From 9e0518fe8e8c901daf1fb6892d8ddc82317755ad Mon Sep 17 00:00:00 2001 From: Todd Fleming Date: Thu, 26 Sep 2019 19:48:58 -0400 Subject: [PATCH 01/50] tester --- .gitmodules | 9 + libraries/abieos | 1 + libraries/eos | 1 + libraries/eos-vm | 1 + .../eosiolib/tester/eosio/chain_types.hpp | 384 +++++++++ libraries/eosiolib/tester/eosio/tester.hpp | 570 ++++++++++++++ .../tester/eosio/tester_intrinsics.cpp | 56 ++ libraries/eosiolib/tester/tester.imports | 18 + modules/ToolsExternalProject.txt | 13 + tools/tester/CMakeLists.txt | 91 +++ tools/tester/src/eosio-tester.cpp | 743 ++++++++++++++++++ 11 files changed, 1887 insertions(+) create mode 160000 libraries/abieos create mode 160000 libraries/eos create mode 160000 libraries/eos-vm create mode 100644 libraries/eosiolib/tester/eosio/chain_types.hpp create mode 100644 libraries/eosiolib/tester/eosio/tester.hpp create mode 100644 libraries/eosiolib/tester/eosio/tester_intrinsics.cpp create mode 100644 libraries/eosiolib/tester/tester.imports create mode 100644 tools/tester/CMakeLists.txt create mode 100644 tools/tester/src/eosio-tester.cpp diff --git a/.gitmodules b/.gitmodules index 9b0f8369c1..9752e710f2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,3 +12,12 @@ [submodule "libraries/native/softfloat"] path = libraries/native/softfloat url = https://github.com/EOSIO/berkeley-softfloat-3.git +[submodule "libraries/eos"] + path = libraries/eos + url = https://github.com/EOSIO/eos.git +[submodule "libraries/abieos"] + path = libraries/abieos + url = https://github.com/EOSIO/abieos.git +[submodule "libraries/eos-vm"] + path = libraries/eos-vm + url = https://github.com/EOSIO/eos-vm.git diff --git a/libraries/abieos b/libraries/abieos new file mode 160000 index 0000000000..1af9a7c4a6 --- /dev/null +++ b/libraries/abieos @@ -0,0 +1 @@ +Subproject commit 1af9a7c4a67273409aa3f7de94e2be0e0e70174e diff --git a/libraries/eos b/libraries/eos new file mode 160000 index 0000000000..7c0b0d388e --- /dev/null +++ b/libraries/eos @@ -0,0 +1 @@ +Subproject commit 7c0b0d388ee5012aa56df7260b53033b721b8c9f diff --git a/libraries/eos-vm b/libraries/eos-vm new file mode 160000 index 0000000000..d85ad1704b --- /dev/null +++ b/libraries/eos-vm @@ -0,0 +1 @@ +Subproject commit d85ad1704b25b9a9833b65cdd6de5d94fa166de8 diff --git a/libraries/eosiolib/tester/eosio/chain_types.hpp b/libraries/eosiolib/tester/eosio/chain_types.hpp new file mode 100644 index 0000000000..7cf5b62e2a --- /dev/null +++ b/libraries/eosiolib/tester/eosio/chain_types.hpp @@ -0,0 +1,384 @@ +#pragma once + +#include + +#ifdef EOSIO_CDT_COMPILATION +# include +#endif + +namespace chain_types { + +#ifdef EOSIO_CDT_COMPILATION +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Winvalid-noreturn" +[[noreturn]] inline void report_error(const std::string& s) { eosio::check(false, s); } +# pragma clang diagnostic pop +#else +[[noreturn]] inline void report_error(const std::string& s) { throw std::runtime_error(s); } +#endif + +template +T read_raw(abieos::input_buffer& bin) { + T result{}; + std::string error; + if (!abieos::read_raw(bin, error, result)) + report_error(error); + return result; +} + +template +T assert_bin_to_native(const std::vector& bin) { + T result{}; + std::string error; + abieos::input_buffer b{ bin.data(), bin.data() + bin.size() }; + if (!abieos::bin_to_native(result, error, b)) + report_error(error); + return result; +} + +struct extension { + uint16_t type = {}; + abieos::input_buffer data = {}; +}; + +ABIEOS_REFLECT(extension) { + ABIEOS_MEMBER(extension, type) + ABIEOS_MEMBER(extension, data) +} + +enum class transaction_status : uint8_t { + executed = 0, // succeed, no error handler executed + soft_fail = 1, // objectively failed (not executed), error handler executed + hard_fail = 2, // objectively failed and error handler objectively failed thus no state change + delayed = 3, // transaction delayed/deferred/scheduled for future execution + expired = 4, // transaction expired and storage space refunded to user +}; + +inline std::string to_string(transaction_status status) { + switch (status) { + case transaction_status::executed: return "executed"; + case transaction_status::soft_fail: return "soft_fail"; + case transaction_status::hard_fail: return "hard_fail"; + case transaction_status::delayed: return "delayed"; + case transaction_status::expired: return "expired"; + } + report_error("unknown status: " + std::to_string((uint8_t)status)); +} + +inline transaction_status get_transaction_status(const std::string& s) { + if (s == "executed") + return transaction_status::executed; + if (s == "soft_fail") + return transaction_status::soft_fail; + if (s == "hard_fail") + return transaction_status::hard_fail; + if (s == "delayed") + return transaction_status::delayed; + if (s == "expired") + return transaction_status::expired; + report_error("unknown status: " + s); +} + +inline bool bin_to_native(transaction_status& status, abieos::bin_to_native_state& state, bool) { + status = transaction_status(read_raw(state.bin)); + return true; +} + +inline bool json_to_native(transaction_status&, abieos::json_to_native_state& state, abieos::event_type, bool) { + state.error = "json_to_native: transaction_status unsupported"; + return false; +} + +inline void native_to_bin(const transaction_status& obj, std::vector& bin) { + abieos::push_raw(bin, static_cast(obj)); +} + +struct permission_level { + abieos::name actor = {}; + abieos::name permission = {}; +}; + +ABIEOS_REFLECT(permission_level) { + ABIEOS_MEMBER(permission_level, actor) + ABIEOS_MEMBER(permission_level, permission) +} + +struct account_auth_sequence { + abieos::name account = {}; + uint64_t sequence = {}; +}; + +ABIEOS_REFLECT(account_auth_sequence) { + ABIEOS_MEMBER(account_auth_sequence, account) + ABIEOS_MEMBER(account_auth_sequence, sequence) +} + +struct account_delta { + abieos::name account = {}; + int64_t delta = {}; +}; + +ABIEOS_REFLECT(account_delta) { + ABIEOS_MEMBER(account_delta, account) + ABIEOS_MEMBER(account_delta, delta) +} + +struct action_receipt_v0 { + abieos::name receiver = {}; + abieos::checksum256 act_digest = {}; + uint64_t global_sequence = {}; + uint64_t recv_sequence = {}; + std::vector auth_sequence = {}; + abieos::varuint32 code_sequence = {}; + abieos::varuint32 abi_sequence = {}; +}; + +ABIEOS_REFLECT(action_receipt_v0) { + ABIEOS_MEMBER(action_receipt_v0, receiver) + ABIEOS_MEMBER(action_receipt_v0, act_digest) + ABIEOS_MEMBER(action_receipt_v0, global_sequence) + ABIEOS_MEMBER(action_receipt_v0, recv_sequence) + ABIEOS_MEMBER(action_receipt_v0, auth_sequence) + ABIEOS_MEMBER(action_receipt_v0, code_sequence) + ABIEOS_MEMBER(action_receipt_v0, abi_sequence) +} + +using action_receipt = std::variant; + +struct action { + abieos::name account = {}; + abieos::name name = {}; + std::vector authorization = {}; + abieos::input_buffer data = {}; +}; + +ABIEOS_REFLECT(action) { + ABIEOS_MEMBER(action, account) + ABIEOS_MEMBER(action, name) + ABIEOS_MEMBER(action, authorization) + ABIEOS_MEMBER(action, data) +} + +struct action_trace_v0 { + abieos::varuint32 action_ordinal = {}; + abieos::varuint32 creator_action_ordinal = {}; + std::optional receipt = {}; + abieos::name receiver = {}; + action act = {}; + bool context_free = {}; + int64_t elapsed = {}; + std::string console = {}; + std::vector account_ram_deltas = {}; + std::optional except = {}; + std::optional error_code = {}; +}; + +ABIEOS_REFLECT(action_trace_v0) { + ABIEOS_MEMBER(action_trace_v0, action_ordinal) + ABIEOS_MEMBER(action_trace_v0, creator_action_ordinal) + ABIEOS_MEMBER(action_trace_v0, receipt) + ABIEOS_MEMBER(action_trace_v0, receiver) + ABIEOS_MEMBER(action_trace_v0, act) + ABIEOS_MEMBER(action_trace_v0, context_free) + ABIEOS_MEMBER(action_trace_v0, elapsed) + ABIEOS_MEMBER(action_trace_v0, console) + ABIEOS_MEMBER(action_trace_v0, account_ram_deltas) + ABIEOS_MEMBER(action_trace_v0, except) + ABIEOS_MEMBER(action_trace_v0, error_code) +} + +using action_trace = std::variant; + +struct partial_transaction_v0 { + abieos::time_point_sec expiration = {}; + uint16_t ref_block_num = {}; + uint32_t ref_block_prefix = {}; + abieos::varuint32 max_net_usage_words = {}; + uint8_t max_cpu_usage_ms = {}; + abieos::varuint32 delay_sec = {}; + std::vector transaction_extensions = {}; + std::vector signatures = {}; + std::vector context_free_data = {}; +}; + +ABIEOS_REFLECT(partial_transaction_v0) { + ABIEOS_MEMBER(partial_transaction_v0, expiration) + ABIEOS_MEMBER(partial_transaction_v0, ref_block_num) + ABIEOS_MEMBER(partial_transaction_v0, ref_block_prefix) + ABIEOS_MEMBER(partial_transaction_v0, max_net_usage_words) + ABIEOS_MEMBER(partial_transaction_v0, max_cpu_usage_ms) + ABIEOS_MEMBER(partial_transaction_v0, delay_sec) + ABIEOS_MEMBER(partial_transaction_v0, transaction_extensions) + ABIEOS_MEMBER(partial_transaction_v0, signatures) + ABIEOS_MEMBER(partial_transaction_v0, context_free_data) +} + +using partial_transaction = std::variant; + +struct recurse_transaction_trace; + +struct transaction_trace_v0 { + abieos::checksum256 id = {}; + transaction_status status = {}; + uint32_t cpu_usage_us = {}; + abieos::varuint32 net_usage_words = {}; + int64_t elapsed = {}; + uint64_t net_usage = {}; + bool scheduled = {}; + std::vector action_traces = {}; + std::optional account_ram_delta = {}; + std::optional except = {}; + std::optional error_code = {}; + std::vector failed_dtrx_trace = {}; + std::optional reserved_do_not_use = {}; +}; + +ABIEOS_REFLECT(transaction_trace_v0) { + ABIEOS_MEMBER(transaction_trace_v0, id) + ABIEOS_MEMBER(transaction_trace_v0, status) + ABIEOS_MEMBER(transaction_trace_v0, cpu_usage_us) + ABIEOS_MEMBER(transaction_trace_v0, net_usage_words) + ABIEOS_MEMBER(transaction_trace_v0, elapsed) + ABIEOS_MEMBER(transaction_trace_v0, net_usage) + ABIEOS_MEMBER(transaction_trace_v0, scheduled) + ABIEOS_MEMBER(transaction_trace_v0, action_traces) + ABIEOS_MEMBER(transaction_trace_v0, account_ram_delta) + ABIEOS_MEMBER(transaction_trace_v0, except) + ABIEOS_MEMBER(transaction_trace_v0, error_code) + ABIEOS_MEMBER(transaction_trace_v0, failed_dtrx_trace) + ABIEOS_MEMBER(transaction_trace_v0, reserved_do_not_use) +} + +using transaction_trace = std::variant; + +struct recurse_transaction_trace { + transaction_trace recurse = {}; +}; + +inline bool bin_to_native(recurse_transaction_trace& obj, abieos::bin_to_native_state& state, bool start) { + return abieos::bin_to_native(obj.recurse, state, start); +} + +inline bool json_to_native(recurse_transaction_trace& obj, abieos::json_to_native_state& state, + abieos::event_type event, bool start) { + return abieos::json_to_native(obj.recurse, state, event, start); +} + +inline void native_to_bin(const recurse_transaction_trace& obj, std::vector& bin) { + abieos::native_to_bin(obj.recurse, bin); +} + +struct producer_key { + abieos::name producer_name = {}; + abieos::public_key block_signing_key = {}; +}; + +ABIEOS_REFLECT(producer_key) { + ABIEOS_MEMBER(producer_key, producer_name) + ABIEOS_MEMBER(producer_key, block_signing_key) +} + +struct producer_schedule { + uint32_t version = {}; + std::vector producers = {}; +}; + +ABIEOS_REFLECT(producer_schedule) { + ABIEOS_MEMBER(producer_schedule, version) + ABIEOS_MEMBER(producer_schedule, producers) +} + +struct transaction_receipt_header { + transaction_status status = {}; + uint32_t cpu_usage_us = {}; + abieos::varuint32 net_usage_words = {}; +}; + +ABIEOS_REFLECT(transaction_receipt_header) { + ABIEOS_MEMBER(transaction_receipt_header, status) + ABIEOS_MEMBER(transaction_receipt_header, cpu_usage_us) + ABIEOS_MEMBER(transaction_receipt_header, net_usage_words) +} + +struct packed_transaction { + std::vector signatures = {}; + uint8_t compression = {}; + abieos::input_buffer packed_context_free_data = {}; + abieos::input_buffer packed_trx = {}; +}; + +ABIEOS_REFLECT(packed_transaction) { + ABIEOS_MEMBER(packed_transaction, signatures) + ABIEOS_MEMBER(packed_transaction, compression) + ABIEOS_MEMBER(packed_transaction, packed_context_free_data) + ABIEOS_MEMBER(packed_transaction, packed_trx) +} + +using transaction_variant = std::variant; + +struct transaction_receipt : transaction_receipt_header { + transaction_variant trx = {}; +}; + +ABIEOS_REFLECT(transaction_receipt) { + ABIEOS_BASE(transaction_receipt_header) + ABIEOS_MEMBER(transaction_receipt, trx) +} + +struct block_header { + abieos::block_timestamp timestamp = {}; + abieos::name producer = {}; + uint16_t confirmed = {}; + abieos::checksum256 previous = {}; + abieos::checksum256 transaction_mroot = {}; + abieos::checksum256 action_mroot = {}; + uint32_t schedule_version = {}; + std::optional new_producers = {}; + std::vector header_extensions = {}; +}; + +ABIEOS_REFLECT(block_header) { + ABIEOS_MEMBER(block_header, timestamp) + ABIEOS_MEMBER(block_header, producer) + ABIEOS_MEMBER(block_header, confirmed) + ABIEOS_MEMBER(block_header, previous) + ABIEOS_MEMBER(block_header, transaction_mroot) + ABIEOS_MEMBER(block_header, action_mroot) + ABIEOS_MEMBER(block_header, schedule_version) + ABIEOS_MEMBER(block_header, new_producers) + ABIEOS_MEMBER(block_header, header_extensions) +} + +struct signed_block_header : block_header { + abieos::signature producer_signature = {}; +}; + +ABIEOS_REFLECT(signed_block_header) { + ABIEOS_BASE(block_header) + ABIEOS_MEMBER(signed_block_header, producer_signature) +} + +struct signed_block : signed_block_header { + std::vector transactions = {}; + std::vector block_extensions = {}; +}; + +ABIEOS_REFLECT(signed_block) { + ABIEOS_BASE(signed_block_header) + ABIEOS_MEMBER(signed_block, transactions) + ABIEOS_MEMBER(signed_block, block_extensions) +} + +struct block_info { + uint32_t block_num = {}; + abieos::checksum256 block_id = {}; + abieos::block_timestamp timestamp = {}; +}; + +ABIEOS_REFLECT(block_info) { + ABIEOS_MEMBER(block_info, block_num) + ABIEOS_MEMBER(block_info, block_id) + ABIEOS_MEMBER(block_info, timestamp) +} + +} // namespace chain_types diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp new file mode 100644 index 0000000000..8196124d8f --- /dev/null +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -0,0 +1,570 @@ +#pragma once +#define FMT_HEADER_ONLY + +#include +#include +#include +#include +#include +#include + +// TODO: move to +namespace std { +inline int fputws(const wchar_t* ws, FILE* stream) { return ::fputws(ws, stream); } +} // namespace std + +#include + +#define TESTER_STRINGIFY1(x) #x +#define TESTER_STRINGIFY(x) TESTER_STRINGIFY1(x) + +#define TESTER_REQUIRE_EQUAL(EXPECTED, ACTUAL) \ + if ((EXPECTED) != (ACTUAL)) \ + eosio::check(false, "expected value doesn't match at " __FILE__ ":" TESTER_STRINGIFY(__LINE__)); + +#define TESTER_REQUIRE(ACTUAL) \ + if (!(ACTUAL)) \ + eosio::check(false, "expected value doesn't match at " __FILE__ ":" TESTER_STRINGIFY(__LINE__)); + +namespace eosio { +namespace internal_use_do_not_use { + + extern "C" void get_args(void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + extern "C" bool reenter(const char* args_begin, const char* args_end, void (*cb)(), void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + extern "C" int32_t open_file(const char* filename_begin, const char* filename_end, const char* mode_begin, + const char* mode_end); + extern "C" void close_file(int32_t file_index); + extern "C" bool write_file(int32_t file_index, const char* content_begin, const char* content_end); + extern "C" bool read_whole_file(const char* filename_begin, const char* filename_end, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + extern "C" int32_t execute(const char* command_begin, const char* command_end); + + extern "C" uint32_t create_chain(); + extern "C" void destroy_chain(uint32_t chain); + extern "C" void start_block(uint32_t chain, int64_t skip_miliseconds); + extern "C" void finish_block(uint32_t chain); + extern "C" void get_head_block_info(uint32_t chain, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + extern "C" void push_transaction(uint32_t chain, const char* args_begin, const char* args_end, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + extern "C" void query_database_chain(uint32_t chain, void* req_begin, void* req_end, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + extern "C" void select_chain_for_db(uint32_t chain_index); + + template + inline void get_args(Alloc_fn alloc_fn) { + return get_args(&alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + + inline const std::vector& get_args() { + static std::optional> bytes; + if (!bytes) { + get_args([&](size_t size) { + bytes.emplace(); + bytes->resize(size); + return bytes->data(); + }); + } + return *bytes; + } + + template + inline bool reenter(const char* args_begin, const char* args_end, void (*fn)(), Alloc_fn alloc_fn) { + return reenter(args_begin, args_end, fn, // + &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + + template + inline bool read_whole_file(const char* filename_begin, const char* filename_end, Alloc_fn alloc_fn) { + return read_whole_file(filename_begin, filename_end, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + + template + inline void get_head_block_info(uint32_t chain, Alloc_fn alloc_fn) { + get_head_block_info(chain, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + + template + inline void push_transaction(uint32_t chain, const char* args_begin, const char* args_end, Alloc_fn alloc_fn) { + push_transaction(chain, args_begin, args_end, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + + template + inline void query_database_chain(uint32_t chain, const T& req, Alloc_fn alloc_fn) { + auto req_data = pack(req); + query_database_chain(chain, req_data.data(), req_data.data() + req_data.size(), &alloc_fn, + [](void* cb_alloc_data, size_t size) -> void* { + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + +} // namespace internal_use_do_not_use + +inline const std::vector& get_args() { + static std::optional> args; + if (!args) { + auto& bytes = internal_use_do_not_use::get_args(); + abieos::input_buffer bin{ bytes.data(), bytes.data() + bytes.size() }; + std::string error; + args.emplace(); + check(abieos::bin_to_native>(*args, error, bin), error); + } + return *args; +} + +template +bool reenter(void (*f)(), E e) { + auto& args = internal_use_do_not_use::get_args(); + std::string error; + bool ok = internal_use_do_not_use::reenter(args.data(), args.data() + args.size(), f, [&](size_t size) { + error.resize(size); + return error.data(); + }); + if (ok) + return true; + e(error); + return false; +} + +inline int32_t open_file(std::string_view filename, std::string_view mode) { + return internal_use_do_not_use::open_file(filename.data(), filename.data() + filename.size(), mode.data(), + mode.data() + mode.size()); +} + +inline void close_file(int32_t file_index) { return internal_use_do_not_use::close_file(file_index); } + +inline bool write_file(int32_t file_index, std::string_view content) { + return internal_use_do_not_use::write_file(file_index, content.data(), content.data() + content.size()); +} + +struct file { + int32_t file_index = -1; + std::string fmt_buffer; + + file(std::string_view filename, std::string_view mode, bool check = true) { + file_index = open_file(filename, mode); + if (check && file_index < 0) + eosio::check(false, "open " + std::string(filename) + " failed"); + } + + file(const file&) = delete; + file(file&&) = delete; + + ~file() { close(); } + + void close() { + if (file_index >= 0) + close_file(file_index); + file_index = -1; + } + + void write(std::string_view content) { write_file(file_index, content); } + + template + void format(const S& format_str, Args&&... args) { + fmt_buffer.clear(); + fmt::format_to(std::back_inserter(fmt_buffer), format_str, std::forward(args)...); + write(fmt_buffer); + } +}; + +template +inline void print_fmt(const S& format_str, Args&&... args) { + static std::string fmt_buffer; + fmt_buffer.clear(); + fmt::format_to(std::back_inserter(fmt_buffer), format_str, std::forward(args)...); + print(fmt_buffer); +} + +inline std::vector read_whole_file(std::string_view filename) { + std::vector result; + if (!internal_use_do_not_use::read_whole_file(filename.data(), filename.data() + filename.size(), [&](size_t size) { + result.resize(size); + return result.data(); + })) + check(false, "read " + std::string(filename) + " failed"); + return result; +} + +inline int32_t execute(std::string_view command) { + return internal_use_do_not_use::execute(command.data(), command.data() + command.size()); +} + +inline abieos::public_key string_to_public_key(std::string_view s) { + std::string error; + abieos::public_key result; + check(abieos::string_to_public_key(result, error, s), error); + return result; +} + +inline abieos::private_key string_to_private_key(std::string_view s) { + std::string error; + abieos::private_key result; + check(abieos::string_to_private_key(result, error, s), error); + return result; +} + +inline public_key convert(const abieos::public_key& k) { return unpack(abieos::native_to_bin(k)); } + +inline abieos::asset string_to_asset(const char* s) { + std::string error; + abieos::asset result; + check(abieos::string_to_asset(result, error, s), error); + return result; +} + +inline symbol convert(abieos::symbol s) { return symbol(s.value); } +inline asset convert(const abieos::asset& a) { return { a.amount, convert(a.sym) }; } +inline asset s2a(const char* s) { return convert(string_to_asset(s)); } + +inline void expect(const chain_types::transaction_trace& ttrace, const char* expected_except = nullptr) { + auto& tt = std::get<0>(ttrace); + if (expected_except) { + if (tt.status == chain_types::transaction_status::executed) + eosio::check(false, "transaction succeeded, but was expected to fail with: " + std::string(expected_except)); + if (!tt.except) + eosio::check(false, "transaction has no failure message. expected: " + std::string(expected_except)); + if (tt.except->find(expected_except) == std::string::npos) + eosio::check(false, "transaction failed with <<<" + *tt.except + ">>>, but was expected to fail with: <<<" + + expected_except + ">>>"); + } else { + if (tt.status == chain_types::transaction_status::executed) + return; + if (tt.except) + eosio::print(*tt.except, "\n"); + eosio::check(false, "transaction has status " + to_string(tt.status)); + } +} + +class test_chain { + private: + uint32_t id; + std::optional head_block_info; + + public: + abieos::public_key default_pub_key = string_to_public_key("EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"); + abieos::private_key default_priv_key = string_to_private_key("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"); + + test_chain() : id{ internal_use_do_not_use::create_chain() } {} + test_chain(const test_chain&) = delete; + test_chain(test_chain&&) = delete; + ~test_chain() { internal_use_do_not_use::destroy_chain(id); } + + test_chain& operator=(const test_chain&) = delete; + test_chain& operator=(test_chain&&) = default; + + // TODO: move definition to someplace else + struct key_weight { + public_key key = {}; + uint16_t weight = {}; + }; + + // TODO: move definition to someplace else + struct permission_level_weight { + permission_level permission = {}; + uint16_t weight = {}; + }; + + // TODO: move definition to someplace else + struct wait_weight { + uint32_t wait_sec = {}; + uint16_t weight = {}; + }; + + // TODO: move definition to someplace else + struct authority { + uint32_t threshold = {}; + std::vector keys = {}; + std::vector accounts = {}; + std::vector waits = {}; + }; + + void start_block(int64_t skip_miliseconds = 0) { + head_block_info.reset(); + if (skip_miliseconds > 500) { + internal_use_do_not_use::start_block(id, skip_miliseconds - 500); + internal_use_do_not_use::start_block(id, 0); + } else { + internal_use_do_not_use::start_block(id, skip_miliseconds); + } + } + + void finish_block() { + head_block_info.reset(); + internal_use_do_not_use::finish_block(id); + } + + void select_chain_for_db() { internal_use_do_not_use::select_chain_for_db(id); } + + const chain_types::block_info& get_head_block_info() { + if (!head_block_info) { + std::vector bin; + internal_use_do_not_use::get_head_block_info(id, [&](size_t size) { + bin.resize(size); + return bin.data(); + }); + head_block_info = chain_types::assert_bin_to_native(bin); + } + return *head_block_info; + } + + void fill_tapos(transaction& t, uint32_t expire_sec = 1) { + auto& info = get_head_block_info(); + t.expiration = time_point_sec(((abieos::time_point)info.timestamp).microseconds / 1'000'000 + expire_sec); + t.ref_block_num = info.block_num; + memcpy(&t.ref_block_prefix, info.block_id.value.data() + 8, sizeof(t.ref_block_prefix)); + } + + transaction make_transaction() { + transaction t{ time_point_sec{} }; + fill_tapos(t); + return t; + } + + transaction make_transaction(std::vector&& actions) { + transaction t{ time_point_sec{} }; + fill_tapos(t); + t.actions = std::move(actions); + return t; + } + + chain_types::transaction_trace push_transaction(const transaction& trx, const std::vector& keys, + const std::vector>& context_free_data = {}, + const std::vector& signatures = {}) { + + std::vector packed_trx = pack(trx); + std::vector args; + abieos::native_to_bin(packed_trx, args); + abieos::native_to_bin(context_free_data, args); + abieos::native_to_bin(signatures, args); + abieos::native_to_bin(keys, args); + std::vector bin; + internal_use_do_not_use::push_transaction(id, args.data(), args.data() + args.size(), [&](size_t size) { + bin.resize(size); + return bin.data(); + }); + return chain_types::assert_bin_to_native(bin); + } + + chain_types::transaction_trace push_transaction(const transaction& trx) { + return push_transaction(trx, { default_priv_key }); + } + + chain_types::transaction_trace transact(std::vector&& actions, const std::vector& keys, + const char* expected_except = nullptr) { + auto trace = push_transaction(make_transaction(std::move(actions)), keys); + expect(trace, expected_except); + return trace; + } + + chain_types::transaction_trace transact(std::vector&& actions, const char* expected_except = nullptr) { + return transact(std::move(actions), { default_priv_key }, expected_except); + } + + chain_types::transaction_trace create_account(name ac, const public_key& pub_key, + const char* expected_except = nullptr) { + authority simple_auth{ + .threshold = 1, + .keys = { { pub_key, 1 } }, + }; + return transact({ action{ { { "eosio"_n, "active"_n } }, + "eosio"_n, + "newaccount"_n, + std::make_tuple("eosio"_n, ac, simple_auth, simple_auth) } }, + expected_except); + } + + chain_types::transaction_trace create_account(name ac, const char* expected_except = nullptr) { + return create_account(ac, convert(default_pub_key), expected_except); + } + + chain_types::transaction_trace create_code_account(name ac, const public_key& pub_key, + const char* expected_except = nullptr) { + authority simple_auth{ + .threshold = 1, + .keys = { { pub_key, 1 } }, + }; + authority code_auth{ + .threshold = 1, + .keys = { { pub_key, 1 } }, + .accounts = { { { ac, "eosio.code"_n }, 1 } }, + }; + return transact({ action{ { { "eosio"_n, "active"_n } }, + "eosio"_n, + "newaccount"_n, + std::make_tuple("eosio"_n, ac, simple_auth, code_auth) } }, + expected_except); + } + + chain_types::transaction_trace create_code_account(name ac, const char* expected_except = nullptr) { + return create_code_account(ac, convert(default_pub_key), expected_except); + } + + chain_types::transaction_trace set_code(name ac, const char* filename, const char* expected_except = nullptr) { + return transact({ action{ { { ac, "active"_n } }, + "eosio"_n, + "setcode"_n, + std::make_tuple(ac, uint8_t{ 0 }, uint8_t{ 0 }, read_whole_file(filename)) } }, + expected_except); + } + + chain_types::transaction_trace create_token(name contract, name signer, name issuer, asset maxsupply, + const char* expected_except = nullptr) { + return transact( + { action{ { { signer, "active"_n } }, contract, "create"_n, std::make_tuple(issuer, maxsupply) } }, + expected_except); + } + + chain_types::transaction_trace issue(const name& contract, const name& issuer, const asset& amount, + const char* expected_except = nullptr) { + return transact({ action{ { { issuer, "active"_n } }, + contract, + "issue"_n, + std::make_tuple(issuer, amount, std::string{ "issuing" }) } }, + expected_except); + } + + chain_types::transaction_trace transfer(const name& contract, const name& from, const name& to, const asset& amount, + const std::string& memo = "", const char* expected_except = nullptr) { + + return transact( + { action{ { { from, "active"_n } }, contract, "transfer"_n, std::make_tuple(from, to, amount, memo) } }, + expected_except); + } + + chain_types::transaction_trace issue_and_transfer(const name& contract, const name& issuer, const name& to, + const asset& amount, const std::string& memo = "", + const char* expected_except = nullptr) { + return transact( + { + action{ { { issuer, "active"_n } }, + contract, + "issue"_n, + std::make_tuple(issuer, amount, std::string{ "issuing" }) }, + action{ + { { issuer, "active"_n } }, contract, "transfer"_n, std::make_tuple(issuer, to, amount, memo) }, + }, + expected_except); + } + + template + inline std::vector query_database(const T& request) { + std::vector result; + internal_use_do_not_use::query_database_chain(id, request, [&result](size_t size) { + result.resize(size); + return result.data(); + }); + return result; + } +}; + +struct test_case { + const char* name; + void (*f)() = {}; + + test_case(const char* name, void (*f)()) : name{ name }, f{ f } { get_tests().push_back(this); } + test_case(const test_case&) = delete; + test_case(test_case&&) = delete; + + static std::vector& get_tests() { + static std::vector tests; + return tests; + } +}; +#define TEST_CASE(N, ...) eosio::test_case N{ #N, __VA_ARGS__ }; + +struct comparison_file { + std::string filename; + eosio::file file; + + comparison_file(const std::string& filename) : filename(filename), file(filename + ".actual", "w") {} + + ~comparison_file() { close(); } + + void write(std::string_view content) { file.write(content); } + + template + void format(const S& format_str, Args&&... args) { + file.format(format_str, std::forward(args)...); + } + + void close() { + file.close(); + bool write = false; + for (auto& arg : get_args()) + if (arg == "--write") + write = true; + if (write) { + auto cmd = "cp " + filename + ".actual " + filename + ".expected"; + if (execute(cmd)) + check(false, "copy failed"); + } else { + check(!execute("colordiff -u " + filename + ".expected " + filename + ".actual"), + "files are different; use --write to overwrite"); + } + } +}; + +inline void run_tests(void (*f)()) { + if (f) + return f(); + int num_passed = 0; + int num_failed = 0; + auto run = [&](auto& test) { + auto ok = reenter(test->f, [&](auto& error) { print(error, "\n"); }); + if (ok) { + ++num_passed; + print_fmt("\033[96m{:60} \033[32mpassed\033[0m\n", std::string{ test->name }); + } else { + ++num_failed; + print_fmt("\033[96m{:60} \033[31mfailed\033[0m\n", std::string{ test->name }); + } + }; + bool manual = false; + auto& args = get_args(); + for (size_t i = 0; i + 1 < args.size(); ++i) { + if (args[i] == "-t") { + manual = true; + bool found = false; + for (auto* test : test_case::get_tests()) { + if (test->name == args[i + 1]) { + found = true; + run(test); + } + } + if (!found) { + ++num_failed; + print_fmt("\033[96m{:60} \033[31mnot found\033[0m\n", args[i + 1]); + } + } + } + if (!manual) + for (auto* test : test_case::get_tests()) run(test); + if (num_passed) + print_fmt("\033[32m{} tests passed\033[0m", num_passed); + if (num_failed) { + if (num_passed) + print_fmt(", "); + print_fmt("\033[31m{} tests failed\033[0m\n", num_failed); + check(false, "test(s) failed"); + } else { + print_fmt("\n"); + } +} + +} // namespace eosio + +#define TEST_ENTRY \ + extern "C" __attribute__((eosio_wasm_entry)) void initialize() {} \ + extern "C" __attribute__((eosio_wasm_entry)) void run_query(void (*f)()) { eosio::run_tests(f); } diff --git a/libraries/eosiolib/tester/eosio/tester_intrinsics.cpp b/libraries/eosiolib/tester/eosio/tester_intrinsics.cpp new file mode 100644 index 0000000000..c33df7a830 --- /dev/null +++ b/libraries/eosiolib/tester/eosio/tester_intrinsics.cpp @@ -0,0 +1,56 @@ +#include +#include + +extern "C" void prints(const char* cstr) { print_range(cstr, cstr + strlen(cstr)); } +extern "C" void prints_l(const char* cstr, uint32_t len) { print_range(cstr, cstr + len); } + +extern "C" void printn(uint64_t n) { + char buffer[13]; + auto end = eosio::name{ n }.write_as_string(buffer, buffer + sizeof(buffer)); + print_range(buffer, end); +} + +extern "C" void printui(uint64_t value) { + char s[21]; + char* ch = s; + do { + *ch++ = '0' + (value % 10); + value /= 10; + } while (value); + std::reverse(s, ch); + print_range(s, ch); +} + +extern "C" void printi(int64_t value) { + if (value < 0) { + prints("-"); + printui(-value); + } else + printui(value); +} + +namespace eosio { +void print(std::string_view sv) { print_range(sv.data(), sv.data() + sv.size()); } + +namespace internal_use_do_not_use { + + extern "C" void eosio_assert(uint32_t test, const char* msg) { + if (!test) + eosio_assert_message(test, msg, strlen(msg)); + } + + extern "C" bool is_feature_activated(void* feature_digest) { + eosio_assert(0, "is_feature_activated is not available"); + return false; + } + + extern "C" void preactivate_feature(void* feature_digest) { + eosio_assert(0, "preactivate_feature is not available"); + } + +} // namespace internal_use_do_not_use +} // namespace eosio + +namespace std { +bool uncaught_exception() noexcept { return false; } +} // namespace std \ No newline at end of file diff --git a/libraries/eosiolib/tester/tester.imports b/libraries/eosiolib/tester/tester.imports new file mode 100644 index 0000000000..913d5df173 --- /dev/null +++ b/libraries/eosiolib/tester/tester.imports @@ -0,0 +1,18 @@ +abort +close_file +create_chain +destroy_chain +eosio_assert_message +execute +finish_block +get_args +get_head_block_info +open_file +print_range +push_transaction +query_database_chain +read_whole_file +reenter +select_chain_for_db +start_block +write_file diff --git a/modules/ToolsExternalProject.txt b/modules/ToolsExternalProject.txt index eb7df5300e..a9c8fda0eb 100644 --- a/modules/ToolsExternalProject.txt +++ b/modules/ToolsExternalProject.txt @@ -16,3 +16,16 @@ ExternalProject_Add( BUILD_ALWAYS 1 DEPENDS EosioClang ) + +ExternalProject_Add( + tester + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=Release -DVERSION_FULL=${VERSION_FULL} -DLLVM_SRCDIR=${CMAKE_SOURCE_DIR}/eosio_llvm -DLLVM_BINDIR=${LLVM_BINDIR} -DLLVM_DIR=${LLVM_BINDIR}/lib/cmake/llvm -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR} + + SOURCE_DIR "${CMAKE_SOURCE_DIR}/tools/tester" + BINARY_DIR "${CMAKE_BINARY_DIR}/tools/tester" + UPDATE_COMMAND "" + PATCH_COMMAND "" + TEST_COMMAND "" + INSTALL_COMMAND "" + BUILD_ALWAYS 1 +) diff --git a/tools/tester/CMakeLists.txt b/tools/tester/CMakeLists.txt new file mode 100644 index 0000000000..5053e401b2 --- /dev/null +++ b/tools/tester/CMakeLists.txt @@ -0,0 +1,91 @@ +cmake_minimum_required (VERSION 3.10) +project(eosio-tester VERSION 0.1 LANGUAGES CXX) +cmake_policy(SET CMP0077 NEW) + +set(default_build_type "Release") +if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to '${default_build_type}' as none was specified.") + set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE + STRING "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) + message(FATAL_ERROR "GCC version must be at least 8.0.") + endif() + if("${CMAKE_GENERATOR}" STREQUAL "Ninja") + add_compile_options(-fdiagnostics-color=always) + endif() +endif() + +if (UNIX AND APPLE) + list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/llvm@4" "/usr/local/opt/gettext") + add_compile_options(-fvisibility=hidden) +endif() + +if ("${OPENSSL_ROOT_DIR}" STREQUAL "") + if (NOT "$ENV{OPENSSL_ROOT_DIR}" STREQUAL "") + set(OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT_DIR}) + set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include) + elseif (APPLE) + set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl") + set(OPENSSL_INCLUDE_DIR "/usr/local/opt/openssl/include") + elseif(UNIX AND NOT APPLE) + set(OPENSSL_ROOT_DIR "/usr/include/openssl") + set(OPENSSL_INCLUDE_DIR "/usr/include/openssl/include") + else() + message(FATAL_ERROR "openssl not found and don't know where to look, please specify OPENSSL_ROOT_DIR") + endif() +endif() + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS ON) +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.14) + +set(Boost_USE_STATIC_LIBS ON) +add_definitions(-DBOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW) +find_package(Boost 1.70 REQUIRED COMPONENTS date_time filesystem chrono system iostreams program_options) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/eos/libraries/fc/CMakeModules") +include(SetupTargetMacros) +include(GNUInstallDirs) +include(VersionMacros) + +add_subdirectory(../../libraries/eos-vm eos-vm EXCLUDE_FROM_ALL) + +set(EOSIO_ROOT_KEY "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV") +set(EOSIO_WASM_OLD_BEHAVIOR "Off") +add_subdirectory(../../libraries/eos/libraries/builtins builtins EXCLUDE_FROM_ALL) +add_subdirectory(../../libraries/eos/libraries/chain chain EXCLUDE_FROM_ALL) +add_subdirectory(../../libraries/eos/libraries/chainbase chainbase EXCLUDE_FROM_ALL) +add_subdirectory(../../libraries/eos/libraries/fc fc EXCLUDE_FROM_ALL) +add_subdirectory(../../libraries/eos/libraries/wabt wabt EXCLUDE_FROM_ALL) +add_subdirectory(../../libraries/eos/libraries/wasm-jit wasm-jit EXCLUDE_FROM_ALL) + +target_include_directories(eosio_chain PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/eos/libraries/wabt" + "${CMAKE_CURRENT_SOURCE_DIR}/builtins" + "${CMAKE_CURRENT_BINARY_DIR}/wabt" +) + +add_executable(eosio-tester src/eosio-tester.cpp) +target_include_directories(eosio-tester + PRIVATE + ../../libraries/abieos/src + ../../libraries/abieos/external/date/include + ../../libraries/abieos/external/rapidjson/include + ../../libraries/eos/libraries/chain/include + ../../libraries/eos/libraries/fc/include + ../../libraries/eos/libraries/wasm-jit/Include + ../../libraries/eos/libraries/wabt/src + ${Boost_INCLUDE_DIR} + ${JS_INCLUDE_DIRS} + ${ROCKSDB_INCLUDE_DIR} +) +target_link_libraries(eosio-tester + eosio_chain wabt Runtime Platform Logging IR fc eos-vm + Boost::date_time Boost::filesystem Boost::chrono Boost::system Boost::iostreams Boost::program_options + -lpthread) diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp new file mode 100644 index 0000000000..4107ad6892 --- /dev/null +++ b/tools/tester/src/eosio-tester.cpp @@ -0,0 +1,743 @@ +#include "../../../libraries/eosiolib/tester/eosio/chain_types.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace abieos::literals; +using namespace std::literals; + +struct callbacks; +using backend_t = eosio::vm::backend; +using rhf_t = eosio::vm::registered_host_functions; + +const static int block_interval_ms = 500; +const static int block_interval_us = block_interval_ms * 1000; + +struct assert_exception : std::exception { + std::string msg; + + assert_exception(std::string&& msg) : msg(std::move(msg)) {} + + const char* what() const noexcept override { return msg.c_str(); } +}; + +struct intrinsic_context { + eosio::chain::controller& control; + eosio::chain::signed_transaction trx; + std::unique_ptr trx_ctx; + std::unique_ptr apply_context; + + intrinsic_context(eosio::chain::controller& control) : control{ control } { + + trx.actions.emplace_back(); + trx.actions.back().account = N(eosio.null); + trx_ctx = std::make_unique(control, trx, trx.id(), fc::time_point::now()); + trx_ctx->init_for_implicit_trx(0); + trx_ctx->exec(); + apply_context = std::make_unique(control, *trx_ctx, 1, 0); + } +}; + +struct test_chain { + eosio::chain::private_key_type producer_key{ "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"s }; + std::unique_ptr cfg; + std::unique_ptr control; + std::unique_ptr intr_ctx; + + test_chain() { + std::string dir = "testchain-XXXXXX"; + if (mkdtemp(dir.data()) != dir.data()) + throw std::runtime_error("could not create directory " + dir); + cfg = std::make_unique(); + cfg->blocks_dir = dir + "/blocks"; + cfg->state_dir = dir + "/state"; + cfg->contracts_console = true; + cfg->genesis.initial_timestamp = fc::time_point::from_iso_string("2020-01-01T00:00:00.000"); + + control = std::make_unique(*cfg); + + control->add_indices(); + control->startup([]() { return false; }, nullptr); + + start_block(); + } + + test_chain(const test_chain&) = delete; + test_chain& operator=(const test_chain&) = delete; + + void mutating() { intr_ctx.reset(); } + + eosio::chain::apply_context& get_apply_context() { + if (!intr_ctx) { + start_if_needed(); + intr_ctx = std::make_unique(*control); + } + return *intr_ctx->apply_context; + } + + void start_block(int64_t skip_miliseconds = 0) { + mutating(); + if (control->is_building_block()) + finish_block(); + control->start_block(control->head_block_time() + fc::microseconds(skip_miliseconds * 1000ll + block_interval_us), + 0, {}); + } + + void start_if_needed() { + mutating(); + if (!control->is_building_block()) + control->start_block(control->head_block_time() + fc::microseconds(block_interval_us), 0, {}); + } + + void finish_block() { + start_if_needed(); + ilog("finish block ${n}", ("n", control->head_block_num())); + control->finalize_block([&](eosio::chain::digest_type d) { return producer_key.sign(d); }); + control->commit_block(); + } +}; + +abieos::checksum256 convert(const eosio::chain::checksum_type& obj) { + abieos::checksum256 result; + static_assert(sizeof(result) == sizeof(obj)); + memcpy(&result, &obj, sizeof(result)); + return result; +} + +chain_types::account_delta convert(const eosio::chain::account_delta& obj) { + chain_types::account_delta result; + result.account.value = obj.account.value; + result.delta = obj.delta; + return result; +} + +chain_types::action_receipt_v0 convert(const eosio::chain::action_receipt& obj) { + chain_types::action_receipt_v0 result; + result.receiver.value = obj.receiver.value; + result.act_digest = convert(obj.act_digest); + result.global_sequence = obj.global_sequence; + result.recv_sequence = obj.recv_sequence; + for (auto& auth : obj.auth_sequence) result.auth_sequence.push_back({ abieos::name{ auth.first }, auth.second }); + result.code_sequence.value = obj.code_sequence.value; + result.abi_sequence.value = obj.abi_sequence.value; + return result; +} + +chain_types::action convert(const eosio::chain::action& obj) { + chain_types::action result; + result.account.value = obj.account.value; + result.name.value = obj.name.value; + for (auto& auth : obj.authorization) + result.authorization.push_back({ abieos::name{ auth.actor.value }, abieos::name{ auth.permission.value } }); + result.data = { obj.data.data(), obj.data.data() + obj.data.size() }; + return result; +} + +chain_types::action_trace_v0 convert(const eosio::chain::action_trace& obj) { + chain_types::action_trace_v0 result; + result.action_ordinal.value = obj.action_ordinal.value; + result.creator_action_ordinal.value = obj.creator_action_ordinal.value; + if (obj.receipt) + result.receipt = convert(*obj.receipt); + result.receiver.value = obj.receiver.value; + result.act = convert(obj.act); + result.context_free = obj.context_free; + result.elapsed = obj.elapsed.count(); + result.console = obj.console; + for (auto& delta : obj.account_ram_deltas) result.account_ram_deltas.push_back(convert(delta)); + if (obj.except) + result.except = obj.except->to_string(); + if (obj.error_code) + result.error_code = *obj.error_code; + return result; +} + +chain_types::transaction_trace_v0 convert(const eosio::chain::transaction_trace& obj) { + chain_types::transaction_trace_v0 result{}; + result.id = convert(obj.id); + if (obj.receipt) { + result.status = (chain_types::transaction_status)obj.receipt->status.value; + result.cpu_usage_us = obj.receipt->cpu_usage_us; + result.net_usage_words = { obj.receipt->net_usage_words.value }; + } else { + result.status = chain_types::transaction_status::hard_fail; + } + result.elapsed = obj.elapsed.count(); + result.net_usage = obj.net_usage; + result.scheduled = obj.scheduled; + for (auto& at : obj.action_traces) result.action_traces.push_back(convert(at)); + if (obj.account_ram_delta) + result.account_ram_delta = convert(*obj.account_ram_delta); + if (obj.except) + result.except = obj.except->to_string(); + if (obj.error_code) + result.error_code = *obj.error_code; + if (obj.failed_dtrx_trace) + result.failed_dtrx_trace.push_back({ chain_types::recurse_transaction_trace{ convert(*obj.failed_dtrx_trace) } }); + return result; +} + +struct contract_row { + uint32_t block_num = {}; + bool present = {}; + abieos::name code = {}; + abieos::name scope = {}; + abieos::name table = {}; + uint64_t primary_key = {}; + abieos::name payer = {}; + abieos::input_buffer value = {}; +}; + +ABIEOS_REFLECT(contract_row) { + ABIEOS_MEMBER(contract_row, block_num); + ABIEOS_MEMBER(contract_row, present); + ABIEOS_MEMBER(contract_row, code); + ABIEOS_MEMBER(contract_row, scope); + ABIEOS_MEMBER(contract_row, table); + ABIEOS_MEMBER(contract_row, primary_key); + ABIEOS_MEMBER(contract_row, payer); + ABIEOS_MEMBER(contract_row, value); +} + +struct file { + FILE* f = nullptr; + + file(FILE* f = nullptr) : f(f) {} + + file(const file&) = delete; + file(file&& src) { *this = std::move(src); } + + ~file() { close(); } + + file& operator=(const file&) = delete; + + file& operator=(file&& src) { + close(); + this->f = src.f; + src.f = nullptr; + return *this; + } + + void close() { + if (f) + fclose(f); + f = nullptr; + } +}; + +namespace eosio { namespace vm { + + template <> + struct wasm_type_converter : linear_memory_access { + auto from_wasm(void* ptr) { return (const char*)ptr; } + }; + + template <> + struct wasm_type_converter : linear_memory_access { + auto from_wasm(void* ptr) { return (char*)ptr; } + }; + + template + struct wasm_type_converter : linear_memory_access { + auto from_wasm(uint32_t val) { + EOS_VM_ASSERT(val != 0, wasm_memory_exception, "references cannot be created for null pointers"); + void* ptr = get_ptr(val); + validate_ptr(ptr, 1); + return eosio::vm::aligned_ref_wrapper{ ptr }; + } + }; + +}} // namespace eosio::vm + +struct state { + const char* wasm; + eosio::vm::wasm_allocator& wa; + backend_t& backend; + std::vector args; + std::vector files; + std::vector> chains; + std::optional selected_chain_index; +}; + +struct push_trx_args { + eosio::chain::bytes transaction; + std::vector context_free_data; + std::vector signatures; + std::vector keys; +}; +FC_REFLECT(push_trx_args, (transaction)(context_free_data)(signatures)(keys)) + +#define DB_WRAPPERS_SIMPLE_SECONDARY(IDX, TYPE) \ + int db_##IDX##_find_secondary(uint64_t code, uint64_t scope, uint64_t table, const TYPE& secondary, \ + uint64_t& primary) { \ + return selected().IDX.find_secondary(code, scope, table, secondary, primary); \ + } \ + int db_##IDX##_find_primary(uint64_t code, uint64_t scope, uint64_t table, TYPE& secondary, uint64_t primary) { \ + return selected().IDX.find_primary(code, scope, table, secondary, primary); \ + } \ + int db_##IDX##_lowerbound(uint64_t code, uint64_t scope, uint64_t table, TYPE& secondary, uint64_t& primary) { \ + return selected().IDX.lowerbound_secondary(code, scope, table, secondary, primary); \ + } \ + int db_##IDX##_upperbound(uint64_t code, uint64_t scope, uint64_t table, TYPE& secondary, uint64_t& primary) { \ + return selected().IDX.upperbound_secondary(code, scope, table, secondary, primary); \ + } \ + int db_##IDX##_end(uint64_t code, uint64_t scope, uint64_t table) { \ + return selected().IDX.end_secondary(code, scope, table); \ + } \ + int db_##IDX##_next(int iterator, uint64_t& primary) { return selected().IDX.next_secondary(iterator, primary); } \ + int db_##IDX##_previous(int iterator, uint64_t& primary) { \ + return selected().IDX.previous_secondary(iterator, primary); \ + } + +#define DB_WRAPPERS_ARRAY_SECONDARY(IDX, ARR_SIZE, ARR_ELEMENT_TYPE) \ + int db_##IDX##_find_secondary(uint64_t code, uint64_t scope, uint64_t table, \ + eosio::chain::array_ptr data, size_t data_len, \ + uint64_t& primary) { \ + EOS_ASSERT(data_len == ARR_SIZE, eosio::chain::db_api_exception, \ + "invalid size of secondary key array for " #IDX \ + ": given ${given} bytes but expected ${expected} bytes", \ + ("given", data_len)("expected", ARR_SIZE)); \ + return selected().IDX.find_secondary(code, scope, table, data, primary); \ + } \ + int db_##IDX##_find_primary(uint64_t code, uint64_t scope, uint64_t table, \ + eosio::chain::array_ptr data, size_t data_len, uint64_t primary) { \ + EOS_ASSERT(data_len == ARR_SIZE, eosio::chain::db_api_exception, \ + "invalid size of secondary key array for " #IDX \ + ": given ${given} bytes but expected ${expected} bytes", \ + ("given", data_len)("expected", ARR_SIZE)); \ + return selected().IDX.find_primary(code, scope, table, data.value, primary); \ + } \ + int db_##IDX##_lowerbound(uint64_t code, uint64_t scope, uint64_t table, \ + eosio::chain::array_ptr data, size_t data_len, uint64_t& primary) { \ + EOS_ASSERT(data_len == ARR_SIZE, eosio::chain::db_api_exception, \ + "invalid size of secondary key array for " #IDX \ + ": given ${given} bytes but expected ${expected} bytes", \ + ("given", data_len)("expected", ARR_SIZE)); \ + return selected().IDX.lowerbound_secondary(code, scope, table, data.value, primary); \ + } \ + int db_##IDX##_upperbound(uint64_t code, uint64_t scope, uint64_t table, \ + eosio::chain::array_ptr data, size_t data_len, uint64_t& primary) { \ + EOS_ASSERT(data_len == ARR_SIZE, eosio::chain::db_api_exception, \ + "invalid size of secondary key array for " #IDX \ + ": given ${given} bytes but expected ${expected} bytes", \ + ("given", data_len)("expected", ARR_SIZE)); \ + return selected().IDX.upperbound_secondary(code, scope, table, data.value, primary); \ + } \ + int db_##IDX##_end(uint64_t code, uint64_t scope, uint64_t table) { \ + return selected().IDX.end_secondary(code, scope, table); \ + } \ + int db_##IDX##_next(int iterator, uint64_t& primary) { return selected().IDX.next_secondary(iterator, primary); } \ + int db_##IDX##_previous(int iterator, uint64_t& primary) { \ + return selected().IDX.previous_secondary(iterator, primary); \ + } + +#define DB_WRAPPERS_FLOAT_SECONDARY(IDX, TYPE) \ + int db_##IDX##_find_secondary(uint64_t code, uint64_t scope, uint64_t table, const TYPE& secondary, \ + uint64_t& primary) { \ + /* EOS_ASSERT(!softfloat_api::is_nan(secondary), transaction_exception, "NaN is not an allowed value for a \ + * secondary key"); */ \ + return selected().IDX.find_secondary(code, scope, table, secondary, primary); \ + } \ + int db_##IDX##_find_primary(uint64_t code, uint64_t scope, uint64_t table, TYPE& secondary, uint64_t primary) { \ + return selected().IDX.find_primary(code, scope, table, secondary, primary); \ + } \ + int db_##IDX##_lowerbound(uint64_t code, uint64_t scope, uint64_t table, TYPE& secondary, uint64_t& primary) { \ + /* EOS_ASSERT(!softfloat_api::is_nan(secondary), transaction_exception, "NaN is not an allowed value for a \ + * secondary key"); */ \ + return selected().IDX.lowerbound_secondary(code, scope, table, secondary, primary); \ + } \ + int db_##IDX##_upperbound(uint64_t code, uint64_t scope, uint64_t table, TYPE& secondary, uint64_t& primary) { \ + /* EOS_ASSERT(!softfloat_api::is_nan(secondary), transaction_exception, "NaN is not an allowed value for a \ + * secondary key"); */ \ + return selected().IDX.upperbound_secondary(code, scope, table, secondary, primary); \ + } \ + int db_##IDX##_end(uint64_t code, uint64_t scope, uint64_t table) { \ + return selected().IDX.end_secondary(code, scope, table); \ + } \ + int db_##IDX##_next(int iterator, uint64_t& primary) { return selected().IDX.next_secondary(iterator, primary); } \ + int db_##IDX##_previous(int iterator, uint64_t& primary) { \ + return selected().IDX.previous_secondary(iterator, primary); \ + } + +struct callbacks { + ::state& state; + + void check_bounds(const char* begin, const char* end) { + if (begin > end) + throw std::runtime_error("bad memory"); + // todo: check bounds + } + + template + T unpack(const char* begin, const char* end) { + fc::datastream ds(begin, end - begin); + T args; + fc::raw::unpack(ds, args); + return args; + } + + template + T unpack_checked(const char* begin, const char* end) { + check_bounds(begin, end); + return unpack(begin, end); + } + + char* alloc(uint32_t cb_alloc_data, uint32_t cb_alloc, uint32_t size) { + // todo: verify cb_alloc isn't in imports + auto result = state.backend.get_context().execute_func_table( + this, eosio::vm::interpret_visitor(state.backend.get_context()), cb_alloc, cb_alloc_data, size); + if (!result || !result->is_a()) + throw std::runtime_error("cb_alloc returned incorrect type"); + char* begin = state.wa.get_base_ptr() + result->to_ui32(); + check_bounds(begin, begin + size); + return begin; + } + + template + void set_data(uint32_t cb_alloc_data, uint32_t cb_alloc, const T& data) { + memcpy(alloc(cb_alloc_data, cb_alloc, data.size()), data.data(), data.size()); + } + + void abort() { throw std::runtime_error("called abort"); } + + void eosio_assert_message(bool test, const char* msg, size_t msg_len) { + check_bounds(msg, msg + msg_len); + if (!test) + throw ::assert_exception(std::string(msg, msg_len)); + } + + void print_range(const char* begin, const char* end) { + check_bounds(begin, end); + std::cerr.write(begin, end - begin); + } + + void get_args(uint32_t cb_alloc_data, uint32_t cb_alloc) { set_data(cb_alloc_data, cb_alloc, state.args); } + + bool reenter(const char* args_begin, const char* args_end, uint32_t f, uint32_t cb_alloc_data, uint32_t cb_alloc) { + check_bounds(args_begin, args_end); + try { + // todo: verify cb isn't in imports + eosio::vm::wasm_allocator wa; + auto code = backend_t::read_wasm(this->state.wasm); + backend_t backend(code); + ::state state{ this->state.wasm, wa, backend, { args_begin, args_end } }; + callbacks cb{ state }; + backend.set_wasm_allocator(&wa); + + rhf_t::resolve(backend.get_module()); + backend.initialize(&cb); + backend(&cb, "env", "initialize"); + backend(&cb, "env", "run_query", f); + return true; + } catch (::assert_exception& e) { + set_data(cb_alloc_data, cb_alloc, std::string_view{ std::string("assert failed: ") + e.what() }); + return false; + } catch (std::exception& e) { + set_data(cb_alloc_data, cb_alloc, std::string_view{ e.what() }); + return false; + } catch (fc::exception& e) { + set_data(cb_alloc_data, cb_alloc, std::string_view{ e.to_string() }); + return false; + } catch (...) { + set_data(cb_alloc_data, cb_alloc, std::string_view{ "unknown exception" }); + return false; + } + } + + int32_t open_file(const char* filename_begin, const char* filename_end, const char* mode_begin, + const char* mode_end) { + check_bounds(filename_begin, filename_end); + check_bounds(mode_begin, mode_end); + file f = fopen(std::string{ filename_begin, filename_end }.c_str(), std::string{ mode_begin, mode_end }.c_str()); + if (!f.f) + return -1; + state.files.push_back(std::move(f)); + return state.files.size() - 1; + } + + file& assert_file(int32_t file_index) { + if (file_index < 0 || file_index >= state.files.size() || !state.files[file_index].f) + throw std::runtime_error("file is not opened"); + return state.files[file_index]; + } + + void close_file(int32_t file_index) { assert_file(file_index).close(); } + + bool write_file(int32_t file_index, const char* content_begin, const char* content_end) { + check_bounds(content_begin, content_end); + auto& f = assert_file(file_index); + return fwrite(content_begin, content_end - content_begin, 1, f.f) == 1; + } + + bool read_whole_file(const char* filename_begin, const char* filename_end, uint32_t cb_alloc_data, + uint32_t cb_alloc) { + check_bounds(filename_begin, filename_end); + file f = fopen(std::string{ filename_begin, filename_end }.c_str(), "r"); + if (!f.f) + return false; + if (fseek(f.f, 0, SEEK_END)) + return false; + auto size = ftell(f.f); + if (size < 0 || (long)(uint32_t)size != size) + return false; + if (fseek(f.f, 0, SEEK_SET)) + return false; + std::vector buf(size); + if (fread(buf.data(), size, 1, f.f) != 1) + return false; + set_data(cb_alloc_data, cb_alloc, buf); + return true; + } + + int32_t execute(const char* command_begin, const char* command_end) { + check_bounds(command_begin, command_end); + return system(std::string{ command_begin, command_end }.c_str()); + } + + test_chain& assert_chain(uint32_t chain) { + if (chain >= state.chains.size() || !state.chains[chain]) + throw std::runtime_error("chain does not exist or was destroyed"); + return *state.chains[chain]; + } + + uint32_t create_chain() { + state.chains.push_back(std::make_unique()); + if (state.chains.size() == 1) + state.selected_chain_index = 0; + return state.chains.size() - 1; + } + + void destroy_chain(uint32_t chain) { + assert_chain(chain); + state.chains[chain].reset(); + } + + void start_block(uint32_t chain_index, int64_t skip_miliseconds) { + assert_chain(chain_index).start_block(skip_miliseconds); + } + + void finish_block(uint32_t chain_index) { assert_chain(chain_index).finish_block(); } + + void get_head_block_info(uint32_t chain_index, uint32_t cb_alloc_data, uint32_t cb_alloc) { + auto& chain = assert_chain(chain_index); + chain_types::block_info info; + info.block_num = chain.control->head_block_num(); + info.block_id = convert(chain.control->head_block_id()); + info.timestamp.slot = chain.control->head_block_state()->header.timestamp.slot; + set_data(cb_alloc_data, cb_alloc, abieos::native_to_bin(info)); + } + + void push_transaction(uint32_t chain_index, const char* args_begin, const char* args_end, uint32_t cb_alloc_data, + uint32_t cb_alloc) { + auto args = unpack_checked(args_begin, args_end); + auto transaction = unpack(args.transaction.data(), + args.transaction.data() + args.transaction.size()); + eosio::chain::signed_transaction signed_trx{ std::move(transaction), std::move(args.signatures), + std::move(args.context_free_data) }; + auto& chain = assert_chain(chain_index); + chain.mutating(); + chain.start_if_needed(); + for (auto& key : args.keys) signed_trx.sign(key, chain.control->get_chain_id()); + auto mtrx = + std::make_shared(signed_trx, eosio::chain::packed_transaction::none); + eosio::chain::transaction_metadata::start_recover_keys( + mtrx, chain.control->get_thread_pool(), chain.control->get_chain_id(), fc::microseconds::maximum()); + auto result = chain.control->push_transaction(mtrx, fc::time_point::maximum(), 2000); + // ilog("${r}", ("r", fc::json::to_pretty_string(result))); + set_data(cb_alloc_data, cb_alloc, abieos::native_to_bin(chain_types::transaction_trace{ convert(*result) })); + } + + void query_database(uint32_t chain_index, const char* req_begin, const char* req_end, uint32_t cb_alloc_data, + uint32_t cb_alloc) { + auto& chain = assert_chain(chain_index); + check_bounds(req_begin, req_end); + abieos::input_buffer query_bin{ req_begin, req_end }; + abieos::name query_name; + abieos::bin_to_native(query_name, query_bin); + if (query_name == "cr.ctsp"_n) + return set_data(cb_alloc_data, cb_alloc, query_contract_row_range_code_table_scope_pk(chain, query_bin)); + throw std::runtime_error("query_database: unknown query: " + (std::string)query_name); + } + + std::vector query_contract_row_range_code_table_scope_pk(test_chain& chain, abieos::input_buffer query_bin) { + auto snapshot_block = abieos::bin_to_native(query_bin); + auto first_code = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; + auto first_table = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; + auto first_scope = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; + auto first_primary_key = abieos::bin_to_native(query_bin); + auto last_code = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; + auto last_table = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; + auto last_scope = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; + auto last_primary_key = abieos::bin_to_native(query_bin); + auto max_results = abieos::bin_to_native(query_bin); + + if (first_code != last_code) + throw std::runtime_error("query_database: first.code != last.code"); + if (first_table != last_table) + throw std::runtime_error("query_database: first.table != last.table"); + + auto& db = chain.control->db(); + const auto& table_index = db.get_index(); + const auto& kv_index = db.get_index(); + + std::vector> rows; + for (auto table_it = table_index.lower_bound(std::make_tuple(first_code, first_scope, eosio::chain::name())); + table_it != table_index.end(); ++table_it) { + if (table_it->code != first_code || table_it->scope > last_scope || rows.size() >= max_results) + break; + if (table_it->table != first_table) + continue; + for (auto kv_it = kv_index.lower_bound(std::make_tuple(table_it->id, first_primary_key)); + kv_it != kv_index.end(); ++kv_it) { + if (kv_it->t_id != table_it->id || kv_it->primary_key > last_primary_key || rows.size() >= max_results) + break; + rows.emplace_back(abieos::native_to_bin( + contract_row{ uint32_t(0), + bool(true), + abieos::name{ table_it->code.value }, + abieos::name{ table_it->scope.value }, + abieos::name{ table_it->table.value }, + kv_it->primary_key, + abieos::name{ kv_it->payer.value }, + { kv_it->value.data(), kv_it->value.data() + kv_it->value.size() } })); + }; + } + return abieos::native_to_bin(rows); + } // query_contract_row_range_code_table_scope_pk + + void select_chain_for_db(uint32_t chain_index) { + assert_chain(chain_index); + state.selected_chain_index = chain_index; + } + + eosio::chain::apply_context& selected() { + if (!state.selected_chain_index || *state.selected_chain_index >= state.chains.size() || + !state.chains[*state.selected_chain_index]) + throw std::runtime_error("select_chain_for_db() must be called before using multi_index"); + return state.chains[*state.selected_chain_index]->get_apply_context(); + } + + // clang-format off + int db_get_i64(int iterator, char* buffer, size_t buffer_size) {return selected().db_get_i64(iterator, buffer, buffer_size);} + int db_next_i64(int iterator, uint64_t& primary) {return selected().db_next_i64(iterator, primary);} + int db_previous_i64(int iterator, uint64_t& primary) {return selected().db_previous_i64(iterator, primary);} + int db_find_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id) {return selected().db_find_i64(code, scope, table, id);} + int db_lowerbound_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id) {return selected().db_lowerbound_i64(code, scope, table, id);} + int db_upperbound_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id) {return selected().db_upperbound_i64(code, scope, table, id);} + int db_end_i64(uint64_t code, uint64_t scope, uint64_t table) {return selected().db_end_i64(code, scope, table);} + + DB_WRAPPERS_SIMPLE_SECONDARY(idx64, uint64_t) + DB_WRAPPERS_SIMPLE_SECONDARY(idx128, unsigned __int128) + DB_WRAPPERS_ARRAY_SECONDARY(idx256, 2, unsigned __int128) + DB_WRAPPERS_FLOAT_SECONDARY(idx_double, float64_t) + DB_WRAPPERS_FLOAT_SECONDARY(idx_long_double, float128_t) + // clang-format on +}; // callbacks + +#define DB_REGISTER_SECONDARY(IDX) \ + rhf_t::add("env", "db_" #IDX \ + "_find_secondary"); \ + rhf_t::add("env", \ + "db_" #IDX "_find_primary"); \ + rhf_t::add("env", \ + "db_" #IDX "_lowerbound"); \ + rhf_t::add("env", \ + "db_" #IDX "_upperbound"); \ + rhf_t::add("env", "db_" #IDX "_end"); \ + rhf_t::add("env", "db_" #IDX "_next"); \ + rhf_t::add("env", "db_" #IDX "_previous"); + +void register_callbacks() { + rhf_t::add("env", "abort"); + rhf_t::add("env", "eosio_assert_message"); + rhf_t::add("env", "print_range"); + rhf_t::add("env", "get_args"); + rhf_t::add("env", "reenter"); + rhf_t::add("env", "open_file"); + rhf_t::add("env", "close_file"); + rhf_t::add("env", "write_file"); + rhf_t::add("env", "read_whole_file"); + rhf_t::add("env", "execute"); + rhf_t::add("env", "create_chain"); + rhf_t::add("env", "destroy_chain"); + rhf_t::add("env", "start_block"); + rhf_t::add("env", "finish_block"); + rhf_t::add("env", "get_head_block_info"); + rhf_t::add("env", "push_transaction"); + rhf_t::add("env", "query_database_chain"); + rhf_t::add("env", "select_chain_for_db"); + + rhf_t::add("env", "db_get_i64"); + rhf_t::add("env", "db_next_i64"); + rhf_t::add("env", "db_previous_i64"); + rhf_t::add("env", "db_find_i64"); + rhf_t::add("env", "db_lowerbound_i64"); + rhf_t::add("env", "db_upperbound_i64"); + rhf_t::add("env", "db_end_i64"); + DB_REGISTER_SECONDARY(idx64) + DB_REGISTER_SECONDARY(idx128) + // DB_REGISTER_SECONDARY(idx256) + DB_REGISTER_SECONDARY(idx_double) + DB_REGISTER_SECONDARY(idx_long_double) +} + +static void run(const char* wasm, const std::vector& args) { + eosio::vm::wasm_allocator wa; + auto code = backend_t::read_wasm(wasm); + backend_t backend(code); + ::state state{ wasm, wa, backend, abieos::native_to_bin(args) }; + callbacks cb{ state }; + backend.set_wasm_allocator(&wa); + + rhf_t::resolve(backend.get_module()); + backend.initialize(&cb); + // backend(&cb, "env", "initialize"); todo: reenable after CDT change + backend(&cb, "env", "run_query", 0); +} + +const char usage[] = "usage: tester [-h or --help] [-v or --verbose] file.wasm [args for wasm]\n"; + +int main(int argc, char* argv[]) { + fc::logger::get(DEFAULT_LOGGER).set_log_level(fc::log_level::off); + + bool show_usage = false; + bool error = false; + int next_arg = 1; + while (next_arg < argc && argv[next_arg][0] == '-') { + if (!strcmp(argv[next_arg], "-h") || !strcmp(argv[next_arg], "--help")) + show_usage = true; + else if (!strcmp(argv[next_arg], "-v") || !strcmp(argv[next_arg], "--verbose")) + fc::logger::get(DEFAULT_LOGGER).set_log_level(fc::log_level::debug); + else { + std::cerr << "unknown option: " << argv[next_arg] << "\n"; + error = true; + } + ++next_arg; + } + if (next_arg >= argc) + error = true; + if (show_usage || error) { + std::cerr << usage; + return error; + } + try { + std::vector args{ argv + next_arg + 1, argv + argc }; + register_callbacks(); + run(argv[next_arg], args); + return 0; + } catch (::assert_exception& e) { + std::cerr << "assert failed: " << e.what() << "\n"; + } catch (eosio::vm::exception& e) { + std::cerr << "vm::exception: " << e.detail() << "\n"; + } catch (std::exception& e) { std::cerr << "std::exception: " << e.what() << "\n"; } catch (fc::exception& e) { + std::cerr << "fc::exception: " << e.to_string() << "\n"; + } + return 1; +} From ed37c0d766acccb47dd5bf2c13f55f982223ee13 Mon Sep 17 00:00:00 2001 From: Todd Fleming Date: Fri, 27 Sep 2019 15:31:32 -0400 Subject: [PATCH 02/50] tester --- .gitmodules | 3 + CMakeLists.txt | 4 + libraries/eosiolib/CMakeLists.txt | 13 + libraries/eosiolib/tester/eosio/database.hpp | 168 +++++++++ .../eosiolib/tester/eosio/shared_memory.hpp | 66 ++++ libraries/eosiolib/tester/eosio/tester.hpp | 76 ++-- .../tester/eosio/tester_intrinsics.cpp | 56 --- libraries/eosiolib/tester/fpconv.c | 334 ++++++++++++++++++ libraries/eosiolib/tester/fpconv.h | 41 +++ libraries/eosiolib/tester/fpconv.license | 23 ++ libraries/eosiolib/tester/powers.h | 76 ++++ libraries/eosiolib/tester/tester.imports | 18 - .../eosiolib/tester/tester_intrinsics.cpp | 116 ++++++ tools/include/compiler_options.hpp.in | 37 +- tools/tester/src/eosio-tester.cpp | 8 +- 15 files changed, 909 insertions(+), 130 deletions(-) create mode 100644 libraries/eosiolib/tester/eosio/database.hpp create mode 100644 libraries/eosiolib/tester/eosio/shared_memory.hpp delete mode 100644 libraries/eosiolib/tester/eosio/tester_intrinsics.cpp create mode 100644 libraries/eosiolib/tester/fpconv.c create mode 100644 libraries/eosiolib/tester/fpconv.h create mode 100644 libraries/eosiolib/tester/fpconv.license create mode 100644 libraries/eosiolib/tester/powers.h delete mode 100644 libraries/eosiolib/tester/tester.imports create mode 100644 libraries/eosiolib/tester/tester_intrinsics.cpp diff --git a/.gitmodules b/.gitmodules index 9752e710f2..daa65a895d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -21,3 +21,6 @@ [submodule "libraries/eos-vm"] path = libraries/eos-vm url = https://github.com/EOSIO/eos-vm.git +[submodule "libraries/fmt"] + path = libraries/fmt + url = https://github.com/fmtlib/fmt.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a9e75df7a..9366987b67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,6 +93,10 @@ configure_file(${CMAKE_SOURCE_DIR}/libraries/boost/boost.license ${CMAKE_BINARY_ configure_file(${CMAKE_SOURCE_DIR}/tools/external/wabt/LICENSE ${CMAKE_BINARY_DIR}/licenses/wabt.license COPYONLY) configure_file(${CMAKE_SOURCE_DIR}/tools/jsoncons/LICENSE ${CMAKE_BINARY_DIR}/licenses/jsoncons.license COPYONLY) configure_file(${CMAKE_SOURCE_DIR}/LICENSE ${CMAKE_BINARY_DIR}/licenses/eosio.cdt.license COPYONLY) +configure_file(${CMAKE_SOURCE_DIR}/libraries/eosiolib/tester/fpconv.license ${CMAKE_BINARY_DIR}/licenses/fpconv.license COPYONLY) +configure_file(${CMAKE_SOURCE_DIR}/libraries/fmt/LICENSE.rst ${CMAKE_BINARY_DIR}/licenses/fmt.license COPYONLY) +configure_file(${CMAKE_SOURCE_DIR}/libraries/abieos/external/date/LICENSE.txt ${CMAKE_BINARY_DIR}/licenses/date.license COPYONLY) +configure_file(${CMAKE_SOURCE_DIR}/libraries/abieos/external/rapidjson/license.txt ${CMAKE_BINARY_DIR}/licenses/rapidjson.license COPYONLY) include(modules/TestsExternalProject.txt) diff --git a/libraries/eosiolib/CMakeLists.txt b/libraries/eosiolib/CMakeLists.txt index 6622b9f4f4..e8c6966938 100644 --- a/libraries/eosiolib/CMakeLists.txt +++ b/libraries/eosiolib/CMakeLists.txt @@ -18,6 +18,11 @@ add_library(eosio_cmem memory.cpp ${HEADERS}) +add_library(eosio_tester + tester/tester_intrinsics.cpp + tester/fpconv.c + ${HEADERS}) + add_native_library(native_eosio eosiolib.cpp crypto.cpp @@ -42,6 +47,14 @@ add_custom_command( TARGET eosio POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${BASE_BINARY_DIR}/lib ) add_custom_command( TARGET eosio_dsm POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${BASE_BINARY_DIR}/lib ) add_custom_command( TARGET eosio_cmem POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${BASE_BINARY_DIR}/lib ) +add_custom_command( TARGET eosio_tester POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${BASE_BINARY_DIR}/lib ) add_custom_command( TARGET native_eosio POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${BASE_BINARY_DIR}/lib ) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../eosiolib DESTINATION ${BASE_BINARY_DIR}/include FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos.h DESTINATION ${BASE_BINARY_DIR}/include/abieos) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos.hpp DESTINATION ${BASE_BINARY_DIR}/include/abieos) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos_numeric.hpp DESTINATION ${BASE_BINARY_DIR}/include/abieos) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos_ripemd160.hpp DESTINATION ${BASE_BINARY_DIR}/include/abieos) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/external/date/include/date DESTINATION ${BASE_BINARY_DIR}/include/date FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/external/rapidjson/include/rapidjson DESTINATION ${BASE_BINARY_DIR}/include/rapidjson FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../fmt/include/fmt DESTINATION ${BASE_BINARY_DIR}/include/fmt FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") diff --git a/libraries/eosiolib/tester/eosio/database.hpp b/libraries/eosiolib/tester/eosio/database.hpp new file mode 100644 index 0000000000..6be0806cd4 --- /dev/null +++ b/libraries/eosiolib/tester/eosio/database.hpp @@ -0,0 +1,168 @@ +// copyright defined in LICENSE.txt + +#pragma once + +#include +#include +#include +#include + +namespace eosio { + +/// \group increment_key Increment Key +/// Increment a database key. Return true if the result wrapped. +inline bool increment_key(uint8_t& key) { return !++key; } + +/// \group increment_key +inline bool increment_key(uint16_t& key) { return !++key; } + +/// \group increment_key +inline bool increment_key(uint32_t& key) { return !++key; } + +/// \group increment_key +inline bool increment_key(uint64_t& key) { return !++key; } + +/// \group increment_key +inline bool increment_key(uint128_t& key) { return !++key; } + +/// \group increment_key +inline bool increment_key(name& key) { return !++key.value; } + +/// \group increment_key +inline bool increment_key(checksum256& key) { return increment_key(key.data()[1]) && increment_key(key.data()[0]); } + +/// A row in a contract's table +struct contract_row { + uint32_t block_num = {}; + bool present = {}; + name code = {}; + name scope = {}; + name table = {}; + uint64_t primary_key = {}; + name payer = {}; + shared_memory> value = {}; +}; + +/// Pass this to `query_database` to get `contract_row` for a range of keys. +/// +/// The query results are sorted by `key`. Every record has a different key. +/// ```c++ +/// struct key { +/// name code = {}; +/// name table = {}; +/// name scope = {}; +/// uint64_t primary_key = {}; +/// +/// // Construct the key from `data` +/// static key from_data(const contract_row& data); +/// }; +/// ``` +struct query_contract_row_range_code_table_scope_pk { + struct key { + name code = {}; + name table = {}; + name scope = {}; + uint64_t primary_key = {}; + + // Extract the key from `data` + static key from_data(const contract_row& data) { + return { + .code = data.code, + .table = data.table, + .scope = data.scope, + .primary_key = data.primary_key, + }; + } + }; + + /// Identifies query type. Do not modify this field. + name query_name = "cr.ctsp"_n; + + /// Look at this point of time in history + uint32_t snapshot_block = {}; + + /// Query records with keys in the range [`first`, `last`]. + key first = {}; + + /// Query records with keys in the range [`first`, `last`]. + key last = {}; + + /// Maximum results to return. The wasm-ql server may cap the number of results to a smaller number. + uint32_t max_results = {}; +}; + +/// \group increment_key +inline bool increment_key(query_contract_row_range_code_table_scope_pk::key& key) { + return increment_key(key.primary_key) && // + increment_key(key.scope) && // + increment_key(key.table) && // + increment_key(key.code); +} + +/// \output_section Query Database +/// Query the database. `request` must be one of the `query_*` structs. Returns result in serialized form. +/// The serialized form is the same as `vector>`'s serialized form. Each inner vector contains the +/// serialized form of a record. The record type varies with query. +/// +/// Use `for_each_query_result` or `for_each_contract_row` to iterate through the result. +template +inline std::vector query_database(const T& request) { + std::vector result; + query_database(request, [&result](size_t size) { + result.resize(size); + return result.data(); + }); + return result; +} + +/// Unpack each record of a query result and call `f(record)`. `T` is the record type. +template +bool for_each_query_result(const std::vector& bytes, F f) { + datastream ds(bytes.data(), bytes.size()); + unsigned_int size; + ds >> size; + for (uint32_t i = 0; i < size.value; ++i) { + shared_memory> record{}; + ds >> record; + T r; + *record >> r; + if (!f(r)) + return false; + } + return true; +} + +/// Use with `query_contract_row_*`. Unpack each row of a query result and call +/// `f(row, data)`. `row` is an instance of `contract_row`. `data` is the unpacked +/// contract-specific data. `T` identifies the type of `data`. +template +bool for_each_contract_row(const std::vector& bytes, F f) { + return for_each_query_result(bytes, [&](contract_row& row) { + T p; + if (row.present && row.value->remaining()) { + // todo: don't assert if serialization fails + *row.value >> p; + if (!f(row, &p)) + return false; + } else { + if (!f(row, (T*)nullptr)) + return false; + } + return true; + }); +} + +/// \exclude +extern "C" void query_database(void* req_begin, void* req_end, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + +/// \exclude +template +inline void query_database(const T& req, Alloc_fn alloc_fn) { + auto req_data = pack(req); + query_database( + req_data.data(), req_data.data() + req_data.size(), &alloc_fn, + [](void* cb_alloc_data, size_t size) -> void* { return (*reinterpret_cast(cb_alloc_data))(size); }); +} + +} // namespace eosio diff --git a/libraries/eosiolib/tester/eosio/shared_memory.hpp b/libraries/eosiolib/tester/eosio/shared_memory.hpp new file mode 100644 index 0000000000..83cdfe6787 --- /dev/null +++ b/libraries/eosiolib/tester/eosio/shared_memory.hpp @@ -0,0 +1,66 @@ +// copyright defined in LICENSE.txt + +#pragma once +#include +#include + +namespace eosio { + +/// Tag objects which share memory with streams or with other things. These reduce +/// deserialization overhead, but require the source memory isn't freed and remains untouched. +template +struct shared_memory { + T value = {}; + + T& operator*() { return value; } + const T& operator*() const { return value; } + T* operator->() { return &value; } + const T* operator->() const { return &value; } +}; + +/// \exclude +template +struct shared_memory> { + datastream value = { nullptr, 0 }; + + datastream& operator*() { return value; } + const datastream& operator*() const { return value; } + datastream* operator->() { return &value; } + const datastream* operator->() const { return &value; } +}; + +template +inline datastream& operator>>(datastream& ds, shared_memory>& dest) { + unsigned_int size; + ds >> size; + dest.value = datastream{ ds.pos(), size }; + ds.skip(size); + return ds; +} + +template +inline datastream& operator<<(datastream& ds, const shared_memory>& obj) { + unsigned_int size = obj.value.remaining(); + ds << size; + ds.write(obj.value.pos(), size); + return ds; +} + +template +inline datastream& operator>>(datastream& ds, shared_memory& dest) { + unsigned_int size; + ds >> size; + dest.value = std::string_view{ ds.pos(), size }; + ds.skip(size); + return ds; +} + +template +inline datastream& operator<<(datastream& ds, const shared_memory& obj) { + unsigned_int size = obj.value.size(); + ds << size; + ds.write(obj.value.begin(), size); + return ds; +} + +}; // namespace eosio diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index 8196124d8f..4592211333 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -1,10 +1,10 @@ #pragma once #define FMT_HEADER_ONLY +#include #include #include #include -#include #include #include @@ -26,31 +26,33 @@ inline int fputws(const wchar_t* ws, FILE* stream) { return ::fputws(ws, stream) if (!(ACTUAL)) \ eosio::check(false, "expected value doesn't match at " __FILE__ ":" TESTER_STRINGIFY(__LINE__)); +#define TESTER_INTRINSIC extern "C" __attribute__((eosio_wasm_import)) + namespace eosio { namespace internal_use_do_not_use { - extern "C" void get_args(void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - extern "C" bool reenter(const char* args_begin, const char* args_end, void (*cb)(), void* cb_alloc_data, - void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - extern "C" int32_t open_file(const char* filename_begin, const char* filename_end, const char* mode_begin, - const char* mode_end); - extern "C" void close_file(int32_t file_index); - extern "C" bool write_file(int32_t file_index, const char* content_begin, const char* content_end); - extern "C" bool read_whole_file(const char* filename_begin, const char* filename_end, void* cb_alloc_data, - void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - extern "C" int32_t execute(const char* command_begin, const char* command_end); - - extern "C" uint32_t create_chain(); - extern "C" void destroy_chain(uint32_t chain); - extern "C" void start_block(uint32_t chain, int64_t skip_miliseconds); - extern "C" void finish_block(uint32_t chain); - extern "C" void get_head_block_info(uint32_t chain, void* cb_alloc_data, - void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - extern "C" void push_transaction(uint32_t chain, const char* args_begin, const char* args_end, void* cb_alloc_data, - void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - extern "C" void query_database_chain(uint32_t chain, void* req_begin, void* req_end, void* cb_alloc_data, - void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - extern "C" void select_chain_for_db(uint32_t chain_index); + TESTER_INTRINSIC void get_args(void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC bool reenter(const char* args_begin, const char* args_end, void (*cb)(), void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC int32_t open_file(const char* filename_begin, const char* filename_end, const char* mode_begin, + const char* mode_end); + TESTER_INTRINSIC void close_file(int32_t file_index); + TESTER_INTRINSIC bool write_file(int32_t file_index, const char* content_begin, const char* content_end); + TESTER_INTRINSIC bool read_whole_file(const char* filename_begin, const char* filename_end, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC int32_t execute(const char* command_begin, const char* command_end); + + TESTER_INTRINSIC uint32_t create_chain(); + TESTER_INTRINSIC void destroy_chain(uint32_t chain); + TESTER_INTRINSIC void start_block(uint32_t chain, int64_t skip_miliseconds); + TESTER_INTRINSIC void finish_block(uint32_t chain); + TESTER_INTRINSIC void get_head_block_info(uint32_t chain, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC void push_transaction(uint32_t chain, const char* args_begin, const char* args_end, + void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC void query_database_chain(uint32_t chain, void* req_begin, void* req_end, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC void select_chain_for_db(uint32_t chain_index); template inline void get_args(Alloc_fn alloc_fn) { @@ -264,32 +266,6 @@ class test_chain { test_chain& operator=(const test_chain&) = delete; test_chain& operator=(test_chain&&) = default; - // TODO: move definition to someplace else - struct key_weight { - public_key key = {}; - uint16_t weight = {}; - }; - - // TODO: move definition to someplace else - struct permission_level_weight { - permission_level permission = {}; - uint16_t weight = {}; - }; - - // TODO: move definition to someplace else - struct wait_weight { - uint32_t wait_sec = {}; - uint16_t weight = {}; - }; - - // TODO: move definition to someplace else - struct authority { - uint32_t threshold = {}; - std::vector keys = {}; - std::vector accounts = {}; - std::vector waits = {}; - }; - void start_block(int64_t skip_miliseconds = 0) { head_block_info.reset(); if (skip_miliseconds > 500) { @@ -567,4 +543,4 @@ inline void run_tests(void (*f)()) { #define TEST_ENTRY \ extern "C" __attribute__((eosio_wasm_entry)) void initialize() {} \ - extern "C" __attribute__((eosio_wasm_entry)) void run_query(void (*f)()) { eosio::run_tests(f); } + extern "C" __attribute__((eosio_wasm_entry)) void start(void (*f)()) { eosio::run_tests(f); } diff --git a/libraries/eosiolib/tester/eosio/tester_intrinsics.cpp b/libraries/eosiolib/tester/eosio/tester_intrinsics.cpp deleted file mode 100644 index c33df7a830..0000000000 --- a/libraries/eosiolib/tester/eosio/tester_intrinsics.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include - -extern "C" void prints(const char* cstr) { print_range(cstr, cstr + strlen(cstr)); } -extern "C" void prints_l(const char* cstr, uint32_t len) { print_range(cstr, cstr + len); } - -extern "C" void printn(uint64_t n) { - char buffer[13]; - auto end = eosio::name{ n }.write_as_string(buffer, buffer + sizeof(buffer)); - print_range(buffer, end); -} - -extern "C" void printui(uint64_t value) { - char s[21]; - char* ch = s; - do { - *ch++ = '0' + (value % 10); - value /= 10; - } while (value); - std::reverse(s, ch); - print_range(s, ch); -} - -extern "C" void printi(int64_t value) { - if (value < 0) { - prints("-"); - printui(-value); - } else - printui(value); -} - -namespace eosio { -void print(std::string_view sv) { print_range(sv.data(), sv.data() + sv.size()); } - -namespace internal_use_do_not_use { - - extern "C" void eosio_assert(uint32_t test, const char* msg) { - if (!test) - eosio_assert_message(test, msg, strlen(msg)); - } - - extern "C" bool is_feature_activated(void* feature_digest) { - eosio_assert(0, "is_feature_activated is not available"); - return false; - } - - extern "C" void preactivate_feature(void* feature_digest) { - eosio_assert(0, "preactivate_feature is not available"); - } - -} // namespace internal_use_do_not_use -} // namespace eosio - -namespace std { -bool uncaught_exception() noexcept { return false; } -} // namespace std \ No newline at end of file diff --git a/libraries/eosiolib/tester/fpconv.c b/libraries/eosiolib/tester/fpconv.c new file mode 100644 index 0000000000..bbcc9dcb81 --- /dev/null +++ b/libraries/eosiolib/tester/fpconv.c @@ -0,0 +1,334 @@ +/// From https://github.com/night-shift/fpconv +/// Boost Software License 1.0 +/// See accompanying license file + +#include +#include + +#include "fpconv.h" +#include "powers.h" + +#define fracmask 0x000FFFFFFFFFFFFFU +#define expmask 0x7FF0000000000000U +#define hiddenbit 0x0010000000000000U +#define signmask 0x8000000000000000U +#define expbias (1023 + 52) + +#define absv(n) ((n) < 0 ? -(n) : (n)) +#define minv(a, b) ((a) < (b) ? (a) : (b)) + +static uint64_t tens[] = { 10000000000000000000U, + 1000000000000000000U, + 100000000000000000U, + 10000000000000000U, + 1000000000000000U, + 100000000000000U, + 10000000000000U, + 1000000000000U, + 100000000000U, + 10000000000U, + 1000000000U, + 100000000U, + 10000000U, + 1000000U, + 100000U, + 10000U, + 1000U, + 100U, + 10U, + 1U }; + +static inline uint64_t get_dbits(double d) { + union { + double dbl; + uint64_t i; + } dbl_bits = { d }; + + return dbl_bits.i; +} + +static Fp build_fp(double d) { + uint64_t bits = get_dbits(d); + + Fp fp; + fp.frac = bits & fracmask; + fp.exp = (bits & expmask) >> 52; + + if (fp.exp) { + fp.frac += hiddenbit; + fp.exp -= expbias; + + } else { + fp.exp = -expbias + 1; + } + + return fp; +} + +static void normalize(Fp* fp) { + while ((fp->frac & hiddenbit) == 0) { + fp->frac <<= 1; + fp->exp--; + } + + int shift = 64 - 52 - 1; + fp->frac <<= shift; + fp->exp -= shift; +} + +static void get_normalized_boundaries(Fp* fp, Fp* lower, Fp* upper) { + upper->frac = (fp->frac << 1) + 1; + upper->exp = fp->exp - 1; + + while ((upper->frac & (hiddenbit << 1)) == 0) { + upper->frac <<= 1; + upper->exp--; + } + + int u_shift = 64 - 52 - 2; + + upper->frac <<= u_shift; + upper->exp = upper->exp - u_shift; + + int l_shift = fp->frac == hiddenbit ? 2 : 1; + + lower->frac = (fp->frac << l_shift) - 1; + lower->exp = fp->exp - l_shift; + + lower->frac <<= lower->exp - upper->exp; + lower->exp = upper->exp; +} + +static Fp multiply(Fp* a, Fp* b) { + const uint64_t lomask = 0x00000000FFFFFFFF; + + uint64_t ah_bl = (a->frac >> 32) * (b->frac & lomask); + uint64_t al_bh = (a->frac & lomask) * (b->frac >> 32); + uint64_t al_bl = (a->frac & lomask) * (b->frac & lomask); + uint64_t ah_bh = (a->frac >> 32) * (b->frac >> 32); + + uint64_t tmp = (ah_bl & lomask) + (al_bh & lomask) + (al_bl >> 32); + /* round up */ + tmp += 1U << 31; + + Fp fp = { ah_bh + (ah_bl >> 32) + (al_bh >> 32) + (tmp >> 32), a->exp + b->exp + 64 }; + + return fp; +} + +static void round_digit(char* digits, int ndigits, uint64_t delta, uint64_t rem, uint64_t kappa, uint64_t frac) { + while (rem < frac && delta - rem >= kappa && (rem + kappa < frac || frac - rem > rem + kappa - frac)) { + + digits[ndigits - 1]--; + rem += kappa; + } +} + +static int generate_digits(Fp* fp, Fp* upper, Fp* lower, char* digits, int* K) { + uint64_t wfrac = upper->frac - fp->frac; + uint64_t delta = upper->frac - lower->frac; + + Fp one; + one.frac = 1ULL << -upper->exp; + one.exp = upper->exp; + + uint64_t part1 = upper->frac >> -one.exp; + uint64_t part2 = upper->frac & (one.frac - 1); + + int idx = 0, kappa = 10; + uint64_t* divp; + /* 1000000000 */ + for (divp = tens + 10; kappa > 0; divp++) { + + uint64_t div = *divp; + unsigned digit = part1 / div; + + if (digit || idx) { + digits[idx++] = digit + '0'; + } + + part1 -= digit * div; + kappa--; + + uint64_t tmp = (part1 << -one.exp) + part2; + if (tmp <= delta) { + *K += kappa; + round_digit(digits, idx, delta, tmp, div << -one.exp, wfrac); + + return idx; + } + } + + /* 10 */ + uint64_t* unit = tens + 18; + + while (true) { + part2 *= 10; + delta *= 10; + kappa--; + + unsigned digit = part2 >> -one.exp; + if (digit || idx) { + digits[idx++] = digit + '0'; + } + + part2 &= one.frac - 1; + if (part2 < delta) { + *K += kappa; + round_digit(digits, idx, delta, part2, one.frac, wfrac * *unit); + + return idx; + } + + unit--; + } +} + +static int grisu2(double d, char* digits, int* K) { + Fp w = build_fp(d); + + Fp lower, upper; + get_normalized_boundaries(&w, &lower, &upper); + + normalize(&w); + + int k; + Fp cp = find_cachedpow10(upper.exp, &k); + + w = multiply(&w, &cp); + upper = multiply(&upper, &cp); + lower = multiply(&lower, &cp); + + lower.frac++; + upper.frac--; + + *K = -k; + + return generate_digits(&w, &upper, &lower, digits, K); +} + +static int emit_digits(char* digits, int ndigits, char* dest, int K, bool neg) { + int exp = absv(K + ndigits - 1); + + /* write plain integer */ + if (K >= 0 && (exp < (ndigits + 7))) { + memcpy(dest, digits, ndigits); + memset(dest + ndigits, '0', K); + + return ndigits + K; + } + + /* write decimal w/o scientific notation */ + if (K < 0 && (K > -7 || exp < 4)) { + int offset = ndigits - absv(K); + /* fp < 1.0 -> write leading zero */ + if (offset <= 0) { + offset = -offset; + dest[0] = '0'; + dest[1] = '.'; + memset(dest + 2, '0', offset); + memcpy(dest + offset + 2, digits, ndigits); + + return ndigits + 2 + offset; + + /* fp > 1.0 */ + } else { + memcpy(dest, digits, offset); + dest[offset] = '.'; + memcpy(dest + offset + 1, digits + offset, ndigits - offset); + + return ndigits + 1; + } + } + + /* write decimal w/ scientific notation */ + ndigits = minv(ndigits, 18 - neg); + + int idx = 0; + dest[idx++] = digits[0]; + + if (ndigits > 1) { + dest[idx++] = '.'; + memcpy(dest + idx, digits + 1, ndigits - 1); + idx += ndigits - 1; + } + + dest[idx++] = 'e'; + + char sign = K + ndigits - 1 < 0 ? '-' : '+'; + dest[idx++] = sign; + + int cent = 0; + + if (exp > 99) { + cent = exp / 100; + dest[idx++] = cent + '0'; + exp -= cent * 100; + } + if (exp > 9) { + int dec = exp / 10; + dest[idx++] = dec + '0'; + exp -= dec * 10; + + } else if (cent) { + dest[idx++] = '0'; + } + + dest[idx++] = exp % 10 + '0'; + + return idx; +} + +static int filter_special(double fp, char* dest) { + if (fp == 0.0) { + dest[0] = '0'; + return 1; + } + + uint64_t bits = get_dbits(fp); + + bool nan = (bits & expmask) == expmask; + + if (!nan) { + return 0; + } + + if (bits & fracmask) { + dest[0] = 'n'; + dest[1] = 'a'; + dest[2] = 'n'; + + } else { + dest[0] = 'i'; + dest[1] = 'n'; + dest[2] = 'f'; + } + + return 3; +} + +int fpconv_dtoa(double d, char dest[24]) { + char digits[18]; + + int str_len = 0; + bool neg = false; + + if (get_dbits(d) & signmask) { + dest[0] = '-'; + str_len++; + neg = true; + } + + int spec = filter_special(d, dest + str_len); + + if (spec) { + return str_len + spec; + } + + int K = 0; + int ndigits = grisu2(d, digits, &K); + + str_len += emit_digits(digits, ndigits, dest + str_len, K, neg); + + return str_len; +} diff --git a/libraries/eosiolib/tester/fpconv.h b/libraries/eosiolib/tester/fpconv.h new file mode 100644 index 0000000000..5c9dc783bd --- /dev/null +++ b/libraries/eosiolib/tester/fpconv.h @@ -0,0 +1,41 @@ +/// From https://github.com/night-shift/fpconv +/// Boost Software License 1.0 +/// See accompanying license file + +#ifndef FPCONV_H +# define FPCONV_H + +/* Fast and accurate double to string conversion based on Florian Loitsch's + * Grisu-algorithm[1]. + * + * Input: + * fp -> the double to convert, dest -> destination buffer. + * The generated string will never be longer than 24 characters. + * Make sure to pass a pointer to at least 24 bytes of memory. + * The emitted string will not be null terminated. + * + * Output: + * The number of written characters. + * + * Exemplary usage: + * + * void print(double d) + * { + * char buf[24 + 1] // plus null terminator + * int str_len = fpconv_dtoa(d, buf); + * + * buf[str_len] = '\0'; + * printf("%s", buf); + * } + * + */ + +# ifdef __cplusplus +extern "C" int fpconv_dtoa(double fp, char dest[24]); +# else +int fpconv_dtoa(double fp, char dest[24]); +# endif + +#endif + +/* [1] http://florian.loitsch.com/publications/dtoa-pldi2010.pdf */ diff --git a/libraries/eosiolib/tester/fpconv.license b/libraries/eosiolib/tester/fpconv.license new file mode 100644 index 0000000000..36b7cd93cd --- /dev/null +++ b/libraries/eosiolib/tester/fpconv.license @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/libraries/eosiolib/tester/powers.h b/libraries/eosiolib/tester/powers.h new file mode 100644 index 0000000000..1d22d8ef44 --- /dev/null +++ b/libraries/eosiolib/tester/powers.h @@ -0,0 +1,76 @@ +/// From https://github.com/night-shift/fpconv +/// Boost Software License 1.0 +/// See accompanying license file + +#pragma once + +#include + +#define npowers 87 +#define steppowers 8 +#define firstpower -348 /* 10 ^ -348 */ + +#define expmax -32 +#define expmin -60 + +typedef struct Fp { + uint64_t frac; + int exp; +} Fp; + +static Fp powers_ten[] = { + { 18054884314459144840U, -1220 }, { 13451937075301367670U, -1193 }, { 10022474136428063862U, -1166 }, + { 14934650266808366570U, -1140 }, { 11127181549972568877U, -1113 }, { 16580792590934885855U, -1087 }, + { 12353653155963782858U, -1060 }, { 18408377700990114895U, -1034 }, { 13715310171984221708U, -1007 }, + { 10218702384817765436U, -980 }, { 15227053142812498563U, -954 }, { 11345038669416679861U, -927 }, + { 16905424996341287883U, -901 }, { 12595523146049147757U, -874 }, { 9384396036005875287U, -847 }, + { 13983839803942852151U, -821 }, { 10418772551374772303U, -794 }, { 15525180923007089351U, -768 }, + { 11567161174868858868U, -741 }, { 17236413322193710309U, -715 }, { 12842128665889583758U, -688 }, + { 9568131466127621947U, -661 }, { 14257626930069360058U, -635 }, { 10622759856335341974U, -608 }, + { 15829145694278690180U, -582 }, { 11793632577567316726U, -555 }, { 17573882009934360870U, -529 }, + { 13093562431584567480U, -502 }, { 9755464219737475723U, -475 }, { 14536774485912137811U, -449 }, + { 10830740992659433045U, -422 }, { 16139061738043178685U, -396 }, { 12024538023802026127U, -369 }, + { 17917957937422433684U, -343 }, { 13349918974505688015U, -316 }, { 9946464728195732843U, -289 }, + { 14821387422376473014U, -263 }, { 11042794154864902060U, -236 }, { 16455045573212060422U, -210 }, + { 12259964326927110867U, -183 }, { 18268770466636286478U, -157 }, { 13611294676837538539U, -130 }, + { 10141204801825835212U, -103 }, { 15111572745182864684U, -77 }, { 11258999068426240000U, -50 }, + { 16777216000000000000U, -24 }, { 12500000000000000000U, 3 }, { 9313225746154785156U, 30 }, + { 13877787807814456755U, 56 }, { 10339757656912845936U, 83 }, { 15407439555097886824U, 109 }, + { 11479437019748901445U, 136 }, { 17105694144590052135U, 162 }, { 12744735289059618216U, 189 }, + { 9495567745759798747U, 216 }, { 14149498560666738074U, 242 }, { 10542197943230523224U, 269 }, + { 15709099088952724970U, 295 }, { 11704190886730495818U, 322 }, { 17440603504673385349U, 348 }, + { 12994262207056124023U, 375 }, { 9681479787123295682U, 402 }, { 14426529090290212157U, 428 }, + { 10748601772107342003U, 455 }, { 16016664761464807395U, 481 }, { 11933345169920330789U, 508 }, + { 17782069995880619868U, 534 }, { 13248674568444952270U, 561 }, { 9871031767461413346U, 588 }, + { 14708983551653345445U, 614 }, { 10959046745042015199U, 641 }, { 16330252207878254650U, 667 }, + { 12166986024289022870U, 694 }, { 18130221999122236476U, 720 }, { 13508068024458167312U, 747 }, + { 10064294952495520794U, 774 }, { 14996968138956309548U, 800 }, { 11173611982879273257U, 827 }, + { 16649979327439178909U, 853 }, { 12405201291620119593U, 880 }, { 9242595204427927429U, 907 }, + { 13772540099066387757U, 933 }, { 10261342003245940623U, 960 }, { 15290591125556738113U, 986 }, + { 11392378155556871081U, 1013 }, { 16975966327722178521U, 1039 }, { 12648080533535911531U, 1066 } +}; + +static Fp find_cachedpow10(int exp, int* k) { + const double one_log_ten = 0.30102999566398114; + + int approx = -(exp + npowers) * one_log_ten; + int idx = (approx - firstpower) / steppowers; + + while (1) { + int current = exp + powers_ten[idx].exp + 64; + + if (current < expmin) { + idx++; + continue; + } + + if (current > expmax) { + idx--; + continue; + } + + *k = (firstpower + idx * steppowers); + + return powers_ten[idx]; + } +} diff --git a/libraries/eosiolib/tester/tester.imports b/libraries/eosiolib/tester/tester.imports deleted file mode 100644 index 913d5df173..0000000000 --- a/libraries/eosiolib/tester/tester.imports +++ /dev/null @@ -1,18 +0,0 @@ -abort -close_file -create_chain -destroy_chain -eosio_assert_message -execute -finish_block -get_args -get_head_block_info -open_file -print_range -push_transaction -query_database_chain -read_whole_file -reenter -select_chain_for_db -start_block -write_file diff --git a/libraries/eosiolib/tester/tester_intrinsics.cpp b/libraries/eosiolib/tester/tester_intrinsics.cpp new file mode 100644 index 0000000000..21b2dfa203 --- /dev/null +++ b/libraries/eosiolib/tester/tester_intrinsics.cpp @@ -0,0 +1,116 @@ +#include +#include + +extern "C" __attribute__((eosio_wasm_import)) void print_range(const char*, const char*); + +extern "C" void prints(const char* cstr) { print_range(cstr, cstr + strlen(cstr)); } +extern "C" void prints_l(const char* cstr, uint32_t len) { print_range(cstr, cstr + len); } + +extern "C" void printn(uint64_t n) { + char buffer[13]; + auto end = eosio::name{ n }.write_as_string(buffer, buffer + sizeof(buffer)); + print_range(buffer, end); +} + +extern "C" void printui(uint64_t value) { + char s[21]; + char* ch = s; + do { + *ch++ = '0' + (value % 10); + value /= 10; + } while (value); + std::reverse(s, ch); + print_range(s, ch); +} + +extern "C" void printi(int64_t value) { + if (value < 0) { + prints("-"); + printui(-value); + } else + printui(value); +} + +namespace eosio { +void print(std::string_view sv) { print_range(sv.data(), sv.data() + sv.size()); } + +namespace internal_use_do_not_use { + extern "C" { + + void eosio_assert(uint32_t test, const char* msg) { + if (!test) + eosio_assert_message(test, msg, strlen(msg)); + } + + void eosio_assert_code(uint32_t test, uint64_t code) { + eosio_assert(0, "eosio_assert_code is not available"); + [[unreachable]]; + } + + uint64_t current_time() { + eosio_assert(0, "current_time is not available"); + [[unreachable]]; + } + + bool is_privileged(uint64_t account) { + eosio_assert(0, "is_privileged is not available"); + [[unreachable]]; + } + + void get_resource_limits(uint64_t account, int64_t* ram_bytes, int64_t* net_weight, int64_t* cpu_weight) { + eosio_assert(0, "get_resource_limits is not available"); + [[unreachable]]; + } + + void set_resource_limits(uint64_t account, int64_t ram_bytes, int64_t net_weight, int64_t cpu_weight) { + eosio_assert(0, "set_resource_limits is not available"); + [[unreachable]]; + } + + void set_privileged(uint64_t account, bool is_priv) { + eosio_assert(0, "set_privileged is not available"); + [[unreachable]]; + } + + void set_blockchain_parameters_packed(char* data, uint32_t datalen) { + eosio_assert(0, "set_blockchain_parameters_packed is not available"); + [[unreachable]]; + } + + uint32_t get_blockchain_parameters_packed(char* data, uint32_t datalen) { + eosio_assert(0, "get_blockchain_parameters_packed is not available"); + [[unreachable]]; + } + + int64_t set_proposed_producers(char*, uint32_t) { + eosio_assert(0, "set_proposed_producers is not available"); + [[unreachable]]; + } + + uint32_t get_active_producers(uint64_t*, uint32_t) { + eosio_assert(0, "get_active_producers is not available"); + [[unreachable]]; + } + + bool is_feature_activated(void* feature_digest) { + eosio_assert(0, "is_feature_activated is not available"); + [[unreachable]]; + } + + void preactivate_feature(const void* feature_digest) { + eosio_assert(0, "preactivate_feature is not available"); + [[unreachable]]; + } + + int64_t set_proposed_producers_ex(uint64_t producer_data_format, char* producer_data, uint32_t producer_data_size) { + eosio_assert(0, "set_proposed_producers_ex is not available"); + [[unreachable]]; + } + + } // extern "C" +} // namespace internal_use_do_not_use +} // namespace eosio + +namespace std { +bool uncaught_exception() noexcept { return false; } +} // namespace std diff --git a/tools/include/compiler_options.hpp.in b/tools/include/compiler_options.hpp.in index f5d1a9d94c..442d114aa4 100644 --- a/tools/include/compiler_options.hpp.in +++ b/tools/include/compiler_options.hpp.in @@ -35,6 +35,10 @@ static cl::opt fquery_client_opt( "fquery-client", cl::desc("Produce binaries for wasmql"), cl::cat(LD_CAT)); +static cl::opt ftester_opt( + "ftester", + cl::desc("Produce binaries for eosio-tester"), + cl::cat(LD_CAT)); static cl::opt use_old_malloc_opt( "use-freeing-malloc", cl::desc("Set the malloc implementation to the old freeing malloc"), @@ -367,6 +371,7 @@ static void GetCompDefaults(std::vector& copts) { copts.emplace_back("-ffreestanding"); copts.emplace_back("-nostdlib"); copts.emplace_back("-fno-builtin"); + copts.emplace_back("-DEOSIO_CDT_COMPILATION"); } else { copts.emplace_back("-Wunused-command-line-argument"); #ifdef __APPLE__ @@ -454,6 +459,15 @@ static void GetLdDefaults(std::vector& ldopts) { ldopts.emplace_back("--only-export \"describe_query_request:function\""); ldopts.emplace_back("--only-export \"describe_query_response:function\""); } + } else if (ftester_opt) { + ldopts.emplace_back("--export-table"); + ldopts.emplace_back("-other-model"); + ldopts.emplace_back("--only-export \"*:table\""); + ldopts.emplace_back("--only-export \"*:memory\""); + ldopts.emplace_back("-e initialize "); + ldopts.emplace_back("--only-export \"initialize:function\""); + ldopts.emplace_back("-export start "); + ldopts.emplace_back("--only-export \"start:function\""); } else { if (fuse_main_opt) ldopts.emplace_back("-e main"); @@ -467,10 +481,13 @@ static void GetLdDefaults(std::vector& ldopts) { else ldopts.emplace_back("-leosio_dsm"); - if (use_rt_opt || fquery_opt || fquery_server_opt || fquery_client_opt) + if (use_rt_opt || fquery_opt || fquery_server_opt || fquery_client_opt || ftester_opt) ldopts.emplace_back("-lrt -lsf"); - if (fquery_opt || fquery_server_opt || fquery_client_opt) + if (fquery_opt || fquery_server_opt || fquery_client_opt || ftester_opt) ldopts.emplace_back("-leosio_cmem"); + if (ftester_opt) { + ldopts.emplace_back("-leosio_tester"); + } } else { #ifdef __APPLE__ @@ -522,6 +539,8 @@ static Options CreateOptions(bool add_defaults=true) { ldopts.emplace_back("-fquery-server"); if (fquery_client_opt) ldopts.emplace_back("-fquery-client"); + if (ftester_opt) + ldopts.emplace_back("-ftester"); #endif if (!pp_path_opt.empty()) @@ -572,6 +591,13 @@ static Options CreateOptions(bool add_defaults=true) { #endif copts.emplace_back("-I"+sysroot_opt+"/include/eosiolib/core"); copts.emplace_back("-I"+sysroot_opt+"/include/eosiolib/contracts"); + if (ftester_opt) { + copts.emplace_back("-I"+sysroot_opt+"/include/eosiolib/tester"); + copts.emplace_back("-I"+sysroot_opt+"/include/abieos"); + copts.emplace_back("-I"+sysroot_opt+"/include/date"); + copts.emplace_back("-I"+sysroot_opt+"/include/fmt"); + copts.emplace_back("-I"+sysroot_opt+"/include/rapidjson"); + } ldopts.emplace_back("-L"+sysroot_opt+"/lib"); #ifndef __APPLE__ @@ -598,6 +624,13 @@ static Options CreateOptions(bool add_defaults=true) { #endif copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/eosiolib/core"); copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/eosiolib/contracts"); + if (ftester_opt) { + copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/eosiolib/tester"); + copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/abieos"); + copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/date"); + copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/fmt"); + copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/rapidjson"); + } #ifndef __APPLE__ ldopts.emplace_back("-L"+eosio::cdt::whereami::where()+"/../lib64"); diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index 4107ad6892..a8e593c443 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -433,8 +433,8 @@ struct callbacks { rhf_t::resolve(backend.get_module()); backend.initialize(&cb); - backend(&cb, "env", "initialize"); - backend(&cb, "env", "run_query", f); + // backend(&cb, "env", "initialize"); // todo: needs change to eosio-cpp + backend(&cb, "env", "start", f); return true; } catch (::assert_exception& e) { set_data(cb_alloc_data, cb_alloc, std::string_view{ std::string("assert failed: ") + e.what() }); @@ -698,8 +698,8 @@ static void run(const char* wasm, const std::vector& args) { rhf_t::resolve(backend.get_module()); backend.initialize(&cb); - // backend(&cb, "env", "initialize"); todo: reenable after CDT change - backend(&cb, "env", "run_query", 0); + // backend(&cb, "env", "initialize"); // todo: needs change to eosio-cpp + backend(&cb, "env", "start", 0); } const char usage[] = "usage: tester [-h or --help] [-v or --verbose] file.wasm [args for wasm]\n"; From f65eea93198d83ee78da650e25751d6f0815af7b Mon Sep 17 00:00:00 2001 From: Todd Fleming Date: Fri, 27 Sep 2019 17:04:09 -0400 Subject: [PATCH 03/50] tester --- README.md | 1 + modules/InstallCDT.cmake | 1 + scripts/eosiocdt_uninstall.sh | 1 + scripts/generate_tarball.sh | 1 + tools/tester/CMakeLists.txt | 2 ++ tools/tester/src/eosio-tester.cpp | 2 +- 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f7f717fced..cc44362480 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ $ sudo ./install.sh * eosio-ar * eosio-objdump * eosio-readelf +* eosio-tester ## Contributing diff --git a/modules/InstallCDT.cmake b/modules/InstallCDT.cmake index 4ba5a88502..2dbbee0b22 100644 --- a/modules/InstallCDT.cmake +++ b/modules/InstallCDT.cmake @@ -67,6 +67,7 @@ eosio_tool_install_and_symlink(eosio-ld eosio-ld) eosio_tool_install_and_symlink(eosio-abigen eosio-abigen) eosio_tool_install_and_symlink(eosio-abidiff eosio-abidiff) eosio_tool_install_and_symlink(eosio-init eosio-init) +eosio_tool_install_and_symlink(eosio-tester eosio-tester) eosio_clang_install(../lib/LLVMEosioApply${CMAKE_SHARED_LIBRARY_SUFFIX}) eosio_clang_install(../lib/LLVMEosioSoftfloat${CMAKE_SHARED_LIBRARY_SUFFIX}) eosio_clang_install(../lib/eosio_plugin${CMAKE_SHARED_LIBRARY_SUFFIX}) diff --git a/scripts/eosiocdt_uninstall.sh b/scripts/eosiocdt_uninstall.sh index f2ec7d71f6..cee349a12e 100755 --- a/scripts/eosiocdt_uninstall.sh +++ b/scripts/eosiocdt_uninstall.sh @@ -16,6 +16,7 @@ binaries=( eosio-ld eosio-abidiff eosio-init + eosio-tester llvm-readelf llvm-objdump llvm-ar diff --git a/scripts/generate_tarball.sh b/scripts/generate_tarball.sh index cd4f25057b..89bbcfd299 100644 --- a/scripts/generate_tarball.sh +++ b/scripts/generate_tarball.sh @@ -54,6 +54,7 @@ create_symlink eosio-abigen eosio-abigen create_symlink eosio-wasm2wast eosio-wasm2wast create_symlink eosio-wast2wasm eosio-wast2wasm create_symlink eosio-ar eosio-ar +create_symlink eosio-tester eosio-tester echo "Generating Tarball $NAME.tar.gz..." tar -cvzf $NAME.tar.gz ./${PREFIX}/* || exit 1 diff --git a/tools/tester/CMakeLists.txt b/tools/tester/CMakeLists.txt index 5053e401b2..5089e0238e 100644 --- a/tools/tester/CMakeLists.txt +++ b/tools/tester/CMakeLists.txt @@ -89,3 +89,5 @@ target_link_libraries(eosio-tester eosio_chain wabt Runtime Platform Logging IR fc eos-vm Boost::date_time Boost::filesystem Boost::chrono Boost::system Boost::iostreams Boost::program_options -lpthread) + +set_target_properties(eosio-tester PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin) diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index a8e593c443..e26d625501 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -702,7 +702,7 @@ static void run(const char* wasm, const std::vector& args) { backend(&cb, "env", "start", 0); } -const char usage[] = "usage: tester [-h or --help] [-v or --verbose] file.wasm [args for wasm]\n"; +const char usage[] = "usage: eosio-tester [-h or --help] [-v or --verbose] file.wasm [args for wasm]\n"; int main(int argc, char* argv[]) { fc::logger::get(DEFAULT_LOGGER).set_log_level(fc::log_level::off); From 0d33526d02b8393334100591bfa0d1116c422ba0 Mon Sep 17 00:00:00 2001 From: Todd Fleming Date: Fri, 27 Sep 2019 19:55:49 -0400 Subject: [PATCH 04/50] tester --- libraries/eosiolib/tester/eosio/tester.hpp | 41 ++++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index 4592211333..9c7f0eaedc 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -249,6 +250,40 @@ inline void expect(const chain_types::transaction_trace& ttrace, const char* exp } } +// TODO: move +struct tester_key_weight { + eosio::public_key key = {}; + uint16_t weight = {}; + + EOSLIB_SERIALIZE(tester_key_weight, (key)(weight)) +}; + +// TODO: move +struct tester_permission_level_weight { + permission_level permission = {}; + uint16_t weight = {}; + + EOSLIB_SERIALIZE(tester_permission_level_weight, (permission)(weight)) +}; + +// TODO: move +struct tester_wait_weight { + uint32_t wait_sec = {}; + uint16_t weight = {}; + + EOSLIB_SERIALIZE(tester_wait_weight, (wait_sec)(weight)) +}; + +// TODO: move +struct tester_authority { + uint32_t threshold = {}; + std::vector keys = {}; + std::vector accounts = {}; + std::vector waits = {}; + + EOSLIB_SERIALIZE(tester_authority, (threshold)(keys)(accounts)(waits)) +}; + class test_chain { private: uint32_t id; @@ -350,7 +385,7 @@ class test_chain { chain_types::transaction_trace create_account(name ac, const public_key& pub_key, const char* expected_except = nullptr) { - authority simple_auth{ + tester_authority simple_auth{ .threshold = 1, .keys = { { pub_key, 1 } }, }; @@ -367,11 +402,11 @@ class test_chain { chain_types::transaction_trace create_code_account(name ac, const public_key& pub_key, const char* expected_except = nullptr) { - authority simple_auth{ + tester_authority simple_auth{ .threshold = 1, .keys = { { pub_key, 1 } }, }; - authority code_auth{ + tester_authority code_auth{ .threshold = 1, .keys = { { pub_key, 1 } }, .accounts = { { { ac, "eosio.code"_n }, 1 } }, From e83907afa2fce254add410f04f451dcad4017436 Mon Sep 17 00:00:00 2001 From: Todd Fleming Date: Tue, 1 Oct 2019 13:29:28 -0400 Subject: [PATCH 05/50] tester --- libraries/eosiolib/tester/eosio/tester.hpp | 48 ++++++++++++++--- tools/tester/src/eosio-tester.cpp | 62 +++++++++++++++++++--- 2 files changed, 95 insertions(+), 15 deletions(-) diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index 9c7f0eaedc..e46eda9ee7 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -51,6 +51,8 @@ namespace internal_use_do_not_use { void* (*cb_alloc)(void* cb_alloc_data, size_t size)); TESTER_INTRINSIC void push_transaction(uint32_t chain, const char* args_begin, const char* args_end, void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC bool exec_deferred(uint32_t chain, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); TESTER_INTRINSIC void query_database_chain(uint32_t chain, void* req_begin, void* req_end, void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); TESTER_INTRINSIC void select_chain_for_db(uint32_t chain_index); @@ -103,6 +105,13 @@ namespace internal_use_do_not_use { }); } + template + inline bool exec_deferred(uint32_t chain, Alloc_fn alloc_fn) { + return exec_deferred(chain, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + template inline void query_database_chain(uint32_t chain, const T& req, Alloc_fn alloc_fn) { auto req_data = pack(req); @@ -383,6 +392,16 @@ class test_chain { return transact(std::move(actions), { default_priv_key }, expected_except); } + std::optional exec_deferred() { + std::vector bin; + if (!internal_use_do_not_use::exec_deferred(id, [&](size_t size) { + bin.resize(size); + return bin.data(); + })) + return {}; + return chain_types::assert_bin_to_native(bin); + } + chain_types::transaction_trace create_account(name ac, const public_key& pub_key, const char* expected_except = nullptr) { tester_authority simple_auth{ @@ -400,7 +419,7 @@ class test_chain { return create_account(ac, convert(default_pub_key), expected_except); } - chain_types::transaction_trace create_code_account(name ac, const public_key& pub_key, + chain_types::transaction_trace create_code_account(name ac, const public_key& pub_key, bool is_priv = false, const char* expected_except = nullptr) { tester_authority simple_auth{ .threshold = 1, @@ -411,15 +430,28 @@ class test_chain { .keys = { { pub_key, 1 } }, .accounts = { { { ac, "eosio.code"_n }, 1 } }, }; - return transact({ action{ { { "eosio"_n, "active"_n } }, - "eosio"_n, - "newaccount"_n, - std::make_tuple("eosio"_n, ac, simple_auth, code_auth) } }, - expected_except); + return transact( + { + action{ { { "eosio"_n, "active"_n } }, + "eosio"_n, + "newaccount"_n, + std::make_tuple("eosio"_n, ac, simple_auth, code_auth) }, + action{ { { "eosio"_n, "active"_n } }, "eosio"_n, "setpriv"_n, std::make_tuple(ac, is_priv) }, + }, + expected_except); + } + + chain_types::transaction_trace create_code_account(name ac, const public_key& pub_key, const char* expected_except) { + return create_code_account(ac, pub_key, false, expected_except); + } + + chain_types::transaction_trace create_code_account(name ac, bool is_priv = false, + const char* expected_except = nullptr) { + return create_code_account(ac, convert(default_pub_key), is_priv, expected_except); } - chain_types::transaction_trace create_code_account(name ac, const char* expected_except = nullptr) { - return create_code_account(ac, convert(default_pub_key), expected_except); + chain_types::transaction_trace create_code_account(name ac, const char* expected_except) { + return create_code_account(ac, convert(default_pub_key), false, expected_except); } chain_types::transaction_trace set_code(name ac, const char* filename, const char* expected_except = nullptr) { diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index e26d625501..1dcedff42e 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -12,13 +13,18 @@ using namespace abieos::literals; using namespace std::literals; +using eosio::chain::builtin_protocol_feature_t; +using eosio::chain::digest_type; +using eosio::chain::protocol_feature_exception; +using eosio::chain::protocol_feature_set; struct callbacks; using backend_t = eosio::vm::backend; using rhf_t = eosio::vm::registered_host_functions; -const static int block_interval_ms = 500; -const static int block_interval_us = block_interval_ms * 1000; +inline constexpr int block_interval_ms = 500; +inline constexpr int block_interval_us = block_interval_ms * 1000; +inline constexpr uint32_t billed_cpu_time_use = 2000; struct assert_exception : std::exception { std::string msg; @@ -45,6 +51,33 @@ struct intrinsic_context { } }; +protocol_feature_set make_protocol_feature_set() { + protocol_feature_set pfs; + std::map> visited_builtins; + + std::function add_builtins = + [&pfs, &visited_builtins, &add_builtins](builtin_protocol_feature_t codename) -> digest_type { + auto res = visited_builtins.emplace(codename, optional()); + if (!res.second) { + EOS_ASSERT(res.first->second, protocol_feature_exception, + "invariant failure: cycle found in builtin protocol feature dependencies"); + return *res.first->second; + } + + auto f = protocol_feature_set::make_default_builtin_protocol_feature( + codename, [&add_builtins](builtin_protocol_feature_t d) { return add_builtins(d); }); + + const auto& pf = pfs.add_feature(f); + res.first->second = pf.feature_digest; + + return pf.feature_digest; + }; + + for (const auto& p : eosio::chain::builtin_protocol_feature_codenames) { add_builtins(p.first); } + + return pfs; +} + struct test_chain { eosio::chain::private_key_type producer_key{ "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"s }; std::unique_ptr cfg; @@ -61,12 +94,12 @@ struct test_chain { cfg->contracts_console = true; cfg->genesis.initial_timestamp = fc::time_point::from_iso_string("2020-01-01T00:00:00.000"); - control = std::make_unique(*cfg); - + control = std::make_unique(*cfg, make_protocol_feature_set()); control->add_indices(); control->startup([]() { return false; }, nullptr); - - start_block(); + control->start_block(control->head_block_time() + fc::microseconds(block_interval_us), 0, + { *control->get_protocol_feature_manager().get_builtin_digest( + eosio::chain::builtin_protocol_feature_t::preactivate_feature) }); } test_chain(const test_chain&) = delete; @@ -542,7 +575,6 @@ struct callbacks { eosio::chain::signed_transaction signed_trx{ std::move(transaction), std::move(args.signatures), std::move(args.context_free_data) }; auto& chain = assert_chain(chain_index); - chain.mutating(); chain.start_if_needed(); for (auto& key : args.keys) signed_trx.sign(key, chain.control->get_chain_id()); auto mtrx = @@ -554,6 +586,21 @@ struct callbacks { set_data(cb_alloc_data, cb_alloc, abieos::native_to_bin(chain_types::transaction_trace{ convert(*result) })); } + bool exec_deferred(uint32_t chain_index, uint32_t cb_alloc_data, uint32_t cb_alloc) { + auto& chain = assert_chain(chain_index); + chain.start_if_needed(); + const auto& idx = + chain.control->db().get_index(); + auto itr = idx.begin(); + if (itr != idx.end() && itr->delay_until <= chain.control->pending_block_time()) { + auto trace = + chain.control->push_scheduled_transaction(itr->trx_id, fc::time_point::maximum(), billed_cpu_time_use); + set_data(cb_alloc_data, cb_alloc, abieos::native_to_bin(chain_types::transaction_trace{ convert(*trace) })); + return true; + } + return false; + } + void query_database(uint32_t chain_index, const char* req_begin, const char* req_end, uint32_t cb_alloc_data, uint32_t cb_alloc) { auto& chain = assert_chain(chain_index); @@ -671,6 +718,7 @@ void register_callbacks() { rhf_t::add("env", "finish_block"); rhf_t::add("env", "get_head_block_info"); rhf_t::add("env", "push_transaction"); + rhf_t::add("env", "exec_deferred"); rhf_t::add("env", "query_database_chain"); rhf_t::add("env", "select_chain_for_db"); From 1afa19b628e7366ea1ec30ed277fee5546891df4 Mon Sep 17 00:00:00 2001 From: Todd Fleming Date: Tue, 1 Oct 2019 13:38:05 -0400 Subject: [PATCH 06/50] tester: forgot submodule --- libraries/fmt | 1 + 1 file changed, 1 insertion(+) create mode 160000 libraries/fmt diff --git a/libraries/fmt b/libraries/fmt new file mode 160000 index 0000000000..7512a55aa3 --- /dev/null +++ b/libraries/fmt @@ -0,0 +1 @@ +Subproject commit 7512a55aa3ae309587ca89668ef9ec4074a51a1f From bd18d34f7f43384c8e002ea5f028140d784cfb94 Mon Sep 17 00:00:00 2001 From: Todd Fleming Date: Fri, 4 Oct 2019 10:42:40 -0400 Subject: [PATCH 07/50] tester: use jit --- tools/tester/src/eosio-tester.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index 1dcedff42e..f3892b75ec 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -19,7 +19,7 @@ using eosio::chain::protocol_feature_exception; using eosio::chain::protocol_feature_set; struct callbacks; -using backend_t = eosio::vm::backend; +using backend_t = eosio::vm::backend; using rhf_t = eosio::vm::registered_host_functions; inline constexpr int block_interval_ms = 500; @@ -424,8 +424,11 @@ struct callbacks { char* alloc(uint32_t cb_alloc_data, uint32_t cb_alloc, uint32_t size) { // todo: verify cb_alloc isn't in imports - auto result = state.backend.get_context().execute_func_table( - this, eosio::vm::interpret_visitor(state.backend.get_context()), cb_alloc, cb_alloc_data, size); + if (state.backend.get_module().tables.size() < 0 || state.backend.get_module().tables[0].table.size() < cb_alloc) + throw std::runtime_error("cb_alloc is out of range"); + auto result = state.backend.get_context().execute( // + this, eosio::vm::jit_visitor(42), state.backend.get_module().tables[0].table[cb_alloc], cb_alloc_data, + size); if (!result || !result->is_a()) throw std::runtime_error("cb_alloc returned incorrect type"); char* begin = state.wa.get_base_ptr() + result->to_ui32(); From cd38b19c5aea4a59df720b3aa9934a2c0b51fba1 Mon Sep 17 00:00:00 2001 From: Todd Fleming Date: Wed, 23 Oct 2019 15:59:49 -0400 Subject: [PATCH 08/50] export and only-export --- tools/include/compiler_options.hpp.in | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tools/include/compiler_options.hpp.in b/tools/include/compiler_options.hpp.in index 5e5057eadb..57fe81e408 100644 --- a/tools/include/compiler_options.hpp.in +++ b/tools/include/compiler_options.hpp.in @@ -19,10 +19,14 @@ static llvm::cl::OptionCategory EosioLdToolCategory("ld options"); #endif /// begin ld options -static cl::opt only_export_opt( +static cl::list only_export_opt( "only-export", cl::desc("Export only this symbol"), - cl::cat(LD_CAT), + cl::Hidden, + cl::ZeroOrMore); +static cl::list export_opt( + "export", + cl::desc("Export this symbol"), cl::Hidden, cl::ZeroOrMore); static cl::opt no_abigen_opt( @@ -477,8 +481,11 @@ static void GetLdDefaults(std::vector& ldopts) { ldopts.emplace_back("-lrt -lsf"); if (fquery_opt || fquery_server_opt || fquery_client_opt) ldopts.emplace_back("-leosio_cmem"); - if (!only_export_opt.empty()) { - ldopts.emplace_back("--only-export \""+only_export_opt+"\""); + for (auto e : only_export_opt) { + ldopts.emplace_back("--only-export \""+e+"\""); + } + for (auto e : export_opt) { + ldopts.emplace_back("-export \""+e+"\""); } } else { @@ -531,6 +538,10 @@ static Options CreateOptions(bool add_defaults=true) { ldopts.emplace_back("-fquery-server"); if (fquery_client_opt) ldopts.emplace_back("-fquery-client"); + for (auto e : only_export_opt) + ldopts.emplace_back("-only-export \""+e+"\""); + for (auto e : export_opt) + ldopts.emplace_back("-export \""+e+"\""); #endif if (!pp_path_opt.empty()) From 5e1559da38adce864fc8154d6e9fa96751be13ec Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 9 Jan 2020 11:23:38 -0500 Subject: [PATCH 09/50] Port tester to current eosio/develop. Functional but needs refactoring. --- libraries/eos | 2 +- tools/tester/src/eosio-tester.cpp | 78 +++++++++++++++++++++---------- 2 files changed, 54 insertions(+), 26 deletions(-) diff --git a/libraries/eos b/libraries/eos index 7c0b0d388e..19e4078a91 160000 --- a/libraries/eos +++ b/libraries/eos @@ -1 +1 @@ -Subproject commit 7c0b0d388ee5012aa56df7260b53033b721b8c9f +Subproject commit 19e4078a919705c6b75769fc6af315c8edd3bdcf diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index f3892b75ec..9ee7ef6481 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -26,6 +26,14 @@ inline constexpr int block_interval_ms = 500; inline constexpr int block_interval_us = block_interval_ms * 1000; inline constexpr uint32_t billed_cpu_time_use = 2000; +// Handle eosio version differences +namespace { +template +auto to_uint64_t(T n) -> std::enable_if_t, decltype(n.value)> { return n.value; } +template +auto to_uint64_t(T n) -> std::enable_if_t, decltype(n.to_uint64_t())> { return n.to_uint64_t(); } +} + struct assert_exception : std::exception { std::string msg; @@ -34,6 +42,25 @@ struct assert_exception : std::exception { const char* what() const noexcept override { return msg.c_str(); } }; +// HACK: UB. Unfortunately, I can't think of a way to allow a transaction_context +// to be constructed outside of controller in 2.0 that doesn't have undefined behavior. +// A better solution would be to factor database access out of apply_context, but +// that can't really be backported to 2.0 at this point. +namespace { + struct __attribute__((__may_alias__)) xxx_transaction_checktime_timer { + std::atomic_bool& expired; + eosio::chain::platform_timer& _timer; + }; + struct transaction_checktime_factory { + eosio::chain::platform_timer timer; + std::atomic_bool expired; + eosio::chain::transaction_checktime_timer get() { + xxx_transaction_checktime_timer result{expired, timer}; + return std::move(*reinterpret_cast(&result)); + } + }; +}; + struct intrinsic_context { eosio::chain::controller& control; eosio::chain::signed_transaction trx; @@ -41,10 +68,11 @@ struct intrinsic_context { std::unique_ptr apply_context; intrinsic_context(eosio::chain::controller& control) : control{ control } { + static transaction_checktime_factory xxx_timer; trx.actions.emplace_back(); trx.actions.back().account = N(eosio.null); - trx_ctx = std::make_unique(control, trx, trx.id(), fc::time_point::now()); + trx_ctx = std::make_unique(control, trx, trx.id(), xxx_timer.get(), fc::time_point::now()); trx_ctx->init_for_implicit_trx(0); trx_ctx->exec(); apply_context = std::make_unique(control, *trx_ctx, 1, 0); @@ -88,15 +116,16 @@ struct test_chain { std::string dir = "testchain-XXXXXX"; if (mkdtemp(dir.data()) != dir.data()) throw std::runtime_error("could not create directory " + dir); + eosio::chain::genesis_state genesis; + genesis.initial_timestamp = fc::time_point::from_iso_string("2020-01-01T00:00:00.000"); cfg = std::make_unique(); cfg->blocks_dir = dir + "/blocks"; cfg->state_dir = dir + "/state"; cfg->contracts_console = true; - cfg->genesis.initial_timestamp = fc::time_point::from_iso_string("2020-01-01T00:00:00.000"); - control = std::make_unique(*cfg, make_protocol_feature_set()); + control = std::make_unique(*cfg, make_protocol_feature_set(), genesis.compute_chain_id()); control->add_indices(); - control->startup([]() { return false; }, nullptr); + control->startup([]{}, []() { return false; }, genesis); control->start_block(control->head_block_time() + fc::microseconds(block_interval_us), 0, { *control->get_protocol_feature_manager().get_builtin_digest( eosio::chain::builtin_protocol_feature_t::preactivate_feature) }); @@ -132,7 +161,7 @@ struct test_chain { void finish_block() { start_if_needed(); ilog("finish block ${n}", ("n", control->head_block_num())); - control->finalize_block([&](eosio::chain::digest_type d) { return producer_key.sign(d); }); + control->finalize_block([&](eosio::chain::digest_type d) { return std::vector{producer_key.sign(d)}; }); control->commit_block(); } }; @@ -146,18 +175,18 @@ abieos::checksum256 convert(const eosio::chain::checksum_type& obj) { chain_types::account_delta convert(const eosio::chain::account_delta& obj) { chain_types::account_delta result; - result.account.value = obj.account.value; + result.account.value = to_uint64_t(obj.account); result.delta = obj.delta; return result; } chain_types::action_receipt_v0 convert(const eosio::chain::action_receipt& obj) { chain_types::action_receipt_v0 result; - result.receiver.value = obj.receiver.value; + result.receiver.value = to_uint64_t(obj.receiver); result.act_digest = convert(obj.act_digest); result.global_sequence = obj.global_sequence; result.recv_sequence = obj.recv_sequence; - for (auto& auth : obj.auth_sequence) result.auth_sequence.push_back({ abieos::name{ auth.first }, auth.second }); + for (auto& auth : obj.auth_sequence) result.auth_sequence.push_back({ abieos::name{ to_uint64_t(auth.first) }, auth.second }); result.code_sequence.value = obj.code_sequence.value; result.abi_sequence.value = obj.abi_sequence.value; return result; @@ -165,10 +194,10 @@ chain_types::action_receipt_v0 convert(const eosio::chain::action_receipt& obj) chain_types::action convert(const eosio::chain::action& obj) { chain_types::action result; - result.account.value = obj.account.value; - result.name.value = obj.name.value; + result.account.value = to_uint64_t(obj.account); + result.name.value = to_uint64_t(obj.name); for (auto& auth : obj.authorization) - result.authorization.push_back({ abieos::name{ auth.actor.value }, abieos::name{ auth.permission.value } }); + result.authorization.push_back({ abieos::name{ to_uint64_t(auth.actor) }, abieos::name{ to_uint64_t(auth.permission) } }); result.data = { obj.data.data(), obj.data.data() + obj.data.size() }; return result; } @@ -179,7 +208,7 @@ chain_types::action_trace_v0 convert(const eosio::chain::action_trace& obj) { result.creator_action_ordinal.value = obj.creator_action_ordinal.value; if (obj.receipt) result.receipt = convert(*obj.receipt); - result.receiver.value = obj.receiver.value; + result.receiver.value = to_uint64_t(obj.receiver); result.act = convert(obj.act); result.context_free = obj.context_free; result.elapsed = obj.elapsed.count(); @@ -580,11 +609,10 @@ struct callbacks { auto& chain = assert_chain(chain_index); chain.start_if_needed(); for (auto& key : args.keys) signed_trx.sign(key, chain.control->get_chain_id()); - auto mtrx = - std::make_shared(signed_trx, eosio::chain::packed_transaction::none); - eosio::chain::transaction_metadata::start_recover_keys( - mtrx, chain.control->get_thread_pool(), chain.control->get_chain_id(), fc::microseconds::maximum()); - auto result = chain.control->push_transaction(mtrx, fc::time_point::maximum(), 2000); + auto ptrx = std::make_shared(signed_trx, eosio::chain::packed_transaction::compression_type::none); + auto fut = eosio::chain::transaction_metadata::start_recover_keys( + ptrx, chain.control->get_thread_pool(), chain.control->get_chain_id(), fc::microseconds::maximum()); + auto result = chain.control->push_transaction( fut.get(), fc::time_point::maximum(), 2000); // ilog("${r}", ("r", fc::json::to_pretty_string(result))); set_data(cb_alloc_data, cb_alloc, abieos::native_to_bin(chain_types::transaction_trace{ convert(*result) })); } @@ -651,11 +679,11 @@ struct callbacks { rows.emplace_back(abieos::native_to_bin( contract_row{ uint32_t(0), bool(true), - abieos::name{ table_it->code.value }, - abieos::name{ table_it->scope.value }, - abieos::name{ table_it->table.value }, + abieos::name{ to_uint64_t(table_it->code) }, + abieos::name{ to_uint64_t(table_it->scope) }, + abieos::name{ to_uint64_t(table_it->table) }, kv_it->primary_key, - abieos::name{ kv_it->payer.value }, + abieos::name{ to_uint64_t(kv_it->payer) }, { kv_it->value.data(), kv_it->value.data() + kv_it->value.size() } })); }; } @@ -678,10 +706,10 @@ struct callbacks { int db_get_i64(int iterator, char* buffer, size_t buffer_size) {return selected().db_get_i64(iterator, buffer, buffer_size);} int db_next_i64(int iterator, uint64_t& primary) {return selected().db_next_i64(iterator, primary);} int db_previous_i64(int iterator, uint64_t& primary) {return selected().db_previous_i64(iterator, primary);} - int db_find_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id) {return selected().db_find_i64(code, scope, table, id);} - int db_lowerbound_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id) {return selected().db_lowerbound_i64(code, scope, table, id);} - int db_upperbound_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id) {return selected().db_upperbound_i64(code, scope, table, id);} - int db_end_i64(uint64_t code, uint64_t scope, uint64_t table) {return selected().db_end_i64(code, scope, table);} + int db_find_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id) {return selected().db_find_i64(eosio::chain::name{code}, eosio::chain::name{scope}, eosio::chain::name{table}, id);} + int db_lowerbound_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id) {return selected().db_lowerbound_i64(eosio::chain::name{code}, eosio::chain::name{scope}, eosio::chain::name{table}, id);} + int db_upperbound_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id) {return selected().db_upperbound_i64(eosio::chain::name{code}, eosio::chain::name{scope}, eosio::chain::name{table}, id);} + int db_end_i64(uint64_t code, uint64_t scope, uint64_t table) {return selected().db_end_i64(eosio::chain::name{code}, eosio::chain::name{scope}, eosio::chain::name{table});} DB_WRAPPERS_SIMPLE_SECONDARY(idx64, uint64_t) DB_WRAPPERS_SIMPLE_SECONDARY(idx128, unsigned __int128) From d4bc7804dfbfe3edfae20b26d14d44159508000e Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 9 Jan 2020 11:49:53 -0500 Subject: [PATCH 10/50] Port tester to 2.0 --- libraries/eos | 2 +- tools/tester/src/eosio-tester.cpp | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libraries/eos b/libraries/eos index 19e4078a91..c03b089db8 160000 --- a/libraries/eos +++ b/libraries/eos @@ -1 +1 @@ -Subproject commit 19e4078a919705c6b75769fc6af315c8edd3bdcf +Subproject commit c03b089db870dbf2e94232b1e476b181115b76fc diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index 9ee7ef6481..aeb4333a4a 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -32,6 +32,19 @@ template auto to_uint64_t(T n) -> std::enable_if_t, decltype(n.value)> { return n.value; } template auto to_uint64_t(T n) -> std::enable_if_t, decltype(n.to_uint64_t())> { return n.to_uint64_t(); } + +template +auto do_startup(C&& control, F0&&, F1&& f1, G&&) -> std::enable_if_t, eosio::chain::controller::config, protocol_feature_set>> { + return control->startup([]() { return false; }, nullptr); +} +template +auto do_startup(C&& control, F0&&, F1&& f1, G&& genesis) -> decltype(control->startup(f1, genesis)) { + return control->startup([]() { return false; }, genesis); +} +template +auto do_startup(C&& control, F0&& f0, F1&& f1, G&& genesis) -> decltype(control->startup(f0, f1, genesis)) { + return control->startup(f0, f1, genesis); +} } struct assert_exception : std::exception { @@ -125,7 +138,7 @@ struct test_chain { control = std::make_unique(*cfg, make_protocol_feature_set(), genesis.compute_chain_id()); control->add_indices(); - control->startup([]{}, []() { return false; }, genesis); + do_startup(control, []{}, []() { return false; }, genesis); control->start_block(control->head_block_time() + fc::microseconds(block_interval_us), 0, { *control->get_protocol_feature_manager().get_builtin_digest( eosio::chain::builtin_protocol_feature_t::preactivate_feature) }); From 913c363d0dac6d3ae5188ff7bb8e83378146ee18 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 9 Jan 2020 14:07:21 -0500 Subject: [PATCH 11/50] Fix merge issues. - std::uncaught_exception is now defined. - Compiler options are separate strings and do not need escaping. --- libraries/eosiolib/tester/tester_intrinsics.cpp | 4 ---- tools/include/compiler_options.hpp.in | 12 ++++++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/libraries/eosiolib/tester/tester_intrinsics.cpp b/libraries/eosiolib/tester/tester_intrinsics.cpp index 21b2dfa203..aac893a3a8 100644 --- a/libraries/eosiolib/tester/tester_intrinsics.cpp +++ b/libraries/eosiolib/tester/tester_intrinsics.cpp @@ -110,7 +110,3 @@ namespace internal_use_do_not_use { } // extern "C" } // namespace internal_use_do_not_use } // namespace eosio - -namespace std { -bool uncaught_exception() noexcept { return false; } -} // namespace std diff --git a/tools/include/compiler_options.hpp.in b/tools/include/compiler_options.hpp.in index 315c00e1d6..5af79ea282 100644 --- a/tools/include/compiler_options.hpp.in +++ b/tools/include/compiler_options.hpp.in @@ -475,12 +475,12 @@ static void GetLdDefaults(std::vector& ldopts) { } else if (ftester_opt) { ldopts.emplace_back("--export-table"); ldopts.emplace_back("-other-model"); - ldopts.emplace_back("--only-export \"*:table\""); - ldopts.emplace_back("--only-export \"*:memory\""); - ldopts.emplace_back("-e initialize "); - ldopts.emplace_back("--only-export \"initialize:function\""); - ldopts.emplace_back("-export start "); - ldopts.emplace_back("--only-export \"start:function\""); + ldopts.insert(ldopts.end(), {"--only-export", "*:table"}); + ldopts.insert(ldopts.end(), {"--only-export", "*:memory"}); + ldopts.insert(ldopts.end(), {"-e", "initialize"}); + ldopts.insert(ldopts.end(), {"--only-export", "initialize:function"}); + ldopts.insert(ldopts.end(), {"-export", "start"}); + ldopts.insert(ldopts.end(), {"--only-export", "start:function"}); } else { if (fuse_main_opt) ldopts.insert(ldopts.end(), { "-e", "main" }); From f2d693cdaedf2f74e11050106ab1999f9b2509c4 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 9 Jan 2020 16:16:35 -0500 Subject: [PATCH 12/50] Don't create a transaction_context/apply_context just for reading the database. --- libraries/eos | 2 +- tools/tester/src/eosio-tester.cpp | 34 +++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/libraries/eos b/libraries/eos index c03b089db8..f821e6f978 160000 --- a/libraries/eos +++ b/libraries/eos @@ -1 +1 @@ -Subproject commit c03b089db870dbf2e94232b1e476b181115b76fc +Subproject commit f821e6f97870dae20f0e556d9ffbff3766598121 diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index aeb4333a4a..63835b4eea 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -74,13 +74,14 @@ namespace { }; }; -struct intrinsic_context { +template +struct intrinsic_context_impl { eosio::chain::controller& control; eosio::chain::signed_transaction trx; std::unique_ptr trx_ctx; std::unique_ptr apply_context; - intrinsic_context(eosio::chain::controller& control) : control{ control } { + intrinsic_context_impl(eosio::chain::controller& control) : control{ control } { static transaction_checktime_factory xxx_timer; trx.actions.emplace_back(); @@ -92,6 +93,31 @@ struct intrinsic_context { } }; +template +struct intrinsic_context_impl> : + ApplyContext::primary_index_read_only +{ + typename ApplyContext::template generic_index_read_only idx64; + typename ApplyContext::template generic_index_read_only idx128; + typename ApplyContext::template generic_index_read_only idx256; + typename ApplyContext::template generic_index_read_only idx_double; + typename ApplyContext::template generic_index_read_only idx_long_double; + intrinsic_context_impl* apply_context; + + intrinsic_context_impl(eosio::chain::controller& control) : + ApplyContext::primary_index_read_only{control.db()}, + idx64{control.db()}, + idx128{control.db()}, + idx256{control.db()}, + idx_double{control.db()}, + idx_long_double{control.db()}, + apply_context{this} + {} +}; + +using intrinsic_context = intrinsic_context_impl; + protocol_feature_set make_protocol_feature_set() { protocol_feature_set pfs; std::map> visited_builtins; @@ -149,7 +175,7 @@ struct test_chain { void mutating() { intr_ctx.reset(); } - eosio::chain::apply_context& get_apply_context() { + auto& get_apply_context() { if (!intr_ctx) { start_if_needed(); intr_ctx = std::make_unique(*control); @@ -708,7 +734,7 @@ struct callbacks { state.selected_chain_index = chain_index; } - eosio::chain::apply_context& selected() { + auto& selected() { if (!state.selected_chain_index || *state.selected_chain_index >= state.chains.size() || !state.chains[*state.selected_chain_index]) throw std::runtime_error("select_chain_for_db() must be called before using multi_index"); From 60471537e85fc395f01f35ca97edd89f7bdb6567 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 10 Jan 2020 10:12:56 -0500 Subject: [PATCH 13/50] Remove eos-vm as a separate submodule. It's already included in eos. --- .gitmodules | 3 --- libraries/eos-vm | 1 - tools/tester/CMakeLists.txt | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) delete mode 160000 libraries/eos-vm diff --git a/.gitmodules b/.gitmodules index daa65a895d..b81763b211 100644 --- a/.gitmodules +++ b/.gitmodules @@ -18,9 +18,6 @@ [submodule "libraries/abieos"] path = libraries/abieos url = https://github.com/EOSIO/abieos.git -[submodule "libraries/eos-vm"] - path = libraries/eos-vm - url = https://github.com/EOSIO/eos-vm.git [submodule "libraries/fmt"] path = libraries/fmt url = https://github.com/fmtlib/fmt.git diff --git a/libraries/eos-vm b/libraries/eos-vm deleted file mode 160000 index d85ad1704b..0000000000 --- a/libraries/eos-vm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d85ad1704b25b9a9833b65cdd6de5d94fa166de8 diff --git a/tools/tester/CMakeLists.txt b/tools/tester/CMakeLists.txt index 5089e0238e..2ab7cc521b 100644 --- a/tools/tester/CMakeLists.txt +++ b/tools/tester/CMakeLists.txt @@ -54,7 +54,7 @@ include(SetupTargetMacros) include(GNUInstallDirs) include(VersionMacros) -add_subdirectory(../../libraries/eos-vm eos-vm EXCLUDE_FROM_ALL) +add_subdirectory(../../libraries/eos/libraries/eos-vm eos-vm EXCLUDE_FROM_ALL) set(EOSIO_ROOT_KEY "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV") set(EOSIO_WASM_OLD_BEHAVIOR "Off") From 86df9bd6e3acc5319dc87d863cc9fb95dbe11ba9 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Mon, 13 Jan 2020 15:06:40 -0500 Subject: [PATCH 14/50] Add intrinsics to support stdio/iostreams and update the standard library. --- libraries/libc++/CMakeLists.txt | 2 +- libraries/libc++/libcxx | 2 +- libraries/libc/CMakeLists.txt | 3 +++ libraries/libc/musl | 2 +- tools/tester/CMakeLists.txt | 6 ++--- tools/tester/src/eosio-tester.cpp | 38 +++++++++++++++++++++++++++++-- 6 files changed, 45 insertions(+), 8 deletions(-) diff --git a/libraries/libc++/CMakeLists.txt b/libraries/libc++/CMakeLists.txt index 8158bf0d71..54ab6a8abd 100644 --- a/libraries/libc++/CMakeLists.txt +++ b/libraries/libc++/CMakeLists.txt @@ -1,4 +1,4 @@ -SET(SRC_FILENAMES algorithm.cpp any.cpp bind.cpp condition_variable.cpp functional.cpp +SET(SRC_FILENAMES algorithm.cpp any.cpp bind.cpp condition_variable.cpp chrono.cpp functional.cpp future.cpp hash.cpp ios.cpp iostream.cpp locale.cpp memory.cpp mutex.cpp new.cpp optional.cpp regex.cpp stdexcept.cpp string.cpp strstream.cpp system_error.cpp exception.cpp typeinfo.cpp utility.cpp valarray.cpp variant.cpp vector.cpp eosio.cpp) diff --git a/libraries/libc++/libcxx b/libraries/libc++/libcxx index d45faf798d..689304c8c1 160000 --- a/libraries/libc++/libcxx +++ b/libraries/libc++/libcxx @@ -1 +1 @@ -Subproject commit d45faf798dd6b56e322e89b0af8d120a33a34b4c +Subproject commit 689304c8c12cbc8f8a6eec7f72dec32947fe3713 diff --git a/libraries/libc/CMakeLists.txt b/libraries/libc/CMakeLists.txt index acff253149..fc0da43bab 100644 --- a/libraries/libc/CMakeLists.txt +++ b/libraries/libc/CMakeLists.txt @@ -7,6 +7,7 @@ file(GLOB LOCALE_SOURCES "musl/src/locale/*.c") file(GLOB MATH_SOURCES "musl/src/math/*.c") file(GLOB MBYTE_SOURCES "musl/src/multibyte/*.c") file(GLOB MISC_SOURCES "musl/src/misc/*.c") +file(GLOB PRNG_SOURCES "musl/src/prng/*.c") file(GLOB SEARCH_SOURCES "musl/src/search/*.c") file(GLOB STDIO_SOURCES "musl/src/stdio/*.c") file(GLOB STDLIB_SOURCES "musl/src/stdlib/*.c") @@ -38,6 +39,7 @@ add_library(c ${MATH_SOURCES} ${MBYTE_SOURCES} ${MISC_SOURCES} + ${PRNG_SOURCES} ${SEARCH_SOURCES} ${STDIO_SOURCES} ${STDLIB_SOURCES} @@ -59,6 +61,7 @@ add_native_library(native_c ${MATH_SOURCES} ${MBYTE_SOURCES} ${MISC_SOURCES} + ${PRNG_SOURCES} ${SEARCH_SOURCES} ${STDIO_SOURCES} ${STDLIB_SOURCES} diff --git a/libraries/libc/musl b/libraries/libc/musl index 5c68a528ad..4a7013c9b1 160000 --- a/libraries/libc/musl +++ b/libraries/libc/musl @@ -1 +1 @@ -Subproject commit 5c68a528ad29c364245d3b56eec7b4a375acd19b +Subproject commit 4a7013c9b1f26d7a8cc2967179603c3963ead9ac diff --git a/tools/tester/CMakeLists.txt b/tools/tester/CMakeLists.txt index 2ab7cc521b..19baab77ac 100644 --- a/tools/tester/CMakeLists.txt +++ b/tools/tester/CMakeLists.txt @@ -12,9 +12,9 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) - message(FATAL_ERROR "GCC version must be at least 8.0.") - endif() + #if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) + # message(FATAL_ERROR "GCC version must be at least 7.0.") + #endif() if("${CMAKE_GENERATOR}" STREQUAL "Ninja") add_compile_options(-fdiagnostics-color=always) endif() diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index 63835b4eea..2070fdd5b0 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -309,8 +309,9 @@ ABIEOS_REFLECT(contract_row) { struct file { FILE* f = nullptr; + bool owns; - file(FILE* f = nullptr) : f(f) {} + file(FILE* f = nullptr, bool owns = true) : f(f), owns(owns) {} file(const file&) = delete; file(file&& src) { *this = std::move(src); } @@ -322,14 +323,17 @@ struct file { file& operator=(file&& src) { close(); this->f = src.f; + this->owns = src.owns; src.f = nullptr; + src.owns = false; return *this; } void close() { - if (f) + if (owns) fclose(f); f = nullptr; + owns = false; } }; @@ -524,6 +528,24 @@ struct callbacks { void get_args(uint32_t cb_alloc_data, uint32_t cb_alloc) { set_data(cb_alloc_data, cb_alloc, state.args); } + int32_t clock_gettime(int32_t id, void* data) { + check_bounds((char*)data, (char*)data+8); + std::chrono::nanoseconds result; + if(id == 0) { // CLOCK_REALTIME + result = std::chrono::system_clock::now().time_since_epoch(); + } else if(id == 1) { // CLOCK_MONOTONIC + result = std::chrono::steady_clock::now().time_since_epoch(); + } else { + return -1; + } + int32_t sec = result.count()/1000000000; + int32_t nsec = result.count()%1000000000; + fc::datastream ds((char*)data, 8); + fc::raw::pack(ds, sec); + fc::raw::pack(ds, nsec); + return 0; + } + bool reenter(const char* args_begin, const char* args_end, uint32_t f, uint32_t cb_alloc_data, uint32_t cb_alloc) { check_bounds(args_begin, args_end); try { @@ -534,6 +556,9 @@ struct callbacks { ::state state{ this->state.wasm, wa, backend, { args_begin, args_end } }; callbacks cb{ state }; backend.set_wasm_allocator(&wa); + state.files.emplace_back(stdin, false); + state.files.emplace_back(stdout, false); + state.files.emplace_back(stderr, false); rhf_t::resolve(backend.get_module()); backend.initialize(&cb); @@ -572,6 +597,10 @@ struct callbacks { return state.files[file_index]; } + bool isatty(int32_t file_index) { + return !assert_file(file_index).owns; + } + void close_file(int32_t file_index) { assert_file(file_index).close(); } bool write_file(int32_t file_index, const char* content_begin, const char* content_end) { @@ -776,8 +805,10 @@ void register_callbacks() { rhf_t::add("env", "eosio_assert_message"); rhf_t::add("env", "print_range"); rhf_t::add("env", "get_args"); + rhf_t::add("env", "clock_gettime"); rhf_t::add("env", "reenter"); rhf_t::add("env", "open_file"); + rhf_t::add("env", "isatty"); rhf_t::add("env", "close_file"); rhf_t::add("env", "write_file"); rhf_t::add("env", "read_whole_file"); @@ -812,6 +843,9 @@ static void run(const char* wasm, const std::vector& args) { backend_t backend(code); ::state state{ wasm, wa, backend, abieos::native_to_bin(args) }; callbacks cb{ state }; + state.files.emplace_back(stdin, false); + state.files.emplace_back(stdout, false); + state.files.emplace_back(stderr, false); backend.set_wasm_allocator(&wa); rhf_t::resolve(backend.get_module()); From e570a2f95dc41f2a0505bb7661c34a6721686a20 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 15 Jan 2020 14:19:06 -0500 Subject: [PATCH 15/50] Support Boost.Test and Catch2 in the tester. Boost.Test only works in header only mode for now. Building it as a static library results in mysterious link errors. Support stdio/iostreams in CDT (only works in the tester, not in contracts as EOSIO has neither a filesystem nor stdin.) Eliminate file handling and generic test library functionality from tester. --- .gitmodules | 3 + libraries/Catch2 | 1 + .../include/boost/algorithm/cxx11/all_of.hpp | 83 + .../boost/include/boost/aligned_storage.hpp | 18 + libraries/boost/include/boost/bind.hpp | 41 + libraries/boost/include/boost/bind/arg.hpp | 69 + libraries/boost/include/boost/bind/bind.hpp | 2365 +++++++++++++++++ .../boost/include/boost/bind/bind_cc.hpp | 117 + .../boost/include/boost/bind/bind_mf2_cc.hpp | 228 ++ .../boost/include/boost/bind/bind_mf_cc.hpp | 441 +++ .../include/boost/bind/bind_template.hpp | 345 +++ libraries/boost/include/boost/bind/mem_fn.hpp | 389 +++ .../boost/include/boost/bind/mem_fn_cc.hpp | 103 + .../include/boost/bind/mem_fn_template.hpp | 1047 ++++++++ .../boost/include/boost/bind/mem_fn_vw.hpp | 130 + .../boost/include/boost/bind/placeholders.hpp | 62 + .../boost/include/boost/bind/storage.hpp | 475 ++++ libraries/boost/include/boost/call_traits.hpp | 20 + .../boost/include/boost/checked_delete.hpp | 17 + libraries/boost/include/boost/config/user.hpp | 3 + libraries/boost/include/boost/cstdlib.hpp | 41 + .../boost/include/boost/current_function.hpp | 75 + .../exception/current_exception_cast.hpp | 43 + .../exception/detail/error_info_impl.hpp | 102 + .../boost/exception/detail/shared_ptr.hpp | 17 + .../boost/exception/detail/type_info.hpp | 82 + .../include/boost/exception/exception.hpp | 521 ++++ .../boost/exception/get_error_info.hpp | 133 + .../boost/function/detail/maybe_include.hpp | 369 +++ .../boost/function/detail/prologue.hpp | 26 + .../include/boost/function/function0.hpp | 12 + .../include/boost/function/function1.hpp | 12 + .../include/boost/function/function2.hpp | 12 + .../include/boost/function/function_base.hpp | 886 ++++++ .../include/boost/function/function_fwd.hpp | 69 + .../boost/function/function_template.hpp | 1187 +++++++++ .../boost/include/boost/function_equal.hpp | 28 + libraries/boost/include/boost/get_pointer.hpp | 76 + libraries/boost/include/boost/integer.hpp | 262 ++ .../include/boost/integer/static_log2.hpp | 127 + libraries/boost/include/boost/integer_fwd.hpp | 190 ++ .../boost/include/boost/integer_traits.hpp | 256 ++ .../boost/include/boost/io/ios_state.hpp | 439 +++ libraries/boost/include/boost/io_fwd.hpp | 67 + .../boost/include/boost/is_placeholder.hpp | 31 + .../boost/iterator/detail/config_def.hpp | 128 + .../boost/iterator/detail/config_undef.hpp | 24 + .../boost/iterator/detail/enable_if.hpp | 83 + .../detail/facade_iterator_category.hpp | 193 ++ .../include/boost/iterator/interoperable.hpp | 54 + .../boost/iterator/iterator_categories.hpp | 216 ++ .../boost/iterator/iterator_facade.hpp | 981 +++++++ .../boost/iterator/iterator_traits.hpp | 61 + libraries/boost/include/boost/limits.hpp | 146 + libraries/boost/include/boost/make_shared.hpp | 16 + libraries/boost/include/boost/mem_fn.hpp | 24 + libraries/boost/include/boost/noncopyable.hpp | 17 + libraries/boost/include/boost/none.hpp | 59 + libraries/boost/include/boost/none_t.hpp | 39 + .../numeric/conversion/conversion_traits.hpp | 32 + .../conversion/detail/conversion_traits.hpp | 97 + .../conversion/detail/int_float_mixture.hpp | 72 + .../conversion/detail/is_subranged.hpp | 234 ++ .../boost/numeric/conversion/detail/meta.hpp | 120 + .../conversion/detail/sign_mixture.hpp | 72 + .../conversion/detail/udt_builtin_mixture.hpp | 69 + .../conversion/int_float_mixture_enum.hpp | 29 + .../numeric/conversion/sign_mixture_enum.hpp | 29 + .../conversion/udt_builtin_mixture_enum.hpp | 26 + libraries/boost/include/boost/optional.hpp | 18 + .../boost/optional/bad_optional_access.hpp | 32 + .../detail/old_optional_implementation.hpp | 1059 ++++++++ .../detail/optional_aligned_storage.hpp | 71 + .../boost/optional/detail/optional_config.hpp | 135 + .../detail/optional_factory_support.hpp | 36 + .../detail/optional_reference_spec.hpp | 253 ++ .../boost/optional/detail/optional_relops.hpp | 196 ++ .../boost/optional/detail/optional_swap.hpp | 117 + .../optional_trivially_copyable_base.hpp | 499 ++++ .../boost/include/boost/optional/optional.hpp | 1490 +++++++++++ .../include/boost/optional/optional_fwd.hpp | 41 + libraries/boost/include/boost/predef.h | 24 + .../boost/include/boost/predef/architecture.h | 32 + .../include/boost/predef/architecture/alpha.h | 59 + .../include/boost/predef/architecture/arm.h | 75 + .../boost/predef/architecture/blackfin.h | 46 + .../boost/predef/architecture/convex.h | 65 + .../include/boost/predef/architecture/ia64.h | 49 + .../include/boost/predef/architecture/m68k.h | 82 + .../include/boost/predef/architecture/mips.h | 73 + .../boost/predef/architecture/parisc.h | 64 + .../include/boost/predef/architecture/ppc.h | 72 + .../boost/predef/architecture/pyramid.h | 42 + .../include/boost/predef/architecture/rs6k.h | 56 + .../include/boost/predef/architecture/sparc.h | 54 + .../boost/predef/architecture/superh.h | 67 + .../boost/predef/architecture/sys370.h | 43 + .../boost/predef/architecture/sys390.h | 43 + .../include/boost/predef/architecture/x86.h | 38 + .../boost/predef/architecture/x86/32.h | 87 + .../boost/predef/architecture/x86/64.h | 50 + .../include/boost/predef/architecture/z.h | 42 + .../boost/include/boost/predef/compiler.h | 43 + .../include/boost/predef/compiler/borland.h | 63 + .../include/boost/predef/compiler/clang.h | 56 + .../include/boost/predef/compiler/comeau.h | 61 + .../include/boost/predef/compiler/compaq.h | 66 + .../include/boost/predef/compiler/diab.h | 56 + .../boost/predef/compiler/digitalmars.h | 56 + .../include/boost/predef/compiler/dignus.h | 56 + .../boost/include/boost/predef/compiler/edg.h | 56 + .../include/boost/predef/compiler/ekopath.h | 57 + .../boost/include/boost/predef/compiler/gcc.h | 68 + .../include/boost/predef/compiler/gcc_xml.h | 53 + .../boost/predef/compiler/greenhills.h | 66 + .../include/boost/predef/compiler/hp_acc.h | 61 + .../boost/include/boost/predef/compiler/iar.h | 56 + .../boost/include/boost/predef/compiler/ibm.h | 72 + .../include/boost/predef/compiler/intel.h | 79 + .../boost/include/boost/predef/compiler/kai.h | 56 + .../include/boost/predef/compiler/llvm.h | 57 + .../include/boost/predef/compiler/metaware.h | 53 + .../boost/predef/compiler/metrowerks.h | 77 + .../include/boost/predef/compiler/microtec.h | 53 + .../boost/include/boost/predef/compiler/mpw.h | 63 + .../include/boost/predef/compiler/palm.h | 56 + .../boost/include/boost/predef/compiler/pgi.h | 60 + .../boost/predef/compiler/sgi_mipspro.h | 66 + .../include/boost/predef/compiler/sunpro.h | 76 + .../include/boost/predef/compiler/tendra.h | 53 + .../include/boost/predef/compiler/visualc.h | 105 + .../include/boost/predef/compiler/watcom.h | 56 + .../include/boost/predef/detail/_cassert.h | 17 + .../include/boost/predef/detail/_exception.h | 15 + .../boost/predef/detail/comp_detected.h | 10 + .../include/boost/predef/detail/os_detected.h | 10 + .../boost/predef/detail/platform_detected.h | 10 + .../boost/include/boost/predef/detail/test.h | 17 + .../boost/include/boost/predef/hardware.h | 16 + .../include/boost/predef/hardware/simd.h | 119 + .../include/boost/predef/hardware/simd/arm.h | 59 + .../boost/predef/hardware/simd/arm/versions.h | 32 + .../include/boost/predef/hardware/simd/ppc.h | 69 + .../boost/predef/hardware/simd/ppc/versions.h | 51 + .../include/boost/predef/hardware/simd/x86.h | 123 + .../boost/predef/hardware/simd/x86/versions.h | 129 + .../boost/predef/hardware/simd/x86_amd.h | 87 + .../predef/hardware/simd/x86_amd/versions.h | 51 + .../boost/include/boost/predef/language.h | 17 + .../include/boost/predef/language/objc.h | 42 + .../include/boost/predef/language/stdc.h | 53 + .../include/boost/predef/language/stdcpp.h | 121 + .../boost/include/boost/predef/library.h | 16 + .../boost/include/boost/predef/library/c.h | 21 + .../include/boost/predef/library/c/_prefix.h | 13 + .../include/boost/predef/library/c/cloudabi.h | 53 + .../include/boost/predef/library/c/gnu.h | 61 + .../boost/include/boost/predef/library/c/uc.h | 47 + .../include/boost/predef/library/c/vms.h | 47 + .../include/boost/predef/library/c/zos.h | 56 + .../boost/include/boost/predef/library/std.h | 25 + .../boost/predef/library/std/_prefix.h | 23 + .../include/boost/predef/library/std/cxx.h | 46 + .../boost/predef/library/std/dinkumware.h | 52 + .../boost/predef/library/std/libcomo.h | 47 + .../include/boost/predef/library/std/modena.h | 45 + .../include/boost/predef/library/std/msl.h | 53 + .../boost/predef/library/std/roguewave.h | 56 + .../include/boost/predef/library/std/sgi.h | 51 + .../boost/predef/library/std/stdcpp3.h | 53 + .../boost/predef/library/std/stlport.h | 59 + .../include/boost/predef/library/std/vacpp.h | 44 + libraries/boost/include/boost/predef/make.h | 93 + libraries/boost/include/boost/predef/os.h | 33 + libraries/boost/include/boost/predef/os/aix.h | 66 + .../boost/include/boost/predef/os/amigaos.h | 46 + .../boost/include/boost/predef/os/android.h | 45 + .../boost/include/boost/predef/os/beos.h | 45 + libraries/boost/include/boost/predef/os/bsd.h | 103 + .../boost/include/boost/predef/os/bsd/bsdi.h | 48 + .../include/boost/predef/os/bsd/dragonfly.h | 50 + .../boost/include/boost/predef/os/bsd/free.h | 67 + .../boost/include/boost/predef/os/bsd/net.h | 84 + .../boost/include/boost/predef/os/bsd/open.h | 251 ++ .../boost/include/boost/predef/os/cygwin.h | 45 + .../boost/include/boost/predef/os/haiku.h | 46 + .../boost/include/boost/predef/os/hpux.h | 47 + libraries/boost/include/boost/predef/os/ios.h | 51 + .../boost/include/boost/predef/os/irix.h | 46 + .../boost/include/boost/predef/os/linux.h | 46 + .../boost/include/boost/predef/os/macos.h | 65 + .../boost/include/boost/predef/os/os400.h | 45 + .../boost/include/boost/predef/os/qnxnto.h | 59 + .../boost/include/boost/predef/os/solaris.h | 46 + .../boost/include/boost/predef/os/unix.h | 76 + libraries/boost/include/boost/predef/os/vms.h | 52 + .../boost/include/boost/predef/os/windows.h | 51 + libraries/boost/include/boost/predef/other.h | 16 + .../boost/include/boost/predef/other/endian.h | 204 ++ .../boost/include/boost/predef/platform.h | 28 + .../include/boost/predef/platform/cloudabi.h | 43 + .../boost/include/boost/predef/platform/ios.h | 58 + .../include/boost/predef/platform/mingw.h | 69 + .../include/boost/predef/platform/mingw32.h | 63 + .../include/boost/predef/platform/mingw64.h | 63 + .../boost/predef/platform/windows_desktop.h | 51 + .../boost/predef/platform/windows_phone.h | 48 + .../boost/predef/platform/windows_runtime.h | 53 + .../boost/predef/platform/windows_server.h | 47 + .../boost/predef/platform/windows_store.h | 50 + .../boost/predef/platform/windows_system.h | 47 + .../boost/predef/platform/windows_uwp.h | 60 + .../boost/include/boost/predef/version.h | 15 + .../include/boost/predef/version_number.h | 72 + libraries/boost/include/boost/range/begin.hpp | 135 + .../boost/include/boost/range/config.hpp | 56 + .../include/boost/range/const_iterator.hpp | 76 + .../include/boost/range/detail/begin.hpp | 83 + .../include/boost/range/detail/common.hpp | 118 + .../boost/include/boost/range/detail/end.hpp | 86 + .../range/detail/extract_optional_type.hpp | 48 + .../range/detail/implementation_help.hpp | 114 + .../detail/msvc_has_iterator_workaround.hpp | 132 + .../include/boost/range/detail/sfinae.hpp | 77 + libraries/boost/include/boost/range/end.hpp | 128 + .../boost/include/boost/range/iterator.hpp | 74 + .../include/boost/range/mutable_iterator.hpp | 79 + .../boost/include/boost/range/range_fwd.hpp | 63 + .../boost/include/boost/scoped_array.hpp | 15 + libraries/boost/include/boost/scoped_ptr.hpp | 15 + libraries/boost/include/boost/shared_ptr.hpp | 19 + .../boost/smart_ptr/allocate_shared_array.hpp | 703 +++++ .../include/boost/smart_ptr/bad_weak_ptr.hpp | 70 + .../smart_ptr/detail/lightweight_mutex.hpp | 42 + .../smart_ptr/detail/local_counted_base.hpp | 148 ++ .../smart_ptr/detail/local_sp_deleter.hpp | 91 + .../boost/smart_ptr/detail/lwm_nop.hpp | 37 + .../boost/smart_ptr/detail/lwm_pthreads.hpp | 87 + .../boost/smart_ptr/detail/lwm_win32_cs.hpp | 134 + .../boost/smart_ptr/detail/operator_bool.hpp | 64 + .../smart_ptr/detail/quick_allocator.hpp | 199 ++ .../boost/smart_ptr/detail/shared_count.hpp | 667 +++++ .../boost/smart_ptr/detail/sp_convertible.hpp | 92 + .../smart_ptr/detail/sp_counted_base.hpp | 96 + .../detail/sp_counted_base_acc_ia64.hpp | 152 ++ .../smart_ptr/detail/sp_counted_base_aix.hpp | 144 + .../detail/sp_counted_base_clang.hpp | 150 ++ .../detail/sp_counted_base_cw_ppc.hpp | 172 ++ .../detail/sp_counted_base_gcc_ia64.hpp | 159 ++ .../detail/sp_counted_base_gcc_mips.hpp | 189 ++ .../detail/sp_counted_base_gcc_ppc.hpp | 183 ++ .../detail/sp_counted_base_gcc_sparc.hpp | 168 ++ .../detail/sp_counted_base_gcc_x86.hpp | 175 ++ .../smart_ptr/detail/sp_counted_base_nt.hpp | 109 + .../smart_ptr/detail/sp_counted_base_pt.hpp | 138 + .../detail/sp_counted_base_snc_ps3.hpp | 163 ++ .../smart_ptr/detail/sp_counted_base_spin.hpp | 133 + .../detail/sp_counted_base_std_atomic.hpp | 138 + .../smart_ptr/detail/sp_counted_base_sync.hpp | 157 ++ .../detail/sp_counted_base_vacpp_ppc.hpp | 152 ++ .../smart_ptr/detail/sp_counted_base_w32.hpp | 132 + .../smart_ptr/detail/sp_counted_impl.hpp | 292 ++ .../detail/sp_disable_deprecated.hpp | 40 + .../boost/smart_ptr/detail/sp_forward.hpp | 52 + .../boost/smart_ptr/detail/sp_has_sync.hpp | 69 + .../boost/smart_ptr/detail/sp_interlocked.hpp | 163 ++ .../boost/smart_ptr/detail/sp_noexcept.hpp | 48 + .../boost/smart_ptr/detail/sp_nullptr_t.hpp | 45 + .../boost/smart_ptr/detail/spinlock.hpp | 68 + .../smart_ptr/detail/spinlock_gcc_arm.hpp | 121 + .../boost/smart_ptr/detail/spinlock_nt.hpp | 89 + .../boost/smart_ptr/detail/spinlock_pool.hpp | 91 + .../boost/smart_ptr/detail/spinlock_pt.hpp | 79 + .../smart_ptr/detail/spinlock_std_atomic.hpp | 83 + .../boost/smart_ptr/detail/spinlock_sync.hpp | 87 + .../boost/smart_ptr/detail/spinlock_w32.hpp | 113 + .../boost/smart_ptr/detail/yield_k.hpp | 177 ++ .../include/boost/smart_ptr/make_shared.hpp | 21 + .../boost/smart_ptr/make_shared_array.hpp | 66 + .../boost/smart_ptr/make_shared_object.hpp | 801 ++++++ .../include/boost/smart_ptr/scoped_array.hpp | 132 + .../include/boost/smart_ptr/scoped_ptr.hpp | 167 ++ .../include/boost/smart_ptr/shared_ptr.hpp | 1184 +++++++++ libraries/boost/include/boost/swap.hpp | 17 + .../include/boost/test/auto_unit_test.hpp | 18 + .../boost/include/boost/test/data/config.hpp | 45 + .../boost/include/boost/test/data/dataset.hpp | 19 + .../boost/test/data/for_each_sample.hpp | 117 + .../include/boost/test/data/generators.hpp | 19 + .../boost/test/data/index_sequence.hpp | 62 + .../include/boost/test/data/monomorphic.hpp | 27 + .../boost/test/data/monomorphic/array.hpp | 83 + .../test/data/monomorphic/collection.hpp | 91 + .../boost/test/data/monomorphic/fwd.hpp | 180 ++ .../boost/test/data/monomorphic/generate.hpp | 111 + .../test/data/monomorphic/generators.hpp | 20 + .../data/monomorphic/generators/keywords.hpp | 39 + .../data/monomorphic/generators/random.hpp | 198 ++ .../data/monomorphic/generators/xrange.hpp | 224 ++ .../boost/test/data/monomorphic/grid.hpp | 183 ++ .../data/monomorphic/initializer_list.hpp | 81 + .../boost/test/data/monomorphic/join.hpp | 148 ++ .../test/data/monomorphic/sample_merge.hpp | 103 + .../boost/test/data/monomorphic/singleton.hpp | 119 + .../boost/test/data/monomorphic/zip.hpp | 194 ++ .../boost/include/boost/test/data/size.hpp | 145 + .../include/boost/test/data/test_case.hpp | 325 +++ libraries/boost/include/boost/test/debug.hpp | 138 + .../boost/include/boost/test/debug_config.hpp | 24 + .../include/boost/test/detail/config.hpp | 127 + .../boost/test/detail/enable_warnings.hpp | 36 + .../include/boost/test/detail/fwd_decl.hpp | 46 + .../boost/test/detail/global_typedef.hpp | 111 + .../include/boost/test/detail/log_level.hpp | 40 + .../include/boost/test/detail/pp_variadic.hpp | 49 + .../boost/test/detail/suppress_warnings.hpp | 38 + .../boost/test/detail/throw_exception.hpp | 71 + .../include/boost/test/detail/workaround.hpp | 56 + .../include/boost/test/execution_monitor.hpp | 579 ++++ .../boost/test/floating_point_comparison.hpp | 14 + .../boost/include/boost/test/framework.hpp | 303 +++ .../test/impl/compiler_log_formatter.ipp | 298 +++ .../include/boost/test/impl/cpp_main.ipp | 136 + .../boost/include/boost/test/impl/debug.ipp | 1009 +++++++ .../include/boost/test/impl/decorator.ipp | 202 ++ .../boost/test/impl/execution_monitor.ipp | 1448 ++++++++++ .../include/boost/test/impl/framework.ipp | 1713 ++++++++++++ .../boost/test/impl/junit_log_formatter.ipp | 840 ++++++ .../test/impl/plain_report_formatter.ipp | 207 ++ .../boost/test/impl/progress_monitor.ipp | 185 ++ .../boost/test/impl/results_collector.ipp | 285 ++ .../boost/test/impl/results_reporter.ipp | 197 ++ .../impl/test_framework_init_observer.ipp | 109 + .../include/boost/test/impl/test_main.ipp | 65 + .../include/boost/test/impl/test_tools.ipp | 823 ++++++ .../include/boost/test/impl/test_tree.ipp | 504 ++++ .../include/boost/test/impl/unit_test_log.ipp | 691 +++++ .../boost/test/impl/unit_test_main.ipp | 293 ++ .../boost/test/impl/unit_test_monitor.ipp | 75 + .../boost/test/impl/unit_test_parameters.ipp | 772 ++++++ .../boost/test/impl/xml_log_formatter.ipp | 223 ++ .../boost/test/impl/xml_report_formatter.ipp | 111 + .../boost/test/included/execution_monitor.hpp | 21 + .../boost/test/included/prg_exec_monitor.hpp | 25 + .../boost/test/included/test_exec_monitor.hpp | 40 + .../include/boost/test/included/unit_test.hpp | 40 + .../test/included/unit_test_framework.hpp | 12 + .../boost/include/boost/test/minimal.hpp | 156 ++ .../test/output/compiler_log_formatter.hpp | 70 + .../boost/test/output/junit_log_formatter.hpp | 167 ++ .../test/output/plain_report_formatter.hpp | 59 + .../boost/test/output/xml_log_formatter.hpp | 72 + .../test/output/xml_report_formatter.hpp | 52 + .../include/boost/test/output_test_stream.hpp | 14 + .../include/boost/test/parameterized_test.hpp | 176 ++ .../include/boost/test/predicate_result.hpp | 14 + .../include/boost/test/prg_exec_monitor.hpp | 81 + .../include/boost/test/progress_monitor.hpp | 66 + .../include/boost/test/results_collector.hpp | 143 + .../include/boost/test/results_reporter.hpp | 122 + .../include/boost/test/test_case_template.hpp | 13 + .../include/boost/test/test_exec_monitor.hpp | 53 + .../test/test_framework_init_observer.hpp | 63 + .../boost/include/boost/test/test_tools.hpp | 68 + .../include/boost/test/tools/assertion.hpp | 410 +++ .../boost/test/tools/assertion_result.hpp | 90 + .../test/tools/collection_comparison_op.hpp | 449 ++++ .../include/boost/test/tools/context.hpp | 65 + .../test/tools/cstring_comparison_op.hpp | 88 + .../boost/test/tools/detail/bitwise_manip.hpp | 123 + .../test/tools/detail/expression_holder.hpp | 70 + .../include/boost/test/tools/detail/fwd.hpp | 121 + .../boost/test/tools/detail/indirections.hpp | 94 + .../boost/test/tools/detail/it_pair.hpp | 74 + .../test/tools/detail/lexicographic_manip.hpp | 69 + .../test/tools/detail/per_element_manip.hpp | 69 + .../boost/test/tools/detail/print_helper.hpp | 246 ++ .../test/tools/detail/tolerance_manip.hpp | 130 + .../test/tools/floating_point_comparison.hpp | 315 +++ .../boost/include/boost/test/tools/fpc_op.hpp | 210 ++ .../boost/test/tools/fpc_tolerance.hpp | 103 + .../include/boost/test/tools/interface.hpp | 369 +++ .../include/boost/test/tools/old/impl.hpp | 358 +++ .../boost/test/tools/old/interface.hpp | 282 ++ .../boost/test/tools/output_test_stream.hpp | 107 + .../boost/test/tree/auto_registration.hpp | 53 + .../include/boost/test/tree/decorator.hpp | 277 ++ .../boost/include/boost/test/tree/fixture.hpp | 191 ++ .../boost/test/tree/global_fixture.hpp | 123 + .../include/boost/test/tree/observer.hpp | 116 + .../boost/test/tree/test_case_counter.hpp | 52 + .../boost/test/tree/test_case_template.hpp | 190 ++ .../include/boost/test/tree/test_unit.hpp | 275 ++ .../include/boost/test/tree/traverse.hpp | 58 + .../boost/include/boost/test/tree/visitor.hpp | 52 + .../boost/include/boost/test/unit_test.hpp | 70 + .../include/boost/test/unit_test_log.hpp | 280 ++ .../boost/test/unit_test_log_formatter.hpp | 322 +++ .../include/boost/test/unit_test_monitor.hpp | 60 + .../boost/test/unit_test_parameters.hpp | 158 ++ .../include/boost/test/unit_test_suite.hpp | 403 +++ .../include/boost/test/utils/algorithm.hpp | 326 +++ .../include/boost/test/utils/assign_op.hpp | 39 + .../utils/basic_cstring/basic_cstring.hpp | 749 ++++++ .../utils/basic_cstring/basic_cstring_fwd.hpp | 40 + .../utils/basic_cstring/bcs_char_traits.hpp | 150 ++ .../test/utils/basic_cstring/compare.hpp | 151 ++ .../boost/test/utils/basic_cstring/io.hpp | 73 + .../boost/test/utils/class_properties.hpp | 195 ++ .../include/boost/test/utils/custom_manip.hpp | 61 + .../include/boost/test/utils/foreach.hpp | 316 +++ .../include/boost/test/utils/is_cstring.hpp | 116 + .../boost/test/utils/is_forward_iterable.hpp | 267 ++ .../utils/iterator/input_iterator_facade.hpp | 105 + .../test/utils/iterator/token_iterator.hpp | 421 +++ .../include/boost/test/utils/lazy_ostream.hpp | 128 + .../include/boost/test/utils/named_params.hpp | 388 +++ .../include/boost/test/utils/nullstream.hpp | 103 + .../boost/include/boost/test/utils/rtti.hpp | 63 + .../boost/test/utils/runtime/argument.hpp | 131 + .../test/utils/runtime/argument_factory.hpp | 242 ++ .../test/utils/runtime/cla/argv_traverser.hpp | 105 + .../boost/test/utils/runtime/cla/parser.hpp | 584 ++++ .../boost/test/utils/runtime/env/fetch.hpp | 108 + .../boost/test/utils/runtime/errors.hpp | 195 ++ .../boost/test/utils/runtime/finalize.hpp | 56 + .../include/boost/test/utils/runtime/fwd.hpp | 45 + .../boost/test/utils/runtime/modifier.hpp | 106 + .../boost/test/utils/runtime/parameter.hpp | 526 ++++ .../include/boost/test/utils/setcolor.hpp | 315 +++ .../include/boost/test/utils/string_cast.hpp | 69 + .../boost/test/utils/trivial_singleton.hpp | 79 + .../boost/test/utils/wrap_stringstream.hpp | 162 ++ .../include/boost/test/utils/xml_printer.hpp | 143 + .../boost/include/boost/throw_exception.hpp | 102 + libraries/boost/include/boost/timer.hpp | 72 + libraries/boost/include/boost/type.hpp | 18 + libraries/boost/include/boost/type_index.hpp | 265 ++ .../boost/type_index/ctti_type_index.hpp | 213 ++ .../detail/compile_time_type_info.hpp | 291 ++ .../type_index/detail/ctti_register_class.hpp | 40 + .../type_index/detail/stl_register_class.hpp | 40 + .../boost/type_index/stl_type_index.hpp | 276 ++ .../boost/type_index/type_index_facade.hpp | 297 +++ libraries/boost/include/boost/visit_each.hpp | 27 + libraries/eosiolib/CMakeLists.txt | 27 +- libraries/eosiolib/tester/crt0.cpp | 18 + libraries/eosiolib/tester/eosio/tester.hpp | 166 +- libraries/libc/musl | 2 +- tools/include/compiler_options.hpp.in | 2 + tools/tester/src/eosio-tester.cpp | 14 +- 451 files changed, 66360 insertions(+), 168 deletions(-) create mode 160000 libraries/Catch2 create mode 100644 libraries/boost/include/boost/algorithm/cxx11/all_of.hpp create mode 100644 libraries/boost/include/boost/aligned_storage.hpp create mode 100644 libraries/boost/include/boost/bind.hpp create mode 100644 libraries/boost/include/boost/bind/arg.hpp create mode 100644 libraries/boost/include/boost/bind/bind.hpp create mode 100644 libraries/boost/include/boost/bind/bind_cc.hpp create mode 100644 libraries/boost/include/boost/bind/bind_mf2_cc.hpp create mode 100644 libraries/boost/include/boost/bind/bind_mf_cc.hpp create mode 100644 libraries/boost/include/boost/bind/bind_template.hpp create mode 100644 libraries/boost/include/boost/bind/mem_fn.hpp create mode 100644 libraries/boost/include/boost/bind/mem_fn_cc.hpp create mode 100644 libraries/boost/include/boost/bind/mem_fn_template.hpp create mode 100644 libraries/boost/include/boost/bind/mem_fn_vw.hpp create mode 100644 libraries/boost/include/boost/bind/placeholders.hpp create mode 100644 libraries/boost/include/boost/bind/storage.hpp create mode 100644 libraries/boost/include/boost/call_traits.hpp create mode 100644 libraries/boost/include/boost/checked_delete.hpp create mode 100644 libraries/boost/include/boost/cstdlib.hpp create mode 100644 libraries/boost/include/boost/current_function.hpp create mode 100644 libraries/boost/include/boost/exception/current_exception_cast.hpp create mode 100644 libraries/boost/include/boost/exception/detail/error_info_impl.hpp create mode 100644 libraries/boost/include/boost/exception/detail/shared_ptr.hpp create mode 100644 libraries/boost/include/boost/exception/detail/type_info.hpp create mode 100644 libraries/boost/include/boost/exception/exception.hpp create mode 100644 libraries/boost/include/boost/exception/get_error_info.hpp create mode 100644 libraries/boost/include/boost/function/detail/maybe_include.hpp create mode 100644 libraries/boost/include/boost/function/detail/prologue.hpp create mode 100644 libraries/boost/include/boost/function/function0.hpp create mode 100644 libraries/boost/include/boost/function/function1.hpp create mode 100644 libraries/boost/include/boost/function/function2.hpp create mode 100644 libraries/boost/include/boost/function/function_base.hpp create mode 100644 libraries/boost/include/boost/function/function_fwd.hpp create mode 100644 libraries/boost/include/boost/function/function_template.hpp create mode 100644 libraries/boost/include/boost/function_equal.hpp create mode 100644 libraries/boost/include/boost/get_pointer.hpp create mode 100644 libraries/boost/include/boost/integer.hpp create mode 100644 libraries/boost/include/boost/integer/static_log2.hpp create mode 100644 libraries/boost/include/boost/integer_fwd.hpp create mode 100644 libraries/boost/include/boost/integer_traits.hpp create mode 100644 libraries/boost/include/boost/io/ios_state.hpp create mode 100644 libraries/boost/include/boost/io_fwd.hpp create mode 100644 libraries/boost/include/boost/is_placeholder.hpp create mode 100644 libraries/boost/include/boost/iterator/detail/config_def.hpp create mode 100644 libraries/boost/include/boost/iterator/detail/config_undef.hpp create mode 100644 libraries/boost/include/boost/iterator/detail/enable_if.hpp create mode 100644 libraries/boost/include/boost/iterator/detail/facade_iterator_category.hpp create mode 100644 libraries/boost/include/boost/iterator/interoperable.hpp create mode 100644 libraries/boost/include/boost/iterator/iterator_categories.hpp create mode 100644 libraries/boost/include/boost/iterator/iterator_facade.hpp create mode 100644 libraries/boost/include/boost/iterator/iterator_traits.hpp create mode 100644 libraries/boost/include/boost/limits.hpp create mode 100644 libraries/boost/include/boost/make_shared.hpp create mode 100644 libraries/boost/include/boost/mem_fn.hpp create mode 100644 libraries/boost/include/boost/noncopyable.hpp create mode 100644 libraries/boost/include/boost/none.hpp create mode 100644 libraries/boost/include/boost/none_t.hpp create mode 100644 libraries/boost/include/boost/numeric/conversion/conversion_traits.hpp create mode 100644 libraries/boost/include/boost/numeric/conversion/detail/conversion_traits.hpp create mode 100644 libraries/boost/include/boost/numeric/conversion/detail/int_float_mixture.hpp create mode 100644 libraries/boost/include/boost/numeric/conversion/detail/is_subranged.hpp create mode 100644 libraries/boost/include/boost/numeric/conversion/detail/meta.hpp create mode 100644 libraries/boost/include/boost/numeric/conversion/detail/sign_mixture.hpp create mode 100644 libraries/boost/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp create mode 100644 libraries/boost/include/boost/numeric/conversion/int_float_mixture_enum.hpp create mode 100644 libraries/boost/include/boost/numeric/conversion/sign_mixture_enum.hpp create mode 100644 libraries/boost/include/boost/numeric/conversion/udt_builtin_mixture_enum.hpp create mode 100644 libraries/boost/include/boost/optional.hpp create mode 100644 libraries/boost/include/boost/optional/bad_optional_access.hpp create mode 100644 libraries/boost/include/boost/optional/detail/old_optional_implementation.hpp create mode 100644 libraries/boost/include/boost/optional/detail/optional_aligned_storage.hpp create mode 100644 libraries/boost/include/boost/optional/detail/optional_config.hpp create mode 100644 libraries/boost/include/boost/optional/detail/optional_factory_support.hpp create mode 100644 libraries/boost/include/boost/optional/detail/optional_reference_spec.hpp create mode 100644 libraries/boost/include/boost/optional/detail/optional_relops.hpp create mode 100644 libraries/boost/include/boost/optional/detail/optional_swap.hpp create mode 100644 libraries/boost/include/boost/optional/detail/optional_trivially_copyable_base.hpp create mode 100644 libraries/boost/include/boost/optional/optional.hpp create mode 100644 libraries/boost/include/boost/optional/optional_fwd.hpp create mode 100644 libraries/boost/include/boost/predef.h create mode 100644 libraries/boost/include/boost/predef/architecture.h create mode 100644 libraries/boost/include/boost/predef/architecture/alpha.h create mode 100644 libraries/boost/include/boost/predef/architecture/arm.h create mode 100644 libraries/boost/include/boost/predef/architecture/blackfin.h create mode 100644 libraries/boost/include/boost/predef/architecture/convex.h create mode 100644 libraries/boost/include/boost/predef/architecture/ia64.h create mode 100644 libraries/boost/include/boost/predef/architecture/m68k.h create mode 100644 libraries/boost/include/boost/predef/architecture/mips.h create mode 100644 libraries/boost/include/boost/predef/architecture/parisc.h create mode 100644 libraries/boost/include/boost/predef/architecture/ppc.h create mode 100644 libraries/boost/include/boost/predef/architecture/pyramid.h create mode 100644 libraries/boost/include/boost/predef/architecture/rs6k.h create mode 100644 libraries/boost/include/boost/predef/architecture/sparc.h create mode 100644 libraries/boost/include/boost/predef/architecture/superh.h create mode 100644 libraries/boost/include/boost/predef/architecture/sys370.h create mode 100644 libraries/boost/include/boost/predef/architecture/sys390.h create mode 100644 libraries/boost/include/boost/predef/architecture/x86.h create mode 100644 libraries/boost/include/boost/predef/architecture/x86/32.h create mode 100644 libraries/boost/include/boost/predef/architecture/x86/64.h create mode 100644 libraries/boost/include/boost/predef/architecture/z.h create mode 100644 libraries/boost/include/boost/predef/compiler.h create mode 100644 libraries/boost/include/boost/predef/compiler/borland.h create mode 100644 libraries/boost/include/boost/predef/compiler/clang.h create mode 100644 libraries/boost/include/boost/predef/compiler/comeau.h create mode 100644 libraries/boost/include/boost/predef/compiler/compaq.h create mode 100644 libraries/boost/include/boost/predef/compiler/diab.h create mode 100644 libraries/boost/include/boost/predef/compiler/digitalmars.h create mode 100644 libraries/boost/include/boost/predef/compiler/dignus.h create mode 100644 libraries/boost/include/boost/predef/compiler/edg.h create mode 100644 libraries/boost/include/boost/predef/compiler/ekopath.h create mode 100644 libraries/boost/include/boost/predef/compiler/gcc.h create mode 100644 libraries/boost/include/boost/predef/compiler/gcc_xml.h create mode 100644 libraries/boost/include/boost/predef/compiler/greenhills.h create mode 100644 libraries/boost/include/boost/predef/compiler/hp_acc.h create mode 100644 libraries/boost/include/boost/predef/compiler/iar.h create mode 100644 libraries/boost/include/boost/predef/compiler/ibm.h create mode 100644 libraries/boost/include/boost/predef/compiler/intel.h create mode 100644 libraries/boost/include/boost/predef/compiler/kai.h create mode 100644 libraries/boost/include/boost/predef/compiler/llvm.h create mode 100644 libraries/boost/include/boost/predef/compiler/metaware.h create mode 100644 libraries/boost/include/boost/predef/compiler/metrowerks.h create mode 100644 libraries/boost/include/boost/predef/compiler/microtec.h create mode 100644 libraries/boost/include/boost/predef/compiler/mpw.h create mode 100644 libraries/boost/include/boost/predef/compiler/palm.h create mode 100644 libraries/boost/include/boost/predef/compiler/pgi.h create mode 100644 libraries/boost/include/boost/predef/compiler/sgi_mipspro.h create mode 100644 libraries/boost/include/boost/predef/compiler/sunpro.h create mode 100644 libraries/boost/include/boost/predef/compiler/tendra.h create mode 100644 libraries/boost/include/boost/predef/compiler/visualc.h create mode 100644 libraries/boost/include/boost/predef/compiler/watcom.h create mode 100644 libraries/boost/include/boost/predef/detail/_cassert.h create mode 100644 libraries/boost/include/boost/predef/detail/_exception.h create mode 100644 libraries/boost/include/boost/predef/detail/comp_detected.h create mode 100644 libraries/boost/include/boost/predef/detail/os_detected.h create mode 100644 libraries/boost/include/boost/predef/detail/platform_detected.h create mode 100644 libraries/boost/include/boost/predef/detail/test.h create mode 100644 libraries/boost/include/boost/predef/hardware.h create mode 100644 libraries/boost/include/boost/predef/hardware/simd.h create mode 100644 libraries/boost/include/boost/predef/hardware/simd/arm.h create mode 100644 libraries/boost/include/boost/predef/hardware/simd/arm/versions.h create mode 100644 libraries/boost/include/boost/predef/hardware/simd/ppc.h create mode 100644 libraries/boost/include/boost/predef/hardware/simd/ppc/versions.h create mode 100644 libraries/boost/include/boost/predef/hardware/simd/x86.h create mode 100644 libraries/boost/include/boost/predef/hardware/simd/x86/versions.h create mode 100644 libraries/boost/include/boost/predef/hardware/simd/x86_amd.h create mode 100644 libraries/boost/include/boost/predef/hardware/simd/x86_amd/versions.h create mode 100644 libraries/boost/include/boost/predef/language.h create mode 100644 libraries/boost/include/boost/predef/language/objc.h create mode 100644 libraries/boost/include/boost/predef/language/stdc.h create mode 100644 libraries/boost/include/boost/predef/language/stdcpp.h create mode 100644 libraries/boost/include/boost/predef/library.h create mode 100644 libraries/boost/include/boost/predef/library/c.h create mode 100644 libraries/boost/include/boost/predef/library/c/_prefix.h create mode 100644 libraries/boost/include/boost/predef/library/c/cloudabi.h create mode 100644 libraries/boost/include/boost/predef/library/c/gnu.h create mode 100644 libraries/boost/include/boost/predef/library/c/uc.h create mode 100644 libraries/boost/include/boost/predef/library/c/vms.h create mode 100644 libraries/boost/include/boost/predef/library/c/zos.h create mode 100644 libraries/boost/include/boost/predef/library/std.h create mode 100644 libraries/boost/include/boost/predef/library/std/_prefix.h create mode 100644 libraries/boost/include/boost/predef/library/std/cxx.h create mode 100644 libraries/boost/include/boost/predef/library/std/dinkumware.h create mode 100644 libraries/boost/include/boost/predef/library/std/libcomo.h create mode 100644 libraries/boost/include/boost/predef/library/std/modena.h create mode 100644 libraries/boost/include/boost/predef/library/std/msl.h create mode 100644 libraries/boost/include/boost/predef/library/std/roguewave.h create mode 100644 libraries/boost/include/boost/predef/library/std/sgi.h create mode 100644 libraries/boost/include/boost/predef/library/std/stdcpp3.h create mode 100644 libraries/boost/include/boost/predef/library/std/stlport.h create mode 100644 libraries/boost/include/boost/predef/library/std/vacpp.h create mode 100644 libraries/boost/include/boost/predef/make.h create mode 100644 libraries/boost/include/boost/predef/os.h create mode 100644 libraries/boost/include/boost/predef/os/aix.h create mode 100644 libraries/boost/include/boost/predef/os/amigaos.h create mode 100644 libraries/boost/include/boost/predef/os/android.h create mode 100644 libraries/boost/include/boost/predef/os/beos.h create mode 100644 libraries/boost/include/boost/predef/os/bsd.h create mode 100644 libraries/boost/include/boost/predef/os/bsd/bsdi.h create mode 100644 libraries/boost/include/boost/predef/os/bsd/dragonfly.h create mode 100644 libraries/boost/include/boost/predef/os/bsd/free.h create mode 100644 libraries/boost/include/boost/predef/os/bsd/net.h create mode 100644 libraries/boost/include/boost/predef/os/bsd/open.h create mode 100644 libraries/boost/include/boost/predef/os/cygwin.h create mode 100644 libraries/boost/include/boost/predef/os/haiku.h create mode 100644 libraries/boost/include/boost/predef/os/hpux.h create mode 100644 libraries/boost/include/boost/predef/os/ios.h create mode 100644 libraries/boost/include/boost/predef/os/irix.h create mode 100644 libraries/boost/include/boost/predef/os/linux.h create mode 100644 libraries/boost/include/boost/predef/os/macos.h create mode 100644 libraries/boost/include/boost/predef/os/os400.h create mode 100644 libraries/boost/include/boost/predef/os/qnxnto.h create mode 100644 libraries/boost/include/boost/predef/os/solaris.h create mode 100644 libraries/boost/include/boost/predef/os/unix.h create mode 100644 libraries/boost/include/boost/predef/os/vms.h create mode 100644 libraries/boost/include/boost/predef/os/windows.h create mode 100644 libraries/boost/include/boost/predef/other.h create mode 100644 libraries/boost/include/boost/predef/other/endian.h create mode 100644 libraries/boost/include/boost/predef/platform.h create mode 100644 libraries/boost/include/boost/predef/platform/cloudabi.h create mode 100644 libraries/boost/include/boost/predef/platform/ios.h create mode 100644 libraries/boost/include/boost/predef/platform/mingw.h create mode 100644 libraries/boost/include/boost/predef/platform/mingw32.h create mode 100644 libraries/boost/include/boost/predef/platform/mingw64.h create mode 100644 libraries/boost/include/boost/predef/platform/windows_desktop.h create mode 100644 libraries/boost/include/boost/predef/platform/windows_phone.h create mode 100644 libraries/boost/include/boost/predef/platform/windows_runtime.h create mode 100644 libraries/boost/include/boost/predef/platform/windows_server.h create mode 100644 libraries/boost/include/boost/predef/platform/windows_store.h create mode 100644 libraries/boost/include/boost/predef/platform/windows_system.h create mode 100644 libraries/boost/include/boost/predef/platform/windows_uwp.h create mode 100644 libraries/boost/include/boost/predef/version.h create mode 100644 libraries/boost/include/boost/predef/version_number.h create mode 100644 libraries/boost/include/boost/range/begin.hpp create mode 100644 libraries/boost/include/boost/range/config.hpp create mode 100644 libraries/boost/include/boost/range/const_iterator.hpp create mode 100644 libraries/boost/include/boost/range/detail/begin.hpp create mode 100644 libraries/boost/include/boost/range/detail/common.hpp create mode 100644 libraries/boost/include/boost/range/detail/end.hpp create mode 100644 libraries/boost/include/boost/range/detail/extract_optional_type.hpp create mode 100644 libraries/boost/include/boost/range/detail/implementation_help.hpp create mode 100644 libraries/boost/include/boost/range/detail/msvc_has_iterator_workaround.hpp create mode 100644 libraries/boost/include/boost/range/detail/sfinae.hpp create mode 100644 libraries/boost/include/boost/range/end.hpp create mode 100644 libraries/boost/include/boost/range/iterator.hpp create mode 100644 libraries/boost/include/boost/range/mutable_iterator.hpp create mode 100644 libraries/boost/include/boost/range/range_fwd.hpp create mode 100644 libraries/boost/include/boost/scoped_array.hpp create mode 100644 libraries/boost/include/boost/scoped_ptr.hpp create mode 100644 libraries/boost/include/boost/shared_ptr.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/allocate_shared_array.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/bad_weak_ptr.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/lightweight_mutex.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/local_counted_base.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/local_sp_deleter.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/lwm_nop.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/lwm_pthreads.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/lwm_win32_cs.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/operator_bool.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/quick_allocator.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/shared_count.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_convertible.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_impl.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_forward.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_has_sync.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_interlocked.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_noexcept.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_nullptr_t.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_nt.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_pool.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_pt.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_sync.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_w32.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/detail/yield_k.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/make_shared.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/make_shared_array.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/make_shared_object.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/scoped_array.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/scoped_ptr.hpp create mode 100644 libraries/boost/include/boost/smart_ptr/shared_ptr.hpp create mode 100644 libraries/boost/include/boost/swap.hpp create mode 100644 libraries/boost/include/boost/test/auto_unit_test.hpp create mode 100644 libraries/boost/include/boost/test/data/config.hpp create mode 100644 libraries/boost/include/boost/test/data/dataset.hpp create mode 100644 libraries/boost/include/boost/test/data/for_each_sample.hpp create mode 100644 libraries/boost/include/boost/test/data/generators.hpp create mode 100644 libraries/boost/include/boost/test/data/index_sequence.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/array.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/collection.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/fwd.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/generate.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/generators.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/generators/keywords.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/generators/random.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/generators/xrange.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/grid.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/initializer_list.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/join.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/sample_merge.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/singleton.hpp create mode 100644 libraries/boost/include/boost/test/data/monomorphic/zip.hpp create mode 100644 libraries/boost/include/boost/test/data/size.hpp create mode 100644 libraries/boost/include/boost/test/data/test_case.hpp create mode 100644 libraries/boost/include/boost/test/debug.hpp create mode 100644 libraries/boost/include/boost/test/debug_config.hpp create mode 100644 libraries/boost/include/boost/test/detail/config.hpp create mode 100644 libraries/boost/include/boost/test/detail/enable_warnings.hpp create mode 100644 libraries/boost/include/boost/test/detail/fwd_decl.hpp create mode 100644 libraries/boost/include/boost/test/detail/global_typedef.hpp create mode 100644 libraries/boost/include/boost/test/detail/log_level.hpp create mode 100644 libraries/boost/include/boost/test/detail/pp_variadic.hpp create mode 100644 libraries/boost/include/boost/test/detail/suppress_warnings.hpp create mode 100644 libraries/boost/include/boost/test/detail/throw_exception.hpp create mode 100644 libraries/boost/include/boost/test/detail/workaround.hpp create mode 100644 libraries/boost/include/boost/test/execution_monitor.hpp create mode 100644 libraries/boost/include/boost/test/floating_point_comparison.hpp create mode 100644 libraries/boost/include/boost/test/framework.hpp create mode 100644 libraries/boost/include/boost/test/impl/compiler_log_formatter.ipp create mode 100644 libraries/boost/include/boost/test/impl/cpp_main.ipp create mode 100644 libraries/boost/include/boost/test/impl/debug.ipp create mode 100644 libraries/boost/include/boost/test/impl/decorator.ipp create mode 100644 libraries/boost/include/boost/test/impl/execution_monitor.ipp create mode 100644 libraries/boost/include/boost/test/impl/framework.ipp create mode 100644 libraries/boost/include/boost/test/impl/junit_log_formatter.ipp create mode 100644 libraries/boost/include/boost/test/impl/plain_report_formatter.ipp create mode 100644 libraries/boost/include/boost/test/impl/progress_monitor.ipp create mode 100644 libraries/boost/include/boost/test/impl/results_collector.ipp create mode 100644 libraries/boost/include/boost/test/impl/results_reporter.ipp create mode 100644 libraries/boost/include/boost/test/impl/test_framework_init_observer.ipp create mode 100644 libraries/boost/include/boost/test/impl/test_main.ipp create mode 100644 libraries/boost/include/boost/test/impl/test_tools.ipp create mode 100644 libraries/boost/include/boost/test/impl/test_tree.ipp create mode 100644 libraries/boost/include/boost/test/impl/unit_test_log.ipp create mode 100644 libraries/boost/include/boost/test/impl/unit_test_main.ipp create mode 100644 libraries/boost/include/boost/test/impl/unit_test_monitor.ipp create mode 100644 libraries/boost/include/boost/test/impl/unit_test_parameters.ipp create mode 100644 libraries/boost/include/boost/test/impl/xml_log_formatter.ipp create mode 100644 libraries/boost/include/boost/test/impl/xml_report_formatter.ipp create mode 100644 libraries/boost/include/boost/test/included/execution_monitor.hpp create mode 100644 libraries/boost/include/boost/test/included/prg_exec_monitor.hpp create mode 100644 libraries/boost/include/boost/test/included/test_exec_monitor.hpp create mode 100644 libraries/boost/include/boost/test/included/unit_test.hpp create mode 100644 libraries/boost/include/boost/test/included/unit_test_framework.hpp create mode 100644 libraries/boost/include/boost/test/minimal.hpp create mode 100644 libraries/boost/include/boost/test/output/compiler_log_formatter.hpp create mode 100644 libraries/boost/include/boost/test/output/junit_log_formatter.hpp create mode 100644 libraries/boost/include/boost/test/output/plain_report_formatter.hpp create mode 100644 libraries/boost/include/boost/test/output/xml_log_formatter.hpp create mode 100644 libraries/boost/include/boost/test/output/xml_report_formatter.hpp create mode 100644 libraries/boost/include/boost/test/output_test_stream.hpp create mode 100644 libraries/boost/include/boost/test/parameterized_test.hpp create mode 100644 libraries/boost/include/boost/test/predicate_result.hpp create mode 100644 libraries/boost/include/boost/test/prg_exec_monitor.hpp create mode 100644 libraries/boost/include/boost/test/progress_monitor.hpp create mode 100644 libraries/boost/include/boost/test/results_collector.hpp create mode 100644 libraries/boost/include/boost/test/results_reporter.hpp create mode 100644 libraries/boost/include/boost/test/test_case_template.hpp create mode 100644 libraries/boost/include/boost/test/test_exec_monitor.hpp create mode 100644 libraries/boost/include/boost/test/test_framework_init_observer.hpp create mode 100644 libraries/boost/include/boost/test/test_tools.hpp create mode 100644 libraries/boost/include/boost/test/tools/assertion.hpp create mode 100644 libraries/boost/include/boost/test/tools/assertion_result.hpp create mode 100644 libraries/boost/include/boost/test/tools/collection_comparison_op.hpp create mode 100644 libraries/boost/include/boost/test/tools/context.hpp create mode 100644 libraries/boost/include/boost/test/tools/cstring_comparison_op.hpp create mode 100644 libraries/boost/include/boost/test/tools/detail/bitwise_manip.hpp create mode 100644 libraries/boost/include/boost/test/tools/detail/expression_holder.hpp create mode 100644 libraries/boost/include/boost/test/tools/detail/fwd.hpp create mode 100644 libraries/boost/include/boost/test/tools/detail/indirections.hpp create mode 100644 libraries/boost/include/boost/test/tools/detail/it_pair.hpp create mode 100644 libraries/boost/include/boost/test/tools/detail/lexicographic_manip.hpp create mode 100644 libraries/boost/include/boost/test/tools/detail/per_element_manip.hpp create mode 100644 libraries/boost/include/boost/test/tools/detail/print_helper.hpp create mode 100644 libraries/boost/include/boost/test/tools/detail/tolerance_manip.hpp create mode 100644 libraries/boost/include/boost/test/tools/floating_point_comparison.hpp create mode 100644 libraries/boost/include/boost/test/tools/fpc_op.hpp create mode 100644 libraries/boost/include/boost/test/tools/fpc_tolerance.hpp create mode 100644 libraries/boost/include/boost/test/tools/interface.hpp create mode 100644 libraries/boost/include/boost/test/tools/old/impl.hpp create mode 100644 libraries/boost/include/boost/test/tools/old/interface.hpp create mode 100644 libraries/boost/include/boost/test/tools/output_test_stream.hpp create mode 100644 libraries/boost/include/boost/test/tree/auto_registration.hpp create mode 100644 libraries/boost/include/boost/test/tree/decorator.hpp create mode 100644 libraries/boost/include/boost/test/tree/fixture.hpp create mode 100644 libraries/boost/include/boost/test/tree/global_fixture.hpp create mode 100644 libraries/boost/include/boost/test/tree/observer.hpp create mode 100644 libraries/boost/include/boost/test/tree/test_case_counter.hpp create mode 100644 libraries/boost/include/boost/test/tree/test_case_template.hpp create mode 100644 libraries/boost/include/boost/test/tree/test_unit.hpp create mode 100644 libraries/boost/include/boost/test/tree/traverse.hpp create mode 100644 libraries/boost/include/boost/test/tree/visitor.hpp create mode 100644 libraries/boost/include/boost/test/unit_test.hpp create mode 100644 libraries/boost/include/boost/test/unit_test_log.hpp create mode 100644 libraries/boost/include/boost/test/unit_test_log_formatter.hpp create mode 100644 libraries/boost/include/boost/test/unit_test_monitor.hpp create mode 100644 libraries/boost/include/boost/test/unit_test_parameters.hpp create mode 100644 libraries/boost/include/boost/test/unit_test_suite.hpp create mode 100644 libraries/boost/include/boost/test/utils/algorithm.hpp create mode 100644 libraries/boost/include/boost/test/utils/assign_op.hpp create mode 100644 libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring.hpp create mode 100644 libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp create mode 100644 libraries/boost/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp create mode 100644 libraries/boost/include/boost/test/utils/basic_cstring/compare.hpp create mode 100644 libraries/boost/include/boost/test/utils/basic_cstring/io.hpp create mode 100644 libraries/boost/include/boost/test/utils/class_properties.hpp create mode 100644 libraries/boost/include/boost/test/utils/custom_manip.hpp create mode 100644 libraries/boost/include/boost/test/utils/foreach.hpp create mode 100644 libraries/boost/include/boost/test/utils/is_cstring.hpp create mode 100644 libraries/boost/include/boost/test/utils/is_forward_iterable.hpp create mode 100644 libraries/boost/include/boost/test/utils/iterator/input_iterator_facade.hpp create mode 100644 libraries/boost/include/boost/test/utils/iterator/token_iterator.hpp create mode 100644 libraries/boost/include/boost/test/utils/lazy_ostream.hpp create mode 100644 libraries/boost/include/boost/test/utils/named_params.hpp create mode 100644 libraries/boost/include/boost/test/utils/nullstream.hpp create mode 100644 libraries/boost/include/boost/test/utils/rtti.hpp create mode 100644 libraries/boost/include/boost/test/utils/runtime/argument.hpp create mode 100644 libraries/boost/include/boost/test/utils/runtime/argument_factory.hpp create mode 100644 libraries/boost/include/boost/test/utils/runtime/cla/argv_traverser.hpp create mode 100644 libraries/boost/include/boost/test/utils/runtime/cla/parser.hpp create mode 100644 libraries/boost/include/boost/test/utils/runtime/env/fetch.hpp create mode 100644 libraries/boost/include/boost/test/utils/runtime/errors.hpp create mode 100644 libraries/boost/include/boost/test/utils/runtime/finalize.hpp create mode 100644 libraries/boost/include/boost/test/utils/runtime/fwd.hpp create mode 100644 libraries/boost/include/boost/test/utils/runtime/modifier.hpp create mode 100644 libraries/boost/include/boost/test/utils/runtime/parameter.hpp create mode 100644 libraries/boost/include/boost/test/utils/setcolor.hpp create mode 100644 libraries/boost/include/boost/test/utils/string_cast.hpp create mode 100644 libraries/boost/include/boost/test/utils/trivial_singleton.hpp create mode 100644 libraries/boost/include/boost/test/utils/wrap_stringstream.hpp create mode 100644 libraries/boost/include/boost/test/utils/xml_printer.hpp create mode 100644 libraries/boost/include/boost/throw_exception.hpp create mode 100644 libraries/boost/include/boost/timer.hpp create mode 100644 libraries/boost/include/boost/type.hpp create mode 100644 libraries/boost/include/boost/type_index.hpp create mode 100644 libraries/boost/include/boost/type_index/ctti_type_index.hpp create mode 100644 libraries/boost/include/boost/type_index/detail/compile_time_type_info.hpp create mode 100644 libraries/boost/include/boost/type_index/detail/ctti_register_class.hpp create mode 100644 libraries/boost/include/boost/type_index/detail/stl_register_class.hpp create mode 100644 libraries/boost/include/boost/type_index/stl_type_index.hpp create mode 100644 libraries/boost/include/boost/type_index/type_index_facade.hpp create mode 100644 libraries/boost/include/boost/visit_each.hpp create mode 100644 libraries/eosiolib/tester/crt0.cpp diff --git a/.gitmodules b/.gitmodules index b81763b211..ff00ed0b15 100644 --- a/.gitmodules +++ b/.gitmodules @@ -21,3 +21,6 @@ [submodule "libraries/fmt"] path = libraries/fmt url = https://github.com/fmtlib/fmt.git +[submodule "external/Catch2"] + path = external/Catch2 + url = https://github.com/catchorg/Catch2 diff --git a/libraries/Catch2 b/libraries/Catch2 new file mode 160000 index 0000000000..d10b9bd02e --- /dev/null +++ b/libraries/Catch2 @@ -0,0 +1 @@ +Subproject commit d10b9bd02e098476670f5eb0527d2c7281476e8a diff --git a/libraries/boost/include/boost/algorithm/cxx11/all_of.hpp b/libraries/boost/include/boost/algorithm/cxx11/all_of.hpp new file mode 100644 index 0000000000..8280b18d62 --- /dev/null +++ b/libraries/boost/include/boost/algorithm/cxx11/all_of.hpp @@ -0,0 +1,83 @@ +/* + Copyright (c) Marshall Clow 2008-2012. + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +*/ + +/// \file all_of.hpp +/// \brief Test ranges to see if all elements match a value or predicate. +/// \author Marshall Clow + +#ifndef BOOST_ALGORITHM_ALL_OF_HPP +#define BOOST_ALGORITHM_ALL_OF_HPP + +#include +#include + +namespace boost { namespace algorithm { + +/// \fn all_of ( InputIterator first, InputIterator last, Predicate p ) +/// \return true if all elements in [first, last) satisfy the predicate 'p' +/// \note returns true on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param p A predicate for testing the elements of the sequence +/// +/// \note This function is part of the C++2011 standard library. +template +bool all_of ( InputIterator first, InputIterator last, Predicate p ) +{ + for ( ; first != last; ++first ) + if ( !p(*first)) + return false; + return true; +} + +/// \fn all_of ( const Range &r, Predicate p ) +/// \return true if all elements in the range satisfy the predicate 'p' +/// \note returns true on an empty range +/// +/// \param r The input range +/// \param p A predicate for testing the elements of the range +/// +template +bool all_of ( const Range &r, Predicate p ) +{ + return boost::algorithm::all_of ( boost::begin (r), boost::end (r), p ); +} + +/// \fn all_of_equal ( InputIterator first, InputIterator last, const T &val ) +/// \return true if all elements in [first, last) are equal to 'val' +/// \note returns true on an empty range +/// +/// \param first The start of the input sequence +/// \param last One past the end of the input sequence +/// \param val A value to compare against +/// +template +bool all_of_equal ( InputIterator first, InputIterator last, const T &val ) +{ + for ( ; first != last; ++first ) + if ( val != *first ) + return false; + return true; +} + +/// \fn all_of_equal ( const Range &r, const T &val ) +/// \return true if all elements in the range are equal to 'val' +/// \note returns true on an empty range +/// +/// \param r The input range +/// \param val A value to compare against +/// +template +bool all_of_equal ( const Range &r, const T &val ) +{ + return boost::algorithm::all_of_equal ( boost::begin (r), boost::end (r), val ); +} + +}} // namespace boost and algorithm + +#endif // BOOST_ALGORITHM_ALL_OF_HPP diff --git a/libraries/boost/include/boost/aligned_storage.hpp b/libraries/boost/include/boost/aligned_storage.hpp new file mode 100644 index 0000000000..f400fa9e75 --- /dev/null +++ b/libraries/boost/include/boost/aligned_storage.hpp @@ -0,0 +1,18 @@ +//----------------------------------------------------------------------------- +// boost aligned_storage.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2002-2003 +// Eric Friedman, Itay Maman +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_ALIGNED_STORAGE_HPP +#define BOOST_ALIGNED_STORAGE_HPP + +#include + +#endif // BOOST_ALIGNED_STORAGE_HPP diff --git a/libraries/boost/include/boost/bind.hpp b/libraries/boost/include/boost/bind.hpp new file mode 100644 index 0000000000..450120c7a7 --- /dev/null +++ b/libraries/boost/include/boost/bind.hpp @@ -0,0 +1,41 @@ +#ifndef BOOST_BIND_HPP_INCLUDED +#define BOOST_BIND_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind.hpp - binds function objects to arguments +// +// Copyright (c) 2009, 2015 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include + +#ifndef BOOST_BIND_NO_PLACEHOLDERS + +#if defined(BOOST_CLANG) +# pragma clang diagnostic push +# if __has_warning("-Wheader-hygiene") +# pragma clang diagnostic ignored "-Wheader-hygiene" +# endif +#endif + +using namespace boost::placeholders; + +#if defined(BOOST_CLANG) +# pragma clang diagnostic pop +#endif + +#endif // #ifndef BOOST_BIND_NO_PLACEHOLDERS + +#endif // #ifndef BOOST_BIND_HPP_INCLUDED diff --git a/libraries/boost/include/boost/bind/arg.hpp b/libraries/boost/include/boost/bind/arg.hpp new file mode 100644 index 0000000000..cb52e6689f --- /dev/null +++ b/libraries/boost/include/boost/bind/arg.hpp @@ -0,0 +1,69 @@ +#ifndef BOOST_BIND_ARG_HPP_INCLUDED +#define BOOST_BIND_ARG_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind/arg.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include +#include + +namespace boost +{ + +template struct _arg_eq +{ +}; + +template<> struct _arg_eq +{ + typedef void type; +}; + +template< int I > struct arg +{ + BOOST_CONSTEXPR arg() + { + } + + template< class T > BOOST_CONSTEXPR arg( T const & /* t */, typename _arg_eq< I == is_placeholder::value >::type * = 0 ) + { + } +}; + +template< int I > BOOST_CONSTEXPR bool operator==( arg const &, arg const & ) +{ + return true; +} + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< int I > struct is_placeholder< arg > +{ + enum _vt { value = I }; +}; + +template< int I > struct is_placeholder< arg (*) () > +{ + enum _vt { value = I }; +}; + +#endif + +} // namespace boost + +#endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED diff --git a/libraries/boost/include/boost/bind/bind.hpp b/libraries/boost/include/boost/bind/bind.hpp new file mode 100644 index 0000000000..4cedc5e9a4 --- /dev/null +++ b/libraries/boost/include/boost/bind/bind.hpp @@ -0,0 +1,2365 @@ +#ifndef BOOST_BIND_BIND_HPP_INCLUDED +#define BOOST_BIND_BIND_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind.hpp - binds function objects to arguments +// +// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2001 David Abrahams +// Copyright (c) 2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) +#include // std::forward +#endif + +// Borland-specific bug, visit_each() silently fails to produce code + +#if defined(__BORLANDC__) +# define BOOST_BIND_VISIT_EACH boost::visit_each +#else +# define BOOST_BIND_VISIT_EACH visit_each +#endif + +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated +#endif + +namespace boost +{ + +template class weak_ptr; + +namespace _bi // implementation details +{ + +// result_traits + +template struct result_traits +{ + typedef R type; +}; + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +struct unspecified {}; + +template struct result_traits +{ + typedef typename F::result_type type; +}; + +template struct result_traits< unspecified, reference_wrapper > +{ + typedef typename F::result_type type; +}; + +#endif + +// ref_compare + +template bool ref_compare( T const & a, T const & b, long ) +{ + return a == b; +} + +template bool ref_compare( arg const &, arg const &, int ) +{ + return true; +} + +template bool ref_compare( arg (*) (), arg (*) (), int ) +{ + return true; +} + +template bool ref_compare( reference_wrapper const & a, reference_wrapper const & b, int ) +{ + return a.get_pointer() == b.get_pointer(); +} + +// bind_t forward declaration for listN + +template class bind_t; + +template bool ref_compare( bind_t const & a, bind_t const & b, int ) +{ + return a.compare( b ); +} + +// value + +template class value +{ +public: + + value(T const & t): t_(t) {} + + T & get() { return t_; } + T const & get() const { return t_; } + + bool operator==(value const & rhs) const + { + return t_ == rhs.t_; + } + +private: + + T t_; +}; + +// ref_compare for weak_ptr + +template bool ref_compare( value< weak_ptr > const & a, value< weak_ptr > const & b, int ) +{ + return !(a.get() < b.get()) && !(b.get() < a.get()); +} + +// type + +template class type {}; + +// unwrap + +template struct unwrapper +{ + static inline F & unwrap( F & f, long ) + { + return f; + } + + template static inline F2 & unwrap( reference_wrapper rf, int ) + { + return rf.get(); + } + + template static inline _mfi::dm unwrap( R T::* pm, int ) + { + return _mfi::dm( pm ); + } +}; + +// listN + +class list0 +{ +public: + + list0() {} + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A &, long) + { + return unwrapper::unwrap(f, 0)(); + } + + template R operator()(type, F const & f, A &, long) const + { + return unwrapper::unwrap(f, 0)(); + } + + template void operator()(type, F & f, A &, int) + { + unwrapper::unwrap(f, 0)(); + } + + template void operator()(type, F const & f, A &, int) const + { + unwrapper::unwrap(f, 0)(); + } + + template void accept(V &) const + { + } + + bool operator==(list0 const &) const + { + return true; + } +}; + +#ifdef BOOST_MSVC +// MSVC is bright enough to realise that the parameter rhs +// in operator==may be unused for some template argument types: +#pragma warning(push) +#pragma warning(disable:4100) +#endif + +template< class A1 > class list1: private storage1< A1 > +{ +private: + + typedef storage1< A1 > base_type; + +public: + + explicit list1( A1 a1 ): base_type( a1 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list1 const & rhs) const + { + return ref_compare(base_type::a1_, rhs.a1_, 0); + } +}; + +struct logical_and; +struct logical_or; + +template< class A1, class A2 > class list2: private storage2< A1, A2 > +{ +private: + + typedef storage2< A1, A2 > base_type; + +public: + + list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template bool operator()( type, logical_and & /*f*/, A & a, int ) + { + return a[ base_type::a1_ ] && a[ base_type::a2_ ]; + } + + template bool operator()( type, logical_and const & /*f*/, A & a, int ) const + { + return a[ base_type::a1_ ] && a[ base_type::a2_ ]; + } + + template bool operator()( type, logical_or & /*f*/, A & a, int ) + { + return a[ base_type::a1_ ] || a[ base_type::a2_ ]; + } + + template bool operator()( type, logical_or const & /*f*/, A & a, int ) const + { + return a[ base_type::a1_ ] || a[ base_type::a2_ ]; + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list2 const & rhs) const + { + return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0); + } +}; + +template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 > +{ +private: + + typedef storage3< A1, A2, A3 > base_type; + +public: + + list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list3 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ); + } +}; + +template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 > +{ +private: + + typedef storage4< A1, A2, A3, A4 > base_type; + +public: + + list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list4 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 > +{ +private: + + typedef storage5< A1, A2, A3, A4, A5 > base_type; + +public: + + list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list5 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ); + } +}; + +template class list6: private storage6< A1, A2, A3, A4, A5, A6 > +{ +private: + + typedef storage6< A1, A2, A3, A4, A5, A6 > base_type; + +public: + + list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list6 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ); + } +}; + +template class list7: private storage7< A1, A2, A3, A4, A5, A6, A7 > +{ +private: + + typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type; + +public: + + list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list7 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class list8: private storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ +private: + + typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type; + +public: + + list8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } + A8 operator[] (boost::arg<8>) const { return base_type::a8_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } + A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list8 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ) && + ref_compare( base_type::a8_, rhs.a8_, 0 ); + } +}; + +template class list9: private storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > +{ +private: + + typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type; + +public: + + list9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } + A8 operator[] (boost::arg<8>) const { return base_type::a8_; } + A9 operator[] (boost::arg<9>) const { return base_type::a9_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } + A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } + A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list9 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ) && + ref_compare( base_type::a8_, rhs.a8_, 0 ) && + ref_compare( base_type::a9_, rhs.a9_, 0 ); + } +}; + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +// bind_t + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +template< class A1 > class rrlist1 +{ +private: + + A1 & a1_; // not A1&& because of msvc-10.0 + +public: + + explicit rrlist1( A1 & a1 ): a1_( a1 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } // not static_cast because of g++ 4.9 + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist1 a( a1_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist1 a( a1_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2 > class rrlist2 +{ +private: + + A1 & a1_; + A2 & a2_; + +public: + + rrlist2( A1 & a1, A2 & a2 ): a1_( a1 ), a2_( a2 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist2 a( a1_, a2_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist2 a( a1_, a2_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3 > class rrlist3 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + +public: + + rrlist3( A1 & a1, A2 & a2, A3 & a3 ): a1_( a1 ), a2_( a2 ), a3_( a3 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist3 a( a1_, a2_, a3_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist3 a( a1_, a2_, a3_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4 > class rrlist4 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + +public: + + rrlist4( A1 & a1, A2 & a2, A3 & a3, A4 & a4 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist4 a( a1_, a2_, a3_, a4_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist4 a( a1_, a2_, a3_, a4_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5 > class rrlist5 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + +public: + + rrlist5( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist5 a( a1_, a2_, a3_, a4_, a5_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist5 a( a1_, a2_, a3_, a4_, a5_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6 > class rrlist6 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + +public: + + rrlist6( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist6 a( a1_, a2_, a3_, a4_, a5_, a6_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist6 a( a1_, a2_, a3_, a4_, a5_, a6_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7 > class rrlist7 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + A7 & a7_; + +public: + + rrlist7( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist7 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist7 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class rrlist8 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + A7 & a7_; + A8 & a8_; + +public: + + rrlist8( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8>) const { return std::forward( a8_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward( a8_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist8 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist8 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > class rrlist9 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + A7 & a7_; + A8 & a8_; + A9 & a9_; + +public: + + rrlist9( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ), a9_( a9 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8>) const { return std::forward( a8_ ); } + A9 && operator[] (boost::arg<9>) const { return std::forward( a9_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward( a8_ ); } + A9 && operator[] (boost::arg<9> (*) ()) const { return std::forward( a9_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist9 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist9 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ ); + return b.eval( a ); + } +}; + +template class bind_t +{ +private: + + F f_; + L l_; + +public: + + typedef typename result_traits::type result_type; + typedef bind_t this_type; + + bind_t( F f, L const & l ): f_( f ), l_( l ) {} + + // + + result_type operator()() + { + list0 a; + return l_( type(), f_, a, 0 ); + } + + result_type operator()() const + { + list0 a; + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1 ) + { + rrlist1< A1 > a( a1 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1 ) const + { + rrlist1< A1 > a( a1 ); + return l_(type(), f_, a, 0); + } + + template result_type operator()( A1 && a1, A2 && a2 ) + { + rrlist2< A1, A2 > a( a1, a2 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2 ) const + { + rrlist2< A1, A2 > a( a1, a2 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) + { + rrlist3< A1, A2, A3 > a( a1, a2, a3 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) const + { + rrlist3< A1, A2, A3 > a( a1, a2, a3 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) + { + rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) const + { + rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) + { + rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) const + { + rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) + { + rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) const + { + rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) + { + rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) const + { + rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) + { + rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) const + { + rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) + { + rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) const + { + rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); + return l_( type(), f_, a, 0 ); + } + + // + + template result_type eval( A & a ) + { + return l_( type(), f_, a, 0 ); + } + + template result_type eval( A & a ) const + { + return l_( type(), f_, a, 0 ); + } + + template void accept( V & v ) const + { +#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) + using boost::visit_each; +#endif + + BOOST_BIND_VISIT_EACH( v, f_, 0 ); + l_.accept( v ); + } + + bool compare( this_type const & rhs ) const + { + return ref_compare( f_, rhs.f_, 0 ) && l_ == rhs.l_; + } +}; + +#elif !defined( BOOST_NO_VOID_RETURNS ) + +template class bind_t +{ +public: + + typedef bind_t this_type; + + bind_t(F f, L const & l): f_(f), l_(l) {} + +#define BOOST_BIND_RETURN return +#include +#undef BOOST_BIND_RETURN + +}; + +#else // no void returns + +template struct bind_t_generator +{ + +template class implementation +{ +public: + + typedef implementation this_type; + + implementation(F f, L const & l): f_(f), l_(l) {} + +#define BOOST_BIND_RETURN return +#include +#undef BOOST_BIND_RETURN + +}; + +}; + +template<> struct bind_t_generator +{ + +template class implementation +{ +private: + + typedef void R; + +public: + + typedef implementation this_type; + + implementation(F f, L const & l): f_(f), l_(l) {} + +#define BOOST_BIND_RETURN +#include +#undef BOOST_BIND_RETURN + +}; + +}; + +template class bind_t: public bind_t_generator::BOOST_NESTED_TEMPLATE implementation +{ +public: + + bind_t(F f, L const & l): bind_t_generator::BOOST_NESTED_TEMPLATE implementation(f, l) {} + +}; + +#endif + +// function_equal + +#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP + +// put overloads in _bi, rely on ADL + +# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +template bool function_equal( bind_t const & a, bind_t const & b ) +{ + return a.compare(b); +} + +# else + +template bool function_equal_impl( bind_t const & a, bind_t const & b, int ) +{ + return a.compare(b); +} + +# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP + +// put overloads in boost + +} // namespace _bi + +# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +template bool function_equal( _bi::bind_t const & a, _bi::bind_t const & b ) +{ + return a.compare(b); +} + +# else + +template bool function_equal_impl( _bi::bind_t const & a, _bi::bind_t const & b, int ) +{ + return a.compare(b); +} + +# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +namespace _bi +{ + +#endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP + +// add_value + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530) + +#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x582) ) + +template struct add_value +{ + typedef _bi::value type; +}; + +#else + +template< class T, int I > struct add_value_2 +{ + typedef boost::arg type; +}; + +template< class T > struct add_value_2< T, 0 > +{ + typedef _bi::value< T > type; +}; + +template struct add_value +{ + typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type; +}; + +#endif + +template struct add_value< value > +{ + typedef _bi::value type; +}; + +template struct add_value< reference_wrapper > +{ + typedef reference_wrapper type; +}; + +template struct add_value< arg > +{ + typedef boost::arg type; +}; + +template struct add_value< arg (*) () > +{ + typedef boost::arg (*type) (); +}; + +template struct add_value< bind_t > +{ + typedef bind_t type; +}; + +#else + +template struct _avt_0; + +template<> struct _avt_0<1> +{ + template struct inner + { + typedef T type; + }; +}; + +template<> struct _avt_0<2> +{ + template struct inner + { + typedef value type; + }; +}; + +typedef char (&_avt_r1) [1]; +typedef char (&_avt_r2) [2]; + +template _avt_r1 _avt_f(value); +template _avt_r1 _avt_f(reference_wrapper); +template _avt_r1 _avt_f(arg); +template _avt_r1 _avt_f(arg (*) ()); +template _avt_r1 _avt_f(bind_t); + +_avt_r2 _avt_f(...); + +template struct add_value +{ + static T t(); + typedef typename _avt_0::template inner::type type; +}; + +#endif + +// list_av_N + +template struct list_av_1 +{ + typedef typename add_value::type B1; + typedef list1 type; +}; + +template struct list_av_2 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef list2 type; +}; + +template struct list_av_3 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef list3 type; +}; + +template struct list_av_4 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef list4 type; +}; + +template struct list_av_5 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef list5 type; +}; + +template struct list_av_6 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef list6 type; +}; + +template struct list_av_7 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef list7 type; +}; + +template struct list_av_8 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef typename add_value::type B8; + typedef list8 type; +}; + +template struct list_av_9 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef typename add_value::type B8; + typedef typename add_value::type B9; + typedef list9 type; +}; + +// operator! + +struct logical_not +{ + template bool operator()(V const & v) const { return !v; } +}; + +template + bind_t< bool, logical_not, list1< bind_t > > + operator! (bind_t const & f) +{ + typedef list1< bind_t > list_type; + return bind_t ( logical_not(), list_type(f) ); +} + +// relational operators + +#define BOOST_BIND_OPERATOR( op, name ) \ +\ +struct name \ +{ \ + template bool operator()(V const & v, W const & w) const { return v op w; } \ +}; \ + \ +template \ + bind_t< bool, name, list2< bind_t, typename add_value::type > > \ + operator op (bind_t const & f, A2 a2) \ +{ \ + typedef typename add_value::type B2; \ + typedef list2< bind_t, B2> list_type; \ + return bind_t ( name(), list_type(f, a2) ); \ +} + +BOOST_BIND_OPERATOR( ==, equal ) +BOOST_BIND_OPERATOR( !=, not_equal ) + +BOOST_BIND_OPERATOR( <, less ) +BOOST_BIND_OPERATOR( <=, less_equal ) + +BOOST_BIND_OPERATOR( >, greater ) +BOOST_BIND_OPERATOR( >=, greater_equal ) + +BOOST_BIND_OPERATOR( &&, logical_and ) +BOOST_BIND_OPERATOR( ||, logical_or ) + +#undef BOOST_BIND_OPERATOR + +#if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) + +// resolve ambiguity with rel_ops + +#define BOOST_BIND_OPERATOR( op, name ) \ +\ +template \ + bind_t< bool, name, list2< bind_t, bind_t > > \ + operator op (bind_t const & f, bind_t const & g) \ +{ \ + typedef list2< bind_t, bind_t > list_type; \ + return bind_t ( name(), list_type(f, g) ); \ +} + +BOOST_BIND_OPERATOR( !=, not_equal ) +BOOST_BIND_OPERATOR( <=, less_equal ) +BOOST_BIND_OPERATOR( >, greater ) +BOOST_BIND_OPERATOR( >=, greater_equal ) + +#endif + +// visit_each, ADL + +#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) \ + && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) + +template void visit_each( V & v, value const & t, int ) +{ + using boost::visit_each; + BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); +} + +template void visit_each( V & v, bind_t const & t, int ) +{ + t.accept( v ); +} + +#endif + +} // namespace _bi + +// visit_each, no ADL + +#if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ ) \ + || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) + +template void visit_each( V & v, _bi::value const & t, int ) +{ + BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); +} + +template void visit_each( V & v, _bi::bind_t const & t, int ) +{ + t.accept( v ); +} + +#endif + +// is_bind_expression + +template< class T > struct is_bind_expression +{ + enum _vt { value = 0 }; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > > +{ + enum _vt { value = 1 }; +}; + +#endif + +// bind + +#ifndef BOOST_BIND +#define BOOST_BIND bind +#endif + +// generic function objects + +template + _bi::bind_t + BOOST_BIND(F f) +{ + typedef _bi::list0 list_type; + return _bi::bind_t (f, list_type()); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t (f, list_type(a1)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t (f, list_type(a1, a2)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +// generic function objects, alternative syntax + +template + _bi::bind_t + BOOST_BIND(boost::type, F f) +{ + typedef _bi::list0 list_type; + return _bi::bind_t (f, list_type()); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t (f, list_type(a1)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t (f, list_type(a1, a2)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +// adaptable function objects + +template + _bi::bind_t<_bi::unspecified, F, _bi::list0> + BOOST_BIND(F f) +{ + typedef _bi::list0 list_type; + return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type()); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1::type> + BOOST_BIND(F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2::type> + BOOST_BIND(F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +// function pointers + +#define BOOST_BIND_CC +#define BOOST_BIND_ST +#define BOOST_BIND_NOEXCEPT + +#include + +# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) +# undef BOOST_BIND_NOEXCEPT +# define BOOST_BIND_NOEXCEPT noexcept +# include +# endif + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST +#undef BOOST_BIND_NOEXCEPT + +#ifdef BOOST_BIND_ENABLE_STDCALL + +#define BOOST_BIND_CC __stdcall +#define BOOST_BIND_ST +#define BOOST_BIND_NOEXCEPT + +#include + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST +#undef BOOST_BIND_NOEXCEPT + +#endif + +#ifdef BOOST_BIND_ENABLE_FASTCALL + +#define BOOST_BIND_CC __fastcall +#define BOOST_BIND_ST +#define BOOST_BIND_NOEXCEPT + +#include + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST +#undef BOOST_BIND_NOEXCEPT + +#endif + +#ifdef BOOST_BIND_ENABLE_PASCAL + +#define BOOST_BIND_ST pascal +#define BOOST_BIND_CC +#define BOOST_BIND_NOEXCEPT + +#include + +#undef BOOST_BIND_ST +#undef BOOST_BIND_CC +#undef BOOST_BIND_NOEXCEPT + +#endif + +// member function pointers + +#define BOOST_BIND_MF_NAME(X) X +#define BOOST_BIND_MF_CC +#define BOOST_BIND_MF_NOEXCEPT + +#include +#include + +# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) +# undef BOOST_BIND_MF_NOEXCEPT +# define BOOST_BIND_MF_NOEXCEPT noexcept +# include +# endif + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC +#undef BOOST_BIND_MF_NOEXCEPT + +#ifdef BOOST_MEM_FN_ENABLE_CDECL + +#define BOOST_BIND_MF_NAME(X) X##_cdecl +#define BOOST_BIND_MF_CC __cdecl +#define BOOST_BIND_MF_NOEXCEPT + +#include +#include + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC +#undef BOOST_BIND_MF_NOEXCEPT + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_STDCALL + +#define BOOST_BIND_MF_NAME(X) X##_stdcall +#define BOOST_BIND_MF_CC __stdcall +#define BOOST_BIND_MF_NOEXCEPT + +#include +#include + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC +#undef BOOST_BIND_MF_NOEXCEPT + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_BIND_MF_NAME(X) X##_fastcall +#define BOOST_BIND_MF_CC __fastcall +#define BOOST_BIND_MF_NOEXCEPT + +#include +#include + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC +#undef BOOST_BIND_MF_NOEXCEPT + +#endif + +// data member pointers + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x620 ) ) ) + +template +_bi::bind_t< R, _mfi::dm, typename _bi::list_av_1::type > + BOOST_BIND(R T::*f, A1 a1) +{ + typedef _mfi::dm F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t( F(f), list_type(a1) ); +} + +#else + +namespace _bi +{ + +template< class Pm, int I > struct add_cref; + +template< class M, class T > struct add_cref< M T::*, 0 > +{ + typedef M type; +}; + +template< class M, class T > struct add_cref< M T::*, 1 > +{ +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4180) +#endif + typedef M const & type; +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif +}; + +template< class R, class T > struct add_cref< R (T::*) (), 1 > +{ + typedef void type; +}; + +#if !defined(__IBMCPP__) || __IBMCPP_FUNC_CV_TMPL_ARG_DEDUCTION + +template< class R, class T > struct add_cref< R (T::*) () const, 1 > +{ + typedef void type; +}; + +#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) + +template< class R, class T > struct add_cref< R (T::*) () const noexcept, 1 > +{ + typedef void type; +}; + +#endif // __cpp_noexcept_function_type + +#endif // __IBMCPP__ + +template struct isref +{ + enum value_type { value = 0 }; +}; + +template struct isref< R& > +{ + enum value_type { value = 1 }; +}; + +template struct isref< R* > +{ + enum value_type { value = 1 }; +}; + +template struct dm_result +{ + typedef typename add_cref< Pm, 1 >::type type; +}; + +template struct dm_result< Pm, bind_t > +{ + typedef typename bind_t::result_type result_type; + typedef typename add_cref< Pm, isref< result_type >::value >::type type; +}; + +} // namespace _bi + +template< class A1, class M, class T > + +_bi::bind_t< + typename _bi::dm_result< M T::*, A1 >::type, + _mfi::dm, + typename _bi::list_av_1::type +> + +BOOST_BIND( M T::*f, A1 a1 ) +{ + typedef typename _bi::dm_result< M T::*, A1 >::type result_type; + typedef _mfi::dm F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) ); +} + +#endif + +} // namespace boost + +#ifndef BOOST_BIND_NO_PLACEHOLDERS + +# include + +#endif + +#ifdef BOOST_MSVC +# pragma warning(default: 4512) // assignment operator could not be generated +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED diff --git a/libraries/boost/include/boost/bind/bind_cc.hpp b/libraries/boost/include/boost/bind/bind_cc.hpp new file mode 100644 index 0000000000..278aa9a2a8 --- /dev/null +++ b/libraries/boost/include/boost/bind/bind_cc.hpp @@ -0,0 +1,117 @@ +// +// bind/bind_cc.hpp - support for different calling conventions +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +template + _bi::bind_t + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) () BOOST_BIND_NOEXCEPT) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) () BOOST_BIND_NOEXCEPT; + typedef _bi::list0 list_type; + return _bi::bind_t (f, list_type()); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1) BOOST_BIND_NOEXCEPT, A1 a1) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t (f, list_type(a1)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t (f, list_type(a1, a2)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8, B9) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8, B9) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} diff --git a/libraries/boost/include/boost/bind/bind_mf2_cc.hpp b/libraries/boost/include/boost/bind/bind_mf2_cc.hpp new file mode 100644 index 0000000000..66476bc19d --- /dev/null +++ b/libraries/boost/include/boost/bind/bind_mf2_cc.hpp @@ -0,0 +1,228 @@ +// +// bind/bind_mf2_cc.hpp - member functions, type<> syntax +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +// 0 + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (), A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) () const, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +// 1 + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1), A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1) const, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +// 2 + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2), A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2) const, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +// 3 + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3), A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +// 4 + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +// 5 + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +// 6 + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +// 7 + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +// 8 + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} diff --git a/libraries/boost/include/boost/bind/bind_mf_cc.hpp b/libraries/boost/include/boost/bind/bind_mf_cc.hpp new file mode 100644 index 0000000000..bbfd3719b6 --- /dev/null +++ b/libraries/boost/include/boost/bind/bind_mf_cc.hpp @@ -0,0 +1,441 @@ +// +// bind/bind_mf_cc.hpp - support for different calling conventions +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +// 0 + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_1::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_1::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +// 1 + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_2::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_2::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +// 2 + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_3::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_3::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +// 3 + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_4::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_4::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +// 4 + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_5::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_5::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +// 5 + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_6::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_6::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +// 6 + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_7::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_7::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +// 7 + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_8::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_8::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +// 8 + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_9::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_9::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} diff --git a/libraries/boost/include/boost/bind/bind_template.hpp b/libraries/boost/include/boost/bind/bind_template.hpp new file mode 100644 index 0000000000..411d20c74e --- /dev/null +++ b/libraries/boost/include/boost/bind/bind_template.hpp @@ -0,0 +1,345 @@ +// +// bind/bind_template.hpp +// +// Do not include this header directly. +// +// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + + typedef typename result_traits::type result_type; + + result_type operator()() + { + list0 a; + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + result_type operator()() const + { + list0 a; + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1) + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1) const + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1) + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1) const + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + + template result_type operator()(A1 & a1, A2 const & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 const & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + + template result_type operator()(A1 const & a1, A2 const & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3) + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3) const + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) const + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) const + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) const + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type eval(A & a) + { + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type eval(A & a) const + { + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template void accept(V & v) const + { +#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) + + using boost::visit_each; + +#endif + BOOST_BIND_VISIT_EACH(v, f_, 0); + l_.accept(v); + } + + bool compare(this_type const & rhs) const + { + return ref_compare(f_, rhs.f_, 0) && l_ == rhs.l_; + } + +private: + + F f_; + L l_; diff --git a/libraries/boost/include/boost/bind/mem_fn.hpp b/libraries/boost/include/boost/bind/mem_fn.hpp new file mode 100644 index 0000000000..956e7d8885 --- /dev/null +++ b/libraries/boost/include/boost/bind/mem_fn.hpp @@ -0,0 +1,389 @@ +#ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED +#define BOOST_BIND_MEM_FN_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// mem_fn.hpp - a generalization of std::mem_fun[_ref] +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2001 David Abrahams +// Copyright (c) 2003-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/mem_fn.html for documentation. +// + +#include +#include +#include + +namespace boost +{ + +#if defined(BOOST_NO_VOID_RETURNS) + +#define BOOST_MEM_FN_CLASS_F , class F +#define BOOST_MEM_FN_TYPEDEF(X) + +namespace _mfi // mem_fun_impl +{ + +template struct mf +{ + +#define BOOST_MEM_FN_RETURN return + +#define BOOST_MEM_FN_NAME(X) inner_##X +#define BOOST_MEM_FN_CC + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#ifdef BOOST_MEM_FN_ENABLE_CDECL + +#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl +#define BOOST_MEM_FN_CC __cdecl + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_STDCALL + +#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall +#define BOOST_MEM_FN_CC __stdcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#undef BOOST_MEM_FN_RETURN + +}; // struct mf + +template<> struct mf +{ + +#define BOOST_MEM_FN_RETURN + +#define BOOST_MEM_FN_NAME(X) inner_##X +#define BOOST_MEM_FN_CC + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#ifdef BOOST_MEM_FN_ENABLE_CDECL + +#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl +#define BOOST_MEM_FN_CC __cdecl + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_STDCALL + +#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall +#define BOOST_MEM_FN_CC __stdcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#undef BOOST_MEM_FN_RETURN + +}; // struct mf + +#undef BOOST_MEM_FN_CLASS_F +#undef BOOST_MEM_FN_TYPEDEF_F + +#define BOOST_MEM_FN_NAME(X) X +#define BOOST_MEM_FN_NAME2(X) inner_##X +#define BOOST_MEM_FN_CC + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_NAME2 +#undef BOOST_MEM_FN_CC + +#ifdef BOOST_MEM_FN_ENABLE_CDECL + +#define BOOST_MEM_FN_NAME(X) X##_cdecl +#define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl +#define BOOST_MEM_FN_CC __cdecl + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_NAME2 +#undef BOOST_MEM_FN_CC + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_STDCALL + +#define BOOST_MEM_FN_NAME(X) X##_stdcall +#define BOOST_MEM_FN_NAME2(X) inner_##X##_stdcall +#define BOOST_MEM_FN_CC __stdcall + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_NAME2 +#undef BOOST_MEM_FN_CC + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) X##_fastcall +#define BOOST_MEM_FN_NAME2(X) inner_##X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_NAME2 +#undef BOOST_MEM_FN_CC + +#endif + +} // namespace _mfi + +#else // #ifdef BOOST_NO_VOID_RETURNS + +#define BOOST_MEM_FN_CLASS_F +#define BOOST_MEM_FN_TYPEDEF(X) typedef X; + +namespace _mfi +{ + +#define BOOST_MEM_FN_RETURN return + +#define BOOST_MEM_FN_NAME(X) X +#define BOOST_MEM_FN_CC + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#ifdef BOOST_MEM_FN_ENABLE_CDECL + +#define BOOST_MEM_FN_NAME(X) X##_cdecl +#define BOOST_MEM_FN_CC __cdecl + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_STDCALL + +#define BOOST_MEM_FN_NAME(X) X##_stdcall +#define BOOST_MEM_FN_CC __stdcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#undef BOOST_MEM_FN_RETURN + +} // namespace _mfi + +#undef BOOST_MEM_FN_CLASS_F +#undef BOOST_MEM_FN_TYPEDEF + +#endif // #ifdef BOOST_NO_VOID_RETURNS + +#define BOOST_MEM_FN_NAME(X) X +#define BOOST_MEM_FN_CC + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_CC + +#ifdef BOOST_MEM_FN_ENABLE_CDECL + +#define BOOST_MEM_FN_NAME(X) X##_cdecl +#define BOOST_MEM_FN_CC __cdecl + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_CC + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_STDCALL + +#define BOOST_MEM_FN_NAME(X) X##_stdcall +#define BOOST_MEM_FN_CC __stdcall + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_CC + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_CC + +#endif + +// data member support + +namespace _mfi +{ + +template class dm +{ +public: + + typedef R const & result_type; + typedef T const * argument_type; + +private: + + typedef R (T::*F); + F f_; + + template R const & call(U & u, T const *) const + { + return (u.*f_); + } + + template R const & call(U & u, void const *) const + { + return (get_pointer(u)->*f_); + } + +public: + + explicit dm(F f): f_(f) {} + + R & operator()(T * p) const + { + return (p->*f_); + } + + R const & operator()(T const * p) const + { + return (p->*f_); + } + + template R const & operator()(U const & u) const + { + return call(u, &u); + } + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200) + + R & operator()(T & t) const + { + return (t.*f_); + } + + R const & operator()(T const & t) const + { + return (t.*f_); + } + +#endif + + bool operator==(dm const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(dm const & rhs) const + { + return f_ != rhs.f_; + } +}; + +} // namespace _mfi + +template _mfi::dm mem_fn(R T::*f) +{ + return _mfi::dm(f); +} + +} // namespace boost + +#endif // #ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED diff --git a/libraries/boost/include/boost/bind/mem_fn_cc.hpp b/libraries/boost/include/boost/bind/mem_fn_cc.hpp new file mode 100644 index 0000000000..8b6ea0ba13 --- /dev/null +++ b/libraries/boost/include/boost/bind/mem_fn_cc.hpp @@ -0,0 +1,103 @@ +// +// bind/mem_fn_cc.hpp - support for different calling conventions +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/mem_fn.html for documentation. +// + +template _mfi::BOOST_MEM_FN_NAME(mf0) mem_fn(R (BOOST_MEM_FN_CC T::*f) ()) +{ + return _mfi::BOOST_MEM_FN_NAME(mf0)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf0) mem_fn(R (BOOST_MEM_FN_CC T::*f) () const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf0)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf1) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf1)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf1) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf1)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf2) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf2)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf2) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf2)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf3) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf3)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf3) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf3)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf4) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf4)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf4) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf4)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf5) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf5)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf5) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf5)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf6) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf6)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf6) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf6)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf7) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf7)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf7) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf7)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf8) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8)) +{ + return _mfi::BOOST_MEM_FN_NAME(mf8)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf8) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf8)(f); +} diff --git a/libraries/boost/include/boost/bind/mem_fn_template.hpp b/libraries/boost/include/boost/bind/mem_fn_template.hpp new file mode 100644 index 0000000000..b26d585dbc --- /dev/null +++ b/libraries/boost/include/boost/bind/mem_fn_template.hpp @@ -0,0 +1,1047 @@ +// +// bind/mem_fn_template.hpp +// +// Do not include this header directly +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/mem_fn.html for documentation. +// + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) +# define BOOST_MEM_FN_ENABLE_CONST_OVERLOADS +#endif + +// mf0 + +template class BOOST_MEM_FN_NAME(mf0) +{ +public: + + typedef R result_type; + typedef T * argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) ()) + F f_; + + template R call(U & u, T const *) const + { + BOOST_MEM_FN_RETURN (u.*f_)(); + } + + template R call(U & u, void const *) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf0)(F f): f_(f) {} + + R operator()(T * p) const + { + BOOST_MEM_FN_RETURN (p->*f_)(); + } + + template R operator()(U & u) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p); + } + +#endif + + R operator()(T & t) const + { + BOOST_MEM_FN_RETURN (t.*f_)(); + } + + bool operator==(BOOST_MEM_FN_NAME(mf0) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf0) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf0 + +template class BOOST_MEM_FN_NAME(cmf0) +{ +public: + + typedef R result_type; + typedef T const * argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) () const) + F f_; + + template R call(U & u, T const *) const + { + BOOST_MEM_FN_RETURN (u.*f_)(); + } + + template R call(U & u, void const *) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf0)(F f): f_(f) {} + + template R operator()(U const & u) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p); + } + + R operator()(T const & t) const + { + BOOST_MEM_FN_RETURN (t.*f_)(); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf0) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf0) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf1 + +template class BOOST_MEM_FN_NAME(mf1) +{ +public: + + typedef R result_type; + typedef T * first_argument_type; + typedef A1 second_argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1)) + F f_; + + template R call(U & u, T const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1); + } + + template R call(U & u, void const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf1)(F f): f_(f) {} + + R operator()(T * p, A1 a1) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1); + } + + template R operator()(U & u, A1 a1) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1); + } + +#endif + + R operator()(T & t, A1 a1) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1); + } + + bool operator==(BOOST_MEM_FN_NAME(mf1) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf1) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf1 + +template class BOOST_MEM_FN_NAME(cmf1) +{ +public: + + typedef R result_type; + typedef T const * first_argument_type; + typedef A1 second_argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1) const) + F f_; + + template R call(U & u, T const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1); + } + + template R call(U & u, void const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf1)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1); + } + + R operator()(T const & t, A1 a1) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf1) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf1) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf2 + +template class BOOST_MEM_FN_NAME(mf2) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf2)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2); + } + + template R operator()(U & u, A1 a1, A2 a2) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); + } + + bool operator==(BOOST_MEM_FN_NAME(mf2) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf2) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf2 + +template class BOOST_MEM_FN_NAME(cmf2) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf2)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2); + } + + R operator()(T const & t, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf2) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf2) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf3 + +template class BOOST_MEM_FN_NAME(mf3) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf3)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); + } + + bool operator==(BOOST_MEM_FN_NAME(mf3) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf3) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf3 + +template class BOOST_MEM_FN_NAME(cmf3) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf3)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf3) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf3) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf4 + +template class BOOST_MEM_FN_NAME(mf4) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf4)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); + } + + bool operator==(BOOST_MEM_FN_NAME(mf4) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf4) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf4 + +template class BOOST_MEM_FN_NAME(cmf4) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf4)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf4) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf4) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf5 + +template class BOOST_MEM_FN_NAME(mf5) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf5)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); + } + + bool operator==(BOOST_MEM_FN_NAME(mf5) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf5) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf5 + +template class BOOST_MEM_FN_NAME(cmf5) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf5)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf5) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf5) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf6 + +template class BOOST_MEM_FN_NAME(mf6) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf6)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); + } + + bool operator==(BOOST_MEM_FN_NAME(mf6) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf6) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf6 + +template class BOOST_MEM_FN_NAME(cmf6) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf6)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf6) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf6) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf7 + +template class BOOST_MEM_FN_NAME(mf7) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf7)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); + } + + bool operator==(BOOST_MEM_FN_NAME(mf7) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf7) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf7 + +template class BOOST_MEM_FN_NAME(cmf7) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf7)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf7) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf7) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf8 + +template class BOOST_MEM_FN_NAME(mf8) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf8)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + bool operator==(BOOST_MEM_FN_NAME(mf8) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf8) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf8 + +template class BOOST_MEM_FN_NAME(cmf8) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf8)(F f): f_(f) {} + + R operator()(T const * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf8) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf8) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +#undef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS diff --git a/libraries/boost/include/boost/bind/mem_fn_vw.hpp b/libraries/boost/include/boost/bind/mem_fn_vw.hpp new file mode 100644 index 0000000000..f3fc58db04 --- /dev/null +++ b/libraries/boost/include/boost/bind/mem_fn_vw.hpp @@ -0,0 +1,130 @@ +// +// bind/mem_fn_vw.hpp - void return helper wrappers +// +// Do not include this header directly +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/mem_fn.html for documentation. +// + +template struct BOOST_MEM_FN_NAME(mf0): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (); + explicit BOOST_MEM_FN_NAME(mf0)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf0): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0) +{ + typedef R (BOOST_MEM_FN_CC T::*F) () const; + explicit BOOST_MEM_FN_NAME(cmf0)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf1): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1); + explicit BOOST_MEM_FN_NAME(mf1)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf1): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1) const; + explicit BOOST_MEM_FN_NAME(cmf1)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf2): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2); + explicit BOOST_MEM_FN_NAME(mf2)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf2): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2) const; + explicit BOOST_MEM_FN_NAME(cmf2)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf3): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3); + explicit BOOST_MEM_FN_NAME(mf3)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf3): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const; + explicit BOOST_MEM_FN_NAME(cmf3)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf4): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4); + explicit BOOST_MEM_FN_NAME(mf4)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf4): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const; + explicit BOOST_MEM_FN_NAME(cmf4)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf5): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5); + explicit BOOST_MEM_FN_NAME(mf5)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf5): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const; + explicit BOOST_MEM_FN_NAME(cmf5)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf6): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6); + explicit BOOST_MEM_FN_NAME(mf6)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf6): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const; + explicit BOOST_MEM_FN_NAME(cmf6)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf7): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7); + explicit BOOST_MEM_FN_NAME(mf7)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf7): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const; + explicit BOOST_MEM_FN_NAME(cmf7)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf8): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8); + explicit BOOST_MEM_FN_NAME(mf8)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf8): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const; + explicit BOOST_MEM_FN_NAME(cmf8)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)(f) {} +}; + diff --git a/libraries/boost/include/boost/bind/placeholders.hpp b/libraries/boost/include/boost/bind/placeholders.hpp new file mode 100644 index 0000000000..b819ef4c46 --- /dev/null +++ b/libraries/boost/include/boost/bind/placeholders.hpp @@ -0,0 +1,62 @@ +#ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED +#define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind/placeholders.hpp - _N definitions +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright 2015 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include +#include + +namespace boost +{ + +namespace placeholders +{ + +#if defined(__BORLANDC__) || defined(__GNUC__) && (__GNUC__ < 4) + +inline boost::arg<1> _1() { return boost::arg<1>(); } +inline boost::arg<2> _2() { return boost::arg<2>(); } +inline boost::arg<3> _3() { return boost::arg<3>(); } +inline boost::arg<4> _4() { return boost::arg<4>(); } +inline boost::arg<5> _5() { return boost::arg<5>(); } +inline boost::arg<6> _6() { return boost::arg<6>(); } +inline boost::arg<7> _7() { return boost::arg<7>(); } +inline boost::arg<8> _8() { return boost::arg<8>(); } +inline boost::arg<9> _9() { return boost::arg<9>(); } + +#else + +BOOST_STATIC_CONSTEXPR boost::arg<1> _1; +BOOST_STATIC_CONSTEXPR boost::arg<2> _2; +BOOST_STATIC_CONSTEXPR boost::arg<3> _3; +BOOST_STATIC_CONSTEXPR boost::arg<4> _4; +BOOST_STATIC_CONSTEXPR boost::arg<5> _5; +BOOST_STATIC_CONSTEXPR boost::arg<6> _6; +BOOST_STATIC_CONSTEXPR boost::arg<7> _7; +BOOST_STATIC_CONSTEXPR boost::arg<8> _8; +BOOST_STATIC_CONSTEXPR boost::arg<9> _9; + +#endif + +} // namespace placeholders + +} // namespace boost + +#endif // #ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED diff --git a/libraries/boost/include/boost/bind/storage.hpp b/libraries/boost/include/boost/bind/storage.hpp new file mode 100644 index 0000000000..be490b0f59 --- /dev/null +++ b/libraries/boost/include/boost/bind/storage.hpp @@ -0,0 +1,475 @@ +#ifndef BOOST_BIND_STORAGE_HPP_INCLUDED +#define BOOST_BIND_STORAGE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind/storage.hpp +// +// boost/bind.hpp support header, optimized storage +// +// Copyright (c) 2006 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated +#endif + +namespace boost +{ + +namespace _bi +{ + +// 1 + +template struct storage1 +{ + explicit storage1( A1 a1 ): a1_( a1 ) {} + + template void accept(V & v) const + { + BOOST_BIND_VISIT_EACH(v, a1_, 0); + } + + A1 a1_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( __BORLANDC__ ) + +template struct storage1< boost::arg > +{ + explicit storage1( boost::arg ) {} + + template void accept(V &) const { } + + static boost::arg a1_() { return boost::arg(); } +}; + +template struct storage1< boost::arg (*) () > +{ + explicit storage1( boost::arg (*) () ) {} + + template void accept(V &) const { } + + static boost::arg a1_() { return boost::arg(); } +}; + +#endif + +// 2 + +template struct storage2: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, A2 a2 ): storage1( a1 ), a2_( a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a2_, 0); + } + + A2 a2_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage2< A1, boost::arg >: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, boost::arg ): storage1( a1 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a2_() { return boost::arg(); } +}; + +template struct storage2< A1, boost::arg (*) () >: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, boost::arg (*) () ): storage1( a1 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a2_() { return boost::arg(); } +}; + +#endif + +// 3 + +template struct storage3: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, A3 a3 ): storage2( a1, a2 ), a3_( a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a3_, 0); + } + + A3 a3_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage3< A1, A2, boost::arg >: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, boost::arg ): storage2( a1, a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a3_() { return boost::arg(); } +}; + +template struct storage3< A1, A2, boost::arg (*) () >: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, boost::arg (*) () ): storage2( a1, a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a3_() { return boost::arg(); } +}; + +#endif + +// 4 + +template struct storage4: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, A4 a4 ): storage3( a1, a2, a3 ), a4_( a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a4_, 0); + } + + A4 a4_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage4< A1, A2, A3, boost::arg >: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, boost::arg ): storage3( a1, a2, a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a4_() { return boost::arg(); } +}; + +template struct storage4< A1, A2, A3, boost::arg (*) () >: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, boost::arg (*) () ): storage3( a1, a2, a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a4_() { return boost::arg(); } +}; + +#endif + +// 5 + +template struct storage5: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): storage4( a1, a2, a3, a4 ), a5_( a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a5_, 0); + } + + A5 a5_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage5< A1, A2, A3, A4, boost::arg >: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg ): storage4( a1, a2, a3, a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a5_() { return boost::arg(); } +}; + +template struct storage5< A1, A2, A3, A4, boost::arg (*) () >: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg (*) () ): storage4( a1, a2, a3, a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a5_() { return boost::arg(); } +}; + +#endif + +// 6 + +template struct storage6: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): storage5( a1, a2, a3, a4, a5 ), a6_( a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a6_, 0); + } + + A6 a6_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage6< A1, A2, A3, A4, A5, boost::arg >: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg ): storage5( a1, a2, a3, a4, a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a6_() { return boost::arg(); } +}; + +template struct storage6< A1, A2, A3, A4, A5, boost::arg (*) () >: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg (*) () ): storage5( a1, a2, a3, a4, a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a6_() { return boost::arg(); } +}; + +#endif + +// 7 + +template struct storage7: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): storage6( a1, a2, a3, a4, a5, a6 ), a7_( a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a7_, 0); + } + + A7 a7_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage7< A1, A2, A3, A4, A5, A6, boost::arg >: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg ): storage6( a1, a2, a3, a4, a5, a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a7_() { return boost::arg(); } +}; + +template struct storage7< A1, A2, A3, A4, A5, A6, boost::arg (*) () >: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg (*) () ): storage6( a1, a2, a3, a4, a5, a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a7_() { return boost::arg(); } +}; + +#endif + +// 8 + +template struct storage8: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): storage7( a1, a2, a3, a4, a5, a6, a7 ), a8_( a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a8_, 0); + } + + A8 a8_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg >: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg ): storage7( a1, a2, a3, a4, a5, a6, a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a8_() { return boost::arg(); } +}; + +template struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg (*) () >: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg (*) () ): storage7( a1, a2, a3, a4, a5, a6, a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a8_() { return boost::arg(); } +}; + +#endif + +// 9 + +template struct storage9: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ), a9_( a9 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a9_, 0); + } + + A9 a9_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a9_() { return boost::arg(); } +}; + +template struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg (*) () >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg (*) () ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a9_() { return boost::arg(); } +}; + +#endif + +} // namespace _bi + +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(default: 4512) // assignment operator could not be generated +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_BIND_STORAGE_HPP_INCLUDED diff --git a/libraries/boost/include/boost/call_traits.hpp b/libraries/boost/include/boost/call_traits.hpp new file mode 100644 index 0000000000..2c1328e94d --- /dev/null +++ b/libraries/boost/include/boost/call_traits.hpp @@ -0,0 +1,20 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/utility for most recent version including documentation. + +// See boost/detail/call_traits.hpp +// for full copyright notices. + +#ifndef BOOST_CALL_TRAITS_HPP +#define BOOST_CALL_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +#include + +#endif // BOOST_CALL_TRAITS_HPP diff --git a/libraries/boost/include/boost/checked_delete.hpp b/libraries/boost/include/boost/checked_delete.hpp new file mode 100644 index 0000000000..fb71c789c8 --- /dev/null +++ b/libraries/boost/include/boost/checked_delete.hpp @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2014 Glen Fernandes + * + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_CHECKED_DELETE_HPP +#define BOOST_CHECKED_DELETE_HPP + +// The header file at this path is deprecated; +// use boost/core/checked_delete.hpp instead. + +#include + +#endif diff --git a/libraries/boost/include/boost/config/user.hpp b/libraries/boost/include/boost/config/user.hpp index 28e7476afd..a830a548db 100644 --- a/libraries/boost/include/boost/config/user.hpp +++ b/libraries/boost/include/boost/config/user.hpp @@ -131,3 +131,6 @@ // to ensure the correct libraries are selected at link time. // #define BOOST_LIB_BUILDID amd64 +// Current CDT limitations +#define BOOST_SP_NO_ATOMIC_ACCESS +#define BOOST_NO_FENV_H diff --git a/libraries/boost/include/boost/cstdlib.hpp b/libraries/boost/include/boost/cstdlib.hpp new file mode 100644 index 0000000000..6322146354 --- /dev/null +++ b/libraries/boost/include/boost/cstdlib.hpp @@ -0,0 +1,41 @@ +// boost/cstdlib.hpp header ------------------------------------------------// + +// Copyright Beman Dawes 2001. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/utility/cstdlib.html for documentation. + +// Revision History +// 26 Feb 01 Initial version (Beman Dawes) + +#ifndef BOOST_CSTDLIB_HPP +#define BOOST_CSTDLIB_HPP + +#include + +namespace boost +{ + // The intent is to propose the following for addition to namespace std + // in the C++ Standard Library, and to then deprecate EXIT_SUCCESS and + // EXIT_FAILURE. As an implementation detail, this header defines the + // new constants in terms of EXIT_SUCCESS and EXIT_FAILURE. In a new + // standard, the constants would be implementation-defined, although it + // might be worthwhile to "suggest" (which a standard is allowed to do) + // values of 0 and 1 respectively. + + // Rationale for having multiple failure values: some environments may + // wish to distinguish between different classes of errors. + // Rationale for choice of values: programs often use values < 100 for + // their own error reporting. Values > 255 are sometimes reserved for + // system detected errors. 200/201 were suggested to minimize conflict. + + const int exit_success = EXIT_SUCCESS; // implementation-defined value + const int exit_failure = EXIT_FAILURE; // implementation-defined value + const int exit_exception_failure = 200; // otherwise uncaught exception + const int exit_test_failure = 201; // report_error or + // report_critical_error called. +} + +#endif + diff --git a/libraries/boost/include/boost/current_function.hpp b/libraries/boost/include/boost/current_function.hpp new file mode 100644 index 0000000000..86955cb041 --- /dev/null +++ b/libraries/boost/include/boost/current_function.hpp @@ -0,0 +1,75 @@ +#ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED +#define BOOST_CURRENT_FUNCTION_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/current_function.hpp - BOOST_CURRENT_FUNCTION +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// http://www.boost.org/libs/assert/current_function.html +// + +namespace boost +{ + +namespace detail +{ + +inline void current_function_helper() +{ + +#if defined( BOOST_DISABLE_CURRENT_FUNCTION ) + +# define BOOST_CURRENT_FUNCTION "(unknown)" + +#elif defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__) + +# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ + +#elif defined(__DMC__) && (__DMC__ >= 0x810) + +# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ + +#elif defined(__FUNCSIG__) + +# define BOOST_CURRENT_FUNCTION __FUNCSIG__ + +#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500)) + +# define BOOST_CURRENT_FUNCTION __FUNCTION__ + +#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550) + +# define BOOST_CURRENT_FUNCTION __FUNC__ + +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) + +# define BOOST_CURRENT_FUNCTION __func__ + +#elif defined(__cplusplus) && (__cplusplus >= 201103) + +# define BOOST_CURRENT_FUNCTION __func__ + +#else + +# define BOOST_CURRENT_FUNCTION "(unknown)" + +#endif + +} + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED diff --git a/libraries/boost/include/boost/exception/current_exception_cast.hpp b/libraries/boost/include/boost/exception/current_exception_cast.hpp new file mode 100644 index 0000000000..5d81f00b00 --- /dev/null +++ b/libraries/boost/include/boost/exception/current_exception_cast.hpp @@ -0,0 +1,43 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef UUID_7E83C166200811DE885E826156D89593 +#define UUID_7E83C166200811DE885E826156D89593 +#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +namespace +boost + { + template + inline + E * + current_exception_cast() + { + try + { + throw; + } + catch( + E & e ) + { + return &e; + } + catch( + ...) + { + return 0; + } + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/libraries/boost/include/boost/exception/detail/error_info_impl.hpp b/libraries/boost/include/boost/exception/detail/error_info_impl.hpp new file mode 100644 index 0000000000..6c48d61ab3 --- /dev/null +++ b/libraries/boost/include/boost/exception/detail/error_info_impl.hpp @@ -0,0 +1,102 @@ +//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef UUID_CE6983AC753411DDA764247956D89593 +#define UUID_CE6983AC753411DDA764247956D89593 + +#include +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +#include +#endif +#include +#include + +#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +namespace +boost + { + namespace + exception_detail + { + class + error_info_base + { + public: + + virtual std::string name_value_string() const = 0; + virtual error_info_base * clone() const = 0; + + virtual + ~error_info_base() throw() + { + } + }; + } + + template + class + error_info: + public exception_detail::error_info_base + { + error_info_base * + clone() const + { + return new error_info(*this); + } + public: + typedef T value_type; + error_info( value_type const & v ): + v_(v) + { + } +#if (__GNUC__*100+__GNUC_MINOR__!=406) //workaround for g++ bug +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + error_info( error_info const & x ): + v_(x.v_) + { + } + error_info( T && v ) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible::value): + v_(std::move(v)) + { + } + error_info( error_info && x ) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible::value): + v_(std::move(x.v_)) + { + } +#endif +#endif + ~error_info() throw() + { + } + value_type const & + value() const + { + return v_; + } + value_type & + value() + { + return v_; + } + private: + error_info & operator=( error_info const & ); +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + error_info & operator=( error_info && x ); +#endif + std::string name_value_string() const; + value_type v_; + }; + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/libraries/boost/include/boost/exception/detail/shared_ptr.hpp b/libraries/boost/include/boost/exception/detail/shared_ptr.hpp new file mode 100644 index 0000000000..51febe8c8f --- /dev/null +++ b/libraries/boost/include/boost/exception/detail/shared_ptr.hpp @@ -0,0 +1,17 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef UUID_837060E885AF11E68DA91D15E31AC075 +#define UUID_837060E885AF11E68DA91D15E31AC075 + +#ifdef BOOST_EXCEPTION_MINI_BOOST +#include +namespace boost { namespace exception_detail { using std::shared_ptr; } } +#else +#include +namespace boost { namespace exception_detail { using boost::shared_ptr; } } +#endif + +#endif diff --git a/libraries/boost/include/boost/exception/detail/type_info.hpp b/libraries/boost/include/boost/exception/detail/type_info.hpp new file mode 100644 index 0000000000..739ac5748e --- /dev/null +++ b/libraries/boost/include/boost/exception/detail/type_info.hpp @@ -0,0 +1,82 @@ +//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef UUID_C3E1741C754311DDB2834CCA55D89593 +#define UUID_C3E1741C754311DDB2834CCA55D89593 + +#include +#include +#include +#include +#include + +#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +namespace +boost + { + template + inline + std::string + tag_type_name() + { +#ifdef BOOST_NO_TYPEID + return BOOST_CURRENT_FUNCTION; +#else + return core::demangle(typeid(T*).name()); +#endif + } + + template + inline + std::string + type_name() + { +#ifdef BOOST_NO_TYPEID + return BOOST_CURRENT_FUNCTION; +#else + return core::demangle(typeid(T).name()); +#endif + } + + namespace + exception_detail + { + struct + type_info_ + { + core::typeinfo const * type_; + + explicit + type_info_( core::typeinfo const & type ): + type_(&type) + { + } + + friend + bool + operator<( type_info_ const & a, type_info_ const & b ) + { + return 0!=(a.type_->before(*b.type_)); + } + }; + } + } + +#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_CORE_TYPEID(T)) + +#ifndef BOOST_NO_RTTI +#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x)) +#endif + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/libraries/boost/include/boost/exception/exception.hpp b/libraries/boost/include/boost/exception/exception.hpp new file mode 100644 index 0000000000..c0fdaf9e55 --- /dev/null +++ b/libraries/boost/include/boost/exception/exception.hpp @@ -0,0 +1,521 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593 +#define UUID_274DA366004E11DCB1DDFE2E56D89593 +#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +#ifdef BOOST_EXCEPTION_MINI_BOOST +#include +namespace boost { namespace exception_detail { using std::shared_ptr; } } +#else +namespace boost { template class shared_ptr; }; +namespace boost { namespace exception_detail { using boost::shared_ptr; } } +#endif + +namespace +boost + { + namespace + exception_detail + { + template + class + refcount_ptr + { + public: + + refcount_ptr(): + px_(0) + { + } + + ~refcount_ptr() + { + release(); + } + + refcount_ptr( refcount_ptr const & x ): + px_(x.px_) + { + add_ref(); + } + + refcount_ptr & + operator=( refcount_ptr const & x ) + { + adopt(x.px_); + return *this; + } + + void + adopt( T * px ) + { + release(); + px_=px; + add_ref(); + } + + T * + get() const + { + return px_; + } + + private: + + T * px_; + + void + add_ref() + { + if( px_ ) + px_->add_ref(); + } + + void + release() + { + if( px_ && px_->release() ) + px_=0; + } + }; + } + + //////////////////////////////////////////////////////////////////////// + + template + class error_info; + + typedef error_info throw_function; + typedef error_info throw_file; + typedef error_info throw_line; + + template <> + class + error_info + { + public: + typedef char const * value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + + template <> + class + error_info + { + public: + typedef char const * value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + + template <> + class + error_info + { + public: + typedef int value_type; + value_type v_; + explicit + error_info( value_type v ): + v_(v) + { + } + }; + +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif + class exception; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif + + namespace + exception_detail + { + class error_info_base; + struct type_info_; + + struct + error_info_container + { + virtual char const * diagnostic_information( char const * ) const = 0; + virtual shared_ptr get( type_info_ const & ) const = 0; + virtual void set( shared_ptr const &, type_info_ const & ) = 0; + virtual void add_ref() const = 0; + virtual bool release() const = 0; + virtual refcount_ptr clone() const = 0; + + protected: + + ~error_info_container() throw() + { + } + }; + + template + struct get_info; + + template <> + struct get_info; + + template <> + struct get_info; + + template <> + struct get_info; + + template + struct set_info_rv; + + template <> + struct set_info_rv; + + template <> + struct set_info_rv; + + template <> + struct set_info_rv; + + char const * get_diagnostic_information( exception const &, char const * ); + + void copy_boost_exception( exception *, exception const * ); + + template + E const & set_info( E const &, error_info const & ); + + template + E const & set_info( E const &, throw_function const & ); + + template + E const & set_info( E const &, throw_file const & ); + + template + E const & set_info( E const &, throw_line const & ); + } + +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif + class + exception + { + // + public: + template void set( typename Tag::type const & ); + template typename Tag::type const * get() const; + // + + protected: + + exception(): + throw_function_(0), + throw_file_(0), + throw_line_(-1) + { + } + +#ifdef __HP_aCC + //On HP aCC, this protected copy constructor prevents throwing boost::exception. + //On all other platforms, the same effect is achieved by the pure virtual destructor. + exception( exception const & x ) throw(): + data_(x.data_), + throw_function_(x.throw_function_), + throw_file_(x.throw_file_), + throw_line_(x.throw_line_) + { + } +#endif + + virtual ~exception() throw() +#ifndef __HP_aCC + = 0 //Workaround for HP aCC, =0 incorrectly leads to link errors. +#endif + ; + +#if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310) + public: +#else + private: + + template + friend E const & exception_detail::set_info( E const &, throw_function const & ); + + template + friend E const & exception_detail::set_info( E const &, throw_file const & ); + + template + friend E const & exception_detail::set_info( E const &, throw_line const & ); + + template + friend E const & exception_detail::set_info( E const &, error_info const & ); + + friend char const * exception_detail::get_diagnostic_information( exception const &, char const * ); + + template + friend struct exception_detail::get_info; + friend struct exception_detail::get_info; + friend struct exception_detail::get_info; + friend struct exception_detail::get_info; + template + friend struct exception_detail::set_info_rv; + friend struct exception_detail::set_info_rv; + friend struct exception_detail::set_info_rv; + friend struct exception_detail::set_info_rv; + friend void exception_detail::copy_boost_exception( exception *, exception const * ); +#endif + mutable exception_detail::refcount_ptr data_; + mutable char const * throw_function_; + mutable char const * throw_file_; + mutable int throw_line_; + }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif + + inline + exception:: + ~exception() throw() + { + } + + namespace + exception_detail + { + template + E const & + set_info( E const & x, throw_function const & y ) + { + x.throw_function_=y.v_; + return x; + } + + template + E const & + set_info( E const & x, throw_file const & y ) + { + x.throw_file_=y.v_; + return x; + } + + template + E const & + set_info( E const & x, throw_line const & y ) + { + x.throw_line_=y.v_; + return x; + } + } + + //////////////////////////////////////////////////////////////////////// + + namespace + exception_detail + { +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif + template + struct + error_info_injector: + public T, + public exception + { + explicit + error_info_injector( T const & x ): + T(x) + { + } + + ~error_info_injector() throw() + { + } + }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif + + struct large_size { char c[256]; }; + large_size dispatch_boost_exception( exception const * ); + + struct small_size { }; + small_size dispatch_boost_exception( void const * ); + + template + struct enable_error_info_helper; + + template + struct + enable_error_info_helper + { + typedef T type; + }; + + template + struct + enable_error_info_helper + { + typedef error_info_injector type; + }; + + template + struct + enable_error_info_return_type + { + typedef typename enable_error_info_helper(0)))>::type type; + }; + } + + template + inline + typename + exception_detail::enable_error_info_return_type::type + enable_error_info( T const & x ) + { + typedef typename exception_detail::enable_error_info_return_type::type rt; + return rt(x); + } + + //////////////////////////////////////////////////////////////////////// + + namespace + exception_detail + { +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif + class + clone_base + { + public: + + virtual clone_base const * clone() const = 0; + virtual void rethrow() const = 0; + + virtual + ~clone_base() throw() + { + } + }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif + + inline + void + copy_boost_exception( exception * a, exception const * b ) + { + refcount_ptr data; + if( error_info_container * d=b->data_.get() ) + data = d->clone(); + a->throw_file_ = b->throw_file_; + a->throw_line_ = b->throw_line_; + a->throw_function_ = b->throw_function_; + a->data_ = data; + } + + inline + void + copy_boost_exception( void *, void const * ) + { + } + +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif + template + class + clone_impl: + public T, + public virtual clone_base + { + struct clone_tag { }; + clone_impl( clone_impl const & x, clone_tag ): + T(x) + { + copy_boost_exception(this,&x); + } + + public: + + explicit + clone_impl( T const & x ): + T(x) + { + copy_boost_exception(this,&x); + } + + ~clone_impl() throw() + { + } + + private: + + clone_base const * + clone() const + { + return new clone_impl(*this,clone_tag()); + } + + void + rethrow() const + { + throw*this; + } + }; + } +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif + + template + inline + exception_detail::clone_impl + enable_current_exception( T const & x ) + { + return exception_detail::clone_impl(x); + } + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/libraries/boost/include/boost/exception/get_error_info.hpp b/libraries/boost/include/boost/exception/get_error_info.hpp new file mode 100644 index 0000000000..831717df59 --- /dev/null +++ b/libraries/boost/include/boost/exception/get_error_info.hpp @@ -0,0 +1,133 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef UUID_1A590226753311DD9E4CCF6156D89593 +#define UUID_1A590226753311DD9E4CCF6156D89593 + +#include +#include +#include +#include +#include +#include + +#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +namespace +boost + { + namespace + exception_detail + { + template + struct + get_info + { + static + typename ErrorInfo::value_type * + get( exception const & x ) + { + if( exception_detail::error_info_container * c=x.data_.get() ) + if( shared_ptr eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) ) + { +#ifndef BOOST_NO_RTTI + BOOST_ASSERT( 0!=dynamic_cast(eib.get()) ); +#endif + ErrorInfo * w = static_cast(eib.get()); + return &w->value(); + } + return 0; + } + }; + + template <> + struct + get_info + { + static + char const * * + get( exception const & x ) + { + return x.throw_function_ ? &x.throw_function_ : 0; + } + }; + + template <> + struct + get_info + { + static + char const * * + get( exception const & x ) + { + return x.throw_file_ ? &x.throw_file_ : 0; + } + }; + + template <> + struct + get_info + { + static + int * + get( exception const & x ) + { + return x.throw_line_!=-1 ? &x.throw_line_ : 0; + } + }; + + template + struct + get_error_info_return_type + { + typedef R * type; + }; + + template + struct + get_error_info_return_type + { + typedef R const * type; + }; + } + +#ifdef BOOST_NO_RTTI + template + inline + typename ErrorInfo::value_type const * + get_error_info( boost::exception const & x ) + { + return exception_detail::get_info::get(x); + } + template + inline + typename ErrorInfo::value_type * + get_error_info( boost::exception & x ) + { + return exception_detail::get_info::get(x); + } +#else + template + inline + typename exception_detail::get_error_info_return_type::type + get_error_info( E & some_exception ) + { + if( exception const * x = dynamic_cast(&some_exception) ) + return exception_detail::get_info::get(*x); + else + return 0; + } +#endif + } + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/libraries/boost/include/boost/function/detail/maybe_include.hpp b/libraries/boost/include/boost/function/detail/maybe_include.hpp new file mode 100644 index 0000000000..ec88905dcd --- /dev/null +++ b/libraries/boost/include/boost/function/detail/maybe_include.hpp @@ -0,0 +1,369 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#if BOOST_FUNCTION_NUM_ARGS == 0 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 0 +# ifndef BOOST_FUNCTION_0 +# define BOOST_FUNCTION_0 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 1 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 1 +# ifndef BOOST_FUNCTION_1 +# define BOOST_FUNCTION_1 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 2 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 2 +# ifndef BOOST_FUNCTION_2 +# define BOOST_FUNCTION_2 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 3 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 3 +# ifndef BOOST_FUNCTION_3 +# define BOOST_FUNCTION_3 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 4 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 4 +# ifndef BOOST_FUNCTION_4 +# define BOOST_FUNCTION_4 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 5 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 5 +# ifndef BOOST_FUNCTION_5 +# define BOOST_FUNCTION_5 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 6 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 6 +# ifndef BOOST_FUNCTION_6 +# define BOOST_FUNCTION_6 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 7 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 7 +# ifndef BOOST_FUNCTION_7 +# define BOOST_FUNCTION_7 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 8 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 8 +# ifndef BOOST_FUNCTION_8 +# define BOOST_FUNCTION_8 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 9 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 9 +# ifndef BOOST_FUNCTION_9 +# define BOOST_FUNCTION_9 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 10 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 10 +# ifndef BOOST_FUNCTION_10 +# define BOOST_FUNCTION_10 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 11 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 11 +# ifndef BOOST_FUNCTION_11 +# define BOOST_FUNCTION_11 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 12 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 12 +# ifndef BOOST_FUNCTION_12 +# define BOOST_FUNCTION_12 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 13 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 13 +# ifndef BOOST_FUNCTION_13 +# define BOOST_FUNCTION_13 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 14 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 14 +# ifndef BOOST_FUNCTION_14 +# define BOOST_FUNCTION_14 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 15 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 15 +# ifndef BOOST_FUNCTION_15 +# define BOOST_FUNCTION_15 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 16 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 16 +# ifndef BOOST_FUNCTION_16 +# define BOOST_FUNCTION_16 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 17 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 17 +# ifndef BOOST_FUNCTION_17 +# define BOOST_FUNCTION_17 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 18 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 18 +# ifndef BOOST_FUNCTION_18 +# define BOOST_FUNCTION_18 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 19 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 19 +# ifndef BOOST_FUNCTION_19 +# define BOOST_FUNCTION_19 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 20 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 20 +# ifndef BOOST_FUNCTION_20 +# define BOOST_FUNCTION_20 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 21 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 21 +# ifndef BOOST_FUNCTION_21 +# define BOOST_FUNCTION_21 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 22 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 22 +# ifndef BOOST_FUNCTION_22 +# define BOOST_FUNCTION_22 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 23 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 23 +# ifndef BOOST_FUNCTION_23 +# define BOOST_FUNCTION_23 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 24 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 24 +# ifndef BOOST_FUNCTION_24 +# define BOOST_FUNCTION_24 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 25 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 25 +# ifndef BOOST_FUNCTION_25 +# define BOOST_FUNCTION_25 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 26 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 26 +# ifndef BOOST_FUNCTION_26 +# define BOOST_FUNCTION_26 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 27 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 27 +# ifndef BOOST_FUNCTION_27 +# define BOOST_FUNCTION_27 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 28 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 28 +# ifndef BOOST_FUNCTION_28 +# define BOOST_FUNCTION_28 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 29 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 29 +# ifndef BOOST_FUNCTION_29 +# define BOOST_FUNCTION_29 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 30 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 30 +# ifndef BOOST_FUNCTION_30 +# define BOOST_FUNCTION_30 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 31 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 31 +# ifndef BOOST_FUNCTION_31 +# define BOOST_FUNCTION_31 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 32 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 32 +# ifndef BOOST_FUNCTION_32 +# define BOOST_FUNCTION_32 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 33 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 33 +# ifndef BOOST_FUNCTION_33 +# define BOOST_FUNCTION_33 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 34 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 34 +# ifndef BOOST_FUNCTION_34 +# define BOOST_FUNCTION_34 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 35 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 35 +# ifndef BOOST_FUNCTION_35 +# define BOOST_FUNCTION_35 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 36 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 36 +# ifndef BOOST_FUNCTION_36 +# define BOOST_FUNCTION_36 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 37 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 37 +# ifndef BOOST_FUNCTION_37 +# define BOOST_FUNCTION_37 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 38 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 38 +# ifndef BOOST_FUNCTION_38 +# define BOOST_FUNCTION_38 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 39 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 39 +# ifndef BOOST_FUNCTION_39 +# define BOOST_FUNCTION_39 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 40 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 40 +# ifndef BOOST_FUNCTION_40 +# define BOOST_FUNCTION_40 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 41 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 41 +# ifndef BOOST_FUNCTION_41 +# define BOOST_FUNCTION_41 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 42 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 42 +# ifndef BOOST_FUNCTION_42 +# define BOOST_FUNCTION_42 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 43 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 43 +# ifndef BOOST_FUNCTION_43 +# define BOOST_FUNCTION_43 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 44 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 44 +# ifndef BOOST_FUNCTION_44 +# define BOOST_FUNCTION_44 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 45 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 45 +# ifndef BOOST_FUNCTION_45 +# define BOOST_FUNCTION_45 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 46 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 46 +# ifndef BOOST_FUNCTION_46 +# define BOOST_FUNCTION_46 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 47 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 47 +# ifndef BOOST_FUNCTION_47 +# define BOOST_FUNCTION_47 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 48 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 48 +# ifndef BOOST_FUNCTION_48 +# define BOOST_FUNCTION_48 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 49 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 49 +# ifndef BOOST_FUNCTION_49 +# define BOOST_FUNCTION_49 +# include +# endif +#elif BOOST_FUNCTION_NUM_ARGS == 50 +# undef BOOST_FUNCTION_MAX_ARGS_DEFINED +# define BOOST_FUNCTION_MAX_ARGS_DEFINED 50 +# ifndef BOOST_FUNCTION_50 +# define BOOST_FUNCTION_50 +# include +# endif +#else +# error Cannot handle Boost.Function objects that accept more than 50 arguments! +#endif diff --git a/libraries/boost/include/boost/function/detail/prologue.hpp b/libraries/boost/include/boost/function/detail/prologue.hpp new file mode 100644 index 0000000000..53d0f05cd3 --- /dev/null +++ b/libraries/boost/include/boost/function/detail/prologue.hpp @@ -0,0 +1,26 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#ifndef BOOST_FUNCTION_PROLOGUE_HPP +#define BOOST_FUNCTION_PROLOGUE_HPP +# include +# include +# include // unary_function, binary_function +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif // BOOST_FUNCTION_PROLOGUE_HPP diff --git a/libraries/boost/include/boost/function/function0.hpp b/libraries/boost/include/boost/function/function0.hpp new file mode 100644 index 0000000000..65a02e5fac --- /dev/null +++ b/libraries/boost/include/boost/function/function0.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 0 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/libraries/boost/include/boost/function/function1.hpp b/libraries/boost/include/boost/function/function1.hpp new file mode 100644 index 0000000000..9089715155 --- /dev/null +++ b/libraries/boost/include/boost/function/function1.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 1 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/libraries/boost/include/boost/function/function2.hpp b/libraries/boost/include/boost/function/function2.hpp new file mode 100644 index 0000000000..dc8bf97521 --- /dev/null +++ b/libraries/boost/include/boost/function/function2.hpp @@ -0,0 +1,12 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2002-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#define BOOST_FUNCTION_NUM_ARGS 2 +#include +#undef BOOST_FUNCTION_NUM_ARGS diff --git a/libraries/boost/include/boost/function/function_base.hpp b/libraries/boost/include/boost/function/function_base.hpp new file mode 100644 index 0000000000..841affb49a --- /dev/null +++ b/libraries/boost/include/boost/function/function_base.hpp @@ -0,0 +1,886 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2001-2006 +// Copyright Emil Dotchevski 2007 +// Use, modification and distribution is subject to the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +#ifndef BOOST_FUNCTION_BASE_HEADER +#define BOOST_FUNCTION_BASE_HEADER + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef BOOST_NO_SFINAE +# include "boost/utility/enable_if.hpp" +#else +# include "boost/mpl/bool.hpp" +#endif +#include +#include + +#if defined(BOOST_MSVC) +# pragma warning( push ) +# pragma warning( disable : 4793 ) // complaint about native code generation +# pragma warning( disable : 4127 ) // "conditional expression is constant" +#endif + +#if defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG) +# define BOOST_FUNCTION_TARGET_FIX(x) x +#else +# define BOOST_FUNCTION_TARGET_FIX(x) +#endif // __ICL etc + +# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ + typename ::boost::enable_if_c< \ + !(::boost::is_integral::value), \ + Type>::type + +namespace boost { + namespace detail { + namespace function { + class X; + + /** + * A buffer used to store small function objects in + * boost::function. It is a union containing function pointers, + * object pointers, and a structure that resembles a bound + * member function pointer. + */ + union function_buffer_members + { + // For pointers to function objects + typedef void* obj_ptr_t; + mutable obj_ptr_t obj_ptr; + + // For pointers to std::type_info objects + struct type_t { + // (get_functor_type_tag, check_functor_type_tag). + const boost::typeindex::type_info* type; + + // Whether the type is const-qualified. + bool const_qualified; + // Whether the type is volatile-qualified. + bool volatile_qualified; + } type; + + // For function pointers of all kinds + typedef void (*func_ptr_t)(); + mutable func_ptr_t func_ptr; + + // For bound member pointers + struct bound_memfunc_ptr_t { + void (X::*memfunc_ptr)(int); + void* obj_ptr; + } bound_memfunc_ptr; + + // For references to function objects. We explicitly keep + // track of the cv-qualifiers on the object referenced. + struct obj_ref_t { + mutable void* obj_ptr; + bool is_const_qualified; + bool is_volatile_qualified; + } obj_ref; + }; + + union function_buffer + { + // Type-specific union members + mutable function_buffer_members members; + + // To relax aliasing constraints + mutable char data[sizeof(function_buffer_members)]; + }; + + /** + * The unusable class is a placeholder for unused function arguments + * It is also completely unusable except that it constructable from + * anything. This helps compilers without partial specialization to + * handle Boost.Function objects returning void. + */ + struct unusable + { + unusable() {} + template unusable(const T&) {} + }; + + /* Determine the return type. This supports compilers that do not support + * void returns or partial specialization by silently changing the return + * type to "unusable". + */ + template struct function_return_type { typedef T type; }; + + template<> + struct function_return_type + { + typedef unusable type; + }; + + // The operation type to perform on the given functor/function pointer + enum functor_manager_operation_type { + clone_functor_tag, + move_functor_tag, + destroy_functor_tag, + check_functor_type_tag, + get_functor_type_tag + }; + + // Tags used to decide between different types of functions + struct function_ptr_tag {}; + struct function_obj_tag {}; + struct member_ptr_tag {}; + struct function_obj_ref_tag {}; + + template + class get_function_tag + { + typedef typename mpl::if_c<(is_pointer::value), + function_ptr_tag, + function_obj_tag>::type ptr_or_obj_tag; + + typedef typename mpl::if_c<(is_member_pointer::value), + member_ptr_tag, + ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag; + + typedef typename mpl::if_c<(is_reference_wrapper::value), + function_obj_ref_tag, + ptr_or_obj_or_mem_tag>::type or_ref_tag; + + public: + typedef or_ref_tag type; + }; + + // The trivial manager does nothing but return the same pointer (if we + // are cloning) or return the null pointer (if we are deleting). + template + struct reference_manager + { + static inline void + manage(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) + { + switch (op) { + case clone_functor_tag: + out_buffer.members.obj_ref = in_buffer.members.obj_ref; + return; + + case move_functor_tag: + out_buffer.members.obj_ref = in_buffer.members.obj_ref; + in_buffer.members.obj_ref.obj_ptr = 0; + return; + + case destroy_functor_tag: + out_buffer.members.obj_ref.obj_ptr = 0; + return; + + case check_functor_type_tag: + { + // Check whether we have the same type. We can add + // cv-qualifiers, but we can't take them away. + if (*out_buffer.members.type.type == boost::typeindex::type_id() + && (!in_buffer.members.obj_ref.is_const_qualified + || out_buffer.members.type.const_qualified) + && (!in_buffer.members.obj_ref.is_volatile_qualified + || out_buffer.members.type.volatile_qualified)) + out_buffer.members.obj_ptr = in_buffer.members.obj_ref.obj_ptr; + else + out_buffer.members.obj_ptr = 0; + } + return; + + case get_functor_type_tag: + out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); + out_buffer.members.type.const_qualified = in_buffer.members.obj_ref.is_const_qualified; + out_buffer.members.type.volatile_qualified = in_buffer.members.obj_ref.is_volatile_qualified; + return; + } + } + }; + + /** + * Determine if boost::function can use the small-object + * optimization with the function object type F. + */ + template + struct function_allows_small_object_optimization + { + BOOST_STATIC_CONSTANT + (bool, + value = ((sizeof(F) <= sizeof(function_buffer) && + (alignment_of::value + % alignment_of::value == 0)))); + }; + + template + struct functor_wrapper: public F, public A + { + functor_wrapper( F f, A a ): + F(f), + A(a) + { + } + + functor_wrapper(const functor_wrapper& f) : + F(static_cast(f)), + A(static_cast(f)) + { + } + }; + + /** + * The functor_manager class contains a static function "manage" which + * can clone or destroy the given function/function object pointer. + */ + template + struct functor_manager_common + { + typedef Functor functor_type; + + // Function pointers + static inline void + manage_ptr(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) + { + if (op == clone_functor_tag) + out_buffer.members.func_ptr = in_buffer.members.func_ptr; + else if (op == move_functor_tag) { + out_buffer.members.func_ptr = in_buffer.members.func_ptr; + in_buffer.members.func_ptr = 0; + } else if (op == destroy_functor_tag) + out_buffer.members.func_ptr = 0; + else if (op == check_functor_type_tag) { + if (*out_buffer.members.type.type == boost::typeindex::type_id()) + out_buffer.members.obj_ptr = &in_buffer.members.func_ptr; + else + out_buffer.members.obj_ptr = 0; + } else /* op == get_functor_type_tag */ { + out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); + out_buffer.members.type.const_qualified = false; + out_buffer.members.type.volatile_qualified = false; + } + } + + // Function objects that fit in the small-object buffer. + static inline void + manage_small(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) + { + if (op == clone_functor_tag || op == move_functor_tag) { + const functor_type* in_functor = + reinterpret_cast(in_buffer.data); + new (reinterpret_cast(out_buffer.data)) functor_type(*in_functor); + + if (op == move_functor_tag) { + functor_type* f = reinterpret_cast(in_buffer.data); + (void)f; // suppress warning about the value of f not being used (MSVC) + f->~Functor(); + } + } else if (op == destroy_functor_tag) { + // Some compilers (Borland, vc6, ...) are unhappy with ~functor_type. + functor_type* f = reinterpret_cast(out_buffer.data); + (void)f; // suppress warning about the value of f not being used (MSVC) + f->~Functor(); + } else if (op == check_functor_type_tag) { + if (*out_buffer.members.type.type == boost::typeindex::type_id()) + out_buffer.members.obj_ptr = in_buffer.data; + else + out_buffer.members.obj_ptr = 0; + } else /* op == get_functor_type_tag */ { + out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); + out_buffer.members.type.const_qualified = false; + out_buffer.members.type.volatile_qualified = false; + } + } + }; + + template + struct functor_manager + { + private: + typedef Functor functor_type; + + // Function pointers + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, function_ptr_tag) + { + functor_manager_common::manage_ptr(in_buffer,out_buffer,op); + } + + // Function objects that fit in the small-object buffer. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, mpl::true_) + { + functor_manager_common::manage_small(in_buffer,out_buffer,op); + } + + // Function objects that require heap allocation + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, mpl::false_) + { + if (op == clone_functor_tag) { + // Clone the functor + // GCC 2.95.3 gets the CV qualifiers wrong here, so we + // can't do the static_cast that we should do. + // jewillco: Changing this to static_cast because GCC 2.95.3 is + // obsolete. + const functor_type* f = + static_cast(in_buffer.members.obj_ptr); + functor_type* new_f = new functor_type(*f); + out_buffer.members.obj_ptr = new_f; + } else if (op == move_functor_tag) { + out_buffer.members.obj_ptr = in_buffer.members.obj_ptr; + in_buffer.members.obj_ptr = 0; + } else if (op == destroy_functor_tag) { + /* Cast from the void pointer to the functor pointer type */ + functor_type* f = + static_cast(out_buffer.members.obj_ptr); + delete f; + out_buffer.members.obj_ptr = 0; + } else if (op == check_functor_type_tag) { + if (*out_buffer.members.type.type == boost::typeindex::type_id()) + out_buffer.members.obj_ptr = in_buffer.members.obj_ptr; + else + out_buffer.members.obj_ptr = 0; + } else /* op == get_functor_type_tag */ { + out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); + out_buffer.members.type.const_qualified = false; + out_buffer.members.type.volatile_qualified = false; + } + } + + // For function objects, we determine whether the function + // object can use the small-object optimization buffer or + // whether we need to allocate it on the heap. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, function_obj_tag) + { + manager(in_buffer, out_buffer, op, + mpl::bool_<(function_allows_small_object_optimization::value)>()); + } + + // For member pointers, we use the small-object optimization buffer. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, member_ptr_tag) + { + manager(in_buffer, out_buffer, op, mpl::true_()); + } + + public: + /* Dispatch to an appropriate manager based on whether we have a + function pointer or a function object pointer. */ + static inline void + manage(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) + { + typedef typename get_function_tag::type tag_type; + switch (op) { + case get_functor_type_tag: + out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); + out_buffer.members.type.const_qualified = false; + out_buffer.members.type.volatile_qualified = false; + return; + + default: + manager(in_buffer, out_buffer, op, tag_type()); + return; + } + } + }; + + template + struct functor_manager_a + { + private: + typedef Functor functor_type; + + // Function pointers + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, function_ptr_tag) + { + functor_manager_common::manage_ptr(in_buffer,out_buffer,op); + } + + // Function objects that fit in the small-object buffer. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, mpl::true_) + { + functor_manager_common::manage_small(in_buffer,out_buffer,op); + } + + // Function objects that require heap allocation + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, mpl::false_) + { + typedef functor_wrapper functor_wrapper_type; +#if defined(BOOST_NO_CXX11_ALLOCATOR) + typedef typename Allocator::template rebind::other + wrapper_allocator_type; + typedef typename wrapper_allocator_type::pointer wrapper_allocator_pointer_type; +#else + using wrapper_allocator_type = typename std::allocator_traits::template rebind_alloc; + using wrapper_allocator_pointer_type = typename std::allocator_traits::pointer; +#endif + + if (op == clone_functor_tag) { + // Clone the functor + // GCC 2.95.3 gets the CV qualifiers wrong here, so we + // can't do the static_cast that we should do. + const functor_wrapper_type* f = + static_cast(in_buffer.members.obj_ptr); + wrapper_allocator_type wrapper_allocator(static_cast(*f)); + wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); +#if defined(BOOST_NO_CXX11_ALLOCATOR) + wrapper_allocator.construct(copy, *f); +#else + std::allocator_traits::construct(wrapper_allocator, copy, *f); +#endif + + // Get back to the original pointer type + functor_wrapper_type* new_f = static_cast(copy); + out_buffer.members.obj_ptr = new_f; + } else if (op == move_functor_tag) { + out_buffer.members.obj_ptr = in_buffer.members.obj_ptr; + in_buffer.members.obj_ptr = 0; + } else if (op == destroy_functor_tag) { + /* Cast from the void pointer to the functor_wrapper_type */ + functor_wrapper_type* victim = + static_cast(in_buffer.members.obj_ptr); + wrapper_allocator_type wrapper_allocator(static_cast(*victim)); +#if defined(BOOST_NO_CXX11_ALLOCATOR) + wrapper_allocator.destroy(victim); +#else + std::allocator_traits::destroy(wrapper_allocator, victim); +#endif + wrapper_allocator.deallocate(victim,1); + out_buffer.members.obj_ptr = 0; + } else if (op == check_functor_type_tag) { + if (*out_buffer.members.type.type == boost::typeindex::type_id()) + out_buffer.members.obj_ptr = in_buffer.members.obj_ptr; + else + out_buffer.members.obj_ptr = 0; + } else /* op == get_functor_type_tag */ { + out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); + out_buffer.members.type.const_qualified = false; + out_buffer.members.type.volatile_qualified = false; + } + } + + // For function objects, we determine whether the function + // object can use the small-object optimization buffer or + // whether we need to allocate it on the heap. + static inline void + manager(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op, function_obj_tag) + { + manager(in_buffer, out_buffer, op, + mpl::bool_<(function_allows_small_object_optimization::value)>()); + } + + public: + /* Dispatch to an appropriate manager based on whether we have a + function pointer or a function object pointer. */ + static inline void + manage(const function_buffer& in_buffer, function_buffer& out_buffer, + functor_manager_operation_type op) + { + typedef typename get_function_tag::type tag_type; + switch (op) { + case get_functor_type_tag: + out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); + out_buffer.members.type.const_qualified = false; + out_buffer.members.type.volatile_qualified = false; + return; + + default: + manager(in_buffer, out_buffer, op, tag_type()); + return; + } + } + }; + + // A type that is only used for comparisons against zero + struct useless_clear_type {}; + +#ifdef BOOST_NO_SFINAE + // These routines perform comparisons between a Boost.Function + // object and an arbitrary function object (when the last + // parameter is mpl::bool_) or against zero (when the + // last parameter is mpl::bool_). They are only necessary + // for compilers that don't support SFINAE. + template + bool + compare_equal(const Function& f, const Functor&, int, mpl::bool_) + { return f.empty(); } + + template + bool + compare_not_equal(const Function& f, const Functor&, int, + mpl::bool_) + { return !f.empty(); } + + template + bool + compare_equal(const Function& f, const Functor& g, long, + mpl::bool_) + { + if (const Functor* fp = f.template target()) + return function_equal(*fp, g); + else return false; + } + + template + bool + compare_equal(const Function& f, const reference_wrapper& g, + int, mpl::bool_) + { + if (const Functor* fp = f.template target()) + return fp == g.get_pointer(); + else return false; + } + + template + bool + compare_not_equal(const Function& f, const Functor& g, long, + mpl::bool_) + { + if (const Functor* fp = f.template target()) + return !function_equal(*fp, g); + else return true; + } + + template + bool + compare_not_equal(const Function& f, + const reference_wrapper& g, int, + mpl::bool_) + { + if (const Functor* fp = f.template target()) + return fp != g.get_pointer(); + else return true; + } +#endif // BOOST_NO_SFINAE + + /** + * Stores the "manager" portion of the vtable for a + * boost::function object. + */ + struct vtable_base + { + void (*manager)(const function_buffer& in_buffer, + function_buffer& out_buffer, + functor_manager_operation_type op); + }; + } // end namespace function + } // end namespace detail + +/** + * The function_base class contains the basic elements needed for the + * function1, function2, function3, etc. classes. It is common to all + * functions (and as such can be used to tell if we have one of the + * functionN objects). + */ +class function_base +{ +public: + function_base() : vtable(0) { } + + /** Determine if the function is empty (i.e., has no target). */ + bool empty() const { return !vtable; } + + /** Retrieve the type of the stored function object, or type_id() + if this is empty. */ + const boost::typeindex::type_info& target_type() const + { + if (!vtable) return boost::typeindex::type_id().type_info(); + + detail::function::function_buffer type; + get_vtable()->manager(functor, type, detail::function::get_functor_type_tag); + return *type.members.type.type; + } + + template + Functor* target() + { + if (!vtable) return 0; + + detail::function::function_buffer type_result; + type_result.members.type.type = &boost::typeindex::type_id().type_info(); + type_result.members.type.const_qualified = is_const::value; + type_result.members.type.volatile_qualified = is_volatile::value; + get_vtable()->manager(functor, type_result, + detail::function::check_functor_type_tag); + return static_cast(type_result.members.obj_ptr); + } + + template + const Functor* target() const + { + if (!vtable) return 0; + + detail::function::function_buffer type_result; + type_result.members.type.type = &boost::typeindex::type_id().type_info(); + type_result.members.type.const_qualified = true; + type_result.members.type.volatile_qualified = is_volatile::value; + get_vtable()->manager(functor, type_result, + detail::function::check_functor_type_tag); + // GCC 2.95.3 gets the CV qualifiers wrong here, so we + // can't do the static_cast that we should do. + return static_cast(type_result.members.obj_ptr); + } + + template + bool contains(const F& f) const + { + if (const F* fp = this->template target()) + { + return function_equal(*fp, f); + } else { + return false; + } + } + +#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3 + // GCC 3.3 and newer cannot copy with the global operator==, due to + // problems with instantiation of function return types before it + // has been verified that the argument types match up. + template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator==(Functor g) const + { + if (const Functor* fp = target()) + return function_equal(*fp, g); + else return false; + } + + template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator!=(Functor g) const + { + if (const Functor* fp = target()) + return !function_equal(*fp, g); + else return true; + } +#endif + +public: // should be protected, but GCC 2.95.3 will fail to allow access + detail::function::vtable_base* get_vtable() const { + return reinterpret_cast( + reinterpret_cast(vtable) & ~static_cast(0x01)); + } + + bool has_trivial_copy_and_destroy() const { + return reinterpret_cast(vtable) & 0x01; + } + + detail::function::vtable_base* vtable; + mutable detail::function::function_buffer functor; +}; + +#if defined(BOOST_CLANG) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +#endif +/** + * The bad_function_call exception class is thrown when a boost::function + * object is invoked + */ +class bad_function_call : public std::runtime_error +{ +public: + bad_function_call() : std::runtime_error("call to empty boost::function") {} +}; +#if defined(BOOST_CLANG) +# pragma clang diagnostic pop +#endif + +#ifndef BOOST_NO_SFINAE +inline bool operator==(const function_base& f, + detail::function::useless_clear_type*) +{ + return f.empty(); +} + +inline bool operator!=(const function_base& f, + detail::function::useless_clear_type*) +{ + return !f.empty(); +} + +inline bool operator==(detail::function::useless_clear_type*, + const function_base& f) +{ + return f.empty(); +} + +inline bool operator!=(detail::function::useless_clear_type*, + const function_base& f) +{ + return !f.empty(); +} +#endif + +#ifdef BOOST_NO_SFINAE +// Comparisons between boost::function objects and arbitrary function objects +template + inline bool operator==(const function_base& f, Functor g) + { + typedef mpl::bool_<(is_integral::value)> integral; + return detail::function::compare_equal(f, g, 0, integral()); + } + +template + inline bool operator==(Functor g, const function_base& f) + { + typedef mpl::bool_<(is_integral::value)> integral; + return detail::function::compare_equal(f, g, 0, integral()); + } + +template + inline bool operator!=(const function_base& f, Functor g) + { + typedef mpl::bool_<(is_integral::value)> integral; + return detail::function::compare_not_equal(f, g, 0, integral()); + } + +template + inline bool operator!=(Functor g, const function_base& f) + { + typedef mpl::bool_<(is_integral::value)> integral; + return detail::function::compare_not_equal(f, g, 0, integral()); + } +#else + +# if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) +// Comparisons between boost::function objects and arbitrary function +// objects. GCC 3.3 and before has an obnoxious bug that prevents this +// from working. +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator==(const function_base& f, Functor g) + { + if (const Functor* fp = f.template target()) + return function_equal(*fp, g); + else return false; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator==(Functor g, const function_base& f) + { + if (const Functor* fp = f.template target()) + return function_equal(g, *fp); + else return false; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator!=(const function_base& f, Functor g) + { + if (const Functor* fp = f.template target()) + return !function_equal(*fp, g); + else return true; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator!=(Functor g, const function_base& f) + { + if (const Functor* fp = f.template target()) + return !function_equal(g, *fp); + else return true; + } +# endif + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator==(const function_base& f, reference_wrapper g) + { + if (const Functor* fp = f.template target()) + return fp == g.get_pointer(); + else return false; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator==(reference_wrapper g, const function_base& f) + { + if (const Functor* fp = f.template target()) + return g.get_pointer() == fp; + else return false; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator!=(const function_base& f, reference_wrapper g) + { + if (const Functor* fp = f.template target()) + return fp != g.get_pointer(); + else return true; + } + +template + BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) + operator!=(reference_wrapper g, const function_base& f) + { + if (const Functor* fp = f.template target()) + return g.get_pointer() != fp; + else return true; + } + +#endif // Compiler supporting SFINAE + +namespace detail { + namespace function { + inline bool has_empty_target(const function_base* f) + { + return f->empty(); + } + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) + inline bool has_empty_target(const void*) + { + return false; + } +#else + inline bool has_empty_target(...) + { + return false; + } +#endif + } // end namespace function +} // end namespace detail +} // end namespace boost + +#undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL + +#if defined(BOOST_MSVC) +# pragma warning( pop ) +#endif + +#endif // BOOST_FUNCTION_BASE_HEADER diff --git a/libraries/boost/include/boost/function/function_fwd.hpp b/libraries/boost/include/boost/function/function_fwd.hpp new file mode 100644 index 0000000000..e79b504899 --- /dev/null +++ b/libraries/boost/include/boost/function/function_fwd.hpp @@ -0,0 +1,69 @@ +// Boost.Function library +// Copyright (C) Douglas Gregor 2008 +// +// Use, modification and distribution is subject to the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org +#ifndef BOOST_FUNCTION_FWD_HPP +#define BOOST_FUNCTION_FWD_HPP +#include + +#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG) +// Work around a compiler bug. +// boost::python::objects::function has to be seen by the compiler before the +// boost::function class template. +namespace boost { namespace python { namespace objects { + class function; +}}} +#endif + +#if defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ + || !(defined(BOOST_STRICT_CONFIG) || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) +# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX +#endif + +namespace boost { + class bad_function_call; + +#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) + // Preferred syntax + template class function; + + template + inline void swap(function& f1, function& f2) + { + f1.swap(f2); + } +#endif // have partial specialization + + // Portable syntax + template class function0; + template class function1; + template class function2; + template class function3; + template + class function4; + template + class function5; + template + class function6; + template + class function7; + template + class function8; + template + class function9; + template + class function10; +} + +#endif diff --git a/libraries/boost/include/boost/function/function_template.hpp b/libraries/boost/include/boost/function/function_template.hpp new file mode 100644 index 0000000000..0b05940b22 --- /dev/null +++ b/libraries/boost/include/boost/function/function_template.hpp @@ -0,0 +1,1187 @@ +// Boost.Function library + +// Copyright Douglas Gregor 2001-2006 +// Copyright Emil Dotchevski 2007 +// Use, modification and distribution is subject to the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org + +// Note: this header is a header template and must NOT have multiple-inclusion +// protection. +#include +#include + +#if defined(BOOST_MSVC) +# pragma warning( push ) +# pragma warning( disable : 4127 ) // "conditional expression is constant" +#endif + +#define BOOST_FUNCTION_TEMPLATE_PARMS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, typename T) + +#define BOOST_FUNCTION_TEMPLATE_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, T) + +#define BOOST_FUNCTION_PARM(J,I,D) BOOST_PP_CAT(T,I) BOOST_PP_CAT(a,I) + +#define BOOST_FUNCTION_PARMS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_PARM,BOOST_PP_EMPTY) + +#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a) +#else +# include +# define BOOST_FUNCTION_ARG(J,I,D) ::boost::forward< BOOST_PP_CAT(T,I) >(BOOST_PP_CAT(a,I)) +# define BOOST_FUNCTION_ARGS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG,BOOST_PP_EMPTY) +#endif + +#define BOOST_FUNCTION_ARG_TYPE(J,I,D) \ + typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(I)),_type); + +#define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,BOOST_PP_EMPTY) + +// Comma if nonzero number of arguments +#if BOOST_FUNCTION_NUM_ARGS == 0 +# define BOOST_FUNCTION_COMMA +#else +# define BOOST_FUNCTION_COMMA , +#endif // BOOST_FUNCTION_NUM_ARGS > 0 + +// Class names used in this version of the code +#define BOOST_FUNCTION_FUNCTION BOOST_JOIN(function,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_FUNCTION_INVOKER \ + BOOST_JOIN(function_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VOID_FUNCTION_INVOKER \ + BOOST_JOIN(void_function_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_FUNCTION_OBJ_INVOKER \ + BOOST_JOIN(function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER \ + BOOST_JOIN(void_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_FUNCTION_REF_INVOKER \ + BOOST_JOIN(function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER \ + BOOST_JOIN(void_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_MEMBER_INVOKER \ + BOOST_JOIN(function_mem_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VOID_MEMBER_INVOKER \ + BOOST_JOIN(function_void_mem_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_GET_FUNCTION_INVOKER \ + BOOST_JOIN(get_function_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER \ + BOOST_JOIN(get_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER \ + BOOST_JOIN(get_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_GET_MEMBER_INVOKER \ + BOOST_JOIN(get_member_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_GET_INVOKER \ + BOOST_JOIN(get_invoker,BOOST_FUNCTION_NUM_ARGS) +#define BOOST_FUNCTION_VTABLE BOOST_JOIN(basic_vtable,BOOST_FUNCTION_NUM_ARGS) + +#ifndef BOOST_NO_VOID_RETURNS +# define BOOST_FUNCTION_VOID_RETURN_TYPE void +# define BOOST_FUNCTION_RETURN(X) X +#else +# define BOOST_FUNCTION_VOID_RETURN_TYPE boost::detail::function::unusable +# define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE () +#endif + +namespace boost { + namespace detail { + namespace function { + template< + typename FunctionPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_FUNCTION_INVOKER + { + static R invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + { + FunctionPtr f = reinterpret_cast(function_ptr.members.func_ptr); + return f(BOOST_FUNCTION_ARGS); + } + }; + + template< + typename FunctionPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER + { + static BOOST_FUNCTION_VOID_RETURN_TYPE + invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + FunctionPtr f = reinterpret_cast(function_ptr.members.func_ptr); + BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS)); + } + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_FUNCTION_OBJ_INVOKER + { + static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + FunctionObj* f; + if (function_allows_small_object_optimization::value) + f = reinterpret_cast(function_obj_ptr.data); + else + f = reinterpret_cast(function_obj_ptr.members.obj_ptr); + return (*f)(BOOST_FUNCTION_ARGS); + } + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER + { + static BOOST_FUNCTION_VOID_RETURN_TYPE + invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + FunctionObj* f; + if (function_allows_small_object_optimization::value) + f = reinterpret_cast(function_obj_ptr.data); + else + f = reinterpret_cast(function_obj_ptr.members.obj_ptr); + BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); + } + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_FUNCTION_REF_INVOKER + { + static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + FunctionObj* f = + reinterpret_cast(function_obj_ptr.members.obj_ptr); + return (*f)(BOOST_FUNCTION_ARGS); + } + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER + { + static BOOST_FUNCTION_VOID_RETURN_TYPE + invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + FunctionObj* f = + reinterpret_cast(function_obj_ptr.members.obj_ptr); + BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); + } + }; + +#if BOOST_FUNCTION_NUM_ARGS > 0 + /* Handle invocation of member pointers. */ + template< + typename MemberPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_MEMBER_INVOKER + { + static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + MemberPtr* f = + reinterpret_cast(function_obj_ptr.data); + return boost::mem_fn(*f)(BOOST_FUNCTION_ARGS); + } + }; + + template< + typename MemberPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_VOID_MEMBER_INVOKER + { + static BOOST_FUNCTION_VOID_RETURN_TYPE + invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA + BOOST_FUNCTION_PARMS) + + { + MemberPtr* f = + reinterpret_cast(function_obj_ptr.data); + BOOST_FUNCTION_RETURN(boost::mem_fn(*f)(BOOST_FUNCTION_ARGS)); + } + }; +#endif + + template< + typename FunctionPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_GET_FUNCTION_INVOKER + { + typedef typename mpl::if_c<(is_void::value), + BOOST_FUNCTION_VOID_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >, + BOOST_FUNCTION_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + > + >::type type; + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER + { + typedef typename mpl::if_c<(is_void::value), + BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >, + BOOST_FUNCTION_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + > + >::type type; + }; + + template< + typename FunctionObj, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER + { + typedef typename mpl::if_c<(is_void::value), + BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >, + BOOST_FUNCTION_FUNCTION_REF_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + > + >::type type; + }; + +#if BOOST_FUNCTION_NUM_ARGS > 0 + /* Retrieve the appropriate invoker for a member pointer. */ + template< + typename MemberPtr, + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + struct BOOST_FUNCTION_GET_MEMBER_INVOKER + { + typedef typename mpl::if_c<(is_void::value), + BOOST_FUNCTION_VOID_MEMBER_INVOKER< + MemberPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >, + BOOST_FUNCTION_MEMBER_INVOKER< + MemberPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + > + >::type type; + }; +#endif + + /* Given the tag returned by get_function_tag, retrieve the + actual invoker that will be used for the given function + object. + + Each specialization contains an "apply" nested class template + that accepts the function object, return type, function + argument types, and allocator. The resulting "apply" class + contains two typedefs, "invoker_type" and "manager_type", + which correspond to the invoker and manager types. */ + template + struct BOOST_FUNCTION_GET_INVOKER { }; + + /* Retrieve the invoker for a function pointer. */ + template<> + struct BOOST_FUNCTION_GET_INVOKER + { + template + struct apply + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager manager_type; + }; + + template + struct apply_a + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER< + FunctionPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager manager_type; + }; + }; + +#if BOOST_FUNCTION_NUM_ARGS > 0 + /* Retrieve the invoker for a member pointer. */ + template<> + struct BOOST_FUNCTION_GET_INVOKER + { + template + struct apply + { + typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER< + MemberPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager manager_type; + }; + + template + struct apply_a + { + typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER< + MemberPtr, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager manager_type; + }; + }; +#endif + + /* Retrieve the invoker for a function object. */ + template<> + struct BOOST_FUNCTION_GET_INVOKER + { + template + struct apply + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager manager_type; + }; + + template + struct apply_a + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< + FunctionObj, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef functor_manager_a manager_type; + }; + }; + + /* Retrieve the invoker for a reference to a function object. */ + template<> + struct BOOST_FUNCTION_GET_INVOKER + { + template + struct apply + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER< + typename RefWrapper::type, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef reference_manager manager_type; + }; + + template + struct apply_a + { + typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER< + typename RefWrapper::type, + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >::type + invoker_type; + + typedef reference_manager manager_type; + }; + }; + + + /** + * vtable for a specific boost::function instance. This + * structure must be an aggregate so that we can use static + * initialization in boost::function's assign_to and assign_to_a + * members. It therefore cannot have any constructors, + * destructors, base classes, etc. + */ + template + struct BOOST_FUNCTION_VTABLE + { +#ifndef BOOST_NO_VOID_RETURNS + typedef R result_type; +#else + typedef typename function_return_type::type result_type; +#endif // BOOST_NO_VOID_RETURNS + + typedef result_type (*invoker_type)(function_buffer& + BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS); + + template + bool assign_to(F f, function_buffer& functor) const + { + typedef typename get_function_tag::type tag; + return assign_to(f, functor, tag()); + } + template + bool assign_to_a(F f, function_buffer& functor, Allocator a) const + { + typedef typename get_function_tag::type tag; + return assign_to_a(f, functor, a, tag()); + } + + void clear(function_buffer& functor) const + { + if (base.manager) + base.manager(functor, functor, destroy_functor_tag); + } + + private: + // Function pointers + template + bool + assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag) const + { + this->clear(functor); + if (f) { + // should be a reinterpret cast, but some compilers insist + // on giving cv-qualifiers to free functions + functor.members.func_ptr = reinterpret_cast(f); + return true; + } else { + return false; + } + } + template + bool + assign_to_a(FunctionPtr f, function_buffer& functor, Allocator, function_ptr_tag) const + { + return assign_to(f,functor,function_ptr_tag()); + } + + // Member pointers +#if BOOST_FUNCTION_NUM_ARGS > 0 + template + bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) const + { + // DPG TBD: Add explicit support for member function + // objects, so we invoke through mem_fn() but we retain the + // right target_type() values. + if (f) { + this->assign_to(boost::mem_fn(f), functor); + return true; + } else { + return false; + } + } + template + bool assign_to_a(MemberPtr f, function_buffer& functor, Allocator a, member_ptr_tag) const + { + // DPG TBD: Add explicit support for member function + // objects, so we invoke through mem_fn() but we retain the + // right target_type() values. + if (f) { + this->assign_to_a(boost::mem_fn(f), functor, a); + return true; + } else { + return false; + } + } +#endif // BOOST_FUNCTION_NUM_ARGS > 0 + + // Function objects + // Assign to a function object using the small object optimization + template + void + assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) const + { + new (reinterpret_cast(functor.data)) FunctionObj(f); + } + template + void + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, mpl::true_) const + { + assign_functor(f,functor,mpl::true_()); + } + + // Assign to a function object allocated on the heap. + template + void + assign_functor(FunctionObj f, function_buffer& functor, mpl::false_) const + { + functor.members.obj_ptr = new FunctionObj(f); + } + template + void + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, mpl::false_) const + { + typedef functor_wrapper functor_wrapper_type; +#if defined(BOOST_NO_CXX11_ALLOCATOR) + typedef typename Allocator::template rebind::other + wrapper_allocator_type; + typedef typename wrapper_allocator_type::pointer wrapper_allocator_pointer_type; +#else + using wrapper_allocator_type = typename std::allocator_traits::template rebind_alloc; + using wrapper_allocator_pointer_type = typename std::allocator_traits::pointer; +#endif + wrapper_allocator_type wrapper_allocator(a); + wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); +#if defined(BOOST_NO_CXX11_ALLOCATOR) + wrapper_allocator.construct(copy, functor_wrapper_type(f,a)); +#else + std::allocator_traits::construct(wrapper_allocator, copy, functor_wrapper_type(f,a)); +#endif + functor_wrapper_type* new_f = static_cast(copy); + functor.members.obj_ptr = new_f; + } + + template + bool + assign_to(FunctionObj f, function_buffer& functor, function_obj_tag) const + { + if (!boost::detail::function::has_empty_target(boost::addressof(f))) { + assign_functor(f, functor, + mpl::bool_<(function_allows_small_object_optimization::value)>()); + return true; + } else { + return false; + } + } + template + bool + assign_to_a(FunctionObj f, function_buffer& functor, Allocator a, function_obj_tag) const + { + if (!boost::detail::function::has_empty_target(boost::addressof(f))) { + assign_functor_a(f, functor, a, + mpl::bool_<(function_allows_small_object_optimization::value)>()); + return true; + } else { + return false; + } + } + + // Reference to a function object + template + bool + assign_to(const reference_wrapper& f, + function_buffer& functor, function_obj_ref_tag) const + { + functor.members.obj_ref.obj_ptr = (void *)(f.get_pointer()); + functor.members.obj_ref.is_const_qualified = is_const::value; + functor.members.obj_ref.is_volatile_qualified = is_volatile::value; + return true; + } + template + bool + assign_to_a(const reference_wrapper& f, + function_buffer& functor, Allocator, function_obj_ref_tag) const + { + return assign_to(f,functor,function_obj_ref_tag()); + } + + public: + vtable_base base; + invoker_type invoker; + }; + } // end namespace function + } // end namespace detail + + template< + typename R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_PARMS + > + class BOOST_FUNCTION_FUNCTION : public function_base + { + public: +#ifndef BOOST_NO_VOID_RETURNS + typedef R result_type; +#else + typedef typename boost::detail::function::function_return_type::type + result_type; +#endif // BOOST_NO_VOID_RETURNS + + private: + typedef boost::detail::function::BOOST_FUNCTION_VTABLE< + R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS> + vtable_type; + + vtable_type* get_vtable() const { + return reinterpret_cast( + reinterpret_cast(vtable) & ~static_cast(0x01)); + } + + struct clear_type {}; + + public: + BOOST_STATIC_CONSTANT(int, args = BOOST_FUNCTION_NUM_ARGS); + + // add signature for boost::lambda + template + struct sig + { + typedef result_type type; + }; + +#if BOOST_FUNCTION_NUM_ARGS == 1 + typedef T0 argument_type; +#elif BOOST_FUNCTION_NUM_ARGS == 2 + typedef T0 first_argument_type; + typedef T1 second_argument_type; +#endif + + BOOST_STATIC_CONSTANT(int, arity = BOOST_FUNCTION_NUM_ARGS); + BOOST_FUNCTION_ARG_TYPES + + typedef BOOST_FUNCTION_FUNCTION self_type; + + BOOST_FUNCTION_FUNCTION() : function_base() { } + + // MSVC chokes if the following two constructors are collapsed into + // one with a default parameter. + template + BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f +#ifndef BOOST_NO_SFINAE + ,typename boost::enable_if_c< + !(is_integral::value), + int>::type = 0 +#endif // BOOST_NO_SFINAE + ) : + function_base() + { + this->assign_to(f); + } + template + BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a +#ifndef BOOST_NO_SFINAE + ,typename boost::enable_if_c< + !(is_integral::value), + int>::type = 0 +#endif // BOOST_NO_SFINAE + ) : + function_base() + { + this->assign_to_a(f,a); + } + +#ifndef BOOST_NO_SFINAE + BOOST_FUNCTION_FUNCTION(clear_type*) : function_base() { } +#else + BOOST_FUNCTION_FUNCTION(int zero) : function_base() + { + BOOST_ASSERT(zero == 0); + } +#endif + + BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : function_base() + { + this->assign_to_own(f); + } + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base() + { + this->move_assign(f); + } +#endif + + ~BOOST_FUNCTION_FUNCTION() { clear(); } + + result_type operator()(BOOST_FUNCTION_PARMS) const + { + if (this->empty()) + boost::throw_exception(bad_function_call()); + + return get_vtable()->invoker + (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); + } + + // The distinction between when to use BOOST_FUNCTION_FUNCTION and + // when to use self_type is obnoxious. MSVC cannot handle self_type as + // the return type of these assignment operators, but Borland C++ cannot + // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to + // construct. + template +#ifndef BOOST_NO_SFINAE + typename boost::enable_if_c< + !(is_integral::value), + BOOST_FUNCTION_FUNCTION&>::type +#else + BOOST_FUNCTION_FUNCTION& +#endif + operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) + { + this->clear(); + BOOST_TRY { + this->assign_to(f); + } BOOST_CATCH (...) { + vtable = 0; + BOOST_RETHROW; + } + BOOST_CATCH_END + return *this; + } + template + void assign(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a) + { + this->clear(); + BOOST_TRY{ + this->assign_to_a(f,a); + } BOOST_CATCH (...) { + vtable = 0; + BOOST_RETHROW; + } + BOOST_CATCH_END + } + +#ifndef BOOST_NO_SFINAE + BOOST_FUNCTION_FUNCTION& operator=(clear_type*) + { + this->clear(); + return *this; + } +#else + BOOST_FUNCTION_FUNCTION& operator=(int zero) + { + BOOST_ASSERT(zero == 0); + this->clear(); + return *this; + } +#endif + + // Assignment from another BOOST_FUNCTION_FUNCTION + BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f) + { + if (&f == this) + return *this; + + this->clear(); + BOOST_TRY { + this->assign_to_own(f); + } BOOST_CATCH (...) { + vtable = 0; + BOOST_RETHROW; + } + BOOST_CATCH_END + return *this; + } + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + // Move assignment from another BOOST_FUNCTION_FUNCTION + BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f) + { + if (&f == this) + return *this; + + this->clear(); + BOOST_TRY { + this->move_assign(f); + } BOOST_CATCH (...) { + vtable = 0; + BOOST_RETHROW; + } + BOOST_CATCH_END + return *this; + } +#endif + + void swap(BOOST_FUNCTION_FUNCTION& other) + { + if (&other == this) + return; + + BOOST_FUNCTION_FUNCTION tmp; + tmp.move_assign(*this); + this->move_assign(other); + other.move_assign(tmp); + } + + // Clear out a target, if there is one + void clear() + { + if (vtable) { + if (!this->has_trivial_copy_and_destroy()) + get_vtable()->clear(this->functor); + vtable = 0; + } + } + +#if (defined __SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && !(defined BOOST_NO_COMPILER_CONFIG) + // Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it + operator bool () const { return !this->empty(); } +#else + private: + struct dummy { + void nonnull() {} + }; + + typedef void (dummy::*safe_bool)(); + + public: + operator safe_bool () const + { return (this->empty())? 0 : &dummy::nonnull; } + + bool operator!() const + { return this->empty(); } +#endif + + private: + void assign_to_own(const BOOST_FUNCTION_FUNCTION& f) + { + if (!f.empty()) { + this->vtable = f.vtable; + if (this->has_trivial_copy_and_destroy()) + this->functor = f.functor; + else + get_vtable()->base.manager(f.functor, this->functor, + boost::detail::function::clone_functor_tag); + } + } + + template + void assign_to(Functor f) + { + using boost::detail::function::vtable_base; + + typedef typename boost::detail::function::get_function_tag::type tag; + typedef boost::detail::function::BOOST_FUNCTION_GET_INVOKER get_invoker; + typedef typename get_invoker:: + template apply + handler_type; + + typedef typename handler_type::invoker_type invoker_type; + typedef typename handler_type::manager_type manager_type; + + // Note: it is extremely important that this initialization use + // static initialization. Otherwise, we will have a race + // condition here in multi-threaded code. See + // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. + static const vtable_type stored_vtable = + { { &manager_type::manage }, &invoker_type::invoke }; + + if (stored_vtable.assign_to(f, functor)) { + std::size_t value = reinterpret_cast(&stored_vtable.base); + // coverity[pointless_expression]: suppress coverity warnings on apparant if(const). + if (boost::has_trivial_copy_constructor::value && + boost::has_trivial_destructor::value && + boost::detail::function::function_allows_small_object_optimization::value) + value |= static_cast(0x01); + vtable = reinterpret_cast(value); + } else + vtable = 0; + } + + template + void assign_to_a(Functor f,Allocator a) + { + using boost::detail::function::vtable_base; + + typedef typename boost::detail::function::get_function_tag::type tag; + typedef boost::detail::function::BOOST_FUNCTION_GET_INVOKER get_invoker; + typedef typename get_invoker:: + template apply_a + handler_type; + + typedef typename handler_type::invoker_type invoker_type; + typedef typename handler_type::manager_type manager_type; + + // Note: it is extremely important that this initialization use + // static initialization. Otherwise, we will have a race + // condition here in multi-threaded code. See + // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. + static const vtable_type stored_vtable = + { { &manager_type::manage }, &invoker_type::invoke }; + + if (stored_vtable.assign_to_a(f, functor, a)) { + std::size_t value = reinterpret_cast(&stored_vtable.base); + // coverity[pointless_expression]: suppress coverity warnings on apparant if(const). + if (boost::has_trivial_copy_constructor::value && + boost::has_trivial_destructor::value && + boost::detail::function::function_allows_small_object_optimization::value) + value |= static_cast(0x01); + vtable = reinterpret_cast(value); + } else + vtable = 0; + } + + // Moves the value from the specified argument to *this. If the argument + // has its function object allocated on the heap, move_assign will pass + // its buffer to *this, and set the argument's buffer pointer to NULL. + void move_assign(BOOST_FUNCTION_FUNCTION& f) + { + if (&f == this) + return; + + BOOST_TRY { + if (!f.empty()) { + this->vtable = f.vtable; + if (this->has_trivial_copy_and_destroy()) + this->functor = f.functor; + else + get_vtable()->base.manager(f.functor, this->functor, + boost::detail::function::move_functor_tag); + f.vtable = 0; + } else { + clear(); + } + } BOOST_CATCH (...) { + vtable = 0; + BOOST_RETHROW; + } + BOOST_CATCH_END + } + }; + + template + inline void swap(BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >& f1, + BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS + >& f2) + { + f1.swap(f2); + } + +// Poison comparisons between boost::function objects of the same type. +template + void operator==(const BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS>&, + const BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS>&); +template + void operator!=(const BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS>&, + const BOOST_FUNCTION_FUNCTION< + R BOOST_FUNCTION_COMMA + BOOST_FUNCTION_TEMPLATE_ARGS>& ); + +#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) + +#if BOOST_FUNCTION_NUM_ARGS == 0 +#define BOOST_FUNCTION_PARTIAL_SPEC R (void) +#else +#define BOOST_FUNCTION_PARTIAL_SPEC R (BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS,T)) +#endif + +template +class function + : public BOOST_FUNCTION_FUNCTION +{ + typedef BOOST_FUNCTION_FUNCTION base_type; + typedef function self_type; + + struct clear_type {}; + +public: + + function() : base_type() {} + + template + function(Functor f +#ifndef BOOST_NO_SFINAE + ,typename boost::enable_if_c< + !(is_integral::value), + int>::type = 0 +#endif + ) : + base_type(f) + { + } + template + function(Functor f, Allocator a +#ifndef BOOST_NO_SFINAE + ,typename boost::enable_if_c< + !(is_integral::value), + int>::type = 0 +#endif + ) : + base_type(f,a) + { + } + +#ifndef BOOST_NO_SFINAE + function(clear_type*) : base_type() {} +#endif + + function(const self_type& f) : base_type(static_cast(f)){} + + function(const base_type& f) : base_type(static_cast(f)){} + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + // Move constructors + function(self_type&& f): base_type(static_cast(f)){} + function(base_type&& f): base_type(static_cast(f)){} +#endif + + self_type& operator=(const self_type& f) + { + self_type(f).swap(*this); + return *this; + } + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + self_type& operator=(self_type&& f) + { + self_type(static_cast(f)).swap(*this); + return *this; + } +#endif + + template +#ifndef BOOST_NO_SFINAE + typename boost::enable_if_c< + !(is_integral::value), + self_type&>::type +#else + self_type& +#endif + operator=(Functor f) + { + self_type(f).swap(*this); + return *this; + } + +#ifndef BOOST_NO_SFINAE + self_type& operator=(clear_type*) + { + this->clear(); + return *this; + } +#endif + + self_type& operator=(const base_type& f) + { + self_type(f).swap(*this); + return *this; + } + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + self_type& operator=(base_type&& f) + { + self_type(static_cast(f)).swap(*this); + return *this; + } +#endif +}; + +#undef BOOST_FUNCTION_PARTIAL_SPEC +#endif // have partial specialization + +} // end namespace boost + +// Cleanup after ourselves... +#undef BOOST_FUNCTION_VTABLE +#undef BOOST_FUNCTION_COMMA +#undef BOOST_FUNCTION_FUNCTION +#undef BOOST_FUNCTION_FUNCTION_INVOKER +#undef BOOST_FUNCTION_VOID_FUNCTION_INVOKER +#undef BOOST_FUNCTION_FUNCTION_OBJ_INVOKER +#undef BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER +#undef BOOST_FUNCTION_FUNCTION_REF_INVOKER +#undef BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER +#undef BOOST_FUNCTION_MEMBER_INVOKER +#undef BOOST_FUNCTION_VOID_MEMBER_INVOKER +#undef BOOST_FUNCTION_GET_FUNCTION_INVOKER +#undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER +#undef BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER +#undef BOOST_FUNCTION_GET_MEM_FUNCTION_INVOKER +#undef BOOST_FUNCTION_GET_INVOKER +#undef BOOST_FUNCTION_TEMPLATE_PARMS +#undef BOOST_FUNCTION_TEMPLATE_ARGS +#undef BOOST_FUNCTION_PARMS +#undef BOOST_FUNCTION_PARM +#ifdef BOOST_FUNCTION_ARG +# undef BOOST_FUNCTION_ARG +#endif +#undef BOOST_FUNCTION_ARGS +#undef BOOST_FUNCTION_ARG_TYPE +#undef BOOST_FUNCTION_ARG_TYPES +#undef BOOST_FUNCTION_VOID_RETURN_TYPE +#undef BOOST_FUNCTION_RETURN + +#if defined(BOOST_MSVC) +# pragma warning( pop ) +#endif diff --git a/libraries/boost/include/boost/function_equal.hpp b/libraries/boost/include/boost/function_equal.hpp new file mode 100644 index 0000000000..2d76c75bc9 --- /dev/null +++ b/libraries/boost/include/boost/function_equal.hpp @@ -0,0 +1,28 @@ +// Copyright Douglas Gregor 2004. +// Copyright 2005 Peter Dimov + +// Use, modification and distribution is subject to +// the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org +#ifndef BOOST_FUNCTION_EQUAL_HPP +#define BOOST_FUNCTION_EQUAL_HPP + +namespace boost { + +template + bool function_equal_impl(const F& f, const G& g, long) + { return f == g; } + +// function_equal_impl needs to be unqualified to pick +// user overloads on two-phase compilers + +template + bool function_equal(const F& f, const G& g) + { return function_equal_impl(f, g, 0); } + +} // end namespace boost + +#endif // BOOST_FUNCTION_EQUAL_HPP diff --git a/libraries/boost/include/boost/get_pointer.hpp b/libraries/boost/include/boost/get_pointer.hpp new file mode 100644 index 0000000000..36e2cd7d0f --- /dev/null +++ b/libraries/boost/include/boost/get_pointer.hpp @@ -0,0 +1,76 @@ +// Copyright Peter Dimov and David Abrahams 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef GET_POINTER_DWA20021219_HPP +#define GET_POINTER_DWA20021219_HPP + +#include + +// In order to avoid circular dependencies with Boost.TR1 +// we make sure that our include of doesn't try to +// pull in the TR1 headers: that's why we use this header +// rather than including directly: +#include // std::auto_ptr + +namespace boost { + +// get_pointer(p) extracts a ->* capable pointer from p + +template T * get_pointer(T * p) +{ + return p; +} + +// get_pointer(shared_ptr const & p) has been moved to shared_ptr.hpp + +#if !defined( BOOST_NO_AUTO_PTR ) + +#if defined( __GNUC__ ) && (defined( __GXX_EXPERIMENTAL_CXX0X__ ) || (__cplusplus >= 201103L)) +#if defined( BOOST_GCC ) +#if BOOST_GCC >= 40600 +#define BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS +#endif // BOOST_GCC >= 40600 +#elif defined( __clang__ ) && defined( __has_warning ) +#if __has_warning("-Wdeprecated-declarations") +#define BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS +#endif // __has_warning("-Wdeprecated-declarations") +#endif +#endif // defined( __GNUC__ ) && (defined( __GXX_EXPERIMENTAL_CXX0X__ ) || (__cplusplus >= 201103L)) + +#if defined( BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS ) +// Disable libstdc++ warnings about std::auto_ptr being deprecated in C++11 mode +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#define BOOST_CORE_DETAIL_DISABLED_DEPRECATED_WARNINGS +#endif + +template T * get_pointer(std::auto_ptr const& p) +{ + return p.get(); +} + +#if defined( BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS ) +#pragma GCC diagnostic pop +#undef BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS +#endif + +#endif // !defined( BOOST_NO_AUTO_PTR ) + +#if !defined( BOOST_NO_CXX11_SMART_PTR ) + +template T * get_pointer( std::unique_ptr const& p ) +{ + return p.get(); +} + +template T * get_pointer( std::shared_ptr const& p ) +{ + return p.get(); +} + +#endif + +} // namespace boost + +#endif // GET_POINTER_DWA20021219_HPP diff --git a/libraries/boost/include/boost/integer.hpp b/libraries/boost/include/boost/integer.hpp new file mode 100644 index 0000000000..9fa0019484 --- /dev/null +++ b/libraries/boost/include/boost/integer.hpp @@ -0,0 +1,262 @@ +// boost integer.hpp header file -------------------------------------------// + +// Copyright Beman Dawes and Daryle Walker 1999. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/integer for documentation. + +// Revision History +// 22 Sep 01 Added value-based integer templates. (Daryle Walker) +// 01 Apr 01 Modified to use new header. (John Maddock) +// 30 Jul 00 Add typename syntax fix (Jens Maurer) +// 28 Aug 99 Initial version + +#ifndef BOOST_INTEGER_HPP +#define BOOST_INTEGER_HPP + +#include // self include + +#include // for boost::::boost::integer_traits +#include // for ::std::numeric_limits +#include // for boost::int64_t and BOOST_NO_INTEGRAL_INT64_T +#include + +// +// We simply cannot include this header on gcc without getting copious warnings of the kind: +// +// boost/integer.hpp:77:30: warning: use of C99 long long integer constant +// +// And yet there is no other reasonable implementation, so we declare this a system header +// to suppress these warnings. +// +#if defined(__GNUC__) && (__GNUC__ >= 4) +#pragma GCC system_header +#endif + +namespace boost +{ + + // Helper templates ------------------------------------------------------// + + // fast integers from least integers + // int_fast_t<> works correctly for unsigned too, in spite of the name. + template< typename LeastInt > + struct int_fast_t + { + typedef LeastInt fast; + typedef fast type; + }; // imps may specialize + + namespace detail{ + + // convert category to type + template< int Category > struct int_least_helper {}; // default is empty + template< int Category > struct uint_least_helper {}; // default is empty + + // specializatons: 1=long, 2=int, 3=short, 4=signed char, + // 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char + // no specializations for 0 and 5: requests for a type > long are in error +#ifdef BOOST_HAS_LONG_LONG + template<> struct int_least_helper<1> { typedef boost::long_long_type least; }; +#elif defined(BOOST_HAS_MS_INT64) + template<> struct int_least_helper<1> { typedef __int64 least; }; +#endif + template<> struct int_least_helper<2> { typedef long least; }; + template<> struct int_least_helper<3> { typedef int least; }; + template<> struct int_least_helper<4> { typedef short least; }; + template<> struct int_least_helper<5> { typedef signed char least; }; +#ifdef BOOST_HAS_LONG_LONG + template<> struct uint_least_helper<1> { typedef boost::ulong_long_type least; }; +#elif defined(BOOST_HAS_MS_INT64) + template<> struct uint_least_helper<1> { typedef unsigned __int64 least; }; +#endif + template<> struct uint_least_helper<2> { typedef unsigned long least; }; + template<> struct uint_least_helper<3> { typedef unsigned int least; }; + template<> struct uint_least_helper<4> { typedef unsigned short least; }; + template<> struct uint_least_helper<5> { typedef unsigned char least; }; + + template + struct exact_signed_base_helper{}; + template + struct exact_unsigned_base_helper{}; + + template <> struct exact_signed_base_helper { typedef signed char exact; }; + template <> struct exact_unsigned_base_helper { typedef unsigned char exact; }; +#if USHRT_MAX != UCHAR_MAX + template <> struct exact_signed_base_helper { typedef short exact; }; + template <> struct exact_unsigned_base_helper { typedef unsigned short exact; }; +#endif +#if UINT_MAX != USHRT_MAX + template <> struct exact_signed_base_helper { typedef int exact; }; + template <> struct exact_unsigned_base_helper { typedef unsigned int exact; }; +#endif +#if ULONG_MAX != UINT_MAX && ( !defined __TI_COMPILER_VERSION__ || \ + ( __TI_COMPILER_VERSION__ >= 7000000 && !defined __TI_40BIT_LONG__ ) ) + template <> struct exact_signed_base_helper { typedef long exact; }; + template <> struct exact_unsigned_base_helper { typedef unsigned long exact; }; +#endif +#if defined(BOOST_HAS_LONG_LONG) &&\ + ((defined(ULLONG_MAX) && (ULLONG_MAX != ULONG_MAX)) ||\ + (defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX != ULONG_MAX)) ||\ + (defined(ULONGLONG_MAX) && (ULONGLONG_MAX != ULONG_MAX)) ||\ + (defined(_ULLONG_MAX) && (_ULLONG_MAX != ULONG_MAX))) + template <> struct exact_signed_base_helper { typedef boost::long_long_type exact; }; + template <> struct exact_unsigned_base_helper { typedef boost::ulong_long_type exact; }; +#endif + + + } // namespace detail + + // integer templates specifying number of bits ---------------------------// + + // signed + template< int Bits > // bits (including sign) required + struct int_t : public boost::detail::exact_signed_base_helper + { + BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::intmax_t) * CHAR_BIT), + "No suitable signed integer type with the requested number of bits is available."); + typedef typename boost::detail::int_least_helper + < +#ifdef BOOST_HAS_LONG_LONG + (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + +#else + 1 + +#endif + (Bits-1 <= ::std::numeric_limits::digits) + + (Bits-1 <= ::std::numeric_limits::digits) + + (Bits-1 <= ::std::numeric_limits::digits) + + (Bits-1 <= ::std::numeric_limits::digits) + >::least least; + typedef typename int_fast_t::type fast; + }; + + // unsigned + template< int Bits > // bits required + struct uint_t : public boost::detail::exact_unsigned_base_helper + { + BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::uintmax_t) * CHAR_BIT), + "No suitable unsigned integer type with the requested number of bits is available."); +#if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T) + // It's really not clear why this workaround should be needed... shrug I guess! JM + BOOST_STATIC_CONSTANT(int, s = + 6 + + (Bits <= ::std::numeric_limits::digits) + + (Bits <= ::std::numeric_limits::digits) + + (Bits <= ::std::numeric_limits::digits) + + (Bits <= ::std::numeric_limits::digits)); + typedef typename detail::int_least_helper< ::boost::uint_t::s>::least least; +#else + typedef typename boost::detail::uint_least_helper + < +#ifdef BOOST_HAS_LONG_LONG + (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + +#else + 1 + +#endif + (Bits <= ::std::numeric_limits::digits) + + (Bits <= ::std::numeric_limits::digits) + + (Bits <= ::std::numeric_limits::digits) + + (Bits <= ::std::numeric_limits::digits) + >::least least; +#endif + typedef typename int_fast_t::type fast; + // int_fast_t<> works correctly for unsigned too, in spite of the name. + }; + + // integer templates specifying extreme value ----------------------------// + + // signed +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) + template< boost::long_long_type MaxValue > // maximum value to require support +#else + template< long MaxValue > // maximum value to require support +#endif + struct int_max_value_t + { + typedef typename boost::detail::int_least_helper + < +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) + (MaxValue <= ::boost::integer_traits::const_max) + +#else + 1 + +#endif + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + >::least least; + typedef typename int_fast_t::type fast; + }; + +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) + template< boost::long_long_type MinValue > // minimum value to require support +#else + template< long MinValue > // minimum value to require support +#endif + struct int_min_value_t + { + typedef typename boost::detail::int_least_helper + < +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) + (MinValue >= ::boost::integer_traits::const_min) + +#else + 1 + +#endif + (MinValue >= ::boost::integer_traits::const_min) + + (MinValue >= ::boost::integer_traits::const_min) + + (MinValue >= ::boost::integer_traits::const_min) + + (MinValue >= ::boost::integer_traits::const_min) + >::least least; + typedef typename int_fast_t::type fast; + }; + + // unsigned +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) + template< boost::ulong_long_type MaxValue > // minimum value to require support +#else + template< unsigned long MaxValue > // minimum value to require support +#endif + struct uint_value_t + { +#if (defined(__BORLANDC__) || defined(__CODEGEAR__)) + // It's really not clear why this workaround should be needed... shrug I guess! JM +#if defined(BOOST_NO_INTEGRAL_INT64_T) + BOOST_STATIC_CONSTANT(unsigned, which = + 1 + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max)); + typedef typename detail::int_least_helper< ::boost::uint_value_t::which>::least least; +#else // BOOST_NO_INTEGRAL_INT64_T + BOOST_STATIC_CONSTANT(unsigned, which = + 1 + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max)); + typedef typename detail::uint_least_helper< ::boost::uint_value_t::which>::least least; +#endif // BOOST_NO_INTEGRAL_INT64_T +#else + typedef typename boost::detail::uint_least_helper + < +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) + (MaxValue <= ::boost::integer_traits::const_max) + +#else + 1 + +#endif + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + + (MaxValue <= ::boost::integer_traits::const_max) + >::least least; +#endif + typedef typename int_fast_t::type fast; + }; + + +} // namespace boost + +#endif // BOOST_INTEGER_HPP diff --git a/libraries/boost/include/boost/integer/static_log2.hpp b/libraries/boost/include/boost/integer/static_log2.hpp new file mode 100644 index 0000000000..56c7a00125 --- /dev/null +++ b/libraries/boost/include/boost/integer/static_log2.hpp @@ -0,0 +1,127 @@ +// -------------- Boost static_log2.hpp header file ----------------------- // +// +// Copyright (C) 2001 Daryle Walker. +// Copyright (C) 2003 Vesa Karvonen. +// Copyright (C) 2003 Gennaro Prota. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// --------------------------------------------------- +// See http://www.boost.org/libs/integer for documentation. +// ------------------------------------------------------------------------- // + + +#ifndef BOOST_INTEGER_STATIC_LOG2_HPP +#define BOOST_INTEGER_STATIC_LOG2_HPP + +#include "boost/integer_fwd.hpp" // for boost::intmax_t + +namespace boost { + + namespace detail { + + namespace static_log2_impl { + + // choose_initial_n<> + // + // Recursively doubles its integer argument, until it + // becomes >= of the "width" (C99, 6.2.6.2p4) of + // static_log2_argument_type. + // + // Used to get the maximum power of two less then the width. + // + // Example: if on your platform argument_type has 48 value + // bits it yields n=32. + // + // It's easy to prove that, starting from such a value + // of n, the core algorithm works correctly for any width + // of static_log2_argument_type and that recursion always + // terminates with x = 1 and n = 0 (see the algorithm's + // invariant). + + typedef boost::static_log2_argument_type argument_type; + typedef boost::static_log2_result_type result_type; + + template + struct choose_initial_n { + + BOOST_STATIC_CONSTANT(bool, c = (argument_type(1) << n << n) != 0); + BOOST_STATIC_CONSTANT( + result_type, + value = !c*n + choose_initial_n<2*c*n>::value + ); + + }; + + template <> + struct choose_initial_n<0> { + BOOST_STATIC_CONSTANT(result_type, value = 0); + }; + + + + // start computing from n_zero - must be a power of two + const result_type n_zero = 16; + const result_type initial_n = choose_initial_n::value; + + // static_log2_impl<> + // + // * Invariant: + // 2n + // 1 <= x && x < 2 at the start of each recursion + // (see also choose_initial_n<>) + // + // * Type requirements: + // + // argument_type maybe any unsigned type with at least n_zero + 1 + // value bits. (Note: If larger types will be standardized -e.g. + // unsigned long long- then the argument_type typedef can be + // changed without affecting the rest of the code.) + // + + template + struct static_log2_impl { + + BOOST_STATIC_CONSTANT(bool, c = (x >> n) > 0); // x >= 2**n ? + BOOST_STATIC_CONSTANT( + result_type, + value = c*n + (static_log2_impl< (x>>c*n), n/2 >::value) + ); + + }; + + template <> + struct static_log2_impl<1, 0> { + BOOST_STATIC_CONSTANT(result_type, value = 0); + }; + + } + } // detail + + + + // -------------------------------------- + // static_log2 + // ---------------------------------------- + + template + struct static_log2 { + + BOOST_STATIC_CONSTANT( + static_log2_result_type, + value = detail::static_log2_impl::static_log2_impl::value + ); + + }; + + + template <> + struct static_log2<0> { }; + +} + + + +#endif // include guard diff --git a/libraries/boost/include/boost/integer_fwd.hpp b/libraries/boost/include/boost/integer_fwd.hpp new file mode 100644 index 0000000000..18519dd696 --- /dev/null +++ b/libraries/boost/include/boost/integer_fwd.hpp @@ -0,0 +1,190 @@ +// Boost integer_fwd.hpp header file ---------------------------------------// + +// (C) Copyright Dave Abrahams and Daryle Walker 2001. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/integer for documentation. + +#ifndef BOOST_INTEGER_FWD_HPP +#define BOOST_INTEGER_FWD_HPP + +#include // for UCHAR_MAX, etc. +#include // for std::size_t + +#include // for BOOST_NO_INTRINSIC_WCHAR_T +#include // for std::numeric_limits +#include // For intmax_t + + +namespace boost +{ + +#ifdef BOOST_NO_INTEGRAL_INT64_T + typedef unsigned long static_log2_argument_type; + typedef int static_log2_result_type; + typedef long static_min_max_signed_type; + typedef unsigned long static_min_max_unsigned_type; +#else + typedef boost::uintmax_t static_min_max_unsigned_type; + typedef boost::intmax_t static_min_max_signed_type; + typedef boost::uintmax_t static_log2_argument_type; + typedef int static_log2_result_type; +#endif + +// From ------------------------------------------------// + +// Only has typedefs or using statements, with #conditionals + + +// From -----------------------------------------// + +template < class T > + class integer_traits; + +template < > + class integer_traits< bool >; + +template < > + class integer_traits< char >; + +template < > + class integer_traits< signed char >; + +template < > + class integer_traits< unsigned char >; + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template < > + class integer_traits< wchar_t >; +#endif + +template < > + class integer_traits< short >; + +template < > + class integer_traits< unsigned short >; + +template < > + class integer_traits< int >; + +template < > + class integer_traits< unsigned int >; + +template < > + class integer_traits< long >; + +template < > + class integer_traits< unsigned long >; + +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) +template < > +class integer_traits< ::boost::long_long_type>; + +template < > +class integer_traits< ::boost::ulong_long_type >; +#elif !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_MS_INT64) +template < > +class integer_traits<__int64>; + +template < > +class integer_traits; +#endif + + +// From ------------------------------------------------// + +template < typename LeastInt > + struct int_fast_t; + +template< int Bits > + struct int_t; + +template< int Bits > + struct uint_t; + +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) + template< boost::long_long_type MaxValue > // maximum value to require support +#else + template< long MaxValue > // maximum value to require support +#endif + struct int_max_value_t; + +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) + template< boost::long_long_type MinValue > // minimum value to require support +#else + template< long MinValue > // minimum value to require support +#endif + struct int_min_value_t; + +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) + template< boost::ulong_long_type MaxValue > // maximum value to require support +#else + template< unsigned long MaxValue > // maximum value to require support +#endif + struct uint_value_t; + + +// From -----------------------------------// + +template < std::size_t Bit > + struct high_bit_mask_t; + +template < std::size_t Bits > + struct low_bits_mask_t; + +template < > + struct low_bits_mask_t< ::std::numeric_limits::digits >; + +// From ------------------------------------// + +template + struct static_log2; + +template <> struct static_log2<0u>; + + +// From ---------------------------------// + +template + struct static_signed_min; + +template + struct static_signed_max; + +template + struct static_unsigned_min; + +template + struct static_unsigned_max; + + +namespace integer +{ +// From + +#ifdef BOOST_NO_INTEGRAL_INT64_T + typedef unsigned long static_gcd_type; +#else + typedef boost::uintmax_t static_gcd_type; +#endif + +template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_gcd; +template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_lcm; + + +// From + +template < typename IntegerType > + class gcd_evaluator; +template < typename IntegerType > + class lcm_evaluator; + +} // namespace integer + +} // namespace boost + + +#endif // BOOST_INTEGER_FWD_HPP diff --git a/libraries/boost/include/boost/integer_traits.hpp b/libraries/boost/include/boost/integer_traits.hpp new file mode 100644 index 0000000000..94eb00d31e --- /dev/null +++ b/libraries/boost/include/boost/integer_traits.hpp @@ -0,0 +1,256 @@ +/* boost integer_traits.hpp header file + * + * Copyright Jens Maurer 2000 + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + * $Id$ + * + * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers + */ + +// See http://www.boost.org/libs/integer for documentation. + + +#ifndef BOOST_INTEGER_TRAITS_HPP +#define BOOST_INTEGER_TRAITS_HPP + +#include +#include + +// These are an implementation detail and not part of the interface +#include +// we need wchar.h for WCHAR_MAX/MIN but not all platforms provide it, +// and some may have but not ... +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun) || defined(__QNX__)) +#include +#endif + +// +// We simply cannot include this header on gcc without getting copious warnings of the kind: +// +// ../../../boost/integer_traits.hpp:164:66: warning: use of C99 long long integer constant +// +// And yet there is no other reasonable implementation, so we declare this a system header +// to suppress these warnings. +// +#if defined(__GNUC__) && (__GNUC__ >= 4) +#pragma GCC system_header +#endif + +namespace boost { +template +class integer_traits : public std::numeric_limits +{ +public: + BOOST_STATIC_CONSTANT(bool, is_integral = false); +}; + +namespace detail { +template +class integer_traits_base +{ +public: + BOOST_STATIC_CONSTANT(bool, is_integral = true); + BOOST_STATIC_CONSTANT(T, const_min = min_val); + BOOST_STATIC_CONSTANT(T, const_max = max_val); +}; + +#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +// A definition is required even for integral static constants +template +const bool integer_traits_base::is_integral; + +template +const T integer_traits_base::const_min; + +template +const T integer_traits_base::const_max; +#endif + +} // namespace detail + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template<> +class integer_traits + : public std::numeric_limits, + // Don't trust WCHAR_MIN and WCHAR_MAX with Mac OS X's native + // library: they are wrong! +#if defined(WCHAR_MIN) && defined(WCHAR_MAX) && !defined(__APPLE__) + public detail::integer_traits_base +#elif defined(__BORLANDC__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__BEOS__) && defined(__GNUC__)) + // No WCHAR_MIN and WCHAR_MAX, whar_t is short and unsigned: + public detail::integer_traits_base +#elif (defined(__sgi) && (!defined(__SGI_STL_PORT) || __SGI_STL_PORT < 0x400))\ + || (defined __APPLE__)\ + || (defined(__OpenBSD__) && defined(__GNUC__))\ + || (defined(__NetBSD__) && defined(__GNUC__))\ + || (defined(__FreeBSD__) && defined(__GNUC__))\ + || (defined(__DragonFly__) && defined(__GNUC__))\ + || (defined(__hpux) && defined(__GNUC__) && (__GNUC__ == 3) && !defined(__SGI_STL_PORT)) + // No WCHAR_MIN and WCHAR_MAX, wchar_t has the same range as int. + // - SGI MIPSpro with native library + // - gcc 3.x on HP-UX + // - Mac OS X with native library + // - gcc on FreeBSD, OpenBSD and NetBSD + public detail::integer_traits_base +#else +#error No WCHAR_MIN and WCHAR_MAX present, please adjust integer_traits<> for your compiler. +#endif +{ }; +#endif // BOOST_NO_INTRINSIC_WCHAR_T + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +template<> +class integer_traits + : public std::numeric_limits, + public detail::integer_traits_base +{ }; + +#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) +#if defined(ULLONG_MAX) && defined(BOOST_HAS_LONG_LONG) + +template<> +class integer_traits< ::boost::long_long_type> + : public std::numeric_limits< ::boost::long_long_type>, + public detail::integer_traits_base< ::boost::long_long_type, LLONG_MIN, LLONG_MAX> +{ }; + +template<> +class integer_traits< ::boost::ulong_long_type> + : public std::numeric_limits< ::boost::ulong_long_type>, + public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULLONG_MAX> +{ }; + +#elif defined(ULONG_LONG_MAX) && defined(BOOST_HAS_LONG_LONG) + +template<> +class integer_traits< ::boost::long_long_type> : public std::numeric_limits< ::boost::long_long_type>, public detail::integer_traits_base< ::boost::long_long_type, LONG_LONG_MIN, LONG_LONG_MAX>{ }; +template<> +class integer_traits< ::boost::ulong_long_type> + : public std::numeric_limits< ::boost::ulong_long_type>, + public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONG_LONG_MAX> +{ }; + +#elif defined(ULONGLONG_MAX) && defined(BOOST_HAS_LONG_LONG) + +template<> +class integer_traits< ::boost::long_long_type> + : public std::numeric_limits< ::boost::long_long_type>, + public detail::integer_traits_base< ::boost::long_long_type, LONGLONG_MIN, LONGLONG_MAX> +{ }; + +template<> +class integer_traits< ::boost::ulong_long_type> + : public std::numeric_limits< ::boost::ulong_long_type>, + public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONGLONG_MAX> +{ }; + +#elif defined(_LLONG_MAX) && defined(_C2) && defined(BOOST_HAS_LONG_LONG) + +template<> +class integer_traits< ::boost::long_long_type> + : public std::numeric_limits< ::boost::long_long_type>, + public detail::integer_traits_base< ::boost::long_long_type, -_LLONG_MAX - _C2, _LLONG_MAX> +{ }; + +template<> +class integer_traits< ::boost::ulong_long_type> + : public std::numeric_limits< ::boost::ulong_long_type>, + public detail::integer_traits_base< ::boost::ulong_long_type, 0, _ULLONG_MAX> +{ }; + +#elif defined(BOOST_HAS_LONG_LONG) +// +// we have long long but no constants, this happens for example with gcc in -ansi mode, +// we'll just have to work out the values for ourselves (assumes 2's compliment representation): +// +template<> +class integer_traits< ::boost::long_long_type> + : public std::numeric_limits< ::boost::long_long_type>, + public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1)), ~(1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1))> +{ }; + +template<> +class integer_traits< ::boost::ulong_long_type> + : public std::numeric_limits< ::boost::ulong_long_type>, + public detail::integer_traits_base< ::boost::ulong_long_type, 0, ~0uLL> +{ }; + +#elif defined(BOOST_HAS_MS_INT64) + +template<> +class integer_traits< __int64> + : public std::numeric_limits< __int64>, + public detail::integer_traits_base< __int64, _I64_MIN, _I64_MAX> +{ }; + +template<> +class integer_traits< unsigned __int64> + : public std::numeric_limits< unsigned __int64>, + public detail::integer_traits_base< unsigned __int64, 0, _UI64_MAX> +{ }; + +#endif +#endif + +} // namespace boost + +#endif /* BOOST_INTEGER_TRAITS_HPP */ + + + diff --git a/libraries/boost/include/boost/io/ios_state.hpp b/libraries/boost/include/boost/io/ios_state.hpp new file mode 100644 index 0000000000..07cfb345ff --- /dev/null +++ b/libraries/boost/include/boost/io/ios_state.hpp @@ -0,0 +1,439 @@ +// Boost io/ios_state.hpp header file --------------------------------------// + +// Copyright 2002, 2005 Daryle Walker. Use, modification, and distribution +// are subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or a copy at .) + +// See for the library's home page. + +#ifndef BOOST_IO_IOS_STATE_HPP +#define BOOST_IO_IOS_STATE_HPP + +#include // self include +#include + +#include // for std::ios_base, std::basic_ios, etc. +#ifndef BOOST_NO_STD_LOCALE +#include // for std::locale +#endif +#include // for std::basic_ostream +#include // for std::basic_streambuf +#include // for std::char_traits + + +namespace boost +{ +namespace io +{ + + +// Basic stream state saver class declarations -----------------------------// + +class ios_flags_saver +{ +public: + typedef ::std::ios_base state_type; + typedef ::std::ios_base::fmtflags aspect_type; + + explicit ios_flags_saver( state_type &s ) + : s_save_( s ), a_save_( s.flags() ) + {} + ios_flags_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.flags(a) ) + {} + ~ios_flags_saver() + { this->restore(); } + + void restore() + { s_save_.flags( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + + ios_flags_saver& operator=(const ios_flags_saver&); +}; + +class ios_precision_saver +{ +public: + typedef ::std::ios_base state_type; + typedef ::std::streamsize aspect_type; + + explicit ios_precision_saver( state_type &s ) + : s_save_( s ), a_save_( s.precision() ) + {} + ios_precision_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.precision(a) ) + {} + ~ios_precision_saver() + { this->restore(); } + + void restore() + { s_save_.precision( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + + ios_precision_saver& operator=(const ios_precision_saver&); +}; + +class ios_width_saver +{ +public: + typedef ::std::ios_base state_type; + typedef ::std::streamsize aspect_type; + + explicit ios_width_saver( state_type &s ) + : s_save_( s ), a_save_( s.width() ) + {} + ios_width_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.width(a) ) + {} + ~ios_width_saver() + { this->restore(); } + + void restore() + { s_save_.width( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + ios_width_saver& operator=(const ios_width_saver&); +}; + + +// Advanced stream state saver class template declarations -----------------// + +template < typename Ch, class Tr > +class basic_ios_iostate_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef ::std::ios_base::iostate aspect_type; + + explicit basic_ios_iostate_saver( state_type &s ) + : s_save_( s ), a_save_( s.rdstate() ) + {} + basic_ios_iostate_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.rdstate() ) + { s.clear(a); } + ~basic_ios_iostate_saver() + { this->restore(); } + + void restore() + { s_save_.clear( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + basic_ios_iostate_saver& operator=(const basic_ios_iostate_saver&); +}; + +template < typename Ch, class Tr > +class basic_ios_exception_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef ::std::ios_base::iostate aspect_type; + + explicit basic_ios_exception_saver( state_type &s ) + : s_save_( s ), a_save_( s.exceptions() ) + {} +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) + basic_ios_exception_saver( state_type &s, aspect_type a ) +#else + basic_ios_exception_saver( state_type &s, aspect_type const &a ) +#endif + : s_save_( s ), a_save_( s.exceptions() ) + { s.exceptions(a); } + ~basic_ios_exception_saver() + { this->restore(); } + + void restore() + { s_save_.exceptions( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + basic_ios_exception_saver& operator=(const basic_ios_exception_saver&); +}; + +template < typename Ch, class Tr > +class basic_ios_tie_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef ::std::basic_ostream * aspect_type; + + explicit basic_ios_tie_saver( state_type &s ) + : s_save_( s ), a_save_( s.tie() ) + {} + basic_ios_tie_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.tie(a) ) + {} + ~basic_ios_tie_saver() + { this->restore(); } + + void restore() + { s_save_.tie( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + basic_ios_tie_saver& operator=(const basic_ios_tie_saver&); +}; + +template < typename Ch, class Tr > +class basic_ios_rdbuf_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef ::std::basic_streambuf * aspect_type; + + explicit basic_ios_rdbuf_saver( state_type &s ) + : s_save_( s ), a_save_( s.rdbuf() ) + {} + basic_ios_rdbuf_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.rdbuf(a) ) + {} + ~basic_ios_rdbuf_saver() + { this->restore(); } + + void restore() + { s_save_.rdbuf( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + basic_ios_rdbuf_saver& operator=(const basic_ios_rdbuf_saver&); +}; + +template < typename Ch, class Tr > +class basic_ios_fill_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef typename state_type::char_type aspect_type; + + explicit basic_ios_fill_saver( state_type &s ) + : s_save_( s ), a_save_( s.fill() ) + {} + basic_ios_fill_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.fill(a) ) + {} + ~basic_ios_fill_saver() + { this->restore(); } + + void restore() + { s_save_.fill( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + basic_ios_fill_saver& operator=(const basic_ios_fill_saver&); +}; + +#ifndef BOOST_NO_STD_LOCALE +template < typename Ch, class Tr > +class basic_ios_locale_saver +{ +public: + typedef ::std::basic_ios state_type; + typedef ::std::locale aspect_type; + + explicit basic_ios_locale_saver( state_type &s ) + : s_save_( s ), a_save_( s.getloc() ) + {} + basic_ios_locale_saver( state_type &s, aspect_type const &a ) + : s_save_( s ), a_save_( s.imbue(a) ) + {} + ~basic_ios_locale_saver() + { this->restore(); } + + void restore() + { s_save_.imbue( a_save_ ); } + +private: + state_type & s_save_; + aspect_type const a_save_; + basic_ios_locale_saver& operator=(const basic_ios_locale_saver&); +}; +#endif + + +// User-defined stream state saver class declarations ----------------------// + +class ios_iword_saver +{ +public: + typedef ::std::ios_base state_type; + typedef int index_type; + typedef long aspect_type; + + explicit ios_iword_saver( state_type &s, index_type i ) + : s_save_( s ), a_save_( s.iword(i) ), i_save_( i ) + {} + ios_iword_saver( state_type &s, index_type i, aspect_type const &a ) + : s_save_( s ), a_save_( s.iword(i) ), i_save_( i ) + { s.iword(i) = a; } + ~ios_iword_saver() + { this->restore(); } + + void restore() + { s_save_.iword( i_save_ ) = a_save_; } + +private: + state_type & s_save_; + aspect_type const a_save_; + index_type const i_save_; + + ios_iword_saver& operator=(const ios_iword_saver&); +}; + +class ios_pword_saver +{ +public: + typedef ::std::ios_base state_type; + typedef int index_type; + typedef void * aspect_type; + + explicit ios_pword_saver( state_type &s, index_type i ) + : s_save_( s ), a_save_( s.pword(i) ), i_save_( i ) + {} + ios_pword_saver( state_type &s, index_type i, aspect_type const &a ) + : s_save_( s ), a_save_( s.pword(i) ), i_save_( i ) + { s.pword(i) = a; } + ~ios_pword_saver() + { this->restore(); } + + void restore() + { s_save_.pword( i_save_ ) = a_save_; } + +private: + state_type & s_save_; + aspect_type const a_save_; + index_type const i_save_; + + ios_pword_saver operator=(const ios_pword_saver&); +}; + + +// Combined stream state saver class (template) declarations ---------------// + +class ios_base_all_saver +{ +public: + typedef ::std::ios_base state_type; + + explicit ios_base_all_saver( state_type &s ) + : s_save_( s ), a1_save_( s.flags() ), a2_save_( s.precision() ) + , a3_save_( s.width() ) + {} + + ~ios_base_all_saver() + { this->restore(); } + + void restore() + { + s_save_.width( a3_save_ ); + s_save_.precision( a2_save_ ); + s_save_.flags( a1_save_ ); + } + +private: + state_type & s_save_; + state_type::fmtflags const a1_save_; + ::std::streamsize const a2_save_; + ::std::streamsize const a3_save_; + + ios_base_all_saver& operator=(const ios_base_all_saver&); +}; + +template < typename Ch, class Tr > +class basic_ios_all_saver +{ +public: + typedef ::std::basic_ios state_type; + + explicit basic_ios_all_saver( state_type &s ) + : s_save_( s ), a1_save_( s.flags() ), a2_save_( s.precision() ) + , a3_save_( s.width() ), a4_save_( s.rdstate() ) + , a5_save_( s.exceptions() ), a6_save_( s.tie() ) + , a7_save_( s.rdbuf() ), a8_save_( s.fill() ) + #ifndef BOOST_NO_STD_LOCALE + , a9_save_( s.getloc() ) + #endif + {} + + ~basic_ios_all_saver() + { this->restore(); } + + void restore() + { + #ifndef BOOST_NO_STD_LOCALE + s_save_.imbue( a9_save_ ); + #endif + s_save_.fill( a8_save_ ); + s_save_.rdbuf( a7_save_ ); + s_save_.tie( a6_save_ ); + s_save_.exceptions( a5_save_ ); + s_save_.clear( a4_save_ ); + s_save_.width( a3_save_ ); + s_save_.precision( a2_save_ ); + s_save_.flags( a1_save_ ); + } + +private: + state_type & s_save_; + typename state_type::fmtflags const a1_save_; + ::std::streamsize const a2_save_; + ::std::streamsize const a3_save_; + typename state_type::iostate const a4_save_; + typename state_type::iostate const a5_save_; + ::std::basic_ostream * const a6_save_; + ::std::basic_streambuf * const a7_save_; + typename state_type::char_type const a8_save_; + #ifndef BOOST_NO_STD_LOCALE + ::std::locale const a9_save_; + #endif + + basic_ios_all_saver& operator=(const basic_ios_all_saver&); +}; + +class ios_all_word_saver +{ +public: + typedef ::std::ios_base state_type; + typedef int index_type; + + ios_all_word_saver( state_type &s, index_type i ) + : s_save_( s ), i_save_( i ), a1_save_( s.iword(i) ) + , a2_save_( s.pword(i) ) + {} + + ~ios_all_word_saver() + { this->restore(); } + + void restore() + { + s_save_.pword( i_save_ ) = a2_save_; + s_save_.iword( i_save_ ) = a1_save_; + } + +private: + state_type & s_save_; + index_type const i_save_; + long const a1_save_; + void * const a2_save_; + + ios_all_word_saver& operator=(const ios_all_word_saver&); +}; + + +} // namespace io +} // namespace boost + + +#endif // BOOST_IO_IOS_STATE_HPP diff --git a/libraries/boost/include/boost/io_fwd.hpp b/libraries/boost/include/boost/io_fwd.hpp new file mode 100644 index 0000000000..417b81e3e1 --- /dev/null +++ b/libraries/boost/include/boost/io_fwd.hpp @@ -0,0 +1,67 @@ +// Boost io_fwd.hpp header file --------------------------------------------// + +// Copyright 2002 Daryle Walker. Use, modification, and distribution are subject +// to the Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or a copy at .) + +// See for the library's home page. + +#ifndef BOOST_IO_FWD_HPP +#define BOOST_IO_FWD_HPP + +#include // for std::char_traits (declaration) + + +namespace boost +{ +namespace io +{ + + +// From -------------------------------------------// + +class ios_flags_saver; +class ios_precision_saver; +class ios_width_saver; +class ios_base_all_saver; + +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_iostate_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_exception_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_tie_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_rdbuf_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_fill_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_locale_saver; +template < typename Ch, class Tr = ::std::char_traits > + class basic_ios_all_saver; + +typedef basic_ios_iostate_saver ios_iostate_saver; +typedef basic_ios_iostate_saver wios_iostate_saver; +typedef basic_ios_exception_saver ios_exception_saver; +typedef basic_ios_exception_saver wios_exception_saver; +typedef basic_ios_tie_saver ios_tie_saver; +typedef basic_ios_tie_saver wios_tie_saver; +typedef basic_ios_rdbuf_saver ios_rdbuf_saver; +typedef basic_ios_rdbuf_saver wios_rdbuf_saver; +typedef basic_ios_fill_saver ios_fill_saver; +typedef basic_ios_fill_saver wios_fill_saver; +typedef basic_ios_locale_saver ios_locale_saver; +typedef basic_ios_locale_saver wios_locale_saver; +typedef basic_ios_all_saver ios_all_saver; +typedef basic_ios_all_saver wios_all_saver; + +class ios_iword_saver; +class ios_pword_saver; +class ios_all_word_saver; + + +} // namespace io +} // namespace boost + + +#endif // BOOST_IO_FWD_HPP diff --git a/libraries/boost/include/boost/is_placeholder.hpp b/libraries/boost/include/boost/is_placeholder.hpp new file mode 100644 index 0000000000..5f1b544f94 --- /dev/null +++ b/libraries/boost/include/boost/is_placeholder.hpp @@ -0,0 +1,31 @@ +#ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED +#define BOOST_IS_PLACEHOLDER_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined( _MSC_VER ) && ( _MSC_VER >= 1020 ) +# pragma once +#endif + + +// is_placeholder.hpp - TR1 is_placeholder metafunction +// +// Copyright (c) 2006 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + + +namespace boost +{ + +template< class T > struct is_placeholder +{ + enum _vt { value = 0 }; +}; + +} // namespace boost + +#endif // #ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED diff --git a/libraries/boost/include/boost/iterator/detail/config_def.hpp b/libraries/boost/include/boost/iterator/detail/config_def.hpp new file mode 100644 index 0000000000..117e75a76d --- /dev/null +++ b/libraries/boost/include/boost/iterator/detail/config_def.hpp @@ -0,0 +1,128 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// no include guard multiple inclusion intended + +// +// This is a temporary workaround until the bulk of this is +// available in boost config. +// 23/02/03 thw +// + +#include // for prior +#include + +#ifdef BOOST_ITERATOR_CONFIG_DEF +# error you have nested config_def #inclusion. +#else +# define BOOST_ITERATOR_CONFIG_DEF +#endif + +// We enable this always now. Otherwise, the simple case in +// libs/iterator/test/constant_iterator_arrow.cpp fails to compile +// because the operator-> return is improperly deduced as a non-const +// pointer. +#if 1 || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) + +// Recall that in general, compilers without partial specialization +// can't strip constness. Consider counting_iterator, which normally +// passes a const Value to iterator_facade. As a result, any code +// which makes a std::vector of the iterator's value_type will fail +// when its allocator declares functions overloaded on reference and +// const_reference (the same type). +// +// Furthermore, Borland 5.5.1 drops constness in enough ways that we +// end up using a proxy for operator[] when we otherwise shouldn't. +// Using reference constness gives it an extra hint that it can +// return the value_type from operator[] directly, but is not +// strictly necessary. Not sure how best to resolve this one. + +# define BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY 1 + +#endif + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x5A0)) \ + || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ + || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \ + || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) + +# define BOOST_NO_LVALUE_RETURN_DETECTION + +# if 0 // test code + struct v {}; + + typedef char (&no)[3]; + + template + no foo(T const&, ...); + + template + char foo(T&, int); + + + struct value_iterator + { + v operator*() const; + }; + + template + struct lvalue_deref_helper + { + static T& x; + enum { value = (sizeof(foo(*x,0)) == 1) }; + }; + + int z2[(lvalue_deref_helper::value == 1) ? 1 : -1]; + int z[(lvalue_deref_helper::value) == 1 ? -1 : 1 ]; +# endif + +#endif + +#if BOOST_WORKAROUND(__MWERKS__, <=0x2407) +# define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work for simple types" +#endif + +#if BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \ + || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +# define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile: + +# if 0 // test code + #include + template + struct foo + { + foo(T); + + template + foo(foo const& other) : p(other.p) { } + + T p; + }; + + bool x = boost::is_convertible, foo >::value; +# endif + +#endif + + +#if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE)) +# define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY +#endif + +# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + +// GCC-2.95 (obsolete) eagerly instantiates templated constructors and conversion +// operators in convertibility checks, causing premature errors. +// +// Borland's problems are harder to diagnose due to lack of an +// instantiation stack backtrace. They may be due in part to the fact +// that it drops cv-qualification willy-nilly in templates. +# define BOOST_NO_ONE_WAY_ITERATOR_INTEROP +# endif + +// no include guard; multiple inclusion intended diff --git a/libraries/boost/include/boost/iterator/detail/config_undef.hpp b/libraries/boost/include/boost/iterator/detail/config_undef.hpp new file mode 100644 index 0000000000..bf1b8d708c --- /dev/null +++ b/libraries/boost/include/boost/iterator/detail/config_undef.hpp @@ -0,0 +1,24 @@ +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// no include guard multiple inclusion intended + +// +// This is a temporary workaround until the bulk of this is +// available in boost config. +// 23/02/03 thw +// + +#undef BOOST_NO_IS_CONVERTIBLE +#undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE +#undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY +#undef BOOST_NO_LVALUE_RETURN_DETECTION +#undef BOOST_NO_ONE_WAY_ITERATOR_INTEROP + +#ifdef BOOST_ITERATOR_CONFIG_DEF +# undef BOOST_ITERATOR_CONFIG_DEF +#else +# error missing or nested #include config_def +#endif diff --git a/libraries/boost/include/boost/iterator/detail/enable_if.hpp b/libraries/boost/include/boost/iterator/detail/enable_if.hpp new file mode 100644 index 0000000000..071f5fe81d --- /dev/null +++ b/libraries/boost/include/boost/iterator/detail/enable_if.hpp @@ -0,0 +1,83 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_ENABLE_IF_23022003THW_HPP +#define BOOST_ENABLE_IF_23022003THW_HPP + +#include +#include + +#include + +// +// Boost iterators uses its own enable_if cause we need +// special semantics for deficient compilers. +// 23/02/03 thw +// + +namespace boost +{ + + namespace iterators + { + // + // Base machinery for all kinds of enable if + // + template + struct enabled + { + template + struct base + { + typedef T type; + }; + }; + + // + // For compilers that don't support "Substitution Failure Is Not An Error" + // enable_if falls back to always enabled. See comments + // on operator implementation for consequences. + // + template<> + struct enabled + { + template + struct base + { +#ifdef BOOST_NO_SFINAE + + typedef T type; + + // This way to do it would give a nice error message containing + // invalid overload, but has the big disadvantage that + // there is no reference to user code in the error message. + // + // struct invalid_overload; + // typedef invalid_overload type; + // +#endif + }; + }; + + + template + struct enable_if +# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE) + : enabled<(Cond::value)>::template base +# else + : mpl::identity +# endif + { + }; + + } // namespace iterators + +} // namespace boost + +#include + +#endif // BOOST_ENABLE_IF_23022003THW_HPP diff --git a/libraries/boost/include/boost/iterator/detail/facade_iterator_category.hpp b/libraries/boost/include/boost/iterator/detail/facade_iterator_category.hpp new file mode 100644 index 0000000000..67fdf446b0 --- /dev/null +++ b/libraries/boost/include/boost/iterator/detail/facade_iterator_category.hpp @@ -0,0 +1,193 @@ +// Copyright David Abrahams 2003. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef FACADE_ITERATOR_CATEGORY_DWA20031118_HPP +# define FACADE_ITERATOR_CATEGORY_DWA20031118_HPP + +# include + +# include // used in iterator_tag inheritance logic +# include +# include +# include +# include +# include + +# include +# include +# include +# include + +# include + +# include // try to keep this last + +# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY +# include +# endif + +// +// iterator_category deduction for iterator_facade +// + +namespace boost { +namespace iterators { + +// forward declaration +struct use_default; + +namespace detail { + +struct input_output_iterator_tag + : std::input_iterator_tag +{ + // Using inheritance for only input_iterator_tag helps to avoid + // ambiguities when a stdlib implementation dispatches on a + // function which is overloaded on both input_iterator_tag and + // output_iterator_tag, as STLPort does, in its __valid_range + // function. I claim it's better to avoid the ambiguity in these + // cases. + operator std::output_iterator_tag() const + { + return std::output_iterator_tag(); + } +}; + +// +// True iff the user has explicitly disabled writability of this +// iterator. Pass the iterator_facade's Value parameter and its +// nested ::reference type. +// +template +struct iterator_writability_disabled +# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY // Adding Thomas' logic? + : mpl::or_< + is_const + , boost::detail::indirect_traits::is_reference_to_const + , is_const + > +# else + : is_const +# endif +{}; + + +// +// Convert an iterator_facade's traversal category, Value parameter, +// and ::reference type to an appropriate old-style category. +// +// Due to changeset 21683, this now never results in a category convertible +// to output_iterator_tag. +// +// Change at: https://svn.boost.org/trac/boost/changeset/21683 +template +struct iterator_facade_default_category + : mpl::eval_if< + mpl::and_< + is_reference + , is_convertible + > + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::if_< + is_convertible + , std::bidirectional_iterator_tag + , std::forward_iterator_tag + > + > + , typename mpl::eval_if< + mpl::and_< + is_convertible + + // check for readability + , is_convertible + > + , mpl::identity + , mpl::identity + > + > +{ +}; + +// True iff T is convertible to an old-style iterator category. +template +struct is_iterator_category + : mpl::or_< + is_convertible + , is_convertible + > +{ +}; + +template +struct is_iterator_traversal + : is_convertible +{}; + +// +// A composite iterator_category tag convertible to Category (a pure +// old-style category) and Traversal (a pure traversal tag). +// Traversal must be a strict increase of the traversal power given by +// Category. +// +template +struct iterator_category_with_traversal + : Category, Traversal +{ + // Make sure this isn't used to build any categories where + // convertibility to Traversal is redundant. Should just use the + // Category element in that case. + BOOST_MPL_ASSERT_NOT(( + is_convertible< + typename iterator_category_to_traversal::type + , Traversal + >)); + + BOOST_MPL_ASSERT((is_iterator_category)); + BOOST_MPL_ASSERT_NOT((is_iterator_category)); + BOOST_MPL_ASSERT_NOT((is_iterator_traversal)); +# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) + BOOST_MPL_ASSERT((is_iterator_traversal)); +# endif +}; + +// Computes an iterator_category tag whose traversal is Traversal and +// which is appropriate for an iterator +template +struct facade_iterator_category_impl +{ + BOOST_MPL_ASSERT_NOT((is_iterator_category)); + + typedef typename iterator_facade_default_category< + Traversal,ValueParam,Reference + >::type category; + + typedef typename mpl::if_< + is_same< + Traversal + , typename iterator_category_to_traversal::type + > + , category + , iterator_category_with_traversal + >::type type; +}; + +// +// Compute an iterator_category for iterator_facade +// +template +struct facade_iterator_category + : mpl::eval_if< + is_iterator_category + , mpl::identity // old-style categories are fine as-is + , facade_iterator_category_impl + > +{ +}; + +}}} // namespace boost::iterators::detail + +# include + +#endif // FACADE_ITERATOR_CATEGORY_DWA20031118_HPP diff --git a/libraries/boost/include/boost/iterator/interoperable.hpp b/libraries/boost/include/boost/iterator/interoperable.hpp new file mode 100644 index 0000000000..6f3c872a27 --- /dev/null +++ b/libraries/boost/include/boost/iterator/interoperable.hpp @@ -0,0 +1,54 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_INTEROPERABLE_23022003THW_HPP +# define BOOST_INTEROPERABLE_23022003THW_HPP + +# include +# include + +# include + +# include // must appear last + +namespace boost { +namespace iterators { + + // + // Meta function that determines whether two + // iterator types are considered interoperable. + // + // Two iterator types A,B are considered interoperable if either + // A is convertible to B or vice versa. + // This interoperability definition is in sync with the + // standards requirements on constant/mutable container + // iterators (23.1 [lib.container.requirements]). + // + // For compilers that don't support is_convertible + // is_interoperable gives false positives. See comments + // on operator implementation for consequences. + // + template + struct is_interoperable +# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY + : mpl::true_ +# else + : mpl::or_< + is_convertible< A, B > + , is_convertible< B, A > > +# endif + { + }; + +} // namespace iterators + +using iterators::is_interoperable; + +} // namespace boost + +# include + +#endif // BOOST_INTEROPERABLE_23022003THW_HPP diff --git a/libraries/boost/include/boost/iterator/iterator_categories.hpp b/libraries/boost/include/boost/iterator/iterator_categories.hpp new file mode 100644 index 0000000000..baf805af6e --- /dev/null +++ b/libraries/boost/include/boost/iterator/iterator_categories.hpp @@ -0,0 +1,216 @@ +// (C) Copyright Jeremy Siek 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_ITERATOR_CATEGORIES_HPP +# define BOOST_ITERATOR_CATEGORIES_HPP + +# include +# include + +# include + +# include +# include +# include +# include + +# include + +# include + +#include + +namespace boost { +namespace iterators { + +// +// Traversal Categories +// + +struct no_traversal_tag {}; + +struct incrementable_traversal_tag + : no_traversal_tag +{ +// incrementable_traversal_tag() {} +// incrementable_traversal_tag(std::output_iterator_tag const&) {}; +}; + +struct single_pass_traversal_tag + : incrementable_traversal_tag +{ +// single_pass_traversal_tag() {} +// single_pass_traversal_tag(std::input_iterator_tag const&) {}; +}; + +struct forward_traversal_tag + : single_pass_traversal_tag +{ +// forward_traversal_tag() {} +// forward_traversal_tag(std::forward_iterator_tag const&) {}; +}; + +struct bidirectional_traversal_tag + : forward_traversal_tag +{ +// bidirectional_traversal_tag() {}; +// bidirectional_traversal_tag(std::bidirectional_iterator_tag const&) {}; +}; + +struct random_access_traversal_tag + : bidirectional_traversal_tag +{ +// random_access_traversal_tag() {}; +// random_access_traversal_tag(std::random_access_iterator_tag const&) {}; +}; + +namespace detail +{ + // + // Convert a "strictly old-style" iterator category to a traversal + // tag. This is broken out into a separate metafunction to reduce + // the cost of instantiating iterator_category_to_traversal, below, + // for new-style types. + // + template + struct old_category_to_traversal + : mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , void + > + > + > + > + > + {}; + +} // namespace detail + +// +// Convert an iterator category into a traversal tag +// +template +struct iterator_category_to_traversal + : mpl::eval_if< // if already convertible to a traversal tag, we're done. + is_convertible + , mpl::identity + , boost::iterators::detail::old_category_to_traversal + > +{}; + +// Trait to get an iterator's traversal category +template +struct iterator_traversal + : iterator_category_to_traversal< + typename std::iterator_traits::iterator_category + > +{}; + +# ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT +// Hack because BOOST_MPL_AUX_LAMBDA_SUPPORT doesn't seem to work +// out well. Instantiating the nested apply template also +// requires instantiating iterator_traits on the +// placeholder. Instead we just specialize it as a metafunction +// class. +template <> +struct iterator_traversal +{ + template + struct apply : iterator_traversal + {}; +}; +template <> +struct iterator_traversal + : iterator_traversal +{}; +# endif + +// +// Convert an iterator traversal to one of the traversal tags. +// +template +struct pure_traversal_tag + : mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , mpl::eval_if< + is_convertible + , mpl::identity + , void + > + > + > + > + > +{ +}; + +// +// Trait to retrieve one of the iterator traversal tags from the iterator category or traversal. +// +template +struct pure_iterator_traversal + : pure_traversal_tag::type> +{}; + +# ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT +template <> +struct pure_iterator_traversal +{ + template + struct apply : pure_iterator_traversal + {}; +}; +template <> +struct pure_iterator_traversal + : pure_iterator_traversal +{}; +# endif + +} // namespace iterators + +using iterators::no_traversal_tag; +using iterators::incrementable_traversal_tag; +using iterators::single_pass_traversal_tag; +using iterators::forward_traversal_tag; +using iterators::bidirectional_traversal_tag; +using iterators::random_access_traversal_tag; +using iterators::iterator_category_to_traversal; +using iterators::iterator_traversal; + +// This import is needed for backward compatibility with Boost.Range: +// boost/range/detail/demote_iterator_traversal_tag.hpp +// It should be removed when that header is fixed. +namespace detail { +using iterators::pure_traversal_tag; +} // namespace detail + +} // namespace boost + +#include + +#endif // BOOST_ITERATOR_CATEGORIES_HPP diff --git a/libraries/boost/include/boost/iterator/iterator_facade.hpp b/libraries/boost/include/boost/iterator/iterator_facade.hpp new file mode 100644 index 0000000000..225c53a231 --- /dev/null +++ b/libraries/boost/include/boost/iterator/iterator_facade.hpp @@ -0,0 +1,981 @@ +// (C) Copyright David Abrahams 2002. +// (C) Copyright Jeremy Siek 2002. +// (C) Copyright Thomas Witt 2002. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_ITERATOR_FACADE_23022003THW_HPP +#define BOOST_ITERATOR_FACADE_23022003THW_HPP + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include // this goes last + +namespace boost { +namespace iterators { + + // This forward declaration is required for the friend declaration + // in iterator_core_access + template class iterator_facade; + + namespace detail + { + // A binary metafunction class that always returns bool. VC6 + // ICEs on mpl::always, probably because of the default + // parameters. + struct always_bool2 + { + template + struct apply + { + typedef bool type; + }; + }; + + // The type trait checks if the category or traversal is at least as advanced as the specified required traversal + template< typename CategoryOrTraversal, typename Required > + struct is_traversal_at_least : + public boost::is_convertible< typename iterator_category_to_traversal< CategoryOrTraversal >::type, Required > + {}; + + // + // enable if for use in operator implementation. + // + template < + class Facade1 + , class Facade2 + , class Return + > + struct enable_if_interoperable : + public boost::iterators::enable_if< + is_interoperable< Facade1, Facade2 > + , Return + > + {}; + + // + // enable if for use in implementation of operators specific for random access traversal. + // + template < + class Facade1 + , class Facade2 + , class Return + > + struct enable_if_interoperable_and_random_access_traversal : + public boost::iterators::enable_if< + mpl::and_< + is_interoperable< Facade1, Facade2 > + , is_traversal_at_least< typename iterator_category< Facade1 >::type, random_access_traversal_tag > + , is_traversal_at_least< typename iterator_category< Facade2 >::type, random_access_traversal_tag > + > + , Return + > + {}; + + // + // Generates associated types for an iterator_facade with the + // given parameters. + // + template < + class ValueParam + , class CategoryOrTraversal + , class Reference + , class Difference + > + struct iterator_facade_types + { + typedef typename facade_iterator_category< + CategoryOrTraversal, ValueParam, Reference + >::type iterator_category; + + typedef typename remove_const::type value_type; + + // Not the real associated pointer type + typedef typename mpl::eval_if< + boost::iterators::detail::iterator_writability_disabled + , add_pointer + , add_pointer + >::type pointer; + +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ + && (BOOST_WORKAROUND(_STLPORT_VERSION, BOOST_TESTED_AT(0x452)) \ + || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, BOOST_TESTED_AT(310))) \ + || BOOST_WORKAROUND(BOOST_RWSTD_VER, BOOST_TESTED_AT(0x20101)) \ + || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 310) + + // To interoperate with some broken library/compiler + // combinations, user-defined iterators must be derived from + // std::iterator. It is possible to implement a standard + // library for broken compilers without this limitation. +# define BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE 1 + + typedef + iterator + base; +# endif + }; + + // iterators whose dereference operators reference the same value + // for all iterators into the same sequence (like many input + // iterators) need help with their postfix ++: the referenced + // value must be read and stored away before the increment occurs + // so that *a++ yields the originally referenced element and not + // the next one. + template + class postfix_increment_proxy + { + typedef typename iterator_value::type value_type; + public: + explicit postfix_increment_proxy(Iterator const& x) + : stored_value(*x) + {} + + // Returning a mutable reference allows nonsense like + // (*r++).mutate(), but it imposes fewer assumptions about the + // behavior of the value_type. In particular, recall that + // (*r).mutate() is legal if operator* returns by value. + value_type& + operator*() const + { + return this->stored_value; + } + private: + mutable value_type stored_value; + }; + + // + // In general, we can't determine that such an iterator isn't + // writable -- we also need to store a copy of the old iterator so + // that it can be written into. + template + class writable_postfix_increment_proxy + { + typedef typename iterator_value::type value_type; + public: + explicit writable_postfix_increment_proxy(Iterator const& x) + : stored_value(*x) + , stored_iterator(x) + {} + + // Dereferencing must return a proxy so that both *r++ = o and + // value_type(*r++) can work. In this case, *r is the same as + // *r++, and the conversion operator below is used to ensure + // readability. + writable_postfix_increment_proxy const& + operator*() const + { + return *this; + } + + // Provides readability of *r++ + operator value_type&() const + { + return stored_value; + } + + // Provides writability of *r++ + template + T const& operator=(T const& x) const + { + *this->stored_iterator = x; + return x; + } + + // This overload just in case only non-const objects are writable + template + T& operator=(T& x) const + { + *this->stored_iterator = x; + return x; + } + + // Provides X(r++) + operator Iterator const&() const + { + return stored_iterator; + } + + private: + mutable value_type stored_value; + Iterator stored_iterator; + }; + +# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + template + struct is_non_proxy_reference_impl + { + static Reference r; + + template + static typename mpl::if_< + is_convertible< + R const volatile* + , Value const volatile* + > + , char[1] + , char[2] + >::type& helper(R const&); + + BOOST_STATIC_CONSTANT(bool, value = sizeof(helper(r)) == 1); + }; + + template + struct is_non_proxy_reference + : mpl::bool_< + is_non_proxy_reference_impl::value + > + {}; +# else + template + struct is_non_proxy_reference + : is_convertible< + typename remove_reference::type + const volatile* + , Value const volatile* + > + {}; +# endif + + // A metafunction to choose the result type of postfix ++ + // + // Because the C++98 input iterator requirements say that *r++ has + // type T (value_type), implementations of some standard + // algorithms like lexicographical_compare may use constructions + // like: + // + // *r++ < *s++ + // + // If *r++ returns a proxy (as required if r is writable but not + // multipass), this sort of expression will fail unless the proxy + // supports the operator<. Since there are any number of such + // operations, we're not going to try to support them. Therefore, + // even if r++ returns a proxy, *r++ will only return a proxy if + // *r also returns a proxy. + template + struct postfix_increment_result + : mpl::eval_if< + mpl::and_< + // A proxy is only needed for readable iterators + is_convertible< + Reference + // Use add_lvalue_reference to form `reference to Value` due to + // some (strict) C++03 compilers (e.g. `gcc -std=c++03`) reject + // 'reference-to-reference' in the template which described in CWG + // DR106. + // http://www.open-std.org/Jtc1/sc22/wg21/docs/cwg_defects.html#106 + , typename add_lvalue_reference::type + > + + // No multipass iterator can have values that disappear + // before positions can be re-visited + , mpl::not_< + is_convertible< + typename iterator_category_to_traversal::type + , forward_traversal_tag + > + > + > + , mpl::if_< + is_non_proxy_reference + , postfix_increment_proxy + , writable_postfix_increment_proxy + > + , mpl::identity + > + {}; + + // operator->() needs special support for input iterators to strictly meet the + // standard's requirements. If *i is not a reference type, we must still + // produce an lvalue to which a pointer can be formed. We do that by + // returning a proxy object containing an instance of the reference object. + template + struct operator_arrow_dispatch // proxy references + { + struct proxy + { + explicit proxy(Reference const & x) : m_ref(x) {} + Reference* operator->() { return boost::addressof(m_ref); } + // This function is needed for MWCW and BCC, which won't call + // operator-> again automatically per 13.3.1.2 para 8 + operator Reference*() { return boost::addressof(m_ref); } + Reference m_ref; + }; + typedef proxy result_type; + static result_type apply(Reference const & x) + { + return result_type(x); + } + }; + + template + struct operator_arrow_dispatch // "real" references + { + typedef Pointer result_type; + static result_type apply(T& x) + { + return boost::addressof(x); + } + }; + + // A proxy return type for operator[], needed to deal with + // iterators that may invalidate referents upon destruction. + // Consider the temporary iterator in *(a + n) + template + class operator_brackets_proxy + { + // Iterator is actually an iterator_facade, so we do not have to + // go through iterator_traits to access the traits. + typedef typename Iterator::reference reference; + typedef typename Iterator::value_type value_type; + + public: + operator_brackets_proxy(Iterator const& iter) + : m_iter(iter) + {} + + operator reference() const + { + return *m_iter; + } + + operator_brackets_proxy& operator=(value_type const& val) + { + *m_iter = val; + return *this; + } + + private: + Iterator m_iter; + }; + + // A metafunction that determines whether operator[] must return a + // proxy, or whether it can simply return a copy of the value_type. + template + struct use_operator_brackets_proxy + : mpl::not_< + mpl::and_< + // Really we want an is_copy_constructible trait here, + // but is_POD will have to suffice in the meantime. + boost::is_POD + , iterator_writability_disabled + > + > + {}; + + template + struct operator_brackets_result + { + typedef typename mpl::if_< + use_operator_brackets_proxy + , operator_brackets_proxy + , Value + >::type type; + }; + + template + operator_brackets_proxy make_operator_brackets_result(Iterator const& iter, mpl::true_) + { + return operator_brackets_proxy(iter); + } + + template + typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, mpl::false_) + { + return *iter; + } + + struct choose_difference_type + { + template + struct apply + : +# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP + iterator_difference +# else + mpl::eval_if< + is_convertible + , iterator_difference + , iterator_difference + > +# endif + {}; + + }; + + template < + class Derived + , class Value + , class CategoryOrTraversal + , class Reference + , class Difference + , bool IsBidirectionalTraversal + , bool IsRandomAccessTraversal + > + class iterator_facade_base; + + } // namespace detail + + + // Macros which describe the declarations of binary operators +# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY +# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \ + template < \ + class Derived1, class V1, class TC1, class Reference1, class Difference1 \ + , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ + > \ + prefix typename mpl::apply2::type \ + operator op( \ + iterator_facade const& lhs \ + , iterator_facade const& rhs) +# else +# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \ + template < \ + class Derived1, class V1, class TC1, class Reference1, class Difference1 \ + , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ + > \ + prefix typename enabler< \ + Derived1, Derived2 \ + , typename mpl::apply2::type \ + >::type \ + operator op( \ + iterator_facade const& lhs \ + , iterator_facade const& rhs) +# endif + +# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ + BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable) + +# define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(prefix, op, result_type) \ + BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable_and_random_access_traversal) + +# define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \ + template \ + prefix typename boost::iterators::enable_if< \ + boost::iterators::detail::is_traversal_at_least< TC, boost::iterators::random_access_traversal_tag >, \ + Derived \ + >::type operator+ args + + // + // Helper class for granting access to the iterator core interface. + // + // The simple core interface is used by iterator_facade. The core + // interface of a user/library defined iterator type should not be made public + // so that it does not clutter the public interface. Instead iterator_core_access + // should be made friend so that iterator_facade can access the core + // interface through iterator_core_access. + // + class iterator_core_access + { +# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + // Tasteless as this may seem, making all members public allows member templates + // to work in the absence of member template friends. + public: +# else + + template friend class iterator_facade; + template + friend class detail::iterator_facade_base; + +# define BOOST_ITERATOR_FACADE_RELATION(op) \ + BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, boost::iterators::detail::always_bool2); + + BOOST_ITERATOR_FACADE_RELATION(==) + BOOST_ITERATOR_FACADE_RELATION(!=) + +# undef BOOST_ITERATOR_FACADE_RELATION + +# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op) \ + BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(friend,op, boost::iterators::detail::always_bool2); + + BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<) + BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>) + BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<=) + BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>=) + +# undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION + + BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD( + friend, -, boost::iterators::detail::choose_difference_type) + ; + + BOOST_ITERATOR_FACADE_PLUS_HEAD( + friend inline + , (iterator_facade const& + , typename Derived::difference_type) + ) + ; + + BOOST_ITERATOR_FACADE_PLUS_HEAD( + friend inline + , (typename Derived::difference_type + , iterator_facade const&) + ) + ; + +# endif + + template + static typename Facade::reference dereference(Facade const& f) + { + return f.dereference(); + } + + template + static void increment(Facade& f) + { + f.increment(); + } + + template + static void decrement(Facade& f) + { + f.decrement(); + } + + template + static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::true_) + { + return f1.equal(f2); + } + + template + static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::false_) + { + return f2.equal(f1); + } + + template + static void advance(Facade& f, typename Facade::difference_type n) + { + f.advance(n); + } + + template + static typename Facade1::difference_type distance_from( + Facade1 const& f1, Facade2 const& f2, mpl::true_) + { + return -f1.distance_to(f2); + } + + template + static typename Facade2::difference_type distance_from( + Facade1 const& f1, Facade2 const& f2, mpl::false_) + { + return f2.distance_to(f1); + } + + // + // Curiously Recurring Template interface. + // + template + static I& derived(iterator_facade& facade) + { + return *static_cast(&facade); + } + + template + static I const& derived(iterator_facade const& facade) + { + return *static_cast(&facade); + } + + // objects of this class are useless + BOOST_DELETED_FUNCTION(iterator_core_access()) + }; + + namespace detail { + + // Implementation for forward traversal iterators + template < + class Derived + , class Value + , class CategoryOrTraversal + , class Reference + , class Difference + > + class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false > +# ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE + : public boost::iterators::detail::iterator_facade_types< + Value, CategoryOrTraversal, Reference, Difference + >::base +# undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE +# endif + { + private: + typedef boost::iterators::detail::iterator_facade_types< + Value, CategoryOrTraversal, Reference, Difference + > associated_types; + + typedef boost::iterators::detail::operator_arrow_dispatch< + Reference + , typename associated_types::pointer + > operator_arrow_dispatch_; + + public: + typedef typename associated_types::value_type value_type; + typedef Reference reference; + typedef Difference difference_type; + + typedef typename operator_arrow_dispatch_::result_type pointer; + + typedef typename associated_types::iterator_category iterator_category; + + public: + reference operator*() const + { + return iterator_core_access::dereference(this->derived()); + } + + pointer operator->() const + { + return operator_arrow_dispatch_::apply(*this->derived()); + } + + Derived& operator++() + { + iterator_core_access::increment(this->derived()); + return this->derived(); + } + + protected: + // + // Curiously Recurring Template interface. + // + Derived& derived() + { + return *static_cast(this); + } + + Derived const& derived() const + { + return *static_cast(this); + } + }; + + // Implementation for bidirectional traversal iterators + template < + class Derived + , class Value + , class CategoryOrTraversal + , class Reference + , class Difference + > + class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > : + public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false > + { + public: + Derived& operator--() + { + iterator_core_access::decrement(this->derived()); + return this->derived(); + } + + Derived operator--(int) + { + Derived tmp(this->derived()); + --*this; + return tmp; + } + }; + + // Implementation for random access traversal iterators + template < + class Derived + , class Value + , class CategoryOrTraversal + , class Reference + , class Difference + > + class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true > : + public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > + { + private: + typedef iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > base_type; + + public: + typedef typename base_type::reference reference; + typedef typename base_type::difference_type difference_type; + + public: + typename boost::iterators::detail::operator_brackets_result::type + operator[](difference_type n) const + { + typedef boost::iterators::detail::use_operator_brackets_proxy use_proxy; + + return boost::iterators::detail::make_operator_brackets_result( + this->derived() + n + , use_proxy() + ); + } + + Derived& operator+=(difference_type n) + { + iterator_core_access::advance(this->derived(), n); + return this->derived(); + } + + Derived& operator-=(difference_type n) + { + iterator_core_access::advance(this->derived(), -n); + return this->derived(); + } + + Derived operator-(difference_type x) const + { + Derived result(this->derived()); + return result -= x; + } + }; + + } // namespace detail + + // + // iterator_facade - use as a public base class for defining new + // standard-conforming iterators. + // + template < + class Derived // The derived iterator type being constructed + , class Value + , class CategoryOrTraversal + , class Reference = Value& + , class Difference = std::ptrdiff_t + > + class iterator_facade : + public detail::iterator_facade_base< + Derived, + Value, + CategoryOrTraversal, + Reference, + Difference, + detail::is_traversal_at_least< CategoryOrTraversal, bidirectional_traversal_tag >::value, + detail::is_traversal_at_least< CategoryOrTraversal, random_access_traversal_tag >::value + > + { + protected: + // For use by derived classes + typedef iterator_facade iterator_facade_; + }; + + template + inline typename boost::iterators::detail::postfix_increment_result::type + operator++( + iterator_facade& i + , int + ) + { + typename boost::iterators::detail::postfix_increment_result::type + tmp(*static_cast(&i)); + + ++i; + + return tmp; + } + + + // + // Comparison operator implementation. The library supplied operators + // enables the user to provide fully interoperable constant/mutable + // iterator types. I.e. the library provides all operators + // for all mutable/constant iterator combinations. + // + // Note though that this kind of interoperability for constant/mutable + // iterators is not required by the standard for container iterators. + // All the standard asks for is a conversion mutable -> constant. + // Most standard library implementations nowadays provide fully interoperable + // iterator implementations, but there are still heavily used implementations + // that do not provide them. (Actually it's even worse, they do not provide + // them for only a few iterators.) + // + // ?? Maybe a BOOST_ITERATOR_NO_FULL_INTEROPERABILITY macro should + // enable the user to turn off mixed type operators + // + // The library takes care to provide only the right operator overloads. + // I.e. + // + // bool operator==(Iterator, Iterator); + // bool operator==(ConstIterator, Iterator); + // bool operator==(Iterator, ConstIterator); + // bool operator==(ConstIterator, ConstIterator); + // + // ... + // + // In order to do so it uses c++ idioms that are not yet widely supported + // by current compiler releases. The library is designed to degrade gracefully + // in the face of compiler deficiencies. In general compiler + // deficiencies result in less strict error checking and more obscure + // error messages, functionality is not affected. + // + // For full operation compiler support for "Substitution Failure Is Not An Error" + // (aka. enable_if) and boost::is_convertible is required. + // + // The following problems occur if support is lacking. + // + // Pseudo code + // + // --------------- + // AdaptorA a1; + // AdaptorA a2; + // + // // This will result in a no such overload error in full operation + // // If enable_if or is_convertible is not supported + // // The instantiation will fail with an error hopefully indicating that + // // there is no operator== for Iterator1, Iterator2 + // // The same will happen if no enable_if is used to remove + // // false overloads from the templated conversion constructor + // // of AdaptorA. + // + // a1 == a2; + // ---------------- + // + // AdaptorA a; + // AdaptorB b; + // + // // This will result in a no such overload error in full operation + // // If enable_if is not supported the static assert used + // // in the operator implementation will fail. + // // This will accidently work if is_convertible is not supported. + // + // a == b; + // ---------------- + // + +# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP +# define BOOST_ITERATOR_CONVERTIBLE(a,b) mpl::true_() +# else +# define BOOST_ITERATOR_CONVERTIBLE(a,b) is_convertible() +# endif + +# define BOOST_ITERATOR_FACADE_INTEROP(op, result_type, return_prefix, base_op) \ + BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type) \ + { \ + /* For those compilers that do not support enable_if */ \ + BOOST_STATIC_ASSERT(( \ + is_interoperable< Derived1, Derived2 >::value \ + )); \ + return_prefix iterator_core_access::base_op( \ + *static_cast(&lhs) \ + , *static_cast(&rhs) \ + , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \ + ); \ + } + +# define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \ + BOOST_ITERATOR_FACADE_INTEROP( \ + op \ + , boost::iterators::detail::always_bool2 \ + , return_prefix \ + , base_op \ + ) + + BOOST_ITERATOR_FACADE_RELATION(==, return, equal) + BOOST_ITERATOR_FACADE_RELATION(!=, return !, equal) + +# undef BOOST_ITERATOR_FACADE_RELATION + + +# define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(op, result_type, return_prefix, base_op) \ + BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(inline, op, result_type) \ + { \ + /* For those compilers that do not support enable_if */ \ + BOOST_STATIC_ASSERT(( \ + is_interoperable< Derived1, Derived2 >::value && \ + boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived1 >::type, random_access_traversal_tag >::value && \ + boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived2 >::type, random_access_traversal_tag >::value \ + )); \ + return_prefix iterator_core_access::base_op( \ + *static_cast(&lhs) \ + , *static_cast(&rhs) \ + , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \ + ); \ + } + +# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op, return_prefix, base_op) \ + BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( \ + op \ + , boost::iterators::detail::always_bool2 \ + , return_prefix \ + , base_op \ + ) + + BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<, return 0 >, distance_from) + BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>, return 0 <, distance_from) + BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<=, return 0 >=, distance_from) + BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>=, return 0 <=, distance_from) + +# undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION + + // operator- requires an additional part in the static assertion + BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( + - + , boost::iterators::detail::choose_difference_type + , return + , distance_from + ) + +# undef BOOST_ITERATOR_FACADE_INTEROP +# undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS + +# define BOOST_ITERATOR_FACADE_PLUS(args) \ + BOOST_ITERATOR_FACADE_PLUS_HEAD(inline, args) \ + { \ + Derived tmp(static_cast(i)); \ + return tmp += n; \ + } + + BOOST_ITERATOR_FACADE_PLUS(( + iterator_facade const& i + , typename Derived::difference_type n + )) + + BOOST_ITERATOR_FACADE_PLUS(( + typename Derived::difference_type n + , iterator_facade const& i + )) + +# undef BOOST_ITERATOR_FACADE_PLUS +# undef BOOST_ITERATOR_FACADE_PLUS_HEAD + +# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD +# undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD +# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL + +} // namespace iterators + +using iterators::iterator_core_access; +using iterators::iterator_facade; + +} // namespace boost + +#include + +#endif // BOOST_ITERATOR_FACADE_23022003THW_HPP diff --git a/libraries/boost/include/boost/iterator/iterator_traits.hpp b/libraries/boost/include/boost/iterator/iterator_traits.hpp new file mode 100644 index 0000000000..6582a68f50 --- /dev/null +++ b/libraries/boost/include/boost/iterator/iterator_traits.hpp @@ -0,0 +1,61 @@ +// Copyright David Abrahams 2003. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +#ifndef ITERATOR_TRAITS_DWA200347_HPP +# define ITERATOR_TRAITS_DWA200347_HPP + +# include + +#include + +namespace boost { +namespace iterators { + +// Macro for supporting old compilers, no longer needed but kept +// for backwards compatibility (it was documented). +#define BOOST_ITERATOR_CATEGORY iterator_category + + +template +struct iterator_value +{ + typedef typename std::iterator_traits::value_type type; +}; + +template +struct iterator_reference +{ + typedef typename std::iterator_traits::reference type; +}; + + +template +struct iterator_pointer +{ + typedef typename std::iterator_traits::pointer type; +}; + +template +struct iterator_difference +{ + typedef typename std::iterator_traits::difference_type type; +}; + +template +struct iterator_category +{ + typedef typename std::iterator_traits::iterator_category type; +}; + +} // namespace iterators + +using iterators::iterator_value; +using iterators::iterator_reference; +using iterators::iterator_pointer; +using iterators::iterator_difference; +using iterators::iterator_category; + +} // namespace boost + +#endif // ITERATOR_TRAITS_DWA200347_HPP diff --git a/libraries/boost/include/boost/limits.hpp b/libraries/boost/include/boost/limits.hpp new file mode 100644 index 0000000000..47d8155611 --- /dev/null +++ b/libraries/boost/include/boost/limits.hpp @@ -0,0 +1,146 @@ + +// (C) Copyright John maddock 1999. +// (C) David Abrahams 2002. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// use this header as a workaround for missing + +// See http://www.boost.org/libs/compatibility/index.html for documentation. + +#ifndef BOOST_LIMITS +#define BOOST_LIMITS + +#include + +#ifdef BOOST_NO_LIMITS +# error "There is no std::numeric_limits suppport available." +#else +# include +#endif + +#if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \ + || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS)) +// Add missing specializations for numeric_limits: +#ifdef BOOST_HAS_MS_INT64 +# define BOOST_LLT __int64 +# define BOOST_ULLT unsigned __int64 +#else +# define BOOST_LLT ::boost::long_long_type +# define BOOST_ULLT ::boost::ulong_long_type +#endif + +#include // for CHAR_BIT + +namespace std +{ + template<> + class numeric_limits + { + public: + + BOOST_STATIC_CONSTANT(bool, is_specialized = true); +#ifdef BOOST_HAS_MS_INT64 + static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x8000000000000000i64; } + static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x7FFFFFFFFFFFFFFFi64; } +#elif defined(LLONG_MAX) + static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MIN; } + static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MAX; } +#elif defined(LONGLONG_MAX) + static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MIN; } + static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MAX; } +#else + static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); } + static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~(min)(); } +#endif + BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1); + BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000); + BOOST_STATIC_CONSTANT(bool, is_signed = true); + BOOST_STATIC_CONSTANT(bool, is_integer = true); + BOOST_STATIC_CONSTANT(bool, is_exact = true); + BOOST_STATIC_CONSTANT(int, radix = 2); + static BOOST_LLT epsilon() throw() { return 0; }; + static BOOST_LLT round_error() throw() { return 0; }; + + BOOST_STATIC_CONSTANT(int, min_exponent = 0); + BOOST_STATIC_CONSTANT(int, min_exponent10 = 0); + BOOST_STATIC_CONSTANT(int, max_exponent = 0); + BOOST_STATIC_CONSTANT(int, max_exponent10 = 0); + + BOOST_STATIC_CONSTANT(bool, has_infinity = false); + BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false); + BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false); + BOOST_STATIC_CONSTANT(bool, has_denorm = false); + BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false); + static BOOST_LLT infinity() throw() { return 0; }; + static BOOST_LLT quiet_NaN() throw() { return 0; }; + static BOOST_LLT signaling_NaN() throw() { return 0; }; + static BOOST_LLT denorm_min() throw() { return 0; }; + + BOOST_STATIC_CONSTANT(bool, is_iec559 = false); + BOOST_STATIC_CONSTANT(bool, is_bounded = true); + BOOST_STATIC_CONSTANT(bool, is_modulo = true); + + BOOST_STATIC_CONSTANT(bool, traps = false); + BOOST_STATIC_CONSTANT(bool, tinyness_before = false); + BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); + + }; + + template<> + class numeric_limits + { + public: + + BOOST_STATIC_CONSTANT(bool, is_specialized = true); +#ifdef BOOST_HAS_MS_INT64 + static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0ui64; } + static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0xFFFFFFFFFFFFFFFFui64; } +#elif defined(ULLONG_MAX) && defined(ULLONG_MIN) + static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MIN; } + static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MAX; } +#elif defined(ULONGLONG_MAX) && defined(ULONGLONG_MIN) + static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MIN; } + static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MAX; } +#else + static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0uLL; } + static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~0uLL; } +#endif + BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT); + BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT)) * 301L / 1000); + BOOST_STATIC_CONSTANT(bool, is_signed = false); + BOOST_STATIC_CONSTANT(bool, is_integer = true); + BOOST_STATIC_CONSTANT(bool, is_exact = true); + BOOST_STATIC_CONSTANT(int, radix = 2); + static BOOST_ULLT epsilon() throw() { return 0; }; + static BOOST_ULLT round_error() throw() { return 0; }; + + BOOST_STATIC_CONSTANT(int, min_exponent = 0); + BOOST_STATIC_CONSTANT(int, min_exponent10 = 0); + BOOST_STATIC_CONSTANT(int, max_exponent = 0); + BOOST_STATIC_CONSTANT(int, max_exponent10 = 0); + + BOOST_STATIC_CONSTANT(bool, has_infinity = false); + BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false); + BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false); + BOOST_STATIC_CONSTANT(bool, has_denorm = false); + BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false); + static BOOST_ULLT infinity() throw() { return 0; }; + static BOOST_ULLT quiet_NaN() throw() { return 0; }; + static BOOST_ULLT signaling_NaN() throw() { return 0; }; + static BOOST_ULLT denorm_min() throw() { return 0; }; + + BOOST_STATIC_CONSTANT(bool, is_iec559 = false); + BOOST_STATIC_CONSTANT(bool, is_bounded = true); + BOOST_STATIC_CONSTANT(bool, is_modulo = true); + + BOOST_STATIC_CONSTANT(bool, traps = false); + BOOST_STATIC_CONSTANT(bool, tinyness_before = false); + BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); + + }; +} +#endif + +#endif + diff --git a/libraries/boost/include/boost/make_shared.hpp b/libraries/boost/include/boost/make_shared.hpp new file mode 100644 index 0000000000..588fbfde1b --- /dev/null +++ b/libraries/boost/include/boost/make_shared.hpp @@ -0,0 +1,16 @@ +#ifndef BOOST_MAKE_SHARED_HPP_INCLUDED +#define BOOST_MAKE_SHARED_HPP_INCLUDED + +// make_shared.hpp +// +// Copyright (c) 2007, 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include + +#endif // #ifndef BOOST_MAKE_SHARED_HPP_INCLUDED diff --git a/libraries/boost/include/boost/mem_fn.hpp b/libraries/boost/include/boost/mem_fn.hpp new file mode 100644 index 0000000000..3bcd2c548b --- /dev/null +++ b/libraries/boost/include/boost/mem_fn.hpp @@ -0,0 +1,24 @@ +#ifndef BOOST_MEM_FN_HPP_INCLUDED +#define BOOST_MEM_FN_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// mem_fn.hpp - a generalization of std::mem_fun[_ref] +// +// Copyright (c) 2009 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/mem_fn.html for documentation. +// + +#include + +#endif // #ifndef BOOST_MEM_FN_HPP_INCLUDED diff --git a/libraries/boost/include/boost/noncopyable.hpp b/libraries/boost/include/boost/noncopyable.hpp new file mode 100644 index 0000000000..e998ee864a --- /dev/null +++ b/libraries/boost/include/boost/noncopyable.hpp @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2014 Glen Fernandes + * + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_NONCOPYABLE_HPP +#define BOOST_NONCOPYABLE_HPP + +// The header file at this path is deprecated; +// use boost/core/noncopyable.hpp instead. + +#include + +#endif diff --git a/libraries/boost/include/boost/none.hpp b/libraries/boost/include/boost/none.hpp new file mode 100644 index 0000000000..a37c45c514 --- /dev/null +++ b/libraries/boost/include/boost/none.hpp @@ -0,0 +1,59 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2014, 2015 Andrzej Krzemienski. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_NONE_17SEP2003_HPP +#define BOOST_NONE_17SEP2003_HPP + +#include "boost/none_t.hpp" + +// NOTE: Borland users have to include this header outside any precompiled headers +// (bcc<=5.64 cannot include instance data in a precompiled header) +// -- * To be verified, now that there's no unnamed namespace + +namespace boost { + +#ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE + +none_t const none = (static_cast(0)) ; + +#elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE + +namespace detail { namespace optional_detail { + + // the trick here is to make boost::none defined once as a global but in a header file + template + struct none_instance + { + static const T instance; + }; + + template + const T none_instance::instance = T(); // global, but because 'tis a template, no cpp file required + +} } // namespace detail::optional_detail + + +namespace { + // TU-local + const none_t& none = detail::optional_detail::none_instance::instance; +} + +#else + +const none_t none ((none_t::init_tag())); + +#endif // older definitions + +} // namespace boost + +#endif // header guard + diff --git a/libraries/boost/include/boost/none_t.hpp b/libraries/boost/include/boost/none_t.hpp new file mode 100644 index 0000000000..008f369d1c --- /dev/null +++ b/libraries/boost/include/boost/none_t.hpp @@ -0,0 +1,39 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2014, 2015 Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_NONE_T_17SEP2003_HPP +#define BOOST_NONE_T_17SEP2003_HPP + +namespace boost { + +#ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE + +namespace detail { struct none_helper{}; } +typedef int detail::none_helper::*none_t ; + +#elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE + +class none_t {}; + +#else + +struct none_t +{ + struct init_tag{}; + explicit none_t(init_tag){} // to disable default constructor +}; + +#endif // old implementation workarounds + +} // namespace boost + +#endif // header guard diff --git a/libraries/boost/include/boost/numeric/conversion/conversion_traits.hpp b/libraries/boost/include/boost/numeric/conversion/conversion_traits.hpp new file mode 100644 index 0000000000..23e0eb8c9a --- /dev/null +++ b/libraries/boost/include/boost/numeric/conversion/conversion_traits.hpp @@ -0,0 +1,32 @@ +// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/numeric/conversion +// +// Contact the author at: fernando_cacciola@hotmail.com +// +#ifndef BOOST_NUMERIC_CONVERSION_CONVERSION_TRAITS_FLC_12NOV2002_HPP +#define BOOST_NUMERIC_CONVERSION_CONVERSION_TRAITS_FLC_12NOV2002_HPP + +#include "boost/numeric/conversion/detail/conversion_traits.hpp" +#include "boost/detail/workaround.hpp" +#include "boost/config.hpp" + +namespace boost { namespace numeric +{ + +template +struct conversion_traits + : convdetail::get_conversion_traits::type +{ +} ; + +} } // namespace boost::numeric + +#endif +// +/////////////////////////////////////////////////////////////////////////////////////////////// + + diff --git a/libraries/boost/include/boost/numeric/conversion/detail/conversion_traits.hpp b/libraries/boost/include/boost/numeric/conversion/detail/conversion_traits.hpp new file mode 100644 index 0000000000..ed25349c67 --- /dev/null +++ b/libraries/boost/include/boost/numeric/conversion/detail/conversion_traits.hpp @@ -0,0 +1,97 @@ +// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/numeric/conversion +// +// Contact the author at: fernando_cacciola@hotmail.com +// +#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP +#define BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP + +#include "boost/type_traits/is_arithmetic.hpp" +#include "boost/type_traits/is_same.hpp" +#include "boost/type_traits/remove_cv.hpp" + +#include "boost/numeric/conversion/detail/meta.hpp" +#include "boost/numeric/conversion/detail/int_float_mixture.hpp" +#include "boost/numeric/conversion/detail/sign_mixture.hpp" +#include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp" +#include "boost/numeric/conversion/detail/is_subranged.hpp" + +namespace boost { namespace numeric { namespace convdetail +{ + //------------------------------------------------------------------- + // Implementation of the Conversion Traits for T != S + // + // This is a VISIBLE base class of the user-level conversion_traits<> class. + //------------------------------------------------------------------- + template + struct non_trivial_traits_impl + { + typedef typename get_int_float_mixture ::type int_float_mixture ; + typedef typename get_sign_mixture ::type sign_mixture ; + typedef typename get_udt_builtin_mixture ::type udt_builtin_mixture ; + + typedef typename get_is_subranged::type subranged ; + + typedef mpl::false_ trivial ; + + typedef T target_type ; + typedef S source_type ; + typedef T result_type ; + + typedef typename mpl::if_< is_arithmetic, S, S const&>::type argument_type ; + + typedef typename mpl::if_::type supertype ; + typedef typename mpl::if_::type subtype ; + } ; + + //------------------------------------------------------------------- + // Implementation of the Conversion Traits for T == S + // + // This is a VISIBLE base class of the user-level conversion_traits<> class. + //------------------------------------------------------------------- + template + struct trivial_traits_impl + { + typedef typename get_int_float_mixture ::type int_float_mixture ; + typedef typename get_sign_mixture ::type sign_mixture ; + typedef typename get_udt_builtin_mixture::type udt_builtin_mixture ; + + typedef mpl::false_ subranged ; + typedef mpl::true_ trivial ; + + typedef N target_type ; + typedef N source_type ; + typedef N const& result_type ; + typedef N const& argument_type ; + + typedef N supertype ; + typedef N subtype ; + + } ; + + //------------------------------------------------------------------- + // Top level implementation selector. + //------------------------------------------------------------------- + template + struct get_conversion_traits + { + typedef typename remove_cv::type target_type ; + typedef typename remove_cv::type source_type ; + + typedef typename is_same::type is_trivial ; + + typedef trivial_traits_impl trivial_imp ; + typedef non_trivial_traits_impl non_trivial_imp ; + + typedef typename mpl::if_::type type ; + } ; + +} } } // namespace boost::numeric::convdetail + +#endif + + diff --git a/libraries/boost/include/boost/numeric/conversion/detail/int_float_mixture.hpp b/libraries/boost/include/boost/numeric/conversion/detail/int_float_mixture.hpp new file mode 100644 index 0000000000..464e52753f --- /dev/null +++ b/libraries/boost/include/boost/numeric/conversion/detail/int_float_mixture.hpp @@ -0,0 +1,72 @@ +// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/numeric/conversion +// +// Contact the author at: fernando_cacciola@hotmail.com +// +#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP +#define BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP + +#include "boost/config.hpp" +#include "boost/limits.hpp" + +#include "boost/numeric/conversion/int_float_mixture_enum.hpp" +#include "boost/numeric/conversion/detail/meta.hpp" + +#include "boost/mpl/integral_c.hpp" + +namespace boost { namespace numeric { namespace convdetail +{ + // Integral Constants for 'IntFloatMixture' + typedef mpl::integral_c int2int_c ; + typedef mpl::integral_c int2float_c ; + typedef mpl::integral_c float2int_c ; + typedef mpl::integral_c float2float_c ; + + // Metafunction: + // + // get_int_float_mixture::type + // + // Selects the appropriate Int-Float Mixture Integral Constant for the combination T,S. + // + template + struct get_int_float_mixture + { + typedef mpl::bool_< ::std::numeric_limits::is_integer > S_int ; + typedef mpl::bool_< ::std::numeric_limits::is_integer > T_int ; + + typedef typename + for_both::type + type ; + } ; + + // Metafunction: + // + // for_int_float_mixture::type + // + // {Mixture} is one of the Integral Constants for Mixture, declared above. + // {int_int,int_float,float_int,float_float} are aribtrary types. (not metafunctions) + // + // According to the value of 'IntFloatMixture', selects the corresponding type. + // + template + struct for_int_float_mixture + { + typedef typename + ct_switch4::type + type ; + } ; + +} } } // namespace boost::numeric::convdetail + +#endif +// +/////////////////////////////////////////////////////////////////////////////////////////////// + + diff --git a/libraries/boost/include/boost/numeric/conversion/detail/is_subranged.hpp b/libraries/boost/include/boost/numeric/conversion/detail/is_subranged.hpp new file mode 100644 index 0000000000..b5e7fe8f1e --- /dev/null +++ b/libraries/boost/include/boost/numeric/conversion/detail/is_subranged.hpp @@ -0,0 +1,234 @@ +// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/numeric/conversion +// +// Contact the author at: fernando_cacciola@hotmail.com +// +#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_IS_SUBRANGED_FLC_12NOV2002_HPP +#define BOOST_NUMERIC_CONVERSION_DETAIL_IS_SUBRANGED_FLC_12NOV2002_HPP + +#include "boost/config.hpp" +#include "boost/limits.hpp" + +#include "boost/mpl/int.hpp" +#include "boost/mpl/multiplies.hpp" +#include "boost/mpl/less.hpp" +#include "boost/mpl/equal_to.hpp" + +#include "boost/type_traits/is_same.hpp" + +#include "boost/numeric/conversion/detail/meta.hpp" +#include "boost/numeric/conversion/detail/int_float_mixture.hpp" +#include "boost/numeric/conversion/detail/sign_mixture.hpp" +#include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp" + +namespace boost { namespace numeric { namespace convdetail +{ + //--------------------------------------------------------------- + // Implementations of the compile time predicate "T is subranged" + //--------------------------------------------------------------- + + // for integral to integral conversions + template + struct subranged_Sig2Unsig + { + // Signed to unsigned conversions are 'subranged' because of possible loose + // of negative values. + typedef mpl::true_ type ; + } ; + + // for unsigned integral to signed integral conversions + template + struct subranged_Unsig2Sig + { + // IMPORTANT NOTE: + // + // This code assumes that signed/unsigned integral values are represented + // such that: + // + // numeric_limits::digits + 1 == numeric_limits::digits + // + // The '+1' is required since numeric_limits<>::digits gives 1 bit less for signed integral types. + // + // This fact is used by the following logic: + // + // if ( (numeric_limits::digits+1) < (2*numeric_limits::digits) ) + // then the conversion is subranged. + // + + typedef mpl::int_< ::std::numeric_limits::digits > S_digits ; + typedef mpl::int_< ::std::numeric_limits::digits > T_digits ; + + // T is signed, so take digits+1 + typedef typename T_digits::next u_T_digits ; + + typedef mpl::int_<2> Two ; + + typedef typename mpl::multiplies::type S_digits_times_2 ; + + typedef typename mpl::less::type type ; + } ; + + // for integral to integral conversions of the same sign. + template + struct subranged_SameSign + { + // An integral conversion of the same sign is subranged if digits(T) < digits(S). + + typedef mpl::int_< ::std::numeric_limits::digits > S_digits ; + typedef mpl::int_< ::std::numeric_limits::digits > T_digits ; + + typedef typename mpl::less::type type ; + } ; + + // for integral to float conversions + template + struct subranged_Int2Float + { + typedef mpl::false_ type ; + } ; + + // for float to integral conversions + template + struct subranged_Float2Int + { + typedef mpl::true_ type ; + } ; + + // for float to float conversions + template + struct subranged_Float2Float + { + // If both T and S are floats, + // compare exponent bits and if they match, mantisa bits. + + typedef mpl::int_< ::std::numeric_limits::digits > S_mantisa ; + typedef mpl::int_< ::std::numeric_limits::digits > T_mantisa ; + + typedef mpl::int_< ::std::numeric_limits::max_exponent > S_exponent ; + typedef mpl::int_< ::std::numeric_limits::max_exponent > T_exponent ; + + typedef typename mpl::less::type T_smaller_exponent ; + + typedef typename mpl::equal_to::type equal_exponents ; + + typedef mpl::less T_smaller_mantisa ; + + typedef mpl::eval_if not_bigger_exponent_case ; + + typedef typename + mpl::eval_if::type + type ; + } ; + + // for Udt to built-in conversions + template + struct subranged_Udt2BuiltIn + { + typedef mpl::true_ type ; + } ; + + // for built-in to Udt conversions + template + struct subranged_BuiltIn2Udt + { + typedef mpl::false_ type ; + } ; + + // for Udt to Udt conversions + template + struct subranged_Udt2Udt + { + typedef mpl::false_ type ; + } ; + + //------------------------------------------------------------------- + // Selectors for the implementations of the subranged predicate + //------------------------------------------------------------------- + + template + struct get_subranged_Int2Int + { + typedef subranged_SameSign Sig2Sig ; + typedef subranged_Sig2Unsig Sig2Unsig ; + typedef subranged_Unsig2Sig Unsig2Sig ; + typedef Sig2Sig Unsig2Unsig ; + + typedef typename get_sign_mixture::type sign_mixture ; + + typedef typename + for_sign_mixture::type + type ; + } ; + + template + struct get_subranged_BuiltIn2BuiltIn + { + typedef get_subranged_Int2Int Int2IntQ ; + + typedef subranged_Int2Float Int2Float ; + typedef subranged_Float2Int Float2Int ; + typedef subranged_Float2Float Float2Float ; + + typedef mpl::identity Int2FloatQ ; + typedef mpl::identity Float2IntQ ; + typedef mpl::identity Float2FloatQ ; + + typedef typename get_int_float_mixture::type int_float_mixture ; + + typedef for_int_float_mixture for_ ; + + typedef typename for_::type selected ; + + typedef typename selected::type type ; + } ; + + template + struct get_subranged + { + typedef get_subranged_BuiltIn2BuiltIn BuiltIn2BuiltInQ ; + + typedef subranged_BuiltIn2Udt BuiltIn2Udt ; + typedef subranged_Udt2BuiltIn Udt2BuiltIn ; + typedef subranged_Udt2Udt Udt2Udt ; + + typedef mpl::identity BuiltIn2UdtQ ; + typedef mpl::identity Udt2BuiltInQ ; + typedef mpl::identity Udt2UdtQ ; + + typedef typename get_udt_builtin_mixture::type udt_builtin_mixture ; + + typedef typename + for_udt_builtin_mixture::type + selected ; + + typedef typename selected::type selected2 ; + + typedef typename selected2::type type ; + } ; + + + //------------------------------------------------------------------- + // Top level implementation selector. + //------------------------------------------------------------------- + template + struct get_is_subranged + { + typedef get_subranged non_trivial_case ; + typedef mpl::identity trivial_case ; + + typedef is_same is_trivial ; + + typedef typename mpl::if_::type selected ; + + typedef typename selected::type type ; + } ; + +} } } // namespace boost::numeric::convdetail + +#endif + + diff --git a/libraries/boost/include/boost/numeric/conversion/detail/meta.hpp b/libraries/boost/include/boost/numeric/conversion/detail/meta.hpp new file mode 100644 index 0000000000..246a1b4702 --- /dev/null +++ b/libraries/boost/include/boost/numeric/conversion/detail/meta.hpp @@ -0,0 +1,120 @@ +// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/numeric/conversion +// +// Contact the author at: fernando_cacciola@hotmail.com +// +#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_META_FLC_12NOV2002_HPP +#define BOOST_NUMERIC_CONVERSION_DETAIL_META_FLC_12NOV2002_HPP + +#include "boost/type_traits/remove_cv.hpp" + +#include "boost/mpl/if.hpp" +#include "boost/mpl/eval_if.hpp" +#include "boost/mpl/equal_to.hpp" +#include "boost/mpl/not.hpp" +#include "boost/mpl/and.hpp" +#include "boost/mpl/bool.hpp" +#include "boost/mpl/identity.hpp" + +namespace boost { namespace numeric { namespace convdetail +{ + template< class T1, class T2> + struct equal_to + { + #if !defined(__BORLANDC__) + + enum { x = ( BOOST_MPL_AUX_VALUE_WKND(T1)::value == BOOST_MPL_AUX_VALUE_WKND(T2)::value ) }; + + BOOST_STATIC_CONSTANT(bool, value = x); + + typedef mpl::bool_ type; + + #else + + BOOST_STATIC_CONSTANT(bool, value = ( + BOOST_MPL_AUX_VALUE_WKND(T1)::value + == BOOST_MPL_AUX_VALUE_WKND(T2)::value + )); + + typedef mpl::bool_<( + BOOST_MPL_AUX_VALUE_WKND(T1)::value + == BOOST_MPL_AUX_VALUE_WKND(T2)::value + )> type; + #endif + }; + +// Metafunction: + // + // ct_switch4::type + // + // {Value,Case(X)Val} are Integral Constants (such as: mpl::int_<>) + // {Case(X)Type,DefaultType} are arbitrary types. (not metafunctions) + // + // Returns Case(X)Type if Val==Case(X)Val; DefaultType otherwise. + // + template + struct ct_switch4 + { + typedef mpl::identity Case0TypeQ ; + typedef mpl::identity Case1TypeQ ; + + typedef equal_to is_case0 ; + typedef equal_to is_case1 ; + typedef equal_to is_case2 ; + + typedef mpl::if_ choose_2_3Q ; + typedef mpl::eval_if choose_1_2_3Q ; + + typedef typename + mpl::eval_if::type + type ; + } ; + + + + + // Metafunction: + // + // for_both::type + // + // {exp0,expr1} are Boolean Integral Constants + // {TT,TF,FT,FF} are aribtrary types. (not metafunctions) + // + // According to the combined boolean value of 'expr0 && expr1', selects the corresponding type. + // + template + struct for_both + { + typedef mpl::identity TF_Q ; + typedef mpl::identity TT_Q ; + + typedef typename mpl::not_::type not_expr0 ; + typedef typename mpl::not_::type not_expr1 ; + + typedef typename mpl::and_::type caseTT ; + typedef typename mpl::and_::type caseTF ; + typedef typename mpl::and_::type caseFT ; + + typedef mpl::if_ choose_FT_FF_Q ; + typedef mpl::eval_if choose_TF_FT_FF_Q ; + + typedef typename mpl::eval_if::type type ; + } ; + +} } } // namespace boost::numeric::convdetail + +#endif + + diff --git a/libraries/boost/include/boost/numeric/conversion/detail/sign_mixture.hpp b/libraries/boost/include/boost/numeric/conversion/detail/sign_mixture.hpp new file mode 100644 index 0000000000..c7f9e42afe --- /dev/null +++ b/libraries/boost/include/boost/numeric/conversion/detail/sign_mixture.hpp @@ -0,0 +1,72 @@ +// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/numeric/conversion +// +// Contact the author at: fernando_cacciola@hotmail.com +// +#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_SIGN_MIXTURE_FLC_12NOV2002_HPP +#define BOOST_NUMERIC_CONVERSION_DETAIL_SIGN_MIXTURE_FLC_12NOV2002_HPP + +#include "boost/config.hpp" +#include "boost/limits.hpp" + +#include "boost/numeric/conversion/sign_mixture_enum.hpp" +#include "boost/numeric/conversion/detail/meta.hpp" + +#include "boost/mpl/integral_c.hpp" + +namespace boost { namespace numeric { namespace convdetail +{ + // Integral Constants for 'SignMixture' + typedef mpl::integral_c unsig2unsig_c ; + typedef mpl::integral_c sig2sig_c ; + typedef mpl::integral_c sig2unsig_c ; + typedef mpl::integral_c unsig2sig_c ; + + // Metafunction: + // + // get_sign_mixture::type + // + // Selects the appropriate SignMixture Integral Constant for the combination T,S. + // + template + struct get_sign_mixture + { + typedef mpl::bool_< ::std::numeric_limits::is_signed > S_signed ; + typedef mpl::bool_< ::std::numeric_limits::is_signed > T_signed ; + + typedef typename + for_both::type + type ; + } ; + + // Metafunction: + // + // for_sign_mixture::type + // + // {SignMixture} is one of the Integral Constants for SignMixture, declared above. + // {Sig2Sig,Sig2Unsig,Unsig2Sig,Unsig2Unsig} are aribtrary types. (not metafunctions) + // + // According to the value of 'SignMixture', selects the corresponding type. + // + template + struct for_sign_mixture + { + typedef typename + ct_switch4::type + type ; + } ; + +} } } // namespace boost::numeric::convdetail + +#endif +// +/////////////////////////////////////////////////////////////////////////////////////////////// + + diff --git a/libraries/boost/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp b/libraries/boost/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp new file mode 100644 index 0000000000..36dbc491b5 --- /dev/null +++ b/libraries/boost/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp @@ -0,0 +1,69 @@ +// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/numeric/conversion +// +// Contact the author at: fernando_cacciola@hotmail.com +// +#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP +#define BOOST_NUMERIC_CONVERSION_DETAIL_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP + +#include "boost/type_traits/is_arithmetic.hpp" + +#include "boost/numeric/conversion/udt_builtin_mixture_enum.hpp" +#include "boost/numeric/conversion/detail/meta.hpp" + +#include "boost/mpl/integral_c.hpp" + +namespace boost { namespace numeric { namespace convdetail +{ + // Integral Constants for 'UdtMixture' + typedef mpl::integral_c builtin2builtin_c ; + typedef mpl::integral_c builtin2udt_c ; + typedef mpl::integral_c udt2builtin_c ; + typedef mpl::integral_c udt2udt_c ; + + // Metafunction: + // + // for_udt_mixture::type + // + // {UdtMixture} is one of the Integral Constants for UdMixture, declared above. + // {BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt} are aribtrary types. (not metafunctions) + // + // According to the value of 'UdtMixture', selects the corresponding type. + // + template + struct for_udt_builtin_mixture + { + typedef typename + ct_switch4::type + type ; + } ; + + // Metafunction: + // + // get_udt_mixture::type + // + // Selects the appropriate UdtMixture Integral Constant for the combination T,S. + // + template + struct get_udt_builtin_mixture + { + typedef is_arithmetic S_builtin ; + typedef is_arithmetic T_builtin ; + + typedef typename + for_both::type + type ; + } ; + +} } } // namespace boost::numeric::convdetail + +#endif + + diff --git a/libraries/boost/include/boost/numeric/conversion/int_float_mixture_enum.hpp b/libraries/boost/include/boost/numeric/conversion/int_float_mixture_enum.hpp new file mode 100644 index 0000000000..d0c2daacfc --- /dev/null +++ b/libraries/boost/include/boost/numeric/conversion/int_float_mixture_enum.hpp @@ -0,0 +1,29 @@ +// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/numeric/conversion +// +// Contact the author at: fernando_cacciola@hotmail.com +// +#ifndef BOOST_NUMERIC_CONVERSION_INT_FLOAT_MIXTURE_ENUM_FLC_12NOV2002_HPP +#define BOOST_NUMERIC_CONVERSION_INT_FLOAT_MIXTURE_ENUM_FLC_12NOV2002_HPP + +namespace boost { namespace numeric +{ + enum int_float_mixture_enum + { + integral_to_integral + ,integral_to_float + ,float_to_integral + ,float_to_float + } ; + +} } // namespace boost::numeric + +#endif +// +/////////////////////////////////////////////////////////////////////////////////////////////// + + diff --git a/libraries/boost/include/boost/numeric/conversion/sign_mixture_enum.hpp b/libraries/boost/include/boost/numeric/conversion/sign_mixture_enum.hpp new file mode 100644 index 0000000000..1525f8d33c --- /dev/null +++ b/libraries/boost/include/boost/numeric/conversion/sign_mixture_enum.hpp @@ -0,0 +1,29 @@ +// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/numeric/conversion +// +// Contact the author at: fernando_cacciola@hotmail.com +// +#ifndef BOOST_NUMERIC_CONVERSION_SIGN_MIXTURE_ENUM_FLC_12NOV2002_HPP +#define BOOST_NUMERIC_CONVERSION_SIGN_MIXTURE_ENUM_FLC_12NOV2002_HPP + +namespace boost { namespace numeric +{ + enum sign_mixture_enum + { + unsigned_to_unsigned + ,signed_to_signed + ,signed_to_unsigned + ,unsigned_to_signed + } ; + +} } // namespace boost::numeric + +#endif +// +/////////////////////////////////////////////////////////////////////////////////////////////// + + diff --git a/libraries/boost/include/boost/numeric/conversion/udt_builtin_mixture_enum.hpp b/libraries/boost/include/boost/numeric/conversion/udt_builtin_mixture_enum.hpp new file mode 100644 index 0000000000..2540e80630 --- /dev/null +++ b/libraries/boost/include/boost/numeric/conversion/udt_builtin_mixture_enum.hpp @@ -0,0 +1,26 @@ +// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/numeric/conversion +// +// Contact the author at: fernando_cacciola@hotmail.com +// +#ifndef BOOST_NUMERIC_CONVERSION_UDT_BUILTIN_MIXTURE_ENUM_FLC_12NOV2002_HPP +#define BOOST_NUMERIC_CONVERSION_UDT_BUILTIN_MIXTURE_ENUM_FLC_12NOV2002_HPP + +namespace boost { namespace numeric +{ + enum udt_builtin_mixture_enum + { + builtin_to_builtin + ,builtin_to_udt + ,udt_to_builtin + ,udt_to_udt + } ; + +} } // namespace boost::numeric + +#endif + diff --git a/libraries/boost/include/boost/optional.hpp b/libraries/boost/include/boost/optional.hpp new file mode 100644 index 0000000000..40cf12e656 --- /dev/null +++ b/libraries/boost/include/boost/optional.hpp @@ -0,0 +1,18 @@ +// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +#ifndef BOOST_OPTIONAL_FLC_19NOV2002_HPP +#define BOOST_OPTIONAL_FLC_19NOV2002_HPP + +#include "boost/optional/optional.hpp" + +#endif + diff --git a/libraries/boost/include/boost/optional/bad_optional_access.hpp b/libraries/boost/include/boost/optional/bad_optional_access.hpp new file mode 100644 index 0000000000..cabf43fbac --- /dev/null +++ b/libraries/boost/include/boost/optional/bad_optional_access.hpp @@ -0,0 +1,32 @@ +// Copyright (C) 2014, Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// akrzemi1@gmail.com +// +#ifndef BOOST_BAD_OPTIONAL_ACCESS_22MAY2014_HPP +#define BOOST_BAD_OPTIONAL_ACCESS_22MAY2014_HPP + +#include +#if __cplusplus < 201103L +#include // to make converting-ctor std::string(char const*) visible +#endif + +namespace boost { + +class bad_optional_access : public std::logic_error +{ +public: + bad_optional_access() + : std::logic_error("Attempted to access the value of an uninitialized optional object.") + {} +}; + +} // namespace boost + +#endif diff --git a/libraries/boost/include/boost/optional/detail/old_optional_implementation.hpp b/libraries/boost/include/boost/optional/detail/old_optional_implementation.hpp new file mode 100644 index 0000000000..62c31eeceb --- /dev/null +++ b/libraries/boost/include/boost/optional/detail/old_optional_implementation.hpp @@ -0,0 +1,1059 @@ +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. +// Copyright (C) 2014-2016 Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the maintainer at: +// akrzemi1@gmail.com + +#ifndef BOOST_OPTIONAL_DETAIL_OLD_OPTIONAL_IMPLEMENTATION_AJK_28JAN2015_HPP +#define BOOST_OPTIONAL_DETAIL_OLD_OPTIONAL_IMPLEMENTATION_AJK_28JAN2015_HPP + +#include +#include +#include +#include +#include + +namespace boost { + +namespace optional_detail { + + +template +struct types_when_isnt_ref +{ + typedef T const& reference_const_type ; + typedef T & reference_type ; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + typedef T && rval_reference_type ; + typedef T && reference_type_of_temporary_wrapper; +#ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + // GCC 4.4 has support for an early draft of rvalue references. The conforming version below + // causes warnings about returning references to a temporary. + static T&& move(T&& r) { return r; } +#else + static rval_reference_type move(reference_type r) { return boost::move(r); } +#endif +#endif + typedef T const* pointer_const_type ; + typedef T * pointer_type ; + typedef T const& argument_type ; +} ; + +template +struct types_when_is_ref +{ + typedef BOOST_DEDUCED_TYPENAME remove_reference::type raw_type ; + + typedef raw_type& reference_const_type ; + typedef raw_type& reference_type ; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + typedef BOOST_DEDUCED_TYPENAME remove_const::type&& rval_reference_type ; + typedef raw_type& reference_type_of_temporary_wrapper; + static reference_type move(reference_type r) { return r; } +#endif + typedef raw_type* pointer_const_type ; + typedef raw_type* pointer_type ; + typedef raw_type& argument_type ; +} ; + +template +void prevent_binding_rvalue_ref_to_optional_lvalue_ref() +{ +#ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES + BOOST_STATIC_ASSERT_MSG( + !boost::is_lvalue_reference::value || !boost::is_rvalue_reference::value, + "binding rvalue references to optional lvalue references is disallowed"); +#endif +} + +struct optional_tag {} ; + +template +class optional_base : public optional_tag +{ + private : + + typedef +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + BOOST_DEDUCED_TYPENAME +#endif + ::boost::detail::make_reference_content::type internal_type ; + + typedef aligned_storage storage_type ; + + typedef types_when_isnt_ref types_when_not_ref ; + typedef types_when_is_ref types_when_ref ; + + typedef optional_base this_type ; + + protected : + + typedef T value_type ; + + typedef mpl::true_ is_reference_tag ; + typedef mpl::false_ is_not_reference_tag ; + + typedef BOOST_DEDUCED_TYPENAME is_reference::type is_reference_predicate ; + + public: + typedef BOOST_DEDUCED_TYPENAME mpl::if_::type types ; + + protected: + typedef BOOST_DEDUCED_TYPENAME types::reference_type reference_type ; + typedef BOOST_DEDUCED_TYPENAME types::reference_const_type reference_const_type ; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + typedef BOOST_DEDUCED_TYPENAME types::rval_reference_type rval_reference_type ; + typedef BOOST_DEDUCED_TYPENAME types::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ; +#endif + typedef BOOST_DEDUCED_TYPENAME types::pointer_type pointer_type ; + typedef BOOST_DEDUCED_TYPENAME types::pointer_const_type pointer_const_type ; + typedef BOOST_DEDUCED_TYPENAME types::argument_type argument_type ; + + // Creates an optional uninitialized. + // No-throw + optional_base() + : + m_initialized(false) {} + + // Creates an optional uninitialized. + // No-throw + optional_base ( none_t ) + : + m_initialized(false) {} + + // Creates an optional initialized with 'val'. + // Can throw if T::T(T const&) does + optional_base ( argument_type val ) + : + m_initialized(false) + { + construct(val); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // move-construct an optional initialized from an rvalue-ref to 'val'. + // Can throw if T::T(T&&) does + optional_base ( rval_reference_type val ) + : + m_initialized(false) + { + construct( boost::move(val) ); + } +#endif + + // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. + // Can throw if T::T(T const&) does + optional_base ( bool cond, argument_type val ) + : + m_initialized(false) + { + if ( cond ) + construct(val); + } + + // Creates a deep copy of another optional + // Can throw if T::T(T const&) does + optional_base ( optional_base const& rhs ) + : + m_initialized(false) + { + if ( rhs.is_initialized() ) + construct(rhs.get_impl()); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates a deep move of another optional + // Can throw if T::T(T&&) does + optional_base ( optional_base&& rhs ) + : + m_initialized(false) + { + if ( rhs.is_initialized() ) + construct( boost::move(rhs.get_impl()) ); + } +#endif + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + template + explicit optional_base ( Expr&& expr, PtrExpr const* tag ) + : + m_initialized(false) + { + construct(boost::forward(expr),tag); + } + +#else + // This is used for both converting and in-place constructions. + // Derived classes use the 'tag' to select the appropriate + // implementation (the correct 'construct()' overload) + template + explicit optional_base ( Expr const& expr, Expr const* tag ) + : + m_initialized(false) + { + construct(expr,tag); + } + +#endif + + + // No-throw (assuming T::~T() doesn't) + ~optional_base() { destroy() ; } + + // Assigns from another optional (deep-copies the rhs value) + void assign ( optional_base const& rhs ) + { + if (is_initialized()) + { + if ( rhs.is_initialized() ) + assign_value(rhs.get_impl(), is_reference_predicate() ); + else destroy(); + } + else + { + if ( rhs.is_initialized() ) + construct(rhs.get_impl()); + } + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from another optional (deep-moves the rhs value) + void assign ( optional_base&& rhs ) + { + if (is_initialized()) + { + if ( rhs.is_initialized() ) + assign_value(boost::move(rhs.get_impl()), is_reference_predicate() ); + else destroy(); + } + else + { + if ( rhs.is_initialized() ) + construct(boost::move(rhs.get_impl())); + } + } +#endif + + // Assigns from another _convertible_ optional (deep-copies the rhs value) + template + void assign ( optional const& rhs ) + { + if (is_initialized()) + { + if ( rhs.is_initialized() ) +#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES + assign_value(rhs.get(), is_reference_predicate() ); +#else + assign_value(static_cast(rhs.get()), is_reference_predicate() ); +#endif + + else destroy(); + } + else + { + if ( rhs.is_initialized() ) +#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES + construct(rhs.get()); +#else + construct(static_cast(rhs.get())); +#endif + } + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // move-assigns from another _convertible_ optional (deep-moves from the rhs value) + template + void assign ( optional&& rhs ) + { + typedef BOOST_DEDUCED_TYPENAME optional::rval_reference_type ref_type; + if (is_initialized()) + { + if ( rhs.is_initialized() ) + assign_value(static_cast(rhs.get()), is_reference_predicate() ); + else destroy(); + } + else + { + if ( rhs.is_initialized() ) + construct(static_cast(rhs.get())); + } + } +#endif + + // Assigns from a T (deep-copies the rhs value) + void assign ( argument_type val ) + { + if (is_initialized()) + assign_value(val, is_reference_predicate() ); + else construct(val); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from a T (deep-moves the rhs value) + void assign ( rval_reference_type val ) + { + if (is_initialized()) + assign_value( boost::move(val), is_reference_predicate() ); + else construct( boost::move(val) ); + } +#endif + + // Assigns from "none", destroying the current value, if any, leaving this UNINITIALIZED + // No-throw (assuming T::~T() doesn't) + void assign ( none_t ) BOOST_NOEXCEPT { destroy(); } + +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + template + void assign_expr ( Expr&& expr, ExprPtr const* tag ) + { + if (is_initialized()) + assign_expr_to_initialized(boost::forward(expr),tag); + else construct(boost::forward(expr),tag); + } +#else + template + void assign_expr ( Expr const& expr, Expr const* tag ) + { + if (is_initialized()) + assign_expr_to_initialized(expr,tag); + else construct(expr,tag); + } +#endif + +#endif + + public : + + // **DEPPRECATED** Destroys the current value, if any, leaving this UNINITIALIZED + // No-throw (assuming T::~T() doesn't) + void reset() BOOST_NOEXCEPT { destroy(); } + + // **DEPPRECATED** Replaces the current value -if any- with 'val' + void reset ( argument_type val ) { assign(val); } + + // Returns a pointer to the value if this is initialized, otherwise, + // returns NULL. + // No-throw + pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; } + pointer_type get_ptr() { return m_initialized ? get_ptr_impl() : 0 ; } + + bool is_initialized() const { return m_initialized ; } + + protected : + + void construct ( argument_type val ) + { + ::new (m_storage.address()) internal_type(val) ; + m_initialized = true ; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + void construct ( rval_reference_type val ) + { + ::new (m_storage.address()) internal_type( types::move(val) ) ; + m_initialized = true ; + } +#endif + + +#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) + // Constructs in-place + // upon exception *this is always uninitialized + template + void emplace_assign ( Args&&... args ) + { + destroy(); + ::new (m_storage.address()) internal_type( boost::forward(args)... ); + m_initialized = true ; + } +#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + template + void emplace_assign ( Arg&& arg ) + { + destroy(); + ::new (m_storage.address()) internal_type( boost::forward(arg) ); + m_initialized = true ; + } + + void emplace_assign () + { + destroy(); + ::new (m_storage.address()) internal_type(); + m_initialized = true ; + } +#else + template + void emplace_assign ( const Arg& arg ) + { + destroy(); + ::new (m_storage.address()) internal_type( arg ); + m_initialized = true ; + } + + template + void emplace_assign ( Arg& arg ) + { + destroy(); + ::new (m_storage.address()) internal_type( arg ); + m_initialized = true ; + } + + void emplace_assign () + { + destroy(); + ::new (m_storage.address()) internal_type(); + m_initialized = true ; + } +#endif + +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Constructs in-place using the given factory + template + void construct ( Expr&& factory, in_place_factory_base const* ) + { + BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; + boost_optional_detail::construct(factory, m_storage.address()); + m_initialized = true ; + } + + // Constructs in-place using the given typed factory + template + void construct ( Expr&& factory, typed_in_place_factory_base const* ) + { + BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; + factory.apply(m_storage.address()) ; + m_initialized = true ; + } + + template + void assign_expr_to_initialized ( Expr&& factory, in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + + // Constructs in-place using the given typed factory + template + void assign_expr_to_initialized ( Expr&& factory, typed_in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + +#else + // Constructs in-place using the given factory + template + void construct ( Expr const& factory, in_place_factory_base const* ) + { + BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; + boost_optional_detail::construct(factory, m_storage.address()); + m_initialized = true ; + } + + // Constructs in-place using the given typed factory + template + void construct ( Expr const& factory, typed_in_place_factory_base const* ) + { + BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; + factory.apply(m_storage.address()) ; + m_initialized = true ; + } + + template + void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + + // Constructs in-place using the given typed factory + template + void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } +#endif + +#endif + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Constructs using any expression implicitly convertible to the single argument + // of a one-argument T constructor. + // Converting constructions of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting constructor of T from U. + template + void construct ( Expr&& expr, void const* ) + { + new (m_storage.address()) internal_type(boost::forward(expr)) ; + m_initialized = true ; + } + + // Assigns using a form any expression implicitly convertible to the single argument + // of a T's assignment operator. + // Converting assignments of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting assignment of T from U. + template + void assign_expr_to_initialized ( Expr&& expr, void const* ) + { + assign_value(boost::forward(expr), is_reference_predicate()); + } +#else + // Constructs using any expression implicitly convertible to the single argument + // of a one-argument T constructor. + // Converting constructions of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting constructor of T from U. + template + void construct ( Expr const& expr, void const* ) + { + new (m_storage.address()) internal_type(expr) ; + m_initialized = true ; + } + + // Assigns using a form any expression implicitly convertible to the single argument + // of a T's assignment operator. + // Converting assignments of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting assignment of T from U. + template + void assign_expr_to_initialized ( Expr const& expr, void const* ) + { + assign_value(expr, is_reference_predicate()); + } + +#endif + +#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION + // BCB5.64 (and probably lower versions) workaround. + // The in-place factories are supported by means of catch-all constructors + // and assignment operators (the functions are parameterized in terms of + // an arbitrary 'Expr' type) + // This compiler incorrectly resolves the overload set and sinks optional and optional + // to the 'Expr'-taking functions even though explicit overloads are present for them. + // Thus, the following overload is needed to properly handle the case when the 'lhs' + // is another optional. + // + // For VC<=70 compilers this workaround dosen't work becasue the comnpiler issues and error + // instead of choosing the wrong overload + // +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Notice that 'Expr' will be optional or optional (but not optional_base<..>) + template + void construct ( Expr&& expr, optional_tag const* ) + { + if ( expr.is_initialized() ) + { + // An exception can be thrown here. + // It it happens, THIS will be left uninitialized. + new (m_storage.address()) internal_type(types::move(expr.get())) ; + m_initialized = true ; + } + } +#else + // Notice that 'Expr' will be optional or optional (but not optional_base<..>) + template + void construct ( Expr const& expr, optional_tag const* ) + { + if ( expr.is_initialized() ) + { + // An exception can be thrown here. + // It it happens, THIS will be left uninitialized. + new (m_storage.address()) internal_type(expr.get()) ; + m_initialized = true ; + } + } +#endif +#endif // defined BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION + + void assign_value ( argument_type val, is_not_reference_tag ) { get_impl() = val; } + void assign_value ( argument_type val, is_reference_tag ) { construct(val); } +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + void assign_value ( rval_reference_type val, is_not_reference_tag ) { get_impl() = static_cast(val); } + void assign_value ( rval_reference_type val, is_reference_tag ) { construct( static_cast(val) ); } +#endif + + void destroy() + { + if ( m_initialized ) + destroy_impl(is_reference_predicate()) ; + } + + reference_const_type get_impl() const { return dereference(get_object(), is_reference_predicate() ) ; } + reference_type get_impl() { return dereference(get_object(), is_reference_predicate() ) ; } + + pointer_const_type get_ptr_impl() const { return cast_ptr(get_object(), is_reference_predicate() ) ; } + pointer_type get_ptr_impl() { return cast_ptr(get_object(), is_reference_predicate() ) ; } + + private : + + // internal_type can be either T or reference_content +#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) + // This workaround is supposed to silence GCC warnings about broken strict aliasing rules + internal_type const* get_object() const + { + union { void const* ap_pvoid; internal_type const* as_ptype; } caster = { m_storage.address() }; + return caster.as_ptype; + } + internal_type * get_object() + { + union { void* ap_pvoid; internal_type* as_ptype; } caster = { m_storage.address() }; + return caster.as_ptype; + } +#else + internal_type const* get_object() const { return static_cast(m_storage.address()); } + internal_type * get_object() { return static_cast (m_storage.address()); } +#endif + + // reference_content lacks an implicit conversion to T&, so the following is needed to obtain a proper reference. + reference_const_type dereference( internal_type const* p, is_not_reference_tag ) const { return *p ; } + reference_type dereference( internal_type* p, is_not_reference_tag ) { return *p ; } + reference_const_type dereference( internal_type const* p, is_reference_tag ) const { return p->get() ; } + reference_type dereference( internal_type* p, is_reference_tag ) { return p->get() ; } + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581)) + void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; } +#else + void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->~T() ; m_initialized = false ; } +#endif + + void destroy_impl ( is_reference_tag ) { m_initialized = false ; } + + // If T is of reference type, trying to get a pointer to the held value must result in a compile-time error. + // Decent compilers should disallow conversions from reference_content* to T*, but just in case, + // the following olverloads are used to filter out the case and guarantee an error in case of T being a reference. + pointer_const_type cast_ptr( internal_type const* p, is_not_reference_tag ) const { return p ; } + pointer_type cast_ptr( internal_type * p, is_not_reference_tag ) { return p ; } + pointer_const_type cast_ptr( internal_type const* p, is_reference_tag ) const { return &p->get() ; } + pointer_type cast_ptr( internal_type * p, is_reference_tag ) { return &p->get() ; } + + bool m_initialized ; + storage_type m_storage ; +} ; + +} // namespace optional_detail + +template +class optional : public optional_detail::optional_base +{ + typedef optional_detail::optional_base base ; + + public : + + typedef optional this_type ; + + typedef BOOST_DEDUCED_TYPENAME base::value_type value_type ; + typedef BOOST_DEDUCED_TYPENAME base::reference_type reference_type ; + typedef BOOST_DEDUCED_TYPENAME base::reference_const_type reference_const_type ; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + typedef BOOST_DEDUCED_TYPENAME base::rval_reference_type rval_reference_type ; + typedef BOOST_DEDUCED_TYPENAME base::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ; +#endif + typedef BOOST_DEDUCED_TYPENAME base::pointer_type pointer_type ; + typedef BOOST_DEDUCED_TYPENAME base::pointer_const_type pointer_const_type ; + typedef BOOST_DEDUCED_TYPENAME base::argument_type argument_type ; + + // Creates an optional uninitialized. + // No-throw + optional() BOOST_NOEXCEPT : base() {} + + // Creates an optional uninitialized. + // No-throw + optional( none_t none_ ) BOOST_NOEXCEPT : base(none_) {} + + // Creates an optional initialized with 'val'. + // Can throw if T::T(T const&) does + optional ( argument_type val ) : base(val) {} + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates an optional initialized with 'move(val)'. + // Can throw if T::T(T &&) does + optional ( rval_reference_type val ) : base( boost::forward(val) ) + {optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref();} +#endif + + // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. + // Can throw if T::T(T const&) does + optional ( bool cond, argument_type val ) : base(cond,val) {} + + // NOTE: MSVC needs templated versions first + + // Creates a deep copy of another convertible optional + // Requires a valid conversion from U to T. + // Can throw if T::T(U const&) does + template + explicit optional ( optional const& rhs ) + : + base() + { + if ( rhs.is_initialized() ) + this->construct(rhs.get()); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates a deep move of another convertible optional + // Requires a valid conversion from U to T. + // Can throw if T::T(U&&) does + template + explicit optional ( optional && rhs ) + : + base() + { + if ( rhs.is_initialized() ) + this->construct( boost::move(rhs.get()) ); + } +#endif + +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + // Creates an optional with an expression which can be either + // (a) An instance of InPlaceFactory (i.e. in_place(a,b,...,n); + // (b) An instance of TypedInPlaceFactory ( i.e. in_place(a,b,...,n); + // (c) Any expression implicitly convertible to the single type + // of a one-argument T's constructor. + // (d*) Weak compilers (BCB) might also resolved Expr as optional and optional + // even though explicit overloads are present for these. + // Depending on the above some T ctor is called. + // Can throw if the resolved T ctor throws. +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + + template + explicit optional ( Expr&& expr, + BOOST_DEDUCED_TYPENAME boost::disable_if_c< + (boost::is_base_of::type>::value) || + boost::is_same::type, none_t>::value, bool >::type = true + ) + : base(boost::forward(expr),boost::addressof(expr)) + {optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref();} + +#else + template + explicit optional ( Expr const& expr ) : base(expr,boost::addressof(expr)) {} +#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +#endif // !defined BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + + // Creates a deep copy of another optional + // Can throw if T::T(T const&) does + optional ( optional const& rhs ) : base( static_cast(rhs) ) {} + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates a deep move of another optional + // Can throw if T::T(T&&) does + optional ( optional && rhs ) + BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value) + : base( boost::move(rhs) ) + {} + +#endif + // No-throw (assuming T::~T() doesn't) + ~optional() {} + +#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) + // Assigns from an expression. See corresponding constructor. + // Basic Guarantee: If the resolved T ctor throws, this is left UNINITIALIZED +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + template + BOOST_DEDUCED_TYPENAME boost::disable_if_c< + boost::is_base_of::type>::value || + boost::is_same::type, none_t>::value, + optional& + >::type + operator= ( Expr&& expr ) + { + optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref(); + this->assign_expr(boost::forward(expr),boost::addressof(expr)); + return *this ; + } + +#else + template + optional& operator= ( Expr const& expr ) + { + this->assign_expr(expr,boost::addressof(expr)); + return *this ; + } +#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +#endif // !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) + + // Copy-assigns from another convertible optional (converts && deep-copies the rhs value) + // Requires a valid conversion from U to T. + // Basic Guarantee: If T::T( U const& ) throws, this is left UNINITIALIZED + template + optional& operator= ( optional const& rhs ) + { + this->assign(rhs); + return *this ; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Move-assigns from another convertible optional (converts && deep-moves the rhs value) + // Requires a valid conversion from U to T. + // Basic Guarantee: If T::T( U && ) throws, this is left UNINITIALIZED + template + optional& operator= ( optional && rhs ) + { + this->assign(boost::move(rhs)); + return *this ; + } +#endif + + // Assigns from another optional (deep-copies the rhs value) + // Basic Guarantee: If T::T( T const& ) throws, this is left UNINITIALIZED + // (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw) + optional& operator= ( optional const& rhs ) + { + this->assign( static_cast(rhs) ) ; + return *this ; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from another optional (deep-moves the rhs value) + optional& operator= ( optional && rhs ) + BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) + { + this->assign( static_cast(rhs) ) ; + return *this ; + } +#endif + + // Assigns from a T (deep-copies the rhs value) + // Basic Guarantee: If T::( T const& ) throws, this is left UNINITIALIZED + optional& operator= ( argument_type val ) + { + this->assign( val ) ; + return *this ; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from a T (deep-moves the rhs value) + optional& operator= ( rval_reference_type val ) + { + optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref(); + this->assign( boost::move(val) ) ; + return *this ; + } +#endif + + // Assigns from a "none" + // Which destroys the current value, if any, leaving this UNINITIALIZED + // No-throw (assuming T::~T() doesn't) + optional& operator= ( none_t none_ ) BOOST_NOEXCEPT + { + this->assign( none_ ) ; + return *this ; + } + +#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) + // Constructs in-place + // upon exception *this is always uninitialized + template + void emplace ( Args&&... args ) + { + this->emplace_assign( boost::forward(args)... ); + } +#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + template + void emplace ( Arg&& arg ) + { + this->emplace_assign( boost::forward(arg) ); + } + + void emplace () + { + this->emplace_assign(); + } +#else + template + void emplace ( const Arg& arg ) + { + this->emplace_assign( arg ); + } + + template + void emplace ( Arg& arg ) + { + this->emplace_assign( arg ); + } + + void emplace () + { + this->emplace_assign(); + } +#endif + + void swap( optional & arg ) + BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) + { + // allow for Koenig lookup + boost::swap(*this, arg); + } + + + // Returns a reference to the value if this is initialized, otherwise, + // the behaviour is UNDEFINED + // No-throw + reference_const_type get() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } + reference_type get() { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } + + // Returns a copy of the value if this is initialized, 'v' otherwise + reference_const_type get_value_or ( reference_const_type v ) const { return this->is_initialized() ? get() : v ; } + reference_type get_value_or ( reference_type v ) { return this->is_initialized() ? get() : v ; } + + // Returns a pointer to the value if this is initialized, otherwise, + // the behaviour is UNDEFINED + // No-throw + pointer_const_type operator->() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } + pointer_type operator->() { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } + + // Returns a reference to the value if this is initialized, otherwise, + // the behaviour is UNDEFINED + // No-throw +#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + reference_const_type operator *() const& { return this->get() ; } + reference_type operator *() & { return this->get() ; } + reference_type_of_temporary_wrapper operator *() && { return base::types::move(this->get()) ; } +#else + reference_const_type operator *() const { return this->get() ; } + reference_type operator *() { return this->get() ; } +#endif // !defined BOOST_NO_CXX11_REF_QUALIFIERS + +#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + reference_const_type value() const& + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } + + reference_type value() & + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } + + reference_type_of_temporary_wrapper value() && + { + if (this->is_initialized()) + return base::types::move(this->get()) ; + else + throw_exception(bad_optional_access()); + } + +#else + reference_const_type value() const + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } + + reference_type value() + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } +#endif + + +#ifndef BOOST_NO_CXX11_REF_QUALIFIERS + template + value_type value_or ( U&& v ) const& + { + if (this->is_initialized()) + return get(); + else + return boost::forward(v); + } + + template + value_type value_or ( U&& v ) && + { + if (this->is_initialized()) + return base::types::move(get()); + else + return boost::forward(v); + } +#elif !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + template + value_type value_or ( U&& v ) const + { + if (this->is_initialized()) + return get(); + else + return boost::forward(v); + } +#else + template + value_type value_or ( U const& v ) const + { + if (this->is_initialized()) + return get(); + else + return v; + } + + template + value_type value_or ( U& v ) const + { + if (this->is_initialized()) + return get(); + else + return v; + } +#endif + + +#ifndef BOOST_NO_CXX11_REF_QUALIFIERS + template + value_type value_or_eval ( F f ) const& + { + if (this->is_initialized()) + return get(); + else + return f(); + } + + template + value_type value_or_eval ( F f ) && + { + if (this->is_initialized()) + return base::types::move(get()); + else + return f(); + } +#else + template + value_type value_or_eval ( F f ) const + { + if (this->is_initialized()) + return get(); + else + return f(); + } +#endif + + bool operator!() const BOOST_NOEXCEPT { return !this->is_initialized() ; } + + BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() +} ; + +} // namespace boost + + +#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_aligned_storage.hpp b/libraries/boost/include/boost/optional/detail/optional_aligned_storage.hpp new file mode 100644 index 0000000000..2937349f52 --- /dev/null +++ b/libraries/boost/include/boost/optional/detail/optional_aligned_storage.hpp @@ -0,0 +1,71 @@ +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. +// Copyright (C) 2016 Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// akrzemi1@gmail.com + +#ifndef BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_ALIGNED_STORAGE_AJK_12FEB2016_HPP +#define BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_ALIGNED_STORAGE_AJK_12FEB2016_HPP + +namespace boost { + +namespace optional_detail { +// This local class is used instead of that in "aligned_storage.hpp" +// because I've found the 'official' class to ICE BCB5.5 +// when some types are used with optional<> +// (due to sizeof() passed down as a non-type template parameter) +template +class aligned_storage +{ + // Borland ICEs if unnamed unions are used for this! + // BOOST_MAY_ALIAS works around GCC warnings about breaking strict aliasing rules when casting storage address to T* + union BOOST_MAY_ALIAS dummy_u + { + char data[ sizeof(T) ]; + BOOST_DEDUCED_TYPENAME type_with_alignment< + ::boost::alignment_of::value >::type aligner_; + } dummy_ ; + + public: + +#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) + void const* address() const { return &dummy_; } + void * address() { return &dummy_; } +#else + void const* address() const { return dummy_.data; } + void * address() { return dummy_.data; } +#endif + +#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) + // This workaround is supposed to silence GCC warnings about broken strict aliasing rules + T const* ptr_ref() const + { + union { void const* ap_pvoid; T const* as_ptype; } caster = { address() }; + return caster.as_ptype; + } + T * ptr_ref() + { + union { void* ap_pvoid; T* as_ptype; } caster = { address() }; + return caster.as_ptype; + } +#else + T const* ptr_ref() const { return static_cast(address()); } + T * ptr_ref() { return static_cast (address()); } +#endif + + T const& ref() const { return *ptr_ref(); } + T & ref() { return *ptr_ref(); } + +} ; + +} // namespace optional_detail +} // namespace boost + +#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_config.hpp b/libraries/boost/include/boost/optional/detail/optional_config.hpp new file mode 100644 index 0000000000..bb7e12f9fc --- /dev/null +++ b/libraries/boost/include/boost/optional/detail/optional_config.hpp @@ -0,0 +1,135 @@ +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. +// Copyright (C) 2015 - 2017 Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// akrzemi1@gmail.com + +#ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_CONFIG_AJK_28JAN2015_HPP +#define BOOST_OPTIONAL_DETAIL_OPTIONAL_CONFIG_AJK_28JAN2015_HPP + +#include +#include + +#if (defined BOOST_NO_CXX11_RVALUE_REFERENCES) || (defined BOOST_OPTIONAL_CONFIG_NO_RVALUE_REFERENCES) +# define BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +#endif + +#if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION,<=700) +// AFAICT only Intel 7 correctly resolves the overload set +// that includes the in-place factory taking functions, +// so for the other icc versions, in-place factory support +// is disabled +# define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT +#endif + +#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) +// BCB (5.5.1) cannot parse the nested template struct in an inplace factory. +# define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT +#endif + +#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) \ + && defined BOOST_BCB_PARTIAL_SPECIALIZATION_BUG +// BCB (up to 5.64) has the following bug: +// If there is a member function/operator template of the form +// template mfunc( Expr expr ) ; +// some calls are resolved to this even if there are other better matches. +// The effect of this bug is that calls to converting ctors and assignments +// are incorrectly sink to this general catch-all member function template as shown above. +# define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION +#endif + +#if !defined(BOOST_NO_MAY_ALIAS) +// GCC since 3.3 and some other compilers have may_alias attribute that helps to alleviate +// optimizer issues with regard to violation of the strict aliasing rules. The optional< T > +// storage type is marked with this attribute in order to let the compiler know that it will +// alias objects of type T and silence compilation warnings. +# define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS +#endif + +#if (defined(_MSC_VER) && _MSC_VER <= 1800) +// on MSCV 2013 and earlier an unwanted temporary is created when you assign from +// a const lvalue of integral type. Thus we bind not to the original address but +// to a temporary. +# define BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT +#endif + +#if (defined __GNUC__) && (!defined BOOST_INTEL_CXX_VERSION) && (!defined __clang__) +// On some GCC versions an unwanted temporary is created when you copy-initialize +// from a const lvalue of integral type. Thus we bind not to the original address but +// to a temporary. + +# if (__GNUC__ < 4) +# define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT +# endif + +# if (__GNUC__ == 4 && __GNUC_MINOR__ <= 5) +# define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT +# endif + +# if (__GNUC__ == 5 && __GNUC_MINOR__ < 2) +# define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT +# endif + +# if (__GNUC__ == 5 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ == 0) +# define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT +# endif + +#endif // defined(__GNUC__) + +#if (defined __GNUC__) && (!defined BOOST_NO_CXX11_RVALUE_REFERENCES) +// On some initial rvalue reference implementations GCC does it in a strange way, +// preferring perfect-forwarding constructor to implicit copy constructor. + +# if (__GNUC__ == 4 && __GNUC_MINOR__ == 4) +# define BOOST_OPTIONAL_CONFIG_NO_LEGAL_CONVERT_FROM_REF +# endif + +# if (__GNUC__ == 4 && __GNUC_MINOR__ == 5) +# define BOOST_OPTIONAL_CONFIG_NO_LEGAL_CONVERT_FROM_REF +# endif + +#endif // defined(__GNUC__) + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500) && !defined(__SUNPRO_CC) + // this condition is a copy paste from is_constructible.hpp + // I also disable SUNPRO, as it seems not to support type_traits correctly +#else +# define BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT +#endif + +#if defined __SUNPRO_CC +# define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS +#elif (defined _MSC_FULL_VER) && (_MSC_FULL_VER < 190023026) +# define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS +#elif defined BOOST_GCC && !defined BOOST_GCC_CXX11 +# define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS +#elif defined BOOST_GCC_VERSION && BOOST_GCC_VERSION < 40800 +# define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS +#endif + + +// Detect suport for defaulting move operations +// (some older compilers implement rvalue references, +// defaulted funcitons but move operations are not special members and cannot be defaulted) + +#ifdef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS +#elif BOOST_WORKAROUND(BOOST_MSVC, < 1900) +# define BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS +#elif BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40600) +# define BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS +#endif + + +#ifdef BOOST_OPTIONAL_CONFIG_NO_DIRECT_STORAGE_SPEC +# define BOOST_OPTIONAL_DETAIL_NO_DIRECT_STORAGE_SPEC +#endif + + +#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_factory_support.hpp b/libraries/boost/include/boost/optional/detail/optional_factory_support.hpp new file mode 100644 index 0000000000..efff92a503 --- /dev/null +++ b/libraries/boost/include/boost/optional/detail/optional_factory_support.hpp @@ -0,0 +1,36 @@ +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. +// Copyright (C) 2016 Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// akrzemi1@gmail.com + +#ifndef BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_FACTORY_SUPPORT_AJK_12FEB2016_HPP +#define BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_FACTORY_SUPPORT_AJK_12FEB2016_HPP + +// Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply<> +// member template of a factory as used in the optional<> implementation. +// He proposed this simple fix which is to move the call to apply<> outside +// namespace boost. +namespace boost_optional_detail +{ + template + inline void construct(Factory const& factory, void* address) + { + factory.BOOST_NESTED_TEMPLATE apply(address); + } +} + +namespace boost +{ + class in_place_factory_base ; + class typed_in_place_factory_base ; +} + +#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_reference_spec.hpp b/libraries/boost/include/boost/optional/detail/optional_reference_spec.hpp new file mode 100644 index 0000000000..012e91a66c --- /dev/null +++ b/libraries/boost/include/boost/optional/detail/optional_reference_spec.hpp @@ -0,0 +1,253 @@ +// Copyright (C) 2015-2016 Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// akrzemi1@gmail.com + +#ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_REFERENCE_SPEC_AJK_03OCT2015_HPP +#define BOOST_OPTIONAL_DETAIL_OPTIONAL_REFERENCE_SPEC_AJK_03OCT2015_HPP + +#ifdef BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT +#include +#include +#endif + +# if 1 + +namespace boost { + +namespace detail { + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + +template +void prevent_binding_rvalue() +{ +#ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES + BOOST_STATIC_ASSERT_MSG(boost::is_lvalue_reference::value, + "binding rvalue references to optional lvalue references is disallowed"); +#endif +} + +template +BOOST_DEDUCED_TYPENAME boost::remove_reference::type& forward_reference(T&& r) +{ + BOOST_STATIC_ASSERT_MSG(boost::is_lvalue_reference::value, + "binding rvalue references to optional lvalue references is disallowed"); + return boost::forward(r); +} + +#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + +template +struct is_const_integral +{ + static const bool value = boost::is_const::value && boost::is_integral::value; +}; + +template +struct is_const_integral_bad_for_conversion +{ +#if (!defined BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES) && (defined BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT) + static const bool value = boost::is_const::value && boost::is_integral::value; +#else + static const bool value = false; +#endif +}; + +template +void prevent_assignment_from_false_const_integral() +{ +#ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES +#ifdef BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT + // MSVC compiler without rvalue refernces: we need to disable the asignment from + // const integral lvalue reference, as it may be an invalid temporary + BOOST_STATIC_ASSERT_MSG(!is_const_integral::value, + "binding const lvalue references to integral types is disabled in this compiler"); +#endif +#endif +} + + +template +struct is_optional_ +{ + static const bool value = false; +}; + +template +struct is_optional_< ::boost::optional > +{ + static const bool value = true; +}; + +template +struct is_no_optional +{ + static const bool value = !is_optional_::type>::value; +}; + + +template + struct is_same_decayed + { + static const bool value = ::boost::is_same::type>::value + || ::boost::is_same::type>::value; + }; + +template +struct no_unboxing_cond +{ + static const bool value = is_no_optional::value && !is_same_decayed::value; +}; + + +} // namespace detail + +template +class optional : public optional_detail::optional_tag +{ + T* ptr_; + +public: + typedef T& value_type; + typedef T& reference_type; + typedef T& reference_const_type; + typedef T& rval_reference_type; + typedef T* pointer_type; + typedef T* pointer_const_type; + + optional() BOOST_NOEXCEPT : ptr_() {} + optional(none_t) BOOST_NOEXCEPT : ptr_() {} + + template + explicit optional(const optional& rhs) BOOST_NOEXCEPT : ptr_(rhs.get_ptr()) {} + optional(const optional& rhs) BOOST_NOEXCEPT : ptr_(rhs.get_ptr()) {} + + // the following two implement a 'conditionally explicit' constructor: condition is a hack for buggy compilers with srewed conversion construction from const int + template + explicit optional(U& rhs, BOOST_DEDUCED_TYPENAME boost::enable_if_c::value && detail::is_const_integral_bad_for_conversion::value, bool>::type = true) BOOST_NOEXCEPT + : ptr_(boost::addressof(rhs)) {} + + template + optional(U& rhs, BOOST_DEDUCED_TYPENAME boost::enable_if_c::value && !detail::is_const_integral_bad_for_conversion::value, bool>::type = true) BOOST_NOEXCEPT + : ptr_(boost::addressof(rhs)) {} + + optional& operator=(const optional& rhs) BOOST_NOEXCEPT { ptr_ = rhs.get_ptr(); return *this; } + template + optional& operator=(const optional& rhs) BOOST_NOEXCEPT { ptr_ = rhs.get_ptr(); return *this; } + optional& operator=(none_t) BOOST_NOEXCEPT { ptr_ = 0; return *this; } + + + void swap(optional& rhs) BOOST_NOEXCEPT { std::swap(ptr_, rhs.ptr_); } + T& get() const { BOOST_ASSERT(ptr_); return *ptr_; } + + T* get_ptr() const BOOST_NOEXCEPT { return ptr_; } + T* operator->() const { BOOST_ASSERT(ptr_); return ptr_; } + T& operator*() const { BOOST_ASSERT(ptr_); return *ptr_; } + T& value() const { return ptr_ ? *ptr_ : (throw_exception(bad_optional_access()), *ptr_); } + + bool operator!() const BOOST_NOEXCEPT { return ptr_ == 0; } + BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() + + void reset() BOOST_NOEXCEPT { ptr_ = 0; } + + bool is_initialized() const BOOST_NOEXCEPT { return ptr_ != 0; } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + optional(T&& /* rhs */) BOOST_NOEXCEPT { detail::prevent_binding_rvalue(); } + + template + optional(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT + : ptr_(boost::addressof(r)) { detail::prevent_binding_rvalue(); } + + template + optional(bool cond, R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT + : ptr_(cond ? boost::addressof(r) : 0) { detail::prevent_binding_rvalue(); } + + template + BOOST_DEDUCED_TYPENAME boost::enable_if, optional&>::type + operator=(R&& r) BOOST_NOEXCEPT { detail::prevent_binding_rvalue(); ptr_ = boost::addressof(r); return *this; } + + template + void emplace(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT + { detail::prevent_binding_rvalue(); ptr_ = boost::addressof(r); } + + template + T& get_value_or(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) const BOOST_NOEXCEPT + { detail::prevent_binding_rvalue(); return ptr_ ? *ptr_ : r; } + + template + T& value_or(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) const BOOST_NOEXCEPT + { detail::prevent_binding_rvalue(); return ptr_ ? *ptr_ : r; } + + template + void reset(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT + { detail::prevent_binding_rvalue(); ptr_ = boost::addressof(r); } + + template + T& value_or_eval(F f) const { return ptr_ ? *ptr_ : detail::forward_reference(f()); } + +#else // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + + // the following two implement a 'conditionally explicit' constructor + template + explicit optional(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if_c::value && detail::is_const_integral_bad_for_conversion::value, bool>::type = true) BOOST_NOEXCEPT + : ptr_(boost::addressof(v)) { } + + template + optional(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if_c::value && !detail::is_const_integral_bad_for_conversion::value, bool>::type = true) BOOST_NOEXCEPT + : ptr_(boost::addressof(v)) { } + + template + optional(bool cond, U& v, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT : ptr_(cond ? boost::addressof(v) : 0) {} + + template + BOOST_DEDUCED_TYPENAME boost::enable_if, optional&>::type + operator=(U& v) BOOST_NOEXCEPT + { + detail::prevent_assignment_from_false_const_integral(); + ptr_ = boost::addressof(v); return *this; + } + + template + void emplace(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT + { ptr_ = boost::addressof(v); } + + template + T& get_value_or(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) const BOOST_NOEXCEPT + { return ptr_ ? *ptr_ : v; } + + template + T& value_or(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) const BOOST_NOEXCEPT + { return ptr_ ? *ptr_ : v; } + + template + void reset(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT + { ptr_ = boost::addressof(v); } + + template + T& value_or_eval(F f) const { return ptr_ ? *ptr_ : f(); } + +#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +}; + +template + void swap ( optional& x, optional& y) BOOST_NOEXCEPT +{ + x.swap(y); +} + +} // namespace boost + +#endif // 1/0 + +#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_relops.hpp b/libraries/boost/include/boost/optional/detail/optional_relops.hpp new file mode 100644 index 0000000000..2c17f2b727 --- /dev/null +++ b/libraries/boost/include/boost/optional/detail/optional_relops.hpp @@ -0,0 +1,196 @@ +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. +// Copyright (C) 2015 Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// akrzemi1@gmail.com + +#ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_RELOPS_AJK_03OCT2015_HPP +#define BOOST_OPTIONAL_DETAIL_OPTIONAL_RELOPS_AJK_03OCT2015_HPP + +namespace boost { + +// optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values). +// WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead. + + +// +// optional vs optional cases +// + +template +inline +bool operator == ( optional const& x, optional const& y ) +{ return bool(x) && bool(y) ? *x == *y : bool(x) == bool(y); } + +template +inline +bool operator < ( optional const& x, optional const& y ) +{ return less_pointees(x,y); } + +template +inline +bool operator != ( optional const& x, optional const& y ) +{ return !( x == y ) ; } + +template +inline +bool operator > ( optional const& x, optional const& y ) +{ return y < x ; } + +template +inline +bool operator <= ( optional const& x, optional const& y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( optional const& x, optional const& y ) +{ return !( x < y ) ; } + + +// +// optional vs T cases +// +template +inline +bool operator == ( optional const& x, T const& y ) +{ return equal_pointees(x, optional(y)); } + +template +inline +bool operator < ( optional const& x, T const& y ) +{ return less_pointees(x, optional(y)); } + +template +inline +bool operator != ( optional const& x, T const& y ) +{ return !( x == y ) ; } + +template +inline +bool operator > ( optional const& x, T const& y ) +{ return y < x ; } + +template +inline +bool operator <= ( optional const& x, T const& y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( optional const& x, T const& y ) +{ return !( x < y ) ; } + +// +// T vs optional cases +// + +template +inline +bool operator == ( T const& x, optional const& y ) +{ return equal_pointees( optional(x), y ); } + +template +inline +bool operator < ( T const& x, optional const& y ) +{ return less_pointees( optional(x), y ); } + +template +inline +bool operator != ( T const& x, optional const& y ) +{ return !( x == y ) ; } + +template +inline +bool operator > ( T const& x, optional const& y ) +{ return y < x ; } + +template +inline +bool operator <= ( T const& x, optional const& y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( T const& x, optional const& y ) +{ return !( x < y ) ; } + + +// +// optional vs none cases +// + +template +inline +bool operator == ( optional const& x, none_t ) BOOST_NOEXCEPT +{ return !x; } + +template +inline +bool operator < ( optional const& x, none_t ) +{ return less_pointees(x,optional() ); } + +template +inline +bool operator != ( optional const& x, none_t ) BOOST_NOEXCEPT +{ return bool(x); } + +template +inline +bool operator > ( optional const& x, none_t y ) +{ return y < x ; } + +template +inline +bool operator <= ( optional const& x, none_t y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( optional const& x, none_t y ) +{ return !( x < y ) ; } + +// +// none vs optional cases +// + +template +inline +bool operator == ( none_t , optional const& y ) BOOST_NOEXCEPT +{ return !y; } + +template +inline +bool operator < ( none_t , optional const& y ) +{ return less_pointees(optional() ,y); } + +template +inline +bool operator != ( none_t, optional const& y ) BOOST_NOEXCEPT +{ return bool(y); } + +template +inline +bool operator > ( none_t x, optional const& y ) +{ return y < x ; } + +template +inline +bool operator <= ( none_t x, optional const& y ) +{ return !( y < x ) ; } + +template +inline +bool operator >= ( none_t x, optional const& y ) +{ return !( x < y ) ; } + +} // namespace boost + +#endif // header guard + diff --git a/libraries/boost/include/boost/optional/detail/optional_swap.hpp b/libraries/boost/include/boost/optional/detail/optional_swap.hpp new file mode 100644 index 0000000000..2a7059e701 --- /dev/null +++ b/libraries/boost/include/boost/optional/detail/optional_swap.hpp @@ -0,0 +1,117 @@ +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. +// Copyright (C) 2015 Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// akrzemi1@gmail.com + +#ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_SWAP_AJK_28JAN2015_HPP +#define BOOST_OPTIONAL_DETAIL_OPTIONAL_SWAP_AJK_28JAN2015_HPP + +#include +#include + +namespace boost { + +namespace optional_detail { + +template struct swap_selector; + +template <> +struct swap_selector +{ + template + static void optional_swap ( optional& x, optional& y ) + { + const bool hasX = !!x; + const bool hasY = !!y; + + if ( !hasX && !hasY ) + return; + + if( !hasX ) + x.emplace(); + else if ( !hasY ) + y.emplace(); + + // Boost.Utility.Swap will take care of ADL and workarounds for broken compilers + boost::swap(x.get(), y.get()); + + if( !hasX ) + y = boost::none ; + else if( !hasY ) + x = boost::none ; + } +}; + +#ifdef BOOST_OPTIONAL_DETAIL_MOVE +# undef BOOST_OPTIONAL_DETAIL_MOVE +#endif + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +# define BOOST_OPTIONAL_DETAIL_MOVE(EXPR_) boost::move(EXPR_) +#else +# define BOOST_OPTIONAL_DETAIL_MOVE(EXPR_) EXPR_ +#endif + +template <> +struct swap_selector +{ + template + static void optional_swap ( optional& x, optional& y ) + //BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && BOOST_NOEXCEPT_EXPR(boost::swap(*x, *y))) + { + if (x) + { + if (y) + { + boost::swap(*x, *y); + } + else + { + y = BOOST_OPTIONAL_DETAIL_MOVE(*x); + x = boost::none; + } + } + else + { + if (y) + { + x = BOOST_OPTIONAL_DETAIL_MOVE(*y); + y = boost::none; + } + } + } +}; + +} // namespace optional_detail + +#if (!defined BOOST_NO_CXX11_RVALUE_REFERENCES) && (!defined BOOST_CONFIG_RESTORE_OBSOLETE_SWAP_IMPLEMENTATION) + +template +struct optional_swap_should_use_default_constructor : boost::false_type {} ; + +#else + +template +struct optional_swap_should_use_default_constructor : has_nothrow_default_constructor {} ; + +#endif + +template +inline void swap ( optional& x, optional& y ) +//BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && BOOST_NOEXCEPT_EXPR(boost::swap(*x, *y))) +{ + optional_detail::swap_selector::value>::optional_swap(x, y); +} + +} // namespace boost + +#undef BOOST_OPTIONAL_DETAIL_MOVE + +#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_trivially_copyable_base.hpp b/libraries/boost/include/boost/optional/detail/optional_trivially_copyable_base.hpp new file mode 100644 index 0000000000..91328ac4e7 --- /dev/null +++ b/libraries/boost/include/boost/optional/detail/optional_trivially_copyable_base.hpp @@ -0,0 +1,499 @@ +// trivilally-copyable version of the storage + +template +class tc_optional_base : public optional_tag +{ + private : + + typedef tc_optional_base this_type ; + + protected : + + typedef T value_type ; + + protected: + typedef T & reference_type ; + typedef T const& reference_const_type ; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + typedef T && rval_reference_type ; + typedef T && reference_type_of_temporary_wrapper ; +#endif + typedef T * pointer_type ; + typedef T const* pointer_const_type ; + typedef T const& argument_type ; + + tc_optional_base() + : + m_initialized(false) {} + + tc_optional_base ( none_t ) + : + m_initialized(false) {} + + tc_optional_base ( argument_type val ) + : + m_initialized(true), m_storage(val) {} + + tc_optional_base ( bool cond, argument_type val ) + : + m_initialized(cond), m_storage(val) {} + + // tc_optional_base ( tc_optional_base const& ) = default; + + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + template + explicit tc_optional_base ( Expr&& expr, PtrExpr const* tag ) + : + m_initialized(false) + { + construct(boost::forward(expr),tag); + } + +#else + // This is used for both converting and in-place constructions. + // Derived classes use the 'tag' to select the appropriate + // implementation (the correct 'construct()' overload) + template + explicit tc_optional_base ( Expr const& expr, Expr const* tag ) + : + m_initialized(false) + { + construct(expr,tag); + } + +#endif + + // tc_optional_base& operator= ( tc_optional_base const& ) = default; + // ~tc_optional_base() = default; + + // Assigns from another optional (deep-copies the rhs value) + void assign ( tc_optional_base const& rhs ) + { + this->operator=(rhs); + } + + // Assigns from another _convertible_ optional (deep-copies the rhs value) + template + void assign ( optional const& rhs ) + { + if ( rhs.is_initialized() ) +#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES + m_storage = rhs.get(); +#else + m_storage = static_cast(rhs.get()); +#endif + + m_initialized = rhs.is_initialized(); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // move-assigns from another _convertible_ optional (deep-moves from the rhs value) + template + void assign ( optional&& rhs ) + { + typedef BOOST_DEDUCED_TYPENAME optional::rval_reference_type ref_type; + if ( rhs.is_initialized() ) + m_storage = static_cast(rhs.get()); + m_initialized = rhs.is_initialized(); + } +#endif + + void assign ( argument_type val ) + { + construct(val); + } + + void assign ( none_t ) { destroy(); } + +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + template + void assign_expr ( Expr&& expr, ExprPtr const* tag ) + { + construct(boost::forward(expr),tag); + } +#else + template + void assign_expr ( Expr const& expr, Expr const* tag ) + { + construct(expr,tag); + } +#endif + +#endif + + public : + + // **DEPPRECATED** Destroys the current value, if any, leaving this UNINITIALIZED + // No-throw (assuming T::~T() doesn't) + void reset() BOOST_NOEXCEPT { destroy(); } + + // **DEPPRECATED** Replaces the current value -if any- with 'val' + void reset ( argument_type val ) BOOST_NOEXCEPT { assign(val); } + + // Returns a pointer to the value if this is initialized, otherwise, + // returns NULL. + // No-throw + pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; } + pointer_type get_ptr() { return m_initialized ? get_ptr_impl() : 0 ; } + + bool is_initialized() const { return m_initialized ; } + + protected : + + void construct ( argument_type val ) + { + m_storage = val ; + m_initialized = true ; + } + + +#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) + // Constructs in-place + // upon exception *this is always uninitialized + template + void construct ( in_place_init_t, Args&&... args ) + { + m_storage = value_type( boost::forward(args)... ) ; + m_initialized = true ; + } + + template + void emplace_assign ( Args&&... args ) + { + construct(in_place_init, boost::forward(args)...); + } + + template + explicit tc_optional_base ( in_place_init_t, Args&&... args ) + : + m_initialized(false) + { + construct(in_place_init, boost::forward(args)...); + } + + template + explicit tc_optional_base ( in_place_init_if_t, bool cond, Args&&... args ) + : + m_initialized(false) + { + if ( cond ) + construct(in_place_init, boost::forward(args)...); + } +#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + template + void construct ( in_place_init_t, Arg&& arg ) + { + m_storage = value_type( boost::forward(arg) ); + m_initialized = true ; + } + + void construct ( in_place_init_t ) + { + m_storage = value_type(); + m_initialized = true ; + } + + template + void emplace_assign ( Arg&& arg ) + { + construct(in_place_init, boost::forward(arg)) ; + } + + void emplace_assign () + { + construct(in_place_init) ; + } + + template + explicit tc_optional_base ( in_place_init_t, Arg&& arg ) + : + m_initialized(false) + { + construct(in_place_init, boost::forward(arg)); + } + + explicit tc_optional_base ( in_place_init_t ) + : + m_initialized(false), m_storage() {} + + template + explicit tc_optional_base ( in_place_init_if_t, bool cond, Arg&& arg ) + : + m_initialized(false) + { + if ( cond ) + construct(in_place_init, boost::forward(arg)); + } + + explicit tc_optional_base ( in_place_init_if_t, bool cond ) + : + m_initialized(false) + { + if ( cond ) + construct(in_place_init); + } + +#else + + template + void construct ( in_place_init_t, const Arg& arg ) + { + m_storage = value_type( arg ); + m_initialized = true ; + } + + template + void construct ( in_place_init_t, Arg& arg ) + { + m_storage = value_type( arg ); + m_initialized = true ; + } + + void construct ( in_place_init_t ) + { + m_storage = value_type(); + m_initialized = true ; + } + + template + void emplace_assign ( const Arg& arg ) + { + construct(in_place_init, arg); + } + + template + void emplace_assign ( Arg& arg ) + { + construct(in_place_init, arg); + } + + void emplace_assign () + { + construct(in_place_init); + } + + template + explicit tc_optional_base ( in_place_init_t, const Arg& arg ) + : m_initialized(false) + { + construct(in_place_init, arg); + } + + template + explicit tc_optional_base ( in_place_init_t, Arg& arg ) + : m_initialized(false) + { + construct(in_place_init, arg); + } + + explicit tc_optional_base ( in_place_init_t ) + : m_initialized(false) + { + construct(in_place_init); + } + + template + explicit tc_optional_base ( in_place_init_if_t, bool cond, const Arg& arg ) + : m_initialized(false) + { + if ( cond ) + construct(in_place_init, arg); + } + + template + explicit tc_optional_base ( in_place_init_if_t, bool cond, Arg& arg ) + : m_initialized(false) + { + if ( cond ) + construct(in_place_init, arg); + } + + explicit tc_optional_base ( in_place_init_if_t, bool cond ) + : m_initialized(false) + { + if ( cond ) + construct(in_place_init); + } +#endif + +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Constructs in-place using the given factory + template + void construct ( Expr&& factory, in_place_factory_base const* ) + { + boost_optional_detail::construct(factory, boost::addressof(m_storage)); + m_initialized = true ; + } + + // Constructs in-place using the given typed factory + template + void construct ( Expr&& factory, typed_in_place_factory_base const* ) + { + factory.apply(boost::addressof(m_storage)) ; + m_initialized = true ; + } + + template + void assign_expr_to_initialized ( Expr&& factory, in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + + // Constructs in-place using the given typed factory + template + void assign_expr_to_initialized ( Expr&& factory, typed_in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + +#else + // Constructs in-place using the given factory + template + void construct ( Expr const& factory, in_place_factory_base const* ) + { + boost_optional_detail::construct(factory, m_storage.address()); + m_initialized = true ; + } + + // Constructs in-place using the given typed factory + template + void construct ( Expr const& factory, typed_in_place_factory_base const* ) + { + factory.apply(boost::addressof(m_storage)) ; + m_initialized = true ; + } + + template + void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + + // Constructs in-place using the given typed factory + template + void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } +#endif + +#endif + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Constructs using any expression implicitly convertible to the single argument + // of a one-argument T constructor. + // Converting constructions of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting constructor of T from U. + template + void construct ( Expr&& expr, void const* ) + { + m_storage = value_type(boost::forward(expr)) ; + m_initialized = true ; + } + + // Assigns using a form any expression implicitly convertible to the single argument + // of a T's assignment operator. + // Converting assignments of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting assignment of T from U. + template + void assign_expr_to_initialized ( Expr&& expr, void const* ) + { + assign_value( boost::forward(expr) ); + } +#else + // Constructs using any expression implicitly convertible to the single argument + // of a one-argument T constructor. + // Converting constructions of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting constructor of T from U. + template + void construct ( Expr const& expr, void const* ) + { + m_storage = value_type(expr) ; + m_initialized = true ; + } + + // Assigns using a form any expression implicitly convertible to the single argument + // of a T's assignment operator. + // Converting assignments of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting assignment of T from U. + template + void assign_expr_to_initialized ( Expr const& expr, void const* ) + { + assign_value(expr); + } + +#endif + +#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION + // BCB5.64 (and probably lower versions) workaround. + // The in-place factories are supported by means of catch-all constructors + // and assignment operators (the functions are parameterized in terms of + // an arbitrary 'Expr' type) + // This compiler incorrectly resolves the overload set and sinks optional and optional + // to the 'Expr'-taking functions even though explicit overloads are present for them. + // Thus, the following overload is needed to properly handle the case when the 'lhs' + // is another optional. + // + // For VC<=70 compilers this workaround dosen't work becasue the comnpiler issues and error + // instead of choosing the wrong overload + // +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Notice that 'Expr' will be optional or optional (but not tc_optional_base<..>) + template + void construct ( Expr&& expr, optional_tag const* ) + { + if ( expr.is_initialized() ) + { + // An exception can be thrown here. + // It it happens, THIS will be left uninitialized. + m_storage = value_type(boost::move(expr.get())) ; + m_initialized = true ; + } + } +#else + // Notice that 'Expr' will be optional or optional (but not tc_optional_base<..>) + template + void construct ( Expr const& expr, optional_tag const* ) + { + if ( expr.is_initialized() ) + { + // An exception can be thrown here. + // It it happens, THIS will be left uninitialized. + m_storage = value_type(expr.get()) ; + m_initialized = true ; + } + } +#endif +#endif // defined BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION + + void assign_value ( argument_type val ) { m_storage = val; } +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + void assign_value ( rval_reference_type val ) { m_storage = static_cast(val); } +#endif + + void destroy() + { + m_initialized = false; + } + + reference_const_type get_impl() const { return m_storage ; } + reference_type get_impl() { return m_storage ; } + + pointer_const_type get_ptr_impl() const { return boost::addressof(m_storage); } + pointer_type get_ptr_impl() { return boost::addressof(m_storage); } + + private : + + bool m_initialized ; + T m_storage ; +} ; diff --git a/libraries/boost/include/boost/optional/optional.hpp b/libraries/boost/include/boost/optional/optional.hpp new file mode 100644 index 0000000000..74ef49c549 --- /dev/null +++ b/libraries/boost/include/boost/optional/optional.hpp @@ -0,0 +1,1490 @@ +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. +// Copyright (C) 2014 - 2017 Andrzej Krzemienski. +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +// Revisions: +// 27 Apr 2008 (improved swap) Fernando Cacciola, Niels Dekker, Thorsten Ottosen +// 05 May 2014 (Added move semantics) Andrzej Krzemienski +// +#ifndef BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP +#define BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP + +#include +#include + +#ifdef BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifdef BOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL +#include +#else +namespace boost { + +namespace optional_ns { + +// a tag for in-place initialization of contained value +struct in_place_init_t +{ + struct init_tag{}; + explicit in_place_init_t(init_tag){} +}; +const in_place_init_t in_place_init ((in_place_init_t::init_tag())); + +// a tag for conditional in-place initialization of contained value +struct in_place_init_if_t +{ + struct init_tag{}; + explicit in_place_init_if_t(init_tag){} +}; +const in_place_init_if_t in_place_init_if ((in_place_init_if_t::init_tag())); + +} // namespace optional_ns + +using optional_ns::in_place_init_t; +using optional_ns::in_place_init; +using optional_ns::in_place_init_if_t; +using optional_ns::in_place_init_if; + +namespace optional_detail { + +struct optional_tag {} ; + + +template +class optional_base : public optional_tag +{ + private : + + typedef aligned_storage storage_type ; + typedef optional_base this_type ; + + protected : + + typedef T value_type ; + + protected: + typedef T & reference_type ; + typedef T const& reference_const_type ; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + typedef T && rval_reference_type ; + typedef T && reference_type_of_temporary_wrapper ; +#endif + typedef T * pointer_type ; + typedef T const* pointer_const_type ; + typedef T const& argument_type ; + + // Creates an optional uninitialized. + // No-throw + optional_base() + : + m_initialized(false) {} + + // Creates an optional uninitialized. + // No-throw + optional_base ( none_t ) + : + m_initialized(false) {} + + // Creates an optional initialized with 'val'. + // Can throw if T::T(T const&) does + optional_base ( argument_type val ) + : + m_initialized(false) + { + construct(val); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // move-construct an optional initialized from an rvalue-ref to 'val'. + // Can throw if T::T(T&&) does + optional_base ( rval_reference_type val ) + : + m_initialized(false) + { + construct( boost::move(val) ); + } +#endif + + // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. + // Can throw if T::T(T const&) does + optional_base ( bool cond, argument_type val ) + : + m_initialized(false) + { + if ( cond ) + construct(val); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates an optional initialized with 'move(val)' IFF cond is true, otherwise creates an uninitialized optional. + // Can throw if T::T(T &&) does + optional_base ( bool cond, rval_reference_type val ) + : + m_initialized(false) + { + if ( cond ) + construct(boost::move(val)); + } +#endif + + // Creates a deep copy of another optional + // Can throw if T::T(T const&) does + optional_base ( optional_base const& rhs ) + : + m_initialized(false) + { + if ( rhs.is_initialized() ) + construct(rhs.get_impl()); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates a deep move of another optional + // Can throw if T::T(T&&) does + optional_base ( optional_base&& rhs ) + BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value) + : + m_initialized(false) + { + if ( rhs.is_initialized() ) + construct( boost::move(rhs.get_impl()) ); + } +#endif + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + template + explicit optional_base ( Expr&& expr, PtrExpr const* tag ) + : + m_initialized(false) + { + construct(boost::forward(expr),tag); + } + +#else + // This is used for both converting and in-place constructions. + // Derived classes use the 'tag' to select the appropriate + // implementation (the correct 'construct()' overload) + template + explicit optional_base ( Expr const& expr, Expr const* tag ) + : + m_initialized(false) + { + construct(expr,tag); + } + +#endif + + optional_base& operator= ( optional_base const& rhs ) + { + this->assign(rhs); + return *this; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + optional_base& operator= ( optional_base && rhs ) + BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) + { + this->assign(static_cast(rhs)); + return *this; + } +#endif + + // No-throw (assuming T::~T() doesn't) + ~optional_base() { destroy() ; } + + // Assigns from another optional (deep-copies the rhs value) + void assign ( optional_base const& rhs ) + { + if (is_initialized()) + { + if ( rhs.is_initialized() ) + assign_value(rhs.get_impl()); + else destroy(); + } + else + { + if ( rhs.is_initialized() ) + construct(rhs.get_impl()); + } + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from another optional (deep-moves the rhs value) + void assign ( optional_base&& rhs ) + { + if (is_initialized()) + { + if ( rhs.is_initialized() ) + assign_value( boost::move(rhs.get_impl()) ); + else destroy(); + } + else + { + if ( rhs.is_initialized() ) + construct(boost::move(rhs.get_impl())); + } + } +#endif + + // Assigns from another _convertible_ optional (deep-copies the rhs value) + template + void assign ( optional const& rhs ) + { + if (is_initialized()) + { + if ( rhs.is_initialized() ) +#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES + assign_value( rhs.get() ); +#else + assign_value( static_cast(rhs.get()) ); +#endif + + else destroy(); + } + else + { + if ( rhs.is_initialized() ) +#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES + construct(rhs.get()); +#else + construct(static_cast(rhs.get())); +#endif + } + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // move-assigns from another _convertible_ optional (deep-moves from the rhs value) + template + void assign ( optional&& rhs ) + { + typedef BOOST_DEDUCED_TYPENAME optional::rval_reference_type ref_type; + if (is_initialized()) + { + if ( rhs.is_initialized() ) + assign_value( static_cast(rhs.get()) ); + else destroy(); + } + else + { + if ( rhs.is_initialized() ) + construct(static_cast(rhs.get())); + } + } +#endif + + // Assigns from a T (deep-copies the rhs value) + void assign ( argument_type val ) + { + if (is_initialized()) + assign_value(val); + else construct(val); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from a T (deep-moves the rhs value) + void assign ( rval_reference_type val ) + { + if (is_initialized()) + assign_value( boost::move(val) ); + else construct( boost::move(val) ); + } +#endif + + // Assigns from "none", destroying the current value, if any, leaving this UNINITIALIZED + // No-throw (assuming T::~T() doesn't) + void assign ( none_t ) BOOST_NOEXCEPT { destroy(); } + +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + template + void assign_expr ( Expr&& expr, ExprPtr const* tag ) + { + if (is_initialized()) + assign_expr_to_initialized(boost::forward(expr),tag); + else construct(boost::forward(expr),tag); + } +#else + template + void assign_expr ( Expr const& expr, Expr const* tag ) + { + if (is_initialized()) + assign_expr_to_initialized(expr,tag); + else construct(expr,tag); + } +#endif + +#endif + + public : + + // **DEPPRECATED** Destroys the current value, if any, leaving this UNINITIALIZED + // No-throw (assuming T::~T() doesn't) + void reset() BOOST_NOEXCEPT { destroy(); } + + // **DEPPRECATED** Replaces the current value -if any- with 'val' + void reset ( argument_type val ) { assign(val); } + + // Returns a pointer to the value if this is initialized, otherwise, + // returns NULL. + // No-throw + pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; } + pointer_type get_ptr() { return m_initialized ? get_ptr_impl() : 0 ; } + + bool is_initialized() const { return m_initialized ; } + + protected : + + void construct ( argument_type val ) + { + ::new (m_storage.address()) value_type(val) ; + m_initialized = true ; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + void construct ( rval_reference_type val ) + { + ::new (m_storage.address()) value_type( boost::move(val) ) ; + m_initialized = true ; + } +#endif + + +#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) + // Constructs in-place + // upon exception *this is always uninitialized + template + void construct ( in_place_init_t, Args&&... args ) + { + ::new (m_storage.address()) value_type( boost::forward(args)... ) ; + m_initialized = true ; + } + + template + void emplace_assign ( Args&&... args ) + { + destroy(); + construct(in_place_init, boost::forward(args)...); + } + + template + explicit optional_base ( in_place_init_t, Args&&... args ) + : + m_initialized(false) + { + construct(in_place_init, boost::forward(args)...); + } + + template + explicit optional_base ( in_place_init_if_t, bool cond, Args&&... args ) + : + m_initialized(false) + { + if ( cond ) + construct(in_place_init, boost::forward(args)...); + } +#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + template + void construct ( in_place_init_t, Arg&& arg ) + { + ::new (m_storage.address()) value_type( boost::forward(arg) ); + m_initialized = true ; + } + + void construct ( in_place_init_t ) + { + ::new (m_storage.address()) value_type(); + m_initialized = true ; + } + + template + void emplace_assign ( Arg&& arg ) + { + destroy(); + construct(in_place_init, boost::forward(arg)) ; + } + + void emplace_assign () + { + destroy(); + construct(in_place_init) ; + } + + template + explicit optional_base ( in_place_init_t, Arg&& arg ) + : + m_initialized(false) + { + construct(in_place_init, boost::forward(arg)); + } + + explicit optional_base ( in_place_init_t ) + : + m_initialized(false) + { + construct(in_place_init); + } + + template + explicit optional_base ( in_place_init_if_t, bool cond, Arg&& arg ) + : + m_initialized(false) + { + if ( cond ) + construct(in_place_init, boost::forward(arg)); + } + + explicit optional_base ( in_place_init_if_t, bool cond ) + : + m_initialized(false) + { + if ( cond ) + construct(in_place_init); + } + +#else + + template + void construct ( in_place_init_t, const Arg& arg ) + { + ::new (m_storage.address()) value_type( arg ); + m_initialized = true ; + } + + template + void construct ( in_place_init_t, Arg& arg ) + { + ::new (m_storage.address()) value_type( arg ); + m_initialized = true ; + } + + void construct ( in_place_init_t ) + { + ::new (m_storage.address()) value_type(); + m_initialized = true ; + } + + template + void emplace_assign ( const Arg& arg ) + { + destroy(); + construct(in_place_init, arg); + } + + template + void emplace_assign ( Arg& arg ) + { + destroy(); + construct(in_place_init, arg); + } + + void emplace_assign () + { + destroy(); + construct(in_place_init); + } + + template + explicit optional_base ( in_place_init_t, const Arg& arg ) + : m_initialized(false) + { + construct(in_place_init, arg); + } + + template + explicit optional_base ( in_place_init_t, Arg& arg ) + : m_initialized(false) + { + construct(in_place_init, arg); + } + + explicit optional_base ( in_place_init_t ) + : m_initialized(false) + { + construct(in_place_init); + } + + template + explicit optional_base ( in_place_init_if_t, bool cond, const Arg& arg ) + : m_initialized(false) + { + if ( cond ) + construct(in_place_init, arg); + } + + template + explicit optional_base ( in_place_init_if_t, bool cond, Arg& arg ) + : m_initialized(false) + { + if ( cond ) + construct(in_place_init, arg); + } + + explicit optional_base ( in_place_init_if_t, bool cond ) + : m_initialized(false) + { + if ( cond ) + construct(in_place_init); + } +#endif + +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Constructs in-place using the given factory + template + void construct ( Expr&& factory, in_place_factory_base const* ) + { + boost_optional_detail::construct(factory, m_storage.address()); + m_initialized = true ; + } + + // Constructs in-place using the given typed factory + template + void construct ( Expr&& factory, typed_in_place_factory_base const* ) + { + factory.apply(m_storage.address()) ; + m_initialized = true ; + } + + template + void assign_expr_to_initialized ( Expr&& factory, in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + + // Constructs in-place using the given typed factory + template + void assign_expr_to_initialized ( Expr&& factory, typed_in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + +#else + // Constructs in-place using the given factory + template + void construct ( Expr const& factory, in_place_factory_base const* ) + { + boost_optional_detail::construct(factory, m_storage.address()); + m_initialized = true ; + } + + // Constructs in-place using the given typed factory + template + void construct ( Expr const& factory, typed_in_place_factory_base const* ) + { + factory.apply(m_storage.address()) ; + m_initialized = true ; + } + + template + void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } + + // Constructs in-place using the given typed factory + template + void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag ) + { + destroy(); + construct(factory,tag); + } +#endif + +#endif + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Constructs using any expression implicitly convertible to the single argument + // of a one-argument T constructor. + // Converting constructions of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting constructor of T from U. + template + void construct ( Expr&& expr, void const* ) + { + new (m_storage.address()) value_type(boost::forward(expr)) ; + m_initialized = true ; + } + + // Assigns using a form any expression implicitly convertible to the single argument + // of a T's assignment operator. + // Converting assignments of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting assignment of T from U. + template + void assign_expr_to_initialized ( Expr&& expr, void const* ) + { + assign_value( boost::forward(expr) ); + } +#else + // Constructs using any expression implicitly convertible to the single argument + // of a one-argument T constructor. + // Converting constructions of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting constructor of T from U. + template + void construct ( Expr const& expr, void const* ) + { + new (m_storage.address()) value_type(expr) ; + m_initialized = true ; + } + + // Assigns using a form any expression implicitly convertible to the single argument + // of a T's assignment operator. + // Converting assignments of optional from optional uses this function with + // 'Expr' being of type 'U' and relying on a converting assignment of T from U. + template + void assign_expr_to_initialized ( Expr const& expr, void const* ) + { + assign_value(expr); + } + +#endif + +#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION + // BCB5.64 (and probably lower versions) workaround. + // The in-place factories are supported by means of catch-all constructors + // and assignment operators (the functions are parameterized in terms of + // an arbitrary 'Expr' type) + // This compiler incorrectly resolves the overload set and sinks optional and optional + // to the 'Expr'-taking functions even though explicit overloads are present for them. + // Thus, the following overload is needed to properly handle the case when the 'lhs' + // is another optional. + // + // For VC<=70 compilers this workaround dosen't work becasue the comnpiler issues and error + // instead of choosing the wrong overload + // +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Notice that 'Expr' will be optional or optional (but not optional_base<..>) + template + void construct ( Expr&& expr, optional_tag const* ) + { + if ( expr.is_initialized() ) + { + // An exception can be thrown here. + // It it happens, THIS will be left uninitialized. + new (m_storage.address()) value_type(boost::move(expr.get())) ; + m_initialized = true ; + } + } +#else + // Notice that 'Expr' will be optional or optional (but not optional_base<..>) + template + void construct ( Expr const& expr, optional_tag const* ) + { + if ( expr.is_initialized() ) + { + // An exception can be thrown here. + // It it happens, THIS will be left uninitialized. + new (m_storage.address()) value_type(expr.get()) ; + m_initialized = true ; + } + } +#endif +#endif // defined BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION + + void assign_value ( argument_type val ) { get_impl() = val; } +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + void assign_value ( rval_reference_type val ) { get_impl() = static_cast(val); } +#endif + + void destroy() + { + if ( m_initialized ) + destroy_impl() ; + } + + reference_const_type get_impl() const { return m_storage.ref() ; } + reference_type get_impl() { return m_storage.ref() ; } + + pointer_const_type get_ptr_impl() const { return m_storage.ptr_ref(); } + pointer_type get_ptr_impl() { return m_storage.ptr_ref(); } + + private : + +#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1900)) + void destroy_impl ( ) { m_storage.ptr_ref()->~T() ; m_initialized = false ; } +#else + void destroy_impl ( ) { m_storage.ref().T::~T() ; m_initialized = false ; } +#endif + + bool m_initialized ; + storage_type m_storage ; +} ; + + + +#include + +// definition of metafunciton is_optional_val_init_candidate +template +struct is_optional_related + : boost::conditional< boost::is_base_of::type>::value + || boost::is_same::type, none_t>::value + || boost::is_same::type, in_place_init_t>::value + || boost::is_same::type, in_place_init_if_t>::value, + boost::true_type, boost::false_type>::type +{}; + +#if !defined(BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT) + +template +struct is_convertible_to_T_or_factory + : boost::conditional< boost::is_base_of::type>::value + || boost::is_base_of::type>::value + || (boost::is_constructible::value && !boost::is_same::type>::value) + , boost::true_type, boost::false_type>::type +{}; + +template +struct is_optional_constructible : boost::is_constructible +{}; + +#else + +template +struct is_convertible_to_T_or_factory : boost::true_type +{}; + +template +struct is_optional_constructible : boost::true_type +{}; + +#endif // is_convertible condition + +template +struct is_optional_val_init_candidate + : boost::conditional< !is_optional_related::value && is_convertible_to_T_or_factory::value + , boost::true_type, boost::false_type>::type +{}; + +} // namespace optional_detail + +namespace optional_config { + +template +struct optional_uses_direct_storage_for + : boost::conditional<(boost::is_scalar::value && !boost::is_const::value && !boost::is_volatile::value) + , boost::true_type, boost::false_type>::type +{}; + +} // namespace optional_config + + +#ifndef BOOST_OPTIONAL_DETAIL_NO_DIRECT_STORAGE_SPEC +# define BOOST_OPTIONAL_BASE_TYPE(T) boost::conditional< optional_config::optional_uses_direct_storage_for::value, \ + optional_detail::tc_optional_base, \ + optional_detail::optional_base \ + >::type +#else +# define BOOST_OPTIONAL_BASE_TYPE(T) optional_detail::optional_base +#endif + +template +class optional + : public BOOST_OPTIONAL_BASE_TYPE(T) +{ + typedef typename BOOST_OPTIONAL_BASE_TYPE(T) base ; + + public : + + typedef optional this_type ; + + typedef BOOST_DEDUCED_TYPENAME base::value_type value_type ; + typedef BOOST_DEDUCED_TYPENAME base::reference_type reference_type ; + typedef BOOST_DEDUCED_TYPENAME base::reference_const_type reference_const_type ; +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + typedef BOOST_DEDUCED_TYPENAME base::rval_reference_type rval_reference_type ; + typedef BOOST_DEDUCED_TYPENAME base::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ; +#endif + typedef BOOST_DEDUCED_TYPENAME base::pointer_type pointer_type ; + typedef BOOST_DEDUCED_TYPENAME base::pointer_const_type pointer_const_type ; + typedef BOOST_DEDUCED_TYPENAME base::argument_type argument_type ; + + // Creates an optional uninitialized. + // No-throw + optional() BOOST_NOEXCEPT : base() {} + + // Creates an optional uninitialized. + // No-throw + optional( none_t none_ ) BOOST_NOEXCEPT : base(none_) {} + + // Creates an optional initialized with 'val'. + // Can throw if T::T(T const&) does + optional ( argument_type val ) : base(val) {} + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates an optional initialized with 'move(val)'. + // Can throw if T::T(T &&) does + optional ( rval_reference_type val ) : base( boost::forward(val) ) + {} +#endif + + // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. + // Can throw if T::T(T const&) does + optional ( bool cond, argument_type val ) : base(cond,val) {} + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + /// Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. + // Can throw if T::T(T &&) does + optional ( bool cond, rval_reference_type val ) : base( cond, boost::forward(val) ) + {} +#endif + + // NOTE: MSVC needs templated versions first + + // Creates a deep copy of another convertible optional + // Requires a valid conversion from U to T. + // Can throw if T::T(U const&) does + template + explicit optional ( optional const& rhs +#ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS + ,BOOST_DEDUCED_TYPENAME boost::enable_if< optional_detail::is_optional_constructible, bool>::type = true +#endif + ) + : + base() + { + if ( rhs.is_initialized() ) + this->construct(rhs.get()); + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates a deep move of another convertible optional + // Requires a valid conversion from U to T. + // Can throw if T::T(U&&) does + template + explicit optional ( optional && rhs +#ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS + ,BOOST_DEDUCED_TYPENAME boost::enable_if< optional_detail::is_optional_constructible, bool>::type = true +#endif + ) + : + base() + { + if ( rhs.is_initialized() ) + this->construct( boost::move(rhs.get()) ); + } +#endif + +#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + // Creates an optional with an expression which can be either + // (a) An instance of InPlaceFactory (i.e. in_place(a,b,...,n); + // (b) An instance of TypedInPlaceFactory ( i.e. in_place(a,b,...,n); + // (c) Any expression implicitly convertible to the single type + // of a one-argument T's constructor. + // (d*) Weak compilers (BCB) might also resolved Expr as optional and optional + // even though explicit overloads are present for these. + // Depending on the above some T ctor is called. + // Can throw if the resolved T ctor throws. +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + + template + explicit optional ( Expr&& expr, + BOOST_DEDUCED_TYPENAME boost::enable_if< optional_detail::is_optional_val_init_candidate, bool>::type = true + ) + : base(boost::forward(expr),boost::addressof(expr)) + {} + +#else + template + explicit optional ( Expr const& expr ) : base(expr,boost::addressof(expr)) {} +#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +#endif // !defined BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT + + // Creates a deep copy of another optional + // Can throw if T::T(T const&) does +#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS + optional ( optional const& ) = default; +#else + optional ( optional const& rhs ) : base( static_cast(rhs) ) {} +#endif + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Creates a deep move of another optional + // Can throw if T::T(T&&) does + +#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS + optional ( optional && rhs ) = default; +#else + optional ( optional && rhs ) + BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value) + : base( boost::move(rhs) ) + {} +#endif + +#endif + +#if BOOST_WORKAROUND(_MSC_VER, <= 1600) + // On old MSVC compilers the implicitly declared dtor is not called + ~optional() {} +#endif + + +#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) + // Assigns from an expression. See corresponding constructor. + // Basic Guarantee: If the resolved T ctor throws, this is left UNINITIALIZED +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + + template + BOOST_DEDUCED_TYPENAME boost::enable_if, optional&>::type + operator= ( Expr&& expr ) + { + this->assign_expr(boost::forward(expr),boost::addressof(expr)); + return *this ; + } + +#else + template + optional& operator= ( Expr const& expr ) + { + this->assign_expr(expr,boost::addressof(expr)); + return *this ; + } +#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +#endif // !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) + + // Copy-assigns from another convertible optional (converts && deep-copies the rhs value) + // Requires a valid conversion from U to T. + // Basic Guarantee: If T::T( U const& ) throws, this is left UNINITIALIZED + template + optional& operator= ( optional const& rhs ) + { + this->assign(rhs); + return *this ; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Move-assigns from another convertible optional (converts && deep-moves the rhs value) + // Requires a valid conversion from U to T. + // Basic Guarantee: If T::T( U && ) throws, this is left UNINITIALIZED + template + optional& operator= ( optional && rhs ) + { + this->assign(boost::move(rhs)); + return *this ; + } +#endif + + // Assigns from another optional (deep-copies the rhs value) + // Basic Guarantee: If T::T( T const& ) throws, this is left UNINITIALIZED + // (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw) +#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS + optional& operator= ( optional const& rhs ) = default; +#else + optional& operator= ( optional const& rhs ) + { + this->assign( static_cast(rhs) ) ; + return *this ; + } +#endif + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from another optional (deep-moves the rhs value) +#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS + optional& operator= ( optional && ) = default; +#else + optional& operator= ( optional && rhs ) + BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) + { + this->assign( static_cast(rhs) ) ; + return *this ; + } +#endif + +#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + +#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + + // Assigns from a T (deep-moves/copies the rhs value) + template + BOOST_DEDUCED_TYPENAME boost::enable_if::type>, optional&>::type + operator= ( T_&& val ) + { + this->assign( boost::forward(val) ) ; + return *this ; + } + +#else + + // Assigns from a T (deep-copies the rhs value) + // Basic Guarantee: If T::( T const& ) throws, this is left UNINITIALIZED + optional& operator= ( argument_type val ) + { + this->assign( val ) ; + return *this ; + } + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + // Assigns from a T (deep-moves the rhs value) + optional& operator= ( rval_reference_type val ) + { + this->assign( boost::move(val) ) ; + return *this ; + } +#endif + +#endif // BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + + // Assigns from a "none" + // Which destroys the current value, if any, leaving this UNINITIALIZED + // No-throw (assuming T::~T() doesn't) + optional& operator= ( none_t none_ ) BOOST_NOEXCEPT + { + this->assign( none_ ) ; + return *this ; + } + +#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) + // Constructs in-place + // upon exception *this is always uninitialized + template + void emplace ( Args&&... args ) + { + this->emplace_assign( boost::forward(args)... ); + } + + template + explicit optional ( in_place_init_t, Args&&... args ) + : base( in_place_init, boost::forward(args)... ) + {} + + template + explicit optional ( in_place_init_if_t, bool cond, Args&&... args ) + : base( in_place_init_if, cond, boost::forward(args)... ) + {} + +#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + template + void emplace ( Arg&& arg ) + { + this->emplace_assign( boost::forward(arg) ); + } + + void emplace () + { + this->emplace_assign(); + } + + template + explicit optional ( in_place_init_t, Args&& args ) + : base( in_place_init, boost::forward(args) ) + {} + + explicit optional ( in_place_init_t ) + : base( in_place_init ) + {} + + template + explicit optional ( in_place_init_if_t, bool cond, Args&& args ) + : base( in_place_init_if, cond, boost::forward(args) ) + {} + + explicit optional ( in_place_init_if_t, bool cond ) + : base( in_place_init_if, cond ) + {} +#else + template + void emplace ( const Arg& arg ) + { + this->emplace_assign( arg ); + } + + template + void emplace ( Arg& arg ) + { + this->emplace_assign( arg ); + } + + void emplace () + { + this->emplace_assign(); + } + + template + explicit optional ( in_place_init_t, const Arg& arg ) + : base( in_place_init, arg ) + {} + + template + explicit optional ( in_place_init_t, Arg& arg ) + : base( in_place_init, arg ) + {} + + explicit optional ( in_place_init_t ) + : base( in_place_init ) + {} + + template + explicit optional ( in_place_init_if_t, bool cond, const Arg& arg ) + : base( in_place_init_if, cond, arg ) + {} + + template + explicit optional ( in_place_init_if_t, bool cond, Arg& arg ) + : base( in_place_init_if, cond, arg ) + {} + + explicit optional ( in_place_init_if_t, bool cond ) + : base( in_place_init_if, cond ) + {} +#endif + + void swap( optional & arg ) + BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) + { + // allow for Koenig lookup + boost::swap(*this, arg); + } + + + // Returns a reference to the value if this is initialized, otherwise, + // the behaviour is UNDEFINED + // No-throw + reference_const_type get() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } + reference_type get() { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } + + // Returns a copy of the value if this is initialized, 'v' otherwise + reference_const_type get_value_or ( reference_const_type v ) const { return this->is_initialized() ? get() : v ; } + reference_type get_value_or ( reference_type v ) { return this->is_initialized() ? get() : v ; } + + // Returns a pointer to the value if this is initialized, otherwise, + // the behaviour is UNDEFINED + // No-throw + pointer_const_type operator->() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } + pointer_type operator->() { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } + + // Returns a reference to the value if this is initialized, otherwise, + // the behaviour is UNDEFINED + // No-throw +#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + reference_const_type operator *() const& { return this->get() ; } + reference_type operator *() & { return this->get() ; } + reference_type_of_temporary_wrapper operator *() && { return boost::move(this->get()) ; } +#else + reference_const_type operator *() const { return this->get() ; } + reference_type operator *() { return this->get() ; } +#endif // !defined BOOST_NO_CXX11_REF_QUALIFIERS + +#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) + reference_const_type value() const& + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } + + reference_type value() & + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } + + reference_type_of_temporary_wrapper value() && + { + if (this->is_initialized()) + return boost::move(this->get()) ; + else + throw_exception(bad_optional_access()); + } + +#else + reference_const_type value() const + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } + + reference_type value() + { + if (this->is_initialized()) + return this->get() ; + else + throw_exception(bad_optional_access()); + } +#endif + + +#ifndef BOOST_NO_CXX11_REF_QUALIFIERS + template + value_type value_or ( U&& v ) const& + { + if (this->is_initialized()) + return get(); + else + return boost::forward(v); + } + + template + value_type value_or ( U&& v ) && + { + if (this->is_initialized()) + return boost::move(get()); + else + return boost::forward(v); + } +#elif !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + template + value_type value_or ( U&& v ) const + { + if (this->is_initialized()) + return get(); + else + return boost::forward(v); + } +#else + template + value_type value_or ( U const& v ) const + { + if (this->is_initialized()) + return get(); + else + return v; + } + + template + value_type value_or ( U& v ) const + { + if (this->is_initialized()) + return get(); + else + return v; + } +#endif + + +#ifndef BOOST_NO_CXX11_REF_QUALIFIERS + template + value_type value_or_eval ( F f ) const& + { + if (this->is_initialized()) + return get(); + else + return f(); + } + + template + value_type value_or_eval ( F f ) && + { + if (this->is_initialized()) + return boost::move(get()); + else + return f(); + } +#else + template + value_type value_or_eval ( F f ) const + { + if (this->is_initialized()) + return get(); + else + return f(); + } +#endif + + bool operator!() const BOOST_NOEXCEPT { return !this->is_initialized() ; } + + BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() +} ; + +} // namespace boost + +#endif // BOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL + +namespace boost { + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES +template +class optional +{ + BOOST_STATIC_ASSERT_MSG(sizeof(T) == 0, "Optional rvalue references are illegal."); +} ; +#endif + +} // namespace boost + +#ifndef BOOST_OPTIONAL_CONFIG_DONT_SPECIALIZE_OPTIONAL_REFS +# include +#endif + +namespace boost { + +#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + +template +inline +optional::type> make_optional ( T && v ) +{ + return optional::type>(boost::forward(v)); +} + +// Returns optional(cond,v) +template +inline +optional::type> make_optional ( bool cond, T && v ) +{ + return optional::type>(cond,boost::forward(v)); +} + +#else + +// Returns optional(v) +template +inline +optional make_optional ( T const& v ) +{ + return optional(v); +} + +// Returns optional(cond,v) +template +inline +optional make_optional ( bool cond, T const& v ) +{ + return optional(cond,v); +} + +#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES + +// Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. +// No-throw +template +inline +BOOST_DEDUCED_TYPENAME optional::reference_const_type +get ( optional const& opt ) +{ + return opt.get() ; +} + +template +inline +BOOST_DEDUCED_TYPENAME optional::reference_type +get ( optional& opt ) +{ + return opt.get() ; +} + +// Returns a pointer to the value if this is initialized, otherwise, returns NULL. +// No-throw +template +inline +BOOST_DEDUCED_TYPENAME optional::pointer_const_type +get ( optional const* opt ) +{ + return opt->get_ptr() ; +} + +template +inline +BOOST_DEDUCED_TYPENAME optional::pointer_type +get ( optional* opt ) +{ + return opt->get_ptr() ; +} + +// Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. +// No-throw +template +inline +BOOST_DEDUCED_TYPENAME optional::reference_const_type +get_optional_value_or ( optional const& opt, BOOST_DEDUCED_TYPENAME optional::reference_const_type v ) +{ + return opt.get_value_or(v) ; +} + +template +inline +BOOST_DEDUCED_TYPENAME optional::reference_type +get_optional_value_or ( optional& opt, BOOST_DEDUCED_TYPENAME optional::reference_type v ) +{ + return opt.get_value_or(v) ; +} + +// Returns a pointer to the value if this is initialized, otherwise, returns NULL. +// No-throw +template +inline +BOOST_DEDUCED_TYPENAME optional::pointer_const_type +get_pointer ( optional const& opt ) +{ + return opt.get_ptr() ; +} + +template +inline +BOOST_DEDUCED_TYPENAME optional::pointer_type +get_pointer ( optional& opt ) +{ + return opt.get_ptr() ; +} + +} // namespace boost + +namespace boost { + +// The following declaration prevents a bug where operator safe-bool is used upon streaming optional object if you forget the IO header. +template +std::basic_ostream& +operator<<(std::basic_ostream& os, optional_detail::optional_tag const&) +{ + BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, "If you want to output boost::optional, include header "); + return os; +} + +} // namespace boost + +#include +#include + +#endif // header guard diff --git a/libraries/boost/include/boost/optional/optional_fwd.hpp b/libraries/boost/include/boost/optional/optional_fwd.hpp new file mode 100644 index 0000000000..faee253e55 --- /dev/null +++ b/libraries/boost/include/boost/optional/optional_fwd.hpp @@ -0,0 +1,41 @@ +// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. +// Copyright (C) 2016 Andrzej Krzemienski +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/optional for documentation. +// +// You are welcome to contact the author at: +// fernando_cacciola@hotmail.com +// +// Revisions: +// 10 May 2008 (added swap related forward declaration) Niels Dekker +// +#ifndef BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP +#define BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP + +#include + +namespace boost { + +template class optional ; + +// This forward is needed to refer to namespace scope swap from the member swap +template void swap ( optional& , optional& ) ; + +template struct optional_swap_should_use_default_constructor ; + +#ifndef BOOST_OPTIONAL_CONFIG_DONT_SPECIALIZE_OPTIONAL_REFS + +template class optional ; + +template void swap ( optional& , optional& ) BOOST_NOEXCEPT; + +#endif + +} // namespace boost + +#endif + diff --git a/libraries/boost/include/boost/predef.h b/libraries/boost/include/boost/predef.h new file mode 100644 index 0000000000..4965337875 --- /dev/null +++ b/libraries/boost/include/boost/predef.h @@ -0,0 +1,24 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#if !defined(BOOST_PREDEF_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) +#ifndef BOOST_PREDEF_H +#define BOOST_PREDEF_H +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#endif diff --git a/libraries/boost/include/boost/predef/architecture.h b/libraries/boost/include/boost/predef/architecture.h new file mode 100644 index 0000000000..c433d437bd --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture.h @@ -0,0 +1,32 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#if !defined(BOOST_PREDEF_ARCHITECTURE_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) +#ifndef BOOST_PREDEF_ARCHITECTURE_H +#define BOOST_PREDEF_ARCHITECTURE_H +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +/*#include */ + +#endif diff --git a/libraries/boost/include/boost/predef/architecture/alpha.h b/libraries/boost/include/boost/predef/architecture/alpha.h new file mode 100644 index 0000000000..5bcade18b1 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/alpha.h @@ -0,0 +1,59 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_ALPHA_H +#define BOOST_PREDEF_ARCHITECTURE_ALPHA_H + +#include +#include + +/*` +[heading `BOOST_ARCH_ALPHA`] + +[@http://en.wikipedia.org/wiki/DEC_Alpha DEC Alpha] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + [[`__alpha__`] [__predef_detection__]] + [[`__alpha`] [__predef_detection__]] + [[`_M_ALPHA`] [__predef_detection__]] + + [[`__alpha_ev4__`] [4.0.0]] + [[`__alpha_ev5__`] [5.0.0]] + [[`__alpha_ev6__`] [6.0.0]] + ] + */ + +#define BOOST_ARCH_ALPHA BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__alpha__) || defined(__alpha) || \ + defined(_M_ALPHA) +# undef BOOST_ARCH_ALPHA +# if !defined(BOOST_ARCH_ALPHA) && defined(__alpha_ev4__) +# define BOOST_ARCH_ALPHA BOOST_VERSION_NUMBER(4,0,0) +# endif +# if !defined(BOOST_ARCH_ALPHA) && defined(__alpha_ev5__) +# define BOOST_ARCH_ALPHA BOOST_VERSION_NUMBER(5,0,0) +# endif +# if !defined(BOOST_ARCH_ALPHA) && defined(__alpha_ev6__) +# define BOOST_ARCH_ALPHA BOOST_VERSION_NUMBER(6,0,0) +# endif +# if !defined(BOOST_ARCH_ALPHA) +# define BOOST_ARCH_ALPHA BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_ARCH_ALPHA +# define BOOST_ARCH_ALPHA_AVAILABLE +#endif + +#define BOOST_ARCH_ALPHA_NAME "DEC Alpha" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_ALPHA,BOOST_ARCH_ALPHA_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/arm.h b/libraries/boost/include/boost/predef/architecture/arm.h new file mode 100644 index 0000000000..76f9f947bd --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/arm.h @@ -0,0 +1,75 @@ +/* +Copyright Rene Rivera 2008-2015 +Copyright Franz Detro 2014 +Copyright (c) Microsoft Corporation 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_ARM_H +#define BOOST_PREDEF_ARCHITECTURE_ARM_H + +#include +#include + +/*` +[heading `BOOST_ARCH_ARM`] + +[@http://en.wikipedia.org/wiki/ARM_architecture ARM] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__arm__`] [__predef_detection__]] + [[`__arm64`] [__predef_detection__]] + [[`__thumb__`] [__predef_detection__]] + [[`__TARGET_ARCH_ARM`] [__predef_detection__]] + [[`__TARGET_ARCH_THUMB`] [__predef_detection__]] + [[`_M_ARM`] [__predef_detection__]] + [[`_M_ARM64`] [__predef_detection__]] + + [[`__arm64`] [8.0.0]] + [[`__TARGET_ARCH_ARM`] [V.0.0]] + [[`__TARGET_ARCH_THUMB`] [V.0.0]] + [[`_M_ARM`] [V.0.0]] + [[`_M_ARM64`] [8.0.0]] + ] + */ + +#define BOOST_ARCH_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__arm__) || defined(__arm64) || defined(__thumb__) || \ + defined(__TARGET_ARCH_ARM) || defined(__TARGET_ARCH_THUMB) || \ + defined(_M_ARM) || defined(_M_ARM64) +# undef BOOST_ARCH_ARM +# if !defined(BOOST_ARCH_ARM) && defined(__arm64) +# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(8,0,0) +# endif +# if !defined(BOOST_ARCH_ARM) && defined(__TARGET_ARCH_ARM) +# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(__TARGET_ARCH_ARM,0,0) +# endif +# if !defined(BOOST_ARCH_ARM) && defined(__TARGET_ARCH_THUMB) +# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(__TARGET_ARCH_THUMB,0,0) +# endif +# if !defined(BOOST_ARCH_ARM) && defined(_M_ARM64) +# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(8,0,0) +# endif +# if !defined(BOOST_ARCH_ARM) && defined(_M_ARM) +# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(_M_ARM,0,0) +# endif +# if !defined(BOOST_ARCH_ARM) +# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_ARCH_ARM +# define BOOST_ARCH_ARM_AVAILABLE +#endif + +#define BOOST_ARCH_ARM_NAME "ARM" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_ARM,BOOST_ARCH_ARM_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/blackfin.h b/libraries/boost/include/boost/predef/architecture/blackfin.h new file mode 100644 index 0000000000..84c58a25e9 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/blackfin.h @@ -0,0 +1,46 @@ +/* +Copyright Rene Rivera 2013-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_BLACKFIN_H +#define BOOST_PREDEF_ARCHITECTURE_BLACKFIN_H + +#include +#include + +/*` +[heading `BOOST_ARCH_BLACKFIN`] + +Blackfin Processors from Analog Devices. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__bfin__`] [__predef_detection__]] + [[`__BFIN__`] [__predef_detection__]] + [[`bfin`] [__predef_detection__]] + [[`BFIN`] [__predef_detection__]] + ] + */ + +#define BOOST_ARCH_BLACKFIN BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__bfin__) || defined(__BFIN__) || \ + defined(bfin) || defined(BFIN) +# undef BOOST_ARCH_BLACKFIN +# define BOOST_ARCH_BLACKFIN BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_ARCH_BLACKFIN +# define BOOST_ARCH_BLACKFIN_AVAILABLE +#endif + +#define BOOST_ARCH_BLACKFIN_NAME "Blackfin" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_BLACKFIN,BOOST_ARCH_BLACKFIN_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/convex.h b/libraries/boost/include/boost/predef/architecture/convex.h new file mode 100644 index 0000000000..ac783a9cc1 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/convex.h @@ -0,0 +1,65 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_CONVEX_H +#define BOOST_PREDEF_ARCHITECTURE_CONVEX_H + +#include +#include + +/*` +[heading `BOOST_ARCH_CONVEX`] + +[@http://en.wikipedia.org/wiki/Convex_Computer Convex Computer] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__convex__`] [__predef_detection__]] + + [[`__convex_c1__`] [1.0.0]] + [[`__convex_c2__`] [2.0.0]] + [[`__convex_c32__`] [3.2.0]] + [[`__convex_c34__`] [3.4.0]] + [[`__convex_c38__`] [3.8.0]] + ] + */ + +#define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__convex__) +# undef BOOST_ARCH_CONVEX +# if !defined(BOOST_ARCH_CONVEX) && defined(__convex_c1__) +# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER(1,0,0) +# endif +# if !defined(BOOST_ARCH_CONVEX) && defined(__convex_c2__) +# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER(2,0,0) +# endif +# if !defined(BOOST_ARCH_CONVEX) && defined(__convex_c32__) +# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER(3,2,0) +# endif +# if !defined(BOOST_ARCH_CONVEX) && defined(__convex_c34__) +# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER(3,4,0) +# endif +# if !defined(BOOST_ARCH_CONVEX) && defined(__convex_c38__) +# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER(3,8,0) +# endif +# if !defined(BOOST_ARCH_CONVEX) +# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_ARCH_CONVEX +# define BOOST_ARCH_CONVEX_AVAILABLE +#endif + +#define BOOST_ARCH_CONVEX_NAME "Convex Computer" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_CONVEX,BOOST_ARCH_CONVEX_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/ia64.h b/libraries/boost/include/boost/predef/architecture/ia64.h new file mode 100644 index 0000000000..9b1972bd39 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/ia64.h @@ -0,0 +1,49 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_IA64_H +#define BOOST_PREDEF_ARCHITECTURE_IA64_H + +#include +#include + +/*` +[heading `BOOST_ARCH_IA64`] + +[@http://en.wikipedia.org/wiki/Ia64 Intel Itanium 64] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__ia64__`] [__predef_detection__]] + [[`_IA64`] [__predef_detection__]] + [[`__IA64__`] [__predef_detection__]] + [[`__ia64`] [__predef_detection__]] + [[`_M_IA64`] [__predef_detection__]] + [[`__itanium__`] [__predef_detection__]] + ] + */ + +#define BOOST_ARCH_IA64 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__ia64__) || defined(_IA64) || \ + defined(__IA64__) || defined(__ia64) || \ + defined(_M_IA64) || defined(__itanium__) +# undef BOOST_ARCH_IA64 +# define BOOST_ARCH_IA64 BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_ARCH_IA64 +# define BOOST_ARCH_IA64_AVAILABLE +#endif + +#define BOOST_ARCH_IA64_NAME "Intel Itanium 64" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_IA64,BOOST_ARCH_IA64_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/m68k.h b/libraries/boost/include/boost/predef/architecture/m68k.h new file mode 100644 index 0000000000..63ed5f8479 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/m68k.h @@ -0,0 +1,82 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_M68K_H +#define BOOST_PREDEF_ARCHITECTURE_M68K_H + +#include +#include + +/*` +[heading `BOOST_ARCH_M68K`] + +[@http://en.wikipedia.org/wiki/M68k Motorola 68k] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__m68k__`] [__predef_detection__]] + [[`M68000`] [__predef_detection__]] + + [[`__mc68060__`] [6.0.0]] + [[`mc68060`] [6.0.0]] + [[`__mc68060`] [6.0.0]] + [[`__mc68040__`] [4.0.0]] + [[`mc68040`] [4.0.0]] + [[`__mc68040`] [4.0.0]] + [[`__mc68030__`] [3.0.0]] + [[`mc68030`] [3.0.0]] + [[`__mc68030`] [3.0.0]] + [[`__mc68020__`] [2.0.0]] + [[`mc68020`] [2.0.0]] + [[`__mc68020`] [2.0.0]] + [[`__mc68010__`] [1.0.0]] + [[`mc68010`] [1.0.0]] + [[`__mc68010`] [1.0.0]] + [[`__mc68000__`] [0.0.1]] + [[`mc68000`] [0.0.1]] + [[`__mc68000`] [0.0.1]] + ] + */ + +#define BOOST_ARCH_M68K BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__m68k__) || defined(M68000) +# undef BOOST_ARCH_M68K +# if !defined(BOOST_ARCH_M68K) && (defined(__mc68060__) || defined(mc68060) || defined(__mc68060)) +# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER(6,0,0) +# endif +# if !defined(BOOST_ARCH_M68K) && (defined(__mc68040__) || defined(mc68040) || defined(__mc68040)) +# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER(4,0,0) +# endif +# if !defined(BOOST_ARCH_M68K) && (defined(__mc68030__) || defined(mc68030) || defined(__mc68030)) +# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER(3,0,0) +# endif +# if !defined(BOOST_ARCH_M68K) && (defined(__mc68020__) || defined(mc68020) || defined(__mc68020)) +# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER(2,0,0) +# endif +# if !defined(BOOST_ARCH_M68K) && (defined(__mc68010__) || defined(mc68010) || defined(__mc68010)) +# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER(1,0,0) +# endif +# if !defined(BOOST_ARCH_M68K) && (defined(__mc68000__) || defined(mc68000) || defined(__mc68000)) +# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER_AVAILABLE +# endif +# if !defined(BOOST_ARCH_M68K) +# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_ARCH_M68K +# define BOOST_ARCH_M68K_AVAILABLE +#endif + +#define BOOST_ARCH_M68K_NAME "Motorola 68k" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_M68K,BOOST_ARCH_M68K_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/mips.h b/libraries/boost/include/boost/predef/architecture/mips.h new file mode 100644 index 0000000000..0189d7dbd6 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/mips.h @@ -0,0 +1,73 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_MIPS_H +#define BOOST_PREDEF_ARCHITECTURE_MIPS_H + +#include +#include + +/*` +[heading `BOOST_ARCH_MIPS`] + +[@http://en.wikipedia.org/wiki/MIPS_architecture MIPS] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__mips__`] [__predef_detection__]] + [[`__mips`] [__predef_detection__]] + [[`__MIPS__`] [__predef_detection__]] + + [[`__mips`] [V.0.0]] + [[`_MIPS_ISA_MIPS1`] [1.0.0]] + [[`_R3000`] [1.0.0]] + [[`_MIPS_ISA_MIPS2`] [2.0.0]] + [[`__MIPS_ISA2__`] [2.0.0]] + [[`_R4000`] [2.0.0]] + [[`_MIPS_ISA_MIPS3`] [3.0.0]] + [[`__MIPS_ISA3__`] [3.0.0]] + [[`_MIPS_ISA_MIPS4`] [4.0.0]] + [[`__MIPS_ISA4__`] [4.0.0]] + ] + */ + +#define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__mips__) || defined(__mips) || \ + defined(__MIPS__) +# undef BOOST_ARCH_MIPS +# if !defined(BOOST_ARCH_MIPS) && (defined(__mips)) +# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER(__mips,0,0) +# endif +# if !defined(BOOST_ARCH_MIPS) && (defined(_MIPS_ISA_MIPS1) || defined(_R3000)) +# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER(1,0,0) +# endif +# if !defined(BOOST_ARCH_MIPS) && (defined(_MIPS_ISA_MIPS2) || defined(__MIPS_ISA2__) || defined(_R4000)) +# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER(2,0,0) +# endif +# if !defined(BOOST_ARCH_MIPS) && (defined(_MIPS_ISA_MIPS3) || defined(__MIPS_ISA3__)) +# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER(3,0,0) +# endif +# if !defined(BOOST_ARCH_MIPS) && (defined(_MIPS_ISA_MIPS4) || defined(__MIPS_ISA4__)) +# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER(4,0,0) +# endif +# if !defined(BOOST_ARCH_MIPS) +# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_ARCH_MIPS +# define BOOST_ARCH_MIPS_AVAILABLE +#endif + +#define BOOST_ARCH_MIPS_NAME "MIPS" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_MIPS,BOOST_ARCH_MIPS_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/parisc.h b/libraries/boost/include/boost/predef/architecture/parisc.h new file mode 100644 index 0000000000..c75a1f3889 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/parisc.h @@ -0,0 +1,64 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_PARISC_H +#define BOOST_PREDEF_ARCHITECTURE_PARISC_H + +#include +#include + +/*` +[heading `BOOST_ARCH_PARISC`] + +[@http://en.wikipedia.org/wiki/PA-RISC_family HP/PA RISC] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__hppa__`] [__predef_detection__]] + [[`__hppa`] [__predef_detection__]] + [[`__HPPA__`] [__predef_detection__]] + + [[`_PA_RISC1_0`] [1.0.0]] + [[`_PA_RISC1_1`] [1.1.0]] + [[`__HPPA11__`] [1.1.0]] + [[`__PA7100__`] [1.1.0]] + [[`_PA_RISC2_0`] [2.0.0]] + [[`__RISC2_0__`] [2.0.0]] + [[`__HPPA20__`] [2.0.0]] + [[`__PA8000__`] [2.0.0]] + ] + */ + +#define BOOST_ARCH_PARISC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__hppa__) || defined(__hppa) || defined(__HPPA__) +# undef BOOST_ARCH_PARISC +# if !defined(BOOST_ARCH_PARISC) && (defined(_PA_RISC1_0)) +# define BOOST_ARCH_PARISC BOOST_VERSION_NUMBER(1,0,0) +# endif +# if !defined(BOOST_ARCH_PARISC) && (defined(_PA_RISC1_1) || defined(__HPPA11__) || defined(__PA7100__)) +# define BOOST_ARCH_PARISC BOOST_VERSION_NUMBER(1,1,0) +# endif +# if !defined(BOOST_ARCH_PARISC) && (defined(_PA_RISC2_0) || defined(__RISC2_0__) || defined(__HPPA20__) || defined(__PA8000__)) +# define BOOST_ARCH_PARISC BOOST_VERSION_NUMBER(2,0,0) +# endif +# if !defined(BOOST_ARCH_PARISC) +# define BOOST_ARCH_PARISC BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_ARCH_PARISC +# define BOOST_ARCH_PARISC_AVAILABLE +#endif + +#define BOOST_ARCH_PARISC_NAME "HP/PA RISC" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_PARISC,BOOST_ARCH_PARISC_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/ppc.h b/libraries/boost/include/boost/predef/architecture/ppc.h new file mode 100644 index 0000000000..e8c57c91f2 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/ppc.h @@ -0,0 +1,72 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_PPC_H +#define BOOST_PREDEF_ARCHITECTURE_PPC_H + +#include +#include + +/*` +[heading `BOOST_ARCH_PPC`] + +[@http://en.wikipedia.org/wiki/PowerPC PowerPC] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__powerpc`] [__predef_detection__]] + [[`__powerpc__`] [__predef_detection__]] + [[`__POWERPC__`] [__predef_detection__]] + [[`__ppc__`] [__predef_detection__]] + [[`_M_PPC`] [__predef_detection__]] + [[`_ARCH_PPC`] [__predef_detection__]] + [[`__PPCGECKO__`] [__predef_detection__]] + [[`__PPCBROADWAY__`] [__predef_detection__]] + [[`_XENON`] [__predef_detection__]] + + [[`__ppc601__`] [6.1.0]] + [[`_ARCH_601`] [6.1.0]] + [[`__ppc603__`] [6.3.0]] + [[`_ARCH_603`] [6.3.0]] + [[`__ppc604__`] [6.4.0]] + [[`__ppc604__`] [6.4.0]] + ] + */ + +#define BOOST_ARCH_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__powerpc) || defined(__powerpc__) || \ + defined(__POWERPC__) || defined(__ppc__) || \ + defined(_M_PPC) || defined(_ARCH_PPC) || \ + defined(__PPCGECKO__) || defined(__PPCBROADWAY__) || \ + defined(_XENON) +# undef BOOST_ARCH_PPC +# if !defined (BOOST_ARCH_PPC) && (defined(__ppc601__) || defined(_ARCH_601)) +# define BOOST_ARCH_PPC BOOST_VERSION_NUMBER(6,1,0) +# endif +# if !defined (BOOST_ARCH_PPC) && (defined(__ppc603__) || defined(_ARCH_603)) +# define BOOST_ARCH_PPC BOOST_VERSION_NUMBER(6,3,0) +# endif +# if !defined (BOOST_ARCH_PPC) && (defined(__ppc604__) || defined(__ppc604__)) +# define BOOST_ARCH_PPC BOOST_VERSION_NUMBER(6,4,0) +# endif +# if !defined (BOOST_ARCH_PPC) +# define BOOST_ARCH_PPC BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_ARCH_PPC +# define BOOST_ARCH_PPC_AVAILABLE +#endif + +#define BOOST_ARCH_PPC_NAME "PowerPC" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_PPC,BOOST_ARCH_PPC_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/pyramid.h b/libraries/boost/include/boost/predef/architecture/pyramid.h new file mode 100644 index 0000000000..4f13253807 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/pyramid.h @@ -0,0 +1,42 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_PYRAMID_H +#define BOOST_PREDEF_ARCHITECTURE_PYRAMID_H + +#include +#include + +/*` +[heading `BOOST_ARCH_PYRAMID`] + +Pyramid 9810 architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`pyr`] [__predef_detection__]] + ] + */ + +#define BOOST_ARCH_PYRAMID BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(pyr) +# undef BOOST_ARCH_PYRAMID +# define BOOST_ARCH_PYRAMID BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_ARCH_PYRAMID +# define BOOST_ARCH_PYRAMID_AVAILABLE +#endif + +#define BOOST_ARCH_PYRAMID_NAME "Pyramid 9810" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_PYRAMID,BOOST_ARCH_PYRAMID_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/rs6k.h b/libraries/boost/include/boost/predef/architecture/rs6k.h new file mode 100644 index 0000000000..8a6e9b6b53 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/rs6k.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_RS6K_H +#define BOOST_PREDEF_ARCHITECTURE_RS6K_H + +#include +#include + +/*` +[heading `BOOST_ARCH_RS6000`] + +[@http://en.wikipedia.org/wiki/RS/6000 RS/6000] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__THW_RS6000`] [__predef_detection__]] + [[`_IBMR2`] [__predef_detection__]] + [[`_POWER`] [__predef_detection__]] + [[`_ARCH_PWR`] [__predef_detection__]] + [[`_ARCH_PWR2`] [__predef_detection__]] + ] + */ + +#define BOOST_ARCH_RS6000 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__THW_RS6000) || defined(_IBMR2) || \ + defined(_POWER) || defined(_ARCH_PWR) || \ + defined(_ARCH_PWR2) +# undef BOOST_ARCH_RS6000 +# define BOOST_ARCH_RS6000 BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_ARCH_RS6000 +# define BOOST_ARCH_RS6000_AVAILABLE +#endif + +#define BOOST_ARCH_RS6000_NAME "RS/6000" + +#define BOOST_ARCH_PWR BOOST_ARCH_RS6000 + +#if BOOST_ARCH_PWR +# define BOOST_ARCH_PWR_AVAILABLE +#endif + +#define BOOST_ARCH_PWR_NAME BOOST_ARCH_RS6000_NAME + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_RS6000,BOOST_ARCH_RS6000_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/sparc.h b/libraries/boost/include/boost/predef/architecture/sparc.h new file mode 100644 index 0000000000..a89a5100b8 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/sparc.h @@ -0,0 +1,54 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_SPARC_H +#define BOOST_PREDEF_ARCHITECTURE_SPARC_H + +#include +#include + +/*` +[heading `BOOST_ARCH_SPARC`] + +[@http://en.wikipedia.org/wiki/SPARC SPARC] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__sparc__`] [__predef_detection__]] + [[`__sparc`] [__predef_detection__]] + + [[`__sparcv9`] [9.0.0]] + [[`__sparcv8`] [8.0.0]] + ] + */ + +#define BOOST_ARCH_SPARC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__sparc__) || defined(__sparc) +# undef BOOST_ARCH_SPARC +# if !defined(BOOST_ARCH_SPARC) && defined(__sparcv9) +# define BOOST_ARCH_SPARC BOOST_VERSION_NUMBER(9,0,0) +# endif +# if !defined(BOOST_ARCH_SPARC) && defined(__sparcv8) +# define BOOST_ARCH_SPARC BOOST_VERSION_NUMBER(8,0,0) +# endif +# if !defined(BOOST_ARCH_SPARC) +# define BOOST_ARCH_SPARC BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_ARCH_SPARC +# define BOOST_ARCH_SPARC_AVAILABLE +#endif + +#define BOOST_ARCH_SPARC_NAME "SPARC" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_SPARC,BOOST_ARCH_SPARC_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/superh.h b/libraries/boost/include/boost/predef/architecture/superh.h new file mode 100644 index 0000000000..da0529e5e0 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/superh.h @@ -0,0 +1,67 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_SUPERH_H +#define BOOST_PREDEF_ARCHITECTURE_SUPERH_H + +#include +#include + +/*` +[heading `BOOST_ARCH_SH`] + +[@http://en.wikipedia.org/wiki/SuperH SuperH] architecture: +If available versions \[1-5\] are specifically detected. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__sh__`] [__predef_detection__]] + + [[`__SH5__`] [5.0.0]] + [[`__SH4__`] [4.0.0]] + [[`__sh3__`] [3.0.0]] + [[`__SH3__`] [3.0.0]] + [[`__sh2__`] [2.0.0]] + [[`__sh1__`] [1.0.0]] + ] + */ + +#define BOOST_ARCH_SH BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__sh__) +# undef BOOST_ARCH_SH +# if !defined(BOOST_ARCH_SH) && (defined(__SH5__)) +# define BOOST_ARCH_SH BOOST_VERSION_NUMBER(5,0,0) +# endif +# if !defined(BOOST_ARCH_SH) && (defined(__SH4__)) +# define BOOST_ARCH_SH BOOST_VERSION_NUMBER(4,0,0) +# endif +# if !defined(BOOST_ARCH_SH) && (defined(__sh3__) || defined(__SH3__)) +# define BOOST_ARCH_SH BOOST_VERSION_NUMBER(3,0,0) +# endif +# if !defined(BOOST_ARCH_SH) && (defined(__sh2__)) +# define BOOST_ARCH_SH BOOST_VERSION_NUMBER(2,0,0) +# endif +# if !defined(BOOST_ARCH_SH) && (defined(__sh1__)) +# define BOOST_ARCH_SH BOOST_VERSION_NUMBER(1,0,0) +# endif +# if !defined(BOOST_ARCH_SH) +# define BOOST_ARCH_SH BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_ARCH_SH +# define BOOST_ARCH_SH_AVAILABLE +#endif + +#define BOOST_ARCH_SH_NAME "SuperH" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_SH,BOOST_ARCH_SH_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/sys370.h b/libraries/boost/include/boost/predef/architecture/sys370.h new file mode 100644 index 0000000000..cfd85dc803 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/sys370.h @@ -0,0 +1,43 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_SYS370_H +#define BOOST_PREDEF_ARCHITECTURE_SYS370_H + +#include +#include + +/*` +[heading `BOOST_ARCH_SYS370`] + +[@http://en.wikipedia.org/wiki/System/370 System/370] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__370__`] [__predef_detection__]] + [[`__THW_370__`] [__predef_detection__]] + ] + */ + +#define BOOST_ARCH_SYS370 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__370__) || defined(__THW_370__) +# undef BOOST_ARCH_SYS370 +# define BOOST_ARCH_SYS370 BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_ARCH_SYS370 +# define BOOST_ARCH_SYS370_AVAILABLE +#endif + +#define BOOST_ARCH_SYS370_NAME "System/370" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_SYS370,BOOST_ARCH_SYS370_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/sys390.h b/libraries/boost/include/boost/predef/architecture/sys390.h new file mode 100644 index 0000000000..47aff6acd6 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/sys390.h @@ -0,0 +1,43 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_SYS390_H +#define BOOST_PREDEF_ARCHITECTURE_SYS390_H + +#include +#include + +/*` +[heading `BOOST_ARCH_SYS390`] + +[@http://en.wikipedia.org/wiki/System/390 System/390] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__s390__`] [__predef_detection__]] + [[`__s390x__`] [__predef_detection__]] + ] + */ + +#define BOOST_ARCH_SYS390 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__s390__) || defined(__s390x__) +# undef BOOST_ARCH_SYS390 +# define BOOST_ARCH_SYS390 BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_ARCH_SYS390 +# define BOOST_ARCH_SYS390_AVAILABLE +#endif + +#define BOOST_ARCH_SYS390_NAME "System/390" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_SYS390,BOOST_ARCH_SYS390_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/x86.h b/libraries/boost/include/boost/predef/architecture/x86.h new file mode 100644 index 0000000000..0ef3ef45ef --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/x86.h @@ -0,0 +1,38 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#include +#include + +#ifndef BOOST_PREDEF_ARCHITECTURE_X86_H +#define BOOST_PREDEF_ARCHITECTURE_X86_H + +/*` +[heading `BOOST_ARCH_X86`] + +[@http://en.wikipedia.org/wiki/X86 Intel x86] architecture. This is +a category to indicate that either `BOOST_ARCH_X86_32` or +`BOOST_ARCH_X86_64` is detected. + */ + +#define BOOST_ARCH_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if BOOST_ARCH_X86_32 || BOOST_ARCH_X86_64 +# undef BOOST_ARCH_X86 +# define BOOST_ARCH_X86 BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_ARCH_X86 +# define BOOST_ARCH_X86_AVAILABLE +#endif + +#define BOOST_ARCH_X86_NAME "Intel x86" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_X86,BOOST_ARCH_X86_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/x86/32.h b/libraries/boost/include/boost/predef/architecture/x86/32.h new file mode 100644 index 0000000000..17fbff554a --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/x86/32.h @@ -0,0 +1,87 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_X86_32_H +#define BOOST_PREDEF_ARCHITECTURE_X86_32_H + +#include +#include + +/*` +[heading `BOOST_ARCH_X86_32`] + +[@http://en.wikipedia.org/wiki/X86 Intel x86] architecture: +If available versions \[3-6\] are specifically detected. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`i386`] [__predef_detection__]] + [[`__i386__`] [__predef_detection__]] + [[`__i486__`] [__predef_detection__]] + [[`__i586__`] [__predef_detection__]] + [[`__i686__`] [__predef_detection__]] + [[`__i386`] [__predef_detection__]] + [[`_M_IX86`] [__predef_detection__]] + [[`_X86_`] [__predef_detection__]] + [[`__THW_INTEL__`] [__predef_detection__]] + [[`__I86__`] [__predef_detection__]] + [[`__INTEL__`] [__predef_detection__]] + + [[`__I86__`] [V.0.0]] + [[`_M_IX86`] [V.0.0]] + [[`__i686__`] [6.0.0]] + [[`__i586__`] [5.0.0]] + [[`__i486__`] [4.0.0]] + [[`__i386__`] [3.0.0]] + ] + */ + +#define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(i386) || defined(__i386__) || \ + defined(__i486__) || defined(__i586__) || \ + defined(__i686__) || defined(__i386) || \ + defined(_M_IX86) || defined(_X86_) || \ + defined(__THW_INTEL__) || defined(__I86__) || \ + defined(__INTEL__) +# undef BOOST_ARCH_X86_32 +# if !defined(BOOST_ARCH_X86_32) && defined(__I86__) +# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER(__I86__,0,0) +# endif +# if !defined(BOOST_ARCH_X86_32) && defined(_M_IX86) +# define BOOST_ARCH_X86_32 BOOST_PREDEF_MAKE_10_VV00(_M_IX86) +# endif +# if !defined(BOOST_ARCH_X86_32) && defined(__i686__) +# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER(6,0,0) +# endif +# if !defined(BOOST_ARCH_X86_32) && defined(__i586__) +# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER(5,0,0) +# endif +# if !defined(BOOST_ARCH_X86_32) && defined(__i486__) +# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER(4,0,0) +# endif +# if !defined(BOOST_ARCH_X86_32) && defined(__i386__) +# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER(3,0,0) +# endif +# if !defined(BOOST_ARCH_X86_32) +# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_ARCH_X86_32 +# define BOOST_ARCH_X86_32_AVAILABLE +#endif + +#define BOOST_ARCH_X86_32_NAME "Intel x86-32" + +#include + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_X86_32,BOOST_ARCH_X86_32_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/x86/64.h b/libraries/boost/include/boost/predef/architecture/x86/64.h new file mode 100644 index 0000000000..f761c92596 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/x86/64.h @@ -0,0 +1,50 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_X86_64_H +#define BOOST_PREDEF_ARCHITECTURE_X86_64_H + +#include +#include + +/*` +[heading `BOOST_ARCH_X86_64`] + +[@http://en.wikipedia.org/wiki/Ia64 Intel IA-64] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__x86_64`] [__predef_detection__]] + [[`__x86_64__`] [__predef_detection__]] + [[`__amd64__`] [__predef_detection__]] + [[`__amd64`] [__predef_detection__]] + [[`_M_X64`] [__predef_detection__]] + ] + */ + +#define BOOST_ARCH_X86_64 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__x86_64) || defined(__x86_64__) || \ + defined(__amd64__) || defined(__amd64) || \ + defined(_M_X64) +# undef BOOST_ARCH_X86_64 +# define BOOST_ARCH_X86_64 BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_ARCH_X86_64 +# define BOOST_ARCH_X86_64_AVAILABLE +#endif + +#define BOOST_ARCH_X86_64_NAME "Intel x86-64" + +#include + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_X86_64,BOOST_ARCH_X86_64_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/z.h b/libraries/boost/include/boost/predef/architecture/z.h new file mode 100644 index 0000000000..3d218aa264 --- /dev/null +++ b/libraries/boost/include/boost/predef/architecture/z.h @@ -0,0 +1,42 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_Z_H +#define BOOST_PREDEF_ARCHITECTURE_Z_H + +#include +#include + +/*` +[heading `BOOST_ARCH_Z`] + +[@http://en.wikipedia.org/wiki/Z/Architecture z/Architecture] architecture. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__SYSC_ZARCH__`] [__predef_detection__]] + ] + */ + +#define BOOST_ARCH_Z BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__SYSC_ZARCH__) +# undef BOOST_ARCH_Z +# define BOOST_ARCH_Z BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_ARCH_Z +# define BOOST_ARCH_Z_AVAILABLE +#endif + +#define BOOST_ARCH_Z_NAME "z/Architecture" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_Z,BOOST_ARCH_Z_NAME) diff --git a/libraries/boost/include/boost/predef/compiler.h b/libraries/boost/include/boost/predef/compiler.h new file mode 100644 index 0000000000..61a4c527ab --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler.h @@ -0,0 +1,43 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#if !defined(BOOST_PREDEF_COMPILER_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) +#ifndef BOOST_PREDEF_COMPILER_H +#define BOOST_PREDEF_COMPILER_H +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/libraries/boost/include/boost/predef/compiler/borland.h b/libraries/boost/include/boost/predef/compiler/borland.h new file mode 100644 index 0000000000..3677cca7fd --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/borland.h @@ -0,0 +1,63 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_BORLAND_H +#define BOOST_PREDEF_COMPILER_BORLAND_H + +#include +#include + +/*` +[heading `BOOST_COMP_BORLAND`] + +[@http://en.wikipedia.org/wiki/C_plus_plus_builder Borland C++] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__BORLANDC__`] [__predef_detection__]] + [[`__CODEGEARC__`] [__predef_detection__]] + + [[`__BORLANDC__`] [V.R.P]] + [[`__CODEGEARC__`] [V.R.P]] + ] + */ + +#define BOOST_COMP_BORLAND BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__BORLANDC__) || defined(__CODEGEARC__) +# if !defined(BOOST_COMP_BORLAND_DETECTION) && (defined(__CODEGEARC__)) +# define BOOST_COMP_BORLAND_DETECTION BOOST_PREDEF_MAKE_0X_VVRP(__CODEGEARC__) +# endif +# if !defined(BOOST_COMP_BORLAND_DETECTION) +# define BOOST_COMP_BORLAND_DETECTION BOOST_PREDEF_MAKE_0X_VVRP(__BORLANDC__) +# endif +#endif + +#ifdef BOOST_COMP_BORLAND_DETECTION +# define BOOST_COMP_BORLAND_AVAILABLE +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_BORLAND_EMULATED BOOST_COMP_BORLAND_DETECTION +# else +# undef BOOST_COMP_BORLAND +# define BOOST_COMP_BORLAND BOOST_COMP_BORLAND_DETECTION +# endif +# include +#endif + +#define BOOST_COMP_BORLAND_NAME "Borland C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_BORLAND,BOOST_COMP_BORLAND_NAME) + +#ifdef BOOST_COMP_BORLAND_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_BORLAND_EMULATED,BOOST_COMP_BORLAND_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/clang.h b/libraries/boost/include/boost/predef/compiler/clang.h new file mode 100644 index 0000000000..56678fe6a5 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/clang.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_CLANG_H +#define BOOST_PREDEF_COMPILER_CLANG_H + +#include +#include + +/*` +[heading `BOOST_COMP_CLANG`] + +[@http://en.wikipedia.org/wiki/Clang Clang] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__clang__`] [__predef_detection__]] + + [[`__clang_major__`, `__clang_minor__`, `__clang_patchlevel__`] [V.R.P]] + ] + */ + +#define BOOST_COMP_CLANG BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__clang__) +# define BOOST_COMP_CLANG_DETECTION BOOST_VERSION_NUMBER(__clang_major__,__clang_minor__,__clang_patchlevel__) +#endif + +#ifdef BOOST_COMP_CLANG_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_CLANG_EMULATED BOOST_COMP_CLANG_DETECTION +# else +# undef BOOST_COMP_CLANG +# define BOOST_COMP_CLANG BOOST_COMP_CLANG_DETECTION +# endif +# define BOOST_COMP_CLANG_AVAILABLE +# include +#endif + +#define BOOST_COMP_CLANG_NAME "Clang" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_CLANG,BOOST_COMP_CLANG_NAME) + +#ifdef BOOST_COMP_CLANG_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_CLANG_EMULATED,BOOST_COMP_CLANG_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/comeau.h b/libraries/boost/include/boost/predef/compiler/comeau.h new file mode 100644 index 0000000000..15a4564896 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/comeau.h @@ -0,0 +1,61 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_COMEAU_H +#define BOOST_PREDEF_COMPILER_COMEAU_H + +#include +#include + +#define BOOST_COMP_COMO BOOST_VERSION_NUMBER_NOT_AVAILABLE + +/*` +[heading `BOOST_COMP_COMO`] + +[@http://en.wikipedia.org/wiki/Comeau_C/C%2B%2B Comeau C++] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__COMO__`] [__predef_detection__]] + + [[`__COMO_VERSION__`] [V.R.P]] + ] + */ + +#if defined(__COMO__) +# if !defined(BOOST_COMP_COMO_DETECTION) && defined(__COMO_VERSION__) +# define BOOST_COMP_COMO_DETECTION BOOST_PREDEF_MAKE_0X_VRP(__COMO_VERSION__) +# endif +# if !defined(BOOST_COMP_COMO_DETECTION) +# define BOOST_COMP_COMO_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_COMP_COMO_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_COMO_EMULATED BOOST_COMP_COMO_DETECTION +# else +# undef BOOST_COMP_COMO +# define BOOST_COMP_COMO BOOST_COMP_COMO_DETECTION +# endif +# define BOOST_COMP_COMO_AVAILABLE +# include +#endif + +#define BOOST_COMP_COMO_NAME "Comeau C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_COMO,BOOST_COMP_COMO_NAME) + +#ifdef BOOST_COMP_COMO_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_COMO_EMULATED,BOOST_COMP_COMO_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/compaq.h b/libraries/boost/include/boost/predef/compiler/compaq.h new file mode 100644 index 0000000000..96a79e6756 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/compaq.h @@ -0,0 +1,66 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_COMPAQ_H +#define BOOST_PREDEF_COMPILER_COMPAQ_H + +#include +#include + +/*` +[heading `BOOST_COMP_DEC`] + +[@http://www.openvms.compaq.com/openvms/brochures/deccplus/ Compaq C/C++] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__DECCXX`] [__predef_detection__]] + [[`__DECC`] [__predef_detection__]] + + [[`__DECCXX_VER`] [V.R.P]] + [[`__DECC_VER`] [V.R.P]] + ] + */ + +#define BOOST_COMP_DEC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__DECC) || defined(__DECCXX) +# if !defined(BOOST_COMP_DEC_DETECTION) && defined(__DECCXX_VER) +# define BOOST_COMP_DEC_DETECTION BOOST_PREDEF_MAKE_10_VVRR0PP00(__DECCXX_VER) +# endif +# if !defined(BOOST_COMP_DEC_DETECTION) && defined(__DECC_VER) +# define BOOST_COMP_DEC_DETECTION BOOST_PREDEF_MAKE_10_VVRR0PP00(__DECC_VER) +# endif +# if !defined(BOOST_COMP_DEC_DETECTION) +# define BOOST_COM_DEC_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_COMP_DEC_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_DEC_EMULATED BOOST_COMP_DEC_DETECTION +# else +# undef BOOST_COMP_DEC +# define BOOST_COMP_DEC BOOST_COMP_DEC_DETECTION +# endif +# define BOOST_COMP_DEC_AVAILABLE +# include +#endif + +#define BOOST_COMP_DEC_NAME "Compaq C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DEC,BOOST_COMP_DEC_NAME) + +#ifdef BOOST_COMP_DEC_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DEC_EMULATED,BOOST_COMP_DEC_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/diab.h b/libraries/boost/include/boost/predef/compiler/diab.h new file mode 100644 index 0000000000..f5a37de7d3 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/diab.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_DIAB_H +#define BOOST_PREDEF_COMPILER_DIAB_H + +#include +#include + +/*` +[heading `BOOST_COMP_DIAB`] + +[@http://www.windriver.com/products/development_suite/wind_river_compiler/ Diab C/C++] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__DCC__`] [__predef_detection__]] + + [[`__VERSION_NUMBER__`] [V.R.P]] + ] + */ + +#define BOOST_COMP_DIAB BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__DCC__) +# define BOOST_COMP_DIAB_DETECTION BOOST_PREDEF_MAKE_10_VRPP(__VERSION_NUMBER__) +#endif + +#ifdef BOOST_COMP_DIAB_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_DIAB_EMULATED BOOST_COMP_DIAB_DETECTION +# else +# undef BOOST_COMP_DIAB +# define BOOST_COMP_DIAB BOOST_COMP_DIAB_DETECTION +# endif +# define BOOST_COMP_DIAB_AVAILABLE +# include +#endif + +#define BOOST_COMP_DIAB_NAME "Diab C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DIAB,BOOST_COMP_DIAB_NAME) + +#ifdef BOOST_COMP_DIAB_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DIAB_EMULATED,BOOST_COMP_DIAB_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/digitalmars.h b/libraries/boost/include/boost/predef/compiler/digitalmars.h new file mode 100644 index 0000000000..9bd58502e0 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/digitalmars.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_DIGITALMARS_H +#define BOOST_PREDEF_COMPILER_DIGITALMARS_H + +#include +#include + +/*` +[heading `BOOST_COMP_DMC`] + +[@http://en.wikipedia.org/wiki/Digital_Mars Digital Mars] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__DMC__`] [__predef_detection__]] + + [[`__DMC__`] [V.R.P]] + ] + */ + +#define BOOST_COMP_DMC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__DMC__) +# define BOOST_COMP_DMC_DETECTION BOOST_PREDEF_MAKE_0X_VRP(__DMC__) +#endif + +#ifdef BOOST_COMP_DMC_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_DMC_EMULATED BOOST_COMP_DMC_DETECTION +# else +# undef BOOST_COMP_DMC +# define BOOST_COMP_DMC BOOST_COMP_DMC_DETECTION +# endif +# define BOOST_COMP_DMC_AVAILABLE +# include +#endif + +#define BOOST_COMP_DMC_NAME "Digital Mars" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DMC,BOOST_COMP_DMC_NAME) + +#ifdef BOOST_COMP_DMC_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DMC_EMULATED,BOOST_COMP_DMC_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/dignus.h b/libraries/boost/include/boost/predef/compiler/dignus.h new file mode 100644 index 0000000000..c65d3dc764 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/dignus.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_DIGNUS_H +#define BOOST_PREDEF_COMPILER_DIGNUS_H + +#include +#include + +/*` +[heading `BOOST_COMP_SYSC`] + +[@http://www.dignus.com/dcxx/ Dignus Systems/C++] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__SYSC__`] [__predef_detection__]] + + [[`__SYSC_VER__`] [V.R.P]] + ] + */ + +#define BOOST_COMP_SYSC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__SYSC__) +# define BOOST_COMP_SYSC_DETECTION BOOST_PREDEF_MAKE_10_VRRPP(__SYSC_VER__) +#endif + +#ifdef BOOST_COMP_SYSC_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_SYSC_EMULATED BOOST_COMP_SYSC_DETECTION +# else +# undef BOOST_COMP_SYSC +# define BOOST_COMP_SYSC BOOST_COMP_SYSC_DETECTION +# endif +# define BOOST_COMP_SYSC_AVAILABLE +# include +#endif + +#define BOOST_COMP_SYSC_NAME "Dignus Systems/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SYSC,BOOST_COMP_SYSC_NAME) + +#ifdef BOOST_COMP_SYSC_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SYSC_EMULATED,BOOST_COMP_SYSC_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/edg.h b/libraries/boost/include/boost/predef/compiler/edg.h new file mode 100644 index 0000000000..2ffb9b0a6d --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/edg.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_EDG_H +#define BOOST_PREDEF_COMPILER_EDG_H + +#include +#include + +/*` +[heading `BOOST_COMP_EDG`] + +[@http://en.wikipedia.org/wiki/Edison_Design_Group EDG C++ Frontend] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__EDG__`] [__predef_detection__]] + + [[`__EDG_VERSION__`] [V.R.0]] + ] + */ + +#define BOOST_COMP_EDG BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__EDG__) +# define BOOST_COMP_EDG_DETECTION BOOST_PREDEF_MAKE_10_VRR(__EDG_VERSION__) +#endif + +#ifdef BOOST_COMP_EDG_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_EDG_EMULATED BOOST_COMP_EDG_DETECTION +# else +# undef BOOST_COMP_EDG +# define BOOST_COMP_EDG BOOST_COMP_EDG_DETECTION +# endif +# define BOOST_COMP_EDG_AVAILABLE +# include +#endif + +#define BOOST_COMP_EDG_NAME "EDG C++ Frontend" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_EDG,BOOST_COMP_EDG_NAME) + +#ifdef BOOST_COMP_EDG_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_EDG_EMULATED,BOOST_COMP_EDG_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/ekopath.h b/libraries/boost/include/boost/predef/compiler/ekopath.h new file mode 100644 index 0000000000..e5cde36752 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/ekopath.h @@ -0,0 +1,57 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_EKOPATH_H +#define BOOST_PREDEF_COMPILER_EKOPATH_H + +#include +#include + +/*` +[heading `BOOST_COMP_PATH`] + +[@http://en.wikipedia.org/wiki/PathScale EKOpath] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__PATHCC__`] [__predef_detection__]] + + [[`__PATHCC__`, `__PATHCC_MINOR__`, `__PATHCC_PATCHLEVEL__`] [V.R.P]] + ] + */ + +#define BOOST_COMP_PATH BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__PATHCC__) +# define BOOST_COMP_PATH_DETECTION \ + BOOST_VERSION_NUMBER(__PATHCC__,__PATHCC_MINOR__,__PATHCC_PATCHLEVEL__) +#endif + +#ifdef BOOST_COMP_PATH_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_PATH_EMULATED BOOST_COMP_PATH_DETECTION +# else +# undef BOOST_COMP_PATH +# define BOOST_COMP_PATH BOOST_COMP_PATH_DETECTION +# endif +# define BOOST_COMP_PATH_AVAILABLE +# include +#endif + +#define BOOST_COMP_PATH_NAME "EKOpath" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PATH,BOOST_COMP_PATH_NAME) + +#ifdef BOOST_COMP_PATH_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PATH_EMULATED,BOOST_COMP_PATH_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/gcc.h b/libraries/boost/include/boost/predef/compiler/gcc.h new file mode 100644 index 0000000000..c2d7fff178 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/gcc.h @@ -0,0 +1,68 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_GCC_H +#define BOOST_PREDEF_COMPILER_GCC_H + +/* Other compilers that emulate this one need to be detected first. */ + +#include + +#include +#include + +/*` +[heading `BOOST_COMP_GNUC`] + +[@http://en.wikipedia.org/wiki/GNU_Compiler_Collection Gnu GCC C/C++] compiler. +Version number available as major, minor, and patch (if available). + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__GNUC__`] [__predef_detection__]] + + [[`__GNUC__`, `__GNUC_MINOR__`, `__GNUC_PATCHLEVEL__`] [V.R.P]] + [[`__GNUC__`, `__GNUC_MINOR__`] [V.R.0]] + ] + */ + +#define BOOST_COMP_GNUC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__GNUC__) +# if !defined(BOOST_COMP_GNUC_DETECTION) && defined(__GNUC_PATCHLEVEL__) +# define BOOST_COMP_GNUC_DETECTION \ + BOOST_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) +# endif +# if !defined(BOOST_COMP_GNUC_DETECTION) +# define BOOST_COMP_GNUC_DETECTION \ + BOOST_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,0) +# endif +#endif + +#ifdef BOOST_COMP_GNUC_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_GNUC_EMULATED BOOST_COMP_GNUC_DETECTION +# else +# undef BOOST_COMP_GNUC +# define BOOST_COMP_GNUC BOOST_COMP_GNUC_DETECTION +# endif +# define BOOST_COMP_GNUC_AVAILABLE +# include +#endif + +#define BOOST_COMP_GNUC_NAME "Gnu GCC C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GNUC,BOOST_COMP_GNUC_NAME) + +#ifdef BOOST_COMP_GNUC_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GNUC_EMULATED,BOOST_COMP_GNUC_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/gcc_xml.h b/libraries/boost/include/boost/predef/compiler/gcc_xml.h new file mode 100644 index 0000000000..acae600c81 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/gcc_xml.h @@ -0,0 +1,53 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_GCC_XML_H +#define BOOST_PREDEF_COMPILER_GCC_XML_H + +#include +#include + +/*` +[heading `BOOST_COMP_GCCXML`] + +[@http://www.gccxml.org/ GCC XML] compiler. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__GCCXML__`] [__predef_detection__]] + ] + */ + +#define BOOST_COMP_GCCXML BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__GCCXML__) +# define BOOST_COMP_GCCXML_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#ifdef BOOST_COMP_GCCXML_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_GCCXML_EMULATED BOOST_COMP_GCCXML_DETECTION +# else +# undef BOOST_COMP_GCCXML +# define BOOST_COMP_GCCXML BOOST_COMP_GCCXML_DETECTION +# endif +# define BOOST_COMP_GCCXML_AVAILABLE +# include +#endif + +#define BOOST_COMP_GCCXML_NAME "GCC XML" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GCCXML,BOOST_COMP_GCCXML_NAME) + +#ifdef BOOST_COMP_GCCXML_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GCCXML_EMULATED,BOOST_COMP_GCCXML_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/greenhills.h b/libraries/boost/include/boost/predef/compiler/greenhills.h new file mode 100644 index 0000000000..23b8f017d8 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/greenhills.h @@ -0,0 +1,66 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_GREENHILLS_H +#define BOOST_PREDEF_COMPILER_GREENHILLS_H + +#include +#include + +/*` +[heading `BOOST_COMP_GHS`] + +[@http://en.wikipedia.org/wiki/Green_Hills_Software Green Hills C/C++] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__ghs`] [__predef_detection__]] + [[`__ghs__`] [__predef_detection__]] + + [[`__GHS_VERSION_NUMBER__`] [V.R.P]] + [[`__ghs`] [V.R.P]] + ] + */ + +#define BOOST_COMP_GHS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__ghs) || defined(__ghs__) +# if !defined(BOOST_COMP_GHS_DETECTION) && defined(__GHS_VERSION_NUMBER__) +# define BOOST_COMP_GHS_DETECTION BOOST_PREDEF_MAKE_10_VRP(__GHS_VERSION_NUMBER__) +# endif +# if !defined(BOOST_COMP_GHS_DETECTION) && defined(__ghs) +# define BOOST_COMP_GHS_DETECTION BOOST_PREDEF_MAKE_10_VRP(__ghs) +# endif +# if !defined(BOOST_COMP_GHS_DETECTION) +# define BOOST_COMP_GHS_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_COMP_GHS_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_GHS_EMULATED BOOST_COMP_GHS_DETECTION +# else +# undef BOOST_COMP_GHS +# define BOOST_COMP_GHS BOOST_COMP_GHS_DETECTION +# endif +# define BOOST_COMP_GHS_AVAILABLE +# include +#endif + +#define BOOST_COMP_GHS_NAME "Green Hills C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GHS,BOOST_COMP_GHS_NAME) + +#ifdef BOOST_COMP_GHS_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GHS_EMULATED,BOOST_COMP_GHS_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/hp_acc.h b/libraries/boost/include/boost/predef/compiler/hp_acc.h new file mode 100644 index 0000000000..7b3ffe9068 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/hp_acc.h @@ -0,0 +1,61 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_HP_ACC_H +#define BOOST_PREDEF_COMPILER_HP_ACC_H + +#include +#include + +/*` +[heading `BOOST_COMP_HPACC`] + +HP aC++ compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__HP_aCC`] [__predef_detection__]] + + [[`__HP_aCC`] [V.R.P]] + ] + */ + +#define BOOST_COMP_HPACC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__HP_aCC) +# if !defined(BOOST_COMP_HPACC_DETECTION) && (__HP_aCC > 1) +# define BOOST_COMP_HPACC_DETECTION BOOST_PREDEF_MAKE_10_VVRRPP(__HP_aCC) +# endif +# if !defined(BOOST_COMP_HPACC_DETECTION) +# define BOOST_COMP_HPACC_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_COMP_HPACC_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_HPACC_EMULATED BOOST_COMP_HPACC_DETECTION +# else +# undef BOOST_COMP_HPACC +# define BOOST_COMP_HPACC BOOST_COMP_HPACC_DETECTION +# endif +# define BOOST_COMP_HPACC_AVAILABLE +# include +#endif + +#define BOOST_COMP_HPACC_NAME "HP aC++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_HPACC,BOOST_COMP_HPACC_NAME) + +#ifdef BOOST_COMP_HPACC_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_HPACC_EMULATED,BOOST_COMP_HPACC_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/iar.h b/libraries/boost/include/boost/predef/compiler/iar.h new file mode 100644 index 0000000000..237f492e29 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/iar.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_IAR_H +#define BOOST_PREDEF_COMPILER_IAR_H + +#include +#include + +/*` +[heading `BOOST_COMP_IAR`] + +IAR C/C++ compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__IAR_SYSTEMS_ICC__`] [__predef_detection__]] + + [[`__VER__`] [V.R.P]] + ] + */ + +#define BOOST_COMP_IAR BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__IAR_SYSTEMS_ICC__) +# define BOOST_COMP_IAR_DETECTION BOOST_PREDEF_MAKE_10_VVRR(__VER__) +#endif + +#ifdef BOOST_COMP_IAR_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_IAR_EMULATED BOOST_COMP_IAR_DETECTION +# else +# undef BOOST_COMP_IAR +# define BOOST_COMP_IAR BOOST_COMP_IAR_DETECTION +# endif +# define BOOST_COMP_IAR_AVAILABLE +# include +#endif + +#define BOOST_COMP_IAR_NAME "IAR C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_IAR,BOOST_COMP_IAR_NAME) + +#ifdef BOOST_COMP_IAR_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_IAR_EMULATED,BOOST_COMP_IAR_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/ibm.h b/libraries/boost/include/boost/predef/compiler/ibm.h new file mode 100644 index 0000000000..6931ebd884 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/ibm.h @@ -0,0 +1,72 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_IBM_H +#define BOOST_PREDEF_COMPILER_IBM_H + +#include +#include + +/*` +[heading `BOOST_COMP_IBM`] + +[@http://en.wikipedia.org/wiki/VisualAge IBM XL C/C++] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__IBMCPP__`] [__predef_detection__]] + [[`__xlC__`] [__predef_detection__]] + [[`__xlc__`] [__predef_detection__]] + + [[`__COMPILER_VER__`] [V.R.P]] + [[`__xlC__`] [V.R.P]] + [[`__xlc__`] [V.R.P]] + [[`__IBMCPP__`] [V.R.P]] + ] + */ + +#define BOOST_COMP_IBM BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__IBMCPP__) || defined(__xlC__) || defined(__xlc__) +# if !defined(BOOST_COMP_IBM_DETECTION) && defined(__COMPILER_VER__) +# define BOOST_COMP_IBM_DETECTION BOOST_PREDEF_MAKE_0X_VRRPPPP(__COMPILER_VER__) +# endif +# if !defined(BOOST_COMP_IBM_DETECTION) && defined(__xlC__) +# define BOOST_COMP_IBM_DETECTION BOOST_PREDEF_MAKE_0X_VVRR(__xlC__) +# endif +# if !defined(BOOST_COMP_IBM_DETECTION) && defined(__xlc__) +# define BOOST_COMP_IBM_DETECTION BOOST_PREDEF_MAKE_0X_VVRR(__xlc__) +# endif +# if !defined(BOOST_COMP_IBM_DETECTION) +# define BOOST_COMP_IBM_DETECTION BOOST_PREDEF_MAKE_10_VRP(__IBMCPP__) +# endif +#endif + +#ifdef BOOST_COMP_IBM_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_IBM_EMULATED BOOST_COMP_IBM_DETECTION +# else +# undef BOOST_COMP_IBM +# define BOOST_COMP_IBM BOOST_COMP_IBM_DETECTION +# endif +# define BOOST_COMP_IBM_AVAILABLE +# include +#endif + +#define BOOST_COMP_IBM_NAME "IBM XL C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_IBM,BOOST_COMP_IBM_NAME) + +#ifdef BOOST_COMP_IBM_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_IBM_EMULATED,BOOST_COMP_IBM_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/intel.h b/libraries/boost/include/boost/predef/compiler/intel.h new file mode 100644 index 0000000000..f8a17ef437 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/intel.h @@ -0,0 +1,79 @@ +/* +Copyright Rene Rivera 2008-2017 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_INTEL_H +#define BOOST_PREDEF_COMPILER_INTEL_H + +#include +#include + +/*` +[heading `BOOST_COMP_INTEL`] + +[@http://en.wikipedia.org/wiki/Intel_C%2B%2B Intel C/C++] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__INTEL_COMPILER`] [__predef_detection__]] + [[`__ICL`] [__predef_detection__]] + [[`__ICC`] [__predef_detection__]] + [[`__ECC`] [__predef_detection__]] + + [[`__INTEL_COMPILER`] [V.R]] + [[`__INTEL_COMPILER` and `__INTEL_COMPILER_UPDATE`] [V.R.P]] + ] + */ + +#define BOOST_COMP_INTEL BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || \ + defined(__ECC) +/*` +[note Because of an Intel mistake in the release version numbering when +`__INTEL_COMPILER` is `9999` it is detected as version 12.1.0.] + */ +# if !defined(BOOST_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 9999) +# define BOOST_COMP_INTEL_DETECTION BOOST_VERSION_NUMBER(12,1,0) +# endif +# if !defined(BOOST_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) +# define BOOST_COMP_INTEL_DETECTION BOOST_VERSION_NUMBER( \ + BOOST_VERSION_NUMBER_MAJOR(BOOST_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)), \ + BOOST_VERSION_NUMBER_MINOR(BOOST_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)), \ + __INTEL_COMPILER_UPDATE) +# endif +# if !defined(BOOST_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) +# define BOOST_COMP_INTEL_DETECTION BOOST_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER) +# endif +# if !defined(BOOST_COMP_INTEL_DETECTION) +# define BOOST_COMP_INTEL_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_COMP_INTEL_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_INTEL_EMULATED BOOST_COMP_INTEL_DETECTION +# else +# undef BOOST_COMP_INTEL +# define BOOST_COMP_INTEL BOOST_COMP_INTEL_DETECTION +# endif +# define BOOST_COMP_INTEL_AVAILABLE +# include +#endif + +#define BOOST_COMP_INTEL_NAME "Intel C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_INTEL,BOOST_COMP_INTEL_NAME) + +#ifdef BOOST_COMP_INTEL_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_INTEL_EMULATED,BOOST_COMP_INTEL_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/kai.h b/libraries/boost/include/boost/predef/compiler/kai.h new file mode 100644 index 0000000000..68ce84e146 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/kai.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_KAI_H +#define BOOST_PREDEF_COMPILER_KAI_H + +#include +#include + +/*` +[heading `BOOST_COMP_KCC`] + +Kai C++ compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__KCC`] [__predef_detection__]] + + [[`__KCC_VERSION`] [V.R.P]] + ] + */ + +#define BOOST_COMP_KCC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__KCC) +# define BOOST_COMP_KCC_DETECTION BOOST_PREDEF_MAKE_0X_VRPP(__KCC_VERSION) +#endif + +#ifdef BOOST_COMP_KCC_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_KCC_EMULATED BOOST_COMP_KCC_DETECTION +# else +# undef BOOST_COMP_KCC +# define BOOST_COMP_KCC BOOST_COMP_KCC_DETECTION +# endif +# define BOOST_COMP_KCC_AVAILABLE +# include +#endif + +#define BOOST_COMP_KCC_NAME "Kai C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_KCC,BOOST_COMP_KCC_NAME) + +#ifdef BOOST_COMP_KCC_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_KCC_EMULATED,BOOST_COMP_KCC_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/llvm.h b/libraries/boost/include/boost/predef/compiler/llvm.h new file mode 100644 index 0000000000..de654eb8ce --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/llvm.h @@ -0,0 +1,57 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_LLVM_H +#define BOOST_PREDEF_COMPILER_LLVM_H + +/* Other compilers that emulate this one need to be detected first. */ + +#include + +#include +#include + +/*` +[heading `BOOST_COMP_LLVM`] + +[@http://en.wikipedia.org/wiki/LLVM LLVM] compiler. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__llvm__`] [__predef_detection__]] + ] + */ + +#define BOOST_COMP_LLVM BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__llvm__) +# define BOOST_COMP_LLVM_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#ifdef BOOST_COMP_LLVM_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_LLVM_EMULATED BOOST_COMP_LLVM_DETECTION +# else +# undef BOOST_COMP_LLVM +# define BOOST_COMP_LLVM BOOST_COMP_LLVM_DETECTION +# endif +# define BOOST_COMP_LLVM_AVAILABLE +# include +#endif + +#define BOOST_COMP_LLVM_NAME "LLVM" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_LLVM,BOOST_COMP_LLVM_NAME) + +#ifdef BOOST_COMP_LLVM_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_LLVM_EMULATED,BOOST_COMP_LLVM_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/metaware.h b/libraries/boost/include/boost/predef/compiler/metaware.h new file mode 100644 index 0000000000..1a32039cef --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/metaware.h @@ -0,0 +1,53 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_METAWARE_H +#define BOOST_PREDEF_COMPILER_METAWARE_H + +#include +#include + +/*` +[heading `BOOST_COMP_HIGHC`] + +MetaWare High C/C++ compiler. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__HIGHC__`] [__predef_detection__]] + ] + */ + +#define BOOST_COMP_HIGHC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__HIGHC__) +# define BOOST_COMP_HIGHC_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#ifdef BOOST_COMP_HIGHC_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_HIGHC_EMULATED BOOST_COMP_HIGHC_DETECTION +# else +# undef BOOST_COMP_HIGHC +# define BOOST_COMP_HIGHC BOOST_COMP_HIGHC_DETECTION +# endif +# define BOOST_COMP_HIGHC_AVAILABLE +# include +#endif + +#define BOOST_COMP_HIGHC_NAME "MetaWare High C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_HIGHC,BOOST_COMP_HIGHC_NAME) + +#ifdef BOOST_COMP_HIGHC_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_HIGHC_EMULATED,BOOST_COMP_HIGHC_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/metrowerks.h b/libraries/boost/include/boost/predef/compiler/metrowerks.h new file mode 100644 index 0000000000..f2d739b958 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/metrowerks.h @@ -0,0 +1,77 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_METROWERKS_H +#define BOOST_PREDEF_COMPILER_METROWERKS_H + +#include +#include + +/*` +[heading `BOOST_COMP_MWERKS`] + +[@http://en.wikipedia.org/wiki/CodeWarrior Metrowerks CodeWarrior] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__MWERKS__`] [__predef_detection__]] + [[`__CWCC__`] [__predef_detection__]] + + [[`__CWCC__`] [V.R.P]] + [[`__MWERKS__`] [V.R.P >= 4.2.0]] + [[`__MWERKS__`] [9.R.0]] + [[`__MWERKS__`] [8.R.0]] + ] + */ + +#define BOOST_COMP_MWERKS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__MWERKS__) || defined(__CWCC__) +# if !defined(BOOST_COMP_MWERKS_DETECTION) && defined(__CWCC__) +# define BOOST_COMP_MWERKS_DETECTION BOOST_PREDEF_MAKE_0X_VRPP(__CWCC__) +# endif +# if !defined(BOOST_COMP_MWERKS_DETECTION) && (__MWERKS__ >= 0x4200) +# define BOOST_COMP_MWERKS_DETECTION BOOST_PREDEF_MAKE_0X_VRPP(__MWERKS__) +# endif +# if !defined(BOOST_COMP_MWERKS_DETECTION) && (__MWERKS__ >= 0x3204) // note the "skip": 04->9.3 +# define BOOST_COMP_MWERKS_DETECTION BOOST_VERSION_NUMBER(9,(__MWERKS__)%100-1,0) +# endif +# if !defined(BOOST_COMP_MWERKS_DETECTION) && (__MWERKS__ >= 0x3200) +# define BOOST_COMP_MWERKS_DETECTION BOOST_VERSION_NUMBER(9,(__MWERKS__)%100,0) +# endif +# if !defined(BOOST_COMP_MWERKS_DETECTION) && (__MWERKS__ >= 0x3000) +# define BOOST_COMP_MWERKS_DETECTION BOOST_VERSION_NUMBER(8,(__MWERKS__)%100,0) +# endif +# if !defined(BOOST_COMP_MWERKS_DETECTION) +# define BOOST_COMP_MWERKS_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_COMP_MWERKS_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_MWERKS_EMULATED BOOST_COMP_MWERKS_DETECTION +# else +# undef BOOST_COMP_MWERKS +# define BOOST_COMP_MWERKS BOOST_COMP_MWERKS_DETECTION +# endif +# define BOOST_COMP_MWERKS_AVAILABLE +# include +#endif + +#define BOOST_COMP_MWERKS_NAME "Metrowerks CodeWarrior" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MWERKS,BOOST_COMP_MWERKS_NAME) + +#ifdef BOOST_COMP_MWERKS_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MWERKS_EMULATED,BOOST_COMP_MWERKS_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/microtec.h b/libraries/boost/include/boost/predef/compiler/microtec.h new file mode 100644 index 0000000000..066a6d2ad9 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/microtec.h @@ -0,0 +1,53 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_MICROTEC_H +#define BOOST_PREDEF_COMPILER_MICROTEC_H + +#include +#include + +/*` +[heading `BOOST_COMP_MRI`] + +[@http://www.mentor.com/microtec/ Microtec C/C++] compiler. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`_MRI`] [__predef_detection__]] + ] + */ + +#define BOOST_COMP_MRI BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(_MRI) +# define BOOST_COMP_MRI_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#ifdef BOOST_COMP_MRI_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_MRI_EMULATED BOOST_COMP_MRI_DETECTION +# else +# undef BOOST_COMP_MRI +# define BOOST_COMP_MRI BOOST_COMP_MRI_DETECTION +# endif +# define BOOST_COMP_MRI_AVAILABLE +# include +#endif + +#define BOOST_COMP_MRI_NAME "Microtec C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MRI,BOOST_COMP_MRI_NAME) + +#ifdef BOOST_COMP_MRI_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MRI_EMULATED,BOOST_COMP_MRI_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/mpw.h b/libraries/boost/include/boost/predef/compiler/mpw.h new file mode 100644 index 0000000000..118330646e --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/mpw.h @@ -0,0 +1,63 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_MPW_H +#define BOOST_PREDEF_COMPILER_MPW_H + +#include +#include + +/*` +[heading `BOOST_COMP_MPW`] + +[@http://en.wikipedia.org/wiki/Macintosh_Programmer%27s_Workshop MPW C++] compiler. +Version number available as major, and minor. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__MRC__`] [__predef_detection__]] + [[`MPW_C`] [__predef_detection__]] + [[`MPW_CPLUS`] [__predef_detection__]] + + [[`__MRC__`] [V.R.0]] + ] + */ + +#define BOOST_COMP_MPW BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__MRC__) || defined(MPW_C) || defined(MPW_CPLUS) +# if !defined(BOOST_COMP_MPW_DETECTION) && defined(__MRC__) +# define BOOST_COMP_MPW_DETECTION BOOST_PREDEF_MAKE_0X_VVRR(__MRC__) +# endif +# if !defined(BOOST_COMP_MPW_DETECTION) +# define BOOST_COMP_MPW_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_COMP_MPW_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_MPW_EMULATED BOOST_COMP_MPW_DETECTION +# else +# undef BOOST_COMP_MPW +# define BOOST_COMP_MPW BOOST_COMP_MPW_DETECTION +# endif +# define BOOST_COMP_MPW_AVAILABLE +# include +#endif + +#define BOOST_COMP_MPW_NAME "MPW C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MPW,BOOST_COMP_MPW_NAME) + +#ifdef BOOST_COMP_MPW_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MPW_EMULATED,BOOST_COMP_MPW_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/palm.h b/libraries/boost/include/boost/predef/compiler/palm.h new file mode 100644 index 0000000000..707925a651 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/palm.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_PALM_H +#define BOOST_PREDEF_COMPILER_PALM_H + +#include +#include + +/*` +[heading `BOOST_COMP_PALM`] + +Palm C/C++ compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`_PACC_VER`] [__predef_detection__]] + + [[`_PACC_VER`] [V.R.P]] + ] + */ + +#define BOOST_COMP_PALM BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(_PACC_VER) +# define BOOST_COMP_PALM_DETECTION BOOST_PREDEF_MAKE_0X_VRRPP000(_PACC_VER) +#endif + +#ifdef BOOST_COMP_PALM_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_PALM_EMULATED BOOST_COMP_PALM_DETECTION +# else +# undef BOOST_COMP_PALM +# define BOOST_COMP_PALM BOOST_COMP_PALM_DETECTION +# endif +# define BOOST_COMP_PALM_AVAILABLE +# include +#endif + +#define BOOST_COMP_PALM_NAME "Palm C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PALM,BOOST_COMP_PALM_NAME) + +#ifdef BOOST_COMP_PALM_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PALM_EMULATED,BOOST_COMP_PALM_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/pgi.h b/libraries/boost/include/boost/predef/compiler/pgi.h new file mode 100644 index 0000000000..e016aeb080 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/pgi.h @@ -0,0 +1,60 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_PGI_H +#define BOOST_PREDEF_COMPILER_PGI_H + +#include +#include + +/*` +[heading `BOOST_COMP_PGI`] + +[@http://en.wikipedia.org/wiki/The_Portland_Group Portland Group C/C++] compiler. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__PGI`] [__predef_detection__]] + + [[`__PGIC__`, `__PGIC_MINOR__`, `__PGIC_PATCHLEVEL__`] [V.R.P]] + ] + */ + +#define BOOST_COMP_PGI BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__PGI) +# if !defined(BOOST_COMP_PGI_DETECTION) && (defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)) +# define BOOST_COMP_PGI_DETECTION BOOST_VERSION_NUMBER(__PGIC__,__PGIC_MINOR__,__PGIC_PATCHLEVEL__) +# endif +# if !defined(BOOST_COMP_PGI_DETECTION) +# define BOOST_COMP_PGI_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_COMP_PGI_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_PGI_EMULATED BOOST_COMP_PGI_DETECTION +# else +# undef BOOST_COMP_PGI +# define BOOST_COMP_PGI BOOST_COMP_PGI_DETECTION +# endif +# define BOOST_COMP_PGI_AVAILABLE +# include +#endif + +#define BOOST_COMP_PGI_NAME "Portland Group C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PGI,BOOST_COMP_PGI_NAME) + +#ifdef BOOST_COMP_PGI_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PGI_EMULATED,BOOST_COMP_PGI_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/sgi_mipspro.h b/libraries/boost/include/boost/predef/compiler/sgi_mipspro.h new file mode 100644 index 0000000000..00739f0c3c --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/sgi_mipspro.h @@ -0,0 +1,66 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_SGI_MIPSPRO_H +#define BOOST_PREDEF_COMPILER_SGI_MIPSPRO_H + +#include +#include + +/*` +[heading `BOOST_COMP_SGI`] + +[@http://en.wikipedia.org/wiki/MIPSpro SGI MIPSpro] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__sgi`] [__predef_detection__]] + [[`sgi`] [__predef_detection__]] + + [[`_SGI_COMPILER_VERSION`] [V.R.P]] + [[`_COMPILER_VERSION`] [V.R.P]] + ] + */ + +#define BOOST_COMP_SGI BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__sgi) || defined(sgi) +# if !defined(BOOST_COMP_SGI_DETECTION) && defined(_SGI_COMPILER_VERSION) +# define BOOST_COMP_SGI_DETECTION BOOST_PREDEF_MAKE_10_VRP(_SGI_COMPILER_VERSION) +# endif +# if !defined(BOOST_COMP_SGI_DETECTION) && defined(_COMPILER_VERSION) +# define BOOST_COMP_SGI_DETECTION BOOST_PREDEF_MAKE_10_VRP(_COMPILER_VERSION) +# endif +# if !defined(BOOST_COMP_SGI_DETECTION) +# define BOOST_COMP_SGI_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_COMP_SGI_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_SGI_EMULATED BOOST_COMP_SGI_DETECTION +# else +# undef BOOST_COMP_SGI +# define BOOST_COMP_SGI BOOST_COMP_SGI_DETECTION +# endif +# define BOOST_COMP_SGI_AVAILABLE +# include +#endif + +#define BOOST_COMP_SGI_NAME "SGI MIPSpro" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SGI,BOOST_COMP_SGI_NAME) + +#ifdef BOOST_COMP_SGI_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SGI_EMULATED,BOOST_COMP_SGI_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/sunpro.h b/libraries/boost/include/boost/predef/compiler/sunpro.h new file mode 100644 index 0000000000..92c3926013 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/sunpro.h @@ -0,0 +1,76 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_SUNPRO_H +#define BOOST_PREDEF_COMPILER_SUNPRO_H + +#include +#include + +/*` +[heading `BOOST_COMP_SUNPRO`] + +[@http://en.wikipedia.org/wiki/Oracle_Solaris_Studio Oracle Solaris Studio] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__SUNPRO_CC`] [__predef_detection__]] + [[`__SUNPRO_C`] [__predef_detection__]] + + [[`__SUNPRO_CC`] [V.R.P]] + [[`__SUNPRO_C`] [V.R.P]] + [[`__SUNPRO_CC`] [VV.RR.P]] + [[`__SUNPRO_C`] [VV.RR.P]] + ] + */ + +#define BOOST_COMP_SUNPRO BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) +# if !defined(BOOST_COMP_SUNPRO_DETECTION) && defined(__SUNPRO_CC) +# if (__SUNPRO_CC < 0x5100) +# define BOOST_COMP_SUNPRO_DETECTION BOOST_PREDEF_MAKE_0X_VRP(__SUNPRO_CC) +# else +# define BOOST_COMP_SUNPRO_DETECTION BOOST_PREDEF_MAKE_0X_VVRRP(__SUNPRO_CC) +# endif +# endif +# if !defined(BOOST_COMP_SUNPRO_DETECTION) && defined(__SUNPRO_C) +# if (__SUNPRO_C < 0x5100) +# define BOOST_COMP_SUNPRO_DETECTION BOOST_PREDEF_MAKE_0X_VRP(__SUNPRO_C) +# else +# define BOOST_COMP_SUNPRO_DETECTION BOOST_PREDEF_MAKE_0X_VVRRP(__SUNPRO_C) +# endif +# endif +# if !defined(BOOST_COMP_SUNPRO_DETECTION) +# define BOOST_COMP_SUNPRO_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_COMP_SUNPRO_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_SUNPRO_EMULATED BOOST_COMP_SUNPRO_DETECTION +# else +# undef BOOST_COMP_SUNPRO +# define BOOST_COMP_SUNPRO BOOST_COMP_SUNPRO_DETECTION +# endif +# define BOOST_COMP_SUNPRO_AVAILABLE +# include +#endif + +#define BOOST_COMP_SUNPRO_NAME "Oracle Solaris Studio" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SUNPRO,BOOST_COMP_SUNPRO_NAME) + +#ifdef BOOST_COMP_SUNPRO_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SUNPRO_EMULATED,BOOST_COMP_SUNPRO_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/tendra.h b/libraries/boost/include/boost/predef/compiler/tendra.h new file mode 100644 index 0000000000..c2bc5e4ef5 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/tendra.h @@ -0,0 +1,53 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_TENDRA_H +#define BOOST_PREDEF_COMPILER_TENDRA_H + +#include +#include + +/*` +[heading `BOOST_COMP_TENDRA`] + +[@http://en.wikipedia.org/wiki/TenDRA_Compiler TenDRA C/C++] compiler. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__TenDRA__`] [__predef_detection__]] + ] + */ + +#define BOOST_COMP_TENDRA BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__TenDRA__) +# define BOOST_COMP_TENDRA_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#ifdef BOOST_COMP_TENDRA_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_TENDRA_EMULATED BOOST_COMP_TENDRA_DETECTION +# else +# undef BOOST_COMP_TENDRA +# define BOOST_COMP_TENDRA BOOST_COMP_TENDRA_DETECTION +# endif +# define BOOST_COMP_TENDRA_AVAILABLE +# include +#endif + +#define BOOST_COMP_TENDRA_NAME "TenDRA C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_TENDRA,BOOST_COMP_TENDRA_NAME) + +#ifdef BOOST_COMP_TENDRA_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_TENDRA_EMULATED,BOOST_COMP_TENDRA_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/visualc.h b/libraries/boost/include/boost/predef/compiler/visualc.h new file mode 100644 index 0000000000..f81e61ed52 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/visualc.h @@ -0,0 +1,105 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_VISUALC_H +#define BOOST_PREDEF_COMPILER_VISUALC_H + +/* Other compilers that emulate this one need to be detected first. */ + +#include + +#include +#include + +/*` +[heading `BOOST_COMP_MSVC`] + +[@http://en.wikipedia.org/wiki/Visual_studio Microsoft Visual C/C++] compiler. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`_MSC_VER`] [__predef_detection__]] + + [[`_MSC_FULL_VER`] [V.R.P]] + [[`_MSC_VER`] [V.R.0]] + ] + +[note Release of Visual Studio after 2015 will no longer be identified +by Boost Predef as the marketing version number. Instead we use the +compiler version number directly, i.e. the _MSC_VER number.] + */ + +#define BOOST_COMP_MSVC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(_MSC_VER) +# if !defined (_MSC_FULL_VER) +# define BOOST_COMP_MSVC_BUILD 0 +# else + /* how many digits does the build number have? */ +# if _MSC_FULL_VER / 10000 == _MSC_VER + /* four digits */ +# define BOOST_COMP_MSVC_BUILD (_MSC_FULL_VER % 10000) +# elif _MSC_FULL_VER / 100000 == _MSC_VER + /* five digits */ +# define BOOST_COMP_MSVC_BUILD (_MSC_FULL_VER % 100000) +# else +# error "Cannot determine build number from _MSC_FULL_VER" +# endif +# endif + /* + VS2014 was skipped in the release sequence for MS. Which + means that the compiler and VS product versions are no longer + in sync. Hence we need to use different formulas for + mapping from MSC version to VS product version. + + VS2017 is a total nightmare when it comes to version numbers. + Hence to avoid arguments relating to that both present and + future.. Any version after VS2015 will use solely the compiler + version, i.e. cl.exe, as the version number here. + */ +# if (_MSC_VER > 1900) +# define BOOST_COMP_MSVC_DETECTION BOOST_VERSION_NUMBER(\ + _MSC_VER/100,\ + _MSC_VER%100,\ + BOOST_COMP_MSVC_BUILD) +# elif (_MSC_VER >= 1900) +# define BOOST_COMP_MSVC_DETECTION BOOST_VERSION_NUMBER(\ + _MSC_VER/100-5,\ + _MSC_VER%100,\ + BOOST_COMP_MSVC_BUILD) +# else +# define BOOST_COMP_MSVC_DETECTION BOOST_VERSION_NUMBER(\ + _MSC_VER/100-6,\ + _MSC_VER%100,\ + BOOST_COMP_MSVC_BUILD) +# endif +#endif + +#ifdef BOOST_COMP_MSVC_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_MSVC_EMULATED BOOST_COMP_MSVC_DETECTION +# else +# undef BOOST_COMP_MSVC +# define BOOST_COMP_MSVC BOOST_COMP_MSVC_DETECTION +# endif +# define BOOST_COMP_MSVC_AVAILABLE +# include +#endif + +#define BOOST_COMP_MSVC_NAME "Microsoft Visual C/C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MSVC,BOOST_COMP_MSVC_NAME) + +#ifdef BOOST_COMP_MSVC_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MSVC_EMULATED,BOOST_COMP_MSVC_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/compiler/watcom.h b/libraries/boost/include/boost/predef/compiler/watcom.h new file mode 100644 index 0000000000..b0e7776d06 --- /dev/null +++ b/libraries/boost/include/boost/predef/compiler/watcom.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_COMPILER_WATCOM_H +#define BOOST_PREDEF_COMPILER_WATCOM_H + +#include +#include + +/*` +[heading `BOOST_COMP_WATCOM`] + +[@http://en.wikipedia.org/wiki/Watcom Watcom C++] compiler. +Version number available as major, and minor. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__WATCOMC__`] [__predef_detection__]] + + [[`__WATCOMC__`] [V.R.P]] + ] + */ + +#define BOOST_COMP_WATCOM BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__WATCOMC__) +# define BOOST_COMP_WATCOM_DETECTION BOOST_PREDEF_MAKE_10_VVRR(__WATCOMC__) +#endif + +#ifdef BOOST_COMP_WATCOM_DETECTION +# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) +# define BOOST_COMP_WATCOM_EMULATED BOOST_COMP_WATCOM_DETECTION +# else +# undef BOOST_COMP_WATCOM +# define BOOST_COMP_WATCOM BOOST_COMP_WATCOM_DETECTION +# endif +# define BOOST_COMP_WATCOM_AVAILABLE +# include +#endif + +#define BOOST_COMP_WATCOM_NAME "Watcom C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_WATCOM,BOOST_COMP_WATCOM_NAME) + +#ifdef BOOST_COMP_WATCOM_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_WATCOM_EMULATED,BOOST_COMP_WATCOM_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/detail/_cassert.h b/libraries/boost/include/boost/predef/detail/_cassert.h new file mode 100644 index 0000000000..940e944e2b --- /dev/null +++ b/libraries/boost/include/boost/predef/detail/_cassert.h @@ -0,0 +1,17 @@ +/* +Copyright Rene Rivera 2011-2012 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_DETAIL__CASSERT_H +#define BOOST_PREDEF_DETAIL__CASSERT_H + +#if defined(__cplusplus) +#include +#else +#include +#endif + +#endif diff --git a/libraries/boost/include/boost/predef/detail/_exception.h b/libraries/boost/include/boost/predef/detail/_exception.h new file mode 100644 index 0000000000..f5a6687a9f --- /dev/null +++ b/libraries/boost/include/boost/predef/detail/_exception.h @@ -0,0 +1,15 @@ +/* +Copyright Rene Rivera 2011-2012 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_DETAIL__EXCEPTION_H +#define BOOST_PREDEF_DETAIL__EXCEPTION_H + +#if defined(__cplusplus) +#include +#endif + +#endif diff --git a/libraries/boost/include/boost/predef/detail/comp_detected.h b/libraries/boost/include/boost/predef/detail/comp_detected.h new file mode 100644 index 0000000000..fda1801b65 --- /dev/null +++ b/libraries/boost/include/boost/predef/detail/comp_detected.h @@ -0,0 +1,10 @@ +/* +Copyright Rene Rivera 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_DETAIL_COMP_DETECTED +#define BOOST_PREDEF_DETAIL_COMP_DETECTED 1 +#endif diff --git a/libraries/boost/include/boost/predef/detail/os_detected.h b/libraries/boost/include/boost/predef/detail/os_detected.h new file mode 100644 index 0000000000..08e10f993a --- /dev/null +++ b/libraries/boost/include/boost/predef/detail/os_detected.h @@ -0,0 +1,10 @@ +/* +Copyright Rene Rivera 2013 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_DETAIL_OS_DETECTED +#define BOOST_PREDEF_DETAIL_OS_DETECTED 1 +#endif diff --git a/libraries/boost/include/boost/predef/detail/platform_detected.h b/libraries/boost/include/boost/predef/detail/platform_detected.h new file mode 100644 index 0000000000..4faf6938d8 --- /dev/null +++ b/libraries/boost/include/boost/predef/detail/platform_detected.h @@ -0,0 +1,10 @@ +/* +Copyright Rene Rivera 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_DETAIL_PLAT_DETECTED +#define BOOST_PREDEF_DETAIL_PLAT_DETECTED 1 +#endif diff --git a/libraries/boost/include/boost/predef/detail/test.h b/libraries/boost/include/boost/predef/detail/test.h new file mode 100644 index 0000000000..546a9e407d --- /dev/null +++ b/libraries/boost/include/boost/predef/detail/test.h @@ -0,0 +1,17 @@ +/* +Copyright Rene Rivera 2011-2012 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_DETAIL_TEST_H +#define BOOST_PREDEF_DETAIL_TEST_H + +#if !defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) + +#define BOOST_PREDEF_DECLARE_TEST(x,s) + +#endif + +#endif diff --git a/libraries/boost/include/boost/predef/hardware.h b/libraries/boost/include/boost/predef/hardware.h new file mode 100644 index 0000000000..972b73af68 --- /dev/null +++ b/libraries/boost/include/boost/predef/hardware.h @@ -0,0 +1,16 @@ +/* +Copyright Charly Chevalier 2015 +Copyright Joel Falcou 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#if !defined(BOOST_PREDEF_HARDWARE_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) +#ifndef BOOST_PREDEF_HARDWARE_H +#define BOOST_PREDEF_HARDWARE_H +#endif + +#include + +#endif diff --git a/libraries/boost/include/boost/predef/hardware/simd.h b/libraries/boost/include/boost/predef/hardware/simd.h new file mode 100644 index 0000000000..ac5c9da2ca --- /dev/null +++ b/libraries/boost/include/boost/predef/hardware/simd.h @@ -0,0 +1,119 @@ +/* +Copyright Charly Chevalier 2015 +Copyright Joel Falcou 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#include +#include +#include +#include + +#ifndef BOOST_PREDEF_HARDWARE_SIMD_H +#define BOOST_PREDEF_HARDWARE_SIMD_H + +#include + +/*` + [section Using the `BOOST_HW_SIMD_*` predefs] + [include ../doc/hardware_simd.qbk] + [endsect] + + [/ --------------------------- ] + + [section `BOOST_HW_SIMD_*`] + + [heading `BOOST_HW_SIMD`] + + The SIMD extension detected for a specific architectures. + Version number depends on the detected extension. + + [table + [[__predef_symbol__] [__predef_version__]] + + [[`BOOST_HW_SIMD_X86_AVAILABLE`] [__predef_detection__]] + [[`BOOST_HW_SIMD_X86_AMD_AVAILABLE`] [__predef_detection__]] + [[`BOOST_HW_SIMD_ARM_AVAILABLE`] [__predef_detection__]] + [[`BOOST_HW_SIMD_PPC_AVAILABLE`] [__predef_detection__]] + ] + + [include ../include/boost/predef/hardware/simd/x86.h] + [include ../include/boost/predef/hardware/simd/x86_amd.h] + [include ../include/boost/predef/hardware/simd/arm.h] + [include ../include/boost/predef/hardware/simd/ppc.h] + + [endsect] + + [/ --------------------------- ] + + [section `BOOST_HW_SIMD_X86_*_VERSION`] + [include ../include/boost/predef/hardware/simd/x86/versions.h] + [endsect] + + [section `BOOST_HW_SIMD_X86_AMD_*_VERSION`] + [include ../include/boost/predef/hardware/simd/x86_amd/versions.h] + [endsect] + + [section `BOOST_HW_SIMD_ARM_*_VERSION`] + [include ../include/boost/predef/hardware/simd/arm/versions.h] + [endsect] + + [section `BOOST_HW_SIMD_PPC_*_VERSION`] + [include ../include/boost/predef/hardware/simd/ppc/versions.h] + [endsect] + + */ + +// We check if SIMD extension of multiples architectures have been detected, +// if yes, then this is an error! +// +// NOTE: _X86_AMD implies _X86, so there is no need to check for it here! +// +#if defined(BOOST_HW_SIMD_ARM_AVAILABLE) && defined(BOOST_HW_SIMD_PPC_AVAILABLE) ||\ + defined(BOOST_HW_SIMD_ARM_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AVAILABLE) ||\ + defined(BOOST_HW_SIMD_PPC_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AVAILABLE) +# error "Multiple SIMD architectures detected, this cannot happen!" +#endif + +#if defined(BOOST_HW_SIMD_X86_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AMD_AVAILABLE) + // If both standard _X86 and _X86_AMD are available, + // then take the biggest version of the two! +# if BOOST_HW_SIMD_X86 >= BOOST_HW_SIMD_X86_AMD +# define BOOST_HW_SIMD BOOST_HW_SIMD_X86 +# else +# define BOOST_HW_SIMD BOOST_HW_SIMD_X86_AMD +# endif +#endif + +#if !defined(BOOST_HW_SIMD) + // At this point, only one of these two is defined +# if defined(BOOST_HW_SIMD_X86_AVAILABLE) +# define BOOST_HW_SIMD BOOST_HW_SIMD_X86 +# endif +# if defined(BOOST_HW_SIMD_X86_AMD_AVAILABLE) +# define BOOST_HW_SIMD BOOST_HW_SIMD_X86_AMD +# endif +#endif + +#if defined(BOOST_HW_SIMD_ARM_AVAILABLE) +# define BOOST_HW_SIMD BOOST_HW_SIMD_ARM +#endif + +#if defined(BOOST_HW_SIMD_PPC_AVAILABLE) +# define BOOST_HW_SIMD BOOST_HW_SIMD_PPC +#endif + +#if defined(BOOST_HW_SIMD) +# define BOOST_HW_SIMD_AVAILABLE +#else +# define BOOST_HW_SIMD BOOST_VERSION_NUMBER_NOT_AVAILABLE +#endif + +#define BOOST_HW_SIMD_NAME "Hardware SIMD" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD, BOOST_HW_SIMD_NAME) diff --git a/libraries/boost/include/boost/predef/hardware/simd/arm.h b/libraries/boost/include/boost/predef/hardware/simd/arm.h new file mode 100644 index 0000000000..3b3fc3fa36 --- /dev/null +++ b/libraries/boost/include/boost/predef/hardware/simd/arm.h @@ -0,0 +1,59 @@ +/* +Copyright Charly Chevalier 2015 +Copyright Joel Falcou 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_HARDWARE_SIMD_ARM_H +#define BOOST_PREDEF_HARDWARE_SIMD_ARM_H + +#include +#include + +/*` + [heading `BOOST_HW_SIMD_ARM`] + + The SIMD extension for ARM (*if detected*). + Version number depends on the most recent detected extension. + + [table + [[__predef_symbol__] [__predef_version__]] + + [[`__ARM_NEON__`] [__predef_detection__]] + [[`__aarch64__`] [__predef_detection__]] + [[`_M_ARM`] [__predef_detection__]] + [[`_M_ARM64`] [__predef_detection__]] + ] + + [table + [[__predef_symbol__] [__predef_version__]] + + [[`__ARM_NEON__`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] + [[`__aarch64__`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] + [[`_M_ARM`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] + [[`_M_ARM64`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] + ] + + */ + +#define BOOST_HW_SIMD_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#undef BOOST_HW_SIMD_ARM +#if !defined(BOOST_HW_SIMD_ARM) && (defined(__ARM_NEON__) || defined(__aarch64__) || defined (_M_ARM) || defined (_M_ARM64)) +# define BOOST_HW_SIMD_ARM BOOST_HW_SIMD_ARM_NEON_VERSION +#endif + +#if !defined(BOOST_HW_SIMD_ARM) +# define BOOST_HW_SIMD_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE +#else +# define BOOST_HW_SIMD_ARM_AVAILABLE +#endif + +#define BOOST_HW_SIMD_ARM_NAME "ARM SIMD" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_ARM, BOOST_HW_SIMD_ARM_NAME) diff --git a/libraries/boost/include/boost/predef/hardware/simd/arm/versions.h b/libraries/boost/include/boost/predef/hardware/simd/arm/versions.h new file mode 100644 index 0000000000..8425b31862 --- /dev/null +++ b/libraries/boost/include/boost/predef/hardware/simd/arm/versions.h @@ -0,0 +1,32 @@ +/* +Copyright Charly Chevalier 2015 +Copyright Joel Falcou 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_HARDWARE_SIMD_ARM_VERSIONS_H +#define BOOST_PREDEF_HARDWARE_SIMD_ARM_VERSIONS_H + +#include + +/*` + Those defines represent ARM SIMD extensions versions. + + [note You *MUST* compare them with the predef `BOOST_HW_SIMD_ARM`.] + */ + +// --------------------------------- + +/*` + [heading `BOOST_HW_SIMD_ARM_NEON_VERSION`] + + The [@https://en.wikipedia.org/wiki/ARM_architecture#Advanced_SIMD_.28NEON.29 NEON] + ARM extension version number. + + Version number is: *1.0.0*. + */ +#define BOOST_HW_SIMD_ARM_NEON_VERSION BOOST_VERSION_NUMBER(1, 0, 0) + +#endif diff --git a/libraries/boost/include/boost/predef/hardware/simd/ppc.h b/libraries/boost/include/boost/predef/hardware/simd/ppc.h new file mode 100644 index 0000000000..eef25c2d26 --- /dev/null +++ b/libraries/boost/include/boost/predef/hardware/simd/ppc.h @@ -0,0 +1,69 @@ +/* +Copyright Charly Chevalier 2015 +Copyright Joel Falcou 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_HARDWARE_SIMD_PPC_H +#define BOOST_PREDEF_HARDWARE_SIMD_PPC_H + +#include +#include + +/*` + [heading `BOOST_HW_SIMD_PPC`] + + The SIMD extension for PowerPC (*if detected*). + Version number depends on the most recent detected extension. + + [table + [[__predef_symbol__] [__predef_version__]] + + [[`__VECTOR4DOUBLE__`] [__predef_detection__]] + + [[`__ALTIVEC__`] [__predef_detection__]] + [[`__VEC__`] [__predef_detection__]] + + [[`__VSX__`] [__predef_detection__]] + ] + + [table + [[__predef_symbol__] [__predef_version__]] + + [[`__VECTOR4DOUBLE__`] [BOOST_HW_SIMD_PPC_QPX_VERSION]] + + [[`__ALTIVEC__`] [BOOST_HW_SIMD_PPC_VMX_VERSION]] + [[`__VEC__`] [BOOST_HW_SIMD_PPC_VMX_VERSION]] + + [[`__VSX__`] [BOOST_HW_SIMD_PPC_VSX_VERSION]] + ] + + */ + +#define BOOST_HW_SIMD_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#undef BOOST_HW_SIMD_PPC +#if !defined(BOOST_HW_SIMD_PPC) && defined(__VECTOR4DOUBLE__) +# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_QPX_VERSION +#endif +#if !defined(BOOST_HW_SIMD_PPC) && defined(__VSX__) +# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_VSX_VERSION +#endif +#if !defined(BOOST_HW_SIMD_PPC) && (defined(__ALTIVEC__) || defined(__VEC__)) +# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_VMX_VERSION +#endif + +#if !defined(BOOST_HW_SIMD_PPC) +# define BOOST_HW_SIMD_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE +#else +# define BOOST_HW_SIMD_PPC_AVAILABLE +#endif + +#define BOOST_HW_SIMD_PPC_NAME "PPC SIMD" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_PPC, BOOST_HW_SIMD_PPC_NAME) diff --git a/libraries/boost/include/boost/predef/hardware/simd/ppc/versions.h b/libraries/boost/include/boost/predef/hardware/simd/ppc/versions.h new file mode 100644 index 0000000000..ffe3f0b1e5 --- /dev/null +++ b/libraries/boost/include/boost/predef/hardware/simd/ppc/versions.h @@ -0,0 +1,51 @@ +/* +Copyright Charly Chevalier 2015 +Copyright Joel Falcou 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_HARDWARE_SIMD_PPC_VERSIONS_H +#define BOOST_PREDEF_HARDWARE_SIMD_PPC_VERSIONS_H + +#include + +/*` + Those defines represent Power PC SIMD extensions versions. + + [note You *MUST* compare them with the predef `BOOST_HW_SIMD_PPC`.] + */ + +// --------------------------------- + +/*` + [heading `BOOST_HW_SIMD_PPC_VMX_VERSION`] + + The [@https://en.wikipedia.org/wiki/AltiVec#VMX128 VMX] powerpc extension + version number. + + Version number is: *1.0.0*. + */ +#define BOOST_HW_SIMD_PPC_VMX_VERSION BOOST_VERSION_NUMBER(1, 0, 0) + +/*` + [heading `BOOST_HW_SIMD_PPC_VSX_VERSION`] + + The [@https://en.wikipedia.org/wiki/AltiVec#VSX VSX] powerpc extension version + number. + + Version number is: *1.1.0*. + */ +#define BOOST_HW_SIMD_PPC_VSX_VERSION BOOST_VERSION_NUMBER(1, 1, 0) + +/*` + [heading `BOOST_HW_SIMD_PPC_QPX_VERSION`] + + The QPX powerpc extension version number. + + Version number is: *2.0.0*. + */ +#define BOOST_HW_SIMD_PPC_QPX_VERSION BOOST_VERSION_NUMBER(2, 0, 0) + +#endif diff --git a/libraries/boost/include/boost/predef/hardware/simd/x86.h b/libraries/boost/include/boost/predef/hardware/simd/x86.h new file mode 100644 index 0000000000..88bd81e362 --- /dev/null +++ b/libraries/boost/include/boost/predef/hardware/simd/x86.h @@ -0,0 +1,123 @@ +/* +Copyright Charly Chevalier 2015 +Copyright Joel Falcou 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_H +#define BOOST_PREDEF_HARDWARE_SIMD_X86_H + +#include +#include + +/*` + [heading `BOOST_HW_SIMD_X86`] + + The SIMD extension for x86 (*if detected*). + Version number depends on the most recent detected extension. + + [table + [[__predef_symbol__] [__predef_version__]] + + [[`__SSE__`] [__predef_detection__]] + [[`_M_X64`] [__predef_detection__]] + [[`_M_IX86_FP >= 1`] [__predef_detection__]] + + [[`__SSE2__`] [__predef_detection__]] + [[`_M_X64`] [__predef_detection__]] + [[`_M_IX86_FP >= 2`] [__predef_detection__]] + + [[`__SSE3__`] [__predef_detection__]] + + [[`__SSSE3__`] [__predef_detection__]] + + [[`__SSE4_1__`] [__predef_detection__]] + + [[`__SSE4_2__`] [__predef_detection__]] + + [[`__AVX__`] [__predef_detection__]] + + [[`__FMA__`] [__predef_detection__]] + + [[`__AVX2__`] [__predef_detection__]] + ] + + [table + [[__predef_symbol__] [__predef_version__]] + + [[`__SSE__`] [BOOST_HW_SIMD_X86_SSE_VERSION]] + [[`_M_X64`] [BOOST_HW_SIMD_X86_SSE_VERSION]] + [[`_M_IX86_FP >= 1`] [BOOST_HW_SIMD_X86_SSE_VERSION]] + + [[`__SSE2__`] [BOOST_HW_SIMD_X86_SSE2_VERSION]] + [[`_M_X64`] [BOOST_HW_SIMD_X86_SSE2_VERSION]] + [[`_M_IX86_FP >= 2`] [BOOST_HW_SIMD_X86_SSE2_VERSION]] + + [[`__SSE3__`] [BOOST_HW_SIMD_X86_SSE3_VERSION]] + + [[`__SSSE3__`] [BOOST_HW_SIMD_X86_SSSE3_VERSION]] + + [[`__SSE4_1__`] [BOOST_HW_SIMD_X86_SSE4_1_VERSION]] + + [[`__SSE4_2__`] [BOOST_HW_SIMD_X86_SSE4_2_VERSION]] + + [[`__AVX__`] [BOOST_HW_SIMD_X86_AVX_VERSION]] + + [[`__FMA__`] [BOOST_HW_SIMD_X86_FMA3_VERSION]] + + [[`__AVX2__`] [BOOST_HW_SIMD_X86_AVX2_VERSION]] + ] + + */ + +#define BOOST_HW_SIMD_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#undef BOOST_HW_SIMD_X86 +#if !defined(BOOST_HW_SIMD_X86) && defined(__MIC__) +# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_MIC_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86) && defined(__AVX2__) +# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_AVX2_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86) && defined(__AVX__) +# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_AVX_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86) && defined(__FMA__) +# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_FMA_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86) && defined(__SSE4_2__) +# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE4_2_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86) && defined(__SSE4_1__) +# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE4_1_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86) && defined(__SSSE3__) +# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSSE3_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86) && defined(__SSE3__) +# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE3_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86) && (defined(__SSE2__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2)) +# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE2_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86) && (defined(__SSE__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1)) +# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86) && defined(__MMX__) +# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_MMX_VERSION +#endif + +#if !defined(BOOST_HW_SIMD_X86) +# define BOOST_HW_SIMD_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE +#else +# define BOOST_HW_SIMD_X86_AVAILABLE +#endif + +#define BOOST_HW_SIMD_X86_NAME "x86 SIMD" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_X86, BOOST_HW_SIMD_X86_NAME) diff --git a/libraries/boost/include/boost/predef/hardware/simd/x86/versions.h b/libraries/boost/include/boost/predef/hardware/simd/x86/versions.h new file mode 100644 index 0000000000..0c7a4d3813 --- /dev/null +++ b/libraries/boost/include/boost/predef/hardware/simd/x86/versions.h @@ -0,0 +1,129 @@ +/* +Copyright Charly Chevalier 2015 +Copyright Joel Falcou 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_VERSIONS_H +#define BOOST_PREDEF_HARDWARE_SIMD_X86_VERSIONS_H + +#include + +/*` + Those defines represent x86 SIMD extensions versions. + + [note You *MUST* compare them with the predef `BOOST_HW_SIMD_X86`.] + */ + +// --------------------------------- + +/*` + [heading `BOOST_HW_SIMD_X86_MMX_VERSION`] + + The [@https://en.wikipedia.org/wiki/MMX_(instruction_set) MMX] x86 extension + version number. + + Version number is: *0.99.0*. + */ +#define BOOST_HW_SIMD_X86_MMX_VERSION BOOST_VERSION_NUMBER(0, 99, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_SSE_VERSION`] + + The [@https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions SSE] x86 extension + version number. + + Version number is: *1.0.0*. + */ +#define BOOST_HW_SIMD_X86_SSE_VERSION BOOST_VERSION_NUMBER(1, 0, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_SSE2_VERSION`] + + The [@https://en.wikipedia.org/wiki/SSE2 SSE2] x86 extension version number. + + Version number is: *2.0.0*. + */ +#define BOOST_HW_SIMD_X86_SSE2_VERSION BOOST_VERSION_NUMBER(2, 0, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_SSE3_VERSION`] + + The [@https://en.wikipedia.org/wiki/SSE3 SSE3] x86 extension version number. + + Version number is: *3.0.0*. + */ +#define BOOST_HW_SIMD_X86_SSE3_VERSION BOOST_VERSION_NUMBER(3, 0, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_SSSE3_VERSION`] + + The [@https://en.wikipedia.org/wiki/SSSE3 SSSE3] x86 extension version number. + + Version number is: *3.1.0*. + */ +#define BOOST_HW_SIMD_X86_SSSE3_VERSION BOOST_VERSION_NUMBER(3, 1, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_SSE4_1_VERSION`] + + The [@https://en.wikipedia.org/wiki/SSE4#SSE4.1 SSE4_1] x86 extension version + number. + + Version number is: *4.1.0*. + */ +#define BOOST_HW_SIMD_X86_SSE4_1_VERSION BOOST_VERSION_NUMBER(4, 1, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_SSE4_2_VERSION`] + + The [@https://en.wikipedia.org/wiki/SSE4##SSE4.2 SSE4_2] x86 extension version + number. + + Version number is: *4.2.0*. + */ +#define BOOST_HW_SIMD_X86_SSE4_2_VERSION BOOST_VERSION_NUMBER(4, 2, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_AVX_VERSION`] + + The [@https://en.wikipedia.org/wiki/Advanced_Vector_Extensions AVX] x86 + extension version number. + + Version number is: *5.0.0*. + */ +#define BOOST_HW_SIMD_X86_AVX_VERSION BOOST_VERSION_NUMBER(5, 0, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_FMA3_VERSION`] + + The [@https://en.wikipedia.org/wiki/FMA_instruction_set FMA3] x86 extension + version number. + + Version number is: *5.2.0*. + */ +#define BOOST_HW_SIMD_X86_FMA3_VERSION BOOST_VERSION_NUMBER(5, 2, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_AVX2_VERSION`] + + The [@https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#Advanced_Vector_Extensions_2 AVX2] + x86 extension version number. + + Version number is: *5.3.0*. + */ +#define BOOST_HW_SIMD_X86_AVX2_VERSION BOOST_VERSION_NUMBER(5, 3, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_MIC_VERSION`] + + The [@https://en.wikipedia.org/wiki/Xeon_Phi MIC] (Xeon Phi) x86 extension + version number. + + Version number is: *9.0.0*. + */ +#define BOOST_HW_SIMD_X86_MIC_VERSION BOOST_VERSION_NUMBER(9, 0, 0) + +#endif diff --git a/libraries/boost/include/boost/predef/hardware/simd/x86_amd.h b/libraries/boost/include/boost/predef/hardware/simd/x86_amd.h new file mode 100644 index 0000000000..c80d1ce2b7 --- /dev/null +++ b/libraries/boost/include/boost/predef/hardware/simd/x86_amd.h @@ -0,0 +1,87 @@ +/* +Copyright Charly Chevalier 2015 +Copyright Joel Falcou 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_H +#define BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_H + +#include +#include + +/*` + [heading `BOOST_HW_SIMD_X86_AMD`] + + The SIMD extension for x86 (AMD) (*if detected*). + Version number depends on the most recent detected extension. + + [table + [[__predef_symbol__] [__predef_version__]] + + [[`__SSE4A__`] [__predef_detection__]] + + [[`__FMA4__`] [__predef_detection__]] + + [[`__XOP__`] [__predef_detection__]] + + [[`BOOST_HW_SIMD_X86`] [__predef_detection__]] + ] + + [table + [[__predef_symbol__] [__predef_version__]] + + [[`__SSE4A__`] [BOOST_HW_SIMD_X86_SSE4A_VERSION]] + + [[`__FMA4__`] [BOOST_HW_SIMD_X86_FMA4_VERSION]] + + [[`__XOP__`] [BOOST_HW_SIMD_X86_XOP_VERSION]] + + [[`BOOST_HW_SIMD_X86`] [BOOST_HW_SIMD_X86]] + ] + + [note This predef includes every other x86 SIMD extensions and also has other + more specific extensions (FMA4, XOP, SSE4a). You should use this predef + instead of `BOOST_HW_SIMD_X86` to test if those specific extensions have + been detected.] + + */ + +#define BOOST_HW_SIMD_X86_AMD BOOST_VERSION_NUMBER_NOT_AVAILABLE + +// AMD CPUs also use x86 architecture. We first try to detect if any AMD +// specific extension are detected, if yes, then try to detect more recent x86 +// common extensions. + +#undef BOOST_HW_SIMD_X86_AMD +#if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__XOP__) +# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_XOP_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__FMA4__) +# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_FMA4_VERSION +#endif +#if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__SSE4A__) +# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION +#endif + +#if !defined(BOOST_HW_SIMD_X86_AMD) +# define BOOST_HW_SIMD_X86_AMD BOOST_VERSION_NUMBER_NOT_AVAILABLE +#else + // At this point, we know that we have an AMD CPU, we do need to check for + // other x86 extensions to determine the final version number. +# include +# if BOOST_HW_SIMD_X86 > BOOST_HW_SIMD_X86_AMD +# undef BOOST_HW_SIMD_X86_AMD +# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86 +# endif +# define BOOST_HW_SIMD_X86_AMD_AVAILABLE +#endif + +#define BOOST_HW_SIMD_X86_AMD_NAME "x86 (AMD) SIMD" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_X86_AMD, BOOST_HW_SIMD_X86_AMD_NAME) diff --git a/libraries/boost/include/boost/predef/hardware/simd/x86_amd/versions.h b/libraries/boost/include/boost/predef/hardware/simd/x86_amd/versions.h new file mode 100644 index 0000000000..1f9e96c500 --- /dev/null +++ b/libraries/boost/include/boost/predef/hardware/simd/x86_amd/versions.h @@ -0,0 +1,51 @@ +/* +Copyright Charly Chevalier 2015 +Copyright Joel Falcou 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_VERSIONS_H +#define BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_VERSIONS_H + +#include + +/*` + Those defines represent x86 (AMD specific) SIMD extensions versions. + + [note You *MUST* compare them with the predef `BOOST_HW_SIMD_X86_AMD`.] + */ + + +// --------------------------------- + +/*` + [heading `BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION`] + + [@https://en.wikipedia.org/wiki/SSE4##SSE4A SSE4A] x86 extension (AMD specific). + + Version number is: *4.0.0*. + */ +#define BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION BOOST_VERSION_NUMBER(4, 0, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_AMD_FMA4_VERSION`] + + [@https://en.wikipedia.org/wiki/FMA_instruction_set#FMA4_instruction_set FMA4] x86 extension (AMD specific). + + Version number is: *5.1.0*. + */ +#define BOOST_HW_SIMD_X86_AMD_FMA4_VERSION BOOST_VERSION_NUMBER(5, 1, 0) + +/*` + [heading `BOOST_HW_SIMD_X86_AMD_XOP_VERSION`] + + [@https://en.wikipedia.org/wiki/XOP_instruction_set XOP] x86 extension (AMD specific). + + Version number is: *5.1.1*. + */ +#define BOOST_HW_SIMD_X86_AMD_XOP_VERSION BOOST_VERSION_NUMBER(5, 1, 1) + + +#endif diff --git a/libraries/boost/include/boost/predef/language.h b/libraries/boost/include/boost/predef/language.h new file mode 100644 index 0000000000..0a317d5ece --- /dev/null +++ b/libraries/boost/include/boost/predef/language.h @@ -0,0 +1,17 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#if !defined(BOOST_PREDEF_LANGUAGE_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) +#ifndef BOOST_PREDEF_LANGUAGE_H +#define BOOST_PREDEF_LANGUAGE_H +#endif + +#include +#include +#include + +#endif diff --git a/libraries/boost/include/boost/predef/language/objc.h b/libraries/boost/include/boost/predef/language/objc.h new file mode 100644 index 0000000000..24e3ad3c5c --- /dev/null +++ b/libraries/boost/include/boost/predef/language/objc.h @@ -0,0 +1,42 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LANGUAGE_OBJC_H +#define BOOST_PREDEF_LANGUAGE_OBJC_H + +#include +#include + +/*` +[heading `BOOST_LANG_OBJC`] + +[@http://en.wikipedia.org/wiki/Objective-C Objective-C] language. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__OBJC__`] [__predef_detection__]] + ] + */ + +#define BOOST_LANG_OBJC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__OBJC__) +# undef BOOST_LANG_OBJC +# define BOOST_LANG_OBJC BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_LANG_OBJC +# define BOOST_LANG_OBJC_AVAILABLE +#endif + +#define BOOST_LANG_OBJC_NAME "Objective-C" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_OBJC,BOOST_LANG_OBJC_NAME) diff --git a/libraries/boost/include/boost/predef/language/stdc.h b/libraries/boost/include/boost/predef/language/stdc.h new file mode 100644 index 0000000000..db25c12dc0 --- /dev/null +++ b/libraries/boost/include/boost/predef/language/stdc.h @@ -0,0 +1,53 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LANGUAGE_STDC_H +#define BOOST_PREDEF_LANGUAGE_STDC_H + +#include +#include + +/*` +[heading `BOOST_LANG_STDC`] + +[@http://en.wikipedia.org/wiki/C_(programming_language) Standard C] language. +If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__STDC__`] [__predef_detection__]] + + [[`__STDC_VERSION__`] [V.R.P]] + ] + */ + +#define BOOST_LANG_STDC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__STDC__) +# undef BOOST_LANG_STDC +# if defined(__STDC_VERSION__) +# if (__STDC_VERSION__ > 100) +# define BOOST_LANG_STDC BOOST_PREDEF_MAKE_YYYYMM(__STDC_VERSION__) +# else +# define BOOST_LANG_STDC BOOST_VERSION_NUMBER_AVAILABLE +# endif +# else +# define BOOST_LANG_STDC BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_LANG_STDC +# define BOOST_LANG_STDC_AVAILABLE +#endif + +#define BOOST_LANG_STDC_NAME "Standard C" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDC,BOOST_LANG_STDC_NAME) diff --git a/libraries/boost/include/boost/predef/language/stdcpp.h b/libraries/boost/include/boost/predef/language/stdcpp.h new file mode 100644 index 0000000000..34dc8c7deb --- /dev/null +++ b/libraries/boost/include/boost/predef/language/stdcpp.h @@ -0,0 +1,121 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LANGUAGE_STDCPP_H +#define BOOST_PREDEF_LANGUAGE_STDCPP_H + +#include +#include + +/*` +[heading `BOOST_LANG_STDCPP`] + +[@http://en.wikipedia.org/wiki/C%2B%2B Standard C++] language. +If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date. +Because of the way the C++ standardization process works the +defined version year will not be the commonly known year of the standard. +Specifically the defined versions are: + +[table Detected Version Number vs. C++ Standard Year + [[Detected Version Number] [Standard Year] [C++ Standard]] + [[27.11.1] [1998] [ISO/IEC 14882:1998]] + [[41.12.1] [2011] [ISO/IEC 14882:2011]] +] + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__cplusplus`] [__predef_detection__]] + + [[`__cplusplus`] [YYYY.MM.1]] + ] + */ + +#define BOOST_LANG_STDCPP BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__cplusplus) +# undef BOOST_LANG_STDCPP +# if (__cplusplus > 100) +# define BOOST_LANG_STDCPP BOOST_PREDEF_MAKE_YYYYMM(__cplusplus) +# else +# define BOOST_LANG_STDCPP BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_LANG_STDCPP +# define BOOST_LANG_STDCPP_AVAILABLE +#endif + +#define BOOST_LANG_STDCPP_NAME "Standard C++" + +/*` +[heading `BOOST_LANG_STDCPPCLI`] + +[@http://en.wikipedia.org/wiki/C%2B%2B/CLI Standard C++/CLI] language. +If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__cplusplus_cli`] [__predef_detection__]] + + [[`__cplusplus_cli`] [YYYY.MM.1]] + ] + */ + +#define BOOST_LANG_STDCPPCLI BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__cplusplus_cli) +# undef BOOST_LANG_STDCPPCLI +# if (__cplusplus_cli > 100) +# define BOOST_LANG_STDCPPCLI BOOST_PREDEF_MAKE_YYYYMM(__cplusplus_cli) +# else +# define BOOST_LANG_STDCPPCLI BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_LANG_STDCPPCLI +# define BOOST_LANG_STDCPPCLI_AVAILABLE +#endif + +#define BOOST_LANG_STDCPPCLI_NAME "Standard C++/CLI" + +/*` +[heading `BOOST_LANG_STDECPP`] + +[@http://en.wikipedia.org/wiki/Embedded_C%2B%2B Standard Embedded C++] language. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__embedded_cplusplus`] [__predef_detection__]] + ] + */ + +#define BOOST_LANG_STDECPP BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__embedded_cplusplus) +# undef BOOST_LANG_STDECPP +# define BOOST_LANG_STDECPP BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_LANG_STDECPP +# define BOOST_LANG_STDECPP_AVAILABLE +#endif + +#define BOOST_LANG_STDECPP_NAME "Standard Embedded C++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDCPP,BOOST_LANG_STDCPP_NAME) + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDCPPCLI,BOOST_LANG_STDCPPCLI_NAME) + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDECPP,BOOST_LANG_STDECPP_NAME) diff --git a/libraries/boost/include/boost/predef/library.h b/libraries/boost/include/boost/predef/library.h new file mode 100644 index 0000000000..40518a90d8 --- /dev/null +++ b/libraries/boost/include/boost/predef/library.h @@ -0,0 +1,16 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#if !defined(BOOST_PREDEF_LIBRARY_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) +#ifndef BOOST_PREDEF_LIBRARY_H +#define BOOST_PREDEF_LIBRARY_H +#endif + +#include +#include + +#endif diff --git a/libraries/boost/include/boost/predef/library/c.h b/libraries/boost/include/boost/predef/library/c.h new file mode 100644 index 0000000000..7ca84cc079 --- /dev/null +++ b/libraries/boost/include/boost/predef/library/c.h @@ -0,0 +1,21 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#if !defined(BOOST_PREDEF_LIBRARY_C_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) +#ifndef BOOST_PREDEF_LIBRARY_C_H +#define BOOST_PREDEF_LIBRARY_C_H +#endif + +#include + +#include +#include +#include +#include +#include + +#endif diff --git a/libraries/boost/include/boost/predef/library/c/_prefix.h b/libraries/boost/include/boost/predef/library/c/_prefix.h new file mode 100644 index 0000000000..12bcb0fb3f --- /dev/null +++ b/libraries/boost/include/boost/predef/library/c/_prefix.h @@ -0,0 +1,13 @@ +/* +Copyright Rene Rivera 2008-2013 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_C__PREFIX_H +#define BOOST_PREDEF_LIBRARY_C__PREFIX_H + +#include + +#endif diff --git a/libraries/boost/include/boost/predef/library/c/cloudabi.h b/libraries/boost/include/boost/predef/library/c/cloudabi.h new file mode 100644 index 0000000000..e6acaee65d --- /dev/null +++ b/libraries/boost/include/boost/predef/library/c/cloudabi.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2017 James E. King III + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_PREDEF_LIBRARY_C_CLOUDABI_H +#define BOOST_PREDEF_LIBRARY_C_CLOUDABI_H + +#include +#include + +#include + +#if defined(__CloudABI__) +#include +#endif + +/*` +[heading `BOOST_LIB_C_CLOUDABI`] + +[@https://github.com/NuxiNL/cloudlibc cloudlibc] - CloudABI's standard C library. +Version number available as major, and minor. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__cloudlibc__`] [__predef_detection__]] + + [[`__cloudlibc_major__`, `__cloudlibc_minor__`] [V.R.0]] + ] + */ + +#define BOOST_LIB_C_CLOUDABI BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__cloudlibc__) +# undef BOOST_LIB_C_CLOUDABI +# define BOOST_LIB_C_CLOUDABI \ + BOOST_VERSION_NUMBER(__cloudlibc_major__,__cloudlibc_minor__,0) +#endif + +#if BOOST_LIB_C_CLOUDABI +# define BOOST_LIB_C_CLOUDABI_AVAILABLE +#endif + +#define BOOST_LIB_C_CLOUDABI_NAME "cloudlibc" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_CLOUDABI,BOOST_LIB_C_CLOUDABI_NAME) diff --git a/libraries/boost/include/boost/predef/library/c/gnu.h b/libraries/boost/include/boost/predef/library/c/gnu.h new file mode 100644 index 0000000000..9e4ca89d64 --- /dev/null +++ b/libraries/boost/include/boost/predef/library/c/gnu.h @@ -0,0 +1,61 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_C_GNU_H +#define BOOST_PREDEF_LIBRARY_C_GNU_H + +#include +#include + +#include + +#if defined(__STDC__) +#include +#elif defined(__cplusplus) +#include +#endif + +/*` +[heading `BOOST_LIB_C_GNU`] + +[@http://en.wikipedia.org/wiki/Glibc GNU glibc] Standard C library. +Version number available as major, and minor. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__GLIBC__`] [__predef_detection__]] + [[`__GNU_LIBRARY__`] [__predef_detection__]] + + [[`__GLIBC__`, `__GLIBC_MINOR__`] [V.R.0]] + [[`__GNU_LIBRARY__`, `__GNU_LIBRARY_MINOR__`] [V.R.0]] + ] + */ + +#define BOOST_LIB_C_GNU BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__GLIBC__) || defined(__GNU_LIBRARY__) +# undef BOOST_LIB_C_GNU +# if defined(__GLIBC__) +# define BOOST_LIB_C_GNU \ + BOOST_VERSION_NUMBER(__GLIBC__,__GLIBC_MINOR__,0) +# else +# define BOOST_LIB_C_GNU \ + BOOST_VERSION_NUMBER(__GNU_LIBRARY__,__GNU_LIBRARY_MINOR__,0) +# endif +#endif + +#if BOOST_LIB_C_GNU +# define BOOST_LIB_C_GNU_AVAILABLE +#endif + +#define BOOST_LIB_C_GNU_NAME "GNU" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_GNU,BOOST_LIB_C_GNU_NAME) diff --git a/libraries/boost/include/boost/predef/library/c/uc.h b/libraries/boost/include/boost/predef/library/c/uc.h new file mode 100644 index 0000000000..03081e94c6 --- /dev/null +++ b/libraries/boost/include/boost/predef/library/c/uc.h @@ -0,0 +1,47 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_C_UC_H +#define BOOST_PREDEF_LIBRARY_C_UC_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_C_UC`] + +[@http://en.wikipedia.org/wiki/Uclibc uClibc] Standard C library. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__UCLIBC__`] [__predef_detection__]] + + [[`__UCLIBC_MAJOR__`, `__UCLIBC_MINOR__`, `__UCLIBC_SUBLEVEL__`] [V.R.P]] + ] + */ + +#define BOOST_LIB_C_UC BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__UCLIBC__) +# undef BOOST_LIB_C_UC +# define BOOST_LIB_C_UC BOOST_VERSION_NUMBER(\ + __UCLIBC_MAJOR__,__UCLIBC_MINOR__,__UCLIBC_SUBLEVEL__) +#endif + +#if BOOST_LIB_C_UC +# define BOOST_LIB_C_UC_AVAILABLE +#endif + +#define BOOST_LIB_C_UC_NAME "uClibc" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_UC,BOOST_LIB_C_UC_NAME) diff --git a/libraries/boost/include/boost/predef/library/c/vms.h b/libraries/boost/include/boost/predef/library/c/vms.h new file mode 100644 index 0000000000..685f1a77d6 --- /dev/null +++ b/libraries/boost/include/boost/predef/library/c/vms.h @@ -0,0 +1,47 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_C_VMS_H +#define BOOST_PREDEF_LIBRARY_C_VMS_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_C_VMS`] + +VMS libc Standard C library. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__CRTL_VER`] [__predef_detection__]] + + [[`__CRTL_VER`] [V.R.P]] + ] + */ + +#define BOOST_LIB_C_VMS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__CRTL_VER) +# undef BOOST_LIB_C_VMS +# define BOOST_LIB_C_VMS BOOST_PREDEF_MAKE_10_VVRR0PP00(__CRTL_VER) +#endif + +#if BOOST_LIB_C_VMS +# define BOOST_LIB_C_VMS_AVAILABLE +#endif + +#define BOOST_LIB_C_VMS_NAME "VMS" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_VMS,BOOST_LIB_C_VMS_NAME) diff --git a/libraries/boost/include/boost/predef/library/c/zos.h b/libraries/boost/include/boost/predef/library/c/zos.h new file mode 100644 index 0000000000..222d35539f --- /dev/null +++ b/libraries/boost/include/boost/predef/library/c/zos.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_C_ZOS_H +#define BOOST_PREDEF_LIBRARY_C_ZOS_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_C_ZOS`] + +z/OS libc Standard C library. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__LIBREL__`] [__predef_detection__]] + + [[`__LIBREL__`] [V.R.P]] + [[`__TARGET_LIB__`] [V.R.P]] + ] + */ + +#define BOOST_LIB_C_ZOS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__LIBREL__) +# undef BOOST_LIB_C_ZOS +# if !defined(BOOST_LIB_C_ZOS) && defined(__LIBREL__) +# define BOOST_LIB_C_ZOS BOOST_PREDEF_MAKE_0X_VRRPPPP(__LIBREL__) +# endif +# if !defined(BOOST_LIB_C_ZOS) && defined(__TARGET_LIB__) +# define BOOST_LIB_C_ZOS BOOST_PREDEF_MAKE_0X_VRRPPPP(__TARGET_LIB__) +# endif +# if !defined(BOOST_LIB_C_ZOS) +# define BOOST_LIB_C_ZOS BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_LIB_C_ZOS +# define BOOST_LIB_C_ZOS_AVAILABLE +#endif + +#define BOOST_LIB_C_ZOS_NAME "z/OS" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_ZOS,BOOST_LIB_C_ZOS_NAME) diff --git a/libraries/boost/include/boost/predef/library/std.h b/libraries/boost/include/boost/predef/library/std.h new file mode 100644 index 0000000000..403b6ff37a --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std.h @@ -0,0 +1,25 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#if !defined(BOOST_PREDEF_LIBRARY_STD_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) +#ifndef BOOST_PREDEF_LIBRARY_STD_H +#define BOOST_PREDEF_LIBRARY_STD_H +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/libraries/boost/include/boost/predef/library/std/_prefix.h b/libraries/boost/include/boost/predef/library/std/_prefix.h new file mode 100644 index 0000000000..932b8557b1 --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std/_prefix.h @@ -0,0 +1,23 @@ +/* +Copyright Rene Rivera 2008-2013 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_PREDEF_LIBRARY_STD__PREFIX_H +#define BOOST_PREDEF_LIBRARY_STD__PREFIX_H + +/* +We need to include an STD header to gives us the context +of which library we are using. The "smallest" code-wise header +seems to be . Boost uses but as far +as I can tell (RR) it's not a stand-alone header in most +implementations. Using also has the benefit of +being available in EC++, so we get a chance to make this work +for embedded users. And since it's not a header impacted by TR1 +there's no magic needed for inclusion in the face of the +Boost.TR1 library. +*/ +#include + +#endif diff --git a/libraries/boost/include/boost/predef/library/std/cxx.h b/libraries/boost/include/boost/predef/library/std/cxx.h new file mode 100644 index 0000000000..07b52cd6af --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std/cxx.h @@ -0,0 +1,46 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_STD_CXX_H +#define BOOST_PREDEF_LIBRARY_STD_CXX_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_STD_CXX`] + +[@http://libcxx.llvm.org/ libc++] C++ Standard Library. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`_LIBCPP_VERSION`] [__predef_detection__]] + + [[`_LIBCPP_VERSION`] [V.0.P]] + ] + */ + +#define BOOST_LIB_STD_CXX BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(_LIBCPP_VERSION) +# undef BOOST_LIB_STD_CXX +# define BOOST_LIB_STD_CXX BOOST_PREDEF_MAKE_10_VPPP(_LIBCPP_VERSION) +#endif + +#if BOOST_LIB_STD_CXX +# define BOOST_LIB_STD_CXX_AVAILABLE +#endif + +#define BOOST_LIB_STD_CXX_NAME "libc++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_CXX,BOOST_LIB_STD_CXX_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/dinkumware.h b/libraries/boost/include/boost/predef/library/std/dinkumware.h new file mode 100644 index 0000000000..0fc077605d --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std/dinkumware.h @@ -0,0 +1,52 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_STD_DINKUMWARE_H +#define BOOST_PREDEF_LIBRARY_STD_DINKUMWARE_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_STD_DINKUMWARE`] + +[@http://en.wikipedia.org/wiki/Dinkumware Dinkumware] Standard C++ Library. +If available version number as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`_YVALS`, `__IBMCPP__`] [__predef_detection__]] + [[`_CPPLIB_VER`] [__predef_detection__]] + + [[`_CPPLIB_VER`] [V.R.0]] + ] + */ + +#define BOOST_LIB_STD_DINKUMWARE BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) +# undef BOOST_LIB_STD_DINKUMWARE +# if defined(_CPPLIB_VER) +# define BOOST_LIB_STD_DINKUMWARE BOOST_PREDEF_MAKE_10_VVRR(_CPPLIB_VER) +# else +# define BOOST_LIB_STD_DINKUMWARE BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_LIB_STD_DINKUMWARE +# define BOOST_LIB_STD_DINKUMWARE_AVAILABLE +#endif + +#define BOOST_LIB_STD_DINKUMWARE_NAME "Dinkumware" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_DINKUMWARE,BOOST_LIB_STD_DINKUMWARE_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/libcomo.h b/libraries/boost/include/boost/predef/library/std/libcomo.h new file mode 100644 index 0000000000..97d4a53d6f --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std/libcomo.h @@ -0,0 +1,47 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_STD_LIBCOMO_H +#define BOOST_PREDEF_LIBRARY_STD_LIBCOMO_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_STD_COMO`] + +[@http://www.comeaucomputing.com/libcomo/ Comeau Computing] Standard C++ Library. +Version number available as major. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__LIBCOMO__`] [__predef_detection__]] + + [[`__LIBCOMO_VERSION__`] [V.0.0]] + ] + */ + +#define BOOST_LIB_STD_COMO BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__LIBCOMO__) +# undef BOOST_LIB_STD_COMO +# define BOOST_LIB_STD_COMO BOOST_VERSION_NUMBER(__LIBCOMO_VERSION__,0,0) +#endif + +#if BOOST_LIB_STD_COMO +# define BOOST_LIB_STD_COMO_AVAILABLE +#endif + +#define BOOST_LIB_STD_COMO_NAME "Comeau Computing" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_COMO,BOOST_LIB_STD_COMO_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/modena.h b/libraries/boost/include/boost/predef/library/std/modena.h new file mode 100644 index 0000000000..b67ac62f17 --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std/modena.h @@ -0,0 +1,45 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_STD_MODENA_H +#define BOOST_PREDEF_LIBRARY_STD_MODENA_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_STD_MSIPL`] + +[@http://modena.us/ Modena Software Lib++] Standard C++ Library. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`MSIPL_COMPILE_H`] [__predef_detection__]] + [[`__MSIPL_COMPILE_H`] [__predef_detection__]] + ] + */ + +#define BOOST_LIB_STD_MSIPL BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(MSIPL_COMPILE_H) || defined(__MSIPL_COMPILE_H) +# undef BOOST_LIB_STD_MSIPL +# define BOOST_LIB_STD_MSIPL BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_LIB_STD_MSIPL +# define BOOST_LIB_STD_MSIPL_AVAILABLE +#endif + +#define BOOST_LIB_STD_MSIPL_NAME "Modena Software Lib++" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_MSIPL,BOOST_LIB_STD_MSIPL_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/msl.h b/libraries/boost/include/boost/predef/library/std/msl.h new file mode 100644 index 0000000000..d73c74c6d8 --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std/msl.h @@ -0,0 +1,53 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_STD_MSL_H +#define BOOST_PREDEF_LIBRARY_STD_MSL_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_STD_MSL`] + +[@http://www.freescale.com/ Metrowerks] Standard C++ Library. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__MSL_CPP__`] [__predef_detection__]] + [[`__MSL__`] [__predef_detection__]] + + [[`__MSL_CPP__`] [V.R.P]] + [[`__MSL__`] [V.R.P]] + ] + */ + +#define BOOST_LIB_STD_MSL BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__MSL_CPP__) || defined(__MSL__) +# undef BOOST_LIB_STD_MSL +# if defined(__MSL_CPP__) +# define BOOST_LIB_STD_MSL BOOST_PREDEF_MAKE_0X_VRPP(__MSL_CPP__) +# else +# define BOOST_LIB_STD_MSL BOOST_PREDEF_MAKE_0X_VRPP(__MSL__) +# endif +#endif + +#if BOOST_LIB_STD_MSL +# define BOOST_LIB_STD_MSL_AVAILABLE +#endif + +#define BOOST_LIB_STD_MSL_NAME "Metrowerks" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_MSL,BOOST_LIB_STD_MSL_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/roguewave.h b/libraries/boost/include/boost/predef/library/std/roguewave.h new file mode 100644 index 0000000000..9c3f288b6f --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std/roguewave.h @@ -0,0 +1,56 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_STD_ROGUEWAVE_H +#define BOOST_PREDEF_LIBRARY_STD_ROGUEWAVE_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_STD_RW`] + +[@http://stdcxx.apache.org/ Roguewave] Standard C++ library. +If available version number as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__STD_RWCOMPILER_H__`] [__predef_detection__]] + [[`_RWSTD_VER`] [__predef_detection__]] + + [[`_RWSTD_VER`] [V.R.P]] + ] + */ + +#define BOOST_LIB_STD_RW BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) +# undef BOOST_LIB_STD_RW +# if defined(_RWSTD_VER) +# if _RWSTD_VER < 0x010000 +# define BOOST_LIB_STD_RW BOOST_PREDEF_MAKE_0X_VVRRP(_RWSTD_VER) +# else +# define BOOST_LIB_STD_RW BOOST_PREDEF_MAKE_0X_VVRRPP(_RWSTD_VER) +# endif +# else +# define BOOST_LIB_STD_RW BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_LIB_STD_RW +# define BOOST_LIB_STD_RW_AVAILABLE +#endif + +#define BOOST_LIB_STD_RW_NAME "Roguewave" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_RW,BOOST_LIB_STD_RW_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/sgi.h b/libraries/boost/include/boost/predef/library/std/sgi.h new file mode 100644 index 0000000000..5d19bbac4d --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std/sgi.h @@ -0,0 +1,51 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_STD_SGI_H +#define BOOST_PREDEF_LIBRARY_STD_SGI_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_STD_SGI`] + +[@http://www.sgi.com/tech/stl/ SGI] Standard C++ library. +If available version number as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__STL_CONFIG_H`] [__predef_detection__]] + + [[`__SGI_STL`] [V.R.P]] + ] + */ + +#define BOOST_LIB_STD_SGI BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__STL_CONFIG_H) +# undef BOOST_LIB_STD_SGI +# if defined(__SGI_STL) +# define BOOST_LIB_STD_SGI BOOST_PREDEF_MAKE_0X_VRP(__SGI_STL) +# else +# define BOOST_LIB_STD_SGI BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_LIB_STD_SGI +# define BOOST_LIB_STD_SGI_AVAILABLE +#endif + +#define BOOST_LIB_STD_SGI_NAME "SGI" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_SGI,BOOST_LIB_STD_SGI_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/stdcpp3.h b/libraries/boost/include/boost/predef/library/std/stdcpp3.h new file mode 100644 index 0000000000..c9802924a7 --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std/stdcpp3.h @@ -0,0 +1,53 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_STD_STDCPP3_H +#define BOOST_PREDEF_LIBRARY_STD_STDCPP3_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_STD_GNU`] + +[@http://gcc.gnu.org/libstdc++/ GNU libstdc++] Standard C++ library. +Version number available as year (from 1970), month, and day. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__GLIBCXX__`] [__predef_detection__]] + [[`__GLIBCPP__`] [__predef_detection__]] + + [[`__GLIBCXX__`] [V.R.P]] + [[`__GLIBCPP__`] [V.R.P]] + ] + */ + +#define BOOST_LIB_STD_GNU BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__GLIBCPP__) || defined(__GLIBCXX__) +# undef BOOST_LIB_STD_GNU +# if defined(__GLIBCXX__) +# define BOOST_LIB_STD_GNU BOOST_PREDEF_MAKE_YYYYMMDD(__GLIBCXX__) +# else +# define BOOST_LIB_STD_GNU BOOST_PREDEF_MAKE_YYYYMMDD(__GLIBCPP__) +# endif +#endif + +#if BOOST_LIB_STD_GNU +# define BOOST_LIB_STD_GNU_AVAILABLE +#endif + +#define BOOST_LIB_STD_GNU_NAME "GNU" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_GNU,BOOST_LIB_STD_GNU_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/stlport.h b/libraries/boost/include/boost/predef/library/std/stlport.h new file mode 100644 index 0000000000..c09483bd9f --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std/stlport.h @@ -0,0 +1,59 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_STD_STLPORT_H +#define BOOST_PREDEF_LIBRARY_STD_STLPORT_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_STD_STLPORT`] + +[@http://sourceforge.net/projects/stlport/ STLport Standard C++] library. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__SGI_STL_PORT`] [__predef_detection__]] + [[`_STLPORT_VERSION`] [__predef_detection__]] + + [[`_STLPORT_MAJOR`, `_STLPORT_MINOR`, `_STLPORT_PATCHLEVEL`] [V.R.P]] + [[`_STLPORT_VERSION`] [V.R.P]] + [[`__SGI_STL_PORT`] [V.R.P]] + ] + */ + +#define BOOST_LIB_STD_STLPORT BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +# undef BOOST_LIB_STD_STLPORT +# if !defined(BOOST_LIB_STD_STLPORT) && defined(_STLPORT_MAJOR) +# define BOOST_LIB_STD_STLPORT \ + BOOST_VERSION_NUMBER(_STLPORT_MAJOR,_STLPORT_MINOR,_STLPORT_PATCHLEVEL) +# endif +# if !defined(BOOST_LIB_STD_STLPORT) && defined(_STLPORT_VERSION) +# define BOOST_LIB_STD_STLPORT BOOST_PREDEF_MAKE_0X_VRP(_STLPORT_VERSION) +# endif +# if !defined(BOOST_LIB_STD_STLPORT) +# define BOOST_LIB_STD_STLPORT BOOST_PREDEF_MAKE_0X_VRP(__SGI_STL_PORT) +# endif +#endif + +#if BOOST_LIB_STD_STLPORT +# define BOOST_LIB_STD_STLPORT_AVAILABLE +#endif + +#define BOOST_LIB_STD_STLPORT_NAME "STLport" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_STLPORT,BOOST_LIB_STD_STLPORT_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/vacpp.h b/libraries/boost/include/boost/predef/library/std/vacpp.h new file mode 100644 index 0000000000..632f846c20 --- /dev/null +++ b/libraries/boost/include/boost/predef/library/std/vacpp.h @@ -0,0 +1,44 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_LIBRARY_STD_VACPP_H +#define BOOST_PREDEF_LIBRARY_STD_VACPP_H + +#include + +#include +#include + +/*` +[heading `BOOST_LIB_STD_IBM`] + +[@http://www.ibm.com/software/awdtools/xlcpp/ IBM VACPP Standard C++] library. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__IBMCPP__`] [__predef_detection__]] + ] + */ + +#define BOOST_LIB_STD_IBM BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__IBMCPP__) +# undef BOOST_LIB_STD_IBM +# define BOOST_LIB_STD_IBM BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_LIB_STD_IBM +# define BOOST_LIB_STD_IBM_AVAILABLE +#endif + +#define BOOST_LIB_STD_IBM_NAME "IBM VACPP" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_IBM,BOOST_LIB_STD_IBM_NAME) diff --git a/libraries/boost/include/boost/predef/make.h b/libraries/boost/include/boost/predef/make.h new file mode 100644 index 0000000000..36b891aa33 --- /dev/null +++ b/libraries/boost/include/boost/predef/make.h @@ -0,0 +1,93 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ +#include + +#ifndef BOOST_PREDEF_MAKE_H +#define BOOST_PREDEF_MAKE_H + +/* +Shorthands for the common version number formats used by vendors... +*/ + +/*` +[heading `BOOST_PREDEF_MAKE_..` macros] + +These set of macros decompose common vendor version number +macros which are composed version, revision, and patch digits. +The naming convention indicates: + +* The base of the specified version number. "`BOOST_PREDEF_MAKE_0X`" for + hexadecimal digits, and "`BOOST_PREDEF_MAKE_10`" for decimal digits. +* The format of the vendor version number. Where "`V`" indicates the version digits, + "`R`" indicates the revision digits, "`P`" indicates the patch digits, and "`0`" + indicates an ignored digit. + +Macros are: +*/ +/*` `BOOST_PREDEF_MAKE_0X_VRP(V)` */ +#define BOOST_PREDEF_MAKE_0X_VRP(V) BOOST_VERSION_NUMBER((V&0xF00)>>8,(V&0xF0)>>4,(V&0xF)) +/*` `BOOST_PREDEF_MAKE_0X_VVRP(V)` */ +#define BOOST_PREDEF_MAKE_0X_VVRP(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xF0)>>4,(V&0xF)) +/*` `BOOST_PREDEF_MAKE_0X_VRPP(V)` */ +#define BOOST_PREDEF_MAKE_0X_VRPP(V) BOOST_VERSION_NUMBER((V&0xF000)>>12,(V&0xF00)>>8,(V&0xFF)) +/*` `BOOST_PREDEF_MAKE_0X_VVRR(V)` */ +#define BOOST_PREDEF_MAKE_0X_VVRR(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xFF),0) +/*` `BOOST_PREDEF_MAKE_0X_VRRPPPP(V)` */ +#define BOOST_PREDEF_MAKE_0X_VRRPPPP(V) BOOST_VERSION_NUMBER((V&0xF000000)>>24,(V&0xFF0000)>>16,(V&0xFFFF)) +/*` `BOOST_PREDEF_MAKE_0X_VVRRP(V)` */ +#define BOOST_PREDEF_MAKE_0X_VVRRP(V) BOOST_VERSION_NUMBER((V&0xFF000)>>12,(V&0xFF0)>>4,(V&0xF)) +/*` `BOOST_PREDEF_MAKE_0X_VRRPP000(V)` */ +#define BOOST_PREDEF_MAKE_0X_VRRPP000(V) BOOST_VERSION_NUMBER((V&0xF0000000)>>28,(V&0xFF00000)>>20,(V&0xFF000)>>12) +/*` `BOOST_PREDEF_MAKE_0X_VVRRPP(V)` */ +#define BOOST_PREDEF_MAKE_0X_VVRRPP(V) BOOST_VERSION_NUMBER((V&0xFF0000)>>16,(V&0xFF00)>>8,(V&0xFF)) +/*` `BOOST_PREDEF_MAKE_10_VPPP(V)` */ +#define BOOST_PREDEF_MAKE_10_VPPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,0,(V)%1000) +/*` `BOOST_PREDEF_MAKE_10_VRP(V)` */ +#define BOOST_PREDEF_MAKE_10_VRP(V) BOOST_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,(V)%10) +/*` `BOOST_PREDEF_MAKE_10_VRP000(V)` */ +#define BOOST_PREDEF_MAKE_10_VRP000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,((V)/1000)%10) +/*` `BOOST_PREDEF_MAKE_10_VRPPPP(V)` */ +#define BOOST_PREDEF_MAKE_10_VRPPPP(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,(V)%10000) +/*` `BOOST_PREDEF_MAKE_10_VRPP(V)` */ +#define BOOST_PREDEF_MAKE_10_VRPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,((V)/100)%10,(V)%100) +/*` `BOOST_PREDEF_MAKE_10_VRR(V)` */ +#define BOOST_PREDEF_MAKE_10_VRR(V) BOOST_VERSION_NUMBER(((V)/100)%10,(V)%100,0) +/*` `BOOST_PREDEF_MAKE_10_VRRPP(V)` */ +#define BOOST_PREDEF_MAKE_10_VRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%10,((V)/100)%100,(V)%100) +/*` `BOOST_PREDEF_MAKE_10_VRR000(V)` */ +#define BOOST_PREDEF_MAKE_10_VRR000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/1000)%100,0) +/*` `BOOST_PREDEF_MAKE_10_VV00(V)` */ +#define BOOST_PREDEF_MAKE_10_VV00(V) BOOST_VERSION_NUMBER(((V)/100)%100,0,0) +/*` `BOOST_PREDEF_MAKE_10_VVRR(V)` */ +#define BOOST_PREDEF_MAKE_10_VVRR(V) BOOST_VERSION_NUMBER(((V)/100)%100,(V)%100,0) +/*` `BOOST_PREDEF_MAKE_10_VVRRPP(V)` */ +#define BOOST_PREDEF_MAKE_10_VVRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%100,((V)/100)%100,(V)%100) +/*` `BOOST_PREDEF_MAKE_10_VVRRPPP(V)` */ +#define BOOST_PREDEF_MAKE_10_VVRRPPP(V) BOOST_VERSION_NUMBER(((V)/100000)%100,((V)/1000)%100,(V)%1000) +/*` `BOOST_PREDEF_MAKE_10_VVRR0PP00(V)` */ +#define BOOST_PREDEF_MAKE_10_VVRR0PP00(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,((V)/100)%100) +/*` `BOOST_PREDEF_MAKE_10_VVRR0PPPP(V)` */ +#define BOOST_PREDEF_MAKE_10_VVRR0PPPP(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,(V)%10000) +/*` `BOOST_PREDEF_MAKE_10_VVRR00PP00(V)` */ +#define BOOST_PREDEF_MAKE_10_VVRR00PP00(V) BOOST_VERSION_NUMBER(((V)/100000000)%100,((V)/1000000)%100,((V)/100)%100) +/*` +[heading `BOOST_PREDEF_MAKE_*..` date macros] + +Date decomposition macros return a date in the relative to the 1970 +Epoch date. If the month is not available, January 1st is used as the month and day. +If the day is not available, but the month is, the 1st of the month is used as the day. +*/ +/*` `BOOST_PREDEF_MAKE_DATE(Y,M,D)` */ +#define BOOST_PREDEF_MAKE_DATE(Y,M,D) BOOST_VERSION_NUMBER((Y)%10000-1970,(M)%100,(D)%100) +/*` `BOOST_PREDEF_MAKE_YYYYMMDD(V)` */ +#define BOOST_PREDEF_MAKE_YYYYMMDD(V) BOOST_PREDEF_MAKE_DATE(((V)/10000)%10000,((V)/100)%100,(V)%100) +/*` `BOOST_PREDEF_MAKE_YYYY(V)` */ +#define BOOST_PREDEF_MAKE_YYYY(V) BOOST_PREDEF_MAKE_DATE(V,1,1) +/*` `BOOST_PREDEF_MAKE_YYYYMM(V)` */ +#define BOOST_PREDEF_MAKE_YYYYMM(V) BOOST_PREDEF_MAKE_DATE((V)/100,(V)%100,1) + +#endif diff --git a/libraries/boost/include/boost/predef/os.h b/libraries/boost/include/boost/predef/os.h new file mode 100644 index 0000000000..bedf99ec54 --- /dev/null +++ b/libraries/boost/include/boost/predef/os.h @@ -0,0 +1,33 @@ +/* +Copyright Rene Rivera 2008-2015 +Copyright Franz Detro 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#if !defined(BOOST_PREDEF_OS_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) +#ifndef BOOST_PREDEF_OS_H +#define BOOST_PREDEF_OS_H +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/libraries/boost/include/boost/predef/os/aix.h b/libraries/boost/include/boost/predef/os/aix.h new file mode 100644 index 0000000000..3e5a953f1b --- /dev/null +++ b/libraries/boost/include/boost/predef/os/aix.h @@ -0,0 +1,66 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_AIX_H +#define BOOST_PREDEF_OS_AIX_H + +#include +#include + +/*` +[heading `BOOST_OS_AIX`] + +[@http://en.wikipedia.org/wiki/AIX_operating_system IBM AIX] operating system. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`_AIX`] [__predef_detection__]] + [[`__TOS_AIX__`] [__predef_detection__]] + + [[`_AIX43`] [4.3.0]] + [[`_AIX41`] [4.1.0]] + [[`_AIX32`] [3.2.0]] + [[`_AIX3`] [3.0.0]] + ] + */ + +#define BOOST_OS_AIX BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(_AIX) || defined(__TOS_AIX__) \ + ) +# undef BOOST_OS_AIX +# if !defined(BOOST_OS_AIX) && defined(_AIX43) +# define BOOST_OS_AIX BOOST_VERSION_NUMBER(4,3,0) +# endif +# if !defined(BOOST_OS_AIX) && defined(_AIX41) +# define BOOST_OS_AIX BOOST_VERSION_NUMBER(4,1,0) +# endif +# if !defined(BOOST_OS_AIX) && defined(_AIX32) +# define BOOST_OS_AIX BOOST_VERSION_NUMBER(3,2,0) +# endif +# if !defined(BOOST_OS_AIX) && defined(_AIX3) +# define BOOST_OS_AIX BOOST_VERSION_NUMBER(3,0,0) +# endif +# if !defined(BOOST_OS_AIX) +# define BOOST_OS_AIX BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_OS_AIX +# define BOOST_OS_AIX_AVAILABLE +# include +#endif + +#define BOOST_OS_AIX_NAME "IBM AIX" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_AIX,BOOST_OS_AIX_NAME) diff --git a/libraries/boost/include/boost/predef/os/amigaos.h b/libraries/boost/include/boost/predef/os/amigaos.h new file mode 100644 index 0000000000..7b32ddf59c --- /dev/null +++ b/libraries/boost/include/boost/predef/os/amigaos.h @@ -0,0 +1,46 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_AMIGAOS_H +#define BOOST_PREDEF_OS_AMIGAOS_H + +#include +#include + +/*` +[heading `BOOST_OS_AMIGAOS`] + +[@http://en.wikipedia.org/wiki/AmigaOS AmigaOS] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`AMIGA`] [__predef_detection__]] + [[`__amigaos__`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_AMIGAOS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(AMIGA) || defined(__amigaos__) \ + ) +# undef BOOST_OS_AMIGAOS +# define BOOST_OS_AMIGAOS BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_AMIGAOS +# define BOOST_OS_AMIGAOS_AVAILABLE +# include +#endif + +#define BOOST_OS_AMIGAOS_NAME "AmigaOS" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_AMIGAOS,BOOST_OS_AMIGAOS_NAME) diff --git a/libraries/boost/include/boost/predef/os/android.h b/libraries/boost/include/boost/predef/os/android.h new file mode 100644 index 0000000000..125dbded9e --- /dev/null +++ b/libraries/boost/include/boost/predef/os/android.h @@ -0,0 +1,45 @@ +/* +Copyright Rene Rivera 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_ANDROID_H +#define BOOST_PREDEF_OS_ANDROID_H + +#include +#include + +/*` +[heading `BOOST_OS_ANDROID`] + +[@http://en.wikipedia.org/wiki/Android_%28operating_system%29 Android] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__ANDROID__`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_ANDROID BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__ANDROID__) \ + ) +# undef BOOST_OS_ANDROID +# define BOOST_OS_ANDROID BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_ANDROID +# define BOOST_OS_ANDROID_AVAILABLE +# include +#endif + +#define BOOST_OS_ANDROID_NAME "Android" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_ANDROID,BOOST_OS_ANDROID_NAME) diff --git a/libraries/boost/include/boost/predef/os/beos.h b/libraries/boost/include/boost/predef/os/beos.h new file mode 100644 index 0000000000..19f4cb71e3 --- /dev/null +++ b/libraries/boost/include/boost/predef/os/beos.h @@ -0,0 +1,45 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_BEOS_H +#define BOOST_PREDEF_OS_BEOS_H + +#include +#include + +/*` +[heading `BOOST_OS_BEOS`] + +[@http://en.wikipedia.org/wiki/BeOS BeOS] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__BEOS__`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_BEOS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__BEOS__) \ + ) +# undef BOOST_OS_BEOS +# define BOOST_OS_BEOS BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_BEOS +# define BOOST_OS_BEOS_AVAILABLE +# include +#endif + +#define BOOST_OS_BEOS_NAME "BeOS" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BEOS,BOOST_OS_BEOS_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd.h b/libraries/boost/include/boost/predef/os/bsd.h new file mode 100644 index 0000000000..fad9aed787 --- /dev/null +++ b/libraries/boost/include/boost/predef/os/bsd.h @@ -0,0 +1,103 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_BSD_H +#define BOOST_PREDEF_OS_BSD_H + +/* Special case: OSX will define BSD predefs if the sys/param.h + * header is included. We can guard against that, but only if we + * detect OSX first. Hence we will force include OSX detection + * before doing any BSD detection. + */ +#include + +#include +#include + +/*` +[heading `BOOST_OS_BSD`] + +[@http://en.wikipedia.org/wiki/Berkeley_Software_Distribution BSD] operating system. + +BSD has various branch operating systems possible and each detected +individually. This detects the following variations and sets a specific +version number macro to match: + +* `BOOST_OS_BSD_DRAGONFLY` [@http://en.wikipedia.org/wiki/DragonFly_BSD DragonFly BSD] +* `BOOST_OS_BSD_FREE` [@http://en.wikipedia.org/wiki/Freebsd FreeBSD] +* `BOOST_OS_BSD_BSDI` [@http://en.wikipedia.org/wiki/BSD/OS BSDi BSD/OS] +* `BOOST_OS_BSD_NET` [@http://en.wikipedia.org/wiki/Netbsd NetBSD] +* `BOOST_OS_BSD_OPEN` [@http://en.wikipedia.org/wiki/Openbsd OpenBSD] + +[note The general `BOOST_OS_BSD` is set in all cases to indicate some form +of BSD. If the above variants is detected the corresponding macro is also set.] + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`BSD`] [__predef_detection__]] + [[`_SYSTYPE_BSD`] [__predef_detection__]] + + [[`BSD4_2`] [4.2.0]] + [[`BSD4_3`] [4.3.0]] + [[`BSD4_4`] [4.4.0]] + [[`BSD`] [V.R.0]] + ] + */ + +#include +#include +#include +#include +#include + +#ifndef BOOST_OS_BSD +#define BOOST_OS_BSD BOOST_VERSION_NUMBER_NOT_AVAILABLE +#endif + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(BSD) || \ + defined(_SYSTYPE_BSD) \ + ) +# undef BOOST_OS_BSD +# include +# if !defined(BOOST_OS_BSD) && defined(BSD4_4) +# define BOOST_OS_BSD BOOST_VERSION_NUMBER(4,4,0) +# endif +# if !defined(BOOST_OS_BSD) && defined(BSD4_3) +# define BOOST_OS_BSD BOOST_VERSION_NUMBER(4,3,0) +# endif +# if !defined(BOOST_OS_BSD) && defined(BSD4_2) +# define BOOST_OS_BSD BOOST_VERSION_NUMBER(4,2,0) +# endif +# if !defined(BOOST_OS_BSD) && defined(BSD) +# define BOOST_OS_BSD BOOST_PREDEF_MAKE_10_VVRR(BSD) +# endif +# if !defined(BOOST_OS_BSD) +# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_OS_BSD +# define BOOST_OS_BSD_AVAILABLE +# include +#endif + +#define BOOST_OS_BSD_NAME "BSD" + +#else + +#include +#include +#include +#include +#include + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD,BOOST_OS_BSD_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd/bsdi.h b/libraries/boost/include/boost/predef/os/bsd/bsdi.h new file mode 100644 index 0000000000..afdcd3eb7c --- /dev/null +++ b/libraries/boost/include/boost/predef/os/bsd/bsdi.h @@ -0,0 +1,48 @@ +/* +Copyright Rene Rivera 2012-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_BSD_BSDI_H +#define BOOST_PREDEF_OS_BSD_BSDI_H + +#include + +/*` +[heading `BOOST_OS_BSD_BSDI`] + +[@http://en.wikipedia.org/wiki/BSD/OS BSDi BSD/OS] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__bsdi__`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_BSD_BSDI BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__bsdi__) \ + ) +# ifndef BOOST_OS_BSD_AVAILABLE +# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE +# define BOOST_OS_BSD_AVAILABLE +# endif +# undef BOOST_OS_BSD_BSDI +# define BOOST_OS_BSD_BSDI BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_BSD_BSDI +# define BOOST_OS_BSD_BSDI_AVAILABLE +# include +#endif + +#define BOOST_OS_BSD_BSDI_NAME "BSDi BSD/OS" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_BSDI,BOOST_OS_BSD_BSDI_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd/dragonfly.h b/libraries/boost/include/boost/predef/os/bsd/dragonfly.h new file mode 100644 index 0000000000..1d075798a1 --- /dev/null +++ b/libraries/boost/include/boost/predef/os/bsd/dragonfly.h @@ -0,0 +1,50 @@ +/* +Copyright Rene Rivera 2012-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_BSD_DRAGONFLY_H +#define BOOST_PREDEF_OS_BSD_DRAGONFLY_H + +#include + +/*` +[heading `BOOST_OS_BSD_DRAGONFLY`] + +[@http://en.wikipedia.org/wiki/DragonFly_BSD DragonFly BSD] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__DragonFly__`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_BSD_DRAGONFLY BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__DragonFly__) \ + ) +# ifndef BOOST_OS_BSD_AVAILABLE +# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE +# define BOOST_OS_BSD_AVAILABLE +# endif +# undef BOOST_OS_BSD_DRAGONFLY +# if defined(__DragonFly__) +# define BOOST_OS_DRAGONFLY_BSD BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_OS_BSD_DRAGONFLY +# define BOOST_OS_BSD_DRAGONFLY_AVAILABLE +# include +#endif + +#define BOOST_OS_BSD_DRAGONFLY_NAME "DragonFly BSD" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_DRAGONFLY,BOOST_OS_BSD_DRAGONFLY_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd/free.h b/libraries/boost/include/boost/predef/os/bsd/free.h new file mode 100644 index 0000000000..81c002109d --- /dev/null +++ b/libraries/boost/include/boost/predef/os/bsd/free.h @@ -0,0 +1,67 @@ +/* +Copyright Rene Rivera 2012-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_BSD_FREE_H +#define BOOST_PREDEF_OS_BSD_FREE_H + +#include + +/*` +[heading `BOOST_OS_BSD_FREE`] + +[@http://en.wikipedia.org/wiki/Freebsd FreeBSD] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__FreeBSD__`] [__predef_detection__]] + + [[`__FreeBSD_version`] [V.R.P]] + ] + */ + +#define BOOST_OS_BSD_FREE BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__FreeBSD__) \ + ) +# ifndef BOOST_OS_BSD_AVAILABLE +# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE +# define BOOST_OS_BSD_AVAILABLE +# endif +# undef BOOST_OS_BSD_FREE +# include +# if defined(__FreeBSD_version) +# if __FreeBSD_version == 491000 +# define BOOST_OS_BSD_FREE \ + BOOST_VERSION_NUMBER(4, 10, 0) +# elif __FreeBSD_version == 492000 +# define BOOST_OS_BSD_FREE \ + BOOST_VERSION_NUMBER(4, 11, 0) +# elif __FreeBSD_version < 500000 +# define BOOST_OS_BSD_FREE \ + BOOST_PREDEF_MAKE_10_VRPPPP(__FreeBSD_version) +# else +# define BOOST_OS_BSD_FREE \ + BOOST_PREDEF_MAKE_10_VVRRPPP(__FreeBSD_version) +# endif +# else +# define BOOST_OS_BSD_FREE BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_OS_BSD_FREE +# define BOOST_OS_BSD_FREE_AVAILABLE +# include +#endif + +#define BOOST_OS_BSD_FREE_NAME "Free BSD" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_FREE,BOOST_OS_BSD_FREE_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd/net.h b/libraries/boost/include/boost/predef/os/bsd/net.h new file mode 100644 index 0000000000..387cbde54f --- /dev/null +++ b/libraries/boost/include/boost/predef/os/bsd/net.h @@ -0,0 +1,84 @@ +/* +Copyright Rene Rivera 2012-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_BSD_NET_H +#define BOOST_PREDEF_OS_BSD_NET_H + +#include + +/*` +[heading `BOOST_OS_BSD_NET`] + +[@http://en.wikipedia.org/wiki/Netbsd NetBSD] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__NETBSD__`] [__predef_detection__]] + [[`__NetBSD__`] [__predef_detection__]] + + [[`__NETBSD_version`] [V.R.P]] + [[`NetBSD0_8`] [0.8.0]] + [[`NetBSD0_9`] [0.9.0]] + [[`NetBSD1_0`] [1.0.0]] + [[`__NetBSD_Version`] [V.R.P]] + ] + */ + +#define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__NETBSD__) || defined(__NetBSD__) \ + ) +# ifndef BOOST_OS_BSD_AVAILABLE +# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE +# define BOOST_OS_BSD_AVAILABLE +# endif +# undef BOOST_OS_BSD_NET +# if defined(__NETBSD__) +# if defined(__NETBSD_version) +# if __NETBSD_version < 500000 +# define BOOST_OS_BSD_NET \ + BOOST_PREDEF_MAKE_10_VRP000(__NETBSD_version) +# else +# define BOOST_OS_BSD_NET \ + BOOST_PREDEF_MAKE_10_VRR000(__NETBSD_version) +# endif +# else +# define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER_AVAILABLE +# endif +# elif defined(__NetBSD__) +# if !defined(BOOST_OS_BSD_NET) && defined(NetBSD0_8) +# define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER(0,8,0) +# endif +# if !defined(BOOST_OS_BSD_NET) && defined(NetBSD0_9) +# define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER(0,9,0) +# endif +# if !defined(BOOST_OS_BSD_NET) && defined(NetBSD1_0) +# define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER(1,0,0) +# endif +# if !defined(BOOST_OS_BSD_NET) && defined(__NetBSD_Version) +# define BOOST_OS_BSD_NET \ + BOOST_PREDEF_MAKE_10_VVRR00PP00(__NetBSD_Version) +# endif +# if !defined(BOOST_OS_BSD_NET) +# define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER_AVAILABLE +# endif +# endif +#endif + +#if BOOST_OS_BSD_NET +# define BOOST_OS_BSD_NET_AVAILABLE +# include +#endif + +#define BOOST_OS_BSD_NET_NAME "DragonFly BSD" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_NET,BOOST_OS_BSD_NET_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd/open.h b/libraries/boost/include/boost/predef/os/bsd/open.h new file mode 100644 index 0000000000..f6ccd24a9b --- /dev/null +++ b/libraries/boost/include/boost/predef/os/bsd/open.h @@ -0,0 +1,251 @@ +/* +Copyright Rene Rivera 2012-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_BSD_OPEN_H +#define BOOST_PREDEF_OS_BSD_OPEN_H + +#include + +/*` +[heading `BOOST_OS_BSD_OPEN`] + +[@http://en.wikipedia.org/wiki/Openbsd OpenBSD] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__OpenBSD__`] [__predef_detection__]] + + [[`OpenBSD2_0`] [2.0.0]] + [[`OpenBSD2_1`] [2.1.0]] + [[`OpenBSD2_2`] [2.2.0]] + [[`OpenBSD2_3`] [2.3.0]] + [[`OpenBSD2_4`] [2.4.0]] + [[`OpenBSD2_5`] [2.5.0]] + [[`OpenBSD2_6`] [2.6.0]] + [[`OpenBSD2_7`] [2.7.0]] + [[`OpenBSD2_8`] [2.8.0]] + [[`OpenBSD2_9`] [2.9.0]] + [[`OpenBSD3_0`] [3.0.0]] + [[`OpenBSD3_1`] [3.1.0]] + [[`OpenBSD3_2`] [3.2.0]] + [[`OpenBSD3_3`] [3.3.0]] + [[`OpenBSD3_4`] [3.4.0]] + [[`OpenBSD3_5`] [3.5.0]] + [[`OpenBSD3_6`] [3.6.0]] + [[`OpenBSD3_7`] [3.7.0]] + [[`OpenBSD3_8`] [3.8.0]] + [[`OpenBSD3_9`] [3.9.0]] + [[`OpenBSD4_0`] [4.0.0]] + [[`OpenBSD4_1`] [4.1.0]] + [[`OpenBSD4_2`] [4.2.0]] + [[`OpenBSD4_3`] [4.3.0]] + [[`OpenBSD4_4`] [4.4.0]] + [[`OpenBSD4_5`] [4.5.0]] + [[`OpenBSD4_6`] [4.6.0]] + [[`OpenBSD4_7`] [4.7.0]] + [[`OpenBSD4_8`] [4.8.0]] + [[`OpenBSD4_9`] [4.9.0]] + [[`OpenBSD5_0`] [5.0.0]] + [[`OpenBSD5_1`] [5.1.0]] + [[`OpenBSD5_2`] [5.2.0]] + [[`OpenBSD5_3`] [5.3.0]] + [[`OpenBSD5_4`] [5.4.0]] + [[`OpenBSD5_5`] [5.5.0]] + [[`OpenBSD5_6`] [5.6.0]] + [[`OpenBSD5_7`] [5.7.0]] + [[`OpenBSD5_8`] [5.8.0]] + [[`OpenBSD5_9`] [5.9.0]] + [[`OpenBSD6_0`] [6.0.0]] + [[`OpenBSD6_1`] [6.1.0]] + [[`OpenBSD6_2`] [6.2.0]] + [[`OpenBSD6_3`] [6.3.0]] + [[`OpenBSD6_4`] [6.4.0]] + [[`OpenBSD6_5`] [6.5.0]] + [[`OpenBSD6_6`] [6.6.0]] + [[`OpenBSD6_7`] [6.7.0]] + [[`OpenBSD6_8`] [6.8.0]] + [[`OpenBSD6_9`] [6.9.0]] + ] + */ + +#define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__OpenBSD__) \ + ) +# ifndef BOOST_OS_BSD_AVAILABLE +# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE +# define BOOST_OS_BSD_AVAILABLE +# endif +# undef BOOST_OS_BSD_OPEN +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_0) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,0,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_1) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,1,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_2) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,2,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_3) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,3,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_4) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,4,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_5) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,5,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_6) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,6,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_7) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,7,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_8) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,8,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_9) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,9,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_0) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,0,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_1) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,1,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_2) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,2,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_3) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,3,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_4) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,4,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_5) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,5,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_6) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,6,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_7) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,7,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_8) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,8,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_9) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,9,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_0) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,0,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_1) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,1,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_2) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,2,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_3) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,3,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_4) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,4,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_5) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,5,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_6) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,6,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_7) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,7,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_8) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,8,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_9) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,9,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_0) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,0,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_1) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,1,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_2) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,2,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_3) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,3,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_4) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,4,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_5) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,5,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_6) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,6,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_7) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,7,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_8) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,8,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_9) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,9,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_0) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,0,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_1) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,1,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_2) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,2,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_3) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,3,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_4) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,4,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_5) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,5,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_6) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,6,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_7) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,7,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_8) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,8,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_9) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,9,0) +# endif +# if !defined(BOOST_OS_BSD_OPEN) +# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_OS_BSD_OPEN +# define BOOST_OS_BSD_OPEN_AVAILABLE +# include +#endif + +#define BOOST_OS_BSD_OPEN_NAME "OpenBSD" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_OPEN,BOOST_OS_BSD_OPEN_NAME) diff --git a/libraries/boost/include/boost/predef/os/cygwin.h b/libraries/boost/include/boost/predef/os/cygwin.h new file mode 100644 index 0000000000..9d36f0f317 --- /dev/null +++ b/libraries/boost/include/boost/predef/os/cygwin.h @@ -0,0 +1,45 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_CYGWIN_H +#define BOOST_PREDEF_OS_CYGWIN_H + +#include +#include + +/*` +[heading `BOOST_OS_CYGWIN`] + +[@http://en.wikipedia.org/wiki/Cygwin Cygwin] evironment. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__CYGWIN__`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_CYGWIN BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__CYGWIN__) \ + ) +# undef BOOST_OS_CYGWIN +# define BOOST_OS_CYGWIN BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_CYGWIN +# define BOOST_OS_CYGWIN_AVAILABLE +# include +#endif + +#define BOOST_OS_CYGWIN_NAME "Cygwin" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_CYGWIN,BOOST_OS_CYGWIN_NAME) diff --git a/libraries/boost/include/boost/predef/os/haiku.h b/libraries/boost/include/boost/predef/os/haiku.h new file mode 100644 index 0000000000..d79dbeac88 --- /dev/null +++ b/libraries/boost/include/boost/predef/os/haiku.h @@ -0,0 +1,46 @@ +/* +Copyright Jessica Hamilton 2014 +Copyright Rene Rivera 2014-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_HAIKU_H +#define BOOST_PREDEF_OS_HAIKU_H + +#include +#include + +/*` +[heading `BOOST_OS_HAIKU`] + +[@http://en.wikipedia.org/wiki/Haiku_(operating_system) Haiku] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__HAIKU__`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_HAIKU BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__HAIKU__) \ + ) +# undef BOOST_OS_HAIKU +# define BOOST_OS_HAIKU BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_HAIKU +# define BOOST_OS_HAIKU_AVAILABLE +# include +#endif + +#define BOOST_OS_HAIKU_NAME "Haiku" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_HAIKU,BOOST_OS_HAIKU_NAME) diff --git a/libraries/boost/include/boost/predef/os/hpux.h b/libraries/boost/include/boost/predef/os/hpux.h new file mode 100644 index 0000000000..29243f4879 --- /dev/null +++ b/libraries/boost/include/boost/predef/os/hpux.h @@ -0,0 +1,47 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_HPUX_H +#define BOOST_PREDEF_OS_HPUX_H + +#include +#include + +/*` +[heading `BOOST_OS_HPUX`] + +[@http://en.wikipedia.org/wiki/HP-UX HP-UX] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`hpux`] [__predef_detection__]] + [[`_hpux`] [__predef_detection__]] + [[`__hpux`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_HPUX BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(hpux) || defined(_hpux) || defined(__hpux) \ + ) +# undef BOOST_OS_HPUX +# define BOOST_OS_HPUX BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_HPUX +# define BOOST_OS_HPUX_AVAILABLE +# include +#endif + +#define BOOST_OS_HPUX_NAME "HP-UX" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_HPUX,BOOST_OS_HPUX_NAME) diff --git a/libraries/boost/include/boost/predef/os/ios.h b/libraries/boost/include/boost/predef/os/ios.h new file mode 100644 index 0000000000..f853815a6d --- /dev/null +++ b/libraries/boost/include/boost/predef/os/ios.h @@ -0,0 +1,51 @@ +/* +Copyright Franz Detro 2014 +Copyright Rene Rivera 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_IOS_H +#define BOOST_PREDEF_OS_IOS_H + +#include +#include + +/*` +[heading `BOOST_OS_IOS`] + +[@http://en.wikipedia.org/wiki/iOS iOS] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__APPLE__`] [__predef_detection__]] + [[`__MACH__`] [__predef_detection__]] + [[`__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__`] [__predef_detection__]] + + [[`__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__`] [__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000]] + ] + */ + +#define BOOST_OS_IOS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__APPLE__) && defined(__MACH__) && \ + defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) \ + ) +# undef BOOST_OS_IOS +# define BOOST_OS_IOS (__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000) +#endif + +#if BOOST_OS_IOS +# define BOOST_OS_IOS_AVAILABLE +# include +#endif + +#define BOOST_OS_IOS_NAME "iOS" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_IOS,BOOST_OS_IOS_NAME) diff --git a/libraries/boost/include/boost/predef/os/irix.h b/libraries/boost/include/boost/predef/os/irix.h new file mode 100644 index 0000000000..fa6ac41dcd --- /dev/null +++ b/libraries/boost/include/boost/predef/os/irix.h @@ -0,0 +1,46 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_IRIX_H +#define BOOST_PREDEF_OS_IRIX_H + +#include +#include + +/*` +[heading `BOOST_OS_IRIX`] + +[@http://en.wikipedia.org/wiki/Irix IRIX] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`sgi`] [__predef_detection__]] + [[`__sgi`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_IRIX BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(sgi) || defined(__sgi) \ + ) +# undef BOOST_OS_IRIX +# define BOOST_OS_IRIX BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_IRIX +# define BOOST_OS_IRIX_AVAILABLE +# include +#endif + +#define BOOST_OS_IRIX_NAME "IRIX" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_IRIX,BOOST_OS_IRIX_NAME) diff --git a/libraries/boost/include/boost/predef/os/linux.h b/libraries/boost/include/boost/predef/os/linux.h new file mode 100644 index 0000000000..a297d08954 --- /dev/null +++ b/libraries/boost/include/boost/predef/os/linux.h @@ -0,0 +1,46 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_LINUX_H +#define BOOST_PREDEF_OS_LINUX_H + +#include +#include + +/*` +[heading `BOOST_OS_LINUX`] + +[@http://en.wikipedia.org/wiki/Linux Linux] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`linux`] [__predef_detection__]] + [[`__linux`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_LINUX BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(linux) || defined(__linux) \ + ) +# undef BOOST_OS_LINUX +# define BOOST_OS_LINUX BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_LINUX +# define BOOST_OS_LINUX_AVAILABLE +# include +#endif + +#define BOOST_OS_LINUX_NAME "Linux" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_LINUX,BOOST_OS_LINUX_NAME) diff --git a/libraries/boost/include/boost/predef/os/macos.h b/libraries/boost/include/boost/predef/os/macos.h new file mode 100644 index 0000000000..4afb30d087 --- /dev/null +++ b/libraries/boost/include/boost/predef/os/macos.h @@ -0,0 +1,65 @@ +/* +Copyright Rene Rivera 2008-2015 +Copyright Franz Detro 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_MACOS_H +#define BOOST_PREDEF_OS_MACOS_H + +/* Special case: iOS will define the same predefs as MacOS, and additionally + '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__'. We can guard against that, + but only if we detect iOS first. Hence we will force include iOS detection + * before doing any MacOS detection. + */ +#include + +#include +#include + +/*` +[heading `BOOST_OS_MACOS`] + +[@http://en.wikipedia.org/wiki/Mac_OS Mac OS] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`macintosh`] [__predef_detection__]] + [[`Macintosh`] [__predef_detection__]] + [[`__APPLE__`] [__predef_detection__]] + [[`__MACH__`] [__predef_detection__]] + + [[`__APPLE__`, `__MACH__`] [10.0.0]] + [[ /otherwise/ ] [9.0.0]] + ] + */ + +#define BOOST_OS_MACOS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(macintosh) || defined(Macintosh) || \ + (defined(__APPLE__) && defined(__MACH__)) \ + ) +# undef BOOST_OS_MACOS +# if !defined(BOOST_OS_MACOS) && defined(__APPLE__) && defined(__MACH__) +# define BOOST_OS_MACOS BOOST_VERSION_NUMBER(10,0,0) +# endif +# if !defined(BOOST_OS_MACOS) +# define BOOST_OS_MACOS BOOST_VERSION_NUMBER(9,0,0) +# endif +#endif + +#if BOOST_OS_MACOS +# define BOOST_OS_MACOS_AVAILABLE +# include +#endif + +#define BOOST_OS_MACOS_NAME "Mac OS" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_MACOS,BOOST_OS_MACOS_NAME) diff --git a/libraries/boost/include/boost/predef/os/os400.h b/libraries/boost/include/boost/predef/os/os400.h new file mode 100644 index 0000000000..b3446c26c9 --- /dev/null +++ b/libraries/boost/include/boost/predef/os/os400.h @@ -0,0 +1,45 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_OS400_H +#define BOOST_PREDEF_OS_OS400_H + +#include +#include + +/*` +[heading `BOOST_OS_OS400`] + +[@http://en.wikipedia.org/wiki/IBM_i IBM OS/400] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__OS400__`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_OS400 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__OS400__) \ + ) +# undef BOOST_OS_OS400 +# define BOOST_OS_OS400 BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_OS400 +# define BOOST_OS_OS400_AVAILABLE +# include +#endif + +#define BOOST_OS_OS400_NAME "IBM OS/400" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_OS400,BOOST_OS_OS400_NAME) diff --git a/libraries/boost/include/boost/predef/os/qnxnto.h b/libraries/boost/include/boost/predef/os/qnxnto.h new file mode 100644 index 0000000000..e76fbf2781 --- /dev/null +++ b/libraries/boost/include/boost/predef/os/qnxnto.h @@ -0,0 +1,59 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_QNXNTO_H +#define BOOST_PREDEF_OS_QNXNTO_H + +#include +#include + +/*` +[heading `BOOST_OS_QNX`] + +[@http://en.wikipedia.org/wiki/QNX QNX] operating system. +Version number available as major, and minor if possible. And +version 4 is specifically detected. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__QNX__`] [__predef_detection__]] + [[`__QNXNTO__`] [__predef_detection__]] + + [[`_NTO_VERSION`] [V.R.0]] + [[`__QNX__`] [4.0.0]] + ] + */ + +#define BOOST_OS_QNX BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(__QNX__) || defined(__QNXNTO__) \ + ) +# undef BOOST_OS_QNX +# if !defined(BOOST_OS_QNX) && defined(_NTO_VERSION) +# define BOOST_OS_QNX BOOST_PREDEF_MAKE_10_VVRR(_NTO_VERSION) +# endif +# if !defined(BOOST_OS_QNX) && defined(__QNX__) +# define BOOST_OS_QNX BOOST_VERSION_NUMBER(4,0,0) +# endif +# if !defined(BOOST_OS_QNX) +# define BOOST_OS_QNX BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_OS_QNX +# define BOOST_OS_QNX_AVAILABLE +# include +#endif + +#define BOOST_OS_QNX_NAME "QNX" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_QNX,BOOST_OS_QNX_NAME) diff --git a/libraries/boost/include/boost/predef/os/solaris.h b/libraries/boost/include/boost/predef/os/solaris.h new file mode 100644 index 0000000000..75ddc91dae --- /dev/null +++ b/libraries/boost/include/boost/predef/os/solaris.h @@ -0,0 +1,46 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_SOLARIS_H +#define BOOST_PREDEF_OS_SOLARIS_H + +#include +#include + +/*` +[heading `BOOST_OS_SOLARIS`] + +[@http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`sun`] [__predef_detection__]] + [[`__sun`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_SOLARIS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(sun) || defined(__sun) \ + ) +# undef BOOST_OS_SOLARIS +# define BOOST_OS_SOLARIS BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_SOLARIS +# define BOOST_OS_SOLARIS_AVAILABLE +# include +#endif + +#define BOOST_OS_SOLARIS_NAME "Solaris" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_SOLARIS,BOOST_OS_SOLARIS_NAME) diff --git a/libraries/boost/include/boost/predef/os/unix.h b/libraries/boost/include/boost/predef/os/unix.h new file mode 100644 index 0000000000..a60710427a --- /dev/null +++ b/libraries/boost/include/boost/predef/os/unix.h @@ -0,0 +1,76 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_UNIX_H +#define BOOST_PREDEF_OS_UNIX_H + +#include +#include + +/*` +[heading `BOOST_OS_UNIX`] + +[@http://en.wikipedia.org/wiki/Unix Unix Environment] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`unix`] [__predef_detection__]] + [[`__unix`] [__predef_detection__]] + [[`_XOPEN_SOURCE`] [__predef_detection__]] + [[`_POSIX_SOURCE`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_UNIX BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(unix) || defined(__unix) || \ + defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) +# undef BOOST_OS_UNIX +# define BOOST_OS_UNIX BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_UNIX +# define BOOST_OS_UNIX_AVAILABLE +#endif + +#define BOOST_OS_UNIX_NAME "Unix Environment" + +/*` +[heading `BOOST_OS_SVR4`] + +[@http://en.wikipedia.org/wiki/UNIX_System_V SVR4 Environment] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__sysv__`] [__predef_detection__]] + [[`__SVR4`] [__predef_detection__]] + [[`__svr4__`] [__predef_detection__]] + [[`_SYSTYPE_SVR4`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_SVR4 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__sysv__) || defined(__SVR4) || \ + defined(__svr4__) || defined(_SYSTYPE_SVR4) +# undef BOOST_OS_SVR4 +# define BOOST_OS_SVR4 BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_SVR4 +# define BOOST_OS_SVR4_AVAILABLE +#endif + +#define BOOST_OS_SVR4_NAME "SVR4 Environment" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_UNIX,BOOST_OS_UNIX_NAME) +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_SVR4,BOOST_OS_SVR4_NAME) diff --git a/libraries/boost/include/boost/predef/os/vms.h b/libraries/boost/include/boost/predef/os/vms.h new file mode 100644 index 0000000000..2f8f786d4e --- /dev/null +++ b/libraries/boost/include/boost/predef/os/vms.h @@ -0,0 +1,52 @@ +/* +Copyright Rene Rivera 2011-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_VMS_H +#define BOOST_PREDEF_OS_VMS_H + +#include +#include + +/*` +[heading `BOOST_OS_VMS`] + +[@http://en.wikipedia.org/wiki/Vms VMS] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`VMS`] [__predef_detection__]] + [[`__VMS`] [__predef_detection__]] + + [[`__VMS_VER`] [V.R.P]] + ] + */ + +#define BOOST_OS_VMS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(VMS) || defined(__VMS) \ + ) +# undef BOOST_OS_VMS +# if defined(__VMS_VER) +# define BOOST_OS_VMS BOOST_PREDEF_MAKE_10_VVRR00PP00(__VMS_VER) +# else +# define BOOST_OS_VMS BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_OS_VMS +# define BOOST_OS_VMS_AVAILABLE +# include +#endif + +#define BOOST_OS_VMS_NAME "VMS" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_VMS,BOOST_OS_VMS_NAME) diff --git a/libraries/boost/include/boost/predef/os/windows.h b/libraries/boost/include/boost/predef/os/windows.h new file mode 100644 index 0000000000..9db4390950 --- /dev/null +++ b/libraries/boost/include/boost/predef/os/windows.h @@ -0,0 +1,51 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_OS_WINDOWS_H +#define BOOST_PREDEF_OS_WINDOWS_H + +#include +#include + +/*` +[heading `BOOST_OS_WINDOWS`] + +[@http://en.wikipedia.org/wiki/Category:Microsoft_Windows Microsoft Windows] operating system. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`_WIN32`] [__predef_detection__]] + [[`_WIN64`] [__predef_detection__]] + [[`__WIN32__`] [__predef_detection__]] + [[`__TOS_WIN__`] [__predef_detection__]] + [[`__WINDOWS__`] [__predef_detection__]] + ] + */ + +#define BOOST_OS_WINDOWS BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ + defined(_WIN32) || defined(_WIN64) || \ + defined(__WIN32__) || defined(__TOS_WIN__) || \ + defined(__WINDOWS__) \ + ) +# undef BOOST_OS_WINDOWS +# define BOOST_OS_WINDOWS BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_OS_WINDOWS +# define BOOST_OS_WINDOWS_AVAILABLE +# include +#endif + +#define BOOST_OS_WINDOWS_NAME "Microsoft Windows" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_OS_WINDOWS,BOOST_OS_WINDOWS_NAME) diff --git a/libraries/boost/include/boost/predef/other.h b/libraries/boost/include/boost/predef/other.h new file mode 100644 index 0000000000..c09ad4945f --- /dev/null +++ b/libraries/boost/include/boost/predef/other.h @@ -0,0 +1,16 @@ +/* +Copyright Rene Rivera 2013-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#if !defined(BOOST_PREDEF_OTHER_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) +#ifndef BOOST_PREDEF_OTHER_H +#define BOOST_PREDEF_OTHER_H +#endif + +#include +/*#include */ + +#endif diff --git a/libraries/boost/include/boost/predef/other/endian.h b/libraries/boost/include/boost/predef/other/endian.h new file mode 100644 index 0000000000..6d1f43ff4d --- /dev/null +++ b/libraries/boost/include/boost/predef/other/endian.h @@ -0,0 +1,204 @@ +/* +Copyright Rene Rivera 2013-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_ENDIAN_H +#define BOOST_PREDEF_ENDIAN_H + +#include +#include +#include +#include +#include +#include + +/*` +[heading `BOOST_ENDIAN_*`] + +Detection of endian memory ordering. There are four defined macros +in this header that define the various generally possible endian +memory orderings: + +* `BOOST_ENDIAN_BIG_BYTE`, byte-swapped big-endian. +* `BOOST_ENDIAN_BIG_WORD`, word-swapped big-endian. +* `BOOST_ENDIAN_LITTLE_BYTE`, byte-swapped little-endian. +* `BOOST_ENDIAN_LITTLE_WORD`, word-swapped little-endian. + +The detection is conservative in that it only identifies endianness +that it knows for certain. In particular bi-endianness is not +indicated as is it not practically possible to determine the +endianness from anything but an operating system provided +header. And the currently known headers do not define that +programatic bi-endianness is available. + +This implementation is a compilation of various publicly available +information and acquired knowledge: + +# The indispensable documentation of "Pre-defined Compiler Macros" + [@http://sourceforge.net/p/predef/wiki/Endianness Endianness]. +# The various endian specifications available in the + [@http://wikipedia.org/ Wikipedia] computer architecture pages. +# Generally available searches for headers that define endianness. + */ + +#define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE +#define BOOST_ENDIAN_BIG_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE +#define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE +#define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE + +/* GNU libc provides a header defining __BYTE_ORDER, or _BYTE_ORDER. + * And some OSs provide some for of endian header also. + */ +#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ + !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD +# if BOOST_LIB_C_GNU || BOOST_OS_ANDROID +# include +# else +# if BOOST_OS_MACOS +# include +# else +# if BOOST_OS_BSD +# if BOOST_OS_BSD_OPEN +# include +# else +# include +# endif +# endif +# endif +# endif +# if defined(__BYTE_ORDER) +# if defined(__BIG_ENDIAN) && (__BYTE_ORDER == __BIG_ENDIAN) +# undef BOOST_ENDIAN_BIG_BYTE +# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +# if defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == __LITTLE_ENDIAN) +# undef BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +# if defined(__PDP_ENDIAN) && (__BYTE_ORDER == __PDP_ENDIAN) +# undef BOOST_ENDIAN_LITTLE_WORD +# define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE +# endif +# endif +# if !defined(__BYTE_ORDER) && defined(_BYTE_ORDER) +# if defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN) +# undef BOOST_ENDIAN_BIG_BYTE +# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +# if defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN) +# undef BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +# if defined(_PDP_ENDIAN) && (_BYTE_ORDER == _PDP_ENDIAN) +# undef BOOST_ENDIAN_LITTLE_WORD +# define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE +# endif +# endif +#endif + +/* Built-in byte-swpped big-endian macros. + */ +#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ + !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD +# if (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)) || \ + (defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)) || \ + defined(__ARMEB__) || \ + defined(__THUMBEB__) || \ + defined(__AARCH64EB__) || \ + defined(_MIPSEB) || \ + defined(__MIPSEB) || \ + defined(__MIPSEB__) +# undef BOOST_ENDIAN_BIG_BYTE +# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +/* Built-in byte-swpped little-endian macros. + */ +#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ + !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD +# if (defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \ + (defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) || \ + defined(__ARMEL__) || \ + defined(__THUMBEL__) || \ + defined(__AARCH64EL__) || \ + defined(_MIPSEL) || \ + defined(__MIPSEL) || \ + defined(__MIPSEL__) +# undef BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +/* Some architectures are strictly one endianess (as opposed + * the current common bi-endianess). + */ +#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ + !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD +# include +# if BOOST_ARCH_M68K || \ + BOOST_ARCH_PARISC || \ + BOOST_ARCH_SPARC || \ + BOOST_ARCH_SYS370 || \ + BOOST_ARCH_SYS390 || \ + BOOST_ARCH_Z +# undef BOOST_ENDIAN_BIG_BYTE +# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +# if BOOST_ARCH_AMD64 || \ + BOOST_ARCH_IA64 || \ + BOOST_ARCH_X86 || \ + BOOST_ARCH_BLACKFIN +# undef BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +/* Windows on ARM, if not otherwise detected/specified, is always + * byte-swaped little-endian. + */ +#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ + !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD +# if BOOST_ARCH_ARM +# include +# if BOOST_OS_WINDOWS +# undef BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE +# endif +# endif +#endif + +#if BOOST_ENDIAN_BIG_BYTE +# define BOOST_ENDIAN_BIG_BYTE_AVAILABLE +#endif +#if BOOST_ENDIAN_BIG_WORD +# define BOOST_ENDIAN_BIG_WORD_BYTE_AVAILABLE +#endif +#if BOOST_ENDIAN_LITTLE_BYTE +# define BOOST_ENDIAN_LITTLE_BYTE_AVAILABLE +#endif +#if BOOST_ENDIAN_LITTLE_WORD +# define BOOST_ENDIAN_LITTLE_WORD_BYTE_AVAILABLE +#endif + +#define BOOST_ENDIAN_BIG_BYTE_NAME "Byte-Swapped Big-Endian" +#define BOOST_ENDIAN_BIG_WORD_NAME "Word-Swapped Big-Endian" +#define BOOST_ENDIAN_LITTLE_BYTE_NAME "Byte-Swapped Little-Endian" +#define BOOST_ENDIAN_LITTLE_WORD_NAME "Word-Swapped Little-Endian" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_BYTE,BOOST_ENDIAN_BIG_BYTE_NAME) + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_WORD,BOOST_ENDIAN_BIG_WORD_NAME) + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_BYTE,BOOST_ENDIAN_LITTLE_BYTE_NAME) + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_WORD,BOOST_ENDIAN_LITTLE_WORD_NAME) diff --git a/libraries/boost/include/boost/predef/platform.h b/libraries/boost/include/boost/predef/platform.h new file mode 100644 index 0000000000..6c366d595c --- /dev/null +++ b/libraries/boost/include/boost/predef/platform.h @@ -0,0 +1,28 @@ +/* +Copyright Rene Rivera 2013-2015 +Copyright (c) Microsoft Corporation 2014 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#if !defined(BOOST_PREDEF_PLATFORM_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) +#ifndef BOOST_PREDEF_PLATFORM_H +#define BOOST_PREDEF_PLATFORM_H +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // deprecated +#include +/*#include */ + +#endif diff --git a/libraries/boost/include/boost/predef/platform/cloudabi.h b/libraries/boost/include/boost/predef/platform/cloudabi.h new file mode 100644 index 0000000000..c44f689454 --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/cloudabi.h @@ -0,0 +1,43 @@ +/* + Copyright 2017 James E. King, III + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_CLOUDABI_H +#define BOOST_PREDEF_PLAT_CLOUDABI_H + +#include +#include + +/*` +[heading `BOOST_PLAT_CLOUDABI`] + +[@https://github.com/NuxiNL/cloudabi CloudABI] platform. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__CloudABI__`] [__predef_detection__]] + ] + */ + +#define BOOST_PLAT_CLOUDABI BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__CloudABI__) +# undef BOOST_PLAT_CLOUDABI +# define BOOST_PLAT_CLOUDABI BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_PLAT_CLOUDABI +# define BOOST_PLAT_CLOUDABI_AVAILABLE +# include +#endif + +#define BOOST_PLAT_CLOUDABI_NAME "CloudABI" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_CLOUDABI,BOOST_PLAT_CLOUDABI_NAME) diff --git a/libraries/boost/include/boost/predef/platform/ios.h b/libraries/boost/include/boost/predef/platform/ios.h new file mode 100644 index 0000000000..af1c364cf0 --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/ios.h @@ -0,0 +1,58 @@ +/* +Copyright Ruslan Baratov 2017 +Copyright Rene Rivera 2017 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_IOS_H +#define BOOST_PREDEF_PLAT_IOS_H + +#include // BOOST_OS_IOS +#include // BOOST_VERSION_NUMBER_NOT_AVAILABLE + +/*` +[heading `BOOST_PLAT_IOS_DEVICE`] +[heading `BOOST_PLAT_IOS_SIMULATOR`] + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`TARGET_IPHONE_SIMULATOR`] [__predef_detection__]] + ] + */ + +#define BOOST_PLAT_IOS_DEVICE BOOST_VERSION_NUMBER_NOT_AVAILABLE +#define BOOST_PLAT_IOS_SIMULATOR BOOST_VERSION_NUMBER_NOT_AVAILABLE + +// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h +#if BOOST_OS_IOS +# include +# if TARGET_IPHONE_SIMULATOR == 1 +# undef BOOST_PLAT_IOS_SIMULATOR +# define BOOST_PLAT_IOS_SIMULATOR BOOST_VERSION_NUMBER_AVAILABLE +# else +# undef BOOST_PLAT_IOS_DEVICE +# define BOOST_PLAT_IOS_DEVICE BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#if BOOST_PLAT_IOS_SIMULATOR +# define BOOST_PLAT_IOS_SIMULATOR_AVAILABLE +# include +#endif + +#if BOOST_PLAT_IOS_DEVICE +# define BOOST_PLAT_IOS_DEVICE_AVAILABLE +# include +#endif + +#define BOOST_PLAT_IOS_SIMULATOR_NAME "iOS Simulator" +#define BOOST_PLAT_IOS_DEVICE_NAME "iOS Device" + +#endif // BOOST_PREDEF_PLAT_IOS_H + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_IOS_SIMULATOR,BOOST_PLAT_IOS_SIMULATOR_NAME) +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_IOS_DEVICE,BOOST_PLAT_IOS_DEVICE_NAME) diff --git a/libraries/boost/include/boost/predef/platform/mingw.h b/libraries/boost/include/boost/predef/platform/mingw.h new file mode 100644 index 0000000000..c52827d7d8 --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/mingw.h @@ -0,0 +1,69 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_MINGW_H +#define BOOST_PREDEF_PLAT_MINGW_H + +#include +#include + +/*` +[heading `BOOST_PLAT_MINGW`] + +[@http://en.wikipedia.org/wiki/MinGW MinGW] platform, either variety. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__MINGW32__`] [__predef_detection__]] + [[`__MINGW64__`] [__predef_detection__]] + + [[`__MINGW64_VERSION_MAJOR`, `__MINGW64_VERSION_MINOR`] [V.R.0]] + [[`__MINGW32_VERSION_MAJOR`, `__MINGW32_VERSION_MINOR`] [V.R.0]] + ] + */ + +#define BOOST_PLAT_MINGW BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__MINGW32__) || defined(__MINGW64__) +# include <_mingw.h> +# if !defined(BOOST_PLAT_MINGW_DETECTION) && (defined(__MINGW64_VERSION_MAJOR) && defined(__MINGW64_VERSION_MINOR)) +# define BOOST_PLAT_MINGW_DETECTION \ + BOOST_VERSION_NUMBER(__MINGW64_VERSION_MAJOR,__MINGW64_VERSION_MINOR,0) +# endif +# if !defined(BOOST_PLAT_MINGW_DETECTION) && (defined(__MINGW32_VERSION_MAJOR) && defined(__MINGW32_VERSION_MINOR)) +# define BOOST_PLAT_MINGW_DETECTION \ + BOOST_VERSION_NUMBER(__MINGW32_MAJOR_VERSION,__MINGW32_MINOR_VERSION,0) +# endif +# if !defined(BOOST_PLAT_MINGW_DETECTION) +# define BOOST_PLAT_MINGW_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_PLAT_MINGW_DETECTION +# define BOOST_PLAT_MINGW_AVAILABLE +# if defined(BOOST_PREDEF_DETAIL_PLAT_DETECTED) +# define BOOST_PLAT_MINGW_EMULATED BOOST_PLAT_MINGW_DETECTION +# else +# undef BOOST_PLAT_MINGW +# define BOOST_PLAT_MINGW BOOST_PLAT_MINGW_DETECTION +# endif +# include +#endif + +#define BOOST_PLAT_MINGW_NAME "MinGW (any variety)" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW,BOOST_PLAT_MINGW_NAME) + +#ifdef BOOST_PLAT_MINGW_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW_EMULATED,BOOST_PLAT_MINGW_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/platform/mingw32.h b/libraries/boost/include/boost/predef/platform/mingw32.h new file mode 100644 index 0000000000..ff90038b4c --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/mingw32.h @@ -0,0 +1,63 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_MINGW32_H +#define BOOST_PREDEF_PLAT_MINGW32_H + +#include +#include + +/*` +[heading `BOOST_PLAT_MINGW32`] + +[@http://www.mingw.org/ MinGW] platform. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__MINGW32__`] [__predef_detection__]] + + [[`__MINGW32_VERSION_MAJOR`, `__MINGW32_VERSION_MINOR`] [V.R.0]] + ] + */ + +#define BOOST_PLAT_MINGW32 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__MINGW32__) +# include <_mingw.h> +# if !defined(BOOST_PLAT_MINGW32_DETECTION) && (defined(__MINGW32_VERSION_MAJOR) && defined(__MINGW32_VERSION_MINOR)) +# define BOOST_PLAT_MINGW32_DETECTION \ + BOOST_VERSION_NUMBER(__MINGW32_VERSION_MAJOR,__MINGW32_VERSION_MINOR,0) +# endif +# if !defined(BOOST_PLAT_MINGW32_DETECTION) +# define BOOST_PLAT_MINGW32_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_PLAT_MINGW32_DETECTION +# define BOOST_PLAT_MINGW32_AVAILABLE +# if defined(BOOST_PREDEF_DETAIL_PLAT_DETECTED) +# define BOOST_PLAT_MINGW32_EMULATED BOOST_PLAT_MINGW32_DETECTION +# else +# undef BOOST_PLAT_MINGW32 +# define BOOST_PLAT_MINGW32 BOOST_PLAT_MINGW32_DETECTION +# endif +# include +#endif + +#define BOOST_PLAT_MINGW32_NAME "MinGW" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW32,BOOST_PLAT_MINGW32_NAME) + +#ifdef BOOST_PLAT_MINGW32_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW32_EMULATED,BOOST_PLAT_MINGW32_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/platform/mingw64.h b/libraries/boost/include/boost/predef/platform/mingw64.h new file mode 100644 index 0000000000..a35dd3e016 --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/mingw64.h @@ -0,0 +1,63 @@ +/* +Copyright Rene Rivera 2008-2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_MINGW64_H +#define BOOST_PREDEF_PLAT_MINGW64_H + +#include +#include + +/*` +[heading `BOOST_PLAT_MINGW64`] + +[@https://mingw-w64.org/ MinGW-w64] platform. +Version number available as major, minor, and patch. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__MINGW64__`] [__predef_detection__]] + + [[`__MINGW64_VERSION_MAJOR`, `__MINGW64_VERSION_MINOR`] [V.R.0]] + ] + */ + +#define BOOST_PLAT_MINGW64 BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__MINGW64__) +# include <_mingw.h> +# if !defined(BOOST_PLAT_MINGW64_DETECTION) && (defined(__MINGW64_VERSION_MAJOR) && defined(__MINGW64_VERSION_MINOR)) +# define BOOST_PLAT_MINGW64_DETECTION \ + BOOST_VERSION_NUMBER(__MINGW64_VERSION_MAJOR,__MINGW64_VERSION_MINOR,0) +# endif +# if !defined(BOOST_PLAT_MINGW64_DETECTION) +# define BOOST_PLAT_MINGW64_DETECTION BOOST_VERSION_NUMBER_AVAILABLE +# endif +#endif + +#ifdef BOOST_PLAT_MINGW64_DETECTION +# define BOOST_PLAT_MINGW64_AVAILABLE +# if defined(BOOST_PREDEF_DETAIL_PLAT_DETECTED) +# define BOOST_PLAT_MINGW64_EMULATED BOOST_PLAT_MINGW64_DETECTION +# else +# undef BOOST_PLAT_MINGW64 +# define BOOST_PLAT_MINGW64 BOOST_PLAT_MINGW64_DETECTION +# endif +# include +#endif + +#define BOOST_PLAT_MINGW64_NAME "MinGW-w64" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW64,BOOST_PLAT_MINGW64_NAME) + +#ifdef BOOST_PLAT_MINGW64_EMULATED +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW64_EMULATED,BOOST_PLAT_MINGW64_NAME) +#endif diff --git a/libraries/boost/include/boost/predef/platform/windows_desktop.h b/libraries/boost/include/boost/predef/platform/windows_desktop.h new file mode 100644 index 0000000000..afb39079a6 --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/windows_desktop.h @@ -0,0 +1,51 @@ +/* +Copyright (c) Microsoft Corporation 2014 +Copyright Rene Rivera 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_WINDOWS_DESKTOP_H +#define BOOST_PREDEF_PLAT_WINDOWS_DESKTOP_H + +#include +#include +#include +#include + +/*` +[heading `BOOST_PLAT_WINDOWS_DESKTOP`] + +[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +for Windows Desktop development. Also available if the Platform SDK is too +old to support UWP. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP`] [__predef_detection__]] + [[`!BOOST_PLAT_WINDOWS_UWP`] [__predef_detection__]] + ] + */ + +#define BOOST_PLAT_WINDOWS_DESKTOP BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if BOOST_OS_WINDOWS && \ + ((defined(WINAPI_FAMILY_DESKTOP_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) || \ + !BOOST_PLAT_WINDOWS_UWP) +# undef BOOST_PLAT_WINDOWS_DESKTOP +# define BOOST_PLAT_WINDOWS_DESKTOP BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_PLAT_WINDOWS_DESKTOP +# define BOOST_PLAT_WINDOWS_DESKTOP_AVAILABLE +# include +#endif + +#define BOOST_PLAT_WINDOWS_DESKTOP_NAME "Windows Desktop" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_DESKTOP,BOOST_PLAT_WINDOWS_DESKTOP_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_phone.h b/libraries/boost/include/boost/predef/platform/windows_phone.h new file mode 100644 index 0000000000..0ebc76d276 --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/windows_phone.h @@ -0,0 +1,48 @@ +/* +Copyright (c) Microsoft Corporation 2014 +Copyright Rene Rivera 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_WINDOWS_PHONE_H +#define BOOST_PREDEF_PLAT_WINDOWS_PHONE_H + +#include +#include +#include +#include + +/*` +[heading `BOOST_PLAT_WINDOWS_PHONE`] + +[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +for Windows Phone development. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP`] [__predef_detection__]] + ] + */ + +#define BOOST_PLAT_WINDOWS_PHONE BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if BOOST_OS_WINDOWS && \ + defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +# undef BOOST_PLAT_WINDOWS_PHONE +# define BOOST_PLAT_WINDOWS_PHONE BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_PLAT_WINDOWS_PHONE +# define BOOST_PLAT_WINDOWS_PHONE_AVAILABLE +# include +#endif + +#define BOOST_PLAT_WINDOWS_PHONE_NAME "Windows Phone" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_PHONE,BOOST_PLAT_WINDOWS_PHONE_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_runtime.h b/libraries/boost/include/boost/predef/platform/windows_runtime.h new file mode 100644 index 0000000000..e7978d7525 --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/windows_runtime.h @@ -0,0 +1,53 @@ +/* +Copyright (c) Microsoft Corporation 2014 +Copyright Rene Rivera 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_WINDOWS_RUNTIME_H +#define BOOST_PREDEF_PLAT_WINDOWS_RUNTIME_H + +#include +#include +#include +#include +#include + +/*` +[heading `BOOST_PLAT_WINDOWS_RUNTIME`] + +Deprecated. + +[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +for Windows Phone or Store development. This does not align to the existing development model for +UWP and is deprecated. Use one of the other `BOOST_PLAT_WINDOWS_*`definitions instead. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`BOOST_PLAT_WINDOWS_PHONE`] [__predef_detection__]] + [[`BOOST_PLAT_WINDOWS_STORE`] [__predef_detection__]] + ] + */ + +#define BOOST_PLAT_WINDOWS_RUNTIME BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if BOOST_OS_WINDOWS && \ + (BOOST_PLAT_WINDOWS_STORE || BOOST_PLAT_WINDOWS_PHONE) +# undef BOOST_PLAT_WINDOWS_RUNTIME +# define BOOST_PLAT_WINDOWS_RUNTIME BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_PLAT_WINDOWS_RUNTIME +# define BOOST_PLAT_WINDOWS_RUNTIME_AVAILABLE +# include +#endif + +#define BOOST_PLAT_WINDOWS_RUNTIME_NAME "Windows Runtime" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_RUNTIME,BOOST_PLAT_WINDOWS_RUNTIME_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_server.h b/libraries/boost/include/boost/predef/platform/windows_server.h new file mode 100644 index 0000000000..7bd629da34 --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/windows_server.h @@ -0,0 +1,47 @@ +/* +Copyright James E. King III, 2017 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_WINDOWS_SERVER_H +#define BOOST_PREDEF_PLAT_WINDOWS_SERVER_H + +#include +#include +#include +#include + +/*` +[heading `BOOST_PLAT_WINDOWS_SERVER`] + +[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +for Windows Server development. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`WINAPI_FAMILY == WINAPI_FAMILY_SERVER`] [__predef_detection__]] + ] + */ + +#define BOOST_PLAT_WINDOWS_SERVER BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if BOOST_OS_WINDOWS && \ + defined(WINAPI_FAMILY_SERVER) && WINAPI_FAMILY == WINAPI_FAMILY_SERVER +# undef BOOST_PLAT_WINDOWS_SERVER +# define BOOST_PLAT_WINDOWS_SERVER BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_PLAT_WINDOWS_SERVER +# define BOOST_PLAT_WINDOWS_SERVER_AVAILABLE +# include +#endif + +#define BOOST_PLAT_WINDOWS_SERVER_NAME "Windows Server" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_SERVER,BOOST_PLAT_WINDOWS_SERVER_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_store.h b/libraries/boost/include/boost/predef/platform/windows_store.h new file mode 100644 index 0000000000..3a3fd8e982 --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/windows_store.h @@ -0,0 +1,50 @@ +/* +Copyright (c) Microsoft Corporation 2014 +Copyright Rene Rivera 2015 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_WINDOWS_STORE_H +#define BOOST_PREDEF_PLAT_WINDOWS_STORE_H + +#include +#include +#include +#include + +/*` +[heading `BOOST_PLAT_WINDOWS_STORE`] + +[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +for Windows Store development. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`WINAPI_FAMILY == WINAPI_FAMILY_PC_APP`] [__predef_detection__]] + [[`WINAPI_FAMILY == WINAPI_FAMILY_APP` (deprecated)] [__predef_detection__]] +] + */ + +#define BOOST_PLAT_WINDOWS_STORE BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if BOOST_OS_WINDOWS && \ + ((defined(WINAPI_FAMILY_PC_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) || \ + (defined(WINAPI_FAMILY_APP) && WINAPI_FAMILY == WINAPI_FAMILY_APP)) +# undef BOOST_PLAT_WINDOWS_STORE +# define BOOST_PLAT_WINDOWS_STORE BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_PLAT_WINDOWS_STORE +# define BOOST_PLAT_WINDOWS_STORE_AVAILABLE +# include +#endif + +#define BOOST_PLAT_WINDOWS_STORE_NAME "Windows Store" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_STORE,BOOST_PLAT_WINDOWS_STORE_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_system.h b/libraries/boost/include/boost/predef/platform/windows_system.h new file mode 100644 index 0000000000..92f424fe7f --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/windows_system.h @@ -0,0 +1,47 @@ +/* +Copyright James E. King III, 2017 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_WINDOWS_SYSTEM_H +#define BOOST_PREDEF_PLAT_WINDOWS_SYSTEM_H + +#include +#include +#include +#include + +/*` +[heading `BOOST_PLAT_WINDOWS_SYSTEM`] + +[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +for Windows System development. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM`] [__predef_detection__]] + ] + */ + +#define BOOST_PLAT_WINDOWS_SYSTEM BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if BOOST_OS_WINDOWS && \ + defined(WINAPI_FAMILY_SYSTEM) && WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM +# undef BOOST_PLAT_WINDOWS_SYSTEM +# define BOOST_PLAT_WINDOWS_SYSTEM BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_PLAT_WINDOWS_SYSTEM +# define BOOST_PLAT_WINDOWS_SYSTEM_AVAILABLE +# include +#endif + +#define BOOST_PLAT_WINDOWS_SYSTEM_NAME "Windows Drivers and Tools" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_SYSTEM,BOOST_PLAT_WINDOWS_SYSTEM_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_uwp.h b/libraries/boost/include/boost/predef/platform/windows_uwp.h new file mode 100644 index 0000000000..e4c6647f41 --- /dev/null +++ b/libraries/boost/include/boost/predef/platform/windows_uwp.h @@ -0,0 +1,60 @@ +/* +Copyright James E. King III, 2017 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_PLAT_WINDOWS_UWP_H +#define BOOST_PREDEF_PLAT_WINDOWS_UWP_H + +#include +#include +#include + +/*` +[heading `BOOST_PLAT_WINDOWS_UWP`] + +[@http://docs.microsoft.com/windows/uwp/ Universal Windows Platform] +is available if the current development environment is capable of targeting +UWP development. + +[table + [[__predef_symbol__] [__predef_version__]] + + [[`__MINGW64_VERSION_MAJOR` from `_mingw.h`] [`>= 3`]] + [[`VER_PRODUCTBUILD` from `ntverp.h`] [`>= 9200`]] +] +*/ + +#define BOOST_PLAT_WINDOWS_UWP BOOST_VERSION_NUMBER_NOT_AVAILABLE +#define BOOST_PLAT_WINDOWS_SDK_VERSION BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if BOOST_OS_WINDOWS +// MinGW (32-bit) has no ntverp.h header +#if !defined(__MINGW32__) +# include +# undef BOOST_PLAT_WINDOWS_SDK_VERSION +# define BOOST_PLAT_WINDOWS_SDK_VERSION BOOST_VERSION_NUMBER(0, 0, VER_PRODUCTBUILD) +#endif + +// 9200 is Windows SDK 8.0 from ntverp.h which introduced family support +#if ((BOOST_PLAT_WINDOWS_SDK_VERSION >= BOOST_VERSION_NUMBER(0, 0, 9200)) || \ + (defined(__MINGW64__) && __MINGW64_VERSION_MAJOR >= 3)) +# undef BOOST_PLAT_WINDOWS_UWP +# define BOOST_PLAT_WINDOWS_UWP BOOST_VERSION_NUMBER_AVAILABLE +#endif +#endif + +#if BOOST_PLAT_WINDOWS_UWP +# define BOOST_PLAT_WINDOWS_UWP_AVAILABLE +# include +# include // Windows SDK +#endif + +#define BOOST_PLAT_WINDOWS_UWP_NAME "Universal Windows Platform" + +#endif + +#include +BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_UWP, BOOST_PLAT_WINDOWS_UWP_NAME) diff --git a/libraries/boost/include/boost/predef/version.h b/libraries/boost/include/boost/predef/version.h new file mode 100644 index 0000000000..bcf97adfc2 --- /dev/null +++ b/libraries/boost/include/boost/predef/version.h @@ -0,0 +1,15 @@ +/* +Copyright Rene Rivera 2015-2016 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_VERSION_H +#define BOOST_PREDEF_VERSION_H + +#include + +#define BOOST_PREDEF_VERSION BOOST_VERSION_NUMBER(1,7,0) + +#endif diff --git a/libraries/boost/include/boost/predef/version_number.h b/libraries/boost/include/boost/predef/version_number.h new file mode 100644 index 0000000000..44942709c7 --- /dev/null +++ b/libraries/boost/include/boost/predef/version_number.h @@ -0,0 +1,72 @@ +/* +Copyright Rene Rivera 2005-2016 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE_1_0.txt or copy at +http://www.boost.org/LICENSE_1_0.txt) +*/ + +#ifndef BOOST_PREDEF_VERSION_NUMBER_H +#define BOOST_PREDEF_VERSION_NUMBER_H + +/*` +[heading `BOOST_VERSION_NUMBER`] + +`` +BOOST_VERSION_NUMBER(major,minor,patch) +`` + +Defines standard version numbers, with these properties: + +* Decimal base whole numbers in the range \[0,1000000000). + The number range is designed to allow for a (2,2,5) triplet. + Which fits within a 32 bit value. +* The `major` number can be in the \[0,99\] range. +* The `minor` number can be in the \[0,99\] range. +* The `patch` number can be in the \[0,99999\] range. +* Values can be specified in any base. As the defined value + is an constant expression. +* Value can be directly used in both preprocessor and compiler + expressions for comparison to other similarly defined values. +* The implementation enforces the individual ranges for the + major, minor, and patch numbers. And values over the ranges + are truncated (modulo). + +*/ +#define BOOST_VERSION_NUMBER(major,minor,patch) \ + ( (((major)%100)*10000000) + (((minor)%100)*100000) + ((patch)%100000) ) + +#define BOOST_VERSION_NUMBER_MAX \ + BOOST_VERSION_NUMBER(99,99,99999) + +#define BOOST_VERSION_NUMBER_ZERO \ + BOOST_VERSION_NUMBER(0,0,0) + +#define BOOST_VERSION_NUMBER_MIN \ + BOOST_VERSION_NUMBER(0,0,1) + +#define BOOST_VERSION_NUMBER_AVAILABLE \ + BOOST_VERSION_NUMBER_MIN + +#define BOOST_VERSION_NUMBER_NOT_AVAILABLE \ + BOOST_VERSION_NUMBER_ZERO + +/*` +`` +BOOST_VERSION_NUMBER_MAJOR(N), BOOST_VERSION_NUMBER_MINOR(N), BOOST_VERSION_NUMBER_PATCH(N) +`` + +The macros extract the major, minor, and patch portion from a well formed +version number resulting in a preprocessor expression in the range of +\[0,99\] or \[0,99999\] for the major and minor, or patch numbers +respectively. +*/ +#define BOOST_VERSION_NUMBER_MAJOR(N) \ + ( ((N)/10000000)%100 ) + +#define BOOST_VERSION_NUMBER_MINOR(N) \ + ( ((N)/100000)%100 ) + +#define BOOST_VERSION_NUMBER_PATCH(N) \ + ( (N)%100000 ) + +#endif diff --git a/libraries/boost/include/boost/range/begin.hpp b/libraries/boost/include/boost/range/begin.hpp new file mode 100644 index 0000000000..ba5a73b92d --- /dev/null +++ b/libraries/boost/include/boost/range/begin.hpp @@ -0,0 +1,135 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_BEGIN_HPP +#define BOOST_RANGE_BEGIN_HPP + +#if defined(_MSC_VER) +# pragma once +#endif + +#include + +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +#include +#else + +#include + +namespace boost +{ + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +namespace range_detail +{ +#endif + + ////////////////////////////////////////////////////////////////////// + // primary template + ////////////////////////////////////////////////////////////////////// + + template< typename C > + inline BOOST_DEDUCED_TYPENAME range_iterator::type + range_begin( C& c ) + { + // + // If you get a compile-error here, it is most likely because + // you have not implemented range_begin() properly in + // the namespace of C + // + return c.begin(); + } + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + inline Iterator range_begin( const std::pair& p ) + { + return p.first; + } + + template< typename Iterator > + inline Iterator range_begin( std::pair& p ) + { + return p.first; + } + + ////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////// + + // + // May this be discarded? Or is it needed for bad compilers? + // + template< typename T, std::size_t sz > + inline const T* range_begin( const T (&a)[sz] ) + { + return a; + } + + template< typename T, std::size_t sz > + inline T* range_begin( T (&a)[sz] ) + { + return a; + } + + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +} // namespace 'range_detail' +#endif + +// Use a ADL namespace barrier to avoid ambiguity with other unqualified +// calls. This is particularly important with C++0x encouraging +// unqualified calls to begin/end. +namespace range_adl_barrier +{ + +template< class T > +inline BOOST_DEDUCED_TYPENAME range_iterator::type begin( T& r ) +{ +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + using namespace range_detail; +#endif + return range_begin( r ); +} + +template< class T > +inline BOOST_DEDUCED_TYPENAME range_iterator::type begin( const T& r ) +{ +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + using namespace range_detail; +#endif + return range_begin( r ); +} + + } // namespace range_adl_barrier +} // namespace boost + +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +namespace boost +{ + namespace range_adl_barrier + { + template< class T > + inline BOOST_DEDUCED_TYPENAME range_iterator::type + const_begin( const T& r ) + { + return boost::range_adl_barrier::begin( r ); + } + } // namespace range_adl_barrier + + using namespace range_adl_barrier; +} // namespace boost + +#endif + diff --git a/libraries/boost/include/boost/range/config.hpp b/libraries/boost/include/boost/range/config.hpp new file mode 100644 index 0000000000..7600a5ff82 --- /dev/null +++ b/libraries/boost/include/boost/range/config.hpp @@ -0,0 +1,56 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_CONFIG_HPP +#define BOOST_RANGE_CONFIG_HPP + +#include + +#if defined(_MSC_VER) +# pragma once +#endif + +#include + +#ifdef BOOST_RANGE_DEDUCED_TYPENAME +#error "macro already defined!" +#endif + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +# define BOOST_RANGE_DEDUCED_TYPENAME typename +#else +#define BOOST_RANGE_DEDUCED_TYPENAME BOOST_DEDUCED_TYPENAME +#endif + +#ifdef BOOST_RANGE_NO_ARRAY_SUPPORT +#error "macro already defined!" +#endif + +#if BOOST_WORKAROUND( __MWERKS__, <= 0x3003 ) +#define BOOST_RANGE_NO_ARRAY_SUPPORT 1 +#endif + +#ifdef BOOST_RANGE_NO_ARRAY_SUPPORT +#define BOOST_RANGE_ARRAY_REF() (boost_range_array) +#define BOOST_RANGE_NO_STATIC_ASSERT +#else +#define BOOST_RANGE_ARRAY_REF() (&boost_range_array) +#endif + +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))) +# define BOOST_RANGE_UNUSED __attribute__((unused)) +#else +# define BOOST_RANGE_UNUSED +#endif + + + +#endif + diff --git a/libraries/boost/include/boost/range/const_iterator.hpp b/libraries/boost/include/boost/range/const_iterator.hpp new file mode 100644 index 0000000000..727fdad058 --- /dev/null +++ b/libraries/boost/include/boost/range/const_iterator.hpp @@ -0,0 +1,76 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_CONST_ITERATOR_HPP +#define BOOST_RANGE_CONST_ITERATOR_HPP + +#if defined(_MSC_VER) +# pragma once +#endif + +#include + +#include +#include +#include +#include +#include +#include + +namespace boost +{ + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + namespace range_detail + { + +BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( const_iterator ) + +template< typename C > +struct range_const_iterator_helper + : extract_const_iterator +{}; + +////////////////////////////////////////////////////////////////////////// +// pair +////////////////////////////////////////////////////////////////////////// + +template< typename Iterator > +struct range_const_iterator_helper > +{ + typedef Iterator type; +}; + +////////////////////////////////////////////////////////////////////////// +// array +////////////////////////////////////////////////////////////////////////// + +template< typename T, std::size_t sz > +struct range_const_iterator_helper< T[sz] > +{ + typedef const T* type; +}; + + } // namespace range_detail + +template +struct range_const_iterator + : range_detail::range_const_iterator_helper< + BOOST_DEDUCED_TYPENAME remove_reference::type + > +{ +}; + +} // namespace boost + + +#endif diff --git a/libraries/boost/include/boost/range/detail/begin.hpp b/libraries/boost/include/boost/range/detail/begin.hpp new file mode 100644 index 0000000000..1d9390ff85 --- /dev/null +++ b/libraries/boost/include/boost/range/detail/begin.hpp @@ -0,0 +1,83 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_BEGIN_HPP +#define BOOST_RANGE_DETAIL_BEGIN_HPP + +#include // BOOST_MSVC +#include +#include +#include + +namespace boost +{ + + namespace range_detail + { + template< typename T > + struct range_begin; + + ////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////// + + template<> + struct range_begin + { + template< typename C > + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type fun( C& c ) + { + return c.begin(); + }; + }; + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template<> + struct range_begin + { + template< typename P > + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator

::type fun( const P& p ) + { + return p.first; + } + }; + + ////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////// + + template<> + struct range_begin + { + template + static BOOST_RANGE_DEDUCED_TYPENAME range_value::type* fun(T& t) + { + return t; + } + }; + + } // namespace 'range_detail' + + namespace range_adl_barrier + { + template< typename C > + inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type + begin( C& c ) + { + return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range::type >::fun( c ); + } + } +} // namespace 'boost' + + +#endif diff --git a/libraries/boost/include/boost/range/detail/common.hpp b/libraries/boost/include/boost/range/detail/common.hpp new file mode 100644 index 0000000000..00b665bef8 --- /dev/null +++ b/libraries/boost/include/boost/range/detail/common.hpp @@ -0,0 +1,118 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_COMMON_HPP +#define BOOST_RANGE_DETAIL_COMMON_HPP + +#if defined(_MSC_VER) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// missing partial specialization workaround. +////////////////////////////////////////////////////////////////////////////// + +namespace boost +{ + namespace range_detail + { + // 1 = std containers + // 2 = std::pair + // 3 = const std::pair + // 4 = array + // 5 = const array + // 6 = char array + // 7 = wchar_t array + // 8 = char* + // 9 = const char* + // 10 = whar_t* + // 11 = const wchar_t* + // 12 = string + + typedef mpl::int_<1>::type std_container_; + typedef mpl::int_<2>::type std_pair_; + typedef mpl::int_<3>::type const_std_pair_; + typedef mpl::int_<4>::type array_; + typedef mpl::int_<5>::type const_array_; + typedef mpl::int_<6>::type char_array_; + typedef mpl::int_<7>::type wchar_t_array_; + typedef mpl::int_<8>::type char_ptr_; + typedef mpl::int_<9>::type const_char_ptr_; + typedef mpl::int_<10>::type wchar_t_ptr_; + typedef mpl::int_<11>::type const_wchar_t_ptr_; + typedef mpl::int_<12>::type string_; + + template< typename C > + struct range_helper + { + static C* c; + static C ptr; + + BOOST_STATIC_CONSTANT( bool, is_pair_ = sizeof( boost::range_detail::is_pair_impl( c ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_char_ptr_ = sizeof( boost::range_detail::is_char_ptr_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_const_char_ptr_ = sizeof( boost::range_detail::is_const_char_ptr_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_wchar_t_ptr_ = sizeof( boost::range_detail::is_wchar_t_ptr_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_const_wchar_t_ptr_ = sizeof( boost::range_detail::is_const_wchar_t_ptr_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_char_array_ = sizeof( boost::range_detail::is_char_array_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_wchar_t_array_ = sizeof( boost::range_detail::is_wchar_t_array_impl( ptr ) ) == sizeof( yes_type ) ); + BOOST_STATIC_CONSTANT( bool, is_string_ = (boost::mpl::or_, boost::mpl::bool_ >::value )); + BOOST_STATIC_CONSTANT( bool, is_array_ = boost::is_array::value ); + + }; + + template< typename C > + class range + { + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_pair_, + boost::range_detail::std_pair_, + void >::type pair_t; + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_array_, + boost::range_detail::array_, + pair_t >::type array_t; + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_string_, + boost::range_detail::string_, + array_t >::type string_t; + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_const_char_ptr_, + boost::range_detail::const_char_ptr_, + string_t >::type const_char_ptr_t; + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_char_ptr_, + boost::range_detail::char_ptr_, + const_char_ptr_t >::type char_ptr_t; + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_const_wchar_t_ptr_, + boost::range_detail::const_wchar_t_ptr_, + char_ptr_t >::type const_wchar_ptr_t; + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_wchar_t_ptr_, + boost::range_detail::wchar_t_ptr_, + const_wchar_ptr_t >::type wchar_ptr_t; + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_wchar_t_array_, + boost::range_detail::wchar_t_array_, + wchar_ptr_t >::type wchar_array_t; + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_char_array_, + boost::range_detail::char_array_, + wchar_array_t >::type char_array_t; + public: + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::is_void::value, + boost::range_detail::std_container_, + char_array_t >::type type; + }; // class 'range' + } +} + +#endif + diff --git a/libraries/boost/include/boost/range/detail/end.hpp b/libraries/boost/include/boost/range/detail/end.hpp new file mode 100644 index 0000000000..f2f71780a7 --- /dev/null +++ b/libraries/boost/include/boost/range/detail/end.hpp @@ -0,0 +1,86 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_END_HPP +#define BOOST_RANGE_DETAIL_END_HPP + +#include // BOOST_MSVC +#include + +#include +#include +#include + +namespace boost +{ + namespace range_detail + { + template< typename T > + struct range_end; + + ////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////// + + template<> + struct range_end + { + template< typename C > + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type + fun( C& c ) + { + return c.end(); + }; + }; + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template<> + struct range_end + { + template< typename P > + static BOOST_RANGE_DEDUCED_TYPENAME range_iterator

::type + fun( const P& p ) + { + return p.second; + } + }; + + ////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////// + + template<> + struct range_end + { + template + static BOOST_RANGE_DEDUCED_TYPENAME remove_extent::type* fun(T& t) + { + return t + remove_extent::size; + } + }; + + } // namespace 'range_detail' + + namespace range_adl_barrier + { + template< typename C > + inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type + end( C& c ) + { + return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range::type >::fun( c ); + } + } // namespace range_adl_barrier + +} // namespace 'boost' + +#endif diff --git a/libraries/boost/include/boost/range/detail/extract_optional_type.hpp b/libraries/boost/include/boost/range/detail/extract_optional_type.hpp new file mode 100644 index 0000000000..0381434a85 --- /dev/null +++ b/libraries/boost/include/boost/range/detail/extract_optional_type.hpp @@ -0,0 +1,48 @@ +// Boost.Range library +// +// Copyright Arno Schoedl & Neil Groves 2009. +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// +#ifndef BOOST_RANGE_DETAIL_EXTRACT_OPTIONAL_TYPE_HPP_INCLUDED +#define BOOST_RANGE_DETAIL_EXTRACT_OPTIONAL_TYPE_HPP_INCLUDED + +#if defined(_MSC_VER) +# pragma once +#endif + +#include +#include +#include + +#if !defined(BOOST_MPL_CFG_NO_HAS_XXX) + +// Defines extract_some_typedef which exposes T::some_typedef as +// extract_some_typedef::type if T::some_typedef exists. Otherwise +// extract_some_typedef is empty. +#define BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( a_typedef ) \ + BOOST_MPL_HAS_XXX_TRAIT_DEF(a_typedef) \ + template< typename C, bool B = BOOST_PP_CAT(has_, a_typedef)::value > \ + struct BOOST_PP_CAT(extract_, a_typedef) \ + {}; \ + template< typename C > \ + struct BOOST_PP_CAT(extract_, a_typedef)< C, true > \ + { \ + typedef BOOST_DEDUCED_TYPENAME C::a_typedef type; \ + }; + +#else + +#define BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( a_typedef ) \ + template< typename C > \ + struct BOOST_PP_CAT(extract_, a_typedef) \ + { \ + typedef BOOST_DEDUCED_TYPENAME C::a_typedef type; \ + }; + +#endif + +#endif // include guard diff --git a/libraries/boost/include/boost/range/detail/implementation_help.hpp b/libraries/boost/include/boost/range/detail/implementation_help.hpp new file mode 100644 index 0000000000..f35953f349 --- /dev/null +++ b/libraries/boost/include/boost/range/detail/implementation_help.hpp @@ -0,0 +1,114 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP +#define BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP + +#include +#include +#include +#include +#include + +#ifndef BOOST_NO_CWCHAR +#include +#endif + +namespace boost +{ + namespace range_detail + { + template + inline void boost_range_silence_warning( const T& ) { } + + ///////////////////////////////////////////////////////////////////// + // end() help + ///////////////////////////////////////////////////////////////////// + + inline const char* str_end( const char* s, const char* ) + { + return s + strlen( s ); + } + +#ifndef BOOST_NO_CWCHAR + inline const wchar_t* str_end( const wchar_t* s, const wchar_t* ) + { + return s + wcslen( s ); + } +#else + inline const wchar_t* str_end( const wchar_t* s, const wchar_t* ) + { + if( s == 0 || s[0] == 0 ) + return s; + while( *++s != 0 ) + ; + return s; + } +#endif + + template< class Char > + inline Char* str_end( Char* s ) + { + return const_cast( str_end( s, s ) ); + } + + template< class T, std::size_t sz > + inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz] ) + { + return boost_range_array + sz; + } + + template< class T, std::size_t sz > + inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] ) + { + return boost_range_array + sz; + } + + ///////////////////////////////////////////////////////////////////// + // size() help + ///////////////////////////////////////////////////////////////////// + + template< class Char > + inline std::size_t str_size( const Char* const& s ) + { + return str_end( s ) - s; + } + + template< class T, std::size_t sz > + inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] ) + { + boost_range_silence_warning( boost_range_array ); + return sz; + } + + template< class T, std::size_t sz > + inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz] ) + { + boost_range_silence_warning( boost_range_array ); + return sz; + } + + inline bool is_same_address(const void* l, const void* r) + { + return l == r; + } + + template + inline bool is_same_object(const T1& l, const T2& r) + { + return range_detail::is_same_address(&l, &r); + } + + } // namespace 'range_detail' + +} // namespace 'boost' + + +#endif diff --git a/libraries/boost/include/boost/range/detail/msvc_has_iterator_workaround.hpp b/libraries/boost/include/boost/range/detail/msvc_has_iterator_workaround.hpp new file mode 100644 index 0000000000..62b67fd529 --- /dev/null +++ b/libraries/boost/include/boost/range/detail/msvc_has_iterator_workaround.hpp @@ -0,0 +1,132 @@ +// Boost.Range library +// +// Copyright Eric Niebler 2014. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_MSVC_HAS_ITERATOR_WORKAROUND_HPP +#define BOOST_RANGE_DETAIL_MSVC_HAS_ITERATOR_WORKAROUND_HPP + +#if defined(_MSC_VER) +# pragma once +#endif + +#ifndef BOOST_RANGE_MUTABLE_ITERATOR_HPP +# error This file should only be included from +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600) +namespace boost +{ +namespace cb_details +{ + template + struct iterator; +} + +namespace python +{ + template + struct iterator; +} + +namespace type_erasure +{ + template< + class Traversal, + class T /*= _self*/, + class Reference /*= ::boost::use_default*/, + class DifferenceType /*= ::std::ptrdiff_t*/, + class ValueType /*= typename deduced >::type*/ + > + struct iterator; +} + +namespace unordered { namespace iterator_detail +{ + template + struct iterator; +}} + +namespace container { namespace container_detail +{ + template + class iterator; +}} + +namespace spirit { namespace lex { namespace lexertl +{ + template + class iterator; +}}} + +namespace range_detail +{ + template + struct has_iterator< ::boost::cb_details::iterator > + : mpl::false_ + {}; + + template + struct has_iterator< ::boost::cb_details::iterator const> + : mpl::false_ + {}; + + template + struct has_iterator< ::boost::python::iterator > + : mpl::false_ + {}; + + template + struct has_iterator< ::boost::python::iterator const> + : mpl::false_ + {}; + + template + struct has_iterator< ::boost::type_erasure::iterator > + : mpl::false_ + {}; + + template + struct has_iterator< ::boost::type_erasure::iterator const> + : mpl::false_ + {}; + + template + struct has_iterator< ::boost::unordered::iterator_detail::iterator > + : mpl::false_ + {}; + + template + struct has_iterator< ::boost::unordered::iterator_detail::iterator const> + : mpl::false_ + {}; + + template + struct has_iterator< ::boost::container::container_detail::iterator > + : mpl::false_ + {}; + + template + struct has_iterator< ::boost::container::container_detail::iterator const> + : mpl::false_ + {}; + + template + struct has_iterator< ::boost::spirit::lex::lexertl::iterator > + : mpl::false_ + {}; + + template + struct has_iterator< ::boost::spirit::lex::lexertl::iterator const> + : mpl::false_ + {}; +} +} +#endif +#endif diff --git a/libraries/boost/include/boost/range/detail/sfinae.hpp b/libraries/boost/include/boost/range/detail/sfinae.hpp new file mode 100644 index 0000000000..5b2c61e71e --- /dev/null +++ b/libraries/boost/include/boost/range/detail/sfinae.hpp @@ -0,0 +1,77 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_SFINAE_HPP +#define BOOST_RANGE_DETAIL_SFINAE_HPP + +#include +#include +#include +#include + + +namespace boost +{ + namespace range_detail + { + using type_traits::yes_type; + using type_traits::no_type; + + ////////////////////////////////////////////////////////////////////// + // string + ////////////////////////////////////////////////////////////////////// + + yes_type is_string_impl( const char* const ); + yes_type is_string_impl( const wchar_t* const ); + no_type is_string_impl( ... ); + + template< std::size_t sz > + yes_type is_char_array_impl( char BOOST_RANGE_ARRAY_REF()[sz] ); + template< std::size_t sz > + yes_type is_char_array_impl( const char BOOST_RANGE_ARRAY_REF()[sz] ); + no_type is_char_array_impl( ... ); + + template< std::size_t sz > + yes_type is_wchar_t_array_impl( wchar_t BOOST_RANGE_ARRAY_REF()[sz] ); + template< std::size_t sz > + yes_type is_wchar_t_array_impl( const wchar_t BOOST_RANGE_ARRAY_REF()[sz] ); + no_type is_wchar_t_array_impl( ... ); + + yes_type is_char_ptr_impl( char* const ); + no_type is_char_ptr_impl( ... ); + + yes_type is_const_char_ptr_impl( const char* const ); + no_type is_const_char_ptr_impl( ... ); + + yes_type is_wchar_t_ptr_impl( wchar_t* const ); + no_type is_wchar_t_ptr_impl( ... ); + + yes_type is_const_wchar_t_ptr_impl( const wchar_t* const ); + no_type is_const_wchar_t_ptr_impl( ... ); + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + yes_type is_pair_impl( const std::pair* ); + no_type is_pair_impl( ... ); + + ////////////////////////////////////////////////////////////////////// + // tags + ////////////////////////////////////////////////////////////////////// + + struct char_or_wchar_t_array_tag {}; + + } // namespace 'range_detail' + +} // namespace 'boost' + +#endif diff --git a/libraries/boost/include/boost/range/end.hpp b/libraries/boost/include/boost/range/end.hpp new file mode 100644 index 0000000000..f2a3337e34 --- /dev/null +++ b/libraries/boost/include/boost/range/end.hpp @@ -0,0 +1,128 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_END_HPP +#define BOOST_RANGE_END_HPP + +#if defined(_MSC_VER) +# pragma once +#endif + +#include + +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +#include +#else + +#include +#include +#include + +namespace boost +{ + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +namespace range_detail +{ +#endif + + ////////////////////////////////////////////////////////////////////// + // primary template + ////////////////////////////////////////////////////////////////////// + template< typename C > + inline BOOST_DEDUCED_TYPENAME range_iterator::type + range_end( C& c ) + { + // + // If you get a compile-error here, it is most likely because + // you have not implemented range_begin() properly in + // the namespace of C + // + return c.end(); + } + + ////////////////////////////////////////////////////////////////////// + // pair + ////////////////////////////////////////////////////////////////////// + + template< typename Iterator > + inline Iterator range_end( const std::pair& p ) + { + return p.second; + } + + template< typename Iterator > + inline Iterator range_end( std::pair& p ) + { + return p.second; + } + + ////////////////////////////////////////////////////////////////////// + // array + ////////////////////////////////////////////////////////////////////// + + template< typename T, std::size_t sz > + inline const T* range_end( const T (&a)[sz] ) + { + return range_detail::array_end( a ); + } + + template< typename T, std::size_t sz > + inline T* range_end( T (&a)[sz] ) + { + return range_detail::array_end( a ); + } + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +} // namespace 'range_detail' +#endif + +namespace range_adl_barrier +{ + +template< class T > +inline BOOST_DEDUCED_TYPENAME range_iterator::type end( T& r ) +{ +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + using namespace range_detail; +#endif + return range_end( r ); +} + +template< class T > +inline BOOST_DEDUCED_TYPENAME range_iterator::type end( const T& r ) +{ +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + using namespace range_detail; +#endif + return range_end( r ); +} + + } // namespace range_adl_barrier +} // namespace 'boost' + +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +namespace boost +{ + namespace range_adl_barrier + { + template< class T > + inline BOOST_DEDUCED_TYPENAME range_iterator::type + const_end( const T& r ) + { + return boost::range_adl_barrier::end( r ); + } + } // namespace range_adl_barrier + using namespace range_adl_barrier; +} // namespace boost + +#endif + diff --git a/libraries/boost/include/boost/range/iterator.hpp b/libraries/boost/include/boost/range/iterator.hpp new file mode 100644 index 0000000000..2956353ab5 --- /dev/null +++ b/libraries/boost/include/boost/range/iterator.hpp @@ -0,0 +1,74 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_ITERATOR_HPP +#define BOOST_RANGE_ITERATOR_HPP + +#if defined(_MSC_VER) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + +#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) + + namespace range_detail_vc7_1 + { + template< typename C, typename Sig = void(C) > + struct range_iterator + { + typedef BOOST_RANGE_DEDUCED_TYPENAME + mpl::eval_if_c< is_const::value, + range_const_iterator< typename remove_const::type >, + range_mutable_iterator >::type type; + }; + + template< typename C, typename T > + struct range_iterator< C, void(T[]) > + { + typedef T* type; + }; + } + + template< typename C, typename Enabler=void > + struct range_iterator + { + + typedef BOOST_RANGE_DEDUCED_TYPENAME + range_detail_vc7_1::range_iterator::type type; + + }; + +#else + + template< typename C, typename Enabler=void > + struct range_iterator + : mpl::if_c< + is_const::type>::value, + range_const_iterator::type>::type>, + range_mutable_iterator::type> + >::type + { + }; + +#endif + +} // namespace boost + +#endif diff --git a/libraries/boost/include/boost/range/mutable_iterator.hpp b/libraries/boost/include/boost/range/mutable_iterator.hpp new file mode 100644 index 0000000000..b924666679 --- /dev/null +++ b/libraries/boost/include/boost/range/mutable_iterator.hpp @@ -0,0 +1,79 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_MUTABLE_ITERATOR_HPP +#define BOOST_RANGE_MUTABLE_ITERATOR_HPP + +#if defined(_MSC_VER) +# pragma once +#endif + +#include + +#include +#include +#include +#include +#include +#include + +namespace boost +{ + + ////////////////////////////////////////////////////////////////////////// + // default + ////////////////////////////////////////////////////////////////////////// + + namespace range_detail + { + +BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( iterator ) + +template< typename C > +struct range_mutable_iterator + : range_detail::extract_iterator< + BOOST_DEDUCED_TYPENAME remove_reference::type> +{}; + +////////////////////////////////////////////////////////////////////////// +// pair +////////////////////////////////////////////////////////////////////////// + +template< typename Iterator > +struct range_mutable_iterator< std::pair > +{ + typedef Iterator type; +}; + +////////////////////////////////////////////////////////////////////////// +// array +////////////////////////////////////////////////////////////////////////// + +template< typename T, std::size_t sz > +struct range_mutable_iterator< T[sz] > +{ + typedef T* type; +}; + + } // namespace range_detail + +template +struct range_mutable_iterator + : range_detail::range_mutable_iterator< + BOOST_DEDUCED_TYPENAME remove_reference::type + > +{ +}; + +} // namespace boost + +#include + +#endif diff --git a/libraries/boost/include/boost/range/range_fwd.hpp b/libraries/boost/include/boost/range/range_fwd.hpp new file mode 100644 index 0000000000..0e6e00f553 --- /dev/null +++ b/libraries/boost/include/boost/range/range_fwd.hpp @@ -0,0 +1,63 @@ +// Boost.Range library +// +// Copyright Neil Groves 2003-2004. +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see http://www.boost.org/libs/range/ +// +#ifndef BOOST_RANGE_RANGE_FWD_HPP_INCLUDED +#define BOOST_RANGE_RANGE_FWD_HPP_INCLUDED + +namespace boost +{ + +// Extension points + template + struct range_iterator; + + template + struct range_mutable_iterator; + + template + struct range_const_iterator; + +// Core classes + template + class iterator_range; + + template + class sub_range; + +// Meta-functions + template + struct range_category; + + template + struct range_difference; + + template + struct range_pointer; + + template + struct range_reference; + + template + struct range_reverse_iterator; + + template + struct range_size; + + template + struct range_value; + + template + struct has_range_iterator; + + template + struct has_range_const_iterator; + +} // namespace boost + +#endif // include guard diff --git a/libraries/boost/include/boost/scoped_array.hpp b/libraries/boost/include/boost/scoped_array.hpp new file mode 100644 index 0000000000..d91889b7cf --- /dev/null +++ b/libraries/boost/include/boost/scoped_array.hpp @@ -0,0 +1,15 @@ +#ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED +#define BOOST_SCOPED_ARRAY_HPP_INCLUDED + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include + +#endif // #ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED diff --git a/libraries/boost/include/boost/scoped_ptr.hpp b/libraries/boost/include/boost/scoped_ptr.hpp new file mode 100644 index 0000000000..334a22e2fe --- /dev/null +++ b/libraries/boost/include/boost/scoped_ptr.hpp @@ -0,0 +1,15 @@ +#ifndef BOOST_SCOPED_PTR_HPP_INCLUDED +#define BOOST_SCOPED_PTR_HPP_INCLUDED + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include + +#endif // #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/shared_ptr.hpp b/libraries/boost/include/boost/shared_ptr.hpp new file mode 100644 index 0000000000..cb01b26588 --- /dev/null +++ b/libraries/boost/include/boost/shared_ptr.hpp @@ -0,0 +1,19 @@ +#ifndef BOOST_SHARED_PTR_HPP_INCLUDED +#define BOOST_SHARED_PTR_HPP_INCLUDED + +// +// shared_ptr.hpp +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001-2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include + +#endif // #ifndef BOOST_SHARED_PTR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/allocate_shared_array.hpp b/libraries/boost/include/boost/smart_ptr/allocate_shared_array.hpp new file mode 100644 index 0000000000..340688146c --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/allocate_shared_array.hpp @@ -0,0 +1,703 @@ +/* +Copyright 2012-2017 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP +#define BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace detail { + +template +struct sp_if_array { }; + +template +struct sp_if_array { + typedef boost::shared_ptr type; +}; + +template +struct sp_if_size_array { }; + +template +struct sp_if_size_array { + typedef boost::shared_ptr type; +}; + +template +struct sp_array_element { }; + +template +struct sp_array_element { + typedef T type; +}; + +template +struct sp_array_element { + typedef T type; +}; + +template +struct sp_array_scalar { + typedef T type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_count { + enum { + value = 1 + }; +}; + +template +struct sp_array_count { + enum { + value = N * sp_array_count::value + }; +}; + +template +struct sp_max_size { + enum { + value = N < M ? M : N + }; +}; + +template +struct sp_align_up { + enum { + value = (N + M - 1) & ~(M - 1) + }; +}; + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +template +struct sp_bind_allocator { + typedef typename std::allocator_traits::template rebind_alloc type; +}; +#else +template +struct sp_bind_allocator { + typedef typename A::template rebind::other type; +}; +#endif + +template +BOOST_CONSTEXPR inline std::size_t +sp_objects(std::size_t size) BOOST_SP_NOEXCEPT +{ + return (size + sizeof(T) - 1) / sizeof(T); +} + +template +struct sp_enable { }; + +template +struct sp_enable { + typedef T type; +}; + +template +inline typename sp_enable::value>::type +sp_array_destroy(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } + +template +inline typename sp_enable::value>::type +sp_array_destroy(A&, T* start, std::size_t size) +{ + while (size > 0) { + start[--size].~T(); + } +} + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +template +inline typename sp_enable::type +sp_array_destroy(A& allocator, T* start, std::size_t size) +{ + while (size > 0) { + std::allocator_traits::destroy(allocator, start + --size); + } +} +#endif + +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value>::type +sp_array_construct(A&, T* start, std::size_t size) +{ + for (std::size_t i = 0; i < size; ++i) { + start[i] = T(); + } +} + +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value>::type +sp_array_construct(A&, T* start, std::size_t size, const T* list, + std::size_t count) +{ + for (std::size_t i = 0; i < size; ++i) { + start[i] = list[i % count]; + } +} + +#if !defined(BOOST_NO_EXCEPTIONS) +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value)>::type +sp_array_construct(A& none, T* start, std::size_t size) +{ + std::size_t i = 0; + try { + for (; i < size; ++i) { + ::new(static_cast(start + i)) T(); + } + } catch (...) { + sp_array_destroy(none, start, i); + throw; + } +} + +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value)>::type +sp_array_construct(A& none, T* start, std::size_t size, const T* list, + std::size_t count) +{ + std::size_t i = 0; + try { + for (; i < size; ++i) { + ::new(static_cast(start + i)) T(list[i % count]); + } + } catch (...) { + sp_array_destroy(none, start, i); + throw; + } +} +#else +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value)>::type +sp_array_construct(A&, T* start, std::size_t size) +{ + for (std::size_t i = 0; i < size; ++i) { + ::new(static_cast(start + i)) T(); + } +} + +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value)>::type +sp_array_construct(A&, T* start, std::size_t size, const T* list, + std::size_t count) +{ + for (std::size_t i = 0; i < size; ++i) { + ::new(static_cast(start + i)) T(list[i % count]); + } +} +#endif + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +#if !defined(BOOST_NO_EXCEPTIONS) +template +inline typename sp_enable::type +sp_array_construct(A& allocator, T* start, std::size_t size) +{ + std::size_t i = 0; + try { + for (i = 0; i < size; ++i) { + std::allocator_traits::construct(allocator, start + i); + } + } catch (...) { + sp_array_destroy(allocator, start, i); + throw; + } +} + +template +inline typename sp_enable::type +sp_array_construct(A& allocator, T* start, std::size_t size, const T* list, + std::size_t count) +{ + std::size_t i = 0; + try { + for (i = 0; i < size; ++i) { + std::allocator_traits::construct(allocator, start + i, + list[i % count]); + } + } catch (...) { + sp_array_destroy(allocator, start, i); + throw; + } +} +#else +template +inline typename sp_enable::type +sp_array_construct(A& allocator, T* start, std::size_t size) +{ + for (std::size_t i = 0; i < size; ++i) { + std::allocator_traits::construct(allocator, start + i); + } +} + +template +inline typename sp_enable::type +sp_array_construct(A& allocator, T* start, std::size_t size, const T* list, + std::size_t count) +{ + for (std::size_t i = 0; i < size; ++i) { + std::allocator_traits::construct(allocator, start + i, + list[i % count]); + } +} +#endif +#endif + +template +inline typename sp_enable::value>::type +sp_array_default(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } + +#if !defined(BOOST_NO_EXCEPTIONS) +template +inline typename sp_enable::value>::type +sp_array_default(A& none, T* start, std::size_t size) +{ + std::size_t i = 0; + try { + for (; i < size; ++i) { + ::new(static_cast(start + i)) T; + } + } catch (...) { + sp_array_destroy(none, start, i); + throw; + } +} +#else +template +inline typename sp_enable::value>::type +sp_array_default(A&, T* start, std::size_t size) +{ + for (std::size_t i = 0; i < size; ++i) { + ::new(static_cast(start + i)) T; + } +} +#endif + +template +class sp_array_state { +public: + typedef A type; + + template + sp_array_state(const U& _allocator, std::size_t _size) BOOST_SP_NOEXCEPT + : allocator_(_allocator), + size_(_size) { } + + A& allocator() BOOST_SP_NOEXCEPT { + return allocator_; + } + + std::size_t size() const BOOST_SP_NOEXCEPT { + return size_; + } + +private: + A allocator_; + std::size_t size_; +}; + +template +class sp_size_array_state { +public: + typedef A type; + + template + sp_size_array_state(const U& _allocator, std::size_t) BOOST_SP_NOEXCEPT + : allocator_(_allocator) { } + + A& allocator() BOOST_SP_NOEXCEPT { + return allocator_; + } + + BOOST_CONSTEXPR std::size_t size() const BOOST_SP_NOEXCEPT { + return N; + } + +private: + A allocator_; +}; + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +template +struct sp_use_construct { + enum { + value = true + }; +}; + +template +struct sp_use_construct > { + enum { + value = false + }; +}; +#else +template +struct sp_use_construct { + enum { + value = false + }; +}; +#endif + +template +struct sp_array_alignment { + enum { + value = sp_max_size::value, + boost::alignment_of::value>::value + }; +}; + +template +struct sp_array_offset { + enum { + value = sp_align_up::value>::value + }; +}; + +template +struct sp_array_storage { + enum { + value = sp_array_alignment::value + }; + typedef typename boost::type_with_alignment::type type; +}; + +template +inline U* +sp_array_start(void* base) BOOST_SP_NOEXCEPT +{ + enum { + size = sp_array_offset::value + }; + return reinterpret_cast(static_cast(base) + size); +} + +template +class sp_array_creator { + typedef typename A::value_type scalar; + + enum { + offset = sp_array_offset::value + }; + + typedef typename sp_array_storage::type type; + +public: + template + sp_array_creator(const U& other, std::size_t size) BOOST_SP_NOEXCEPT + : other_(other), + size_(sp_objects(offset + sizeof(scalar) * size)) { } + + T* create() { + return reinterpret_cast(other_.allocate(size_)); + } + + void destroy(T* base) { + other_.deallocate(reinterpret_cast(base), size_); + } + +private: + typename sp_bind_allocator::type other_; + std::size_t size_; +}; + +struct sp_default { }; + +template::value> +class sp_array_base + : public sp_counted_base { + typedef typename T::type allocator; + +public: + typedef typename allocator::value_type type; + + template + sp_array_base(const A& other, std::size_t size, type* start) + : state_(other, size) { + sp_array_construct(state_.allocator(), start, state_.size()); + } + + template + sp_array_base(const A& other, std::size_t size, const type* list, + std::size_t count, type* start) + : state_(other, size) { + sp_array_construct(state_.allocator(), start, state_.size(), list, + count); + } + + template + sp_array_base(sp_default, const A& other, std::size_t size, type* start) + : state_(other, size) { + sp_array_default(state_.allocator(), start, state_.size()); + } + + T& state() BOOST_SP_NOEXCEPT { + return state_; + } + + virtual void dispose() { + sp_array_destroy(state_.allocator(), + sp_array_start(this), state_.size()); + } + + virtual void destroy() { + sp_array_creator other(state_.allocator(), + state_.size()); + this->~sp_array_base(); + other.destroy(this); + } + + virtual void* get_deleter(const sp_typeinfo&) { + return 0; + } + + virtual void* get_local_deleter(const sp_typeinfo&) { + return 0; + } + + virtual void* get_untyped_deleter() { + return 0; + } + +private: + T state_; +}; + +template +struct sp_array_result { +public: + template + sp_array_result(const U& other, std::size_t size) + : creator_(other, size), + result_(creator_.create()) { } + + ~sp_array_result() { + if (result_) { + creator_.destroy(result_); + } + } + + T* get() const { + return result_; + } + + void release() { + result_ = 0; + } + +private: + sp_array_result(const sp_array_result&); + sp_array_result& operator=(const sp_array_result&); + + sp_array_creator creator_; + T* result_; +}; + +} /* detail */ + +template +inline typename detail::sp_if_array::type +allocate_shared(const A& allocator, std::size_t count) +{ + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_array_state state; + typedef detail::sp_array_base base; + std::size_t size = count * detail::sp_array_count::value; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(allocator, size, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +template +inline typename detail::sp_if_size_array::type +allocate_shared(const A& allocator) +{ + enum { + size = detail::sp_array_count::value + }; + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_size_array_state state; + typedef detail::sp_array_base base; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(allocator, size, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +template +inline typename detail::sp_if_array::type +allocate_shared(const A& allocator, std::size_t count, + const typename detail::sp_array_element::type& value) +{ + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_array_state state; + typedef detail::sp_array_base base; + std::size_t size = count * detail::sp_array_count::value; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(allocator, size, + reinterpret_cast(&value), + detail::sp_array_count::value, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +template +inline typename detail::sp_if_size_array::type +allocate_shared(const A& allocator, + const typename detail::sp_array_element::type& value) +{ + enum { + size = detail::sp_array_count::value + }; + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_size_array_state state; + typedef detail::sp_array_base base; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(allocator, size, + reinterpret_cast(&value), + detail::sp_array_count::value, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +template +inline typename detail::sp_if_array::type +allocate_shared_noinit(const A& allocator, std::size_t count) +{ + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_array_state state; + typedef detail::sp_array_base base; + std::size_t size = count * detail::sp_array_count::value; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(detail::sp_default(), allocator, + size, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +template +inline typename detail::sp_if_size_array::type +allocate_shared_noinit(const A& allocator) +{ + enum { + size = detail::sp_array_count::value + }; + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_size_array_state state; + typedef detail::sp_array_base base; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(detail::sp_default(), allocator, + size, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +} /* boost */ + +#endif diff --git a/libraries/boost/include/boost/smart_ptr/bad_weak_ptr.hpp b/libraries/boost/include/boost/smart_ptr/bad_weak_ptr.hpp new file mode 100644 index 0000000000..b086be595f --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/bad_weak_ptr.hpp @@ -0,0 +1,70 @@ +#ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/smart_ptr/bad_weak_ptr.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +#ifdef __BORLANDC__ +# pragma warn -8026 // Functions with excep. spec. are not expanded inline +#endif + +namespace boost +{ + +// The standard library that comes with Borland C++ 5.5.1, 5.6.4 +// defines std::exception and its members as having C calling +// convention (-pc). When the definition of bad_weak_ptr +// is compiled with -ps, the compiler issues an error. +// Hence, the temporary #pragma option -pc below. + +#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 +# pragma option push -pc +#endif + +#if defined(BOOST_CLANG) +// Intel C++ on Mac defines __clang__ but doesn't support the pragma +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +#endif + +class bad_weak_ptr: public std::exception +{ +public: + + virtual char const * what() const throw() + { + return "tr1::bad_weak_ptr"; + } +}; + +#if defined(BOOST_CLANG) +# pragma clang diagnostic pop +#endif + +#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 +# pragma option pop +#endif + +} // namespace boost + +#ifdef __BORLANDC__ +# pragma warn .8026 // Functions with excep. spec. are not expanded inline +#endif + +#endif // #ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/lightweight_mutex.hpp b/libraries/boost/include/boost/smart_ptr/detail/lightweight_mutex.hpp new file mode 100644 index 0000000000..d46b1932c2 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/lightweight_mutex.hpp @@ -0,0 +1,42 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lightweight_mutex.hpp - lightweight mutex +// +// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// typedef boost::detail::lightweight_mutex; +// +// boost::detail::lightweight_mutex is a header-only implementation of +// a subset of the Mutex concept requirements: +// +// http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.Mutex +// +// It maps to a CRITICAL_SECTION on Windows or a pthread_mutex on POSIX. +// + +#include + +#if !defined(BOOST_HAS_THREADS) +# include +#elif defined(BOOST_HAS_PTHREADS) +# include +#elif defined(BOOST_HAS_WINTHREADS) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# include +#else +// Use #define BOOST_DISABLE_THREADS to avoid the error +# error Unrecognized threading platform +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/local_counted_base.hpp b/libraries/boost/include/boost/smart_ptr/detail/local_counted_base.hpp new file mode 100644 index 0000000000..fdfe2c65cd --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/local_counted_base.hpp @@ -0,0 +1,148 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/local_counted_base.hpp +// +// Copyright 2017 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +class local_counted_base +{ +private: + + local_counted_base & operator= ( local_counted_base const & ); + +private: + + // not 'int' or 'unsigned' to avoid aliasing and enable optimizations + enum count_type { min_ = 0, initial_ = 1, max_ = 2147483647 }; + + count_type local_use_count_; + +public: + + BOOST_CONSTEXPR local_counted_base() BOOST_SP_NOEXCEPT: local_use_count_( initial_ ) + { + } + + BOOST_CONSTEXPR local_counted_base( local_counted_base const & ) BOOST_SP_NOEXCEPT: local_use_count_( initial_ ) + { + } + + virtual ~local_counted_base() /*BOOST_SP_NOEXCEPT*/ + { + } + + virtual void local_cb_destroy() BOOST_SP_NOEXCEPT = 0; + + virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT = 0; + + void add_ref() BOOST_SP_NOEXCEPT + { +#if !defined(__NVCC__) +#if defined( __has_builtin ) +# if __has_builtin( __builtin_assume ) + + __builtin_assume( local_use_count_ >= 1 ); + +# endif +#endif +#endif + + local_use_count_ = static_cast( local_use_count_ + 1 ); + } + + void release() BOOST_SP_NOEXCEPT + { + local_use_count_ = static_cast( local_use_count_ - 1 ); + + if( local_use_count_ == 0 ) + { + local_cb_destroy(); + } + } + + long local_use_count() const BOOST_SP_NOEXCEPT + { + return local_use_count_; + } +}; + +class local_counted_impl: public local_counted_base +{ +private: + + local_counted_impl( local_counted_impl const & ); + +private: + + shared_count pn_; + +public: + + explicit local_counted_impl( shared_count const& pn ): pn_( pn ) + { + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + explicit local_counted_impl( shared_count && pn ): pn_( std::move(pn) ) + { + } + +#endif + + virtual void local_cb_destroy() BOOST_SP_NOEXCEPT + { + delete this; + } + + virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT + { + return pn_; + } +}; + +class local_counted_impl_em: public local_counted_base +{ +public: + + shared_count pn_; + + virtual void local_cb_destroy() BOOST_SP_NOEXCEPT + { + shared_count().swap( pn_ ); + } + + virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT + { + return pn_; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/local_sp_deleter.hpp b/libraries/boost/include/boost/smart_ptr/detail/local_sp_deleter.hpp new file mode 100644 index 0000000000..7d04f1dc52 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/local_sp_deleter.hpp @@ -0,0 +1,91 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/local_sp_deleter.hpp +// +// Copyright 2017 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include +#include + +namespace boost +{ + +namespace detail +{ + +template class local_sp_deleter: public local_counted_impl_em +{ +private: + + D d_; + +public: + + local_sp_deleter(): d_() + { + } + + explicit local_sp_deleter( D const& d ) BOOST_SP_NOEXCEPT: d_( d ) + { + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + explicit local_sp_deleter( D&& d ) BOOST_SP_NOEXCEPT: d_( std::move(d) ) + { + } + +#endif + + D& deleter() + { + return d_; + } + + template void operator()( Y* p ) BOOST_SP_NOEXCEPT + { + d_( p ); + } + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + + void operator()( boost::detail::sp_nullptr_t p ) BOOST_SP_NOEXCEPT + { + d_( p ); + } + +#endif +}; + +template<> class local_sp_deleter +{ +}; + +template D * get_local_deleter( local_sp_deleter * p ) +{ + return &p->deleter(); +} + +inline void * get_local_deleter( local_sp_deleter * /*p*/ ) +{ + return 0; +} + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/lwm_nop.hpp b/libraries/boost/include/boost/smart_ptr/detail/lwm_nop.hpp new file mode 100644 index 0000000000..521a88ec1c --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/lwm_nop.hpp @@ -0,0 +1,37 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lwm_nop.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +namespace boost +{ + +namespace detail +{ + +class lightweight_mutex +{ +public: + + typedef lightweight_mutex scoped_lock; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/lwm_pthreads.hpp b/libraries/boost/include/boost/smart_ptr/detail/lwm_pthreads.hpp new file mode 100644 index 0000000000..8eda518233 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/lwm_pthreads.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lwm_pthreads.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +class lightweight_mutex +{ +private: + + pthread_mutex_t m_; + + lightweight_mutex(lightweight_mutex const &); + lightweight_mutex & operator=(lightweight_mutex const &); + +public: + + lightweight_mutex() + { + +// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init + +#if defined(__hpux) && defined(_DECTHREADS_) + BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 ); +#else + BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 ); +#endif + } + + ~lightweight_mutex() + { + BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 ); + } + + class scoped_lock; + friend class scoped_lock; + + class scoped_lock + { + private: + + pthread_mutex_t & m_; + + scoped_lock(scoped_lock const &); + scoped_lock & operator=(scoped_lock const &); + + public: + + scoped_lock(lightweight_mutex & m): m_(m.m_) + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + } + + ~scoped_lock() + { + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + } + }; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/lwm_win32_cs.hpp b/libraries/boost/include/boost/smart_ptr/detail/lwm_win32_cs.hpp new file mode 100644 index 0000000000..25b1f195b7 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/lwm_win32_cs.hpp @@ -0,0 +1,134 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lwm_win32_cs.hpp +// +// Copyright (c) 2002, 2003 Peter Dimov +// Copyright (c) Microsoft Corporation 2014 +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#ifdef BOOST_USE_WINDOWS_H + +#include + +#else + +struct _RTL_CRITICAL_SECTION; + +#endif + +namespace boost +{ + +namespace detail +{ + +#ifndef BOOST_USE_WINDOWS_H + +struct critical_section +{ + struct critical_section_debug * DebugInfo; + long LockCount; + long RecursionCount; + void * OwningThread; + void * LockSemaphore; +#if defined(_WIN64) + unsigned __int64 SpinCount; +#else + unsigned long SpinCount; +#endif +}; + +#if BOOST_PLAT_WINDOWS_RUNTIME +extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSectionEx(::_RTL_CRITICAL_SECTION *, unsigned long, unsigned long); +#else +extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(::_RTL_CRITICAL_SECTION *); +#endif +extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRITICAL_SECTION *); +extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *); +extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *); + +#else + +typedef ::CRITICAL_SECTION critical_section; + +#if BOOST_PLAT_WINDOWS_RUNTIME +using ::InitializeCriticalSectionEx; +#else +using ::InitializeCriticalSection; +#endif +using ::EnterCriticalSection; +using ::LeaveCriticalSection; +using ::DeleteCriticalSection; + +#endif // #ifndef BOOST_USE_WINDOWS_H + +class lightweight_mutex +{ +private: + + critical_section cs_; + + lightweight_mutex(lightweight_mutex const &); + lightweight_mutex & operator=(lightweight_mutex const &); + +public: + + lightweight_mutex() + { +#if BOOST_PLAT_WINDOWS_RUNTIME + boost::detail::InitializeCriticalSectionEx(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_), 4000, 0); +#else + boost::detail::InitializeCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_)); +#endif + } + + ~lightweight_mutex() + { + boost::detail::DeleteCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_)); + } + + class scoped_lock; + friend class scoped_lock; + + class scoped_lock + { + private: + + lightweight_mutex & m_; + + scoped_lock(scoped_lock const &); + scoped_lock & operator=(scoped_lock const &); + + public: + + explicit scoped_lock(lightweight_mutex & m): m_(m) + { + boost::detail::EnterCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_)); + } + + ~scoped_lock() + { + boost::detail::LeaveCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_)); + } + }; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/operator_bool.hpp b/libraries/boost/include/boost/smart_ptr/detail/operator_bool.hpp new file mode 100644 index 0000000000..f9c5ef6803 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/operator_bool.hpp @@ -0,0 +1,64 @@ +// This header intentionally has no include guards. +// +// Copyright (c) 2001-2009, 2012 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !defined( BOOST_NO_CXX11_NULLPTR )\ + && !(defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5130)) + + explicit operator bool () const BOOST_SP_NOEXCEPT + { + return px != 0; + } + +#elif ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) + + operator bool () const BOOST_SP_NOEXCEPT + { + return px != 0; + } + +#elif defined( _MANAGED ) + + static void unspecified_bool( this_type*** ) + { + } + + typedef void (*unspecified_bool_type)( this_type*** ); + + operator unspecified_bool_type() const BOOST_SP_NOEXCEPT + { + return px == 0? 0: unspecified_bool; + } + +#elif \ + ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ + ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ + ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) + + typedef element_type * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const BOOST_SP_NOEXCEPT + { + return px == 0? 0: &this_type::get; + } + +#else + + typedef element_type * this_type::*unspecified_bool_type; + + operator unspecified_bool_type() const BOOST_SP_NOEXCEPT + { + return px == 0? 0: &this_type::px; + } + +#endif + + // operator! is redundant, but some compilers need it + bool operator! () const BOOST_SP_NOEXCEPT + { + return px == 0; + } diff --git a/libraries/boost/include/boost/smart_ptr/detail/quick_allocator.hpp b/libraries/boost/include/boost/smart_ptr/detail/quick_allocator.hpp new file mode 100644 index 0000000000..159bd5e7aa --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/quick_allocator.hpp @@ -0,0 +1,199 @@ +#ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/quick_allocator.hpp +// +// Copyright (c) 2003 David Abrahams +// Copyright (c) 2003 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#include +#include +#include + +#include // ::operator new, ::operator delete +#include // std::size_t + +namespace boost +{ + +namespace detail +{ + +template union freeblock +{ + typedef typename boost::type_with_alignment::type aligner_type; + aligner_type aligner; + char bytes[size]; + freeblock * next; +}; + +template struct allocator_impl +{ + typedef freeblock block; + + // It may seem odd to use such small pages. + // + // However, on a typical Windows implementation that uses + // the OS allocator, "normal size" pages interact with the + // "ordinary" operator new, slowing it down dramatically. + // + // 512 byte pages are handled by the small object allocator, + // and don't interfere with ::new. + // + // The other alternative is to use much bigger pages (1M.) + // + // It is surprisingly easy to hit pathological behavior by + // varying the page size. g++ 2.96 on Red Hat Linux 7.2, + // for example, passionately dislikes 496. 512 seems OK. + +#if defined(BOOST_QA_PAGE_SIZE) + + enum { items_per_page = BOOST_QA_PAGE_SIZE / size }; + +#else + + enum { items_per_page = 512 / size }; // 1048560 / size + +#endif + +#ifdef BOOST_HAS_THREADS + + static lightweight_mutex & mutex() + { + static freeblock< sizeof( lightweight_mutex ), boost::alignment_of< lightweight_mutex >::value > fbm; + static lightweight_mutex * pm = new( &fbm ) lightweight_mutex; + return *pm; + } + + static lightweight_mutex * mutex_init; + +#endif + + static block * free; + static block * page; + static unsigned last; + + static inline void * alloc() + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + if(block * x = free) + { + free = x->next; + return x; + } + else + { + if(last == items_per_page) + { + // "Listen to me carefully: there is no memory leak" + // -- Scott Meyers, Eff C++ 2nd Ed Item 10 + page = ::new block[items_per_page]; + last = 0; + } + + return &page[last++]; + } + } + + static inline void * alloc(std::size_t n) + { + if(n != size) // class-specific new called for a derived object + { + return ::operator new(n); + } + else + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + if(block * x = free) + { + free = x->next; + return x; + } + else + { + if(last == items_per_page) + { + page = ::new block[items_per_page]; + last = 0; + } + + return &page[last++]; + } + } + } + + static inline void dealloc(void * pv) + { + if(pv != 0) // 18.4.1.1/13 + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + block * pb = static_cast(pv); + pb->next = free; + free = pb; + } + } + + static inline void dealloc(void * pv, std::size_t n) + { + if(n != size) // class-specific delete called for a derived object + { + ::operator delete(pv); + } + else if(pv != 0) // 18.4.1.1/13 + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + block * pb = static_cast(pv); + pb->next = free; + free = pb; + } + } +}; + +#ifdef BOOST_HAS_THREADS + +template + lightweight_mutex * allocator_impl::mutex_init = &allocator_impl::mutex(); + +#endif + +template + freeblock * allocator_impl::free = 0; + +template + freeblock * allocator_impl::page = 0; + +template + unsigned allocator_impl::last = allocator_impl::items_per_page; + +template +struct quick_allocator: public allocator_impl< sizeof(T), boost::alignment_of::value > +{ +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/shared_count.hpp b/libraries/boost/include/boost/smart_ptr/detail/shared_count.hpp new file mode 100644 index 0000000000..ae7d0fb46f --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/shared_count.hpp @@ -0,0 +1,667 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/shared_count.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#ifdef __BORLANDC__ +# pragma warn -8027 // Functions containing try are not expanded inline +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +// In order to avoid circular dependencies with Boost.TR1 +// we make sure that our include of doesn't try to +// pull in the TR1 headers: that's why we use this header +// rather than including directly: +#include // std::auto_ptr +#include // std::less + +#ifdef BOOST_NO_EXCEPTIONS +# include // std::bad_alloc +#endif + +#include + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +namespace boost +{ + +namespace movelib +{ + +template< class T, class D > class unique_ptr; + +} // namespace movelib + +namespace detail +{ + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +int const shared_count_id = 0x2C35F101; +int const weak_count_id = 0x298C38A4; + +#endif + +struct sp_nothrow_tag {}; + +template< class D > struct sp_inplace_tag +{ +}; + +template< class T > class sp_reference_wrapper +{ +public: + + explicit sp_reference_wrapper( T & t): t_( boost::addressof( t ) ) + { + } + + template< class Y > void operator()( Y * p ) const + { + (*t_)( p ); + } + +private: + + T * t_; +}; + +template< class D > struct sp_convert_reference +{ + typedef D type; +}; + +template< class D > struct sp_convert_reference< D& > +{ + typedef sp_reference_wrapper< D > type; +}; + +class weak_count; + +class shared_count +{ +private: + + sp_counted_base * pi_; + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + int id_; +#endif + + friend class weak_count; + +public: + + BOOST_CONSTEXPR shared_count(): pi_(0) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + } + + BOOST_CONSTEXPR explicit shared_count( sp_counted_base * pi ): pi_( pi ) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + } + + template explicit shared_count( Y * p ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = new sp_counted_impl_p( p ); + } + catch(...) + { + boost::checked_delete( p ); + throw; + } + +#else + + pi_ = new sp_counted_impl_p( p ); + + if( pi_ == 0 ) + { + boost::checked_delete( p ); + boost::throw_exception( std::bad_alloc() ); + } + +#endif + } + +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) + template shared_count( Y * p, D d ): pi_(0) +#else + template shared_count( P p, D d ): pi_(0) +#endif +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) + typedef Y* P; +#endif +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = new sp_counted_impl_pd(p, d); + } + catch(...) + { + d(p); // delete p + throw; + } + +#else + + pi_ = new sp_counted_impl_pd(p, d); + + if(pi_ == 0) + { + d(p); // delete p + boost::throw_exception(std::bad_alloc()); + } + +#endif + } + +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + + template< class P, class D > shared_count( P p, sp_inplace_tag ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = new sp_counted_impl_pd< P, D >( p ); + } + catch( ... ) + { + D::operator_fn( p ); // delete p + throw; + } + +#else + + pi_ = new sp_counted_impl_pd< P, D >( p ); + + if( pi_ == 0 ) + { + D::operator_fn( p ); // delete p + boost::throw_exception( std::bad_alloc() ); + } + +#endif // #ifndef BOOST_NO_EXCEPTIONS + } + +#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + + template shared_count( P p, D d, A a ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef sp_counted_impl_pda impl_type; + +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + typedef typename std::allocator_traits::template rebind_alloc< impl_type > A2; + +#else + + typedef typename A::template rebind< impl_type >::other A2; + +#endif + + A2 a2( a ); + +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = a2.allocate( 1 ); + ::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + } + catch(...) + { + d( p ); + + if( pi_ != 0 ) + { + a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); + } + + throw; + } + +#else + + pi_ = a2.allocate( 1 ); + + if( pi_ != 0 ) + { + ::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + } + else + { + d( p ); + boost::throw_exception( std::bad_alloc() ); + } + +#endif + } + +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + + template< class P, class D, class A > shared_count( P p, sp_inplace_tag< D >, A a ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef sp_counted_impl_pda< P, D, A > impl_type; + +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + typedef typename std::allocator_traits::template rebind_alloc< impl_type > A2; + +#else + + typedef typename A::template rebind< impl_type >::other A2; + +#endif + + A2 a2( a ); + +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = a2.allocate( 1 ); + ::new( static_cast< void* >( pi_ ) ) impl_type( p, a ); + } + catch(...) + { + D::operator_fn( p ); + + if( pi_ != 0 ) + { + a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); + } + + throw; + } + +#else + + pi_ = a2.allocate( 1 ); + + if( pi_ != 0 ) + { + ::new( static_cast< void* >( pi_ ) ) impl_type( p, a ); + } + else + { + D::operator_fn( p ); + boost::throw_exception( std::bad_alloc() ); + } + +#endif // #ifndef BOOST_NO_EXCEPTIONS + } + +#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + +#ifndef BOOST_NO_AUTO_PTR + + // auto_ptr is special cased to provide the strong guarantee + + template + explicit shared_count( std::auto_ptr & r ): pi_( new sp_counted_impl_p( r.get() ) ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#ifdef BOOST_NO_EXCEPTIONS + + if( pi_ == 0 ) + { + boost::throw_exception(std::bad_alloc()); + } + +#endif + + r.release(); + } + +#endif + +#if !defined( BOOST_NO_CXX11_SMART_PTR ) + + template + explicit shared_count( std::unique_ptr & r ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef typename sp_convert_reference::type D2; + + D2 d2( r.get_deleter() ); + pi_ = new sp_counted_impl_pd< typename std::unique_ptr::pointer, D2 >( r.get(), d2 ); + +#ifdef BOOST_NO_EXCEPTIONS + + if( pi_ == 0 ) + { + boost::throw_exception( std::bad_alloc() ); + } + +#endif + + r.release(); + } + +#endif + + template + explicit shared_count( boost::movelib::unique_ptr & r ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef typename sp_convert_reference::type D2; + + D2 d2( r.get_deleter() ); + pi_ = new sp_counted_impl_pd< typename boost::movelib::unique_ptr::pointer, D2 >( r.get(), d2 ); + +#ifdef BOOST_NO_EXCEPTIONS + + if( pi_ == 0 ) + { + boost::throw_exception( std::bad_alloc() ); + } + +#endif + + r.release(); + } + + ~shared_count() // nothrow + { + if( pi_ != 0 ) pi_->release(); +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + id_ = 0; +#endif + } + + shared_count(shared_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + if( pi_ != 0 ) pi_->add_ref_copy(); + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + shared_count(shared_count && r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + r.pi_ = 0; + } + +#endif + + explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 + shared_count( weak_count const & r, sp_nothrow_tag ); // constructs an empty *this when r.use_count() == 0 + + shared_count & operator= (shared_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + + if( tmp != pi_ ) + { + if( tmp != 0 ) tmp->add_ref_copy(); + if( pi_ != 0 ) pi_->release(); + pi_ = tmp; + } + + return *this; + } + + void swap(shared_count & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; + } + + long use_count() const // nothrow + { + return pi_ != 0? pi_->use_count(): 0; + } + + bool unique() const // nothrow + { + return use_count() == 1; + } + + bool empty() const // nothrow + { + return pi_ == 0; + } + + friend inline bool operator==(shared_count const & a, shared_count const & b) + { + return a.pi_ == b.pi_; + } + + friend inline bool operator<(shared_count const & a, shared_count const & b) + { + return std::less()( a.pi_, b.pi_ ); + } + + void * get_deleter( sp_typeinfo const & ti ) const + { + return pi_? pi_->get_deleter( ti ): 0; + } + + void * get_local_deleter( sp_typeinfo const & ti ) const + { + return pi_? pi_->get_local_deleter( ti ): 0; + } + + void * get_untyped_deleter() const + { + return pi_? pi_->get_untyped_deleter(): 0; + } +}; + + +class weak_count +{ +private: + + sp_counted_base * pi_; + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + int id_; +#endif + + friend class shared_count; + +public: + + BOOST_CONSTEXPR weak_count(): pi_(0) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + } + + weak_count(shared_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + if(pi_ != 0) pi_->weak_add_ref(); + } + + weak_count(weak_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + if(pi_ != 0) pi_->weak_add_ref(); + } + +// Move support + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + weak_count(weak_count && r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + r.pi_ = 0; + } + +#endif + + ~weak_count() // nothrow + { + if(pi_ != 0) pi_->weak_release(); +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + id_ = 0; +#endif + } + + weak_count & operator= (shared_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + + if( tmp != pi_ ) + { + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + } + + return *this; + } + + weak_count & operator= (weak_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + + if( tmp != pi_ ) + { + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + } + + return *this; + } + + void swap(weak_count & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; + } + + long use_count() const // nothrow + { + return pi_ != 0? pi_->use_count(): 0; + } + + bool empty() const // nothrow + { + return pi_ == 0; + } + + friend inline bool operator==(weak_count const & a, weak_count const & b) + { + return a.pi_ == b.pi_; + } + + friend inline bool operator<(weak_count const & a, weak_count const & b) + { + return std::less()(a.pi_, b.pi_); + } +}; + +inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif +{ + if( pi_ == 0 || !pi_->add_ref_lock() ) + { + boost::throw_exception( boost::bad_weak_ptr() ); + } +} + +inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( r.pi_ ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif +{ + if( pi_ != 0 && !pi_->add_ref_lock() ) + { + pi_ = 0; + } +} + +} // namespace detail + +} // namespace boost + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic pop +#endif + +#ifdef __BORLANDC__ +# pragma warn .8027 // Functions containing try are not expanded inline +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_convertible.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_convertible.hpp new file mode 100644 index 0000000000..4bba9ed444 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_convertible.hpp @@ -0,0 +1,92 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_convertible.hpp +// +// Copyright 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ < 303 ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x630 ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + +namespace boost +{ + +namespace detail +{ + +template< class Y, class T > struct sp_convertible +{ + typedef char (&yes) [1]; + typedef char (&no) [2]; + + static yes f( T* ); + static no f( ... ); + + enum _vt { value = sizeof( (f)( static_cast(0) ) ) == sizeof(yes) }; +}; + +template< class Y, class T > struct sp_convertible< Y, T[] > +{ + enum _vt { value = false }; +}; + +template< class Y, class T > struct sp_convertible< Y[], T[] > +{ + enum _vt { value = sp_convertible< Y[1], T[1] >::value }; +}; + +template< class Y, std::size_t N, class T > struct sp_convertible< Y[N], T[] > +{ + enum _vt { value = sp_convertible< Y[1], T[1] >::value }; +}; + +struct sp_empty +{ +}; + +template< bool > struct sp_enable_if_convertible_impl; + +template<> struct sp_enable_if_convertible_impl +{ + typedef sp_empty type; +}; + +template<> struct sp_enable_if_convertible_impl +{ +}; + +template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value > +{ +}; + +} // namespace detail + +} // namespace boost + +#endif // !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base.hpp new file mode 100644 index 0000000000..438613765b --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base.hpp @@ -0,0 +1,96 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base.hpp +// +// Copyright 2005-2013 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +#if !defined( __c2__ ) && defined( __clang__ ) && defined( __has_extension ) +# if __has_extension( __c_atomic__ ) +# define BOOST_SP_HAS_CLANG_C11_ATOMICS +# endif +#endif + +#if defined( BOOST_SP_DISABLE_THREADS ) +# include + +#elif defined( BOOST_SP_USE_STD_ATOMIC ) +# include + +#elif defined( BOOST_SP_USE_SPINLOCK ) +# include + +#elif defined( BOOST_SP_USE_PTHREADS ) +# include + +#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) +# include + +#elif defined( BOOST_SP_HAS_CLANG_C11_ATOMICS ) +# include + +#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) +# include + +#elif defined( __SNC__ ) +# include + +#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined(__PATHSCALE__) +# include + +#elif defined(__HP_aCC) && defined(__ia64) +# include + +#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER ) && !defined(__PATHSCALE__) +# include + +#elif defined( __IBMCPP__ ) && defined( __powerpc ) +# include + +#elif defined( __MWERKS__ ) && defined( __POWERPC__ ) +# include + +#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) ) && !defined(__PATHSCALE__) && !defined( _AIX ) +# include + +#elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) && !defined(__PATHSCALE__) && !defined( __mips16 ) +# include + +#elif defined( BOOST_SP_HAS_SYNC ) +# include + +#elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) ) +# include + +#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__) +# include + +#elif defined( _AIX ) +# include + +#elif !defined( BOOST_HAS_THREADS ) +# include + +#else +# include + +#endif + +#undef BOOST_SP_HAS_CLANG_C11_ATOMICS + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp new file mode 100644 index 0000000000..ec6f6ee184 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp @@ -0,0 +1,152 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED + +// +// detail/sp_counted_base_acc_ia64.hpp - aC++ on HP-UX IA64 +// +// Copyright 2007 Baruch Zilber +// Copyright 2007 Boris Gubenko +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + _Asm_fetchadd(_FASZ_W, _SEM_REL, pw, +1, _LDHINT_NONE); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int r = static_cast(_Asm_fetchadd(_FASZ_W, _SEM_REL, pw, -1, _LDHINT_NONE)); + if (1 == r) + { + _Asm_mf(); + } + + return r - 1; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int v = *pw; + + for (;;) + { + if (0 == v) + { + return 0; + } + + _Asm_mov_to_ar(_AREG_CCV, + v, + (_UP_CALL_FENCE | _UP_SYS_FENCE | _DOWN_CALL_FENCE | _DOWN_SYS_FENCE)); + int r = static_cast(_Asm_cmpxchg(_SZ_W, _SEM_ACQ, pw, v + 1, _LDHINT_NONE)); + if (r == v) + { + return r + 1; + } + + v = r; + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); // TODO use ld.acq here + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp new file mode 100644 index 0000000000..ce8ee686ba --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp @@ -0,0 +1,144 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED + +// +// detail/sp_counted_base_aix.hpp +// based on: detail/sp_counted_base_w32.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// Copyright 2006 Michael van der Westhuizen +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int32_t* pw ) +{ + // ++*pw; + + fetch_and_add( pw, 1 ); +} + +inline int32_t atomic_decrement( int32_t * pw ) +{ + // return --*pw; + + int32_t originalValue; + + __lwsync(); + originalValue = fetch_and_add( pw, -1 ); + __isync(); + + return (originalValue - 1); +} + +inline int32_t atomic_conditional_increment( int32_t * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int32_t tmp = fetch_and_add( pw, 0 ); + for( ;; ) + { + if( tmp == 0 ) return 0; + if( compare_and_swap( pw, &tmp, tmp + 1 ) ) return (tmp + 1); + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int32_t use_count_; // #shared + int32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return fetch_and_add( const_cast(&use_count_), 0 ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp new file mode 100644 index 0000000000..5d6e073d95 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp @@ -0,0 +1,150 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_clang.hpp - __c11 clang intrinsics +// +// Copyright (c) 2007, 2013, 2015 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +namespace boost +{ + +namespace detail +{ + +typedef _Atomic( boost::int_least32_t ) atomic_int_least32_t; + +inline void atomic_increment( atomic_int_least32_t * pw ) +{ + __c11_atomic_fetch_add( pw, 1, __ATOMIC_RELAXED ); +} + +inline boost::int_least32_t atomic_decrement( atomic_int_least32_t * pw ) +{ + return __c11_atomic_fetch_sub( pw, 1, __ATOMIC_ACQ_REL ); +} + +inline boost::int_least32_t atomic_conditional_increment( atomic_int_least32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + boost::int_least32_t r = __c11_atomic_load( pw, __ATOMIC_RELAXED ); + + for( ;; ) + { + if( r == 0 ) + { + return r; + } + + if( __c11_atomic_compare_exchange_weak( pw, &r, r + 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED ) ) + { + return r; + } + } +} + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +#endif + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + atomic_int_least32_t use_count_; // #shared + atomic_int_least32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base() + { + __c11_atomic_init( &use_count_, 1 ); + __c11_atomic_init( &weak_count_, 1 ); + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return __c11_atomic_load( const_cast< atomic_int_least32_t* >( &use_count_ ), __ATOMIC_ACQUIRE ); + } +}; + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp new file mode 100644 index 0000000000..065f7c3d14 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp @@ -0,0 +1,172 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_cw_ppc.hpp - CodeWarrior on PowerPC +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( register long * pw ) +{ + register int a; + + asm + { +loop: + + lwarx a, 0, pw + addi a, a, 1 + stwcx. a, 0, pw + bne- loop + } +} + +inline long atomic_decrement( register long * pw ) +{ + register int a; + + asm + { + sync + +loop: + + lwarx a, 0, pw + addi a, a, -1 + stwcx. a, 0, pw + bne- loop + + isync + } + + return a; +} + +inline long atomic_conditional_increment( register long * pw ) +{ + register int a; + + asm + { +loop: + + lwarx a, 0, pw + cmpwi a, 0 + beq store + + addi a, a, 1 + +store: + + stwcx. a, 0, pw + bne- loop + } + + return a; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp new file mode 100644 index 0000000000..6c3cce8d44 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp @@ -0,0 +1,159 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED + +// +// detail/sp_counted_base_gcc_ia64.hpp - g++ on IA64 +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2006 Peter Dimov +// Copyright 2005 Ben Hutchings +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + int tmp; + + // No barrier is required here but fetchadd always has an acquire or + // release barrier associated with it. We choose release as it should be + // cheaper. + __asm__ ("fetchadd4.rel %0=%1,1" : + "=r"(tmp), "=m"(*pw) : + "m"( *pw )); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int rv; + + __asm__ (" fetchadd4.rel %0=%1,-1 ;; \n" + " cmp.eq p7,p0=1,%0 ;; \n" + "(p7) ld4.acq %0=%1 " : + "=&r"(rv), "=m"(*pw) : + "m"( *pw ) : + "p7"); + + return rv; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int rv, tmp, tmp2; + + __asm__ ("0: ld4 %0=%3 ;; \n" + " cmp.eq p7,p0=0,%0 ;; \n" + "(p7) br.cond.spnt 1f \n" + " mov ar.ccv=%0 \n" + " add %1=1,%0 ;; \n" + " cmpxchg4.acq %2=%3,%1,ar.ccv ;; \n" + " cmp.ne p7,p0=%0,%2 ;; \n" + "(p7) br.cond.spnt 0b \n" + " mov %0=%1 ;; \n" + "1:" : + "=&r"(rv), "=&r"(tmp), "=&r"(tmp2), "=m"(*pw) : + "m"( *pw ) : + "ar.ccv", "p7"); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); // TODO use ld.acq here + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp new file mode 100644 index 0000000000..c3175cf8ed --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp @@ -0,0 +1,189 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_gcc_mips.hpp - g++ on MIPS +// +// Copyright (c) 2009, Spirent Communications, Inc. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + int tmp; + + __asm__ __volatile__ + ( + "0:\n\t" + ".set push\n\t" +#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) + ".set mips2\n\t" +#endif + "ll %0, %1\n\t" + "addiu %0, 1\n\t" + "sc %0, %1\n\t" + ".set pop\n\t" + "beqz %0, 0b": + "=&r"( tmp ), "=m"( *pw ): + "m"( *pw ) + ); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int rv, tmp; + + __asm__ __volatile__ + ( + "0:\n\t" + ".set push\n\t" +#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) + ".set mips2\n\t" +#endif + "ll %1, %2\n\t" + "addiu %0, %1, -1\n\t" + "sc %0, %2\n\t" + ".set pop\n\t" + "beqz %0, 0b\n\t" + "addiu %0, %1, -1": + "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): + "m"( *pw ): + "memory" + ); + + return rv; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int rv, tmp; + + __asm__ __volatile__ + ( + "0:\n\t" + ".set push\n\t" +#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) + ".set mips2\n\t" +#endif + "ll %0, %2\n\t" + "beqz %0, 1f\n\t" + "addiu %1, %0, 1\n\t" + "sc %1, %2\n\t" + ".set pop\n\t" + "beqz %1, 0b\n\t" + "addiu %0, %0, 1\n\t" + "1:": + "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): + "m"( *pw ): + "memory" + ); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp new file mode 100644 index 0000000000..0fb807488a --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp @@ -0,0 +1,183 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_gcc_ppc.hpp - g++ on PowerPC +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + int tmp; + + __asm__ + ( + "0:\n\t" + "lwarx %1, 0, %2\n\t" + "addi %1, %1, 1\n\t" + "stwcx. %1, 0, %2\n\t" + "bne- 0b": + + "=m"( *pw ), "=&b"( tmp ): + "r"( pw ), "m"( *pw ): + "cc" + ); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int rv; + + __asm__ __volatile__ + ( + "sync\n\t" + "0:\n\t" + "lwarx %1, 0, %2\n\t" + "addi %1, %1, -1\n\t" + "stwcx. %1, 0, %2\n\t" + "bne- 0b\n\t" + "isync": + + "=m"( *pw ), "=&b"( rv ): + "r"( pw ), "m"( *pw ): + "memory", "cc" + ); + + return rv; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int rv; + + __asm__ + ( + "0:\n\t" + "lwarx %1, 0, %2\n\t" + "cmpwi %1, 0\n\t" + "beq 1f\n\t" + "addi %1, %1, 1\n\t" + "1:\n\t" + "stwcx. %1, 0, %2\n\t" + "bne- 0b": + + "=m"( *pw ), "=&b"( rv ): + "r"( pw ), "m"( *pw ): + "cc" + ); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp new file mode 100644 index 0000000000..b8bb707f1b --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp @@ -0,0 +1,168 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ +// +// Copyright (c) 2006 Piotr Wyderski +// Copyright (c) 2006 Tomas Puverle +// Copyright (c) 2006 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// Thanks to Michael van der Westhuizen + +#include +#include // int32_t + +namespace boost +{ + +namespace detail +{ + +inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ ) +{ + __asm__ __volatile__( "cas [%1], %2, %0" + : "+r" (swap_) + : "r" (dest_), "r" (compare_) + : "memory" ); + + return swap_; +} + +inline int32_t atomic_fetch_and_add( int32_t * pw, int32_t dv ) +{ + // long r = *pw; + // *pw += dv; + // return r; + + for( ;; ) + { + int32_t r = *pw; + + if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) + { + return r; + } + } +} + +inline void atomic_increment( int32_t * pw ) +{ + atomic_fetch_and_add( pw, 1 ); +} + +inline int32_t atomic_decrement( int32_t * pw ) +{ + return atomic_fetch_and_add( pw, -1 ); +} + +inline int32_t atomic_conditional_increment( int32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + for( ;; ) + { + int32_t r = *pw; + + if( r == 0 ) + { + return r; + } + + if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) + { + return r; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int32_t use_count_; // #shared + int32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return const_cast< int32_t const volatile & >( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp new file mode 100644 index 0000000000..3d2dd61ed6 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp @@ -0,0 +1,175 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_gcc_x86.hpp - g++ on 486+ or AMD64 +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline int atomic_exchange_and_add( int * pw, int dv ) +{ + // int r = *pw; + // *pw += dv; + // return r; + + int r; + + __asm__ __volatile__ + ( + "lock\n\t" + "xadd %1, %0": + "=m"( *pw ), "=r"( r ): // outputs (%0, %1) + "m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1) + "memory", "cc" // clobbers + ); + + return r; +} + +inline void atomic_increment( int * pw ) +{ + //atomic_exchange_and_add( pw, 1 ); + + __asm__ + ( + "lock\n\t" + "incl %0": + "=m"( *pw ): // output (%0) + "m"( *pw ): // input (%1) + "cc" // clobbers + ); +} + +inline int atomic_conditional_increment( int * pw ) +{ + // int rv = *pw; + // if( rv != 0 ) ++*pw; + // return rv; + + int rv, tmp; + + __asm__ + ( + "movl %0, %%eax\n\t" + "0:\n\t" + "test %%eax, %%eax\n\t" + "je 1f\n\t" + "movl %%eax, %2\n\t" + "incl %2\n\t" + "lock\n\t" + "cmpxchgl %2, %0\n\t" + "jne 0b\n\t" + "1:": + "=m"( *pw ), "=&a"( rv ), "=&r"( tmp ): // outputs (%0, %1, %2) + "m"( *pw ): // input (%3) + "cc" // clobbers + ); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp new file mode 100644 index 0000000000..dea905c905 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp @@ -0,0 +1,109 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_nt.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + ++use_count_; + } + + bool add_ref_lock() // true on success + { + if( use_count_ == 0 ) return false; + ++use_count_; + return true; + } + + void release() // nothrow + { + if( --use_count_ == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + ++weak_count_; + } + + void weak_release() // nothrow + { + if( --weak_count_ == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return use_count_; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp new file mode 100644 index 0000000000..85f2563d5d --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp @@ -0,0 +1,138 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_pt.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + + mutable pthread_mutex_t m_; + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { +// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init + +#if defined(__hpux) && defined(_DECTHREADS_) + BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 ); +#else + BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 ); +#endif + } + + virtual ~sp_counted_base() // nothrow + { + BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 ); + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + ++use_count_; + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + } + + bool add_ref_lock() // true on success + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + bool r = use_count_ == 0? false: ( ++use_count_, true ); + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + return r; + } + + void release() // nothrow + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + long new_use_count = --use_count_; + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + + if( new_use_count == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + ++weak_count_; + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + } + + void weak_release() // nothrow + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + long new_weak_count = --weak_count_; + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + + if( new_weak_count == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + long r = use_count_; + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + + return r; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp new file mode 100644 index 0000000000..7b5f9178a6 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp @@ -0,0 +1,163 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ +// +// Copyright (c) 2006 Piotr Wyderski +// Copyright (c) 2006 Tomas Puverle +// Copyright (c) 2006 Peter Dimov +// Copyright (c) 2011 Emil Dotchevski +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// Thanks to Michael van der Westhuizen + +#include +#include // uint32_t + +namespace boost +{ + +namespace detail +{ + +inline uint32_t compare_and_swap( uint32_t * dest_, uint32_t compare_, uint32_t swap_ ) +{ + return __builtin_cellAtomicCompareAndSwap32(dest_,compare_,swap_); +} + +inline uint32_t atomic_fetch_and_add( uint32_t * pw, uint32_t dv ) +{ + // long r = *pw; + // *pw += dv; + // return r; + + for( ;; ) + { + uint32_t r = *pw; + + if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) + { + return r; + } + } +} + +inline void atomic_increment( uint32_t * pw ) +{ + (void) __builtin_cellAtomicIncr32( pw ); +} + +inline uint32_t atomic_decrement( uint32_t * pw ) +{ + return __builtin_cellAtomicDecr32( pw ); +} + +inline uint32_t atomic_conditional_increment( uint32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + for( ;; ) + { + uint32_t r = *pw; + + if( r == 0 ) + { + return r; + } + + if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) + { + return r; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + uint32_t use_count_; // #shared + uint32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return const_cast< uint32_t const volatile & >( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp new file mode 100644 index 0000000000..faf503ad57 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp @@ -0,0 +1,133 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_spin.hpp - spinlock pool atomic emulation +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline int atomic_exchange_and_add( int * pw, int dv ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + + int r = *pw; + *pw += dv; + return r; +} + +inline void atomic_increment( int * pw ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + ++*pw; +} + +inline int atomic_conditional_increment( int * pw ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + + int rv = *pw; + if( rv != 0 ) ++*pw; + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + spinlock_pool<1>::scoped_lock lock( &use_count_ ); + return use_count_; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp new file mode 100644 index 0000000000..9f562b9b4a --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp @@ -0,0 +1,138 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_std_atomic.hpp - C++11 std::atomic +// +// Copyright (c) 2007, 2013 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( std::atomic_int_least32_t * pw ) +{ + pw->fetch_add( 1, std::memory_order_relaxed ); +} + +inline std::int_least32_t atomic_decrement( std::atomic_int_least32_t * pw ) +{ + return pw->fetch_sub( 1, std::memory_order_acq_rel ); +} + +inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + std::int_least32_t r = pw->load( std::memory_order_relaxed ); + + for( ;; ) + { + if( r == 0 ) + { + return r; + } + + if( pw->compare_exchange_weak( r, r + 1, std::memory_order_relaxed, std::memory_order_relaxed ) ) + { + return r; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + std::atomic_int_least32_t use_count_; // #shared + std::atomic_int_least32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return use_count_.load( std::memory_order_acquire ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp new file mode 100644 index 0000000000..d2138e7c26 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp @@ -0,0 +1,157 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_sync.hpp - g++ 4.1+ __sync intrinsics +// +// Copyright (c) 2007 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) +# include +#endif + +namespace boost +{ + +namespace detail +{ + +#if INT_MAX >= 2147483647 + +typedef int sp_int32_t; + +#else + +typedef long sp_int32_t; + +#endif + +inline void atomic_increment( sp_int32_t * pw ) +{ + __sync_fetch_and_add( pw, 1 ); +} + +inline sp_int32_t atomic_decrement( sp_int32_t * pw ) +{ + return __sync_fetch_and_add( pw, -1 ); +} + +inline sp_int32_t atomic_conditional_increment( sp_int32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + sp_int32_t r = *pw; + + for( ;; ) + { + if( r == 0 ) + { + return r; + } + + sp_int32_t r2 = __sync_val_compare_and_swap( pw, r, r + 1 ); + + if( r2 == r ) + { + return r; + } + else + { + r = r2; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + sp_int32_t use_count_; // #shared + sp_int32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return const_cast< sp_int32_t const volatile & >( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp new file mode 100644 index 0000000000..f2de3b02d8 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp @@ -0,0 +1,152 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED + +// +// detail/sp_counted_base_vacpp_ppc.hpp - xlC(vacpp) on POWER +// based on: detail/sp_counted_base_w32.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// Copyright 2006 Michael van der Westhuizen +// Copyright 2012 IBM Corp. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +extern "builtin" void __lwsync(void); +extern "builtin" void __isync(void); +extern "builtin" int __fetch_and_add(volatile int* addr, int val); +extern "builtin" int __compare_and_swap(volatile int*, int*, int); + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int *pw ) +{ + // ++*pw; + __lwsync(); + __fetch_and_add(pw, 1); + __isync(); +} + +inline int atomic_decrement( int *pw ) +{ + // return --*pw; + __lwsync(); + int originalValue = __fetch_and_add(pw, -1); + __isync(); + + return (originalValue - 1); +} + +inline int atomic_conditional_increment( int *pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + __lwsync(); + int v = *const_cast(pw); + for (;;) + // loop until state is known + { + if (v == 0) return 0; + if (__compare_and_swap(pw, &v, v + 1)) + { + __isync(); return (v + 1); + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + char pad[64] __attribute__((__aligned__(64))); + // pad to prevent false sharing +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return *const_cast(&use_count_); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp new file mode 100644 index 0000000000..960e42e128 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp @@ -0,0 +1,132 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_w32.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + BOOST_SP_INTERLOCKED_INCREMENT( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + for( ;; ) + { + long tmp = static_cast< long const volatile& >( use_count_ ); + if( tmp == 0 ) return false; + +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 ) + + // work around a code generation bug + + long tmp2 = tmp + 1; + if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true; + +#else + + if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true; + +#endif + } + } + + void release() // nothrow + { + if( BOOST_SP_INTERLOCKED_DECREMENT( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + BOOST_SP_INTERLOCKED_INCREMENT( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( BOOST_SP_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_impl.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_impl.hpp new file mode 100644 index 0000000000..fa2f75eb1a --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_impl.hpp @@ -0,0 +1,292 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_impl.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR) +# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible. +#endif + +#include +#include +#include + +#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) +#include +#endif + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) +#include // std::allocator +#endif + +#include // std::size_t + +namespace boost +{ + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn ); +void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn ); + +#endif + +namespace detail +{ + +// get_local_deleter + +template class local_sp_deleter; + +template D * get_local_deleter( D * /*p*/ ) +{ + return 0; +} + +template D * get_local_deleter( local_sp_deleter * p ); + +// + +template class sp_counted_impl_p: public sp_counted_base +{ +private: + + X * px_; + + sp_counted_impl_p( sp_counted_impl_p const & ); + sp_counted_impl_p & operator= ( sp_counted_impl_p const & ); + + typedef sp_counted_impl_p this_type; + +public: + + explicit sp_counted_impl_p( X * px ): px_( px ) + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_constructor_hook( px, sizeof(X), this ); +#endif + } + + virtual void dispose() // nothrow + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_destructor_hook( px_, sizeof(X), this ); +#endif + boost::checked_delete( px_ ); + } + + virtual void * get_deleter( sp_typeinfo const & ) + { + return 0; + } + + virtual void * get_local_deleter( sp_typeinfo const & ) + { + return 0; + } + + virtual void * get_untyped_deleter() + { + return 0; + } + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) + + void * operator new( std::size_t ) + { + return std::allocator().allocate( 1, static_cast(0) ); + } + + void operator delete( void * p ) + { + std::allocator().deallocate( static_cast(p), 1 ); + } + +#endif + +#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) + + void * operator new( std::size_t ) + { + return quick_allocator::alloc(); + } + + void operator delete( void * p ) + { + quick_allocator::dealloc( p ); + } + +#endif +}; + +// +// Borland's Codeguard trips up over the -Vx- option here: +// +#ifdef __CODEGUARD__ +# pragma option push -Vx- +#endif + +template class sp_counted_impl_pd: public sp_counted_base +{ +private: + + P ptr; // copy constructor must not throw + D del; // copy constructor must not throw + + sp_counted_impl_pd( sp_counted_impl_pd const & ); + sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & ); + + typedef sp_counted_impl_pd this_type; + +public: + + // pre: d(p) must not throw + + sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d ) + { + } + + sp_counted_impl_pd( P p ): ptr( p ), del() + { + } + + virtual void dispose() // nothrow + { + del( ptr ); + } + + virtual void * get_deleter( sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast( del ): 0; + } + + virtual void * get_local_deleter( sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0; + } + + virtual void * get_untyped_deleter() + { + return &reinterpret_cast( del ); + } + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) + + void * operator new( std::size_t ) + { + return std::allocator().allocate( 1, static_cast(0) ); + } + + void operator delete( void * p ) + { + std::allocator().deallocate( static_cast(p), 1 ); + } + +#endif + +#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) + + void * operator new( std::size_t ) + { + return quick_allocator::alloc(); + } + + void operator delete( void * p ) + { + quick_allocator::dealloc( p ); + } + +#endif +}; + +template class sp_counted_impl_pda: public sp_counted_base +{ +private: + + P p_; // copy constructor must not throw + D d_; // copy constructor must not throw + A a_; // copy constructor must not throw + + sp_counted_impl_pda( sp_counted_impl_pda const & ); + sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & ); + + typedef sp_counted_impl_pda this_type; + +public: + + // pre: d( p ) must not throw + + sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a ) + { + } + + sp_counted_impl_pda( P p, A a ): p_( p ), d_( a ), a_( a ) + { + } + + virtual void dispose() // nothrow + { + d_( p_ ); + } + + virtual void destroy() // nothrow + { +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + typedef typename std::allocator_traits::template rebind_alloc< this_type > A2; + +#else + + typedef typename A::template rebind< this_type >::other A2; + +#endif + + A2 a2( a_ ); + + this->~this_type(); + + a2.deallocate( this, 1 ); + } + + virtual void * get_deleter( sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast( d_ ): 0; + } + + virtual void * get_local_deleter( sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0; + } + + virtual void * get_untyped_deleter() + { + return &reinterpret_cast( d_ ); + } +}; + +#ifdef __CODEGUARD__ +# pragma option pop +#endif + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp new file mode 100644 index 0000000000..f79bdf38a8 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp @@ -0,0 +1,40 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/smart_ptr/detail/sp_disable_deprecated.hpp +// +// Copyright 2015 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined( __GNUC__ ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || ( __cplusplus >= 201103L ) ) + +# if defined( BOOST_GCC ) + +# if BOOST_GCC >= 40600 +# define BOOST_SP_DISABLE_DEPRECATED +# endif + +# elif defined( __clang__ ) && defined( __has_warning ) + +# if __has_warning( "-Wdeprecated-declarations" ) +# define BOOST_SP_DISABLE_DEPRECATED +# endif + +# endif + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_forward.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_forward.hpp new file mode 100644 index 0000000000..8fdec65b7f --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_forward.hpp @@ -0,0 +1,52 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_forward.hpp +// +// Copyright 2008,2012 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include + +namespace boost +{ + +namespace detail +{ + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +#if defined( BOOST_GCC ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404 + +// GCC 4.4 supports an outdated version of rvalue references and creates a copy of the forwarded object. +// This results in warnings 'returning reference to temporary'. Therefore we use a special version similar to std::forward. +template< class T > T&& sp_forward( T && t ) BOOST_NOEXCEPT +{ + return t; +} + +#else + +template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT +{ + return static_cast< T&& >( t ); +} + +#endif + +#endif + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_has_sync.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_has_sync.hpp new file mode 100644 index 0000000000..e1debf0cc9 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_has_sync.hpp @@ -0,0 +1,69 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/smart_ptr/detail/sp_has_sync.hpp +// +// Copyright (c) 2008, 2009 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Defines the BOOST_SP_HAS_SYNC macro if the __sync_* intrinsics +// are available. +// + +#ifndef BOOST_SP_NO_SYNC + +#if !defined( __c2__ ) && defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 ) + +# define BOOST_SP_HAS_SYNC + +#elif defined( __IBMCPP__ ) && ( __IBMCPP__ >= 1210 ) && !defined( __COMPILER_VER__ ) + +# define BOOST_SP_HAS_SYNC + +#elif !defined( __c2__ ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) + +#define BOOST_SP_HAS_SYNC + +#if defined( __arm__ ) || defined( __armel__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __hppa ) || defined( __hppa__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __m68k__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __sh__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __sparc__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1110 ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined(__PATHSCALE__) && ((__PATHCC__ == 4) && (__PATHCC_MINOR__ < 9)) +#undef BOOST_SP_HAS_SYNC +#endif + +#endif + +#endif // #ifndef BOOST_SP_NO_SYNC + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_interlocked.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_interlocked.hpp new file mode 100644 index 0000000000..79cae14a37 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_interlocked.hpp @@ -0,0 +1,163 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/sp_interlocked.hpp +// +// Copyright 2005, 2014 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// + +#include + +// BOOST_SP_HAS_INTRIN_H + +// VC9 has intrin.h, but it collides with +#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1600 + +# define BOOST_SP_HAS_INTRIN_H + +// Unlike __MINGW64__, __MINGW64_VERSION_MAJOR is defined by MinGW-w64 for both 32 and 64-bit targets. +#elif defined( __MINGW64_VERSION_MAJOR ) + +// MinGW-w64 provides intrin.h for both 32 and 64-bit targets. +# define BOOST_SP_HAS_INTRIN_H + +// Intel C++ on Windows on VC10+ stdlib +#elif defined( BOOST_INTEL_WIN ) && defined( _CPPLIB_VER ) && _CPPLIB_VER >= 520 + +# define BOOST_SP_HAS_INTRIN_H + +#endif + +#if defined( BOOST_USE_WINDOWS_H ) + +# include + +# define BOOST_SP_INTERLOCKED_INCREMENT InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd + +#elif defined( BOOST_USE_INTRIN_H ) || defined( BOOST_SP_HAS_INTRIN_H ) + +#include + +# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd + +#elif defined( _WIN32_WCE ) + +#if _WIN32_WCE >= 0x600 + +extern "C" long __cdecl _InterlockedIncrement( long volatile * ); +extern "C" long __cdecl _InterlockedDecrement( long volatile * ); +extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); +extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); + +# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd + +#else + +// under Windows CE we still have old-style Interlocked* functions + +extern "C" long __cdecl InterlockedIncrement( long* ); +extern "C" long __cdecl InterlockedDecrement( long* ); +extern "C" long __cdecl InterlockedCompareExchange( long*, long, long ); +extern "C" long __cdecl InterlockedExchange( long*, long ); +extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); + +# define BOOST_SP_INTERLOCKED_INCREMENT InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd + +#endif + +#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN ) + +#if defined( __CLRCALL_PURE_OR_CDECL ) + +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long ); + +#else + +extern "C" long __cdecl _InterlockedIncrement( long volatile * ); +extern "C" long __cdecl _InterlockedDecrement( long volatile * ); +extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); +extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); + +# if defined( BOOST_MSVC ) && BOOST_MSVC == 1310 +//From MSDN, Visual Studio .NET 2003 spedific: To declare one of the interlocked functions +//for use as an intrinsic, the function must be declared with the leading underscore and +//the new function must appear in a #pragma intrinsic statement. +# pragma intrinsic( _InterlockedIncrement ) +# pragma intrinsic( _InterlockedDecrement ) +# pragma intrinsic( _InterlockedCompareExchange ) +# pragma intrinsic( _InterlockedExchange ) +# pragma intrinsic( _InterlockedExchangeAdd ) +# endif + +#endif + +# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd + +#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) + +namespace boost +{ + +namespace detail +{ + +extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * ); +extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * ); +extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long ); +extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long ); +extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long ); + +} // namespace detail + +} // namespace boost + +# define BOOST_SP_INTERLOCKED_INCREMENT ::boost::detail::InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT ::boost::detail::InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd + +#else + +# error "Interlocked intrinsics not available" + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_noexcept.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_noexcept.hpp new file mode 100644 index 0000000000..1287ba4952 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_noexcept.hpp @@ -0,0 +1,48 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_noexcept.hpp +// +// Copyright 2016, 2017 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include + +// BOOST_SP_NOEXCEPT + +#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1700 && BOOST_MSVC < 1900 + +# define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT_OR_NOTHROW + +#else + +# define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT + +#endif + +// BOOST_SP_NOEXCEPT_WITH_ASSERT + +#if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) ) + +# define BOOST_SP_NOEXCEPT_WITH_ASSERT BOOST_SP_NOEXCEPT + +#elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) ) + +# define BOOST_SP_NOEXCEPT_WITH_ASSERT + +#else + +# define BOOST_SP_NOEXCEPT_WITH_ASSERT BOOST_SP_NOEXCEPT + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_nullptr_t.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_nullptr_t.hpp new file mode 100644 index 0000000000..219ae8070a --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/sp_nullptr_t.hpp @@ -0,0 +1,45 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_nullptr_t.hpp +// +// Copyright 2013 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +namespace boost +{ + +namespace detail +{ + +#if !defined( BOOST_NO_CXX11_DECLTYPE ) && ( ( defined( __clang__ ) && !defined( _LIBCPP_VERSION ) ) || defined( __INTEL_COMPILER ) ) + + typedef decltype(nullptr) sp_nullptr_t; + +#else + + typedef std::nullptr_t sp_nullptr_t; + +#endif + +} // namespace detail + +} // namespace boost + +#endif // !defined( BOOST_NO_CXX11_NULLPTR ) + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock.hpp new file mode 100644 index 0000000000..0b618dfc15 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/spinlock.hpp @@ -0,0 +1,68 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/spinlock.hpp +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// struct spinlock +// { +// void lock(); +// bool try_lock(); +// void unlock(); +// +// class scoped_lock; +// }; +// +// #define BOOST_DETAIL_SPINLOCK_INIT +// + +#include +#include + +#if defined( BOOST_SP_USE_STD_ATOMIC ) +# if !defined( __clang__ ) +# include +# else +// Clang (at least up to 3.4) can't compile spinlock_pool when +// using std::atomic, so substitute the __sync implementation instead. +# include +# endif + +#elif defined( BOOST_SP_USE_PTHREADS ) +# include + +#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) +# include + +#elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) +# include + +#elif defined( BOOST_SP_HAS_SYNC ) +# include + +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# include + +#elif defined(BOOST_HAS_PTHREADS) +# include + +#elif !defined(BOOST_HAS_THREADS) +# include + +#else +# error Unrecognized threading platform +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp new file mode 100644 index 0000000000..24d08a8815 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp @@ -0,0 +1,121 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED + +// +// Copyright (c) 2008, 2011 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7S__) + +# define BOOST_SP_ARM_BARRIER "dmb" +# define BOOST_SP_ARM_HAS_LDREX + +#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) + +# define BOOST_SP_ARM_BARRIER "mcr p15, 0, r0, c7, c10, 5" +# define BOOST_SP_ARM_HAS_LDREX + +#else + +# define BOOST_SP_ARM_BARRIER "" + +#endif + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + int v_; + +public: + + bool try_lock() + { + int r; + +#ifdef BOOST_SP_ARM_HAS_LDREX + + __asm__ __volatile__( + "ldrex %0, [%2]; \n" + "cmp %0, %1; \n" + "strexne %0, %1, [%2]; \n" + BOOST_SP_ARM_BARRIER : + "=&r"( r ): // outputs + "r"( 1 ), "r"( &v_ ): // inputs + "memory", "cc" ); + +#else + + __asm__ __volatile__( + "swp %0, %1, [%2];\n" + BOOST_SP_ARM_BARRIER : + "=&r"( r ): // outputs + "r"( 1 ), "r"( &v_ ): // inputs + "memory", "cc" ); + +#endif + + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" ); + *const_cast< int volatile* >( &v_ ) = 0; + __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#undef BOOST_SP_ARM_BARRIER +#undef BOOST_SP_ARM_HAS_LDREX + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_nt.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_nt.hpp new file mode 100644 index 0000000000..1f399d0dd4 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/spinlock_nt.hpp @@ -0,0 +1,89 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + bool locked_; + +public: + + inline bool try_lock() + { + if( locked_ ) + { + return false; + } + else + { + locked_ = true; + return true; + } + } + + inline void lock() + { + BOOST_ASSERT( !locked_ ); + locked_ = true; + } + + inline void unlock() + { + BOOST_ASSERT( locked_ ); + locked_ = false; + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT { false } + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_pool.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_pool.hpp new file mode 100644 index 0000000000..39cf180b24 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/spinlock_pool.hpp @@ -0,0 +1,91 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/spinlock_pool.hpp +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// spinlock_pool<0> is reserved for atomic<>, when/if it arrives +// spinlock_pool<1> is reserved for shared_ptr reference counts +// spinlock_pool<2> is reserved for shared_ptr atomic access +// + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +template< int M > class spinlock_pool +{ +private: + + static spinlock pool_[ 41 ]; + +public: + + static spinlock & spinlock_for( void const * pv ) + { +#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + std::size_t i = reinterpret_cast< unsigned long long >( pv ) % 41; +#else + std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41; +#endif + return pool_[ i ]; + } + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( void const * pv ): sp_( spinlock_for( pv ) ) + { + sp_.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +template< int M > spinlock spinlock_pool< M >::pool_[ 41 ] = +{ + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT +}; + +} // namespace detail +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_pt.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_pt.hpp new file mode 100644 index 0000000000..f9cabfc3a7 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/spinlock_pt.hpp @@ -0,0 +1,79 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + pthread_mutex_t v_; + +public: + + bool try_lock() + { + return pthread_mutex_trylock( &v_ ) == 0; + } + + void lock() + { + pthread_mutex_lock( &v_ ); + } + + void unlock() + { + pthread_mutex_unlock( &v_ ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT { PTHREAD_MUTEX_INITIALIZER } + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp new file mode 100644 index 0000000000..a61c1cd96d --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp @@ -0,0 +1,83 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2014 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + std::atomic_flag v_; + +public: + + bool try_lock() + { + return !v_.test_and_set( std::memory_order_acquire ); + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + v_ .clear( std::memory_order_release ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT { ATOMIC_FLAG_INIT } + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_sync.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_sync.hpp new file mode 100644 index 0000000000..a7145c5ac2 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/spinlock_sync.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) +# include +#endif + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + int v_; + +public: + + bool try_lock() + { + int r = __sync_lock_test_and_set( &v_, 1 ); + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + __sync_lock_release( &v_ ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_w32.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_w32.hpp new file mode 100644 index 0000000000..d34e4fc2b5 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/spinlock_w32.hpp @@ -0,0 +1,113 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +// BOOST_COMPILER_FENCE + +#if defined(__INTEL_COMPILER) + +#define BOOST_COMPILER_FENCE __memory_barrier(); + +#elif defined( _MSC_VER ) && _MSC_VER >= 1310 + +extern "C" void _ReadWriteBarrier(); +#pragma intrinsic( _ReadWriteBarrier ) + +#define BOOST_COMPILER_FENCE _ReadWriteBarrier(); + +#elif defined(__GNUC__) + +#define BOOST_COMPILER_FENCE __asm__ __volatile__( "" : : : "memory" ); + +#else + +#define BOOST_COMPILER_FENCE + +#endif + +// + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + long v_; + +public: + + bool try_lock() + { + long r = BOOST_SP_INTERLOCKED_EXCHANGE( &v_, 1 ); + + BOOST_COMPILER_FENCE + + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + BOOST_COMPILER_FENCE + *const_cast< long volatile* >( &v_ ) = 0; + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/yield_k.hpp b/libraries/boost/include/boost/smart_ptr/detail/yield_k.hpp new file mode 100644 index 0000000000..f8ca6b6467 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/detail/yield_k.hpp @@ -0,0 +1,177 @@ +#ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// yield_k.hpp +// +// Copyright (c) 2008 Peter Dimov +// Copyright (c) Microsoft Corporation 2014 +// +// void yield( unsigned k ); +// +// Typical use: +// +// for( unsigned k = 0; !try_lock(); ++k ) yield( k ); +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// + +#include +#include + +#if BOOST_PLAT_WINDOWS_RUNTIME +#include +#endif + +// BOOST_SMT_PAUSE + +#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) ) && !defined(__c2__) + +extern "C" void _mm_pause(); + +#define BOOST_SMT_PAUSE _mm_pause(); + +#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) + +#define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" ); + +#endif + +// + +#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) + +#if defined( BOOST_USE_WINDOWS_H ) +# include +#endif + +namespace boost +{ + +namespace detail +{ + +#if !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME +#if !BOOST_COMP_CLANG || !defined __MINGW32__ + extern "C" void __stdcall Sleep( unsigned long ms ); +#else +#include <_mingw.h> +#if !defined __MINGW64_VERSION_MAJOR + extern "C" void __stdcall Sleep( unsigned long ms ); +#else + extern "C" __declspec(dllimport) void __stdcall Sleep( unsigned long ms ); +#endif +#endif +#endif + +inline void yield( unsigned k ) +{ + if( k < 4 ) + { + } +#if defined( BOOST_SMT_PAUSE ) + else if( k < 16 ) + { + BOOST_SMT_PAUSE + } +#endif +#if !BOOST_PLAT_WINDOWS_RUNTIME + else if( k < 32 ) + { + Sleep( 0 ); + } + else + { + Sleep( 1 ); + } +#else + else + { + // Sleep isn't supported on the Windows Runtime. + std::this_thread::yield(); + } +#endif +} + +} // namespace detail + +} // namespace boost + +#elif defined( BOOST_HAS_PTHREADS ) + +#ifndef _AIX +#include +#else + // AIX's sched.h defines ::var which sometimes conflicts with Lambda's var + extern "C" int sched_yield(void); +#endif + +#include + +namespace boost +{ + +namespace detail +{ + +inline void yield( unsigned k ) +{ + if( k < 4 ) + { + } +#if defined( BOOST_SMT_PAUSE ) + else if( k < 16 ) + { + BOOST_SMT_PAUSE + } +#endif + else if( k < 32 || k & 1 ) + { + sched_yield(); + } + else + { + // g++ -Wextra warns on {} or {0} + struct timespec rqtp = { 0, 0 }; + + // POSIX says that timespec has tv_sec and tv_nsec + // But it doesn't guarantee order or placement + + rqtp.tv_sec = 0; + rqtp.tv_nsec = 1000; + + nanosleep( &rqtp, 0 ); + } +} + +} // namespace detail + +} // namespace boost + +#else + +namespace boost +{ + +namespace detail +{ + +inline void yield( unsigned ) +{ +} + +} // namespace detail + +} // namespace boost + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/make_shared.hpp b/libraries/boost/include/boost/smart_ptr/make_shared.hpp new file mode 100644 index 0000000000..dd9191c61d --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/make_shared.hpp @@ -0,0 +1,21 @@ +#ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED +#define BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED + +// make_shared.hpp +// +// Copyright (c) 2007, 2008, 2012 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_SFINAE ) +# include +# include +#endif + +#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/make_shared_array.hpp b/libraries/boost/include/boost/smart_ptr/make_shared_array.hpp new file mode 100644 index 0000000000..2eaf4db71b --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/make_shared_array.hpp @@ -0,0 +1,66 @@ +/* +Copyright 2012-2017 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP +#define BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP + +#include + +namespace boost { + +template +inline typename detail::sp_if_size_array::type +make_shared() +{ + return boost::allocate_shared(std::allocator::type>()); +} + +template +inline typename detail::sp_if_size_array::type +make_shared(const typename detail::sp_array_element::type& value) +{ + return boost::allocate_shared(std::allocator::type>(), value); +} + +template +inline typename detail::sp_if_array::type +make_shared(std::size_t size) +{ + return boost::allocate_shared(std::allocator::type>(), size); +} + +template +inline typename detail::sp_if_array::type +make_shared(std::size_t size, + const typename detail::sp_array_element::type& value) +{ + return boost::allocate_shared(std::allocator::type>(), size, value); +} + +template +inline typename detail::sp_if_size_array::type +make_shared_noinit() +{ + return allocate_shared_noinit(std::allocator::type>()); +} + +template +inline typename detail::sp_if_array::type +make_shared_noinit(std::size_t size) +{ + return allocate_shared_noinit(std::allocator::type>(), size); +} + +} /* boost */ + +#endif diff --git a/libraries/boost/include/boost/smart_ptr/make_shared_object.hpp b/libraries/boost/include/boost/smart_ptr/make_shared_object.hpp new file mode 100644 index 0000000000..c681602dca --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/make_shared_object.hpp @@ -0,0 +1,801 @@ +#ifndef BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED +#define BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED + +// make_shared_object.hpp +// +// Copyright (c) 2007, 2008, 2012 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +template< std::size_t N, std::size_t A > struct sp_aligned_storage +{ + union type + { + char data_[ N ]; + typename boost::type_with_alignment< A >::type align_; + }; +}; + +template< class T > class sp_ms_deleter +{ +private: + + typedef typename sp_aligned_storage< sizeof( T ), ::boost::alignment_of< T >::value >::type storage_type; + + bool initialized_; + storage_type storage_; + +private: + + void destroy() BOOST_SP_NOEXCEPT + { + if( initialized_ ) + { +#if defined( __GNUC__ ) + + // fixes incorrect aliasing warning + T * p = reinterpret_cast< T* >( storage_.data_ ); + p->~T(); + +#else + + reinterpret_cast< T* >( storage_.data_ )->~T(); + +#endif + + initialized_ = false; + } + } + +public: + + sp_ms_deleter() BOOST_SP_NOEXCEPT : initialized_( false ) + { + } + + template explicit sp_ms_deleter( A const & ) BOOST_SP_NOEXCEPT : initialized_( false ) + { + } + + // optimization: do not copy storage_ + sp_ms_deleter( sp_ms_deleter const & ) BOOST_SP_NOEXCEPT : initialized_( false ) + { + } + + ~sp_ms_deleter() BOOST_SP_NOEXCEPT + { + destroy(); + } + + void operator()( T * ) BOOST_SP_NOEXCEPT + { + destroy(); + } + + static void operator_fn( T* ) BOOST_SP_NOEXCEPT // operator() can't be static + { + } + + void * address() BOOST_SP_NOEXCEPT + { + return storage_.data_; + } + + void set_initialized() BOOST_SP_NOEXCEPT + { + initialized_ = true; + } +}; + +template< class T, class A > class sp_as_deleter +{ +private: + + typedef typename sp_aligned_storage< sizeof( T ), ::boost::alignment_of< T >::value >::type storage_type; + + storage_type storage_; + A a_; + bool initialized_; + +private: + + void destroy() BOOST_SP_NOEXCEPT + { + if( initialized_ ) + { + T * p = reinterpret_cast< T* >( storage_.data_ ); + +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + std::allocator_traits::destroy( a_, p ); + +#else + + p->~T(); + +#endif + + initialized_ = false; + } + } + +public: + + sp_as_deleter( A const & a ) BOOST_SP_NOEXCEPT : a_( a ), initialized_( false ) + { + } + + // optimization: do not copy storage_ + sp_as_deleter( sp_as_deleter const & r ) BOOST_SP_NOEXCEPT : a_( r.a_), initialized_( false ) + { + } + + ~sp_as_deleter() BOOST_SP_NOEXCEPT + { + destroy(); + } + + void operator()( T * ) BOOST_SP_NOEXCEPT + { + destroy(); + } + + static void operator_fn( T* ) BOOST_SP_NOEXCEPT // operator() can't be static + { + } + + void * address() BOOST_SP_NOEXCEPT + { + return storage_.data_; + } + + void set_initialized() BOOST_SP_NOEXCEPT + { + initialized_ = true; + } +}; + +template< class T > struct sp_if_not_array +{ + typedef boost::shared_ptr< T > type; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T > struct sp_if_not_array< T[] > +{ +}; + +#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) + +template< class T, std::size_t N > struct sp_if_not_array< T[N] > +{ +}; + +#endif + +#endif + +} // namespace detail + +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) +# define BOOST_SP_MSD( T ) boost::detail::sp_inplace_tag< boost::detail::sp_ms_deleter< T > >() +#else +# define BOOST_SP_MSD( T ) boost::detail::sp_ms_deleter< T >() +#endif + +// _noinit versions + +template< class T > typename boost::detail::sp_if_not_array< T >::type make_shared_noinit() +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T; + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A > typename boost::detail::sp_if_not_array< T >::type allocate_shared_noinit( A const & a ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T; + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +#if !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +// Variadic templates, rvalue reference + +template< class T, class... Args > typename boost::detail::sp_if_not_array< T >::type make_shared( Args && ... args ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( boost::detail::sp_forward( args )... ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class... Args > typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, Args && ... args ) +{ +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + typedef typename std::allocator_traits::template rebind_alloc A2; + A2 a2( a ); + + typedef boost::detail::sp_as_deleter< T, A2 > D; + + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a2 ); + +#else + + typedef boost::detail::sp_ms_deleter< T > D; + + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a ); + +#endif + + D * pd = static_cast< D* >( pt._internal_get_untyped_deleter() ); + void * pv = pd->address(); + +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + std::allocator_traits::construct( a2, static_cast< T* >( pv ), boost::detail::sp_forward( args )... ); + +#else + + ::new( pv ) T( boost::detail::sp_forward( args )... ); + +#endif + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +#else // !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +// Common zero-argument versions + +template< class T > typename boost::detail::sp_if_not_array< T >::type make_shared() +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T(); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A > typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T(); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +// C++03 version + +template< class T, class A1 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ), + boost::forward( a8 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ), + boost::forward( a8 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8, BOOST_FWD_REF(A9) a9 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ), + boost::forward( a8 ), + boost::forward( a9 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8, BOOST_FWD_REF(A9) a9 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ), + boost::forward( a8 ), + boost::forward( a9 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +#endif // !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +#undef BOOST_SP_MSD + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/scoped_array.hpp b/libraries/boost/include/boost/smart_ptr/scoped_array.hpp new file mode 100644 index 0000000000..05dd05aea8 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/scoped_array.hpp @@ -0,0 +1,132 @@ +#ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED +#define BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include +#include +#include +#include +#include + +#include + +#include // for std::ptrdiff_t + +namespace boost +{ + +// Debug hooks + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +void sp_array_constructor_hook(void * p); +void sp_array_destructor_hook(void * p); + +#endif + +// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to +// is guaranteed, either on destruction of the scoped_array or via an explicit +// reset(). Use shared_array or std::vector if your needs are more complex. + +template class scoped_array // noncopyable +{ +private: + + T * px; + + scoped_array(scoped_array const &); + scoped_array & operator=(scoped_array const &); + + typedef scoped_array this_type; + + void operator==( scoped_array const& ) const; + void operator!=( scoped_array const& ) const; + +public: + + typedef T element_type; + + explicit scoped_array( T * p = 0 ) BOOST_SP_NOEXCEPT : px( p ) + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_array_constructor_hook( px ); +#endif + } + + ~scoped_array() BOOST_SP_NOEXCEPT + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_array_destructor_hook( px ); +#endif + boost::checked_array_delete( px ); + } + + void reset(T * p = 0) BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors + this_type(p).swap(*this); + } + + T & operator[](std::ptrdiff_t i) const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + BOOST_ASSERT( i >= 0 ); + return px[i]; + } + + T * get() const BOOST_SP_NOEXCEPT + { + return px; + } + +// implicit conversion to "bool" +#include + + void swap(scoped_array & b) BOOST_SP_NOEXCEPT + { + T * tmp = b.px; + b.px = px; + px = tmp; + } +}; + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +template inline bool operator==( scoped_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator==( boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator!=( scoped_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +template inline bool operator!=( boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +#endif + +template inline void swap(scoped_array & a, scoped_array & b) BOOST_SP_NOEXCEPT +{ + a.swap(b); +} + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/scoped_ptr.hpp b/libraries/boost/include/boost/smart_ptr/scoped_ptr.hpp new file mode 100644 index 0000000000..5325eba5ff --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/scoped_ptr.hpp @@ -0,0 +1,167 @@ +#ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_NO_AUTO_PTR +# include // for std::auto_ptr +#endif + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +namespace boost +{ + +// Debug hooks + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +void sp_scalar_constructor_hook(void * p); +void sp_scalar_destructor_hook(void * p); + +#endif + +// scoped_ptr mimics a built-in pointer except that it guarantees deletion +// of the object pointed to, either on destruction of the scoped_ptr or via +// an explicit reset(). scoped_ptr is a simple solution for simple needs; +// use shared_ptr or std::auto_ptr if your needs are more complex. + +template class scoped_ptr // noncopyable +{ +private: + + T * px; + + scoped_ptr(scoped_ptr const &); + scoped_ptr & operator=(scoped_ptr const &); + + typedef scoped_ptr this_type; + + void operator==( scoped_ptr const& ) const; + void operator!=( scoped_ptr const& ) const; + +public: + + typedef T element_type; + + explicit scoped_ptr( T * p = 0 ) BOOST_SP_NOEXCEPT : px( p ) + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_constructor_hook( px ); +#endif + } + +#ifndef BOOST_NO_AUTO_PTR + + explicit scoped_ptr( std::auto_ptr p ) BOOST_SP_NOEXCEPT : px( p.release() ) + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_constructor_hook( px ); +#endif + } + +#endif + + ~scoped_ptr() BOOST_SP_NOEXCEPT + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_destructor_hook( px ); +#endif + boost::checked_delete( px ); + } + + void reset(T * p = 0) BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors + this_type(p).swap(*this); + } + + T & operator*() const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + return *px; + } + + T * operator->() const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + return px; + } + + T * get() const BOOST_SP_NOEXCEPT + { + return px; + } + +// implicit conversion to "bool" +#include + + void swap(scoped_ptr & b) BOOST_SP_NOEXCEPT + { + T * tmp = b.px; + b.px = px; + px = tmp; + } +}; + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +template inline bool operator==( scoped_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator==( boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator!=( scoped_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +template inline bool operator!=( boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +#endif + +template inline void swap(scoped_ptr & a, scoped_ptr & b) BOOST_SP_NOEXCEPT +{ + a.swap(b); +} + +// get_pointer(p) is a generic way to say p.get() + +template inline T * get_pointer(scoped_ptr const & p) BOOST_SP_NOEXCEPT +{ + return p.get(); +} + +} // namespace boost + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic pop +#endif + +#endif // #ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/shared_ptr.hpp b/libraries/boost/include/boost/smart_ptr/shared_ptr.hpp new file mode 100644 index 0000000000..4ac0699ef6 --- /dev/null +++ b/libraries/boost/include/boost/smart_ptr/shared_ptr.hpp @@ -0,0 +1,1184 @@ +#ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED + +// +// shared_ptr.hpp +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001-2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include // for broken compiler workarounds + +// In order to avoid circular dependencies with Boost.TR1 +// we make sure that our include of doesn't try to +// pull in the TR1 headers: that's why we use this header +// rather than including directly: +#include // std::auto_ptr + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) +#include +#endif + +#include // for std::swap +#include // for std::less +#include // for std::bad_cast +#include // for std::size_t + +#if !defined(BOOST_NO_IOSTREAM) +#if !defined(BOOST_NO_IOSFWD) +#include // for std::basic_ostream +#else +#include +#endif +#endif + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +namespace boost +{ + +template class shared_ptr; +template class weak_ptr; +template class enable_shared_from_this; +class enable_shared_from_raw; + +namespace movelib +{ + + template< class T, class D > class unique_ptr; + +} // namespace movelib + +namespace detail +{ + +// sp_element, element_type + +template< class T > struct sp_element +{ + typedef T type; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T > struct sp_element< T[] > +{ + typedef T type; +}; + +#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) + +template< class T, std::size_t N > struct sp_element< T[N] > +{ + typedef T type; +}; + +#endif + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// sp_dereference, return type of operator* + +template< class T > struct sp_dereference +{ + typedef T & type; +}; + +template<> struct sp_dereference< void > +{ + typedef void type; +}; + +#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) + +template<> struct sp_dereference< void const > +{ + typedef void type; +}; + +template<> struct sp_dereference< void volatile > +{ + typedef void type; +}; + +template<> struct sp_dereference< void const volatile > +{ + typedef void type; +}; + +#endif // !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T > struct sp_dereference< T[] > +{ + typedef void type; +}; + +#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) + +template< class T, std::size_t N > struct sp_dereference< T[N] > +{ + typedef void type; +}; + +#endif + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// sp_member_access, return type of operator-> + +template< class T > struct sp_member_access +{ + typedef T * type; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T > struct sp_member_access< T[] > +{ + typedef void type; +}; + +#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) + +template< class T, std::size_t N > struct sp_member_access< T[N] > +{ + typedef void type; +}; + +#endif + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// sp_array_access, return type of operator[] + +template< class T > struct sp_array_access +{ + typedef void type; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T > struct sp_array_access< T[] > +{ + typedef T & type; +}; + +#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) + +template< class T, std::size_t N > struct sp_array_access< T[N] > +{ + typedef T & type; +}; + +#endif + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// sp_extent, for operator[] index check + +template< class T > struct sp_extent +{ + enum _vt { value = 0 }; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T, std::size_t N > struct sp_extent< T[N] > +{ + enum _vt { value = N }; +}; + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// enable_shared_from_this support + +template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr const * ppx, Y const * py, boost::enable_shared_from_this< T > const * pe ) +{ + if( pe != 0 ) + { + pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) ); + } +} + +template< class X, class Y > inline void sp_enable_shared_from_this( boost::shared_ptr * ppx, Y const * py, boost::enable_shared_from_raw const * pe ); + +#ifdef _MANAGED + +// Avoid C4793, ... causes native code generation + +struct sp_any_pointer +{ + template sp_any_pointer( T* ) {} +}; + +inline void sp_enable_shared_from_this( sp_any_pointer, sp_any_pointer, sp_any_pointer ) +{ +} + +#else // _MANAGED + +inline void sp_enable_shared_from_this( ... ) +{ +} + +#endif // _MANAGED + +#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_AUTO_PTR ) + +// rvalue auto_ptr support based on a technique by Dave Abrahams + +template< class T, class R > struct sp_enable_if_auto_ptr +{ +}; + +template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R > +{ + typedef R type; +}; + +#endif + +// sp_assert_convertible + +template< class Y, class T > inline void sp_assert_convertible() BOOST_SP_NOEXCEPT +{ +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + // static_assert( sp_convertible< Y, T >::value ); + typedef char tmp[ sp_convertible< Y, T >::value? 1: -1 ]; + (void)sizeof( tmp ); + +#else + + T* p = static_cast< Y* >( 0 ); + (void)p; + +#endif +} + +// pointer constructor helper + +template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T > * ppx, Y * p, boost::detail::shared_count & pn ) +{ + boost::detail::shared_count( p ).swap( pn ); + boost::detail::sp_enable_shared_from_this( ppx, p, p ); +} + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * p, boost::detail::shared_count & pn ) +{ + sp_assert_convertible< Y[], T[] >(); + boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn ); +} + +template< class T, std::size_t N, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * p, boost::detail::shared_count & pn ) +{ + sp_assert_convertible< Y[N], T[N] >(); + boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn ); +} + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// deleter constructor helper + +template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T > * ppx, Y * p ) +{ + boost::detail::sp_enable_shared_from_this( ppx, p, p ); +} + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * /*p*/ ) +{ + sp_assert_convertible< Y[], T[] >(); +} + +template< class T, std::size_t N, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * /*p*/ ) +{ + sp_assert_convertible< Y[N], T[N] >(); +} + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +struct sp_internal_constructor_tag +{ +}; + +} // namespace detail + + +// +// shared_ptr +// +// An enhanced relative of scoped_ptr with reference counted copy semantics. +// The object pointed to is deleted when the last shared_ptr pointing to it +// is destroyed or reset. +// + +template class shared_ptr +{ +private: + + // Borland 5.5.1 specific workaround + typedef shared_ptr this_type; + +public: + + typedef typename boost::detail::sp_element< T >::type element_type; + + BOOST_CONSTEXPR shared_ptr() BOOST_SP_NOEXCEPT : px( 0 ), pn() + { + } + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + + BOOST_CONSTEXPR shared_ptr( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn() + { + } + +#endif + + BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count const & pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( pn_ ) + { + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count && pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( std::move( pn_ ) ) + { + } + +#endif + + template + explicit shared_ptr( Y * p ): px( p ), pn() // Y must be complete + { + boost::detail::sp_pointer_construct( this, p, pn ); + } + + // + // Requirements: D's copy constructor must not throw + // + // shared_ptr will release p by calling d(p) + // + + template shared_ptr( Y * p, D d ): px( p ), pn( p, d ) + { + boost::detail::sp_deleter_construct( this, p ); + } + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + + template shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d ) + { + } + +#endif + + // As above, but with allocator. A's copy constructor shall not throw. + + template shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a ) + { + boost::detail::sp_deleter_construct( this, p ); + } + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + + template shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a ) + { + } + +#endif + +// generated copy constructor, destructor are fine... + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +// ... except in C++0x, move disables the implicit copy + + shared_ptr( shared_ptr const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) + { + } + +#endif + + template + explicit shared_ptr( weak_ptr const & r ): pn( r.pn ) // may throw + { + boost::detail::sp_assert_convertible< Y, T >(); + + // it is now safe to copy r.px, as pn(r.pn) did not throw + px = r.px; + } + + template + shared_ptr( weak_ptr const & r, boost::detail::sp_nothrow_tag ) + BOOST_SP_NOEXCEPT : px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) + { + if( !pn.empty() ) + { + px = r.px; + } + } + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + shared_ptr( shared_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) + +#else + + shared_ptr( shared_ptr const & r ) + +#endif + BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) + { + boost::detail::sp_assert_convertible< Y, T >(); + } + + // aliasing + template< class Y > + shared_ptr( shared_ptr const & r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn( r.pn ) + { + } + +#ifndef BOOST_NO_AUTO_PTR + + template + explicit shared_ptr( std::auto_ptr & r ): px(r.get()), pn() + { + boost::detail::sp_assert_convertible< Y, T >(); + + Y * tmp = r.get(); + pn = boost::detail::shared_count( r ); + + boost::detail::sp_deleter_construct( this, tmp ); + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template + shared_ptr( std::auto_ptr && r ): px(r.get()), pn() + { + boost::detail::sp_assert_convertible< Y, T >(); + + Y * tmp = r.get(); + pn = boost::detail::shared_count( r ); + + boost::detail::sp_deleter_construct( this, tmp ); + } + +#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + + template + explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr::type = 0 ): px( r.get() ), pn() + { + typedef typename Ap::element_type Y; + + boost::detail::sp_assert_convertible< Y, T >(); + + Y * tmp = r.get(); + pn = boost::detail::shared_count( r ); + + boost::detail::sp_deleter_construct( this, tmp ); + } + +#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif // BOOST_NO_AUTO_PTR + +#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template< class Y, class D > + shared_ptr( std::unique_ptr< Y, D > && r ): px( r.get() ), pn() + { + boost::detail::sp_assert_convertible< Y, T >(); + + typename std::unique_ptr< Y, D >::pointer tmp = r.get(); + + if( tmp != 0 ) + { + pn = boost::detail::shared_count( r ); + boost::detail::sp_deleter_construct( this, tmp ); + } + } + +#endif + + template< class Y, class D > + shared_ptr( boost::movelib::unique_ptr< Y, D > r ): px( r.get() ), pn() + { + boost::detail::sp_assert_convertible< Y, T >(); + + typename boost::movelib::unique_ptr< Y, D >::pointer tmp = r.get(); + + if( tmp != 0 ) + { + pn = boost::detail::shared_count( r ); + boost::detail::sp_deleter_construct( this, tmp ); + } + } + + // assignment + + shared_ptr & operator=( shared_ptr const & r ) BOOST_SP_NOEXCEPT + { + this_type(r).swap(*this); + return *this; + } + +#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400) + + template + shared_ptr & operator=(shared_ptr const & r) BOOST_SP_NOEXCEPT + { + this_type(r).swap(*this); + return *this; + } + +#endif + +#ifndef BOOST_NO_AUTO_PTR + + template + shared_ptr & operator=( std::auto_ptr & r ) + { + this_type( r ).swap( *this ); + return *this; + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template + shared_ptr & operator=( std::auto_ptr && r ) + { + this_type( static_cast< std::auto_ptr && >( r ) ).swap( *this ); + return *this; + } + +#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + + template + typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r ) + { + this_type( r ).swap( *this ); + return *this; + } + +#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif // BOOST_NO_AUTO_PTR + +#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template + shared_ptr & operator=( std::unique_ptr && r ) + { + this_type( static_cast< std::unique_ptr && >( r ) ).swap(*this); + return *this; + } + +#endif + + template + shared_ptr & operator=( boost::movelib::unique_ptr r ) + { + // this_type( static_cast< unique_ptr && >( r ) ).swap( *this ); + + boost::detail::sp_assert_convertible< Y, T >(); + + typename boost::movelib::unique_ptr< Y, D >::pointer p = r.get(); + + shared_ptr tmp; + + if( p != 0 ) + { + tmp.px = p; + tmp.pn = boost::detail::shared_count( r ); + + boost::detail::sp_deleter_construct( &tmp, p ); + } + + tmp.swap( *this ); + + return *this; + } + +// Move support + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + shared_ptr( shared_ptr && r ) BOOST_SP_NOEXCEPT : px( r.px ), pn() + { + pn.swap( r.pn ); + r.px = 0; + } + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + shared_ptr( shared_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) + +#else + + shared_ptr( shared_ptr && r ) + +#endif + BOOST_SP_NOEXCEPT : px( r.px ), pn() + { + boost::detail::sp_assert_convertible< Y, T >(); + + pn.swap( r.pn ); + r.px = 0; + } + + shared_ptr & operator=( shared_ptr && r ) BOOST_SP_NOEXCEPT + { + this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); + return *this; + } + + template + shared_ptr & operator=( shared_ptr && r ) BOOST_SP_NOEXCEPT + { + this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); + return *this; + } + + // aliasing move + template + shared_ptr( shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn() + { + pn.swap( r.pn ); + r.px = 0; + } + +#endif + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + + shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT + { + this_type().swap(*this); + return *this; + } + +#endif + + void reset() BOOST_SP_NOEXCEPT + { + this_type().swap(*this); + } + + template void reset( Y * p ) // Y must be complete + { + BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors + this_type( p ).swap( *this ); + } + + template void reset( Y * p, D d ) + { + this_type( p, d ).swap( *this ); + } + + template void reset( Y * p, D d, A a ) + { + this_type( p, d, a ).swap( *this ); + } + + template void reset( shared_ptr const & r, element_type * p ) BOOST_SP_NOEXCEPT + { + this_type( r, p ).swap( *this ); + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template void reset( shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT + { + this_type( static_cast< shared_ptr && >( r ), p ).swap( *this ); + } + +#endif + + typename boost::detail::sp_dereference< T >::type operator* () const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + return *px; + } + + typename boost::detail::sp_member_access< T >::type operator-> () const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + return px; + } + + typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) ); + + return static_cast< typename boost::detail::sp_array_access< T >::type >( px[ i ] ); + } + + element_type * get() const BOOST_SP_NOEXCEPT + { + return px; + } + +// implicit conversion to "bool" +#include + + bool unique() const BOOST_SP_NOEXCEPT + { + return pn.unique(); + } + + long use_count() const BOOST_SP_NOEXCEPT + { + return pn.use_count(); + } + + void swap( shared_ptr & other ) BOOST_SP_NOEXCEPT + { + std::swap(px, other.px); + pn.swap(other.pn); + } + + template bool owner_before( shared_ptr const & rhs ) const BOOST_SP_NOEXCEPT + { + return pn < rhs.pn; + } + + template bool owner_before( weak_ptr const & rhs ) const BOOST_SP_NOEXCEPT + { + return pn < rhs.pn; + } + + void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + { + return pn.get_deleter( ti ); + } + + void * _internal_get_local_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + { + return pn.get_local_deleter( ti ); + } + + void * _internal_get_untyped_deleter() const BOOST_SP_NOEXCEPT + { + return pn.get_untyped_deleter(); + } + + bool _internal_equiv( shared_ptr const & r ) const BOOST_SP_NOEXCEPT + { + return px == r.px && pn == r.pn; + } + + boost::detail::shared_count _internal_count() const BOOST_NOEXCEPT + { + return pn; + } + +// Tasteless as this may seem, making all members public allows member templates +// to work in the absence of member template friends. (Matthew Langston) + +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + +private: + + template friend class shared_ptr; + template friend class weak_ptr; + + +#endif + + element_type * px; // contained pointer + boost::detail::shared_count pn; // reference counter + +}; // shared_ptr + +template inline bool operator==(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.get() == b.get(); +} + +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.get() != b.get(); +} + +#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 + +// Resolve the ambiguity between our op!= and the one in rel_ops + +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.get() != b.get(); +} + +#endif + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +template inline bool operator==( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator==( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator!=( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +template inline bool operator!=( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +#endif + +template inline bool operator<(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.owner_before( b ); +} + +template inline void swap(shared_ptr & a, shared_ptr & b) BOOST_SP_NOEXCEPT +{ + a.swap(b); +} + +template shared_ptr static_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT +{ + (void) static_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = static_cast< E* >( r.get() ); + return shared_ptr( r, p ); +} + +template shared_ptr const_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT +{ + (void) const_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = const_cast< E* >( r.get() ); + return shared_ptr( r, p ); +} + +template shared_ptr dynamic_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT +{ + (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = dynamic_cast< E* >( r.get() ); + return p? shared_ptr( r, p ): shared_ptr(); +} + +template shared_ptr reinterpret_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT +{ + (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = reinterpret_cast< E* >( r.get() ); + return shared_ptr( r, p ); +} + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +template shared_ptr static_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT +{ + (void) static_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = static_cast< E* >( r.get() ); + return shared_ptr( std::move(r), p ); +} + +template shared_ptr const_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT +{ + (void) const_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = const_cast< E* >( r.get() ); + return shared_ptr( std::move(r), p ); +} + +template shared_ptr dynamic_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT +{ + (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = dynamic_cast< E* >( r.get() ); + return p? shared_ptr( std::move(r), p ): shared_ptr(); +} + +template shared_ptr reinterpret_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT +{ + (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = reinterpret_cast< E* >( r.get() ); + return shared_ptr( std::move(r), p ); +} + +#endif // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +// get_pointer() enables boost::mem_fn to recognize shared_ptr + +template inline typename shared_ptr::element_type * get_pointer(shared_ptr const & p) BOOST_SP_NOEXCEPT +{ + return p.get(); +} + +// operator<< + +#if !defined(BOOST_NO_IOSTREAM) + +#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) ) + +template std::ostream & operator<< (std::ostream & os, shared_ptr const & p) +{ + os << p.get(); + return os; +} + +#else + +// in STLport's no-iostreams mode no iostream symbols can be used +#ifndef _STLP_NO_IOSTREAMS + +# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) +// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL +using std::basic_ostream; +template basic_ostream & operator<< (basic_ostream & os, shared_ptr const & p) +# else +template std::basic_ostream & operator<< (std::basic_ostream & os, shared_ptr const & p) +# endif +{ + os << p.get(); + return os; +} + +#endif // _STLP_NO_IOSTREAMS + +#endif // __GNUC__ < 3 + +#endif // !defined(BOOST_NO_IOSTREAM) + +// get_deleter + +namespace detail +{ + +template D * basic_get_deleter( shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return static_cast( p._internal_get_deleter(BOOST_SP_TYPEID(D)) ); +} + +template D * basic_get_local_deleter( D *, shared_ptr const & p ) BOOST_SP_NOEXCEPT; +template D const * basic_get_local_deleter( D const *, shared_ptr const & p ) BOOST_SP_NOEXCEPT; + +class esft2_deleter_wrapper +{ +private: + + shared_ptr deleter_; + +public: + + esft2_deleter_wrapper() + { + } + + template< class T > void set_deleter( shared_ptr const & deleter ) BOOST_SP_NOEXCEPT + { + deleter_ = deleter; + } + + template D* get_deleter() const BOOST_SP_NOEXCEPT + { + return boost::detail::basic_get_deleter( deleter_ ); + } + + template< class T> void operator()( T* ) BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( deleter_.use_count() <= 1 ); + deleter_.reset(); + } +}; + +} // namespace detail + +template D * get_deleter( shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + D * d = boost::detail::basic_get_deleter( p ); + + if( d == 0 ) + { + d = boost::detail::basic_get_local_deleter( d, p ); + } + + if( d == 0 ) + { + boost::detail::esft2_deleter_wrapper *del_wrapper = boost::detail::basic_get_deleter(p); +// The following get_deleter method call is fully qualified because +// older versions of gcc (2.95, 3.2.3) fail to compile it when written del_wrapper->get_deleter() + if(del_wrapper) d = del_wrapper->::boost::detail::esft2_deleter_wrapper::get_deleter(); + } + + return d; +} + +// atomic access + +#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) + +template inline bool atomic_is_lock_free( shared_ptr const * /*p*/ ) BOOST_SP_NOEXCEPT +{ + return false; +} + +template shared_ptr atomic_load( shared_ptr const * p ) BOOST_SP_NOEXCEPT +{ + boost::detail::spinlock_pool<2>::scoped_lock lock( p ); + return *p; +} + +template inline shared_ptr atomic_load_explicit( shared_ptr const * p, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT +{ + return atomic_load( p ); +} + +template void atomic_store( shared_ptr * p, shared_ptr r ) BOOST_SP_NOEXCEPT +{ + boost::detail::spinlock_pool<2>::scoped_lock lock( p ); + p->swap( r ); +} + +template inline void atomic_store_explicit( shared_ptr * p, shared_ptr r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT +{ + atomic_store( p, r ); // std::move( r ) +} + +template shared_ptr atomic_exchange( shared_ptr * p, shared_ptr r ) BOOST_SP_NOEXCEPT +{ + boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); + + sp.lock(); + p->swap( r ); + sp.unlock(); + + return r; // return std::move( r ) +} + +template shared_ptr inline atomic_exchange_explicit( shared_ptr * p, shared_ptr r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT +{ + return atomic_exchange( p, r ); // std::move( r ) +} + +template bool atomic_compare_exchange( shared_ptr * p, shared_ptr * v, shared_ptr w ) BOOST_SP_NOEXCEPT +{ + boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); + + sp.lock(); + + if( p->_internal_equiv( *v ) ) + { + p->swap( w ); + + sp.unlock(); + + return true; + } + else + { + shared_ptr tmp( *p ); + + sp.unlock(); + + tmp.swap( *v ); + return false; + } +} + +template inline bool atomic_compare_exchange_explicit( shared_ptr * p, shared_ptr * v, shared_ptr w, /*memory_order success*/ M, /*memory_order failure*/ M ) BOOST_SP_NOEXCEPT +{ + return atomic_compare_exchange( p, v, w ); // std::move( w ) +} + +#endif // !defined(BOOST_SP_NO_ATOMIC_ACCESS) + +// hash_value + +template< class T > struct hash; + +template< class T > std::size_t hash_value( boost::shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return boost::hash< typename boost::shared_ptr::element_type* >()( p.get() ); +} + +} // namespace boost + +#include + +namespace boost +{ + +namespace detail +{ + +template D * basic_get_local_deleter( D *, shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return static_cast( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter) ) ); +} + +template D const * basic_get_local_deleter( D const *, shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return static_cast( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter) ) ); +} + +} // namespace detail + +} // namespace boost + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic pop +#endif + +#endif // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/swap.hpp b/libraries/boost/include/boost/swap.hpp new file mode 100644 index 0000000000..55cafa4fdd --- /dev/null +++ b/libraries/boost/include/boost/swap.hpp @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2014 Glen Fernandes + * + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_SWAP_HPP +#define BOOST_SWAP_HPP + +// The header file at this path is deprecated; +// use boost/core/swap.hpp instead. + +#include + +#endif diff --git a/libraries/boost/include/boost/test/auto_unit_test.hpp b/libraries/boost/include/boost/test/auto_unit_test.hpp new file mode 100644 index 0000000000..99acd162ab --- /dev/null +++ b/libraries/boost/include/boost/test/auto_unit_test.hpp @@ -0,0 +1,18 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! @brief Deprecated header. +//! @deprecated Use @c boost/test/unit_test.hpp instead. +// *************************************************************************** + +#ifndef BOOST_TEST_AUTO_UNIT_TEST_HPP_071894GER +#define BOOST_TEST_AUTO_UNIT_TEST_HPP_071894GER + +#include + +#endif // BOOST_TEST_AUTO_UNIT_TEST_HPP_071894GER diff --git a/libraries/boost/include/boost/test/data/config.hpp b/libraries/boost/include/boost/test/data/config.hpp new file mode 100644 index 0000000000..7a9d03be98 --- /dev/null +++ b/libraries/boost/include/boost/test/data/config.hpp @@ -0,0 +1,45 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief common dataset macros +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_CONFIG_HPP_112611GER +#define BOOST_TEST_DATA_CONFIG_HPP_112611GER + +// Boost.Test +#include +#include + +// STL +#include // for std::logic_error + +// availability on features: preprocessed by doxygen + +#if defined(BOOST_NO_CXX11_HDR_RANDOM) || defined(BOOST_TEST_DOXYGEN_DOC__) +//! Defined when the random dataset feature is not available +#define BOOST_TEST_NO_RANDOM_DATASET_AVAILABLE + +#endif + +#if defined(BOOST_NO_CXX11_HDR_TUPLE) || defined(BOOST_TEST_DOXYGEN_DOC__) + +//! Defined when grid composition of datasets is not available +#define BOOST_TEST_NO_GRID_COMPOSITION_AVAILABLE + +//! Defined when zip composition of datasets is not available +#define BOOST_TEST_NO_ZIP_COMPOSITION_AVAILABLE + +#endif + +//____________________________________________________________________________// + +#define BOOST_TEST_DS_ERROR( msg ) BOOST_TEST_I_THROW( std::logic_error( msg ) ) +#define BOOST_TEST_DS_ASSERT( cond, msg ) BOOST_TEST_I_ASSRT( cond, std::logic_error( msg ) ) + +#endif // BOOST_TEST_DATA_CONFIG_HPP_112611GER diff --git a/libraries/boost/include/boost/test/data/dataset.hpp b/libraries/boost/include/boost/test/data/dataset.hpp new file mode 100644 index 0000000000..3f576ab357 --- /dev/null +++ b/libraries/boost/include/boost/test/data/dataset.hpp @@ -0,0 +1,19 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief dataset interfaces +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_DATASET_HPP_102211GER +#define BOOST_TEST_DATA_DATASET_HPP_102211GER + +// Boost.Test +#include + +#endif // BOOST_TEST_DATA_DATASET_HPP_102211GER + diff --git a/libraries/boost/include/boost/test/data/for_each_sample.hpp b/libraries/boost/include/boost/test/data/for_each_sample.hpp new file mode 100644 index 0000000000..4785b038cc --- /dev/null +++ b/libraries/boost/include/boost/test/data/for_each_sample.hpp @@ -0,0 +1,117 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Defines for_each_sample algorithm +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_FOR_EACH_SAMPLE_HPP_102211GER +#define BOOST_TEST_DATA_FOR_EACH_SAMPLE_HPP_102211GER + +// Boost.Test +#include +#include +#include +#include +#include + +// STL +#include + +#include + +// needed for std::min +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { + +// ************************************************************************** // +// ************** data::invoke_action ************** // +// ************************************************************************** // + +template +inline void +invoke_action( Action const& action, T && arg, std::false_type /* is_tuple */ ) +{ + action( std::forward(arg) ); +} + +//____________________________________________________________________________// + +template +inline void +invoke_action_impl( Action const& action, + T && args, + index_sequence const& ) +{ + action( std::get(std::forward(args))... ); +} + +//____________________________________________________________________________// + +template +inline void +invoke_action( Action const& action, T&& args, std::true_type /* is_tuple */ ) +{ + invoke_action_impl( action, + std::forward(args), + typename make_index_sequence< 0, + std::tuple_size::type>::value + >::type{} ); + +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** for_each_sample ************** // +// ************************************************************************** // + +template +inline typename std::enable_if::value,void>::type +for_each_sample( DataSet && samples, + Action const& act, + data::size_t number_of_samples = BOOST_TEST_DS_INFINITE_SIZE ) +{ + data::size_t size = (std::min)( samples.size(), number_of_samples ); + BOOST_TEST_DS_ASSERT( !size.is_inf(), "Dataset has infinite size. Please specify the number of samples" ); + + auto it = samples.begin(); + + while( size-- > 0 ) { + invoke_action( act, + *it, + typename monomorphic::ds_detail::is_tuple::type()); + ++it; + } +} + +//____________________________________________________________________________// + +template +inline typename std::enable_if::value,void>::type +for_each_sample( DataSet && samples, + Action const& act, + data::size_t number_of_samples = BOOST_TEST_DS_INFINITE_SIZE ) +{ + data::for_each_sample( data::make( std::forward(samples) ), + act, + number_of_samples ); +} + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_FOR_EACH_SAMPLE_HPP_102211GER + diff --git a/libraries/boost/include/boost/test/data/generators.hpp b/libraries/boost/include/boost/test/data/generators.hpp new file mode 100644 index 0000000000..e9bd4c17b5 --- /dev/null +++ b/libraries/boost/include/boost/test/data/generators.hpp @@ -0,0 +1,19 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief specific generators +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER +#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER + +// Boost.Test +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER + diff --git a/libraries/boost/include/boost/test/data/index_sequence.hpp b/libraries/boost/include/boost/test/data/index_sequence.hpp new file mode 100644 index 0000000000..21af7e504c --- /dev/null +++ b/libraries/boost/include/boost/test/data/index_sequence.hpp @@ -0,0 +1,62 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Defines c++14 index_sequence implementation +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_INDEX_SEQUENCE_HPP +#define BOOST_TEST_DATA_INDEX_SEQUENCE_HPP + +// Boost.Test +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { + +// ************************************************************************** // +// ************** data::index_sequence ************** // +// ************************************************************************** // + +template +struct index_sequence {}; + +template +struct merge_index_sequence; + +template +struct merge_index_sequence, index_sequence> { + typedef index_sequence type; +}; + +template +struct make_index_sequence { + typedef typename merge_index_sequence::type, + typename make_index_sequence<(B+E)/2,E>::type>::type type; +}; + +template +struct make_index_sequence::type> { + typedef index_sequence type; +}; + +template +using index_sequence_for = typename make_index_sequence<0, sizeof...(T)>::type; + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_INDEX_SEQUENCE_HPP + diff --git a/libraries/boost/include/boost/test/data/monomorphic.hpp b/libraries/boost/include/boost/test/data/monomorphic.hpp new file mode 100644 index 0000000000..31d7b01b32 --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic.hpp @@ -0,0 +1,27 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief Monomorphic dataset interfaces +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_HPP_102211GER +#define BOOST_TEST_DATA_MONOMORPHIC_HPP_102211GER + +// Boost.Test +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_HPP_102211GER + diff --git a/libraries/boost/include/boost/test/data/monomorphic/array.hpp b/libraries/boost/include/boost/test/data/monomorphic/array.hpp new file mode 100644 index 0000000000..6f7ed8eb3b --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/array.hpp @@ -0,0 +1,83 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +///@file +///Defines monomorphic dataset based on C type arrays +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER +#define BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { +namespace monomorphic { + +// ************************************************************************** // +// ************** array ************** // +// ************************************************************************** // + +/// Dataset view of a C array +template +class array { +public: + typedef T sample; + + enum { arity = 1 }; + + typedef T const* iterator; + + // Constructor + array( T const* arr_, std::size_t size_ ) + : m_arr( arr_ ) + , m_size( size_ ) + {} + + // dataset interface + data::size_t size() const { return m_size; } + iterator begin() const { return m_arr; } + +private: + // Data members + T const* m_arr; + std::size_t m_size; +}; + +//____________________________________________________________________________// + +//! An array dataset is a dataset +template +struct is_dataset> : mpl::true_ {}; + +} // namespace monomorphic + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::make() +template +inline monomorphic::array::type> +make( T (&a)[size] ) +{ + return monomorphic::array::type>( a, size ); +} + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER + diff --git a/libraries/boost/include/boost/test/data/monomorphic/collection.hpp b/libraries/boost/include/boost/test/data/monomorphic/collection.hpp new file mode 100644 index 0000000000..71a4863f41 --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/collection.hpp @@ -0,0 +1,91 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +///@file +///Defines monomorphic dataset based on forward iterable sequence +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_COLLECTION_HPP_102211GER +#define BOOST_TEST_DATA_MONOMORPHIC_COLLECTION_HPP_102211GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { +namespace monomorphic { + +// ************************************************************************** // +// ************** collection ************** // +// ************************************************************************** // + + +//!@brief Dataset from a forward iterable container (collection) +//! +//! This dataset is applicable to any container implementing a forward iterator. Note that +//! container with one element will be considered as singletons. +//! This dataset is constructible with the @ref boost::unit_test::data::make function. +template +class collection { + typedef typename boost::decay::type col_type; +public: + typedef typename col_type::value_type sample; + + enum { arity = 1 }; + + typedef typename col_type::const_iterator iterator; + + //! Constructor consumed a temporary collection or stores a reference + explicit collection( C&& col ) : m_col( std::forward(col) ) {} + + //! Move constructor + collection( collection&& c ) : m_col( std::forward( c.m_col ) ) {} + + //! Returns the underlying collection + C const& col() const { return m_col; } + + //! dataset interface + data::size_t size() const { return m_col.size(); } + iterator begin() const { return m_col.begin(); } + +private: + // Data members + C m_col; +}; + +//____________________________________________________________________________// + +//! A collection from a forward iterable container is a dataset. +template +struct is_dataset> : mpl::true_ {}; + +} // namespace monomorphic + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::make() +template +inline typename std::enable_if::value,monomorphic::collection>::type +make( C&& c ) +{ + return monomorphic::collection( std::forward(c) ); +} + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_COLLECTION_HPP_102211GER + diff --git a/libraries/boost/include/boost/test/data/monomorphic/fwd.hpp b/libraries/boost/include/boost/test/data/monomorphic/fwd.hpp new file mode 100644 index 0000000000..dcd1b84165 --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/fwd.hpp @@ -0,0 +1,180 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Forward declares monomorphic datasets interfaces +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER +#define BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER + +// Boost.Test +#include +#include + +#include + +// Boost +#include +#include +#include +#include + +// STL +#include + +#include + +// STL +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { + +namespace monomorphic { + + +#if !defined(BOOST_TEST_DOXYGEN_DOC__) + +template +class dataset; + +template +class singleton; + +template +class collection; + +template +class array; + +template +class init_list; + +#endif + +// ************************************************************************** // +// ************** monomorphic::is_dataset ************** // +// ************************************************************************** // + +//! Helper metafunction indicating if the specified type is a dataset. +template +struct is_dataset : mpl::false_ {}; + +//____________________________________________________________________________// + +//! A reference to a dataset is a dataset +template +struct is_dataset : is_dataset {}; + +//____________________________________________________________________________// + +//! A const dataset is a dataset +template +struct is_dataset : is_dataset {}; + +} // namespace monomorphic + +// ************************************************************************** // +// ************** data::make ************** // +// ************************************************************************** // + +//! @brief Creates a dataset from a value, a collection or an array +//! +//! This function has several overloads: +//! @code +//! // returns ds if ds is already a dataset +//! template DataSet make(DataSet&& ds); +//! +//! // creates a singleton dataset, for non forward iterable and non dataset type T +//! // (a C string is not considered as a sequence). +//! template monomorphic::singleton make(T&& v); +//! monomorphic::singleton make( char* str ); +//! monomorphic::singleton make( char const* str ); +//! +//! // creates a collection dataset, for forward iterable and non dataset type C +//! template monomorphic::collection make(C && c); +//! +//! // creates an array dataset +//! template monomorphic::array make( T (&a)[size] ); +//! @endcode +template +inline typename std::enable_if::value,DataSet>::type +make(DataSet&& ds) +{ + return std::forward( ds ); +} + +//____________________________________________________________________________// + +// warning: doxygen is apparently unable to handle @overload from different files, so if the overloads +// below are not declared with @overload in THIS file, they do not appear in the documentation. + +//! @overload boost::unit_test::data::make() +template +inline typename std::enable_if::value && + !monomorphic::is_dataset::value && + !is_array::type>::value, + monomorphic::singleton>::type +make( T&& v ); + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::make() +template +inline typename std::enable_if::value,monomorphic::collection>::type +make( C&& c ); + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::make() +template +inline monomorphic::array< typename boost::remove_const::type > +make( T (&a)[size] ); + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::make() +inline monomorphic::singleton +make( char* str ); + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::make() +inline monomorphic::singleton +make( char const* str ); + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::make() +template +inline monomorphic::init_list +make( std::initializer_list&& ); + +//____________________________________________________________________________// + +namespace result_of { + +//! Result of the make call. +template +struct make { + typedef decltype( data::make( declval() ) ) type; +}; + +} // namespace result_of + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER + diff --git a/libraries/boost/include/boost/test/data/monomorphic/generate.hpp b/libraries/boost/include/boost/test/data/monomorphic/generate.hpp new file mode 100644 index 0000000000..614ef3aad5 --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/generate.hpp @@ -0,0 +1,111 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Defines generic interface for monomorphic dataset based on generator +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATE_HPP_112011GER +#define BOOST_TEST_DATA_MONOMORPHIC_GENERATE_HPP_112011GER + +// Boost.Test +#include +#include + +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { +namespace monomorphic { + +// ************************************************************************** // +// ************** generated_by ************** // +// ************************************************************************** // + +/*!@brief Generators interface + * + * This class implements the dataset concept over a generator. Examples of generators are: + * - xrange_t + * - random_t + * + * The generator concept is the following: + * - the type of the generated samples is given by field @c sample + * - the member function @c capacity should return the size of the collection being generated (potentially infinite) + * - the member function @c next should change the state of the generator to the next generated value + * - the member function @c reset should put the state of the object in the same state as right after its instanciation + */ +template +class generated_by { +public: + typedef typename Generator::sample sample; + + enum { arity = 1 }; + + struct iterator { + // Constructor + explicit iterator( Generator& gen ) + : m_gen( &gen ) + { + if(m_gen->capacity() > 0) { + m_gen->reset(); + ++*this; + } + } + + // forward iterator interface + sample const& operator*() const { return m_curr_sample; } + void operator++() { m_curr_sample = m_gen->next(); } + + private: + // Data members + Generator* m_gen; + sample m_curr_sample; + }; + + typedef Generator generator_type; + + // Constructor + explicit generated_by( Generator&& G ) + : m_generator( std::forward(G) ) + {} + + // Move constructor + generated_by( generated_by&& rhs ) + : m_generator( std::forward(rhs.m_generator) ) + {} + + //! Size of the underlying dataset + data::size_t size() const { return m_generator.capacity(); } + + //! Iterator on the beginning of the dataset + iterator begin() const { return iterator( boost::ref(const_cast(m_generator)) ); } + +private: + // Data members + Generator m_generator; +}; + +//____________________________________________________________________________// + +//! A generated dataset is a dataset. +template +struct is_dataset> : mpl::true_ {}; + +} // namespace monomorphic +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATE_HPP_112011GER + diff --git a/libraries/boost/include/boost/test/data/monomorphic/generators.hpp b/libraries/boost/include/boost/test/data/monomorphic/generators.hpp new file mode 100644 index 0000000000..108d4ba58d --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/generators.hpp @@ -0,0 +1,20 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +///@file +///Defines specific generators +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER +#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER + +// Boost.Test +#include +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER + diff --git a/libraries/boost/include/boost/test/data/monomorphic/generators/keywords.hpp b/libraries/boost/include/boost/test/data/monomorphic/generators/keywords.hpp new file mode 100644 index 0000000000..de6a4e89e5 --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/generators/keywords.hpp @@ -0,0 +1,39 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +///@file +/// Keywords used in generator interfaces +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_KEYWORDS_HPP_101512GER +#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_KEYWORDS_HPP_101512GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { + +namespace { +nfp::keyword begin; +nfp::keyword end; +nfp::keyword step; +} // local namespace + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_KEYWORDS_HPP_101512GER diff --git a/libraries/boost/include/boost/test/data/monomorphic/generators/random.hpp b/libraries/boost/include/boost/test/data/monomorphic/generators/random.hpp new file mode 100644 index 0000000000..24a1df3c64 --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/generators/random.hpp @@ -0,0 +1,198 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief Random generator +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_RANDOM_HPP_101512GER +#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_RANDOM_HPP_101512GER + +// Boost.Test +#include + + + + +#if !defined(BOOST_TEST_NO_RANDOM_DATASET_AVAILABLE) || defined(BOOST_TEST_DOXYGEN_DOC__) + +#include +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { + +namespace { +nfp::keyword seed; +nfp::keyword distribution; +nfp::keyword engine; +} // local namespace + +namespace monomorphic { + +namespace ds_detail { +template +struct default_distribution { + typedef typename mpl::if_, + std::uniform_int_distribution, + std::uniform_real_distribution>::type type; +}; + +} // namespace ds_detail + +// ************************************************************************** // +// ************** random_t ************** // +// ************************************************************************** // + +/*!@brief Generator for the random sequences + * + * This class implements the generator concept (see @ref boost::unit_test::data::monomorphic::generated_by) for implementing + * a random number generator. + */ +template::type, + typename EngineType = std::default_random_engine> +class random_t { +public: + typedef SampleType sample; + typedef DistributionType distr_type; + typedef EngineType engine_type; + + random_t() + : m_distribution() + , m_engine( std::random_device()() ) + {} + explicit random_t( distr_type&& d ) + : m_distribution( std::forward(d) ) + , m_engine( std::random_device()() ){} + random_t( engine_type&& e, distr_type&& d ) + : m_distribution( std::forward(d) ) + , m_engine( std::forward(e) ){} + + // Generator interface + data::size_t capacity() const { return BOOST_TEST_DS_INFINITE_SIZE; } + SampleType next() + { + return m_distribution( m_engine ); + } + void reset() {} + + //! Sets the seed of the pseudo-random number engine. + template + void seed( SeedType&& seed ) { m_engine.seed( std::forward( seed ) ); } + +private: + // Data members + DistributionType m_distribution; + EngineType m_engine; +}; + +//____________________________________________________________________________// + +} // namespace monomorphic + + +//! @brief Returns an infinite sequence of random numbers. +//! +//! The following overloads are available: +//! @code +//! auto d = random(); +//! auto d = random(begin, end); +//! auto d = random(params); +//! @endcode +//! +//! +//! - The first overload uses the default distribution, which is uniform and which elements +//! are @c double type (the values are in [0, 1) ). +//! - The second overload generates numbers in the given interval. The distribution is uniform (in [begin, end) +//! for real numbers, and in [begin, end] for integers). The type of the distribution is deduced from the type +//! of the @c begin and @c end parameters. +//! - The third overload generates numbers using the named parameter inside @c params , which are: +//! - @c distribution: the distribution used. In this overload, since the type of the samples cannot be deduced, +//! the samples are of type @c double and the distribution is uniform real in [0, 1). +//! - @c seed: the seed for generating the values +//! - @c engine: the random number generator engine +//! +//! The function returns an object that implements the dataset API. +//! @note This function is available only for C++11 capable compilers. +inline monomorphic::generated_by< monomorphic::random_t<>> random() +{ + return monomorphic::generated_by>( monomorphic::random_t<>() ); +} + +//____________________________________________________________________________// + +/// @overload boost::unit_test::data::random() +template +inline monomorphic::generated_by< monomorphic::random_t> +random( SampleType begin, SampleType end ) +{ + typedef monomorphic::random_t Gen; + typedef typename Gen::distr_type distr_type; + return monomorphic::generated_by( Gen( distr_type(begin,end) ) ); +} + +//____________________________________________________________________________// + +namespace ds_detail { +template +struct random_gen_type { + typedef typename nfp::param_type>::type distr_type; + typedef typename nfp::param_type::type engine_type; + typedef typename distr_type::result_type sample_type; + + typedef monomorphic::random_t type; +}; + +} + + +/// @overload boost::unit_test::data::random() +template +inline monomorphic::generated_by::type> +random( Params const& params ) +{ + typedef typename ds_detail::random_gen_type::type Gen; + typedef typename Gen::distr_type distr_type; + typedef typename Gen::engine_type engine_type; + + std::random_device rd; + engine_type E; +// engine_type E( rd ); + if( params.has(engine) ) + E = params[engine]; + + distr_type D; + if( params.has(distribution) ) + D = params[distribution]; + + Gen G( std::move(E), std::move(D) ); + + if( params.has(seed) ) + G.seed( params[seed] ); + + return monomorphic::generated_by( std::move(G) ); +} + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_NO_RANDOM_DATASET_AVAILABLE + + +#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_RANDOM_HPP_101512GER diff --git a/libraries/boost/include/boost/test/data/monomorphic/generators/xrange.hpp b/libraries/boost/include/boost/test/data/monomorphic/generators/xrange.hpp new file mode 100644 index 0000000000..02da352adf --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/generators/xrange.hpp @@ -0,0 +1,224 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +///@file +///Defines range generator +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_XRANGE_HPP_112011GER +#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_XRANGE_HPP_112011GER + +// Boost.Test +#include + +#include +#include + +// Boost +#include +#include +#include + +// STL +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { +namespace monomorphic { + +// ************************************************************************** // +// ************** monomorphic::xrange_t ************** // +// ************************************************************************** // + + +/*!@brief Generator for the range sequences + * + * This class implements the generator concept (see @ref boost::unit_test::data::monomorphic::generated_by) for implementing + * a range like sequence of numbers. + */ +template +class xrange_t { +public: + typedef SampleType sample; + + xrange_t( SampleType const& begin_, StepType const& step_, data::size_t size_ ) + : m_begin( begin_ ) + , m_curr( begin_ ) + , m_step( step_ ) + , m_index( 0 ) + , m_size( size_ ) + {} + + // Generator interface + data::size_t capacity() const { return m_size; } + SampleType next() + { + if( m_index == m_size ) + return m_curr; + + SampleType res = m_curr; + + m_curr += m_step; + ++m_index; + + return res; + } + void reset() + { + m_curr = m_begin; + m_index = 0; + } + +private: + // Data members + SampleType m_begin; + SampleType m_curr; + StepType m_step; + data::size_t m_index; + data::size_t m_size; +}; + +//____________________________________________________________________________// + +namespace ds_detail { + +template +struct make_xrange { + static StepType abs( StepType s, boost::true_type* ) { return s; } + static StepType abs( StepType s, boost::false_type* ) { return std::abs(s); } + + typedef xrange_t range_gen; + + template + static generated_by + _( Params const& params ) + { + SampleType begin_val = params.has( data::begin ) ? params[data::begin] : SampleType(); + optional end_val = params.has( data::end ) ? params[data::end] : optional(); + StepType step_val = params.has( data::step ) ? params[data::step] : 1; + + BOOST_TEST_DS_ASSERT( step_val != 0, "Range step can't be zero" ); + + data::size_t size; + if( !end_val.is_initialized() ) + size = BOOST_TEST_DS_INFINITE_SIZE; + else { + BOOST_TEST_DS_ASSERT( (step_val < 0) ^ (begin_val < *end_val), "Invalid step direction" ); + + SampleType abs_distance = step_val < 0 ? begin_val - *end_val : *end_val-begin_val; + StepType abs_step = make_xrange::abs(step_val, (typename boost::is_unsigned::type*)0 ); + std::size_t s = static_cast(abs_distance/abs_step); + + if( static_cast(s*abs_step) < abs_distance ) + s++; + + size = s; + } + + return generated_by( range_gen( begin_val, step_val, size ) ); + } +}; + +} // namespace ds_detail +} // namespace monomorphic + +//____________________________________________________________________________// + +//! Creates a range (sequence) dataset. +//! +//! The following overloads are available: +//! @code +//! auto d = xrange(); +//! auto d = xrange(end_val); +//! auto d = xrange(end_val, param); +//! auto d = xrange(begin_val, end_val); +//! auto d = xrange(begin_val, end_val, step_val); +//! auto d = xrange(param); +//! @endcode +//! +//! - @c begin_val indicates the start of the sequence (default to 0). +//! - @c end_val is the end of the sequence. If ommited, the dataset has infinite size.\n +//! - @c step_val is the step between two consecutive elements of the sequence, and defaults to 1.\n +//! - @c param is the named parameters that describe the sequence. The following parameters are accepted: +//! - @c begin: same meaning @c begin_val +//! - @c end: same meaning as @c end_val +//! - @c step: same meaning as @c step_val +//! +//! +//! The returned value is an object that implements the dataset API. +//! +//! @note the step size cannot be null, and it should be positive if @c begin_val < @c end_val, negative otherwise. +template +inline monomorphic::generated_by> +xrange( Params const& params ) +{ + return monomorphic::ds_detail::make_xrange::_( params ); +} + +//____________________________________________________________________________// + +/// @overload boost::unit_test::data::xrange() +template +inline monomorphic::generated_by> +xrange( SampleType const& end_val ) +{ + return monomorphic::ds_detail::make_xrange::_( data::end=end_val ); +} + +//____________________________________________________________________________// + +/// @overload boost::unit_test::data::xrange() +template +inline typename enable_if_c::value, + monomorphic::generated_by>>::type +xrange( SampleType const& end_val, Params const& params ) +{ + return monomorphic::ds_detail::make_xrange::_(( params, data::end=end_val )); +} + +//____________________________________________________________________________// + +/// @overload boost::unit_test::data::xrange() +template +inline monomorphic::generated_by> +xrange( SampleType const& begin_val, SampleType const& end_val ) +{ + return monomorphic::ds_detail::make_xrange::_(( + data::begin=begin_val, + data::end=end_val )); +} + +//____________________________________________________________________________// + + + +/// @overload boost::unit_test::data::xrange() +template +inline monomorphic::generated_by> +xrange( SampleType const& begin_val, SampleType const& end_val, StepType const& step_val ) +{ + return monomorphic::ds_detail::make_xrange::_(( + data::begin=begin_val, + data::end=end_val, + data::step=step_val )); +} + +//____________________________________________________________________________// + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_XRANGE_HPP_112011GER diff --git a/libraries/boost/include/boost/test/data/monomorphic/grid.hpp b/libraries/boost/include/boost/test/data/monomorphic/grid.hpp new file mode 100644 index 0000000000..2cf66189a0 --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/grid.hpp @@ -0,0 +1,183 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +///@file +/// Defines monomorphic dataset n+m dimentional *. Samples in this +/// dataset is grid of elements in DataSet1 and DataSet2. There will be total +/// |DataSet1| * |DataSet2| samples +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_GRID_HPP_101512GER +#define BOOST_TEST_DATA_MONOMORPHIC_GRID_HPP_101512GER + +// Boost.Test +#include + +#if !defined(BOOST_TEST_NO_GRID_COMPOSITION_AVAILABLE) || defined(BOOST_TEST_DOXYGEN_DOC__) + +#include +#include + +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { +namespace monomorphic { + +// ************************************************************************** // +// ************** grid ************** // +// ************************************************************************** // + + +//! Implements the dataset resulting from a cartesian product/grid operation on datasets. +//! +//! The arity of the resulting dataset is the sum of the arity of its operands. +template +class grid { + typedef typename boost::decay::type dataset1_decay; + typedef typename boost::decay::type dataset2_decay; + + typedef typename dataset1_decay::iterator dataset1_iter; + typedef typename dataset2_decay::iterator dataset2_iter; + +public: + + struct iterator { + // Constructor + explicit iterator( dataset1_iter iter1, DataSet2 const& ds2 ) + : m_iter1( std::move( iter1 ) ) + , m_iter2( std::move( ds2.begin() ) ) + , m_ds2( &ds2 ) + , m_ds2_pos( 0 ) + {} + + using iterator_sample = decltype( + sample_merge( *std::declval(), + *std::declval()) ); + + // forward iterator interface + auto operator*() const -> iterator_sample { + return sample_merge( *m_iter1, *m_iter2 ); + } + void operator++() + { + ++m_ds2_pos; + if( m_ds2_pos != m_ds2->size() ) + ++m_iter2; + else { + m_ds2_pos = 0; + ++m_iter1; + m_iter2 = std::move( m_ds2->begin() ); + } + } + + private: + // Data members + dataset1_iter m_iter1; + dataset2_iter m_iter2; + dataset2_decay const* m_ds2; + data::size_t m_ds2_pos; + }; + +public: + enum { arity = boost::decay::type::arity + boost::decay::type::arity }; + + //! Constructor + grid( DataSet1&& ds1, DataSet2&& ds2 ) + : m_ds1( std::forward( ds1 ) ) + , m_ds2( std::forward( ds2 ) ) + {} + + //! Move constructor + grid( grid&& j ) + : m_ds1( std::forward( j.m_ds1 ) ) + , m_ds2( std::forward( j.m_ds2 ) ) + {} + + // dataset interface + data::size_t size() const { return m_ds1.size() * m_ds2.size(); } + iterator begin() const { return iterator( m_ds1.begin(), m_ds2 ); } + +private: + // Data members + DataSet1 m_ds1; + DataSet2 m_ds2; +}; + +//____________________________________________________________________________// + +// A grid dataset is a dataset +template +struct is_dataset> : mpl::true_ {}; + +//____________________________________________________________________________// + +namespace result_of { + +/// Result type of the grid operation on dataset. +template +struct grid { + typedef monomorphic::grid type; +}; + +} // namespace result_of + +//____________________________________________________________________________// + +//! Grid operation +template +inline typename boost::lazy_enable_if_c::value && is_dataset::value, + result_of::grid,mpl::identity> +>::type +operator*( DataSet1&& ds1, DataSet2&& ds2 ) +{ + BOOST_TEST_DS_ASSERT( !ds1.size().is_inf() && !ds2.size().is_inf(), "Grid axes can't have infinite size" ); + + return grid( std::forward( ds1 ), std::forward( ds2 ) ); +} + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::operator* +template +inline typename boost::lazy_enable_if_c::value && !is_dataset::value, + result_of::grid,data::result_of::make> +>::type +operator*( DataSet1&& ds1, DataSet2&& ds2 ) +{ + return std::forward(ds1) * data::make(std::forward(ds2)); +} + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::operator* +template +inline typename boost::lazy_enable_if_c::value && is_dataset::value, + result_of::grid,mpl::identity> +>::type +operator*( DataSet1&& ds1, DataSet2&& ds2 ) +{ + return data::make(std::forward(ds1)) * std::forward(ds2); +} + +} // namespace monomorphic + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_NO_GRID_COMPOSITION_AVAILABLE + +#endif // BOOST_TEST_DATA_MONOMORPHIC_GRID_HPP_101512GER + diff --git a/libraries/boost/include/boost/test/data/monomorphic/initializer_list.hpp b/libraries/boost/include/boost/test/data/monomorphic/initializer_list.hpp new file mode 100644 index 0000000000..3221597396 --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/initializer_list.hpp @@ -0,0 +1,81 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +///@file +///Defines monomorphic dataset based on C++11 initializer_list template +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_INITIALIZATION_LIST_HPP_091515GER +#define BOOST_TEST_DATA_MONOMORPHIC_INITIALIZATION_LIST_HPP_091515GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { +namespace monomorphic { + +// ************************************************************************** // +// ************** array ************** // +// ************************************************************************** // + +/// Dataset view of a C array +template +class init_list { +public: + typedef T sample; + + enum { arity = 1 }; + + typedef T const* iterator; + + //! Constructor swallows initializer_list + init_list( std::initializer_list&& il ) + : m_data( std::forward>( il ) ) + {} + + //! dataset interface + data::size_t size() const { return m_data.size(); } + iterator begin() const { return m_data.begin(); } + +private: + // Data members + std::initializer_list m_data; +}; + +//____________________________________________________________________________// + +//! An array dataset is a dataset +template +struct is_dataset> : mpl::true_ {}; + +} // namespace monomorphic + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::make() +template +inline monomorphic::init_list +make( std::initializer_list&& il ) +{ + return monomorphic::init_list( std::forward>( il ) ); +} + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_INITIALIZATION_LIST_HPP_091515GER + diff --git a/libraries/boost/include/boost/test/data/monomorphic/join.hpp b/libraries/boost/include/boost/test/data/monomorphic/join.hpp new file mode 100644 index 0000000000..f817994dd3 --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/join.hpp @@ -0,0 +1,148 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! Defines dataset join operation +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_JOIN_HPP_112711GER +#define BOOST_TEST_DATA_MONOMORPHIC_JOIN_HPP_112711GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { +namespace monomorphic { + +// ************************************************************************** // +// ************** join ************** // +// ************************************************************************** // + +//! Defines a new dataset from the concatenation of two datasets +//! +//! The size of the resulting dataset is the sum of the two underlying datasets. The arity of the datasets +//! should match. +template +class join { + typedef typename boost::decay::type dataset1_decay; + typedef typename boost::decay::type dataset2_decay; + + typedef typename dataset1_decay::iterator dataset1_iter; + typedef typename dataset2_decay::iterator dataset2_iter; +public: + typedef typename dataset1_decay::sample sample; + + enum { arity = dataset1_decay::arity }; + + struct iterator { + // Constructor + explicit iterator( dataset1_iter it1, dataset2_iter it2, data::size_t first_size ) + : m_it1( std::move( it1 ) ) + , m_it2( std::move( it2 ) ) + , m_first_size( first_size ) + {} + + // forward iterator interface + sample const& operator*() const { return m_first_size > 0 ? *m_it1 : *m_it2; } + void operator++() { if( m_first_size > 0 ) { --m_first_size; ++m_it1; } else ++m_it2; } + + private: + // Data members + dataset1_iter m_it1; + dataset2_iter m_it2; + data::size_t m_first_size; + }; + + //! Constructor + join( DataSet1&& ds1, DataSet2&& ds2 ) + : m_ds1( std::forward( ds1 ) ) + , m_ds2( std::forward( ds2 ) ) + {} + + //! Move constructor + join( join&& j ) + : m_ds1( std::forward( j.m_ds1 ) ) + , m_ds2( std::forward( j.m_ds2 ) ) + {} + + //! dataset interface + data::size_t size() const { return m_ds1.size() + m_ds2.size(); } + iterator begin() const { return iterator( m_ds1.begin(), m_ds2.begin(), m_ds1.size() ); } + +private: + // Data members + DataSet1 m_ds1; + DataSet2 m_ds2; +}; + +//____________________________________________________________________________// + +// A joined dataset is a dataset. +template +struct is_dataset> : mpl::true_ {}; + +//____________________________________________________________________________// + +namespace result_of { + +//! Result type of the join operation on datasets. +template +struct join { + typedef monomorphic::join type; +}; + +} // namespace result_of + +//____________________________________________________________________________// + +template +inline typename boost::lazy_enable_if_c::value && is_dataset::value, + result_of::join,mpl::identity> +>::type +operator+( DataSet1&& ds1, DataSet2&& ds2 ) +{ + return join( std::forward( ds1 ), std::forward( ds2 ) ); +} + +//____________________________________________________________________________// + +template +inline typename boost::lazy_enable_if_c::value && !is_dataset::value, + result_of::join,data::result_of::make> +>::type +operator+( DataSet1&& ds1, DataSet2&& ds2 ) +{ + return std::forward( ds1 ) + data::make( std::forward( ds2 ) ); +} + +//____________________________________________________________________________// + +template +inline typename boost::lazy_enable_if_c::value && is_dataset::value, + result_of::join,mpl::identity> +>::type +operator+( DataSet1&& ds1, DataSet2&& ds2 ) +{ + return data::make( std::forward(ds1) ) + std::forward( ds2 ); +} + +} // namespace monomorphic +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_JOIN_HPP_112711GER + diff --git a/libraries/boost/include/boost/test/data/monomorphic/sample_merge.hpp b/libraries/boost/include/boost/test/data/monomorphic/sample_merge.hpp new file mode 100644 index 0000000000..d7535beff7 --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/sample_merge.hpp @@ -0,0 +1,103 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Defines helper routines and types for merging monomorphic samples +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_SAMPLE_MERGE_HPP +#define BOOST_TEST_DATA_MONOMORPHIC_SAMPLE_MERGE_HPP + +// Boost.Test +#include +#include + +#include + +#include + +namespace boost { +namespace unit_test { +namespace data { +namespace monomorphic { + +//____________________________________________________________________________// + +namespace ds_detail { + +template +struct is_tuple : std::false_type {}; + +template +struct is_tuple> : std::true_type {}; + +template +struct is_tuple : is_tuple::type> {}; + +template +struct is_tuple : is_tuple::type> {}; + +template +inline auto as_tuple_impl_xvalues( T const & arg, std::false_type /* is_rvalue_ref */ ) + -> decltype(std::tuple(arg)) { + //return std::tuple(arg); + return std::forward_as_tuple(arg); +} + +template +inline auto as_tuple_impl_xvalues( T && arg, std::true_type /* is_rvalue_ref */ ) + -> decltype(std::make_tuple(std::forward(arg))) { + return std::make_tuple(std::forward(arg)); +} + + +template +inline auto as_tuple_impl( T && arg, std::false_type /* is_tuple = nullptr */ ) + -> decltype(as_tuple_impl_xvalues(std::forward(arg), + typename std::is_rvalue_reference::type())) { + return as_tuple_impl_xvalues(std::forward(arg), + typename std::is_rvalue_reference::type()); +} + +//____________________________________________________________________________// + +template +inline T && +as_tuple_impl(T && arg, std::true_type /* is_tuple */ ) { + return std::forward(arg); +} + +template +inline auto as_tuple( T && arg ) + -> decltype( as_tuple_impl(std::forward(arg), + typename ds_detail::is_tuple::type()) ) { + return as_tuple_impl(std::forward(arg), + typename ds_detail::is_tuple::type()); +} + +//____________________________________________________________________________// + +} // namespace ds_detail + +template +inline auto +sample_merge( T1 && a1, T2 && a2 ) + -> decltype( std::tuple_cat(ds_detail::as_tuple(std::forward(a1)), + ds_detail::as_tuple(std::forward(a2)) ) ) { + return std::tuple_cat(ds_detail::as_tuple(std::forward(a1)), + ds_detail::as_tuple(std::forward(a2))); +} + +} // namespace monomorphic +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_SAMPLE_MERGE_HPP + diff --git a/libraries/boost/include/boost/test/data/monomorphic/singleton.hpp b/libraries/boost/include/boost/test/data/monomorphic/singleton.hpp new file mode 100644 index 0000000000..b0abd0eabb --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/singleton.hpp @@ -0,0 +1,119 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Defines single element monomorphic dataset +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_SINGLETON_HPP_102211GER +#define BOOST_TEST_DATA_MONOMORPHIC_SINGLETON_HPP_102211GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { +namespace monomorphic { + +// ************************************************************************** // +// ************** singleton ************** // +// ************************************************************************** // + +/// Models a single element data set +template +class singleton { +public: + typedef typename boost::decay::type sample; + + enum { arity = 1 }; + + struct iterator { + // Constructor + explicit iterator( singleton const* owner ) + : m_owner( owner ) + {} + + // forward iterator interface + sample const& operator*() const { return m_owner->value(); } + void operator++() {} + + private: + singleton const* m_owner; + }; + + //! Constructor + explicit singleton( T&& value ) : m_value( std::forward( value ) ) {} + + //! Move constructor + singleton( singleton&& s ) : m_value( std::forward( s.m_value ) ) {} + + //! Value access method + T const& value() const { return m_value; } + + //! dataset interface + data::size_t size() const { return 1; } + iterator begin() const { return iterator( this ); } + +private: + // Data members + T m_value; +}; + +//____________________________________________________________________________// + +// a singleton is a dataset +template +struct is_dataset> : mpl::true_ {}; + +//____________________________________________________________________________// + +} // namespace monomorphic + +/// @overload boost::unit_test::data::make() +template +inline typename std::enable_if::value && + !monomorphic::is_dataset::value && + !boost::is_array::type>::value, + monomorphic::singleton +>::type +make( T&& v ) +{ + return monomorphic::singleton( std::forward( v ) ); +} + +//____________________________________________________________________________// + +/// @overload boost::unit_test::data::make +inline monomorphic::singleton +make( char* str ) +{ + return monomorphic::singleton( std::move(str) ); +} + +//____________________________________________________________________________// + +/// @overload boost::unit_test::data::make +inline monomorphic::singleton +make( char const* str ) +{ + return monomorphic::singleton( std::move(str) ); +} + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_MONOMORPHIC_SINGLETON_HPP_102211GER + diff --git a/libraries/boost/include/boost/test/data/monomorphic/zip.hpp b/libraries/boost/include/boost/test/data/monomorphic/zip.hpp new file mode 100644 index 0000000000..5fc65d0e20 --- /dev/null +++ b/libraries/boost/include/boost/test/data/monomorphic/zip.hpp @@ -0,0 +1,194 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Defines monomorphic dataset based on zipping of 2 other monomorphic datasets +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_MONOMORPHIC_ZIP_HPP_102211GER +#define BOOST_TEST_DATA_MONOMORPHIC_ZIP_HPP_102211GER + +// Boost.Test +#include + +#if !defined(BOOST_TEST_NO_ZIP_COMPOSITION_AVAILABLE) || defined(BOOST_TEST_DOXYGEN_DOC__) + +#include +#include + +#include + + +namespace boost { +namespace unit_test { +namespace data { +namespace monomorphic { + +// ************************************************************************** // +// ************** zip ************** // +// ************************************************************************** // + +//! Zip datasets +//! +//! A zip of two datasets is a dataset whose arity is the sum of the operand datasets arity. The size is given by +//! the function creating the instance (see @c operator^ on datasets). +template +class zip { + typedef typename boost::decay::type dataset1_decay; + typedef typename boost::decay::type dataset2_decay; + + typedef typename dataset1_decay::iterator dataset1_iter; + typedef typename dataset2_decay::iterator dataset2_iter; + +public: + enum { arity = dataset1_decay::arity + dataset2_decay::arity }; + + struct iterator { + // Constructor + explicit iterator( dataset1_iter iter1, dataset2_iter iter2 ) + : m_iter1( std::move( iter1 ) ) + , m_iter2( std::move( iter2 ) ) + {} + + using iterator_sample = decltype( + sample_merge( *std::declval(), + *std::declval()) ); + + // forward iterator interface + auto operator*() const -> iterator_sample { + return sample_merge( *m_iter1, *m_iter2 ); + } + void operator++() { ++m_iter1; ++m_iter2; } + + private: + // Data members + dataset1_iter m_iter1; + dataset2_iter m_iter2; + }; + + typedef typename iterator::iterator_sample sample; + + //! Constructor + //! + //! The datasets are moved and not copied. + zip( DataSet1&& ds1, DataSet2&& ds2, data::size_t size ) + : m_ds1( std::forward( ds1 ) ) + , m_ds2( std::forward( ds2 ) ) + , m_size( size ) + {} + + //! Move constructor + zip( zip&& j ) + : m_ds1( std::forward( j.m_ds1 ) ) + , m_ds2( std::forward( j.m_ds2 ) ) + , m_size( j.m_size ) + {} + + // dataset interface + data::size_t size() const { return m_size; } + iterator begin() const { return iterator( m_ds1.begin(), m_ds2.begin() ); } + +private: + // Data members + DataSet1 m_ds1; + DataSet2 m_ds2; + data::size_t m_size; +}; + +//____________________________________________________________________________// + +//! Zipped datasets results in a dataset. +template +struct is_dataset> : mpl::true_ {}; + +//____________________________________________________________________________// + +namespace ds_detail { + +//! Handles the sise of the resulting zipped dataset. +template +inline data::size_t +zip_size( DataSet1&& ds1, DataSet2&& ds2 ) +{ + data::size_t ds1_size = ds1.size(); + data::size_t ds2_size = ds2.size(); + + if( ds1_size == ds2_size ) + return ds1_size; + + if( ds1_size == 1 || ds1_size.is_inf() ) + return ds2_size; + + if( ds2_size == 1 || ds2_size.is_inf() ) + return ds1_size; + + BOOST_TEST_DS_ERROR( "Can't zip datasets of different sizes" ); +} + +} // namespace ds_detail + +//____________________________________________________________________________// + +namespace result_of { + +//! Result type of the zip operator. +template +struct zip { + typedef monomorphic::zip type; +}; + +} // namespace result_of + +//____________________________________________________________________________// + +//! Overload operator for zip support +template +inline typename boost::lazy_enable_if_c::value && is_dataset::value, + result_of::zip,mpl::identity> +>::type +operator^( DataSet1&& ds1, DataSet2&& ds2 ) +{ + return zip( std::forward( ds1 ), + std::forward( ds2 ), + ds_detail::zip_size( ds1, ds2 ) ); +} + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::monomorphic::operator^() +template +inline typename boost::lazy_enable_if_c::value && !is_dataset::value, + result_of::zip,data::result_of::make> +>::type +operator^( DataSet1&& ds1, DataSet2&& ds2 ) +{ + return std::forward( ds1 ) ^ data::make( std::forward( ds2 ) ); +} + +//____________________________________________________________________________// + +//! @overload boost::unit_test::data::monomorphic::operator^() +template +inline typename boost::lazy_enable_if_c::value && is_dataset::value, + result_of::zip,mpl::identity> +>::type +operator^( DataSet1&& ds1, DataSet2&& ds2 ) +{ + return data::make( std::forward( ds1 ) ) ^ std::forward( ds2 ); +} + +} // namespace monomorphic +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_NO_ZIP_COMPOSITION_AVAILABLE + +#endif // BOOST_TEST_DATA_MONOMORPHIC_ZIP_HPP_102211GER + diff --git a/libraries/boost/include/boost/test/data/size.hpp b/libraries/boost/include/boost/test/data/size.hpp new file mode 100644 index 0000000000..3e9ba96795 --- /dev/null +++ b/libraries/boost/include/boost/test/data/size.hpp @@ -0,0 +1,145 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief simple dataset size abstraction (can be infinite) +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_SIZE_HPP_102211GER +#define BOOST_TEST_DATA_SIZE_HPP_102211GER + +// Boost.Test +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { + +// ************************************************************************** // +// ************** size_t ************** // +// ************************************************************************** // + +//! Utility for handling the size of a datasets +class size_t { + struct dummy { void nonnull() {} }; + typedef void (dummy::*safe_bool)(); +public: + // Constructors + size_t( std::size_t s = 0 ) : m_value( s ), m_infinity( false ) {} + explicit size_t( bool ) : m_value( 0 ), m_infinity( true ) {} + template + size_t( T v ) : m_value( static_cast(v) ), m_infinity( false ) {} + + // Access methods + std::size_t value() const { return m_value; } + bool is_inf() const { return m_infinity; } + operator safe_bool() const { return is_inf() || m_value != 0 ? &dummy::nonnull : 0; } + + // Unary operators + data::size_t operator--() { if( !is_inf() ) m_value--; return *this; } + data::size_t operator--(int) { data::size_t res(*this); if( !is_inf() ) m_value--; return res; } + data::size_t operator++() { if( !is_inf() ) m_value++; return *this; } + data::size_t operator++(int) { data::size_t res(*this); if( !is_inf() ) m_value++; return res; } + + // Binary operators + data::size_t& operator+=( std::size_t rhs ) { if( !is_inf() ) m_value += rhs; return *this; } + data::size_t& operator+=( data::size_t rhs ) + { + if( !is_inf() ) { + if( rhs.is_inf() ) + *this = rhs; + else + m_value += rhs.value(); + } + return *this; + } + data::size_t& operator-=( std::size_t rhs ) { if( !is_inf() ) m_value -= rhs; return *this; } + data::size_t& operator-=( data::size_t rhs ) + { + if( !is_inf() ) { + if( value() < rhs.value() ) + m_value = 0; + else + m_value -= rhs.value(); + } + return *this; + } + +private: + // Data members + std::size_t m_value; + bool m_infinity; +}; + +namespace { const data::size_t BOOST_TEST_DS_INFINITE_SIZE( true ); } + +//____________________________________________________________________________// + +// Binary operators +inline bool operator>(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() || (lhs.value() > rhs); } +inline bool operator>(std::size_t lhs, data::size_t rhs) { return !rhs.is_inf() && (lhs > rhs.value()); } +inline bool operator>(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? lhs.is_inf() : lhs.value() > rhs.value(); } + +inline bool operator>=(data::size_t lhs, std::size_t rhs ) { return lhs.is_inf() || (lhs.value() >= rhs); } +inline bool operator>=(std::size_t lhs, data::size_t rhs) { return !rhs.is_inf() && (lhs >= rhs.value()); } +inline bool operator>=(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? lhs.is_inf() : lhs.value() >= rhs.value(); } + +inline bool operator<(data::size_t lhs, std::size_t rhs) { return !lhs.is_inf() && (lhs.value() < rhs); } +inline bool operator<(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() || (lhs < rhs.value()); } +inline bool operator<(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? rhs.is_inf() : lhs.value() < rhs.value(); } + +inline bool operator<=(data::size_t lhs, std::size_t rhs) { return !lhs.is_inf() && (lhs.value() <= rhs); } +inline bool operator<=(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() || (lhs <= rhs.value()); } +inline bool operator<=(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? rhs.is_inf() : lhs.value() <= rhs.value(); } + +inline bool operator==(data::size_t lhs, std::size_t rhs) { return !lhs.is_inf() && (lhs.value() == rhs); } +inline bool operator==(std::size_t lhs, data::size_t rhs) { return !rhs.is_inf() && (lhs == rhs.value()); } +inline bool operator==(data::size_t lhs, data::size_t rhs) { return !(lhs.is_inf() ^ rhs.is_inf()) && lhs.value() == rhs.value(); } + +inline bool operator!=(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() || (lhs.value() != rhs); } +inline bool operator!=(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() || (lhs != rhs.value()); } +inline bool operator!=(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() || lhs.value() != rhs.value(); } + +inline data::size_t operator+(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() ? lhs : data::size_t( lhs.value()+rhs ); } +inline data::size_t operator+(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() ? rhs : data::size_t( lhs+rhs.value() ); } +inline data::size_t operator+(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() || rhs.is_inf() ? data::size_t(true) : data::size_t( lhs.value()+rhs.value() ); } + +inline data::size_t operator*(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() ? lhs : data::size_t( lhs.value()*rhs ); } +inline data::size_t operator*(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() ? rhs : data::size_t( lhs*rhs.value() ); } +inline data::size_t operator*(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() || rhs.is_inf() ? data::size_t(true) : data::size_t( lhs.value()*rhs.value() ); } + +//____________________________________________________________________________// + +template +inline std::basic_ostream& +operator<<( std::basic_ostream& os, data::size_t const& s ) +{ + if( s.is_inf() ) + os << "infinity"; + else + os << s.value(); + + return os; +} + +//____________________________________________________________________________// + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_SIZE_HPP_102211GER + diff --git a/libraries/boost/include/boost/test/data/test_case.hpp b/libraries/boost/include/boost/test/data/test_case.hpp new file mode 100644 index 0000000000..01dc91b06a --- /dev/null +++ b/libraries/boost/include/boost/test/data/test_case.hpp @@ -0,0 +1,325 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief test case family based on data generator +// *************************************************************************** + +#ifndef BOOST_TEST_DATA_TEST_CASE_HPP_102211GER +#define BOOST_TEST_DATA_TEST_CASE_HPP_102211GER + +// Boost.Test +#include +#include +#include +#include + +// Boost +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include + +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) \ + && !defined(BOOST_TEST_DATASET_MAX_ARITY) +# define BOOST_TEST_DATASET_MAX_ARITY 10 +#endif + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace data { + +namespace ds_detail { + +// ************************************************************************** // +// ************** seed ************** // +// ************************************************************************** // + +struct seed { + template + typename data::result_of::make::type + operator->*( DataSet&& ds ) const + { + return data::make( std::forward( ds ) ); + } +}; + + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ + !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ + !defined(BOOST_NO_CXX11_DECLTYPE) && \ + !defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) && \ + !defined(BOOST_NO_CXX11_SMART_PTR) + +#define BOOST_TEST_DATASET_VARIADIC +template +struct parameter_holder { + std::shared_ptr value; + + parameter_holder(T && value_) + : value(std::make_shared(std::move(value_))) + {} + + operator T const&() const { + return *value; + } +}; + +template +parameter_holder::type> +boost_bind_rvalue_holder_helper_impl(T&& value, boost::false_type /* is copy constructible */) { + return parameter_holder::type>(std::forward(value)); +} + +template +T&& boost_bind_rvalue_holder_helper_impl(T&& value, boost::true_type /* is copy constructible */) { + return std::forward(value); +} + +template +auto boost_bind_rvalue_holder_helper(T&& value) + -> decltype(boost_bind_rvalue_holder_helper_impl( + std::forward(value), + typename boost::is_copy_constructible::type>::type())) +{ + // need to use boost::is_copy_constructible because std::is_copy_constructible is broken on MSVC12 + return boost_bind_rvalue_holder_helper_impl( + std::forward(value), + typename boost::is_copy_constructible::type>::type()); +} + +#endif + + +// ************************************************************************** // +// ************** test_case_gen ************** // +// ************************************************************************** // + +template +class test_case_gen : public test_unit_generator { +public: + // Constructor +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet&& ds ) + : m_tc_name( ut_detail::normalize_test_case_name( tc_name ) ) + , m_tc_file( tc_file ) + , m_tc_line( tc_line ) + , m_tc_index( 0 ) + { + data::for_each_sample( std::forward( ds ), *this ); + } + test_case_gen( test_case_gen&& gen ) + : m_tc_name( gen.m_tc_name ) + , m_tc_file( gen.m_tc_file ) + , m_tc_line( gen.m_tc_line ) + , m_tc_index( gen.m_tc_index ) + , m_test_cases( std::move(gen.m_test_cases) ) + {} +#else + test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet const& ds ) + : m_tc_name( ut_detail::normalize_test_case_name( tc_name ) ) + , m_tc_file( tc_file ) + , m_tc_line( tc_line ) + , m_tc_index( 0 ) + { + data::for_each_sample( ds, *this ); + } +#endif + + virtual test_unit* next() const + { + if( m_test_cases.empty() ) + return 0; + + test_unit* res = m_test_cases.front(); + m_test_cases.pop_front(); + + return res; + } + +#if !defined(BOOST_TEST_DATASET_VARIADIC) + // see BOOST_TEST_DATASET_MAX_ARITY to increase the default supported arity + // there is also a limit on boost::bind +#define TC_MAKE(z,arity,_) \ + template \ + void operator()( BOOST_PP_ENUM_BINARY_PARAMS(arity, Arg, const& arg) ) const \ + { \ + m_test_cases.push_back( new test_case( genTestCaseName(), m_tc_file, m_tc_line, \ + boost::bind( &TestCase::template test_method,\ + BOOST_PP_ENUM_PARAMS(arity, arg) ) ) ); \ + } \ + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_TEST_DATASET_MAX_ARITY, TC_MAKE, _) +#else + template + void operator()(Arg&& ... arg) const + { + m_test_cases.push_back( + new test_case( genTestCaseName(), + m_tc_file, + m_tc_line, + std::bind( &TestCase::template test_method, + boost_bind_rvalue_holder_helper(std::forward(arg))...))); + } +#endif + +private: + std::string genTestCaseName() const + { + return "_" + utils::string_cast(m_tc_index++); + } + + // Data members + std::string m_tc_name; + const_string m_tc_file; + std::size_t m_tc_line; + mutable std::size_t m_tc_index; + mutable std::list m_test_cases; +}; + +//____________________________________________________________________________// + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +template +test_case_gen +make_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet&& ds ) +{ + return test_case_gen( tc_name, tc_file, tc_line, std::forward(ds) ); +} +#else +template +test_case_gen +make_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet const& ds ) +{ + return test_case_gen( tc_name, tc_file, tc_line, ds ); +} +#endif + +//____________________________________________________________________________// + +} // namespace ds_detail + +// ************************************************************************** // +// ************** BOOST_DATA_TEST_CASE ************** // +// ************************************************************************** // + +#define BOOST_DATA_TEST_CASE_PARAM(r, _, i, param) (BOOST_PP_CAT(Arg, i) const& param) +#define BOOST_DATA_TEST_CONTEXT(r, _, param) << BOOST_STRINGIZE(param) << " = " << boost::test_tools::tt_detail::print_helper(param) << "; " + +#define BOOST_DATA_TEST_CASE_PARAMS( params ) \ + BOOST_PP_SEQ_ENUM( \ + BOOST_PP_SEQ_FOR_EACH_I(BOOST_DATA_TEST_CASE_PARAM, _, params)) \ +/**/ + +#define BOOST_DATA_TEST_CASE_IMPL(arity, F, test_name, dataset, params) \ +struct BOOST_PP_CAT(test_name, case) : public F { \ + template \ + static void test_method( BOOST_DATA_TEST_CASE_PARAMS( params ) ) \ + { \ + BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture entry.");\ + BOOST_PP_CAT(test_name, case) t; \ + BOOST_TEST_CHECKPOINT('"' << #test_name << "\" entry."); \ + BOOST_TEST_CONTEXT( "" \ + BOOST_PP_SEQ_FOR_EACH(BOOST_DATA_TEST_CONTEXT, _, params)) \ + t._impl(BOOST_PP_SEQ_ENUM(params)); \ + BOOST_TEST_CHECKPOINT('"' << #test_name << "\" exit."); \ + } \ +private: \ + template \ + void _impl(BOOST_DATA_TEST_CASE_PARAMS( params )); \ +}; \ + \ +BOOST_AUTO_TEST_SUITE( test_name ) \ + \ +BOOST_AUTO_TU_REGISTRAR( BOOST_PP_CAT(test_name, case) )( \ + boost::unit_test::data::ds_detail::make_test_case_gen< \ + BOOST_PP_CAT(test_name, case)>( \ + BOOST_STRINGIZE( test_name ), \ + __FILE__, __LINE__, \ + boost::unit_test::data::ds_detail::seed{} ->* dataset ), \ + boost::unit_test::decorator::collector::instance() ); \ + \ +BOOST_AUTO_TEST_SUITE_END() \ + \ + template \ + void BOOST_PP_CAT(test_name, case)::_impl( \ + BOOST_DATA_TEST_CASE_PARAMS( params ) ) \ +/**/ + +#define BOOST_DATA_TEST_CASE_WITH_PARAMS( F, test_name, dataset, ... ) \ + BOOST_DATA_TEST_CASE_IMPL( BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), \ + F, test_name, dataset, \ + BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) ) \ +/**/ +#define BOOST_DATA_TEST_CASE_NO_PARAMS( F, test_name, dataset ) \ + BOOST_DATA_TEST_CASE_WITH_PARAMS( F, test_name, dataset, sample ) \ +/**/ + +#if BOOST_PP_VARIADICS_MSVC + +#define BOOST_DATA_TEST_CASE( ... ) \ + BOOST_PP_CAT( \ + BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2), \ + BOOST_DATA_TEST_CASE_NO_PARAMS, \ + BOOST_DATA_TEST_CASE_WITH_PARAMS) ( \ + BOOST_AUTO_TEST_CASE_FIXTURE, __VA_ARGS__), ) \ +/**/ + +#define BOOST_DATA_TEST_CASE_F( F, ... ) \ + BOOST_PP_CAT( \ + BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2), \ + BOOST_DATA_TEST_CASE_NO_PARAMS, \ + BOOST_DATA_TEST_CASE_WITH_PARAMS) ( \ + F, __VA_ARGS__), ) \ +/**/ + +#else + +#define BOOST_DATA_TEST_CASE( ... ) \ + BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2), \ + BOOST_DATA_TEST_CASE_NO_PARAMS, \ + BOOST_DATA_TEST_CASE_WITH_PARAMS) ( \ + BOOST_AUTO_TEST_CASE_FIXTURE, __VA_ARGS__) \ +/**/ + +#define BOOST_DATA_TEST_CASE_F( F, ... ) \ + BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2), \ + BOOST_DATA_TEST_CASE_NO_PARAMS, \ + BOOST_DATA_TEST_CASE_WITH_PARAMS) ( \ + F, __VA_ARGS__) \ +/**/ +#endif + +} // namespace data +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_DATA_TEST_CASE_HPP_102211GER + diff --git a/libraries/boost/include/boost/test/debug.hpp b/libraries/boost/include/boost/test/debug.hpp new file mode 100644 index 0000000000..a8ccae0b97 --- /dev/null +++ b/libraries/boost/include/boost/test/debug.hpp @@ -0,0 +1,138 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! @brief defines portable debug interfaces +//! +//! Intended to standardize interface of programs with debuggers +// *************************************************************************** + +#ifndef BOOST_TEST_DEBUG_API_HPP_112006GER +#define BOOST_TEST_DEBUG_API_HPP_112006GER + +// Boost.Test +#include +#include + +// Boost +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +/// Contains debugger and debug C Runtime interfaces +namespace debug { + +/// @defgroup DebuggerInterface Debugger and debug C Runtime portable interfaces +/// @{ +/// These interfaces are intended to be used by application to: +/// - check if we are running under debugger +/// - attach the debugger to itself +/// +/// Unfortunately these actions differ widely between different debuggers available in a field. These interface present generalized standard form of +/// performing these actions. Implementation depends a lot on the environment application is running in and thus there are several custom implementations +/// supported by the Boost.Test +/// +/// In addition here you find interfaces for memory leaks detection and reporting. +/// +/// All these interfaces are defined in namespace boost::debug + +// ************************************************************************** // +/// Checks if programs runs under debugger + +/// @returns true if current process is under debugger. False otherwise +// ************************************************************************** // +bool BOOST_TEST_DECL under_debugger(); + +// ************************************************************************** // +/// Cause program to break execution in debugger at call point +// ************************************************************************** // + +void BOOST_TEST_DECL debugger_break(); + +// ************************************************************************** // +/// Collection of data, which is used by debugger starter routine +// ************************************************************************** // + +struct dbg_startup_info { + long pid; ///< pid of a program to attach to + bool break_or_continue; ///< what to do after debugger is attached + unit_test::const_string binary_path; ///< path to executable for current process + unit_test::const_string display; ///< if debugger has a GUI, which display to use (on UNIX) + unit_test::const_string init_done_lock; ///< path to a uniquely named lock file, which is used to pause current application while debugger is being initialized +}; + +/// Signature of debugger starter routine. Takes an instance of dbg_startup_into as only argument +typedef boost::function dbg_starter; + +// ************************************************************************** // +/// Specifies which debugger to use when attaching and optionally what routine to use to start that debugger + +/// There are many different debuggers available for different platforms. Some of them also can be used in a different setups/configuratins. +/// For example, gdb can be used in plain text mode, inside ddd, inside (x)emacs or in a separate xterm window. +/// Boost.Test identifies each configuration with unique string. +/// Also different debuggers configurations require different routines which is specifically tailored to start that debugger configuration. +/// Boost.Test comes with set of predefined configuration names and corresponding routines for these configurations: +/// - TODO +/// +/// You can use this routine to select which one of the predefined debugger configurations to use in which case you do not need to provide starter +/// routine (the one provided by Boost.Test will be used). You can also use this routine to select your own debugger by providing unique configuration +/// id and starter routine for this configuration. +/// +/// @param[in] dbg_id Unique id for debugger configuration (for example, gdb) +/// @param[in] s Optional starter routine for selected configuration (use only you want to define your own configuration) +/// @returns Id of previously selected debugger configuration +std::string BOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id, dbg_starter s = dbg_starter() ); + +// ************************************************************************** // +/// Attaches debugger to the current process + +/// Using currently selected debugger, this routine attempts to attach the debugger to this process. +/// @param[in] break_or_continue tells what we wan to do after the debugger is attached. If true - process execution breaks +/// in the point in invocation of this function. Otherwise execution continues, but now it is +/// under the debugger +/// @returns true if debugger successfully attached. False otherwise +// ************************************************************************** // + +bool BOOST_TEST_DECL attach_debugger( bool break_or_continue = true ); + +// ************************************************************************** // +/// Switches on/off memory leaks detection + +/// On platforms where memory leak detection is possible inside of running application (at the moment this is only Windows family) you can +/// switch this feature on and off using this interface. In addition you can specify the name of the file to write a report into. Otherwise +/// the report is going to be generated in standard error stream. +/// @param[in] on_off boolean switch +/// @param[in] report_file file, where the report should be directed to +// ************************************************************************** // + +void BOOST_TEST_DECL detect_memory_leaks( bool on_off, unit_test::const_string report_file = unit_test::const_string() ); + +// ************************************************************************** // +/// Causes program to break execution in debugger at specific allocation point + +/// On some platforms/memory managers (at the moment only on Windows/Visual Studio) one can tell a C Runtime to break +/// on specific memory allocation. This can be used in combination with memory leak detection (which reports leaked memory +/// allocation number) to locate the place where leak initiated. +/// @param[in] mem_alloc_order_num Specific memory allocation number +// ************************************************************************** // + +void BOOST_TEST_DECL break_memory_alloc( long mem_alloc_order_num ); + +} // namespace debug +/// @} + +} // namespace boost + +#include + +#endif diff --git a/libraries/boost/include/boost/test/debug_config.hpp b/libraries/boost/include/boost/test/debug_config.hpp new file mode 100644 index 0000000000..894d78e65a --- /dev/null +++ b/libraries/boost/include/boost/test/debug_config.hpp @@ -0,0 +1,24 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! @brief user's config for Boost.Test debugging support +//! +//! This file is intended to be edited by end user to specify varios macros, which configure debugger interface +//! Alterntively you can set these parameters in your own sources/makefiles +// *************************************************************************** + +#ifndef BOOST_TEST_DEBUG_CONFIG_HPP_112006GER +#define BOOST_TEST_DEBUG_CONFIG_HPP_112006GER + +// ';' separated list of supported debuggers +// #define BOOST_TEST_DBG_LIST gdb;dbx + +// maximum size of /proc/pid/stat file +// #define BOOST_TEST_STAT_LINE_MAX + +#endif diff --git a/libraries/boost/include/boost/test/detail/config.hpp b/libraries/boost/include/boost/test/detail/config.hpp new file mode 100644 index 0000000000..db9b5d2b92 --- /dev/null +++ b/libraries/boost/include/boost/test/detail/config.hpp @@ -0,0 +1,127 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief a central place for global configuration switches +// *************************************************************************** + +#ifndef BOOST_TEST_CONFIG_HPP_071894GER +#define BOOST_TEST_CONFIG_HPP_071894GER + +// Boost +#include // compilers workarounds +#include + +#if defined(_WIN32) && !defined(BOOST_DISABLE_WIN32) && \ + (!defined(__COMO__) && !defined(__MWERKS__) && !defined(__GNUC__) || \ + BOOST_WORKAROUND(__MWERKS__, >= 0x3000)) +# define BOOST_SEH_BASED_SIGNAL_HANDLING +#endif + +#if defined(__COMO__) && defined(_MSC_VER) +// eh.h uses type_info without declaring it. +class type_info; +# define BOOST_SEH_BASED_SIGNAL_HANDLING +#endif + +//____________________________________________________________________________// + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)) || \ + BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) || \ + (defined __sgi && BOOST_WORKAROUND(_COMPILER_VERSION, BOOST_TESTED_AT(730))) +# define BOOST_TEST_SHIFTED_LINE +#endif + +//____________________________________________________________________________// + +#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)) +# define BOOST_TEST_CALL_DECL __cdecl +#else +# define BOOST_TEST_CALL_DECL /**/ +#endif + +//____________________________________________________________________________// + +#if !defined(BOOST_NO_STD_LOCALE) && !defined(__MWERKS__) +# define BOOST_TEST_USE_STD_LOCALE 1 +#endif + +//____________________________________________________________________________// + +#if BOOST_WORKAROUND(__BORLANDC__, <= 0x570) || \ + BOOST_WORKAROUND( __COMO__, <= 0x433 ) || \ + BOOST_WORKAROUND( __INTEL_COMPILER, <= 800 ) || \ + defined(__sgi) && _COMPILER_VERSION <= 730 || \ + BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) || \ + defined(__DECCXX) || \ + defined(__DMC__) +# define BOOST_TEST_NO_PROTECTED_USING +#endif + +//____________________________________________________________________________// + +#if defined(__GNUC__) || BOOST_WORKAROUND(BOOST_MSVC, == 1400) +#define BOOST_TEST_PROTECTED_VIRTUAL virtual +#else +#define BOOST_TEST_PROTECTED_VIRTUAL +#endif + +//____________________________________________________________________________// + +#if !defined(__BORLANDC__) && !BOOST_WORKAROUND( __SUNPRO_CC, < 0x5100 ) +#define BOOST_TEST_SUPPORT_TOKEN_ITERATOR 1 +#endif + +//____________________________________________________________________________// + +#if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_TEST_DYN_LINK) +# define BOOST_TEST_DYN_LINK +#endif + +#if defined(BOOST_TEST_INCLUDED) +# undef BOOST_TEST_DYN_LINK +#endif + +#if defined(BOOST_TEST_DYN_LINK) +# define BOOST_TEST_ALTERNATIVE_INIT_API + +# ifdef BOOST_TEST_SOURCE +# define BOOST_TEST_DECL BOOST_SYMBOL_EXPORT +# else +# define BOOST_TEST_DECL BOOST_SYMBOL_IMPORT +# endif // BOOST_TEST_SOURCE +#else +# define BOOST_TEST_DECL +#endif + +#if !defined(BOOST_TEST_MAIN) && defined(BOOST_AUTO_TEST_MAIN) +#define BOOST_TEST_MAIN BOOST_AUTO_TEST_MAIN +#endif + +#if !defined(BOOST_TEST_MAIN) && defined(BOOST_TEST_MODULE) +#define BOOST_TEST_MAIN BOOST_TEST_MODULE +#endif + + + +#ifndef BOOST_PP_VARIADICS /* we can change this only if not already defined) */ + +#ifdef __PGI +#define BOOST_PP_VARIADICS 1 +#endif + +#if BOOST_CLANG +#define BOOST_PP_VARIADICS 1 +#endif + +#if defined(BOOST_GCC) && (BOOST_GCC >= 4 * 10000 + 8 * 100) +#define BOOST_PP_VARIADICS 1 +#endif + +#endif /* ifndef BOOST_PP_VARIADICS */ + +#endif // BOOST_TEST_CONFIG_HPP_071894GER diff --git a/libraries/boost/include/boost/test/detail/enable_warnings.hpp b/libraries/boost/include/boost/test/detail/enable_warnings.hpp new file mode 100644 index 0000000000..45afb31944 --- /dev/null +++ b/libraries/boost/include/boost/test/detail/enable_warnings.hpp @@ -0,0 +1,36 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief enable previously suppressed warnings +// *************************************************************************** + +#ifdef BOOST_MSVC +# pragma warning(default: 4511) // copy constructor can't not be generated +# pragma warning(default: 4512) // assignment operator can't not be generated +# pragma warning(default: 4100) // unreferenced formal parameter +# pragma warning(default: 4996) // was declared deprecated +# pragma warning(default: 4355) // 'this' : used in base member initializer list +# pragma warning(default: 4706) // assignment within conditional expression +# pragma warning(default: 4251) // class 'A' needs to have dll-interface to be used by clients of class 'B' +# pragma warning(default: 4127) // conditional expression is constant +# pragma warning(default: 4290) // C++ exception specification ignored except to ... +# pragma warning(default: 4180) // qualifier applied to function type has no meaning; ignored +# pragma warning(default: 4275) // non dll-interface class ... used as base for dll-interface class ... +# pragma warning(default: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data +# pragma warning(default: 4511) // 'class' : copy constructor could not be generated +# pragma warning(pop) +#endif + +#if BOOST_CLANG +#pragma clang diagnostic pop +#endif + +#if defined(BOOST_GCC) && (BOOST_GCC >= 4 * 10000 + 6 * 100) +# pragma GCC diagnostic pop +#endif + diff --git a/libraries/boost/include/boost/test/detail/fwd_decl.hpp b/libraries/boost/include/boost/test/detail/fwd_decl.hpp new file mode 100644 index 0000000000..d5c97fb706 --- /dev/null +++ b/libraries/boost/include/boost/test/detail/fwd_decl.hpp @@ -0,0 +1,46 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief contains forward eclarations for Boost.Test data types +// *************************************************************************** + +#ifndef BOOST_TEST_FWD_DECL_HPP_011605GER +#define BOOST_TEST_FWD_DECL_HPP_011605GER + +namespace boost { + +class execution_monitor; +class execution_exception; + +namespace unit_test { + +class test_unit; +class test_case; +class test_suite; +class master_test_suite_t; + +class test_tree_visitor; +class test_observer; +class test_unit_fixture; + +// singletons +class unit_test_monitor_t; +class unit_test_log_t; + +class unit_test_log_formatter; +struct log_entry_data; +struct log_checkpoint_data; + +class lazy_ostream; + +} // namespace unit_test + +} // namespace boost + +#endif // BOOST_TEST_FWD_DECL_HPP_011605GER + diff --git a/libraries/boost/include/boost/test/detail/global_typedef.hpp b/libraries/boost/include/boost/test/detail/global_typedef.hpp new file mode 100644 index 0000000000..aeede00e9c --- /dev/null +++ b/libraries/boost/include/boost/test/detail/global_typedef.hpp @@ -0,0 +1,111 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief some trivial global typedefs +// *************************************************************************** + +#ifndef BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER +#define BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER + +#include +#include + +#define BOOST_TEST_L( s ) ::boost::unit_test::const_string( s, sizeof( s ) - 1 ) +#define BOOST_TEST_STRINGIZE( s ) BOOST_TEST_L( BOOST_STRINGIZE( s ) ) +#define BOOST_TEST_EMPTY_STRING BOOST_TEST_L( "" ) + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +typedef unsigned long counter_t; + +//____________________________________________________________________________// + +enum report_level { INV_REPORT_LEVEL, CONFIRMATION_REPORT, SHORT_REPORT, DETAILED_REPORT, NO_REPORT }; + +//____________________________________________________________________________// + +//! Indicates the output format for the loggers or the test tree printing +enum output_format { OF_INVALID, + OF_CLF, ///< compiler log format + OF_XML, ///< XML format for report and log, + OF_JUNIT, ///< JUNIT format for report and log, + OF_CUSTOM_LOGGER, ///< User specified logger. + OF_DOT ///< dot format for output content +}; + +//____________________________________________________________________________// + +enum test_unit_type { TUT_CASE = 0x01, TUT_SUITE = 0x10, TUT_ANY = 0x11 }; + +//____________________________________________________________________________// + +enum assertion_result { AR_FAILED, AR_PASSED, AR_TRIGGERED }; + +//____________________________________________________________________________// + +typedef unsigned long test_unit_id; + +const test_unit_id INV_TEST_UNIT_ID = 0xFFFFFFFF; +const test_unit_id MAX_TEST_CASE_ID = 0xFFFFFFFE; +const test_unit_id MIN_TEST_CASE_ID = 0x00010000; +const test_unit_id MAX_TEST_SUITE_ID = 0x0000FF00; +const test_unit_id MIN_TEST_SUITE_ID = 0x00000001; + +//____________________________________________________________________________// + +namespace ut_detail { + +inline test_unit_type +test_id_2_unit_type( test_unit_id id ) +{ + return (id & 0xFFFF0000) != 0 ? TUT_CASE : TUT_SUITE; +} + +//! Helper class for restoring the current test unit ID in a RAII manner +struct test_unit_id_restore { + test_unit_id_restore(test_unit_id& to_restore_, test_unit_id new_value) + : to_restore(to_restore_) + , bkup(to_restore_) { + to_restore = new_value; + } + ~test_unit_id_restore() { + to_restore = bkup; + } +private: + test_unit_id& to_restore; + test_unit_id bkup; +}; + +//____________________________________________________________________________// + +} // namespace ut_detail + +// helper templates to prevent ODR violations +template +struct static_constant { + static T value; +}; + +template +T static_constant::value; + +//____________________________________________________________________________// + +} // namespace unit_test +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER diff --git a/libraries/boost/include/boost/test/detail/log_level.hpp b/libraries/boost/include/boost/test/detail/log_level.hpp new file mode 100644 index 0000000000..abdecea7ec --- /dev/null +++ b/libraries/boost/include/boost/test/detail/log_level.hpp @@ -0,0 +1,40 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief shared definition for unit test log levels +// *************************************************************************** + +#ifndef BOOST_TEST_LOG_LEVEL_HPP_011605GER +#define BOOST_TEST_LOG_LEVEL_HPP_011605GER + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** log levels ************** // +// ************************************************************************** // + +// each log level includes all subsequent higher loging levels +enum log_level { + invalid_log_level = -1, + log_successful_tests = 0, + log_test_units = 1, + log_messages = 2, + log_warnings = 3, + log_all_errors = 4, // reported by unit test macros + log_cpp_exception_errors = 5, // uncaught C++ exceptions + log_system_errors = 6, // including timeouts, signals, traps + log_fatal_errors = 7, // including unit test macros or + // fatal system errors + log_nothing = 8 +}; + +} // namespace unit_test +} // namespace boost + +#endif // BOOST_TEST_LOG_LEVEL_HPP_011605GER diff --git a/libraries/boost/include/boost/test/detail/pp_variadic.hpp b/libraries/boost/include/boost/test/detail/pp_variadic.hpp new file mode 100644 index 0000000000..a443744daa --- /dev/null +++ b/libraries/boost/include/boost/test/detail/pp_variadic.hpp @@ -0,0 +1,49 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief few helpers for working with variadic macros +// *************************************************************************** + +#ifndef BOOST_TEST_PP_VARIADIC_HPP_021515GER +#define BOOST_TEST_PP_VARIADIC_HPP_021515GER + +// Boost +#include +#include +#include + +//____________________________________________________________________________// + +#if BOOST_PP_VARIADICS + +#if BOOST_PP_VARIADICS_MSVC +# define BOOST_TEST_INVOKE_VARIADIC( tool, ... ) BOOST_PP_CAT( tool (__VA_ARGS__), ) +#else +# define BOOST_TEST_INVOKE_VARIADIC( tool, ... ) tool (__VA_ARGS__) +#endif + +//____________________________________________________________________________// + +/// if sizeof(__VA_ARGS__) == N: F1(__VA_ARGS__) +/// else: F2(__VA_ARGS__) +#define BOOST_TEST_INVOKE_IF_N_ARGS( N, F1, F2, ... ) \ + BOOST_TEST_INVOKE_VARIADIC( \ + BOOST_PP_IIF( \ + BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), N), \ + F1, \ + F2), \ + __VA_ARGS__ ) \ +/**/ + +//____________________________________________________________________________// + +#endif /* BOOST_PP_VARIADICS */ + +#endif // BOOST_TEST_PP_VARIADIC_HPP_021515GER + +// EOF diff --git a/libraries/boost/include/boost/test/detail/suppress_warnings.hpp b/libraries/boost/include/boost/test/detail/suppress_warnings.hpp new file mode 100644 index 0000000000..4badf20758 --- /dev/null +++ b/libraries/boost/include/boost/test/detail/suppress_warnings.hpp @@ -0,0 +1,38 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief suppress some warnings +// *************************************************************************** + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4511) // copy constructor can't not be generated +# pragma warning(disable: 4512) // assignment operator can't not be generated +# pragma warning(disable: 4100) // unreferenced formal parameter +# pragma warning(disable: 4996) // was declared deprecated +# pragma warning(disable: 4355) // 'this' : used in base member initializer list +# pragma warning(disable: 4706) // assignment within conditional expression +# pragma warning(disable: 4251) // class 'A' needs to have dll-interface to be used by clients of class 'B' +# pragma warning(disable: 4127) // conditional expression is constant +# pragma warning(disable: 4290) // C++ exception specification ignored except to ... +# pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored +# pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ... +# pragma warning(disable: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data +# pragma warning(disable: 4511) // 'class' : copy constructor could not be generated +#endif + +#if BOOST_CLANG +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wvariadic-macros" +#endif + +#if defined(BOOST_GCC) && (BOOST_GCC >= 4 * 10000 + 6 * 100) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wvariadic-macros" +#endif + diff --git a/libraries/boost/include/boost/test/detail/throw_exception.hpp b/libraries/boost/include/boost/test/detail/throw_exception.hpp new file mode 100644 index 0000000000..3f2f4687d3 --- /dev/null +++ b/libraries/boost/include/boost/test/detail/throw_exception.hpp @@ -0,0 +1,71 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief contains wrappers, which allows to build Boost.Test with no exception +// *************************************************************************** + +#ifndef BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP +#define BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP + +// Boost +#include // BOOST_NO_EXCEPTIONS + +#ifdef BOOST_NO_EXCEPTIONS +// C RUNTIME +#include + +#endif + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace ut_detail { + +#ifdef BOOST_NO_EXCEPTIONS + +template +BOOST_NORETURN inline void +throw_exception(E const& e) { abort(); } + +#define BOOST_TEST_I_TRY +#define BOOST_TEST_I_CATCH( T, var ) for(T const& var = *(T*)0; false;) +#define BOOST_TEST_I_CATCH0( T ) if(0) +#define BOOST_TEST_I_CATCHALL() if(0) +#define BOOST_TEST_I_RETHROW + +#else + +template +BOOST_NORETURN inline void +throw_exception(E const& e) { throw e; } + +#define BOOST_TEST_I_TRY try +#define BOOST_TEST_I_CATCH( T, var ) catch( T const& var ) +#define BOOST_TEST_I_CATCH0( T ) catch( T const& ) +#define BOOST_TEST_I_CATCHALL() catch(...) +#define BOOST_TEST_I_RETHROW throw +#endif + +//____________________________________________________________________________// + +#define BOOST_TEST_I_THROW( E ) unit_test::ut_detail::throw_exception( E ) +#define BOOST_TEST_I_ASSRT( cond, ex ) if( cond ) {} else BOOST_TEST_I_THROW( ex ) + + +} // namespace ut_detail +} // namespace unit_test +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP diff --git a/libraries/boost/include/boost/test/detail/workaround.hpp b/libraries/boost/include/boost/test/detail/workaround.hpp new file mode 100644 index 0000000000..4ba3a7e934 --- /dev/null +++ b/libraries/boost/include/boost/test/detail/workaround.hpp @@ -0,0 +1,56 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief contains mics. workarounds +// *************************************************************************** + +#ifndef BOOST_TEST_WORKAROUND_HPP_021005GER +#define BOOST_TEST_WORKAROUND_HPP_021005GER + +// Boost +#include // compilers workarounds and std::ptrdiff_t + +// STL +#include // for std::distance + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace ut_detail { + +#ifdef BOOST_NO_STD_DISTANCE +template +std::ptrdiff_t distance( T const& x_, T const& y_ ) +{ + std::ptrdiff_t res = 0; + + std::distance( x_, y_, res ); + + return res; +} + +//____________________________________________________________________________// + +#else +using std::distance; +#endif + +template inline void ignore_unused_variable_warning(const T&) {} + +} // namespace ut_detail +} // namespace unit_test +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_WORKAROUND_HPP_021005GER diff --git a/libraries/boost/include/boost/test/execution_monitor.hpp b/libraries/boost/include/boost/test/execution_monitor.hpp new file mode 100644 index 0000000000..ed06ef254e --- /dev/null +++ b/libraries/boost/include/boost/test/execution_monitor.hpp @@ -0,0 +1,579 @@ +// (C) Copyright Gennadiy Rozental 2001. +// (C) Copyright Beman Dawes 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief Defines public interface of the Execution Monitor and related classes +// *************************************************************************** + +#ifndef BOOST_TEST_EXECUTION_MONITOR_HPP_071894GER +#define BOOST_TEST_EXECUTION_MONITOR_HPP_071894GER + +// Boost.Test +#include +#include +#include + +#include + +// Boost +#include +#include +#include +#include +#include + +#include + +#ifdef BOOST_SEH_BASED_SIGNAL_HANDLING + +// for the FP constants and control routines +#include + +#ifndef EM_INVALID +#define EM_INVALID _EM_INVALID +#endif + +#ifndef EM_DENORMAL +#define EM_DENORMAL _EM_DENORMAL +#endif + +#ifndef EM_ZERODIVIDE +#define EM_ZERODIVIDE _EM_ZERODIVIDE +#endif + +#ifndef EM_OVERFLOW +#define EM_OVERFLOW _EM_OVERFLOW +#endif + +#ifndef EM_UNDERFLOW +#define EM_UNDERFLOW _EM_UNDERFLOW +#endif + +#ifndef MCW_EM +#define MCW_EM _MCW_EM +#endif + +#else // based on ISO C standard + +#if !defined(BOOST_NO_FENV_H) + #include +#endif + +#endif + +#if defined(BOOST_SEH_BASED_SIGNAL_HANDLING) && !defined(UNDER_CE) + //! Indicates tha the floating point exception handling is supported + //! through SEH + #define BOOST_TEST_FPE_SUPPORT_WITH_SEH__ +#elif !defined(BOOST_SEH_BASED_SIGNAL_HANDLING) && !defined(UNDER_CE) + #if !defined(BOOST_NO_FENV_H) && !defined(BOOST_CLANG) && \ + defined(__GLIBC__) && defined(__USE_GNU) && \ + !(defined(__UCLIBC__) || defined(__nios2__) || defined(__microblaze__)) + //! Indicates that floating point exception handling is supported for the + //! non SEH version of it, for the GLIBC extensions only + // see dicussions on the related topic: https://svn.boost.org/trac/boost/ticket/11756 + #define BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__ + #endif +#endif + + +// Additional macro documentations not being generated without this hack +#ifdef BOOST_TEST_DOXYGEN_DOC__ + +//! Disables the support of the alternative stack +//! during the compilation of the Boost.test framework. This is especially useful +//! in case it is not possible to detect the lack of alternative stack support for +//! your compiler (for instance, ESXi). +#define BOOST_TEST_DISABLE_ALT_STACK + +#endif + +//____________________________________________________________________________// + +namespace boost { + +/// @defgroup ExecutionMonitor Function Execution Monitor +/// @{ +/// @section Intro Introduction +/// Sometimes we need to call a function and make sure that no user or system originated exceptions are being thrown by it. Uniform exception reporting +/// is also may be convenient. That's the purpose of the Boost.Test's Execution Monitor. +/// +/// The Execution Monitor is a lower-level component of the Boost Test Library. It is the base for implementing all other Boost.Test components, but also +/// can be used standalone to get controlled execution of error-prone functions with a uniform error notification. The Execution Monitor calls a user-supplied +/// function in a controlled environment, relieving users from messy error detection. +/// +/// The Execution Monitor usage is demonstrated in the example exec_mon_example. +/// +/// @section DesignRationale Design Rationale +/// +/// The Execution Monitor design assumes that it can be used when no (or almost no) memory available. Also the Execution Monitor is intended to be portable to as many platforms as possible. +/// +/// @section UserGuide User's guide +/// The Execution Monitor is designed to solve the problem of executing potentially dangerous function that may result in any number of error conditions, +/// in monitored environment that should prevent any undesirable exceptions to propagate out of function call and produce consistent result report for all outcomes. +/// The Execution Monitor is able to produce informative report for all standard C++ exceptions and intrinsic types. All other exceptions are reported as unknown. +/// If you prefer different message for your exception type or need to perform any action, the Execution Monitor supports custom exception translators. +/// There are several other parameters of the monitored environment can be configured by setting appropriate properties of the Execution Monitor. +/// +/// All symbols in the Execution Monitor implementation are located in the namespace boost. To use the Execution Monitor you need to: +/// -# include @c boost/test/execution_monitor.hpp +/// -# Make an instance of execution_monitor. +/// -# Optionally register custom exception translators for exception classes which require special processing. +/// +/// @subsection FuncExec Monitored function execution +/// +/// The class execution_monitor can monitor functions with the following signatures: +/// - int () +/// - void () +/// +/// This function is expected to be self sufficient part of your application. You can't pass any arguments to this function directly. Instead you +/// should bind them into executable nullary function using bind function (either standard or boost variant). Neither you can return any other value, +/// but an integer result code. If necessary you can bind output parameters by reference or use some other more complicated nullary functor, which +/// maintains state. This includes class methods, static class methods etc. +/// +/// To start the monitored function, invoke the method execution_monitor::execute and pass the monitored function as an argument. If the call succeeds, +/// the method returns the result code produced by the monitored function. If any of the following conditions occur: +/// - Uncaught C++ exception +/// - Hardware or software signal, trap, or other exception +/// - Timeout reached +/// - Debug assert event occurred (under Microsoft Visual C++ or compatible compiler) +/// +/// then the method throws the execution_exception. The exception contains unique error_code value identifying the error condition and the detailed message +/// that can be used to report the error. +/// +/// @subsection Reporting Errors reporting and translation +/// +/// If you need to report an error inside monitored function execution you have to throw an exception. Do not use the execution_exception - it's not intended +/// to be used for this purpose. The simplest choice is to use one of the following C++ types as an exception: +/// - C string +/// - std:string +/// - any exception class in std::exception hierarchy +/// - boost::exception +/// +/// execution_monitor will catch and report these types of exceptions. If exception is thrown which is unknown to execution_monitor, it can only +/// report the fact of the exception. So in case if you prefer to use your own exception types or can't govern what exceptions are generated by monitored +/// function and would like to see proper error message in a report, execution_monitor can be configured with custom "translator" routine, which will have +/// a chance to either record the fact of the exception itself or translate it into one of standard exceptions and rethrow (or both). The translator routine +/// is registered per exception type and is invoked when exception of this class (or one inherited from it) is thrown inside monitored routine. You can +/// register as many independent translators as you like. See execution_monitor::register_exception_translator specification for requirements on translator +/// function. +/// +/// Finally, if you need to abort the monitored function execution without reporting any errors, you can throw an exception execution_aborted. As a result +/// the execution is aborted and zero result code is produced by the method execution_monitor::execute. +/// +/// @subsection Parameters Supported parameters +/// +/// The Execution Monitor behavior is configurable through the set of parameters (properties) associated with the instance of the monitor. See execution_monitor +/// specification for a list of supported parameters and their semantic. + +// ************************************************************************** // +// ************** detail::translator_holder_base ************** // +// ************************************************************************** // + +namespace detail { + +class translator_holder_base; +typedef boost::shared_ptr translator_holder_base_ptr; + +class BOOST_TEST_DECL translator_holder_base { +protected: + typedef boost::unit_test::const_string const_string; +public: + // Constructor + translator_holder_base( translator_holder_base_ptr next, const_string tag ) + : m_next( next ) + , m_tag( std::string() + tag ) + { + } + + // Destructor + virtual ~translator_holder_base() {} + + // translator holder interface + // invokes the function F inside the try/catch guarding against specific exception + virtual int operator()( boost::function const& F ) = 0; + + // erases specific translator holder from the chain + translator_holder_base_ptr erase( translator_holder_base_ptr this_, const_string tag ) + { + if( m_next ) + m_next = m_next->erase( m_next, tag ); + + return m_tag == tag ? m_next : this_; + } +#ifndef BOOST_NO_RTTI + virtual translator_holder_base_ptr erase( translator_holder_base_ptr this_, std::type_info const& ) = 0; + template + translator_holder_base_ptr erase( translator_holder_base_ptr this_, boost::type* = 0 ) + { + if( m_next ) + m_next = m_next->erase( m_next ); + + return erase( this_, typeid(ExceptionType) ); + } +#endif + +protected: + // Data members + translator_holder_base_ptr m_next; + std::string m_tag; +}; + +} // namespace detail + +// ************************************************************************** // +/// @class execution_exception +/// @brief This class is used to report any kind of an failure during execution of a monitored function inside of execution_monitor +/// +/// The instance of this class is thrown out of execution_monitor::execute invocation when failure is detected. Regardless of a kind of failure occurred +/// the instance will provide a uniform way to catch and report it. +/// +/// One important design rationale for this class is that we should be ready to work after fatal memory corruptions or out of memory conditions. To facilitate +/// this class never allocates any memory and assumes that strings it refers to are either some constants or live in a some kind of persistent (preallocated) memory. +// ************************************************************************** // + +class BOOST_TEST_DECL execution_exception { + typedef boost::unit_test::const_string const_string; +public: + /// These values are sometimes used as program return codes. + /// The particular values have been chosen to avoid conflicts with + /// commonly used program return codes: values < 100 are often user + /// assigned, values > 255 are sometimes used to report system errors. + /// Gaps in values allow for orderly expansion. + /// + /// @note(1) Only uncaught C++ exceptions are treated as errors. + /// If a function catches a C++ exception, it never reaches + /// the execution_monitor. + /// + /// The implementation decides what is a system_fatal_error and what is + /// just a system_exception. Fatal errors are so likely to have corrupted + /// machine state (like a stack overflow or addressing exception) that it + /// is unreasonable to continue execution. + /// + /// @note(2) These errors include Unix signals and Windows structured + /// exceptions. They are often initiated by hardware traps. + enum error_code { + no_error = 0, ///< for completeness only; never returned + user_error = 200, ///< user reported non-fatal error + cpp_exception_error = 205, ///< see note (1) above + system_error = 210, ///< see note (2) above + timeout_error = 215, ///< only detectable on certain platforms + user_fatal_error = 220, ///< user reported fatal error + system_fatal_error = 225 ///< see note (2) above + }; + + /// Simple model for the location of failure in a source code + struct BOOST_TEST_DECL location { + explicit location( char const* file_name = 0, size_t line_num = 0, char const* func = 0 ); + explicit location( const_string file_name, size_t line_num = 0, char const* func = 0 ); + + const_string m_file_name; ///< File name + size_t m_line_num; ///< Line number + const_string m_function; ///< Function name + }; + + /// @name Constructors + + /// Constructs instance based on message, location and error code + + /// @param[in] ec error code + /// @param[in] what_msg error message + /// @param[in] location error location + execution_exception( error_code ec, const_string what_msg, location const& location ); + + /// @name Access methods + + /// Exception error code + error_code code() const { return m_error_code; } + /// Exception message + const_string what() const { return m_what; } + /// Exception location + location const& where() const { return m_location; } + ///@} + +private: + // Data members + error_code m_error_code; + const_string m_what; + location m_location; +}; // execution_exception + +// ************************************************************************** // +/// @brief Function execution monitor + +/// This class is used to uniformly detect and report an occurrence of several types of signals and exceptions, reducing various +/// errors to a uniform execution_exception that is returned to a caller. +/// +/// The executiom_monitor behavior can be customized through a set of public parameters (properties) associated with the execution_monitor instance. +/// All parameters are implemented as public unit_test::readwrite_property data members of the class execution_monitor. +// ************************************************************************** // + +class BOOST_TEST_DECL execution_monitor { + typedef boost::unit_test::const_string const_string; +public: + + /// Default constructor initializes all execution monitor properties + execution_monitor(); + + /// Should monitor catch system errors. + /// + /// The @em p_catch_system_errors property is a boolean flag (default value is true) specifying whether or not execution_monitor should trap system + /// errors/system level exceptions/signals, which would cause program to crash in a regular case (without execution_monitor). + /// Set this property to false, for example, if you wish to force coredump file creation. The Unit Test Framework provides a + /// runtime parameter @c \-\-catch_system_errors=yes to alter the behavior in monitored test cases. + unit_test::readwrite_property p_catch_system_errors; + + /// Should monitor try to attach debugger in case of caught system error. + /// + /// The @em p_auto_start_dbg property is a boolean flag (default value is false) specifying whether or not execution_monitor should try to attach debugger + /// in case system error is caught. + unit_test::readwrite_property p_auto_start_dbg; + + + /// Specifies the seconds that elapse before a timer_error occurs. + /// + /// The @em p_timeout property is an integer timeout (in seconds) for monitored function execution. Use this parameter to monitor code with possible deadlocks + /// or indefinite loops. This feature is only available for some operating systems (not yet Microsoft Windows). + unit_test::readwrite_property p_timeout; + + /// Should monitor use alternative stack for the signal catching. + /// + /// The @em p_use_alt_stack property is a boolean flag (default value is false) specifying whether or not execution_monitor should use an alternative stack + /// for the sigaction based signal catching. When enabled the signals are delivered to the execution_monitor on a stack different from current execution + /// stack, which is safer in case if it is corrupted by monitored function. For more details on alternative stack handling see appropriate manuals. + unit_test::readwrite_property p_use_alt_stack; + + /// Should monitor try to detect hardware floating point exceptions (!= 0), and which specific exception to catch. + /// + /// The @em p_detect_fp_exceptions property is a boolean flag (default value is false) specifying whether or not execution_monitor should install hardware + /// traps for the floating point exception on platforms where it's supported. + unit_test::readwrite_property p_detect_fp_exceptions; + + + // @name Monitoring entry points + + /// @brief Execution monitor entry point for functions returning integer value + /// + /// This method executes supplied function F inside a try/catch block and also may include other unspecified platform dependent error detection code. + /// + /// This method throws an execution_exception on an uncaught C++ exception, a hardware or software signal, trap, or other user exception. + /// + /// @note execute() doesn't consider it an error for F to return a non-zero value. + /// @param[in] F Function to monitor + /// @returns value returned by function call F(). + /// @see vexecute + int execute( boost::function const& F ); + + /// @brief Execution monitor entry point for functions returning void + /// + /// This method is semantically identical to execution_monitor::execute, but des't produce any result code. + /// @param[in] F Function to monitor + /// @see execute + void vexecute( boost::function const& F ); + // @} + + // @name Exception translator registration + + /// @brief Registers custom (user supplied) exception translator + + /// This method template registers a translator for an exception type specified as a first template argument. For example + /// @code + /// void myExceptTr( MyException const& ex ) { /*do something with the exception here*/} + /// em.register_exception_translator( myExceptTr ); + /// @endcode + /// The translator should be any unary function/functor object which accepts MyException const&. This can be free standing function + /// or bound class method. The second argument is an optional string tag you can associate with this translator routine. The only reason + /// to specify the tag is if you plan to erase the translator eventually. This can be useful in scenario when you reuse the same + /// execution_monitor instance to monitor different routines and need to register a translator specific to the routine being monitored. + /// While it is possible to erase the translator based on an exception type it was registered for, tag string provides simpler way of doing this. + /// @tparam ExceptionType type of the exception we register a translator for + /// @tparam ExceptionTranslator type of the translator we register for this exception + /// @param[in] tr translator function object with the signature void (ExceptionType const&) + /// @param[in] tag tag associated with this translator + template + void register_exception_translator( ExceptionTranslator const& tr, const_string tag = const_string(), boost::type* = 0 ); + + /// @brief Erases custom exception translator based on a tag + + /// Use the same tag as the one used during translator registration + /// @param[in] tag tag associated with translator you wants to erase + void erase_exception_translator( const_string tag ) + { + m_custom_translators = m_custom_translators->erase( m_custom_translators, tag ); + } +#ifndef BOOST_NO_RTTI + /// @brief Erases custom exception translator based on an exception type + /// + /// tparam ExceptionType Exception type for which you want to erase the translator + template + void erase_exception_translator( boost::type* = 0 ) + { + m_custom_translators = m_custom_translators->erase( m_custom_translators ); + } + //@} +#endif + +private: + // implementation helpers + int catch_signals( boost::function const& F ); + + // Data members + detail::translator_holder_base_ptr m_custom_translators; + boost::scoped_array m_alt_stack; +}; // execution_monitor + +// ************************************************************************** // +// ************** detail::translator_holder ************** // +// ************************************************************************** // + +namespace detail { + +template +class translator_holder : public translator_holder_base +{ +public: + explicit translator_holder( ExceptionTranslator const& tr, translator_holder_base_ptr& next, const_string tag = const_string() ) + : translator_holder_base( next, tag ), m_translator( tr ) {} + + // translator holder interface + virtual int operator()( boost::function const& F ) + { + BOOST_TEST_I_TRY { + return m_next ? (*m_next)( F ) : F(); + } + BOOST_TEST_I_CATCH( ExceptionType, e ) { + m_translator( e ); + return boost::exit_exception_failure; + } + } +#ifndef BOOST_NO_RTTI + virtual translator_holder_base_ptr erase( translator_holder_base_ptr this_, std::type_info const& ti ) + { + return ti == typeid(ExceptionType) ? m_next : this_; + } +#endif + +private: + // Data members + ExceptionTranslator m_translator; +}; + +} // namespace detail + +template +void +execution_monitor::register_exception_translator( ExceptionTranslator const& tr, const_string tag, boost::type* ) +{ + m_custom_translators.reset( + new detail::translator_holder( tr, m_custom_translators, tag ) ); +} + +// ************************************************************************** // +/// @class execution_aborted +/// @brief This is a trivial default constructible class. Use it to report graceful abortion of a monitored function execution. +// ************************************************************************** // + +struct execution_aborted {}; + +// ************************************************************************** // +// ************** system_error ************** // +// ************************************************************************** // + +class system_error { +public: + // Constructor + explicit system_error( char const* exp ); + + long const p_errno; + char const* const p_failed_exp; +}; + +//!@internal +#define BOOST_TEST_SYS_ASSERT( cond ) BOOST_TEST_I_ASSRT( cond, ::boost::system_error( BOOST_STRINGIZE( exp ) ) ) + +// ************************************************************************** // +// **************Floating point exception management interface ************** // +// ************************************************************************** // + +namespace fpe { + +enum masks { + BOOST_FPE_OFF = 0, + +#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__) /* *** */ + BOOST_FPE_DIVBYZERO = EM_ZERODIVIDE, + BOOST_FPE_INEXACT = EM_INEXACT, + BOOST_FPE_INVALID = EM_INVALID, + BOOST_FPE_OVERFLOW = EM_OVERFLOW, + BOOST_FPE_UNDERFLOW = EM_UNDERFLOW|EM_DENORMAL, + + BOOST_FPE_ALL = MCW_EM, + +#elif !defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__)/* *** */ + BOOST_FPE_ALL = BOOST_FPE_OFF, + +#else /* *** */ + +#if defined(FE_DIVBYZERO) + BOOST_FPE_DIVBYZERO = FE_DIVBYZERO, +#else + BOOST_FPE_DIVBYZERO = BOOST_FPE_OFF, +#endif + +#if defined(FE_INEXACT) + BOOST_FPE_INEXACT = FE_INEXACT, +#else + BOOST_FPE_INEXACT = BOOST_FPE_OFF, +#endif + +#if defined(FE_INVALID) + BOOST_FPE_INVALID = FE_INVALID, +#else + BOOST_FPE_INVALID = BOOST_FPE_OFF, +#endif + +#if defined(FE_OVERFLOW) + BOOST_FPE_OVERFLOW = FE_OVERFLOW, +#else + BOOST_FPE_OVERFLOW = BOOST_FPE_OFF, +#endif + +#if defined(FE_UNDERFLOW) + BOOST_FPE_UNDERFLOW = FE_UNDERFLOW, +#else + BOOST_FPE_UNDERFLOW = BOOST_FPE_OFF, +#endif + +#if defined(FE_ALL_EXCEPT) + BOOST_FPE_ALL = FE_ALL_EXCEPT, +#else + BOOST_FPE_ALL = BOOST_FPE_OFF, +#endif + +#endif /* *** */ + BOOST_FPE_INV = BOOST_FPE_ALL+1 +}; + +//____________________________________________________________________________// + +// return the previous set of enabled exceptions when successful, and BOOST_FPE_INV otherwise +unsigned BOOST_TEST_DECL enable( unsigned mask ); +unsigned BOOST_TEST_DECL disable( unsigned mask ); + +//____________________________________________________________________________// + +} // namespace fpe + +///@} + +} // namespace boost + + +#include + +#endif diff --git a/libraries/boost/include/boost/test/floating_point_comparison.hpp b/libraries/boost/include/boost/test/floating_point_comparison.hpp new file mode 100644 index 0000000000..e889274477 --- /dev/null +++ b/libraries/boost/include/boost/test/floating_point_comparison.hpp @@ -0,0 +1,14 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! @brief Deprecated header +//! @deprecated Use boost/test/tools/floating_point_comparison.hpp instead +// *************************************************************************** + +// Boost.Test +#include diff --git a/libraries/boost/include/boost/test/framework.hpp b/libraries/boost/include/boost/test/framework.hpp new file mode 100644 index 0000000000..099c02969b --- /dev/null +++ b/libraries/boost/include/boost/test/framework.hpp @@ -0,0 +1,303 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief Defines Unit Test Framework mono-state interfaces. +//! The framework interfaces are based on Monostate design pattern. +// *************************************************************************** + +#ifndef BOOST_TEST_FRAMEWORK_HPP_020805GER +#define BOOST_TEST_FRAMEWORK_HPP_020805GER + +// Boost.Test +#include +#include +#include + +#include + +#include + +// STL +#include + +//____________________________________________________________________________// + +namespace boost { + +/// Main namespace for the Unit Test Framework interfaces and implementation +namespace unit_test { + +// ************************************************************************** // +// ************** init_unit_test_func ************** // +// ************************************************************************** // + +/// Test module initialization routine signature + +/// Different depending on whether BOOST_TEST_ALTERNATIVE_INIT_API is defined or not +#ifdef BOOST_TEST_ALTERNATIVE_INIT_API +typedef bool (*init_unit_test_func)(); +#else +typedef test_suite* (*init_unit_test_func)( int, char* [] ); +#endif + +// ************************************************************************** // +// ************** framework ************** // +// ************************************************************************** // + +/// Namespace of the Unit Test Framework mono-state +namespace framework { + +/// @name Unit Test Framework initialization and shutdown +/// @{ + +/// @brief This function performs initialization of the framework mono-state. +/// +/// It needs to be called every time before the test is started. +/// @param[in] init_func test module initialization routine +/// @param[in] argc command line arguments collection +/// @param[in] argv command line arguments collection +BOOST_TEST_DECL void init( init_unit_test_func init_func, int argc, char* argv[] ); + +/// This function applies all the decorators and figures out default run status. This argument facilitates an +/// ability of the test cases to prepare some other test units (primarily used internally for self testing). +/// @param[in] tu Optional id of the test unit representing root of test tree. If absent, master test suite is used +BOOST_TEST_DECL void finalize_setup_phase( test_unit_id tu = INV_TEST_UNIT_ID); + +/// This function returns true when testing is in progress (setup is finished). +BOOST_TEST_DECL bool test_in_progress(); + +/// This function shuts down the framework and clears up its mono-state. +/// +/// It needs to be at the very end of test module execution +BOOST_TEST_DECL void shutdown(); +/// @} + +/// @name Test unit registration +/// @{ + +/// Provides both read and write access to current "leaf" auto test suite during the test unit registration phase. +/// +/// During auto-registration phase the framework maintain a FIFO queue of test units being registered. New test units become children +/// of the current "leaf" test suite and if this is test suite it is pushed back into queue and becomes a new leaf. +/// When test suite registration is completed, a test suite is popped from the back of the queue. Only automatically registered test suites +/// should be added to this queue. Master test suite is always a zero element in this queue, so if no other test suites are registered +/// all test cases are added to master test suite. + +/// This function facilitates all three possible actions: +/// - if no argument are provided it returns the current queue leaf test suite +/// - if test suite is provided and no second argument are set, test suite is added to the queue +/// - if no test suite are provided and last argument is false, the semantic of this function is similar to queue pop: last element is popped from the queue +/// @param[in] ts test suite to push back to the queue +/// @param[in] push_or_pop should we push ts to the queue or pop leaf test suite instead +/// @returns a reference to the currently active/"leaf" test suite +BOOST_TEST_DECL test_suite& current_auto_test_suite( test_suite* ts = 0, bool push_or_pop = true ); + +/// This function add new test case into the global collection of test units the framework aware of. + +/// This function also assignes unique test unit id for every test case. Later on one can use this id to locate +/// the test case if necessary. This is the way for the framework to maintain weak references between test units. +/// @param[in] tc test case to register +BOOST_TEST_DECL void register_test_unit( test_case* tc ); + +/// This function add new test suite into the global collection of test units the framework aware of. + +/// This function also assignes unique test unit id for every test suite. Later on one can use this id to locate +/// the test case if necessary. This is the way for the framework to maintain weak references between test units. +/// @param[in] ts test suite to register +BOOST_TEST_DECL void register_test_unit( test_suite* ts ); + +/// This function removes the test unit from the collection of known test units and destroys the test unit object. + +/// This function also assigns unique test unit id for every test case. Later on one can use this id to located +/// the test case if necessary. This is the way for the framework to maintain weak references between test units. +/// @param[in] tu test unit to deregister +BOOST_TEST_DECL void deregister_test_unit( test_unit* tu ); + +// This function clears up the framework mono-state. + +/// After this call the framework can be reinitialized to perform a second test run during the same program lifetime. +BOOST_TEST_DECL void clear(); +/// @} + +/// @name Test observer registration +/// @{ +/// Adds new test execution observer object into the framework's list of test observers. + +/// Observer lifetime should exceed the the testing execution timeframe +/// @param[in] to test observer object to add +BOOST_TEST_DECL void register_observer( test_observer& to ); + +/// Excludes the observer object form the framework's list of test observers +/// @param[in] to test observer object to exclude +BOOST_TEST_DECL void deregister_observer( test_observer& to ); + +/// @} + +/// @name Global fixtures registration +/// @{ + +/// Adds a new global fixture to be setup before any other tests starts and tore down after +/// any other tests finished. +/// Test unit fixture lifetime should exceed the testing execution timeframe +/// @param[in] tuf fixture to add +BOOST_TEST_DECL void register_global_fixture( test_unit_fixture& tuf ); + +/// Removes a test global fixture from the framework +/// +/// Test unit fixture lifetime should exceed the testing execution timeframe +/// @param[in] tuf fixture to remove +BOOST_TEST_DECL void deregister_global_fixture( test_unit_fixture& tuf ); +/// @} + +/// @name Assertion/uncaught exception context support +/// @{ +/// Context accessor +struct BOOST_TEST_DECL context_generator { + context_generator() : m_curr_frame( 0 ) {} + + /// Is there any context? + bool is_empty() const; + + /// Give me next frame; empty - last frame + const_string next() const; + +private: + // Data members + mutable unsigned m_curr_frame; +}; + +/// Records context frame message. + +/// Some context frames are sticky - they can only explicitly cleared by specifying context id. Other (non sticky) context frames cleared after every assertion. +/// @param[in] context_descr context frame message +/// @param[in] sticky is this sticky frame or not +/// @returns id of the newly created frame +BOOST_TEST_DECL int add_context( lazy_ostream const& context_descr, bool sticky ); +/// Erases context frame (when test exits context scope) + +/// If context_id is passed clears that specific context frame identified by this id, otherwise clears all non sticky contexts. +BOOST_TEST_DECL void clear_context( int context_id = -1 ); +/// Produces an instance of small "delegate" object, which facilitates access to collected context. +BOOST_TEST_DECL context_generator get_context(); +/// @} + +/// @name Access to registered test units. +/// @{ +/// This function provides access to the master test suite. + +/// There is only only master test suite per test module. +/// @returns a reference the master test suite instance +BOOST_TEST_DECL master_test_suite_t& master_test_suite(); + +/// This function provides an access to the test unit currently being executed. + +/// The difference with current_test_case is about the time between a test-suite +/// is being set up or torn down (fixtures) and when the test-cases of that suite start. + +/// This function is only valid during test execution phase. +/// @see current_test_case_id, current_test_case +BOOST_TEST_DECL test_unit const& current_test_unit(); + +/// This function provides an access to the test case currently being executed. + +/// This function is only valid during test execution phase. +/// @see current_test_case_id +BOOST_TEST_DECL test_case const& current_test_case(); + +/// This function provides an access to an id of the test case currently being executed. + +/// This function safer than current_test_case, cause if wont throw if no test case is being executed. +/// @see current_test_case +BOOST_TEST_DECL test_unit_id current_test_case_id(); /* safe version of above */ + +/// This function provides access to a test unit by id and type combination. It will throw if no test unit located. +/// @param[in] tu_id id of a test unit to locate +/// @param[in] tu_type type of a test unit to locate +/// @returns located test unit +BOOST_TEST_DECL test_unit& get( test_unit_id tu_id, test_unit_type tu_type ); + +/// This function template provides access to a typed test unit by id + +/// It will throw if you specify incorrect test unit type +/// @tparam UnitType compile time type of test unit to get (test_suite or test_case) +/// @param id id of test unit to get +template +inline UnitType& get( test_unit_id id ) +{ + return static_cast( get( id, static_cast(UnitType::type) ) ); +} +///@} + +/// @name Test initiation interface +/// @{ + +/// Initiates test execution + +/// This function is used to start the test execution from a specific "root" test unit. +/// If no root provided, test is started from master test suite. This second argument facilitates an ability of the test cases to +/// start some other test units (primarily used internally for self testing). +/// @param[in] tu Optional id of the test unit or test unit itself from which the test is started. If absent, master test suite is used +/// @param[in] continue_test true == continue test if it was already started, false == restart the test from scratch regardless +BOOST_TEST_DECL void run( test_unit_id tu = INV_TEST_UNIT_ID, bool continue_test = true ); +/// Initiates test execution. Same as other overload +BOOST_TEST_DECL void run( test_unit const* tu, bool continue_test = true ); +/// @} + +/// @name Test events dispatchers +/// @{ +/// Reports results of assertion to all test observers +BOOST_TEST_DECL void assertion_result( unit_test::assertion_result ar ); +/// Reports uncaught exception to all test observers +BOOST_TEST_DECL void exception_caught( execution_exception const& ); +/// Reports aborted test unit to all test observers +BOOST_TEST_DECL void test_unit_aborted( test_unit const& ); +/// Reports aborted test module to all test observers +BOOST_TEST_DECL void test_aborted( ); +/// @} + +namespace impl { +// exclusively for self test +BOOST_TEST_DECL void setup_for_execution( test_unit const& ); +BOOST_TEST_DECL void setup_loggers( ); +} // namespace impl + +// ************************************************************************** // +// ************** framework errors ************** // +// ************************************************************************** // + +/// This exception type is used to report internal Boost.Test framework errors. +struct BOOST_TEST_DECL internal_error : public std::runtime_error { + internal_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {} +}; + +//____________________________________________________________________________// + +/// This exception type is used to report test module setup errors. +struct BOOST_TEST_DECL setup_error : public std::runtime_error { + setup_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {} +}; + +#define BOOST_TEST_SETUP_ASSERT( cond, msg ) BOOST_TEST_I_ASSRT( cond, unit_test::framework::setup_error( msg ) ) + +//____________________________________________________________________________// + +struct nothing_to_test { + explicit nothing_to_test( int rc ) : m_result_code( rc ) {} + + int m_result_code; +}; + +//____________________________________________________________________________// + +} // namespace framework +} // unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_FRAMEWORK_HPP_020805GER diff --git a/libraries/boost/include/boost/test/impl/compiler_log_formatter.ipp b/libraries/boost/include/boost/test/impl/compiler_log_formatter.ipp new file mode 100644 index 0000000000..aa0a0e229f --- /dev/null +++ b/libraries/boost/include/boost/test/impl/compiler_log_formatter.ipp @@ -0,0 +1,298 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : implements compiler like Log formatter +// *************************************************************************** + +#ifndef BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER +#define BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER + +// Boost.Test +#include + +#include +#include +#include + +#include + +#include +#include +#include + + +// Boost +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace output { + +// ************************************************************************** // +// ************** compiler_log_formatter ************** // +// ************************************************************************** // + +namespace { + +std::string +test_phase_identifier() +{ + return framework::test_in_progress() ? framework::current_test_unit().full_name() : std::string( "Test setup" ); +} + +} // local namespace + +//____________________________________________________________________________// + +void +compiler_log_formatter::log_start( std::ostream& output, counter_t test_cases_amount ) +{ + m_color_output = runtime_config::get( runtime_config::btrt_color_output ); + + if( test_cases_amount > 0 ) + output << "Running " << test_cases_amount << " test " + << (test_cases_amount > 1 ? "cases" : "case") << "...\n"; +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::log_finish( std::ostream& ostr ) +{ + ostr.flush(); +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::log_build_info( std::ostream& output ) +{ + output << "Platform: " << BOOST_PLATFORM << '\n' + << "Compiler: " << BOOST_COMPILER << '\n' + << "STL : " << BOOST_STDLIB << '\n' + << "Boost : " << BOOST_VERSION/100000 << "." + << BOOST_VERSION/100 % 1000 << "." + << BOOST_VERSION % 100 << std::endl; +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::test_unit_start( std::ostream& output, test_unit const& tu ) +{ + BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::BLUE ); + + print_prefix( output, tu.p_file_name, tu.p_line_num ); + + output << "Entering test " << tu.p_type_name << " \"" << tu.p_name << "\"" << std::endl; +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::test_unit_finish( std::ostream& output, test_unit const& tu, unsigned long elapsed ) +{ + BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::BLUE ); + + print_prefix( output, tu.p_file_name, tu.p_line_num ); + + output << "Leaving test " << tu.p_type_name << " \"" << tu.p_name << "\""; + + if( elapsed > 0 ) { + output << "; testing time: "; + if( elapsed % 1000 == 0 ) + output << elapsed/1000 << "ms"; + else + output << elapsed << "us"; + } + + output << std::endl; +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::test_unit_skipped( std::ostream& output, test_unit const& tu, const_string reason ) +{ + BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::YELLOW ); + + print_prefix( output, tu.p_file_name, tu.p_line_num ); + + output << "Test " << tu.p_type_name << " \"" << tu.full_name() << "\"" << " is skipped because " << reason << std::endl; +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::log_exception_start( std::ostream& output, log_checkpoint_data const& checkpoint_data, execution_exception const& ex ) +{ + execution_exception::location const& loc = ex.where(); + + print_prefix( output, loc.m_file_name, loc.m_line_num ); + + { + BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::UNDERLINE, term_color::RED ); + + output << "fatal error: in \"" << (loc.m_function.is_empty() ? test_phase_identifier() : loc.m_function ) << "\": " + << ex.what(); + } + + if( !checkpoint_data.m_file_name.is_empty() ) { + output << '\n'; + print_prefix( output, checkpoint_data.m_file_name, checkpoint_data.m_line_num ); + + BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::CYAN ); + + output << "last checkpoint"; + if( !checkpoint_data.m_message.empty() ) + output << ": " << checkpoint_data.m_message; + } +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::log_exception_finish( std::ostream& output ) +{ + output << std::endl; +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::log_entry_start( std::ostream& output, log_entry_data const& entry_data, log_entry_types let ) +{ + using namespace utils; + + switch( let ) { + case BOOST_UTL_ET_INFO: + print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); + if( m_color_output ) + output << setcolor( term_attr::BRIGHT, term_color::GREEN ); + output << "info: "; + break; + case BOOST_UTL_ET_MESSAGE: + if( m_color_output ) + output << setcolor( term_attr::BRIGHT, term_color::CYAN ); + break; + case BOOST_UTL_ET_WARNING: + print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); + if( m_color_output ) + output << setcolor( term_attr::BRIGHT, term_color::YELLOW ); + output << "warning: in \"" << test_phase_identifier() << "\": "; + break; + case BOOST_UTL_ET_ERROR: + print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); + if( m_color_output ) + output << setcolor( term_attr::BRIGHT, term_color::RED ); + output << "error: in \"" << test_phase_identifier() << "\": "; + break; + case BOOST_UTL_ET_FATAL_ERROR: + print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); + if( m_color_output ) + output << setcolor( term_attr::UNDERLINE, term_color::RED ); + output << "fatal error: in \"" << test_phase_identifier() << "\": "; + break; + } +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::log_entry_value( std::ostream& output, const_string value ) +{ + output << value; +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::log_entry_value( std::ostream& output, lazy_ostream const& value ) +{ + output << value; +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::log_entry_finish( std::ostream& output ) +{ + if( m_color_output ) + output << utils::setcolor(); + + output << std::endl; +} + + +//____________________________________________________________________________// + +void +compiler_log_formatter::print_prefix( std::ostream& output, const_string file_name, std::size_t line_num ) +{ + if( !file_name.empty() ) { +#ifdef __APPLE_CC__ + // Xcode-compatible logging format, idea by Richard Dingwall at + // . + output << file_name << ':' << line_num << ": "; +#else + output << file_name << '(' << line_num << "): "; +#endif + } +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::entry_context_start( std::ostream& output, log_level l ) +{ + if( l == log_messages ) { + output << "\n[context:"; + } + else { + output << (l == log_successful_tests ? "\nAssertion" : "\nFailure" ) << " occurred in a following context:"; + } +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::entry_context_finish( std::ostream& output, log_level l ) +{ + if( l == log_messages ) { + output << "]"; + } + output.flush(); +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::log_entry_context( std::ostream& output, log_level /*l*/, const_string context_descr ) +{ + output << "\n " << context_descr; +} + +//____________________________________________________________________________// + +} // namespace output +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/cpp_main.ipp b/libraries/boost/include/boost/test/impl/cpp_main.ipp new file mode 100644 index 0000000000..aaa5cabfc5 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/cpp_main.ipp @@ -0,0 +1,136 @@ +// (C) Copyright Gennadiy Rozental 2001. +// (C) Copyright Beman Dawes 1995-2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : main function implementation for Program Executon Monitor +// *************************************************************************** + +#ifndef BOOST_TEST_CPP_MAIN_IPP_012205GER +#define BOOST_TEST_CPP_MAIN_IPP_012205GER + +// Boost.Test +#include +#include +#include + +// Boost +#include // for exit codes +#include // for workarounds + +// STL +#include +#include // std::getenv +#include // std::strerror + +#include + +//____________________________________________________________________________// + +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::getenv; using ::strerror; } +#endif + +namespace { + +struct cpp_main_caller { + cpp_main_caller( int (*cpp_main_func)( int argc, char* argv[] ), int argc, char** argv ) + : m_cpp_main_func( cpp_main_func ) + , m_argc( argc ) + , m_argv( argv ) {} + + int operator()() { return (*m_cpp_main_func)( m_argc, m_argv ); } + +private: + // Data members + int (*m_cpp_main_func)( int argc, char* argv[] ); + int m_argc; + char** m_argv; +}; + +} // local namespace + +// ************************************************************************** // +// ************** prg_exec_monitor_main ************** // +// ************************************************************************** // + +namespace boost { + +int BOOST_TEST_DECL +prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char* argv[] ) +{ + int result = 0; + + BOOST_TEST_I_TRY { + boost::unit_test::const_string p( std::getenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS" ) ); + ::boost::execution_monitor ex_mon; + + ex_mon.p_catch_system_errors.value = p != "no"; + + result = ex_mon.execute( cpp_main_caller( cpp_main, argc, argv ) ); + + if( result == 0 ) + result = ::boost::exit_success; + else if( result != ::boost::exit_success ) { + std::cout << "\n**** error return code: " << result << std::endl; + result = ::boost::exit_failure; + } + } + BOOST_TEST_I_CATCH( ::boost::execution_exception, exex ) { + std::cout << "\n**** exception(" << exex.code() << "): " << exex.what() << std::endl; + result = ::boost::exit_exception_failure; + } + BOOST_TEST_I_CATCH( ::boost::system_error, ex ) { + std::cout << "\n**** failed to initialize execution monitor." + << "\n**** expression at fault: " << ex.p_failed_exp + << "\n**** error(" << ex.p_errno << "): " << std::strerror( ex.p_errno ) << std::endl; + result = ::boost::exit_exception_failure; + } + + if( result != ::boost::exit_success ) { + std::cerr << "******** errors detected; see standard output for details ********" << std::endl; + } + else { + // Some prefer a confirming message when all is well, while others don't + // like the clutter. Use an environment variable to avoid command + // line argument modifications; for use in production programs + // that's a no-no in some organizations. + ::boost::unit_test::const_string p( std::getenv( "BOOST_PRG_MON_CONFIRM" ) ); + if( p != "no" ) { + std::cerr << std::flush << "no errors detected" << std::endl; + } + } + + return result; +} + +} // namespace boost + +#if !defined(BOOST_TEST_DYN_LINK) && !defined(BOOST_TEST_NO_MAIN) + +// ************************************************************************** // +// ************** main function for tests using lib ************** // +// ************************************************************************** // + +int cpp_main( int argc, char* argv[] ); // prototype for user's cpp_main() + +int BOOST_TEST_CALL_DECL +main( int argc, char* argv[] ) +{ + return ::boost::prg_exec_monitor_main( &cpp_main, argc, argv ); +} + +//____________________________________________________________________________// + +#endif // !BOOST_TEST_DYN_LINK && !BOOST_TEST_NO_MAIN + +#include + +#endif // BOOST_TEST_CPP_MAIN_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/debug.ipp b/libraries/boost/include/boost/test/impl/debug.ipp new file mode 100644 index 0000000000..a5e5f6da06 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/debug.ipp @@ -0,0 +1,1009 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Use, modification, and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : debug interfaces implementation +// *************************************************************************** + +#ifndef BOOST_TEST_DEBUG_API_IPP_112006GER +#define BOOST_TEST_DEBUG_API_IPP_112006GER + +// Boost.Test +#include +#include +#include + +#include +#include + +// Implementation on Windows +#if defined(_WIN32) && !defined(UNDER_CE) && !defined(BOOST_DISABLE_WIN32) // ******* WIN32 + +# define BOOST_WIN32_BASED_DEBUG + +// SYSTEM API +# include +# include +# include +# include + +# if !defined(NDEBUG) && defined(_MSC_VER) +# define BOOST_MS_CRT_BASED_DEBUG +# include +# endif + + +# ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::memset; using ::sprintf; } +# endif + +#elif defined(unix) || defined(__unix) // ********************* UNIX + +# define BOOST_UNIX_BASED_DEBUG + +// Boost.Test +#include +#include + +// STL +#include // std::memcpy +#include +#include +#include // !! ?? cstdarg + +// SYSTEM API +# include +# include +# include + +# include +# include +# include +# include +# include +# include + +# if defined(sun) || defined(__sun) + +# define BOOST_SUN_BASED_DEBUG + +# ifndef BOOST_TEST_DBG_LIST +# define BOOST_TEST_DBG_LIST dbx;gdb +# endif + +# define BOOST_TEST_CNL_DBG dbx +# define BOOST_TEST_GUI_DBG dbx-ddd + +# include + +# elif defined(linux) || defined(__linux) + +# define BOOST_LINUX_BASED_DEBUG + +# include + +# ifndef BOOST_TEST_STAT_LINE_MAX +# define BOOST_TEST_STAT_LINE_MAX 500 +# endif + +# ifndef BOOST_TEST_DBG_LIST +# define BOOST_TEST_DBG_LIST gdb +# endif + +# define BOOST_TEST_CNL_DBG gdb +# define BOOST_TEST_GUI_DBG gdb-xterm + +# endif + +#endif + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace debug { + +using unit_test::const_string; + +// ************************************************************************** // +// ************** debug::info_t ************** // +// ************************************************************************** // + +namespace { + +#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 + +template +inline void +dyn_symbol( T& res, char const* module_name, char const* symbol_name ) +{ + HMODULE m = ::GetModuleHandleA( module_name ); + + if( !m ) + m = ::LoadLibraryA( module_name ); + + res = reinterpret_cast( ::GetProcAddress( m, symbol_name ) ); +} + +//____________________________________________________________________________// + +static struct info_t { + typedef BOOL (WINAPI* IsDebuggerPresentT)(); + typedef LONG (WINAPI* RegQueryValueExT)( HKEY, char const* /*LPTSTR*/, LPDWORD, LPDWORD, LPBYTE, LPDWORD ); + typedef LONG (WINAPI* RegOpenKeyT)( HKEY, char const* /*LPCTSTR*/, PHKEY ); + typedef LONG (WINAPI* RegCloseKeyT)( HKEY ); + + info_t(); + + IsDebuggerPresentT m_is_debugger_present; + RegOpenKeyT m_reg_open_key; + RegQueryValueExT m_reg_query_value; + RegCloseKeyT m_reg_close_key; + +} s_info; + +//____________________________________________________________________________// + +info_t::info_t() +{ + dyn_symbol( m_is_debugger_present, "kernel32", "IsDebuggerPresent" ); + dyn_symbol( m_reg_open_key, "advapi32", "RegOpenKeyA" ); + dyn_symbol( m_reg_query_value, "advapi32", "RegQueryValueExA" ); + dyn_symbol( m_reg_close_key, "advapi32", "RegCloseKey" ); +} + +//____________________________________________________________________________// + +#elif defined(BOOST_UNIX_BASED_DEBUG) + +// ************************************************************************** // +// ************** fd_holder ************** // +// ************************************************************************** // + +struct fd_holder { + explicit fd_holder( int fd ) : m_fd( fd ) {} + ~fd_holder() + { + if( m_fd != -1 ) + ::close( m_fd ); + } + + operator int() { return m_fd; } + +private: + // Data members + int m_fd; +}; + + +// ************************************************************************** // +// ************** process_info ************** // +// ************************************************************************** // + +struct process_info { + // Constructor + explicit process_info( int pid ); + + // access methods + int parent_pid() const { return m_parent_pid; } + const_string binary_name() const { return m_binary_name; } + const_string binary_path() const { return m_binary_path; } + +private: + // Data members + int m_parent_pid; + const_string m_binary_name; + const_string m_binary_path; + +#if defined(BOOST_SUN_BASED_DEBUG) + struct psinfo m_psi; + char m_binary_path_buff[500+1]; // !! ?? +#elif defined(BOOST_LINUX_BASED_DEBUG) + char m_stat_line[BOOST_TEST_STAT_LINE_MAX+1]; + char m_binary_path_buff[500+1]; // !! ?? +#endif +}; + +//____________________________________________________________________________// + +process_info::process_info( int pid ) +: m_parent_pid( 0 ) +{ +#if defined(BOOST_SUN_BASED_DEBUG) + char fname_buff[30]; + + ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/psinfo", pid ); + + fd_holder psinfo_fd( ::open( fname_buff, O_RDONLY ) ); + + if( psinfo_fd == -1 ) + return; + + if( ::read( psinfo_fd, &m_psi, sizeof(m_psi) ) == -1 ) + return; + + m_parent_pid = m_psi.pr_ppid; + + m_binary_name.assign( m_psi.pr_fname ); + + //-------------------------- // + + ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/as", pid ); + + fd_holder as_fd( ::open( fname_buff, O_RDONLY ) ); + uintptr_t binary_name_pos; + + // !! ?? could we avoid reading whole m_binary_path_buff? + if( as_fd == -1 || + ::lseek( as_fd, m_psi.pr_argv, SEEK_SET ) == -1 || + ::read ( as_fd, &binary_name_pos, sizeof(binary_name_pos) ) == -1 || + ::lseek( as_fd, binary_name_pos, SEEK_SET ) == -1 || + ::read ( as_fd, m_binary_path_buff, sizeof(m_binary_path_buff) ) == -1 ) + return; + + m_binary_path.assign( m_binary_path_buff ); + +#elif defined(BOOST_LINUX_BASED_DEBUG) + char fname_buff[30]; + + ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/stat", pid ); + + fd_holder psinfo_fd( ::open( fname_buff, O_RDONLY ) ); + + if( psinfo_fd == -1 ) + return; + + ssize_t num_read = ::read( psinfo_fd, m_stat_line, sizeof(m_stat_line)-1 ); + if( num_read == -1 ) + return; + + m_stat_line[num_read] = 0; + + char const* name_beg = m_stat_line; + while( *name_beg && *name_beg != '(' ) + ++name_beg; + + char const* name_end = name_beg+1; + while( *name_end && *name_end != ')' ) + ++name_end; + + std::sscanf( name_end+1, "%*s%d", &m_parent_pid ); + + m_binary_name.assign( name_beg+1, name_end ); + + ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/exe", pid ); + num_read = ::readlink( fname_buff, m_binary_path_buff, sizeof(m_binary_path_buff)-1 ); + + if( num_read == -1 ) + return; + + m_binary_path_buff[num_read] = 0; + m_binary_path.assign( m_binary_path_buff, num_read ); +#endif +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** prepare_window_title ************** // +// ************************************************************************** // + +static char* +prepare_window_title( dbg_startup_info const& dsi ) +{ + typedef unit_test::const_string str_t; + + static char title_str[50]; + + str_t path_sep( "\\/" ); + + str_t::iterator it = unit_test::utils::find_last_of( dsi.binary_path.begin(), dsi.binary_path.end(), + path_sep.begin(), path_sep.end() ); + + if( it == dsi.binary_path.end() ) + it = dsi.binary_path.begin(); + else + ++it; + + ::snprintf( title_str, sizeof(title_str), "%*s %ld", (int)(dsi.binary_path.end()-it), it, dsi.pid ); + + return title_str; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** save_execlp ************** // +// ************************************************************************** // + +typedef unit_test::basic_cstring mbuffer; + +inline char* +copy_arg( mbuffer& dest, const_string arg ) +{ + if( dest.size() < arg.size()+1 ) + return 0; + + char* res = dest.begin(); + + std::memcpy( res, arg.begin(), arg.size()+1 ); + + dest.trim_left( arg.size()+1 ); + + return res; +} + +//____________________________________________________________________________// + +bool +safe_execlp( char const* file, ... ) +{ + static char* argv_buff[200]; + + va_list args; + char const* arg; + + // first calculate actual number of arguments + int num_args = 2; // file name and 0 at least + + va_start( args, file ); + while( !!(arg = va_arg( args, char const* )) ) + num_args++; + va_end( args ); + + // reserve space for the argument pointers array + char** argv_it = argv_buff; + mbuffer work_buff( reinterpret_cast(argv_buff), sizeof(argv_buff) ); + work_buff.trim_left( num_args * sizeof(char*) ); + + // copy all the argument values into local storage + if( !(*argv_it++ = copy_arg( work_buff, file )) ) + return false; + + printf( "!! %s\n", file ); + + va_start( args, file ); + while( !!(arg = va_arg( args, char const* )) ) { + printf( "!! %s\n", arg ); + if( !(*argv_it++ = copy_arg( work_buff, arg )) ) { + va_end( args ); + return false; + } + } + va_end( args ); + + *argv_it = 0; + + return ::execvp( file, argv_buff ) != -1; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** start_debugger_in_emacs ************** // +// ************************************************************************** // + +static void +start_debugger_in_emacs( dbg_startup_info const& dsi, char const* emacs_name, char const* dbg_command ) +{ + char const* title = prepare_window_title( dsi ); + + if( !title ) + return; + + dsi.display.is_empty() + ? safe_execlp( emacs_name, "-title", title, "--eval", dbg_command, 0 ) + : safe_execlp( emacs_name, "-title", title, "-display", dsi.display.begin(), "--eval", dbg_command, 0 ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** gdb starters ************** // +// ************************************************************************** // + +static char const* +prepare_gdb_cmnd_file( dbg_startup_info const& dsi ) +{ + // prepare pid value + char pid_buff[16]; + ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); + unit_test::const_string pid_str( pid_buff ); + + static char cmd_file_name[] = "/tmp/btl_gdb_cmd_XXXXXX"; // !! ?? + + // prepare commands + fd_holder cmd_fd( ::mkstemp( cmd_file_name ) ); + + if( cmd_fd == -1 ) + return 0; + +#define WRITE_STR( str ) if( ::write( cmd_fd, str.begin(), str.size() ) == -1 ) return 0; +#define WRITE_CSTR( str ) if( ::write( cmd_fd, str, sizeof( str )-1 ) == -1 ) return 0; + + WRITE_CSTR( "file " ); + WRITE_STR( dsi.binary_path ); + WRITE_CSTR( "\nattach " ); + WRITE_STR( pid_str ); + WRITE_CSTR( "\nshell unlink " ); + WRITE_STR( dsi.init_done_lock ); + WRITE_CSTR( "\ncont" ); + if( dsi.break_or_continue ) + WRITE_CSTR( "\nup 4" ); + + WRITE_CSTR( "\necho \\n" ); // !! ?? + WRITE_CSTR( "\nlist -" ); + WRITE_CSTR( "\nlist" ); + WRITE_CSTR( "\nshell unlink " ); + WRITE_CSTR( cmd_file_name ); + + return cmd_file_name; +} + +//____________________________________________________________________________// + +static void +start_gdb_in_console( dbg_startup_info const& dsi ) +{ + char const* cmnd_file_name = prepare_gdb_cmnd_file( dsi ); + + if( !cmnd_file_name ) + return; + + safe_execlp( "gdb", "-q", "-x", cmnd_file_name, 0 ); +} + +//____________________________________________________________________________// + +static void +start_gdb_in_xterm( dbg_startup_info const& dsi ) +{ + char const* title = prepare_window_title( dsi ); + char const* cmnd_file_name = prepare_gdb_cmnd_file( dsi ); + + if( !title || !cmnd_file_name ) + return; + + safe_execlp( "xterm", "-T", title, "-display", dsi.display.begin(), + "-bg", "black", "-fg", "white", "-geometry", "88x30+10+10", "-fn", "9x15", "-e", + "gdb", "-q", "-x", cmnd_file_name, 0 ); +} + +//____________________________________________________________________________// + +static void +start_gdb_in_emacs( dbg_startup_info const& dsi ) +{ + char const* cmnd_file_name = prepare_gdb_cmnd_file( dsi ); + if( !cmnd_file_name ) + return; + + char dbg_cmd_buff[500]; // !! ?? + ::snprintf( dbg_cmd_buff, sizeof(dbg_cmd_buff), "(progn (gdb \"gdb -q -x %s\"))", cmnd_file_name ); + + start_debugger_in_emacs( dsi, "emacs", dbg_cmd_buff ); +} + +//____________________________________________________________________________// + +static void +start_gdb_in_xemacs( dbg_startup_info const& ) +{ + // !! ?? +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** dbx starters ************** // +// ************************************************************************** // + +static char const* +prepare_dbx_cmd_line( dbg_startup_info const& dsi, bool list_source = true ) +{ + static char cmd_line_buff[500]; // !! ?? + + ::snprintf( cmd_line_buff, sizeof(cmd_line_buff), "unlink %s;cont;%s%s", + dsi.init_done_lock.begin(), + dsi.break_or_continue ? "up 2;": "", + list_source ? "echo \" \";list -w3;" : "" ); + + return cmd_line_buff; +} + +//____________________________________________________________________________// + +static void +start_dbx_in_console( dbg_startup_info const& dsi ) +{ + char pid_buff[16]; + ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); + + safe_execlp( "dbx", "-q", "-c", prepare_dbx_cmd_line( dsi ), dsi.binary_path.begin(), pid_buff, 0 ); +} + +//____________________________________________________________________________// + +static void +start_dbx_in_xterm( dbg_startup_info const& dsi ) +{ + char const* title = prepare_window_title( dsi ); + if( !title ) + return; + + char pid_buff[16]; // !! ?? + ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); + + safe_execlp( "xterm", "-T", title, "-display", dsi.display.begin(), + "-bg", "black", "-fg", "white", "-geometry", "88x30+10+10", "-fn", "9x15", "-e", + "dbx", "-q", "-c", prepare_dbx_cmd_line( dsi ), dsi.binary_path.begin(), pid_buff, 0 ); +} + +//____________________________________________________________________________// + +static void +start_dbx_in_emacs( dbg_startup_info const& /*dsi*/ ) +{ +// char dbg_cmd_buff[500]; // !! ?? +// +// ::snprintf( dbg_cmd_buff, sizeof(dbg_cmd_buff), "(progn (dbx \"dbx -q -c cont %s %ld\"))", dsi.binary_path.begin(), dsi.pid ); + +// start_debugger_in_emacs( dsi, "emacs", dbg_cmd_buff ); +} + +//____________________________________________________________________________// + +static void +start_dbx_in_xemacs( dbg_startup_info const& ) +{ + // !! ?? +} + +//____________________________________________________________________________// + +static void +start_dbx_in_ddd( dbg_startup_info const& dsi ) +{ + char const* title = prepare_window_title( dsi ); + if( !title ) + return; + + char pid_buff[16]; // !! ?? + ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); + + safe_execlp( "ddd", "-display", dsi.display.begin(), + "--dbx", "-q", "-c", prepare_dbx_cmd_line( dsi, false ), dsi.binary_path.begin(), pid_buff, 0 ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** debug::info_t ************** // +// ************************************************************************** // + +static struct info_t { + // Constructor + info_t(); + + // Public properties + unit_test::readwrite_property p_dbg; + + // Data members + std::map m_dbg_starter_reg; +} s_info; + +//____________________________________________________________________________// + +info_t::info_t() +{ + p_dbg.value = ::getenv( "DISPLAY" ) + ? std::string( BOOST_STRINGIZE( BOOST_TEST_GUI_DBG ) ) + : std::string( BOOST_STRINGIZE( BOOST_TEST_CNL_DBG ) ); + + m_dbg_starter_reg[std::string("gdb")] = &start_gdb_in_console; + m_dbg_starter_reg[std::string("gdb-emacs")] = &start_gdb_in_emacs; + m_dbg_starter_reg[std::string("gdb-xterm")] = &start_gdb_in_xterm; + m_dbg_starter_reg[std::string("gdb-xemacs")] = &start_gdb_in_xemacs; + + m_dbg_starter_reg[std::string("dbx")] = &start_dbx_in_console; + m_dbg_starter_reg[std::string("dbx-emacs")] = &start_dbx_in_emacs; + m_dbg_starter_reg[std::string("dbx-xterm")] = &start_dbx_in_xterm; + m_dbg_starter_reg[std::string("dbx-xemacs")] = &start_dbx_in_xemacs; + m_dbg_starter_reg[std::string("dbx-ddd")] = &start_dbx_in_ddd; +} + +//____________________________________________________________________________// + +#endif + +} // local namespace + +// ************************************************************************** // +// ************** check if program is running under debugger ************** // +// ************************************************************************** // + +bool +under_debugger() +{ +#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 + + return !!s_info.m_is_debugger_present && s_info.m_is_debugger_present(); + +#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX + + // !! ?? could/should we cache the result somehow? + const_string dbg_list = BOOST_TEST_STRINGIZE( BOOST_TEST_DBG_LIST ); + + pid_t pid = ::getpid(); + + while( pid != 0 ) { + process_info pi( pid ); + + // !! ?? should we use tokenizer here instead? + if( dbg_list.find( pi.binary_name() ) != const_string::npos ) + return true; + + pid = (pi.parent_pid() == pid ? 0 : pi.parent_pid()); + } + + return false; + +#else // ****************************************************** default + + return false; + +#endif +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** cause program to break execution ************** // +// ************** in debugger at call point ************** // +// ************************************************************************** // + +void +debugger_break() +{ + // !! ?? auto-start debugger? + +#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 + +#if defined(__GNUC__) && !defined(__MINGW32__) || \ + defined(__INTEL_COMPILER) +# define BOOST_DEBUG_BREAK __debugbreak +#else +# define BOOST_DEBUG_BREAK DebugBreak +#endif + +#ifndef __MINGW32__ + if( !under_debugger() ) { + __try { + __try { + BOOST_DEBUG_BREAK(); + } + __except( UnhandledExceptionFilter(GetExceptionInformation()) ) + { + // User opted to ignore the breakpoint + return; + } + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + // If we got here, the user has pushed Debug. Debugger is already attached to our process and we + // continue to let the another BOOST_DEBUG_BREAK to be called. + } + } +#endif + + BOOST_DEBUG_BREAK(); + +#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX + + ::kill( ::getpid(), SIGTRAP ); + +#else // ****************************************************** default + +#endif +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** console debugger setup ************** // +// ************************************************************************** // + +#if defined(BOOST_UNIX_BASED_DEBUG) // ************************ UNIX + +std::string +set_debugger( unit_test::const_string dbg_id, dbg_starter s ) +{ + std::string old = s_info.p_dbg; + + assign_op( s_info.p_dbg.value, dbg_id, 0 ); + + if( !!s ) + s_info.m_dbg_starter_reg[s_info.p_dbg.get()] = s; + + return old; +} + +#else // ***************************************************** default + +std::string +set_debugger( unit_test::const_string, dbg_starter ) +{ + return std::string(); +} + +#endif + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** attach debugger to the current process ************** // +// ************************************************************************** // + +#if defined(BOOST_WIN32_BASED_DEBUG) + +struct safe_handle_helper +{ + HANDLE& handle; + safe_handle_helper(HANDLE &handle_) : handle(handle_) {} + + void close_handle() + { + if( handle != INVALID_HANDLE_VALUE ) + { + ::CloseHandle( handle ); + handle = INVALID_HANDLE_VALUE; + } + } + + ~safe_handle_helper() + { + close_handle(); + } +}; +#endif + +bool +attach_debugger( bool break_or_continue ) +{ + if( under_debugger() ) + return false; + +#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 + + const int MAX_CMD_LINE = 200; + + // *************************************************** // + // Debugger "ready" event + + SECURITY_ATTRIBUTES attr; + attr.nLength = sizeof(attr); + attr.lpSecurityDescriptor = NULL; + attr.bInheritHandle = true; + + // manual resettable, initially non signaled, unnamed event, + // that will signal me that debugger initialization is done + HANDLE dbg_init_done_ev = ::CreateEvent( + &attr, // pointer to security attributes + true, // flag for manual-reset event + false, // flag for initial state + NULL // pointer to event-object name + ); + + if( !dbg_init_done_ev ) + return false; + + safe_handle_helper safe_handle_obj( dbg_init_done_ev ); + + // *************************************************** // + // Debugger command line format + + HKEY reg_key; + + if( !s_info.m_reg_open_key || (*s_info.m_reg_open_key)( + HKEY_LOCAL_MACHINE, // handle of open key + "Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", // name of subkey to open + ®_key ) != ERROR_SUCCESS ) // address of handle of open key + return false; + + char format[MAX_CMD_LINE]; + DWORD format_size = MAX_CMD_LINE; + DWORD type = REG_SZ; + + bool b_read_key = s_info.m_reg_query_value && + ((*s_info.m_reg_query_value)( + reg_key, // handle of open key + "Debugger", // name of subkey to query + 0, // reserved + &type, // value type + (LPBYTE)format, // buffer for returned string + &format_size ) == ERROR_SUCCESS ); // in: buffer size; out: actual size of returned string + + if( !s_info.m_reg_close_key || (*s_info.m_reg_close_key)( reg_key ) != ERROR_SUCCESS ) + return false; + + if( !b_read_key ) + return false; + + // *************************************************** // + // Debugger command line + + char cmd_line[MAX_CMD_LINE]; + std::sprintf( cmd_line, format, ::GetCurrentProcessId(), dbg_init_done_ev ); + + // *************************************************** // + // Debugger window parameters + + STARTUPINFOA startup_info; + std::memset( &startup_info, 0, sizeof(startup_info) ); + + startup_info.cb = sizeof(startup_info); + startup_info.dwFlags = STARTF_USESHOWWINDOW; + startup_info.wShowWindow = SW_SHOWNORMAL; + + // debugger process s_info + PROCESS_INFORMATION debugger_info; + + bool created = !!::CreateProcessA( + NULL, // pointer to name of executable module; NULL - use the one in command line + cmd_line, // pointer to command line string + NULL, // pointer to process security attributes; NULL - debugger's handle can't be inherited + NULL, // pointer to thread security attributes; NULL - debugger's handle can't be inherited + true, // debugger inherit opened handles + 0, // priority flags; 0 - normal priority + NULL, // pointer to new environment block; NULL - use this process environment + NULL, // pointer to current directory name; NULL - use this process correct directory + &startup_info, // pointer to STARTUPINFO that specifies main window appearance + &debugger_info // pointer to PROCESS_INFORMATION that will contain the new process identification + ); + + bool debugger_run_ok = false; + if( created ) + { + DWORD ret_code = ::WaitForSingleObject( dbg_init_done_ev, INFINITE ); + debugger_run_ok = ( ret_code == WAIT_OBJECT_0 ); + } + + safe_handle_obj.close_handle(); + + if( !created || !debugger_run_ok ) + return false; + + if( break_or_continue ) + debugger_break(); + + return true; + +#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX + + char init_done_lock_fn[] = "/tmp/btl_dbg_init_done_XXXXXX"; + fd_holder init_done_lock_fd( ::mkstemp( init_done_lock_fn ) ); + + if( init_done_lock_fd == -1 ) + return false; + + pid_t child_pid = fork(); + + if( child_pid == -1 ) + return false; + + if( child_pid != 0 ) { // parent process - here we will start the debugger + dbg_startup_info dsi; + + process_info pi( child_pid ); + if( pi.binary_path().is_empty() ) + ::exit( -1 ); + + dsi.pid = child_pid; + dsi.break_or_continue = break_or_continue; + dsi.binary_path = pi.binary_path(); + dsi.display = ::getenv( "DISPLAY" ); + dsi.init_done_lock = init_done_lock_fn; + + dbg_starter starter = s_info.m_dbg_starter_reg[s_info.p_dbg]; + if( !!starter ) + starter( dsi ); + + ::perror( "Boost.Test execution monitor failed to start a debugger:" ); + + ::exit( -1 ); + } + + // child process - here we will continue our test module execution ; // !! ?? should it be vice versa + + while( ::access( init_done_lock_fn, F_OK ) == 0 ) { + struct timeval to = { 0, 100 }; + + ::select( 0, 0, 0, 0, &to ); + } + +// char dummy; +// while( ::read( init_done_lock_fd, &dummy, sizeof(char) ) == 0 ); + + if( break_or_continue ) + debugger_break(); + + return true; + +#else // ****************************************************** default + (void) break_or_continue; // silence 'unused variable' warning + return false; + +#endif +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** switch on/off detect memory leaks feature ************** // +// ************************************************************************** // + +void +detect_memory_leaks( bool on_off, unit_test::const_string report_file ) +{ + unit_test::ut_detail::ignore_unused_variable_warning( on_off ); + +#ifdef BOOST_MS_CRT_BASED_DEBUG + int flags = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); + + if( !on_off ) + flags &= ~_CRTDBG_LEAK_CHECK_DF; + else { + flags |= _CRTDBG_LEAK_CHECK_DF; + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); + + if( report_file.is_empty() ) + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + else { + HANDLE hreport_f = ::CreateFileA( report_file.begin(), + GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + _CrtSetReportFile(_CRT_WARN, hreport_f ); + } + } + + _CrtSetDbgFlag ( flags ); +#else + unit_test::ut_detail::ignore_unused_variable_warning( report_file ); +#endif // BOOST_MS_CRT_BASED_DEBUG +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** cause program to break execution in ************** // +// ************** debugger at specific allocation point ************** // +// ************************************************************************** // + +void +break_memory_alloc( long mem_alloc_order_num ) +{ + unit_test::ut_detail::ignore_unused_variable_warning( mem_alloc_order_num ); + +#ifdef BOOST_MS_CRT_BASED_DEBUG + // only set the value if one was supplied (do not use default used by UTF just as a indicator to enable leak detection) + if( mem_alloc_order_num > 1 ) + _CrtSetBreakAlloc( mem_alloc_order_num ); +#endif // BOOST_MS_CRT_BASED_DEBUG +} + +//____________________________________________________________________________// + +} // namespace debug +} // namespace boost + +#include + +#endif // BOOST_TEST_DEBUG_API_IPP_112006GER + diff --git a/libraries/boost/include/boost/test/impl/decorator.ipp b/libraries/boost/include/boost/test/impl/decorator.ipp new file mode 100644 index 0000000000..74d42b22a2 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/decorator.ipp @@ -0,0 +1,202 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : unit test decorators implementation +// *************************************************************************** + +#ifndef BOOST_TEST_TREE_DECORATOR_IPP_091911GER +#define BOOST_TEST_TREE_DECORATOR_IPP_091911GER + +// Boost.Test +#include +#include + +#include +#if BOOST_TEST_SUPPORT_TOKEN_ITERATOR +#include +#endif + +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace decorator { + +// ************************************************************************** // +// ************** decorator::collector ************** // +// ************************************************************************** // + +collector& +collector::operator*( base const& d ) +{ + m_tu_decorators.push_back( d.clone() ); + + return *this; +} + +//____________________________________________________________________________// + +void +collector::store_in( test_unit& tu ) +{ + tu.p_decorators.value.insert( tu.p_decorators.value.end(), m_tu_decorators.begin(), m_tu_decorators.end() ); +} + +//____________________________________________________________________________// + +void +collector::reset() +{ + m_tu_decorators.clear(); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** decorator::base ************** // +// ************************************************************************** // + +collector& +base::operator*() const +{ + return collector::instance() * *this; +} + +// ************************************************************************** // +// ************** decorator::label ************** // +// ************************************************************************** // + +void +label::apply( test_unit& tu ) +{ + tu.add_label( m_label ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** decorator::expected_failures ************** // +// ************************************************************************** // + +void +expected_failures::apply( test_unit& tu ) +{ + tu.increase_exp_fail( m_exp_fail ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** decorator::timeout ************** // +// ************************************************************************** // + +void +timeout::apply( test_unit& tu ) +{ + tu.p_timeout.value = m_timeout; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** decorator::description ************** // +// ************************************************************************** // + +void +description::apply( test_unit& tu ) +{ + tu.p_description.value += m_description; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** decorator::depends_on ************** // +// ************************************************************************** // + +void +depends_on::apply( test_unit& tu ) +{ +#if !BOOST_TEST_SUPPORT_TOKEN_ITERATOR + BOOST_TEST_SETUP_ASSERT( false, "depends_on decorator is not supported on this platform" ); +#else + utils::string_token_iterator tit( m_dependency, (utils::dropped_delimeters = "/", utils::kept_delimeters = utils::dt_none) ); + + test_unit* dep = &framework::master_test_suite(); + while( tit != utils::string_token_iterator() ) { + BOOST_TEST_SETUP_ASSERT( dep->p_type == TUT_SUITE, std::string( "incorrect dependency specification " ) + m_dependency ); + + test_unit_id next_id = static_cast(dep)->get( *tit ); + + BOOST_TEST_SETUP_ASSERT( next_id != INV_TEST_UNIT_ID, + std::string( "incorrect dependency specification " ) + m_dependency ); + + dep = &framework::get( next_id, TUT_ANY ); + ++tit; + } + + tu.depends_on( dep ); +#endif +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** decorator::enable_if/enabled/disabled ************** // +// ************************************************************************** // + +void +enable_if_impl::apply_impl( test_unit& tu, bool condition ) +{ + BOOST_TEST_SETUP_ASSERT(tu.p_default_status == test_unit::RS_INHERIT, + "Can't apply multiple enabled/disabled decorators " + "to the same test unit " + tu.full_name()); + + tu.p_default_status.value = condition ? test_unit::RS_ENABLED : test_unit::RS_DISABLED; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** decorator::fixture ************** // +// ************************************************************************** // + +void +fixture_t::apply( test_unit& tu ) +{ + tu.p_fixtures.value.push_back( m_impl ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** decorator::depends_on ************** // +// ************************************************************************** // + +void +precondition::apply( test_unit& tu ) +{ + tu.add_precondition( m_precondition ); +} + +//____________________________________________________________________________// + +} // namespace decorator +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TREE_DECORATOR_IPP_091911GER diff --git a/libraries/boost/include/boost/test/impl/execution_monitor.ipp b/libraries/boost/include/boost/test/impl/execution_monitor.ipp new file mode 100644 index 0000000000..035bb958c1 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/execution_monitor.ipp @@ -0,0 +1,1448 @@ +// (C) Copyright Gennadiy Rozental 2001. +// (C) Copyright Beman Dawes and Ullrich Koethe 1995-2001. +// Use, modification, and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Provides execution monitor implementation for all supported +/// configurations, including Microsoft structured exception based, unix signals +/// based and special workarounds for borland +/// +/// Note that when testing requirements or user wishes preclude use of this +/// file as a separate compilation unit, it may be included as a header file. +/// +/// Header dependencies are deliberately restricted to reduce coupling to other +/// boost libraries. +// *************************************************************************** + +#ifndef BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER +#define BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER + +// Boost.Test +#include +#include +#include +#include +#include + +// Boost +#include // for exit codes +#include // for workarounds +#include // for ignore_unused +#ifndef BOOST_NO_EXCEPTIONS +#include // for get_error_info +#include // for current_exception_cast +#endif + +// STL +#include // for std::string +#include // for std::bad_alloc +#include // for std::bad_cast, std::bad_typeid +#include // for std::exception, std::bad_exception +#include // for std exception hierarchy +#include // for C string API +#include // for assert +#include // for NULL +#include // for vsnprintf +#include // for varargs + +#include // for varargs + +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::strerror; using ::strlen; using ::strncat; } +#endif + +// to use vsnprintf +#if defined(__SUNPRO_CC) || defined(__SunOS) +# include +# include +using std::va_list; +#endif + +// to use vsnprintf +#if defined(__QNXNTO__) || defined(__VXWORKS__) +# include +using std::va_list; +#endif + +#if defined(__VXWORKS__) +# define BOOST_TEST_LIMITED_SIGNAL_DETAILS +#endif + +#ifdef BOOST_SEH_BASED_SIGNAL_HANDLING +# include + +# if defined(__MWERKS__) || (defined(_MSC_VER) && !defined(UNDER_CE)) +# include +# endif + +# if defined(__BORLANDC__) && __BORLANDC__ >= 0x560 || defined(__MWERKS__) +# include +# endif + +# if defined(__BORLANDC__) && __BORLANDC__ < 0x560 + typedef unsigned uintptr_t; +# endif + +# if defined(UNDER_CE) && BOOST_WORKAROUND(_MSC_VER, < 1500 ) + typedef void* uintptr_t; +# elif defined(UNDER_CE) +# include +# endif + +# if !defined(NDEBUG) && defined(_MSC_VER) && !defined(UNDER_CE) +# include +# define BOOST_TEST_CRT_HOOK_TYPE _CRT_REPORT_HOOK +# define BOOST_TEST_CRT_ASSERT _CRT_ASSERT +# define BOOST_TEST_CRT_ERROR _CRT_ERROR +# define BOOST_TEST_CRT_SET_HOOK(H) _CrtSetReportHook(H) +# else +# define BOOST_TEST_CRT_HOOK_TYPE void* +# define BOOST_TEST_CRT_ASSERT 2 +# define BOOST_TEST_CRT_ERROR 1 +# define BOOST_TEST_CRT_SET_HOOK(H) (void*)(H) +# endif + +# if (!BOOST_WORKAROUND(_MSC_VER, >= 1400 ) && \ + !defined(BOOST_COMO)) || defined(UNDER_CE) + +typedef void* _invalid_parameter_handler; + +inline _invalid_parameter_handler +_set_invalid_parameter_handler( _invalid_parameter_handler arg ) +{ + return arg; +} + +# endif + +# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564)) || defined(UNDER_CE) + +namespace { void _set_se_translator( void* ) {} } + +# endif + +#elif defined(BOOST_HAS_SIGACTION) + +# define BOOST_SIGACTION_BASED_SIGNAL_HANDLING + +# include +# include +# include + +# if defined(__FreeBSD__) + +# include + +# ifndef SIGPOLL +# define SIGPOLL SIGIO +# endif + +# if (__FreeBSD_version < 70100) + +# define ILL_ILLADR 0 // ILL_RESAD_FAULT +# define ILL_PRVOPC ILL_PRIVIN_FAULT +# define ILL_ILLOPN 2 // ILL_RESOP_FAULT +# define ILL_COPROC ILL_FPOP_FAULT + +# define BOOST_TEST_LIMITED_SIGNAL_DETAILS + +# endif +# endif + +# if defined(__ANDROID__) +# include +# endif + +// documentation of BOOST_TEST_DISABLE_ALT_STACK in execution_monitor.hpp +# if !defined(__CYGWIN__) && !defined(__QNXNTO__) && !defined(__bgq__) && \ + (!defined(__ANDROID__) || __ANDROID_API__ >= 8) && \ + !defined(BOOST_TEST_DISABLE_ALT_STACK) +# define BOOST_TEST_USE_ALT_STACK +# endif + +# if defined(SIGPOLL) && !defined(__CYGWIN__) && \ + !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && \ + !defined(__NetBSD__) && \ + !defined(__QNXNTO__) +# define BOOST_TEST_CATCH_SIGPOLL +# endif + +# ifdef BOOST_TEST_USE_ALT_STACK +# define BOOST_TEST_ALT_STACK_SIZE SIGSTKSZ +# endif + + +#else + +# define BOOST_NO_SIGNAL_HANDLING + +#endif + +#ifndef UNDER_CE +#include +#endif + +#if !defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) +# include +#endif + +#include + +//____________________________________________________________________________// + +namespace boost { + +// ************************************************************************** // +// ************** throw_exception ************** // +// ************************************************************************** // + +#ifdef BOOST_NO_EXCEPTIONS +void throw_exception( std::exception const & e ) { abort(); } +#endif + +// ************************************************************************** // +// ************** report_error ************** // +// ************************************************************************** // + +namespace detail { + +#ifdef __BORLANDC__ +# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) std::vsnprintf( (a1), (a2), (a3), (a4) ) +#elif BOOST_WORKAROUND(_MSC_VER, <= 1310) || \ + BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3000)) || \ + defined(UNDER_CE) +# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) _vsnprintf( (a1), (a2), (a3), (a4) ) +#else +# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) vsnprintf( (a1), (a2), (a3), (a4) ) +#endif + +#ifndef BOOST_NO_EXCEPTIONS + +template +typename ErrorInfo::value_type +extract( boost::exception const* ex ) +{ + if( !ex ) + return 0; + + typename ErrorInfo::value_type const * val = boost::get_error_info( *ex ); + + return val ? *val : 0; +} + +//____________________________________________________________________________// + +static void +report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, va_list* args ) +{ + static const int REPORT_ERROR_BUFFER_SIZE = 4096; + static char buf[REPORT_ERROR_BUFFER_SIZE]; + + BOOST_TEST_VSNPRINTF( buf, sizeof(buf)-1, format, *args ); + buf[sizeof(buf)-1] = 0; + + va_end( *args ); + + BOOST_TEST_I_THROW(execution_exception( ec, buf, execution_exception::location( extract( be ), + (size_t)extract( be ), + extract( be ) ) )); +} + +//____________________________________________________________________________// + +static void +report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, ... ) +{ + va_list args; + va_start( args, format ); + + report_error( ec, be, format, &args ); +} + +#endif + +//____________________________________________________________________________// + +static void +report_error( execution_exception::error_code ec, char const* format, ... ) +{ + va_list args; + va_start( args, format ); + + report_error( ec, 0, format, &args ); +} + +//____________________________________________________________________________// + +template +inline int +do_invoke( Tr const& tr, Functor const& F ) +{ + return tr ? (*tr)( F ) : F(); +} + +//____________________________________________________________________________// + +struct fpe_except_guard { + explicit fpe_except_guard( unsigned detect_fpe ) + : m_detect_fpe( detect_fpe ) + { + // prepare fp exceptions control + m_previously_enabled = fpe::disable( fpe::BOOST_FPE_ALL ); + if( m_previously_enabled != fpe::BOOST_FPE_INV && detect_fpe != fpe::BOOST_FPE_OFF ) + fpe::enable( detect_fpe ); + } + ~fpe_except_guard() + { + if( m_detect_fpe != fpe::BOOST_FPE_OFF ) + fpe::disable( m_detect_fpe ); + if( m_previously_enabled != fpe::BOOST_FPE_INV ) + fpe::enable( m_previously_enabled ); + } + + unsigned m_detect_fpe; + unsigned m_previously_enabled; +}; + + +// ************************************************************************** // +// ************** typeid_name ************** // +// ************************************************************************** // + +#if !defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) +template +std::string +typeid_name( T const& t ) +{ + return boost::core::demangle(typeid(t).name()); +} +#endif + +} // namespace detail + +#if defined(BOOST_SIGACTION_BASED_SIGNAL_HANDLING) + +// ************************************************************************** // +// ************** Sigaction based signal handling ************** // +// ************************************************************************** // + +namespace detail { + +// ************************************************************************** // +// ************** boost::detail::system_signal_exception ************** // +// ************************************************************************** // + +class system_signal_exception { +public: + // Constructor + system_signal_exception() + : m_sig_info( 0 ) + , m_context( 0 ) + {} + + // Access methods + void operator()( siginfo_t* i, void* c ) + { + m_sig_info = i; + m_context = c; + } + void report() const; + +private: + // Data members + siginfo_t* m_sig_info; // system signal detailed info + void* m_context; // signal context +}; + +//____________________________________________________________________________// + +void +system_signal_exception::report() const +{ + if( !m_sig_info ) + return; // no error actually occur? + + switch( m_sig_info->si_code ) { +#ifdef __VXWORKS__ +// a bit of a hack to adapt code to small m_sig_info VxWorks uses +#define si_addr si_value.sival_int +#define si_band si_value.sival_int +#else + case SI_USER: + report_error( execution_exception::system_error, + "signal: generated by kill() (or family); uid=%d; pid=%d", + (int)m_sig_info->si_uid, (int)m_sig_info->si_pid ); + break; +#endif + case SI_QUEUE: + report_error( execution_exception::system_error, + "signal: sent by sigqueue()" ); + break; + case SI_TIMER: + report_error( execution_exception::system_error, + "signal: the expiration of a timer set by timer_settimer()" ); + break; + case SI_ASYNCIO: + report_error( execution_exception::system_error, + "signal: generated by the completion of an asynchronous I/O request" ); + break; + case SI_MESGQ: + report_error( execution_exception::system_error, + "signal: generated by the the arrival of a message on an empty message queue" ); + break; + default: + break; + } + + switch( m_sig_info->si_signo ) { + case SIGILL: + switch( m_sig_info->si_code ) { +#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS + case ILL_ILLOPC: + report_error( execution_exception::system_fatal_error, + "signal: illegal opcode; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case ILL_ILLTRP: + report_error( execution_exception::system_fatal_error, + "signal: illegal trap; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case ILL_PRVREG: + report_error( execution_exception::system_fatal_error, + "signal: privileged register; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case ILL_BADSTK: + report_error( execution_exception::system_fatal_error, + "signal: internal stack error; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; +#endif + case ILL_ILLOPN: + report_error( execution_exception::system_fatal_error, + "signal: illegal operand; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case ILL_ILLADR: + report_error( execution_exception::system_fatal_error, + "signal: illegal addressing mode; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case ILL_PRVOPC: + report_error( execution_exception::system_fatal_error, + "signal: privileged opcode; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case ILL_COPROC: + report_error( execution_exception::system_fatal_error, + "signal: co-processor error; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + default: + report_error( execution_exception::system_fatal_error, + "signal: SIGILL, si_code: %d (illegal instruction; address of failing instruction: 0x%08lx)", + m_sig_info->si_addr, m_sig_info->si_code ); + break; + } + break; + + case SIGFPE: + switch( m_sig_info->si_code ) { + case FPE_INTDIV: + report_error( execution_exception::system_error, + "signal: integer divide by zero; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case FPE_INTOVF: + report_error( execution_exception::system_error, + "signal: integer overflow; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case FPE_FLTDIV: + report_error( execution_exception::system_error, + "signal: floating point divide by zero; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case FPE_FLTOVF: + report_error( execution_exception::system_error, + "signal: floating point overflow; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case FPE_FLTUND: + report_error( execution_exception::system_error, + "signal: floating point underflow; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case FPE_FLTRES: + report_error( execution_exception::system_error, + "signal: floating point inexact result; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case FPE_FLTINV: + report_error( execution_exception::system_error, + "signal: invalid floating point operation; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + case FPE_FLTSUB: + report_error( execution_exception::system_error, + "signal: subscript out of range; address of failing instruction: 0x%08lx", + m_sig_info->si_addr ); + break; + default: + report_error( execution_exception::system_error, + "signal: SIGFPE, si_code: %d (errnoneous arithmetic operations; address of failing instruction: 0x%08lx)", + m_sig_info->si_addr, m_sig_info->si_code ); + break; + } + break; + + case SIGSEGV: + switch( m_sig_info->si_code ) { +#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS + case SEGV_MAPERR: + report_error( execution_exception::system_fatal_error, + "memory access violation at address: 0x%08lx: no mapping at fault address", + m_sig_info->si_addr ); + break; + case SEGV_ACCERR: + report_error( execution_exception::system_fatal_error, + "memory access violation at address: 0x%08lx: invalid permissions", + m_sig_info->si_addr ); + break; +#endif + default: + report_error( execution_exception::system_fatal_error, + "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)", + m_sig_info->si_addr, m_sig_info->si_code ); + break; + } + break; + + case SIGBUS: + switch( m_sig_info->si_code ) { +#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS + case BUS_ADRALN: + report_error( execution_exception::system_fatal_error, + "memory access violation at address: 0x%08lx: invalid address alignment", + m_sig_info->si_addr ); + break; + case BUS_ADRERR: + report_error( execution_exception::system_fatal_error, + "memory access violation at address: 0x%08lx: non-existent physical address", + m_sig_info->si_addr ); + break; + case BUS_OBJERR: + report_error( execution_exception::system_fatal_error, + "memory access violation at address: 0x%08lx: object specific hardware error", + m_sig_info->si_addr ); + break; +#endif + default: + report_error( execution_exception::system_fatal_error, + "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)", + m_sig_info->si_addr, m_sig_info->si_code ); + break; + } + break; + +#if defined(BOOST_TEST_CATCH_SIGPOLL) + + case SIGPOLL: + switch( m_sig_info->si_code ) { +#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS + case POLL_IN: + report_error( execution_exception::system_error, + "data input available; band event %d", + (int)m_sig_info->si_band ); + break; + case POLL_OUT: + report_error( execution_exception::system_error, + "output buffers available; band event %d", + (int)m_sig_info->si_band ); + break; + case POLL_MSG: + report_error( execution_exception::system_error, + "input message available; band event %d", + (int)m_sig_info->si_band ); + break; + case POLL_ERR: + report_error( execution_exception::system_error, + "i/o error; band event %d", + (int)m_sig_info->si_band ); + break; + case POLL_PRI: + report_error( execution_exception::system_error, + "high priority input available; band event %d", + (int)m_sig_info->si_band ); + break; +#if defined(POLL_ERR) && defined(POLL_HUP) && (POLL_ERR - POLL_HUP) + case POLL_HUP: + report_error( execution_exception::system_error, + "device disconnected; band event %d", + (int)m_sig_info->si_band ); + break; +#endif +#endif + default: + report_error( execution_exception::system_error, + "signal: SIGPOLL, si_code: %d (asynchronous I/O event occurred; band event %d)", + (int)m_sig_info->si_band, m_sig_info->si_code ); + break; + } + break; + +#endif + + case SIGABRT: + report_error( execution_exception::system_error, + "signal: SIGABRT (application abort requested)" ); + break; + + case SIGALRM: + report_error( execution_exception::timeout_error, + "signal: SIGALRM (timeout while executing function)" ); + break; + + default: + report_error( execution_exception::system_error, + "unrecognized signal %d", m_sig_info->si_signo ); + } +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** boost::detail::signal_action ************** // +// ************************************************************************** // + +// Forward declaration +extern "C" { +static void boost_execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context ); +static void boost_execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context ); +} + +class signal_action { + typedef struct sigaction* sigaction_ptr; +public: + //Constructor + signal_action(); + signal_action( int sig, bool install, bool attach_dbg, char* alt_stack ); + ~signal_action(); + +private: + // Data members + int m_sig; + bool m_installed; + struct sigaction m_new_action; + struct sigaction m_old_action; +}; + +//____________________________________________________________________________// + +signal_action::signal_action() +: m_installed( false ) +{} + +//____________________________________________________________________________// + +signal_action::signal_action( int sig, bool install, bool attach_dbg, char* alt_stack ) +: m_sig( sig ) +, m_installed( install ) +{ + if( !install ) + return; + + std::memset( &m_new_action, 0, sizeof(struct sigaction) ); + + BOOST_TEST_SYS_ASSERT( ::sigaction( m_sig , sigaction_ptr(), &m_new_action ) != -1 ); + + if( m_new_action.sa_sigaction || m_new_action.sa_handler ) { + m_installed = false; + return; + } + + m_new_action.sa_flags |= SA_SIGINFO; + m_new_action.sa_sigaction = attach_dbg ? &boost_execution_monitor_attaching_signal_handler + : &boost_execution_monitor_jumping_signal_handler; + BOOST_TEST_SYS_ASSERT( sigemptyset( &m_new_action.sa_mask ) != -1 ); + +#ifdef BOOST_TEST_USE_ALT_STACK + if( alt_stack ) + m_new_action.sa_flags |= SA_ONSTACK; +#endif + + BOOST_TEST_SYS_ASSERT( ::sigaction( m_sig, &m_new_action, &m_old_action ) != -1 ); +} + +//____________________________________________________________________________// + +signal_action::~signal_action() +{ + if( m_installed ) + ::sigaction( m_sig, &m_old_action , sigaction_ptr() ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** boost::detail::signal_handler ************** // +// ************************************************************************** // + +class signal_handler { +public: + // Constructor + explicit signal_handler( bool catch_system_errors, bool detect_fpe, unsigned timeout, bool attach_dbg, char* alt_stack ); + + // Destructor + ~signal_handler(); + + // access methods + static sigjmp_buf& jump_buffer() + { + assert( !!s_active_handler ); + + return s_active_handler->m_sigjmp_buf; + } + + static system_signal_exception& sys_sig() + { + assert( !!s_active_handler ); + + return s_active_handler->m_sys_sig; + } + +private: + // Data members + signal_handler* m_prev_handler; + unsigned m_timeout; + + // Note: We intentionality do not catch SIGCHLD. Users have to deal with it themselves + signal_action m_ILL_action; + signal_action m_FPE_action; + signal_action m_SEGV_action; + signal_action m_BUS_action; + signal_action m_CHLD_action; + signal_action m_POLL_action; + signal_action m_ABRT_action; + signal_action m_ALRM_action; + + sigjmp_buf m_sigjmp_buf; + system_signal_exception m_sys_sig; + + static signal_handler* s_active_handler; +}; + +// !! need to be placed in thread specific storage +typedef signal_handler* signal_handler_ptr; +signal_handler* signal_handler::s_active_handler = signal_handler_ptr(); + +//____________________________________________________________________________// + +signal_handler::signal_handler( bool catch_system_errors, bool detect_fpe, unsigned timeout, bool attach_dbg, char* alt_stack ) +: m_prev_handler( s_active_handler ) +, m_timeout( timeout ) +, m_ILL_action ( SIGILL , catch_system_errors, attach_dbg, alt_stack ) +, m_FPE_action ( SIGFPE , detect_fpe , attach_dbg, alt_stack ) +, m_SEGV_action( SIGSEGV, catch_system_errors, attach_dbg, alt_stack ) +, m_BUS_action ( SIGBUS , catch_system_errors, attach_dbg, alt_stack ) +#ifdef BOOST_TEST_CATCH_SIGPOLL +, m_POLL_action( SIGPOLL, catch_system_errors, attach_dbg, alt_stack ) +#endif +, m_ABRT_action( SIGABRT, catch_system_errors, attach_dbg, alt_stack ) +, m_ALRM_action( SIGALRM, timeout > 0 , attach_dbg, alt_stack ) +{ + s_active_handler = this; + + if( m_timeout > 0 ) { + ::alarm( 0 ); + ::alarm( timeout ); + } + +#ifdef BOOST_TEST_USE_ALT_STACK + if( alt_stack ) { + stack_t sigstk; + std::memset( &sigstk, 0, sizeof(stack_t) ); + + BOOST_TEST_SYS_ASSERT( ::sigaltstack( 0, &sigstk ) != -1 ); + + if( sigstk.ss_flags & SS_DISABLE ) { + sigstk.ss_sp = alt_stack; + sigstk.ss_size = BOOST_TEST_ALT_STACK_SIZE; + sigstk.ss_flags = 0; + BOOST_TEST_SYS_ASSERT( ::sigaltstack( &sigstk, 0 ) != -1 ); + } + } +#endif +} + +//____________________________________________________________________________// + +signal_handler::~signal_handler() +{ + assert( s_active_handler == this ); + + if( m_timeout > 0 ) + ::alarm( 0 ); + +#ifdef BOOST_TEST_USE_ALT_STACK +#ifdef __GNUC__ + // We shouldn't need to explicitly initialize all the members here, + // but gcc warns if we don't, so add initializers for each of the + // members specified in the POSIX std: + stack_t sigstk = { 0, 0, 0 }; +#else + stack_t sigstk = { }; +#endif + + sigstk.ss_size = MINSIGSTKSZ; + sigstk.ss_flags = SS_DISABLE; + if( ::sigaltstack( &sigstk, 0 ) == -1 ) { + int error_n = errno; + std::cerr << "******** errors disabling the alternate stack:" << std::endl + << "\t#error:" << error_n << std::endl + << "\t" << std::strerror( error_n ) << std::endl; + } +#endif + + s_active_handler = m_prev_handler; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** execution_monitor_signal_handler ************** // +// ************************************************************************** // + +extern "C" { + +static void boost_execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context ) +{ + signal_handler::sys_sig()( info, context ); + + siglongjmp( signal_handler::jump_buffer(), sig ); +} + +//____________________________________________________________________________// + +static void boost_execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context ) +{ + if( !debug::attach_debugger( false ) ) + boost_execution_monitor_jumping_signal_handler( sig, info, context ); + + // debugger attached; it will handle the signal + BOOST_TEST_SYS_ASSERT( ::signal( sig, SIG_DFL ) != SIG_ERR ); +} + +//____________________________________________________________________________// + +} + +} // namespace detail + +// ************************************************************************** // +// ************** execution_monitor::catch_signals ************** // +// ************************************************************************** // + +int +execution_monitor::catch_signals( boost::function const& F ) +{ + using namespace detail; + +#if defined(__CYGWIN__) + p_catch_system_errors.value = false; +#endif + +#ifdef BOOST_TEST_USE_ALT_STACK + if( !!p_use_alt_stack && !m_alt_stack ) + m_alt_stack.reset( new char[BOOST_TEST_ALT_STACK_SIZE] ); +#else + p_use_alt_stack.value = false; +#endif + + signal_handler local_signal_handler( p_catch_system_errors, + p_catch_system_errors || (p_detect_fp_exceptions != fpe::BOOST_FPE_OFF), + p_timeout, + p_auto_start_dbg, + !p_use_alt_stack ? 0 : m_alt_stack.get() ); + + if( !sigsetjmp( signal_handler::jump_buffer(), 1 ) ) + return detail::do_invoke( m_custom_translators , F ); + else + BOOST_TEST_I_THROW( local_signal_handler.sys_sig() ); +} + +//____________________________________________________________________________// + +#elif defined(BOOST_SEH_BASED_SIGNAL_HANDLING) + +// ************************************************************************** // +// ************** Microsoft structured exception handling ************** // +// ************************************************************************** // + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564)) +namespace { void _set_se_translator( void* ) {} } +#endif + +namespace detail { + +// ************************************************************************** // +// ************** boost::detail::system_signal_exception ************** // +// ************************************************************************** // + +class system_signal_exception { +public: + // Constructor + explicit system_signal_exception( execution_monitor* em ) + : m_em( em ) + , m_se_id( 0 ) + , m_fault_address( 0 ) + , m_dir( false ) + {} + + void report() const; + int operator()( unsigned id, _EXCEPTION_POINTERS* exps ); + +private: + // Data members + execution_monitor* m_em; + + unsigned m_se_id; + void* m_fault_address; + bool m_dir; +}; + +//____________________________________________________________________________// + +#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) +static void +seh_catch_preventer( unsigned /* id */, _EXCEPTION_POINTERS* /* exps */ ) +{ + throw; +} +#endif + +//____________________________________________________________________________// + +int +system_signal_exception::operator()( unsigned id, _EXCEPTION_POINTERS* exps ) +{ + const unsigned MSFT_CPP_EXCEPT = 0xE06d7363; // EMSC + + // C++ exception - allow to go through + if( id == MSFT_CPP_EXCEPT ) + return EXCEPTION_CONTINUE_SEARCH; + + // FPE detection is enabled, while system exception detection is not - check if this is actually FPE + if( !m_em->p_catch_system_errors ) { + if( !m_em->p_detect_fp_exceptions ) + return EXCEPTION_CONTINUE_SEARCH; + + switch( id ) { + case EXCEPTION_FLT_DIVIDE_BY_ZERO: + case EXCEPTION_FLT_STACK_CHECK: + case EXCEPTION_FLT_DENORMAL_OPERAND: + case EXCEPTION_FLT_INEXACT_RESULT: + case EXCEPTION_FLT_OVERFLOW: + case EXCEPTION_FLT_UNDERFLOW: + case EXCEPTION_FLT_INVALID_OPERATION: + case STATUS_FLOAT_MULTIPLE_FAULTS: + case STATUS_FLOAT_MULTIPLE_TRAPS: + break; + default: + return EXCEPTION_CONTINUE_SEARCH; + } + } + + if( !!m_em->p_auto_start_dbg && debug::attach_debugger( false ) ) { + m_em->p_catch_system_errors.value = false; +#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) + _set_se_translator( &seh_catch_preventer ); +#endif + return EXCEPTION_CONTINUE_EXECUTION; + } + + m_se_id = id; + if( m_se_id == EXCEPTION_ACCESS_VIOLATION && exps->ExceptionRecord->NumberParameters == 2 ) { + m_fault_address = (void*)exps->ExceptionRecord->ExceptionInformation[1]; + m_dir = exps->ExceptionRecord->ExceptionInformation[0] == 0; + } + + return EXCEPTION_EXECUTE_HANDLER; +} + +//____________________________________________________________________________// + +void +system_signal_exception::report() const +{ + switch( m_se_id ) { + // cases classified as system_fatal_error + case EXCEPTION_ACCESS_VIOLATION: { + if( !m_fault_address ) + detail::report_error( execution_exception::system_fatal_error, "memory access violation" ); + else + detail::report_error( + execution_exception::system_fatal_error, + "memory access violation occurred at address 0x%08lx, while attempting to %s", + m_fault_address, + m_dir ? " read inaccessible data" + : " write to an inaccessible (or protected) address" + ); + break; + } + + case EXCEPTION_ILLEGAL_INSTRUCTION: + detail::report_error( execution_exception::system_fatal_error, "illegal instruction" ); + break; + + case EXCEPTION_PRIV_INSTRUCTION: + detail::report_error( execution_exception::system_fatal_error, "tried to execute an instruction whose operation is not allowed in the current machine mode" ); + break; + + case EXCEPTION_IN_PAGE_ERROR: + detail::report_error( execution_exception::system_fatal_error, "access to a memory page that is not present" ); + break; + + case EXCEPTION_STACK_OVERFLOW: + detail::report_error( execution_exception::system_fatal_error, "stack overflow" ); + break; + + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + detail::report_error( execution_exception::system_fatal_error, "tried to continue execution after a non continuable exception occurred" ); + break; + + // cases classified as (non-fatal) system_trap + case EXCEPTION_DATATYPE_MISALIGNMENT: + detail::report_error( execution_exception::system_error, "data misalignment" ); + break; + + case EXCEPTION_INT_DIVIDE_BY_ZERO: + detail::report_error( execution_exception::system_error, "integer divide by zero" ); + break; + + case EXCEPTION_INT_OVERFLOW: + detail::report_error( execution_exception::system_error, "integer overflow" ); + break; + + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + detail::report_error( execution_exception::system_error, "array bounds exceeded" ); + break; + + case EXCEPTION_FLT_DIVIDE_BY_ZERO: + detail::report_error( execution_exception::system_error, "floating point divide by zero" ); + break; + + case EXCEPTION_FLT_STACK_CHECK: + detail::report_error( execution_exception::system_error, + "stack overflowed or underflowed as the result of a floating-point operation" ); + break; + + case EXCEPTION_FLT_DENORMAL_OPERAND: + detail::report_error( execution_exception::system_error, + "operand of floating point operation is denormal" ); + break; + + case EXCEPTION_FLT_INEXACT_RESULT: + detail::report_error( execution_exception::system_error, + "result of a floating-point operation cannot be represented exactly" ); + break; + + case EXCEPTION_FLT_OVERFLOW: + detail::report_error( execution_exception::system_error, + "exponent of a floating-point operation is greater than the magnitude allowed by the corresponding type" ); + break; + + case EXCEPTION_FLT_UNDERFLOW: + detail::report_error( execution_exception::system_error, + "exponent of a floating-point operation is less than the magnitude allowed by the corresponding type" ); + break; + + case EXCEPTION_FLT_INVALID_OPERATION: + detail::report_error( execution_exception::system_error, "floating point error" ); + break; + + case STATUS_FLOAT_MULTIPLE_FAULTS: + detail::report_error( execution_exception::system_error, "multiple floating point errors" ); + break; + + case STATUS_FLOAT_MULTIPLE_TRAPS: + detail::report_error( execution_exception::system_error, "multiple floating point errors" ); + break; + + case EXCEPTION_BREAKPOINT: + detail::report_error( execution_exception::system_error, "breakpoint encountered" ); + break; + + default: + detail::report_error( execution_exception::system_error, "unrecognized exception. Id: 0x%08lx", m_se_id ); + break; + } +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** assert_reporting_function ************** // +// ************************************************************************** // + +int BOOST_TEST_CALL_DECL +assert_reporting_function( int reportType, char* userMessage, int* ) +{ + // write this way instead of switch to avoid unreachable statements + if( reportType == BOOST_TEST_CRT_ASSERT || reportType == BOOST_TEST_CRT_ERROR ) + detail::report_error( reportType == BOOST_TEST_CRT_ASSERT ? execution_exception::user_error : execution_exception::system_error, userMessage ); + + return 0; +} // assert_reporting_function + +//____________________________________________________________________________// + +void BOOST_TEST_CALL_DECL +invalid_param_handler( wchar_t const* /* expr */, + wchar_t const* /* func */, + wchar_t const* /* file */, + unsigned /* line */, + uintptr_t /* reserved */) +{ + detail::report_error( execution_exception::user_error, + "Invalid parameter detected by C runtime library" ); +} + +//____________________________________________________________________________// + +} // namespace detail + +// ************************************************************************** // +// ************** execution_monitor::catch_signals ************** // +// ************************************************************************** // + +int +execution_monitor::catch_signals( boost::function const& F ) +{ + _invalid_parameter_handler old_iph = _invalid_parameter_handler(); + BOOST_TEST_CRT_HOOK_TYPE old_crt_hook = 0; + + if( p_catch_system_errors ) { + old_crt_hook = BOOST_TEST_CRT_SET_HOOK( &detail::assert_reporting_function ); + + old_iph = _set_invalid_parameter_handler( + reinterpret_cast<_invalid_parameter_handler>( &detail::invalid_param_handler ) ); + } else if( !p_detect_fp_exceptions ) { +#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) + _set_se_translator( &detail::seh_catch_preventer ); +#endif + } + + detail::system_signal_exception SSE( this ); + + int ret_val = 0; + // clang windows workaround: this not available in __finally scope + bool l_catch_system_errors = p_catch_system_errors; + + __try { + __try { + ret_val = detail::do_invoke( m_custom_translators, F ); + } + __except( SSE( GetExceptionCode(), GetExceptionInformation() ) ) { + throw SSE; + } + } + __finally { + if( l_catch_system_errors ) { + BOOST_TEST_CRT_SET_HOOK( old_crt_hook ); + + _set_invalid_parameter_handler( old_iph ); + } + } + + return ret_val; +} + +//____________________________________________________________________________// + +#else // default signal handler + +namespace detail { + +class system_signal_exception { +public: + void report() const {} +}; + +} // namespace detail + +int +execution_monitor::catch_signals( boost::function const& F ) +{ + return detail::do_invoke( m_custom_translators , F ); +} + +//____________________________________________________________________________// + +#endif // choose signal handler + +// ************************************************************************** // +// ************** execution_monitor ************** // +// ************************************************************************** // + +execution_monitor::execution_monitor() +: p_catch_system_errors( true ) +, p_auto_start_dbg( false ) +, p_timeout( 0 ) +, p_use_alt_stack( true ) +, p_detect_fp_exceptions( fpe::BOOST_FPE_OFF ) +{} + +//____________________________________________________________________________// + +int +execution_monitor::execute( boost::function const& F ) +{ + if( debug::under_debugger() ) + p_catch_system_errors.value = false; + + BOOST_TEST_I_TRY { + detail::fpe_except_guard G( p_detect_fp_exceptions ); + unit_test::ut_detail::ignore_unused_variable_warning( G ); + + return catch_signals( F ); + } + +#ifndef BOOST_NO_EXCEPTIONS + + // Catch-clause reference arguments are a bit different from function + // arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't + // required. Programmers ask for const anyhow, so we supply it. That's + // easier than answering questions about non-const usage. + + catch( char const* ex ) + { detail::report_error( execution_exception::cpp_exception_error, + "C string: %s", ex ); } + catch( std::string const& ex ) + { detail::report_error( execution_exception::cpp_exception_error, + "std::string: %s", ex.c_str() ); } + + // std:: exceptions +#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI) +#define CATCH_AND_REPORT_STD_EXCEPTION( ex_name ) \ + catch( ex_name const& ex ) \ + { detail::report_error( execution_exception::cpp_exception_error, \ + current_exception_cast(), \ + #ex_name ": %s", ex.what() ); } \ +/**/ +#else +#define CATCH_AND_REPORT_STD_EXCEPTION( ex_name ) \ + catch( ex_name const& ex ) \ + { detail::report_error( execution_exception::cpp_exception_error, \ + current_exception_cast(), \ + "%s: %s", detail::typeid_name(ex).c_str(), ex.what() ); } \ +/**/ +#endif + + CATCH_AND_REPORT_STD_EXCEPTION( std::bad_alloc ) + +#if BOOST_WORKAROUND(__BORLANDC__, <= 0x0551) + CATCH_AND_REPORT_STD_EXCEPTION( std::bad_cast ) + CATCH_AND_REPORT_STD_EXCEPTION( std::bad_typeid ) +#else + CATCH_AND_REPORT_STD_EXCEPTION( std::bad_cast ) + CATCH_AND_REPORT_STD_EXCEPTION( std::bad_typeid ) +#endif + + CATCH_AND_REPORT_STD_EXCEPTION( std::bad_exception ) + CATCH_AND_REPORT_STD_EXCEPTION( std::domain_error ) + CATCH_AND_REPORT_STD_EXCEPTION( std::invalid_argument ) + CATCH_AND_REPORT_STD_EXCEPTION( std::length_error ) + CATCH_AND_REPORT_STD_EXCEPTION( std::out_of_range ) + CATCH_AND_REPORT_STD_EXCEPTION( std::range_error ) + CATCH_AND_REPORT_STD_EXCEPTION( std::overflow_error ) + CATCH_AND_REPORT_STD_EXCEPTION( std::underflow_error ) + CATCH_AND_REPORT_STD_EXCEPTION( std::logic_error ) + CATCH_AND_REPORT_STD_EXCEPTION( std::runtime_error ) + CATCH_AND_REPORT_STD_EXCEPTION( std::exception ) +#undef CATCH_AND_REPORT_STD_EXCEPTION + + catch( boost::exception const& ex ) + { detail::report_error( execution_exception::cpp_exception_error, + &ex, +#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI) + "unknown boost::exception" ); } +#else + typeid(ex).name() ); } +#endif + + // system errors + catch( system_error const& ex ) + { detail::report_error( execution_exception::cpp_exception_error, + "system_error produced by: %s: %s", ex.p_failed_exp, std::strerror( ex.p_errno ) ); } + catch( detail::system_signal_exception const& ex ) + { ex.report(); } + + // not an error + catch( execution_aborted const& ) + { return 0; } + + // just forward + catch( execution_exception const& ) + { throw; } + + // unknown error + catch( ... ) + { detail::report_error( execution_exception::cpp_exception_error, "unknown type" ); } + +#endif // !BOOST_NO_EXCEPTIONS + + return 0; // never reached; supplied to quiet compiler warnings +} // execute + +//____________________________________________________________________________// + +namespace detail { + +struct forward { + explicit forward( boost::function const& F ) : m_F( F ) {} + + int operator()() { m_F(); return 0; } + + boost::function const& m_F; +}; + +} // namespace detail +void +execution_monitor::vexecute( boost::function const& F ) +{ + execute( detail::forward( F ) ); +} + +// ************************************************************************** // +// ************** system_error ************** // +// ************************************************************************** // + +system_error::system_error( char const* exp ) +#ifdef UNDER_CE +: p_errno( GetLastError() ) +#else +: p_errno( errno ) +#endif +, p_failed_exp( exp ) +{} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** execution_exception ************** // +// ************************************************************************** // + +execution_exception::execution_exception( error_code ec_, const_string what_msg_, location const& location_ ) +: m_error_code( ec_ ) +, m_what( what_msg_.empty() ? BOOST_TEST_L( "uncaught exception, system error or abort requested" ) : what_msg_ ) +, m_location( location_ ) +{} + +//____________________________________________________________________________// + +execution_exception::location::location( char const* file_name, size_t line_num, char const* func ) +: m_file_name( file_name ? file_name : "unknown location" ) +, m_line_num( line_num ) +, m_function( func ) +{} + +execution_exception::location::location(const_string file_name, size_t line_num, char const* func ) +: m_file_name( file_name ) +, m_line_num( line_num ) +, m_function( func ) +{} + +//____________________________________________________________________________// + +// ************************************************************************** // +// **************Floating point exception management interface ************** // +// ************************************************************************** // + +namespace fpe { + +unsigned +enable( unsigned mask ) +{ + boost::ignore_unused(mask); +#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__) + _clearfp(); + +#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) + unsigned old_cw = ::_controlfp( 0, 0 ); + ::_controlfp( old_cw & ~mask, BOOST_FPE_ALL ); +#else + unsigned old_cw; + if( ::_controlfp_s( &old_cw, 0, 0 ) != 0 ) + return BOOST_FPE_INV; + + // Set the control word + if( ::_controlfp_s( 0, old_cw & ~mask, BOOST_FPE_ALL ) != 0 ) + return BOOST_FPE_INV; +#endif + return ~old_cw & BOOST_FPE_ALL; + +#elif defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__) + // same macro definition as in execution_monitor.hpp + if (BOOST_FPE_ALL == BOOST_FPE_OFF) + /* Not Implemented */ + return BOOST_FPE_OFF; + feclearexcept(BOOST_FPE_ALL); + int res = feenableexcept( mask ); + return res == -1 ? (unsigned)BOOST_FPE_INV : (unsigned)res; +#else + /* Not Implemented */ + return BOOST_FPE_OFF; +#endif +} + +//____________________________________________________________________________// + +unsigned +disable( unsigned mask ) +{ + boost::ignore_unused(mask); + +#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__) + _clearfp(); +#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) + unsigned old_cw = ::_controlfp( 0, 0 ); + ::_controlfp( old_cw | mask, BOOST_FPE_ALL ); +#else + unsigned old_cw; + if( ::_controlfp_s( &old_cw, 0, 0 ) != 0 ) + return BOOST_FPE_INV; + + // Set the control word + if( ::_controlfp_s( 0, old_cw | mask, BOOST_FPE_ALL ) != 0 ) + return BOOST_FPE_INV; +#endif + return ~old_cw & BOOST_FPE_ALL; + +#elif defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__) + if (BOOST_FPE_ALL == BOOST_FPE_OFF) + /* Not Implemented */ + return BOOST_FPE_INV; + feclearexcept(BOOST_FPE_ALL); + int res = fedisableexcept( mask ); + return res == -1 ? (unsigned)BOOST_FPE_INV : (unsigned)res; +#else + /* Not Implemented */ + return BOOST_FPE_INV; +#endif +} + +//____________________________________________________________________________// + +} // namespace fpe + +} // namespace boost + +#include + +#endif // BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/framework.ipp b/libraries/boost/include/boost/test/impl/framework.ipp new file mode 100644 index 0000000000..496e7de859 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/framework.ipp @@ -0,0 +1,1713 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : implements framework API - main driver for the test +// *************************************************************************** + +#ifndef BOOST_TEST_FRAMEWORK_IPP_021005GER +#define BOOST_TEST_FRAMEWORK_IPP_021005GER + +// Boost.Test +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if BOOST_TEST_SUPPORT_TOKEN_ITERATOR +#include +#endif + +#include +#include +#include + +#include +#include + +// Boost +#include +#include + +// STL +#include +#include +#include +#include +#include +#include +#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE +#include +#endif + +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::time; using ::srand; } +#endif + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace framework { + +namespace impl { + +// ************************************************************************** // +// ************** order detection helpers ************** // +// ************************************************************************** // + +struct order_info { + order_info() : depth(-1) {} + + int depth; + std::vector dependant_siblings; +}; + +typedef std::set tu_id_set; +typedef std::map order_info_per_tu; // !! ?? unordered map + +//____________________________________________________________________________// + +static test_unit_id +get_tu_parent( test_unit_id tu_id ) +{ + return framework::get( tu_id, TUT_ANY ).p_parent_id; +} + +//____________________________________________________________________________// + +static int +tu_depth( test_unit_id tu_id, test_unit_id master_tu_id, order_info_per_tu& tuoi ) +{ + if( tu_id == master_tu_id ) + return 0; + + order_info& info = tuoi[tu_id]; + + if( info.depth == -1 ) + info.depth = tu_depth( get_tu_parent( tu_id ), master_tu_id, tuoi ) + 1; + + return info.depth; +} + +//____________________________________________________________________________// + +static void +collect_dependant_siblings( test_unit_id from, test_unit_id to, test_unit_id master_tu_id, order_info_per_tu& tuoi ) +{ + int from_depth = tu_depth( from, master_tu_id, tuoi ); + int to_depth = tu_depth( to, master_tu_id, tuoi ); + + while(from_depth > to_depth) { + from = get_tu_parent( from ); + --from_depth; + } + + while(from_depth < to_depth) { + to = get_tu_parent( to ); + --to_depth; + } + + while(true) { + test_unit_id from_parent = get_tu_parent( from ); + test_unit_id to_parent = get_tu_parent( to ); + if( from_parent == to_parent ) + break; + from = from_parent; + to = to_parent; + } + + tuoi[from].dependant_siblings.push_back( to ); +} + +//____________________________________________________________________________// + +static counter_t +assign_sibling_rank( test_unit_id tu_id, order_info_per_tu& tuoi ) +{ + test_unit& tu = framework::get( tu_id, TUT_ANY ); + + BOOST_TEST_SETUP_ASSERT( tu.p_sibling_rank != (std::numeric_limits::max)(), + "Cyclic dependency detected involving test unit \"" + tu.full_name() + "\"" ); + + if( tu.p_sibling_rank != 0 ) + return tu.p_sibling_rank; + + order_info const& info = tuoi[tu_id]; + + // indicate in progress + tu.p_sibling_rank.value = (std::numeric_limits::max)(); + + counter_t new_rank = 1; + BOOST_TEST_FOREACH( test_unit_id, sibling_id, info.dependant_siblings ) + new_rank = (std::max)(new_rank, assign_sibling_rank( sibling_id, tuoi ) + 1); + + return tu.p_sibling_rank.value = new_rank; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** test_init call wrapper ************** // +// ************************************************************************** // + +static void +invoke_init_func( init_unit_test_func init_func ) +{ +#ifdef BOOST_TEST_ALTERNATIVE_INIT_API + BOOST_TEST_I_ASSRT( (*init_func)(), std::runtime_error( "test module initialization failed" ) ); +#else + test_suite* manual_test_units = (*init_func)( framework::master_test_suite().argc, framework::master_test_suite().argv ); + + if( manual_test_units ) + framework::master_test_suite().add( manual_test_units ); +#endif +} + +// ************************************************************************** // +// ************** name_filter ************** // +// ************************************************************************** // + +class name_filter : public test_tree_visitor { + struct component { + component( const_string name ) // has to be implicit + { + if( name == "*" ) + m_kind = SFK_ALL; + else if( first_char( name ) == '*' && last_char( name ) == '*' ) { + m_kind = SFK_SUBSTR; + m_name = name.substr( 1, name.size()-1 ); + } + else if( first_char( name ) == '*' ) { + m_kind = SFK_TRAILING; + m_name = name.substr( 1 ); + } + else if( last_char( name ) == '*' ) { + m_kind = SFK_LEADING; + m_name = name.substr( 0, name.size()-1 ); + } + else { + m_kind = SFK_MATCH; + m_name = name; + } + } + + bool pass( test_unit const& tu ) const + { + const_string name( tu.p_name ); + + switch( m_kind ) { + default: + case SFK_ALL: + return true; + case SFK_LEADING: + return name.substr( 0, m_name.size() ) == m_name; + case SFK_TRAILING: + return name.size() >= m_name.size() && name.substr( name.size() - m_name.size() ) == m_name; + case SFK_SUBSTR: + return name.find( m_name ) != const_string::npos; + case SFK_MATCH: + return m_name == tu.p_name.get(); + } + } + enum kind { SFK_ALL, SFK_LEADING, SFK_TRAILING, SFK_SUBSTR, SFK_MATCH }; + + kind m_kind; + const_string m_name; + }; + +public: + // Constructor + name_filter( test_unit_id_list& targ_list, const_string filter_expr ) : m_targ_list( targ_list ), m_depth( 0 ) + { +#ifdef BOOST_TEST_SUPPORT_TOKEN_ITERATOR + utils::string_token_iterator tit( filter_expr, (utils::dropped_delimeters = "/", + utils::kept_delimeters = utils::dt_none) ); + + while( tit != utils::string_token_iterator() ) { + m_components.push_back( + std::vector( utils::string_token_iterator( *tit, (utils::dropped_delimeters = ",", + utils::kept_delimeters = utils::dt_none) ), + utils::string_token_iterator() ) ); + + ++tit; + } +#endif + } + +private: + bool filter_unit( test_unit const& tu ) + { + // skip master test suite + if( m_depth == 0 ) + return true; + + // corresponding name filters are at level m_depth-1 + std::vector const& filters = m_components[m_depth-1]; + + // look for match + using namespace boost::placeholders; + return std::find_if( filters.begin(), filters.end(), bind( &component::pass, _1, boost::ref(tu) ) ) != filters.end(); + } + + // test_tree_visitor interface + virtual void visit( test_case const& tc ) + { + // make sure we only accept test cases if we match last component of the filter + if( m_depth == m_components.size() && filter_unit( tc ) ) + m_targ_list.push_back( tc.p_id ); // found a test case + } + virtual bool test_suite_start( test_suite const& ts ) + { + if( !filter_unit( ts ) ) + return false; + + if( m_depth < m_components.size() ) { + ++m_depth; + return true; + } + + m_targ_list.push_back( ts.p_id ); // found a test suite + + return false; + } + virtual void test_suite_finish( test_suite const& /*ts*/ ) + { + --m_depth; + } + + // Data members + typedef std::vector > components_per_level; + + components_per_level m_components; + test_unit_id_list& m_targ_list; + unsigned m_depth; +}; + +// ************************************************************************** // +// ************** label_filter ************** // +// ************************************************************************** // + +class label_filter : public test_tree_visitor { +public: + label_filter( test_unit_id_list& targ_list, const_string label ) + : m_targ_list( targ_list ) + , m_label( label ) + {} + +private: + // test_tree_visitor interface + virtual bool visit( test_unit const& tu ) + { + if( tu.has_label( m_label ) ) { + // found a test unit; add it to list of tu to enable with children and stop recursion in case of suites + m_targ_list.push_back( tu.p_id ); + return false; + } + + return true; + } + + // Data members + test_unit_id_list& m_targ_list; + const_string m_label; +}; + +// ************************************************************************** // +// ************** set_run_status ************** // +// ************************************************************************** // + +class set_run_status : public test_tree_visitor { +public: + explicit set_run_status( test_unit::run_status rs, test_unit_id_list* dep_collector = 0 ) + : m_new_status( rs ) + , m_dep_collector( dep_collector ) + {} + + // test_tree_visitor interface + virtual bool visit( test_unit const& tu ) + { + const_cast(tu).p_run_status.value = m_new_status == test_unit::RS_INVALID ? tu.p_default_status : m_new_status; + if( m_dep_collector ) { + BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) { + test_unit const& dep = framework::get( dep_id, TUT_ANY ); + + if( dep.p_run_status == tu.p_run_status ) + continue; + + BOOST_TEST_FRAMEWORK_MESSAGE( "Including test " << dep.p_type_name << ' ' << dep.full_name() << + " as a dependency of test " << tu.p_type_name << ' ' << tu.full_name() ); + + m_dep_collector->push_back( dep_id ); + } + } + return true; + } + +private: + // Data members + test_unit::run_status m_new_status; + test_unit_id_list* m_dep_collector; +}; + +// ************************************************************************** // +// ************** parse_filters ************** // +// ************************************************************************** // + +static void +add_filtered_test_units( test_unit_id master_tu_id, const_string filter, test_unit_id_list& targ ) +{ + // Choose between two kinds of filters + if( filter[0] == '@' ) { + filter.trim_left( 1 ); + label_filter lf( targ, filter ); + traverse_test_tree( master_tu_id, lf, true ); + } + else { + name_filter nf( targ, filter ); + traverse_test_tree( master_tu_id, nf, true ); + } +} + +//____________________________________________________________________________// + +static bool +parse_filters( test_unit_id master_tu_id, test_unit_id_list& tu_to_enable, test_unit_id_list& tu_to_disable ) +{ + // 10. collect tu to enable and disable based on filters + bool had_selector_filter = false; + + std::vector const& filters = runtime_config::get >( runtime_config::btrt_run_filters ); + + BOOST_TEST_FOREACH( const_string, filter, filters ) { + BOOST_TEST_SETUP_ASSERT( !filter.is_empty(), "Invalid filter specification" ); + + // each --run_test command may also be separated by a ':' (environment variable) + utils::string_token_iterator t_filter_it( filter, (utils::dropped_delimeters = ":", + utils::kept_delimeters = utils::dt_none) ); + + while( t_filter_it != utils::string_token_iterator() ) { + const_string filter_token = *t_filter_it; + + enum { SELECTOR, ENABLER, DISABLER } filter_type = SELECTOR; + + // 11. Deduce filter type + if( filter_token[0] == '!' || filter_token[0] == '+' ) { + filter_type = filter_token[0] == '+' ? ENABLER : DISABLER; + filter_token.trim_left( 1 ); + BOOST_TEST_SETUP_ASSERT( !filter_token.is_empty(), "Invalid filter specification" ); + } + + had_selector_filter |= filter_type == SELECTOR; + + // 12. Add test units to corresponding list + switch( filter_type ) { + case SELECTOR: + case ENABLER: add_filtered_test_units( master_tu_id, filter_token, tu_to_enable ); break; + case DISABLER: add_filtered_test_units( master_tu_id, filter_token, tu_to_disable ); break; + } + + ++t_filter_it; + } + } + + return had_selector_filter; +} + +//____________________________________________________________________________// + +#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE + +// a poor man's implementation of random_shuffle +template< class RandomIt, class RandomFunc > +void random_shuffle( RandomIt first, RandomIt last, RandomFunc &r ) +{ + typedef typename std::iterator_traits::difference_type difference_type; + difference_type n = last - first; + for (difference_type i = n-1; i > 0; --i) { + difference_type j = r(i+1); + if (j != i) { + using std::swap; + swap(first[i], first[j]); + } + } +} + +#endif + + +// A simple handle for registering the global fixtures to the master test suite +// without deleting an existing static object (the global fixture itself) when the program +// terminates (shared_ptr). +class global_fixture_handle : public test_unit_fixture { +public: + global_fixture_handle(test_unit_fixture* fixture) : m_global_fixture(fixture) {} + ~global_fixture_handle() {} + + virtual void setup() { + m_global_fixture->setup(); + } + virtual void teardown() { + m_global_fixture->teardown(); + } + +private: + test_unit_fixture* m_global_fixture; +}; + + +} // namespace impl + +// ************************************************************************** // +// ************** framework::state ************** // +// ************************************************************************** // + +unsigned const TIMEOUT_EXCEEDED = static_cast( -1 ); + +class state { +public: + state() + : m_master_test_suite( 0 ) + , m_curr_test_unit( INV_TEST_UNIT_ID ) + , m_next_test_case_id( MIN_TEST_CASE_ID ) + , m_next_test_suite_id( MIN_TEST_SUITE_ID ) + , m_test_in_progress( false ) + , m_context_idx( 0 ) + , m_log_sinks( ) + , m_report_sink( std::cerr ) + { + } + + ~state() { clear(); } + + void clear() + { + while( !m_test_units.empty() ) { + test_unit_store::value_type const& tu = *m_test_units.begin(); + test_unit const* tu_ptr = tu.second; + + // the delete will erase this element from map + if( ut_detail::test_id_2_unit_type( tu.second->p_id ) == TUT_SUITE ) + delete static_cast(tu_ptr); + else + delete static_cast(tu_ptr); + } + } + + void set_tu_id( test_unit& tu, test_unit_id id ) { tu.p_id.value = id; } + + ////////////////////////////////////////////////////////////////// + + // Validates the dependency graph and deduces the sibling dependency rank for each child + void deduce_siblings_order( test_unit_id tu_id, test_unit_id master_tu_id, impl::order_info_per_tu& tuoi ) + { + test_unit& tu = framework::get( tu_id, TUT_ANY ); + + // collect all sibling dependancy from tu own list + BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) + collect_dependant_siblings( tu_id, dep_id, master_tu_id, tuoi ); + + if( tu.p_type != TUT_SUITE ) + return; + + test_suite& ts = static_cast(tu); + + // recursive call to children first + BOOST_TEST_FOREACH( test_unit_id, chld_id, ts.m_children ) + deduce_siblings_order( chld_id, master_tu_id, tuoi ); + + ts.m_ranked_children.clear(); + BOOST_TEST_FOREACH( test_unit_id, chld_id, ts.m_children ) { + counter_t rank = assign_sibling_rank( chld_id, tuoi ); + ts.m_ranked_children.insert( std::make_pair( rank, chld_id ) ); + } + } + + ////////////////////////////////////////////////////////////////// + + // Finalize default run status: + // 1) inherit run status from parent where applicable + // 2) if any of test units in test suite enabled enable it as well + bool finalize_default_run_status( test_unit_id tu_id, test_unit::run_status parent_status ) + { + test_unit& tu = framework::get( tu_id, TUT_ANY ); + + if( tu.p_default_status == test_suite::RS_INHERIT ) + tu.p_default_status.value = parent_status; + + // go through list of children + if( tu.p_type == TUT_SUITE ) { + bool has_enabled_child = false; + BOOST_TEST_FOREACH( test_unit_id, chld_id, static_cast(tu).m_children ) + has_enabled_child |= finalize_default_run_status( chld_id, tu.p_default_status ); + + tu.p_default_status.value = has_enabled_child ? test_suite::RS_ENABLED : test_suite::RS_DISABLED; + } + + return tu.p_default_status == test_suite::RS_ENABLED; + } + + ////////////////////////////////////////////////////////////////// + + bool finalize_run_status( test_unit_id tu_id ) + { + test_unit& tu = framework::get( tu_id, TUT_ANY ); + + // go through list of children + if( tu.p_type == TUT_SUITE ) { + bool has_enabled_child = false; + BOOST_TEST_FOREACH( test_unit_id, chld_id, static_cast(tu).m_children) + has_enabled_child |= finalize_run_status( chld_id ); + + tu.p_run_status.value = has_enabled_child ? test_suite::RS_ENABLED : test_suite::RS_DISABLED; + } + + return tu.is_enabled(); + } + + ////////////////////////////////////////////////////////////////// + + void deduce_run_status( test_unit_id master_tu_id ) + { + using namespace framework::impl; + test_unit_id_list tu_to_enable; + test_unit_id_list tu_to_disable; + + // 10. If there are any filters supplied, figure out lists of test units to enable/disable + bool had_selector_filter = !runtime_config::get >( runtime_config::btrt_run_filters ).empty() && + parse_filters( master_tu_id, tu_to_enable, tu_to_disable ); + + // 20. Set the stage: either use default run status or disable all test units + set_run_status initial_setter( had_selector_filter ? test_unit::RS_DISABLED : test_unit::RS_INVALID ); + traverse_test_tree( master_tu_id, initial_setter, true ); + + // 30. Apply all selectors and enablers. + while( !tu_to_enable.empty() ) { + test_unit& tu = framework::get( tu_to_enable.back(), TUT_ANY ); + + tu_to_enable.pop_back(); + + // 35. Ignore test units which are already enabled + if( tu.is_enabled() ) + continue; + + // set new status and add all dependencies into tu_to_enable + set_run_status enabler( test_unit::RS_ENABLED, &tu_to_enable ); + traverse_test_tree( tu.p_id, enabler, true ); + + // Add the dependencies of the parent suites, see trac #13149 + test_unit_id parent_id = tu.p_parent_id; + while( parent_id != INV_TEST_UNIT_ID + && parent_id != master_tu_id ) + { + // we do not use the traverse_test_tree as otherwise it would enable the sibblings and subtree + // of the test case we want to enable (we need to enable the parent suites and their dependencies only) + // the parent_id needs to be enabled in order to be properly parsed by finalize_run_status, the visit + // does the job + test_unit& tu_parent = framework::get( parent_id, TUT_ANY ); + enabler.visit( tu_parent ); + parent_id = tu_parent.p_parent_id; + } + } + + // 40. Apply all disablers + while( !tu_to_disable.empty() ) { + test_unit const& tu = framework::get( tu_to_disable.back(), TUT_ANY ); + + tu_to_disable.pop_back(); + + // 35. Ignore test units which already disabled + if( !tu.is_enabled() ) + continue; + + set_run_status disabler( test_unit::RS_DISABLED ); + traverse_test_tree( tu.p_id, disabler, true ); + } + + // 50. Make sure parents of enabled test units are also enabled + finalize_run_status( master_tu_id ); + } + + ////////////////////////////////////////////////////////////////// + + typedef unit_test_monitor_t::error_level execution_result; + + // Random generator using the std::rand function (seeded prior to the call) + struct random_generator_helper { + size_t operator()(size_t i) const { + return std::rand() % i; + } + }; + + // Executes the test tree with the root at specified test unit + execution_result execute_test_tree( test_unit_id tu_id, + unsigned timeout = 0, + random_generator_helper const * const p_random_generator = 0) + { + test_unit const& tu = framework::get( tu_id, TUT_ANY ); + + execution_result result = unit_test_monitor_t::test_ok; + + if( !tu.is_enabled() ) + return result; + + // 10. Check preconditions, including zero time left for execution and + // successful execution of all dependencies + if( timeout == TIMEOUT_EXCEEDED ) { + // notify all observers about skipped test unit + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_unit_skipped( tu, "timeout for the test unit is exceeded" ); + + return unit_test_monitor_t::os_timeout; + } + else if( timeout == 0 || timeout > tu.p_timeout ) // deduce timeout for this test unit + timeout = tu.p_timeout; + + test_tools::assertion_result const precondition_res = tu.check_preconditions(); + if( !precondition_res ) { + // notify all observers about skipped test unit + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_unit_skipped( tu, precondition_res.message() ); + + return unit_test_monitor_t::precondition_failure; + } + + // 20. Notify all observers about the start of the test unit + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_unit_start( tu ); + + // 30. Execute setup fixtures if any; any failure here leads to test unit abortion + BOOST_TEST_FOREACH( test_unit_fixture_ptr, F, tu.p_fixtures.get() ) { + ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tu.p_id); + result = unit_test_monitor.execute_and_translate( boost::bind( &test_unit_fixture::setup, F ) ); + if( result != unit_test_monitor_t::test_ok ) + break; + test_results const& test_rslt = unit_test::results_collector.results( m_curr_test_unit ); + if( test_rslt.aborted() ) { + result = unit_test_monitor_t::precondition_failure; + break; + } + } + + // This is the time we are going to spend executing the test unit + unsigned long elapsed = 0; + + if( result == unit_test_monitor_t::test_ok ) { + // 40. We are going to time the execution + boost::timer tu_timer; + + // we pass the random generator + const random_generator_helper& rand_gen = p_random_generator ? *p_random_generator : random_generator_helper(); + + if( tu.p_type == TUT_SUITE ) { + test_suite const& ts = static_cast( tu ); + + if( runtime_config::get( runtime_config::btrt_random_seed ) == 0 ) { + typedef std::pair value_type; + + BOOST_TEST_FOREACH( value_type, chld, ts.m_ranked_children ) { + unsigned chld_timeout = child_timeout( timeout, tu_timer.elapsed() ); + + result = (std::min)( result, execute_test_tree( chld.second, chld_timeout, &rand_gen ) ); + + if( unit_test_monitor.is_critical_error( result ) ) + break; + } + } + else { + // Go through ranges of children with the same dependency rank and shuffle them + // independently. Execute each subtree in this order + test_unit_id_list children_with_the_same_rank; + + typedef test_suite::children_per_rank::const_iterator it_type; + it_type it = ts.m_ranked_children.begin(); + while( it != ts.m_ranked_children.end() ) { + children_with_the_same_rank.clear(); + + std::pair range = ts.m_ranked_children.equal_range( it->first ); + it = range.first; + while( it != range.second ) { + children_with_the_same_rank.push_back( it->second ); + it++; + } + +#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE + impl::random_shuffle( children_with_the_same_rank.begin(), children_with_the_same_rank.end(), rand_gen ); +#else + std::random_shuffle( children_with_the_same_rank.begin(), children_with_the_same_rank.end(), rand_gen ); +#endif + + BOOST_TEST_FOREACH( test_unit_id, chld, children_with_the_same_rank ) { + unsigned chld_timeout = child_timeout( timeout, tu_timer.elapsed() ); + + result = (std::min)( result, execute_test_tree( chld, chld_timeout, &rand_gen ) ); + + if( unit_test_monitor.is_critical_error( result ) ) + break; + } + } + } + + elapsed = static_cast( tu_timer.elapsed() * 1e6 ); + } + else { // TUT_CASE + test_case const& tc = static_cast( tu ); + + // setup contexts + m_context_idx = 0; + + // setup current test case + ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tc.p_id); + + // execute the test case body + result = unit_test_monitor.execute_and_translate( tc.p_test_func, timeout ); + elapsed = static_cast( tu_timer.elapsed() * 1e6 ); + + // cleanup leftover context + m_context.clear(); + + // restore state (scope exit) and abort if necessary + } + } + + // if run error is critical skip teardown, who knows what the state of the program at this point + if( !unit_test_monitor.is_critical_error( result ) ) { + // execute teardown fixtures if any in reverse order + BOOST_TEST_REVERSE_FOREACH( test_unit_fixture_ptr, F, tu.p_fixtures.get() ) { + ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tu.p_id); + result = (std::min)( result, unit_test_monitor.execute_and_translate( boost::bind( &test_unit_fixture::teardown, F ), 0 ) ); + + if( unit_test_monitor.is_critical_error( result ) ) + break; + } + } + + // notify all observers about abortion + if( unit_test_monitor.is_critical_error( result ) ) { + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_aborted(); + } + + // notify all observers about completion + BOOST_TEST_REVERSE_FOREACH( test_observer*, to, m_observers ) + to->test_unit_finish( tu, elapsed ); + + return result; + } + + ////////////////////////////////////////////////////////////////// + + unsigned child_timeout( unsigned tu_timeout, double elapsed ) + { + if( tu_timeout == 0U ) + return 0U; + + unsigned elpsed_sec = static_cast(elapsed); // rounding to number of whole seconds + + return tu_timeout > elpsed_sec ? tu_timeout - elpsed_sec : TIMEOUT_EXCEEDED; + } + + struct priority_order { + bool operator()( test_observer* lhs, test_observer* rhs ) const + { + return (lhs->priority() < rhs->priority()) || ((lhs->priority() == rhs->priority()) && (lhs < rhs)); + } + }; + + // Data members + typedef std::map test_unit_store; + typedef std::set observer_store; + struct context_frame { + context_frame( std::string const& d, int id, bool sticky ) + : descr( d ) + , frame_id( id ) + , is_sticky( sticky ) + {} + + std::string descr; + int frame_id; + bool is_sticky; + }; + typedef std::vector context_data; + + master_test_suite_t* m_master_test_suite; + std::vector m_auto_test_suites; + + test_unit_id m_curr_test_unit; + test_unit_store m_test_units; + + test_unit_id m_next_test_case_id; + test_unit_id m_next_test_suite_id; + + bool m_test_in_progress; + + observer_store m_observers; + context_data m_context; + int m_context_idx; + + std::set m_global_fixtures; + + boost::execution_monitor m_aux_em; + + std::map m_log_sinks; + runtime_config::stream_holder m_report_sink; +}; + +//____________________________________________________________________________// + +namespace impl { +namespace { + +#if defined(__CYGWIN__) +framework::state& s_frk_state() { static framework::state* the_inst = 0; if(!the_inst) the_inst = new framework::state; return *the_inst; } +#else +framework::state& s_frk_state() { static framework::state the_inst; return the_inst; } +#endif + +} // local namespace + +void +setup_for_execution( test_unit const& tu ) +{ + s_frk_state().deduce_run_status( tu.p_id ); +} + +struct sum_to_first_only { + sum_to_first_only() : is_first(true) {} + template + T operator()(T const& l_, U const& r_) { + if(is_first) { + is_first = false; + return l_ + r_.first; + } + return l_ + ", " + r_.first; + } + + bool is_first; +}; + +void +shutdown_loggers_and_reports() +{ + s_frk_state().m_log_sinks.clear(); + s_frk_state().m_report_sink.setup( "stderr" ); +} + +void +setup_loggers() +{ + + BOOST_TEST_I_TRY { + +#ifdef BOOST_TEST_SUPPORT_TOKEN_ITERATOR + bool has_combined_logger = runtime_config::has( runtime_config::btrt_combined_logger ) + && !runtime_config::get< std::vector >( runtime_config::btrt_combined_logger ).empty(); +#else + bool has_combined_logger = false; +#endif + + if( !has_combined_logger ) { + unit_test_log.set_threshold_level( runtime_config::get( runtime_config::btrt_log_level ) ); + const output_format format = runtime_config::get( runtime_config::btrt_log_format ); + unit_test_log.set_format( format ); + + runtime_config::stream_holder& stream_logger = s_frk_state().m_log_sinks[format]; + if( runtime_config::has( runtime_config::btrt_log_sink ) ) { + // we remove all streams in this case, so we do not specify the format + boost::function< void () > log_cleaner = boost::bind( &unit_test_log_t::set_stream, + &unit_test_log, + boost::ref(std::cout) + ); + stream_logger.setup( runtime_config::get( runtime_config::btrt_log_sink ), + log_cleaner ); + } + unit_test_log.set_stream( stream_logger.ref() ); + } + else + { + + const std::vector& v_output_format = runtime_config::get< std::vector >( runtime_config::btrt_combined_logger ) ; + + static const std::pair all_log_levels[] = { + std::make_pair( "all" , log_successful_tests ), + std::make_pair( "success" , log_successful_tests ), + std::make_pair( "test_suite" , log_test_units ), + std::make_pair( "unit_scope" , log_test_units ), + std::make_pair( "message" , log_messages ), + std::make_pair( "warning" , log_warnings ), + std::make_pair( "error" , log_all_errors ), + std::make_pair( "cpp_exception" , log_cpp_exception_errors ), + std::make_pair( "system_error" , log_system_errors ), + std::make_pair( "fatal_error" , log_fatal_errors ), + std::make_pair( "nothing" , log_nothing ) + }; + + static const std::pair all_formats[] = { + std::make_pair( "HRF" , OF_CLF ), + std::make_pair( "CLF" , OF_CLF ), + std::make_pair( "XML" , OF_XML ), + std::make_pair( "JUNIT", OF_JUNIT ) + }; + + + bool is_first = true; + + BOOST_TEST_FOREACH( const_string, current_multi_config, v_output_format ) { + + #ifdef BOOST_TEST_SUPPORT_TOKEN_ITERATOR + + // ':' may be used for file names: C:/tmp/mylogsink.xml + // we merge the tokens that start with / or \ with the previous one. + std::vector v_processed_tokens; + + { + utils::string_token_iterator current_config( current_multi_config, (utils::dropped_delimeters = ":", + utils::kept_delimeters = utils::dt_none) ); + + for( ; current_config != utils::string_token_iterator() ; ++current_config) { + std::string str_copy(current_config->begin(), current_config->end()); + if( ( str_copy[0] == '\\' || str_copy[0] == '/' ) + && v_processed_tokens.size() > 0) { + v_processed_tokens.back() += ":" + str_copy; // ':' has been eaten up + } + else { + v_processed_tokens.push_back(str_copy); + } + } + } + + BOOST_TEST_FOREACH( std::string const&, current_config, v_processed_tokens ) { + + utils::string_token_iterator current_format_specs( current_config, (utils::keep_empty_tokens, + utils::dropped_delimeters = ",", + utils::kept_delimeters = utils::dt_none) ); + + output_format format = OF_INVALID ; // default + if( current_format_specs != utils::string_token_iterator() && + current_format_specs->size() ) { + + for(size_t elem=0; elem < sizeof(all_formats)/sizeof(all_formats[0]); elem++) { + if(const_string(all_formats[elem].first) == *current_format_specs) { + format = all_formats[elem].second; + break; + } + } + } + + BOOST_TEST_I_ASSRT( format != OF_INVALID, + boost::runtime::access_to_missing_argument() + << "Unable to determine the logger type from '" + << current_config + << "'. Possible choices are: " + << std::accumulate(all_formats, + all_formats + sizeof(all_formats)/sizeof(all_formats[0]), + std::string(""), + sum_to_first_only()) + ); + + // activates this format + if( is_first ) { + unit_test_log.set_format( format ); + } + else { + unit_test_log.add_format( format ); + } + is_first = false; + + unit_test_log_formatter * const formatter = unit_test_log.get_formatter(format); + BOOST_TEST_SETUP_ASSERT( formatter, "Logger setup error" ); + + log_level formatter_log_level = invalid_log_level; + ++current_format_specs ; + if( !current_format_specs->size() ) { + formatter_log_level = formatter->get_log_level(); // default log level given by the formatter + } + else if( current_format_specs != utils::string_token_iterator() ) { + + for(size_t elem=0; elem < sizeof(all_log_levels)/sizeof(all_log_levels[0]); elem++) { + if(const_string(all_log_levels[elem].first) == *current_format_specs) { + formatter_log_level = all_log_levels[elem].second; + break; + } + } + } + + BOOST_TEST_I_ASSRT( formatter_log_level != invalid_log_level, + boost::runtime::access_to_missing_argument() + << "Unable to determine the log level from '" + << current_config + << "'. Possible choices are: " + << std::accumulate(all_log_levels, + all_log_levels + sizeof(all_log_levels)/sizeof(all_log_levels[0]), + std::string(""), + sum_to_first_only()) + ); + + unit_test_log.set_threshold_level( format, formatter_log_level ); + + runtime_config::stream_holder& stream_logger = s_frk_state().m_log_sinks[format]; + boost::function< void () > log_cleaner = boost::bind( &unit_test_log_t::set_stream, + &unit_test_log, + format, + boost::ref(std::cout) ); + if( ++current_format_specs != utils::string_token_iterator() && + current_format_specs->size() ) { + stream_logger.setup( *current_format_specs, + log_cleaner ); + } + else { + stream_logger.setup( formatter->get_default_stream_description(), + log_cleaner ); + } + unit_test_log.set_stream( format, stream_logger.ref() ); + } + #endif + } // for each logger + + } // if/else new logger API + } // BOOST_TEST_I_TRY + BOOST_TEST_I_CATCH( boost::runtime::init_error, ex ) { + BOOST_TEST_SETUP_ASSERT( false, ex.msg ); + } + BOOST_TEST_I_CATCH( boost::runtime::input_error, ex ) { + std::cerr << ex.msg << "\n\n"; + + BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); + } + + +} + +//____________________________________________________________________________// + +} // namespace impl + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** framework::init ************** // +// ************************************************************************** // + +void +init( init_unit_test_func init_func, int argc, char* argv[] ) +{ + using namespace impl; + + // 10. Set up runtime parameters + runtime_config::init( argc, argv ); + + // 20. Set the desired log level, format and sink + impl::setup_loggers(); + + // 30. Set the desired report level, format and sink + results_reporter::set_level( runtime_config::get( runtime_config::btrt_report_level ) ); + results_reporter::set_format( runtime_config::get( runtime_config::btrt_report_format ) ); + + if( runtime_config::has( runtime_config::btrt_report_sink ) ) { + boost::function< void () > report_cleaner = boost::bind( &results_reporter::set_stream, + boost::ref(std::cerr) + ); + s_frk_state().m_report_sink.setup( runtime_config::get( runtime_config::btrt_report_sink ), + report_cleaner ); + } + + results_reporter::set_stream( s_frk_state().m_report_sink.ref() ); + + // 40. Register default test observers + register_observer( results_collector ); + register_observer( unit_test_log ); + register_observer( framework_init_observer ); + + if( runtime_config::get( runtime_config::btrt_show_progress ) ) { + progress_monitor.set_stream( std::cout ); // defaults to stdout + register_observer( progress_monitor ); + } + + // 50. Set up memory leak detection + unsigned long detect_mem_leak = runtime_config::get( runtime_config::btrt_detect_mem_leaks ); + if( detect_mem_leak > 0 ) { + debug::detect_memory_leaks( true, runtime_config::get( runtime_config::btrt_report_mem_leaks ) ); + debug::break_memory_alloc( (long)detect_mem_leak ); + } + + // 60. Initialize master unit test suite + master_test_suite().argc = argc; + master_test_suite().argv = argv; + + // 70. Invoke test module initialization routine + BOOST_TEST_I_TRY { + s_frk_state().m_aux_em.vexecute( boost::bind( &impl::invoke_init_func, init_func ) ); + } + BOOST_TEST_I_CATCH( execution_exception, ex ) { + BOOST_TEST_SETUP_ASSERT( false, ex.what() ); + } +} + +//____________________________________________________________________________// + +void +finalize_setup_phase( test_unit_id master_tu_id ) +{ + if( master_tu_id == INV_TEST_UNIT_ID ) + master_tu_id = master_test_suite().p_id; + + // 10. Apply all decorators to the auto test units + class apply_decorators : public test_tree_visitor { + private: + // test_tree_visitor interface + virtual bool visit( test_unit const& tu ) + { + BOOST_TEST_FOREACH( decorator::base_ptr, d, tu.p_decorators.get() ) + d->apply( const_cast(tu) ); + + return true; + } + } ad; + traverse_test_tree( master_tu_id, ad, true ); + + // 20. Finalize setup phase + impl::order_info_per_tu tuoi; + impl::s_frk_state().deduce_siblings_order( master_tu_id, master_tu_id, tuoi ); + impl::s_frk_state().finalize_default_run_status( master_tu_id, test_unit::RS_INVALID ); +} + +// ************************************************************************** // +// ************** test_in_progress ************** // +// ************************************************************************** // + +bool +test_in_progress() +{ + return impl::s_frk_state().m_test_in_progress; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** framework::shutdown ************** // +// ************************************************************************** // + +void +shutdown() +{ + impl::shutdown_loggers_and_reports(); + // eliminating some fake memory leak reports. See for more details: + // http://connect.microsoft.com/VisualStudio/feedback/details/106937/memory-leaks-reported-by-debug-crt-inside-typeinfo-name + +# if BOOST_WORKAROUND(BOOST_MSVC, <= 1600 ) && !defined(_DLL) && defined(_DEBUG) +# if BOOST_WORKAROUND(BOOST_MSVC, < 1600 ) +#define _Next next +#define _MemPtr memPtr +#endif + __type_info_node* pNode = __type_info_root_node._Next; + __type_info_node* tmpNode = &__type_info_root_node; + + for( ; pNode!=NULL; pNode = tmpNode ) { + tmpNode = pNode->_Next; + delete pNode->_MemPtr; + delete pNode; + } +# if BOOST_WORKAROUND(BOOST_MSVC, < 1600 ) +#undef _Next +#undef _MemPtr +#endif +# endif +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** register_test_unit ************** // +// ************************************************************************** // + +void +register_test_unit( test_case* tc ) +{ + BOOST_TEST_SETUP_ASSERT( tc->p_id == INV_TEST_UNIT_ID, BOOST_TEST_L( "test case already registered" ) ); + + test_unit_id new_id = impl::s_frk_state().m_next_test_case_id; + + BOOST_TEST_SETUP_ASSERT( new_id != MAX_TEST_CASE_ID, BOOST_TEST_L( "too many test cases" ) ); + + typedef state::test_unit_store::value_type map_value_type; + + impl::s_frk_state().m_test_units.insert( map_value_type( new_id, tc ) ); + impl::s_frk_state().m_next_test_case_id++; + + impl::s_frk_state().set_tu_id( *tc, new_id ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** register_test_unit ************** // +// ************************************************************************** // + +void +register_test_unit( test_suite* ts ) +{ + BOOST_TEST_SETUP_ASSERT( ts->p_id == INV_TEST_UNIT_ID, BOOST_TEST_L( "test suite already registered" ) ); + + test_unit_id new_id = impl::s_frk_state().m_next_test_suite_id; + + BOOST_TEST_SETUP_ASSERT( new_id != MAX_TEST_SUITE_ID, BOOST_TEST_L( "too many test suites" ) ); + + typedef state::test_unit_store::value_type map_value_type; + + impl::s_frk_state().m_test_units.insert( map_value_type( new_id, ts ) ); + impl::s_frk_state().m_next_test_suite_id++; + + impl::s_frk_state().set_tu_id( *ts, new_id ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** deregister_test_unit ************** // +// ************************************************************************** // + +void +deregister_test_unit( test_unit* tu ) +{ + impl::s_frk_state().m_test_units.erase( tu->p_id ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** clear ************** // +// ************************************************************************** // + +void +clear() +{ + impl::s_frk_state().clear(); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** register_observer ************** // +// ************************************************************************** // + +void +register_observer( test_observer& to ) +{ + impl::s_frk_state().m_observers.insert( &to ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** deregister_observer ************** // +// ************************************************************************** // + +void +deregister_observer( test_observer& to ) +{ + impl::s_frk_state().m_observers.erase( &to ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** register_global_fixture ************** // +// ************************************************************************** // + +void +register_global_fixture( test_unit_fixture& tuf ) +{ + impl::s_frk_state().m_global_fixtures.insert( &tuf ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** deregister_global_fixture ************** // +// ************************************************************************** // + +void +deregister_global_fixture( test_unit_fixture &tuf ) +{ + impl::s_frk_state().m_global_fixtures.erase( &tuf ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** add_context ************** // +// ************************************************************************** // + +int +add_context( ::boost::unit_test::lazy_ostream const& context_descr, bool sticky ) +{ + std::stringstream buffer; + context_descr( buffer ); + int res_idx = impl::s_frk_state().m_context_idx++; + + impl::s_frk_state().m_context.push_back( state::context_frame( buffer.str(), res_idx, sticky ) ); + + return res_idx; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** clear_context ************** // +// ************************************************************************** // + +struct frame_with_id { + explicit frame_with_id( int id ) : m_id( id ) {} + + bool operator()( state::context_frame const& f ) + { + return f.frame_id == m_id; + } + int m_id; +}; + +//____________________________________________________________________________// + +void +clear_context( int frame_id ) +{ + if( frame_id == -1 ) { // clear all non sticky frames + for( int i=static_cast(impl::s_frk_state().m_context.size())-1; i>=0; i-- ) + if( !impl::s_frk_state().m_context[i].is_sticky ) + impl::s_frk_state().m_context.erase( impl::s_frk_state().m_context.begin()+i ); + } + + else { // clear specific frame + state::context_data::iterator it = + std::find_if( impl::s_frk_state().m_context.begin(), impl::s_frk_state().m_context.end(), frame_with_id( frame_id ) ); + + if( it != impl::s_frk_state().m_context.end() ) // really an internal error if this is not true + impl::s_frk_state().m_context.erase( it ); + } +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** get_context ************** // +// ************************************************************************** // + +context_generator +get_context() +{ + return context_generator(); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** context_generator ************** // +// ************************************************************************** // + +bool +context_generator::is_empty() const +{ + return impl::s_frk_state().m_context.empty(); +} + +//____________________________________________________________________________// + +const_string +context_generator::next() const +{ + return m_curr_frame < impl::s_frk_state().m_context.size() ? impl::s_frk_state().m_context[m_curr_frame++].descr : const_string(); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** master_test_suite ************** // +// ************************************************************************** // + +master_test_suite_t& +master_test_suite() +{ + if( !impl::s_frk_state().m_master_test_suite ) + impl::s_frk_state().m_master_test_suite = new master_test_suite_t; + + return *impl::s_frk_state().m_master_test_suite; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** current_auto_test_suite ************** // +// ************************************************************************** // + +test_suite& +current_auto_test_suite( test_suite* ts, bool push_or_pop ) +{ + if( impl::s_frk_state().m_auto_test_suites.empty() ) + impl::s_frk_state().m_auto_test_suites.push_back( &framework::master_test_suite() ); + + if( !push_or_pop ) + impl::s_frk_state().m_auto_test_suites.pop_back(); + else if( ts ) + impl::s_frk_state().m_auto_test_suites.push_back( ts ); + + return *impl::s_frk_state().m_auto_test_suites.back(); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** current_test_case ************** // +// ************************************************************************** // + +test_case const& +current_test_case() +{ + return get( impl::s_frk_state().m_curr_test_unit ); +} + + +test_unit const& +current_test_unit() +{ + return *impl::s_frk_state().m_test_units[impl::s_frk_state().m_curr_test_unit]; +} + +//____________________________________________________________________________// + +test_unit_id +current_test_case_id() +{ + return impl::s_frk_state().m_curr_test_unit; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** framework::get ************** // +// ************************************************************************** // + +test_unit& +get( test_unit_id id, test_unit_type t ) +{ + test_unit* res = impl::s_frk_state().m_test_units[id]; + + BOOST_TEST_I_ASSRT( (res->p_type & t) != 0, internal_error( "Invalid test unit type" ) ); + + return *res; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** framework::run ************** // +// ************************************************************************** // + +template +struct swap_on_delete { + swap_on_delete(Cont& c1, Cont& c2) : m_c1(c1), m_c2(c2){} + ~swap_on_delete() { + m_c1.swap(m_c2); + } + + Cont& m_c1; + Cont& m_c2; +}; + +void +run( test_unit_id id, bool continue_test ) +{ + if( id == INV_TEST_UNIT_ID ) + id = master_test_suite().p_id; + + // Figure out run status for execution phase + impl::s_frk_state().deduce_run_status( id ); + + test_case_counter tcc; + traverse_test_tree( id, tcc ); + + BOOST_TEST_SETUP_ASSERT( tcc.p_count != 0 , runtime_config::get >( runtime_config::btrt_run_filters ).empty() + ? BOOST_TEST_L( "test tree is empty" ) + : BOOST_TEST_L( "no test cases matching filter or all test cases were disabled" ) ); + + bool was_in_progress = framework::test_in_progress(); + bool call_start_finish = !continue_test || !was_in_progress; + bool init_ok = true; + const_string setup_error; + + if( call_start_finish ) { + // indicates the framework that no test is in progress now if observers need to be notified + impl::s_frk_state().m_test_in_progress = false; + // unit_test::framework_init_observer will get cleared first + BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) { + BOOST_TEST_I_TRY { + ut_detail::test_unit_id_restore restore_current_test_unit(impl::s_frk_state().m_curr_test_unit, id); + unit_test_monitor_t::error_level result = unit_test_monitor.execute_and_translate( boost::bind( &test_observer::test_start, to, tcc.p_count ) ); + if( init_ok ) { + if( result != unit_test_monitor_t::test_ok ) { + init_ok = false; + } + else { + if( unit_test::framework_init_observer.has_failed() ) { + init_ok = false; + } + } + } + } + BOOST_TEST_I_CATCH( execution_exception, ex ) { + if( init_ok ) { + // log only the first error + init_ok = false; + setup_error = ex.what(); + } + // break; // we should continue otherwise loggers may have improper structure (XML start missing for instance) + } + } + } + + if( init_ok ) { + + // attaching the global fixtures to the main entry point + test_unit& entry_test_unit = framework::get( id, TUT_ANY ); + std::vector v_saved_fixture(entry_test_unit.p_fixtures.value.begin(), + entry_test_unit.p_fixtures.value.end()); + + BOOST_TEST_FOREACH( test_unit_fixture*, tuf, impl::s_frk_state().m_global_fixtures ) { + entry_test_unit.p_fixtures.value.insert( entry_test_unit.p_fixtures.value.begin(), + test_unit_fixture_ptr(new impl::global_fixture_handle(tuf)) ); + } + + swap_on_delete< std::vector > raii_fixture(v_saved_fixture, entry_test_unit.p_fixtures.value); + + // now work in progress + impl::s_frk_state().m_test_in_progress = true; + unsigned seed = runtime_config::get( runtime_config::btrt_random_seed ); + switch( seed ) { + case 0: + break; + case 1: + seed = static_cast( std::rand() ^ std::time( 0 ) ); // better init using std::rand() ^ ... + BOOST_FALLTHROUGH; + default: + BOOST_TEST_FRAMEWORK_MESSAGE( "Test cases order is shuffled using seed: " << seed ); + std::srand( seed ); + } + + // executing the test tree + impl::s_frk_state().execute_test_tree( id ); + + // removing previously added global fixtures: dtor raii_fixture + } + + impl::s_frk_state().m_test_in_progress = false; + + results_reporter::make_report( INV_REPORT_LEVEL, id ); + + unit_test::framework_init_observer.clear(); + if( call_start_finish ) { + // indicates the framework that no test is in progress anymore if observers need to be notified + // and this is a teardown, so assertions should not raise any exception otherwise an exception + // might be raised in a dtor of a global fixture + impl::s_frk_state().m_test_in_progress = false; + BOOST_TEST_REVERSE_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) { + ut_detail::test_unit_id_restore restore_current_test_unit(impl::s_frk_state().m_curr_test_unit, id); + to->test_finish(); + } + } + + impl::s_frk_state().m_test_in_progress = was_in_progress; + + // propagates the init/teardown error if any + BOOST_TEST_SETUP_ASSERT( init_ok && !unit_test::framework_init_observer.has_failed(), setup_error ); +} + +//____________________________________________________________________________// + +void +run( test_unit const* tu, bool continue_test ) +{ + run( tu->p_id, continue_test ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** assertion_result ************** // +// ************************************************************************** // + +void +assertion_result( unit_test::assertion_result ar ) +{ + BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) + to->assertion_result( ar ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** exception_caught ************** // +// ************************************************************************** // + +void +exception_caught( execution_exception const& ex ) +{ + BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) + to->exception_caught( ex ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** test_unit_aborted ************** // +// ************************************************************************** // + +void +test_unit_aborted( test_unit const& tu ) +{ + BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) + to->test_unit_aborted( tu ); +} + +// ************************************************************************** // +// ************** test_aborted ************** // +// ************************************************************************** // + +void +test_aborted( ) +{ + BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) + to->test_aborted( ); +} + + +//____________________________________________________________________________// + +} // namespace framework +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_FRAMEWORK_IPP_021005GER diff --git a/libraries/boost/include/boost/test/impl/junit_log_formatter.ipp b/libraries/boost/include/boost/test/impl/junit_log_formatter.ipp new file mode 100644 index 0000000000..e82e2bd1b0 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/junit_log_formatter.ipp @@ -0,0 +1,840 @@ +// (C) Copyright 2016 Raffi Enficiaud. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +///@file +///@brief Contains the implementatoin of the Junit log formatter (OF_JUNIT) +// *************************************************************************** + +#ifndef BOOST_TEST_JUNIT_LOG_FORMATTER_IPP__ +#define BOOST_TEST_JUNIT_LOG_FORMATTER_IPP__ + +// Boost.Test +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +//#include + + +// Boost +#include + +// STL +#include +#include +#include + +#include + + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace output { + + +struct s_replace_chars { + template + void operator()(T& to_replace) + { + if(to_replace == '/') + to_replace = '.'; + else if(to_replace == ' ') + to_replace = '_'; + } +}; + +inline std::string tu_name_normalize(std::string full_name) +{ + // maybe directly using normalize_test_case_name instead? + std::for_each(full_name.begin(), full_name.end(), s_replace_chars()); + return full_name; +} + +inline std::string tu_name_remove_newlines(std::string full_name) +{ + full_name.erase(std::remove(full_name.begin(), full_name.end(), '\n'), full_name.end()); + return full_name; +} + +const_string file_basename(const_string filename) { + + const_string path_sep( "\\/" ); + const_string::iterator it = unit_test::utils::find_last_of( filename.begin(), filename.end(), + path_sep.begin(), path_sep.end() ); + if( it != filename.end() ) + filename.trim_left( it + 1 ); + + return filename; + +} + +// ************************************************************************** // +// ************** junit_log_formatter ************** // +// ************************************************************************** // + +void +junit_log_formatter::log_start( std::ostream& /*ostr*/, counter_t /*test_cases_amount*/) +{ + map_tests.clear(); + list_path_to_root.clear(); + runner_log_entry.clear(); +} + +//____________________________________________________________________________// + +class junit_result_helper : public test_tree_visitor { +private: + typedef junit_impl::junit_log_helper::assertion_entry assertion_entry; + typedef std::vector< assertion_entry >::const_iterator vect_assertion_entry_citerator; + typedef std::list::const_iterator list_str_citerator; + +public: + explicit junit_result_helper( + std::ostream& stream, + test_unit const& ts, + junit_log_formatter::map_trace_t const& mt, + junit_impl::junit_log_helper const& runner_log_, + bool display_build_info ) + : m_stream(stream) + , m_ts( ts ) + , m_map_test( mt ) + , runner_log( runner_log_ ) + , m_id( 0 ) + , m_display_build_info(display_build_info) + { } + + void add_log_entry(assertion_entry const& log) const + { + std::string entry_type; + if( log.log_entry == assertion_entry::log_entry_failure ) { + entry_type = "failure"; + } + else if( log.log_entry == assertion_entry::log_entry_error ) { + entry_type = "error"; + } + else { + return; + } + + m_stream + << "<" << entry_type + << " message" << utils::attr_value() << log.logentry_message + << " type" << utils::attr_value() << log.logentry_type + << ">"; + + if(!log.output.empty()) { + m_stream << utils::cdata() << "\n" + log.output; + } + + m_stream << ""; + } + + struct conditional_cdata_helper { + std::ostream &ostr; + std::string const field; + bool empty; + + conditional_cdata_helper(std::ostream &ostr_, std::string field_) + : ostr(ostr_) + , field(field_) + , empty(true) + {} + + ~conditional_cdata_helper() { + if(!empty) { + ostr << BOOST_TEST_L( "]]>" ) << "' << std::endl; + } + } + + void operator()(const std::string& s) { + bool current_empty = s.empty(); + if(empty) { + if(!current_empty) { + empty = false; + ostr << '<' << field << '>' << BOOST_TEST_L( " build_skipping_chain(test_unit const & tu) const + { + // we enter here because we know that the tu has been skipped. + // either junit has not seen this tu, or it is indicated as disabled + assert(m_map_test.count(tu.p_id) == 0 || results_collector.results( tu.p_id ).p_skipped); + + std::list out; + + test_unit_id id(tu.p_id); + while( id != m_ts.p_id && id != INV_TEST_UNIT_ID) { + test_unit const& tu_hierarchy = boost::unit_test::framework::get( id, TUT_ANY ); + out.push_back("- disabled test unit: '" + tu_name_remove_newlines(tu_hierarchy.full_name()) + "'\n"); + if(m_map_test.count(id) > 0) + { + // junit has seen the reason: this is enough for constructing the chain + break; + } + id = tu_hierarchy.p_parent_id; + } + junit_log_formatter::map_trace_t::const_iterator it_element_stack(m_map_test.find(id)); + if( it_element_stack != m_map_test.end() ) + { + out.push_back("- reason: '" + it_element_stack->second.skipping_reason + "'"); + out.push_front("Test case disabled because of the following chain of decision:\n"); + } + + return out; + } + + std::string get_class_name(test_unit const & tu_class) const { + std::string classname; + test_unit_id id(tu_class.p_parent_id); + while( id != m_ts.p_id && id != INV_TEST_UNIT_ID ) { + test_unit const& tu = boost::unit_test::framework::get( id, TUT_ANY ); + classname = tu_name_normalize(tu.p_name) + "." + classname; + id = tu.p_parent_id; + } + + // removes the trailing dot + if(!classname.empty() && *classname.rbegin() == '.') { + classname.erase(classname.size()-1); + } + + return classname; + } + + void write_testcase_header(test_unit const & tu, + test_results const *tr, + int nb_assertions) const + { + std::string name; + std::string classname; + + if(tu.p_id == m_ts.p_id ) { + name = "boost_test"; + } + else { + classname = get_class_name(tu); + name = tu_name_normalize(tu.p_name); + } + + if( tu.p_type == TUT_SUITE ) { + name += "-setup-teardown"; + } + + m_stream << "p_duration_microseconds) * 1E-6 + << ">" << std::endl; + } + + void write_testcase_system_out(junit_impl::junit_log_helper const &detailed_log, + test_unit const * tu, + bool skipped) const + { + // system-out + all info/messages, the object skips the empty entries + conditional_cdata_helper system_out_helper(m_stream, "system-out"); + + // indicate why the test has been skipped first + if( skipped ) { + std::list skipping_decision_chain = build_skipping_chain(*tu); + for(list_str_citerator it(skipping_decision_chain.begin()), ite(skipping_decision_chain.end()); + it != ite; + ++it) + { + system_out_helper(*it); + } + } + + // stdout + for(list_str_citerator it(detailed_log.system_out.begin()), ite(detailed_log.system_out.end()); + it != ite; + ++it) + { + system_out_helper(*it); + } + + // warning/info message last + for(vect_assertion_entry_citerator it(detailed_log.assertion_entries.begin()); + it != detailed_log.assertion_entries.end(); + ++it) + { + if(it->log_entry != assertion_entry::log_entry_info) + continue; + system_out_helper(it->output); + } + } + + void write_testcase_system_err(junit_impl::junit_log_helper const &detailed_log, + test_unit const * tu, + test_results const *tr) const + { + // system-err output + test case informations + bool has_failed = (tr != 0) ? !tr->p_skipped && !tr->passed() : false; + if(!detailed_log.system_err.empty() || has_failed) + { + std::ostringstream o; + if(has_failed) { + o << "Failures detected in:" << std::endl; + } + else { + o << "ERROR STREAM:" << std::endl; + } + + if(tu->p_type == TUT_SUITE) { + if( tu->p_id == m_ts.p_id ) { + o << " boost.test global setup/teardown" << std::endl; + } else { + o << "- test suite: " << tu_name_remove_newlines(tu->full_name()) << std::endl; + } + } + else { + o << "- test case: " << tu_name_remove_newlines(tu->full_name()); + if(!tu->p_description.value.empty()) + o << " '" << tu->p_description << "'"; + + o << std::endl + << "- file: " << file_basename(tu->p_file_name) << std::endl + << "- line: " << tu->p_line_num << std::endl + ; + } + + if(!detailed_log.system_err.empty()) + o << std::endl << "STDERR BEGIN: ------------" << std::endl; + + for(list_str_citerator it(detailed_log.system_err.begin()), ite(detailed_log.system_err.end()); + it != ite; + ++it) + { + o << *it; + } + + if(!detailed_log.system_err.empty()) + o << std::endl << "STDERR END ------------" << std::endl; + + conditional_cdata_helper system_err_helper(m_stream, "system-err"); + system_err_helper(o.str()); + } + } + + int get_nb_assertions(junit_impl::junit_log_helper const &detailed_log, + test_unit const & tu, + test_results const *tr) const { + int nb_assertions(-1); + if( tu.p_type == TUT_SUITE ) { + nb_assertions = 0; + for(vect_assertion_entry_citerator it(detailed_log.assertion_entries.begin()); + it != detailed_log.assertion_entries.end(); + ++it) + { + if(it->log_entry != assertion_entry::log_entry_info) + nb_assertions++; + } + } + else { + nb_assertions = tr->p_assertions_passed + tr->p_assertions_failed; + } + + return nb_assertions; + } + + void output_detailed_logs(junit_impl::junit_log_helper const &detailed_log, + test_unit const & tu, + bool skipped, + test_results const *tr) const + { + int nb_assertions = get_nb_assertions(detailed_log, tu, tr); + if(!nb_assertions && tu.p_type == TUT_SUITE) + return; + + write_testcase_header(tu, tr, nb_assertions); + + if( skipped ) { + m_stream << "" << std::endl; + } + else { + + for(vect_assertion_entry_citerator it(detailed_log.assertion_entries.begin()); + it != detailed_log.assertion_entries.end(); + ++it) + { + add_log_entry(*it); + } + } + + write_testcase_system_out(detailed_log, &tu, skipped); + write_testcase_system_err(detailed_log, &tu, tr); + m_stream << "" << std::endl; + } + + void visit( test_case const& tc ) + { + + test_results const& tr = results_collector.results( tc.p_id ); + junit_log_formatter::map_trace_t::const_iterator it_find = m_map_test.find(tc.p_id); + if(it_find == m_map_test.end()) + { + // test has been skipped and not seen by the logger + output_detailed_logs(junit_impl::junit_log_helper(), tc, true, &tr); + } + else { + output_detailed_logs(it_find->second, tc, tr.p_skipped, &tr); + } + } + + bool test_suite_start( test_suite const& ts ) + { + test_results const& tr = results_collector.results( ts.p_id ); + + // unique test suite, without s, nesting not supported in CI + if( m_ts.p_id == ts.p_id ) { + m_stream << "" << std::endl; + + if(m_display_build_info) + { + m_stream << "" << std::endl; + m_stream << "" << std::endl; + m_stream << "" << std::endl; + m_stream << "" << std::endl; + + std::ostringstream o; + o << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100; + m_stream << "" << std::endl; + m_stream << "" << std::endl; + } + } + + if( !tr.p_skipped ) { + // if we land here, then this is a chance that we are logging the fixture setup/teardown of a test-suite. + // the setup/teardown logging of a test-case is part of the test case. + // we do not care about the test-suite that were skipped (really??) + junit_log_formatter::map_trace_t::const_iterator it_find = m_map_test.find(ts.p_id); + if(it_find != m_map_test.end()) { + output_detailed_logs(it_find->second, ts, false, &tr); + } + } + + return true; // indicates that the children should also be parsed + } + + virtual void test_suite_finish( test_suite const& ts ) + { + if( m_ts.p_id == ts.p_id ) { + write_testcase_system_out(runner_log, 0, false); + write_testcase_system_err(runner_log, 0, 0); + + m_stream << ""; + return; + } + } + +private: + // Data members + std::ostream& m_stream; + test_unit const& m_ts; + junit_log_formatter::map_trace_t const& m_map_test; + junit_impl::junit_log_helper const& runner_log; + size_t m_id; + bool m_display_build_info; +}; + + + +void +junit_log_formatter::log_finish( std::ostream& ostr ) +{ + ostr << "" << std::endl; + + // getting the root test suite + if(!map_tests.empty()) { + test_unit* root = &boost::unit_test::framework::get( map_tests.begin()->first, TUT_ANY ); + + // looking for the root of the SUBtree (we stay in the subtree) + while(root->p_parent_id != INV_TEST_UNIT_ID && map_tests.count(root->p_parent_id) > 0) { + root = &boost::unit_test::framework::get( root->p_parent_id, TUT_ANY ); + } + junit_result_helper ch( ostr, *root, map_tests, this->runner_log_entry, m_display_build_info ); + traverse_test_tree( root->p_id, ch, true ); // last is to ignore disabled suite special handling + } + else { + ostr << ""; + ostr << ""; + ostr << ""; + ostr << "Incorrect setup: no test case executed"; + ostr << ""; + } + return; +} + +//____________________________________________________________________________// + +void +junit_log_formatter::log_build_info( std::ostream& /*ostr*/ ) +{ + m_display_build_info = true; +} + +//____________________________________________________________________________// + +void +junit_log_formatter::test_unit_start( std::ostream& /*ostr*/, test_unit const& tu ) +{ + list_path_to_root.push_back( tu.p_id ); + map_tests.insert(std::make_pair(tu.p_id, junit_impl::junit_log_helper())); // current_test_case_id not working here +} + + + +//____________________________________________________________________________// + +void +junit_log_formatter::test_unit_finish( std::ostream& /*ostr*/, test_unit const& tu, unsigned long /*elapsed*/ ) +{ + // the time is already stored in the result_reporter + assert( tu.p_id == list_path_to_root.back() ); + list_path_to_root.pop_back(); +} + +void +junit_log_formatter::test_unit_aborted( std::ostream& /*ostr*/, test_unit const& tu ) +{ + assert( tu.p_id == list_path_to_root.back() ); + //list_path_to_root.pop_back(); +} + +//____________________________________________________________________________// + +void +junit_log_formatter::test_unit_skipped( std::ostream& /*ostr*/, test_unit const& tu, const_string reason ) +{ + // if a test unit is skipped, then the start of this TU has not been called yet. + // we cannot use get_current_log_entry here, but the TU id should appear in the map. + // The "skip" boolean is given by the boost.test framework + junit_impl::junit_log_helper& v = map_tests[tu.p_id]; // not sure if we can use get_current_log_entry() + v.skipping_reason.assign(reason.begin(), reason.end()); +} + +//____________________________________________________________________________// + +void +junit_log_formatter::log_exception_start( std::ostream& /*ostr*/, log_checkpoint_data const& checkpoint_data, execution_exception const& ex ) +{ + std::ostringstream o; + execution_exception::location const& loc = ex.where(); + + m_is_last_assertion_or_error = false; + + junit_impl::junit_log_helper& last_entry = get_current_log_entry(); + + junit_impl::junit_log_helper::assertion_entry entry; + + entry.logentry_message = "unexpected exception"; + entry.log_entry = junit_impl::junit_log_helper::assertion_entry::log_entry_error; + + switch(ex.code()) + { + case execution_exception::cpp_exception_error: + entry.logentry_type = "uncaught exception"; + break; + case execution_exception::timeout_error: + entry.logentry_type = "execution timeout"; + break; + case execution_exception::user_error: + entry.logentry_type = "user, assert() or CRT error"; + break; + case execution_exception::user_fatal_error: + // Looks like never used + entry.logentry_type = "user fatal error"; + break; + case execution_exception::system_error: + entry.logentry_type = "system error"; + break; + case execution_exception::system_fatal_error: + entry.logentry_type = "system fatal error"; + break; + default: + entry.logentry_type = "no error"; // not sure how to handle this one + break; + } + + o << "UNCAUGHT EXCEPTION:" << std::endl; + if( !loc.m_function.is_empty() ) + o << "- function: \"" << loc.m_function << "\"" << std::endl; + + o << "- file: " << file_basename(loc.m_file_name) << std::endl + << "- line: " << loc.m_line_num << std::endl + << std::endl; + + o << "\nEXCEPTION STACK TRACE: --------------\n" << ex.what() + << "\n-------------------------------------"; + + if( !checkpoint_data.m_file_name.is_empty() ) { + o << std::endl << std::endl + << "Last checkpoint:" << std::endl + << "- message: \"" << checkpoint_data.m_message << "\"" << std::endl + << "- file: " << file_basename(checkpoint_data.m_file_name) << std::endl + << "- line: " << checkpoint_data.m_line_num << std::endl + ; + } + + entry.output = o.str(); + + last_entry.assertion_entries.push_back(entry); +} + +//____________________________________________________________________________// + +void +junit_log_formatter::log_exception_finish( std::ostream& /*ostr*/ ) +{ + // sealing the last entry + assert(!get_current_log_entry().assertion_entries.back().sealed); + get_current_log_entry().assertion_entries.back().sealed = true; +} + +//____________________________________________________________________________// + +void +junit_log_formatter::log_entry_start( std::ostream& /*ostr*/, log_entry_data const& entry_data, log_entry_types let ) +{ + junit_impl::junit_log_helper& last_entry = get_current_log_entry(); + last_entry.skipping = false; + m_is_last_assertion_or_error = true; + switch(let) + { + case unit_test_log_formatter::BOOST_UTL_ET_INFO: + { + if(m_log_level_internal > log_successful_tests) { + last_entry.skipping = true; + break; + } + BOOST_FALLTHROUGH; + } + case unit_test_log_formatter::BOOST_UTL_ET_MESSAGE: + { + if(m_log_level_internal > log_messages) { + last_entry.skipping = true; + break; + } + BOOST_FALLTHROUGH; + } + case unit_test_log_formatter::BOOST_UTL_ET_WARNING: + { + if(m_log_level_internal > log_warnings) { + last_entry.skipping = true; + break; + } + std::ostringstream o; + junit_impl::junit_log_helper::assertion_entry entry; + + entry.log_entry = junit_impl::junit_log_helper::assertion_entry::log_entry_info; + entry.logentry_message = "info"; + entry.logentry_type = "message"; + + o << (let == unit_test_log_formatter::BOOST_UTL_ET_WARNING ? + "WARNING:" : (let == unit_test_log_formatter::BOOST_UTL_ET_MESSAGE ? + "MESSAGE:" : "INFO:")) + << std::endl + << "- file : " << file_basename(entry_data.m_file_name) << std::endl + << "- line : " << entry_data.m_line_num << std::endl + << "- message: "; // no CR + + entry.output += o.str(); + last_entry.assertion_entries.push_back(entry); + break; + } + default: + case unit_test_log_formatter::BOOST_UTL_ET_ERROR: + case unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR: + { + std::ostringstream o; + junit_impl::junit_log_helper::assertion_entry entry; + entry.log_entry = junit_impl::junit_log_helper::assertion_entry::log_entry_failure; + entry.logentry_message = "failure"; + entry.logentry_type = (let == unit_test_log_formatter::BOOST_UTL_ET_ERROR ? "assertion error" : "fatal error"); + + o << "ASSERTION FAILURE:" << std::endl + << "- file : " << file_basename(entry_data.m_file_name) << std::endl + << "- line : " << entry_data.m_line_num << std::endl + << "- message: " ; // no CR + + entry.output += o.str(); + last_entry.assertion_entries.push_back(entry); + break; + } + } +} + +//____________________________________________________________________________// + +void +junit_log_formatter::log_entry_value( std::ostream& /*ostr*/, const_string value ) +{ + junit_impl::junit_log_helper& last_entry = get_current_log_entry(); + if(last_entry.skipping) + return; + + assert(last_entry.assertion_entries.empty() || !last_entry.assertion_entries.back().sealed); + + if(!last_entry.assertion_entries.empty()) + { + junit_impl::junit_log_helper::assertion_entry& log_entry = last_entry.assertion_entries.back(); + log_entry.output += value; + } + else + { + // this may be a message coming from another observer + // the prefix is set in the log_entry_start + last_entry.system_out.push_back(std::string(value.begin(), value.end())); + } +} + +//____________________________________________________________________________// + +void +junit_log_formatter::log_entry_finish( std::ostream& /*ostr*/ ) +{ + junit_impl::junit_log_helper& last_entry = get_current_log_entry(); + if(!last_entry.skipping) + { + assert(last_entry.assertion_entries.empty() || !last_entry.assertion_entries.back().sealed); + + if(!last_entry.assertion_entries.empty()) { + junit_impl::junit_log_helper::assertion_entry& log_entry = last_entry.assertion_entries.back(); + log_entry.output += "\n\n"; // quote end, CR + log_entry.sealed = true; + } + else { + last_entry.system_out.push_back("\n\n"); // quote end, CR + } + } + + last_entry.skipping = false; +} + +//____________________________________________________________________________// + +void +junit_log_formatter::entry_context_start( std::ostream& /*ostr*/, log_level ) +{ + junit_impl::junit_log_helper& last_entry = get_current_log_entry(); + if(last_entry.skipping) + return; + + std::vector< junit_impl::junit_log_helper::assertion_entry > &v_failure_or_error = last_entry.assertion_entries; + assert(!v_failure_or_error.back().sealed); + + junit_impl::junit_log_helper::assertion_entry& last_log_entry = v_failure_or_error.back(); + if(m_is_last_assertion_or_error) + { + last_log_entry.output += "\n- context:\n"; + } + else + { + last_log_entry.output += "\n\nCONTEXT:\n"; + } +} + +//____________________________________________________________________________// + +void +junit_log_formatter::entry_context_finish( std::ostream& /*ostr*/, log_level ) +{ + // no op, may be removed + junit_impl::junit_log_helper& last_entry = get_current_log_entry(); + if(last_entry.skipping) + return; + assert(!get_current_log_entry().assertion_entries.back().sealed); +} + +//____________________________________________________________________________// + +void +junit_log_formatter::log_entry_context( std::ostream& /*ostr*/, log_level , const_string context_descr ) +{ + junit_impl::junit_log_helper& last_entry = get_current_log_entry(); + if(last_entry.skipping) + return; + + assert(!last_entry.assertion_entries.back().sealed); + junit_impl::junit_log_helper::assertion_entry& last_log_entry = get_current_log_entry().assertion_entries.back(); + + last_log_entry.output += + (m_is_last_assertion_or_error ? " - '": "- '") + std::string(context_descr.begin(), context_descr.end()) + "'\n"; // quote end +} + +//____________________________________________________________________________// + + +std::string +junit_log_formatter::get_default_stream_description() const { + std::string name = framework::master_test_suite().p_name.value; + + static const std::string to_replace[] = { " ", "\"", "/", "\\", ":"}; + static const std::string replacement[] = { "_", "_" , "_", "_" , "_"}; + + name = unit_test::utils::replace_all_occurrences_of( + name, + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]), + replacement, replacement + sizeof(replacement)/sizeof(replacement[0])); + + std::ifstream check_init((name + ".xml").c_str()); + if(!check_init) + return name + ".xml"; + + int index = 0; + for(; index < 100; index++) { + std::string candidate = name + "_" + utils::string_cast(index) + ".xml"; + std::ifstream file(candidate.c_str()); + if(!file) + return candidate; + } + + return name + ".xml"; +} + +} // namespace output +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_junit_log_formatter_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/plain_report_formatter.ipp b/libraries/boost/include/boost/test/impl/plain_report_formatter.ipp new file mode 100644 index 0000000000..cbf5a4c029 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/plain_report_formatter.ipp @@ -0,0 +1,207 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : plain report formatter definition +// *************************************************************************** + +#ifndef BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER +#define BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER + +// Boost.Test +#include +#include +#include +#include + +#include + +#include +#include + +// STL +#include +#include +#include + +#include + +# ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::log10; } +# endif + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace output { + +namespace { + +typedef utils::custom_manip quote; + +template +inline std::ostream& +operator<<( utils::custom_printer const& p, T const& value ) +{ + *p << '"' << value << '"'; + + return *p; +} + +//____________________________________________________________________________// + +void +print_stat_value( std::ostream& ostr, counter_t v, counter_t indent, counter_t total, const_string name, const_string res ) +{ + if( v == 0 ) + return; + + if( total > 0 ) + ostr << std::setw( static_cast(indent) ) << "" << v << ' ' << name << ( v != 1 ? "s" : "" ) + << " out of " << total << ' ' << res << '\n'; + else + ostr << std::setw( static_cast(indent) ) << "" << v << ' ' << res << ' ' << name << ( v != 1 ? "s" : "" ) << '\n'; +} + +//____________________________________________________________________________// + +} // local namespace + +// ************************************************************************** // +// ************** plain_report_formatter ************** // +// ************************************************************************** // + +void +plain_report_formatter::results_report_start( std::ostream& ostr ) +{ + m_indent = 0; + m_color_output = runtime_config::get( runtime_config::btrt_color_output ); + ostr << '\n'; +} + +//____________________________________________________________________________// + +void +plain_report_formatter::results_report_finish( std::ostream& ostr ) +{ + ostr.flush(); +} + +//____________________________________________________________________________// + +void +plain_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream& ostr ) +{ + test_results const& tr = results_collector.results( tu.p_id ); + + const_string descr; + + if( tr.passed() ) + descr = "has passed"; + else if( tr.p_skipped ) + descr = "was skipped"; + else if( tr.p_aborted ) + descr = "was aborted"; + else + descr = "has failed"; + + ostr << std::setw( static_cast(m_indent) ) << "" + << "Test " << tu.p_type_name << ' ' << quote() << tu.full_name() << ' ' << descr; + + if( tr.p_skipped ) { + ostr << "\n"; + m_indent += 2; + return; + } + + counter_t total_assertions = tr.p_assertions_passed + tr.p_assertions_failed; + counter_t total_tc = tr.p_test_cases_passed + tr.p_test_cases_warned + tr.p_test_cases_failed + tr.p_test_cases_skipped; + + if( total_assertions > 0 || total_tc > 0 || tr.p_warnings_failed > 0) + ostr << " with:"; + + ostr << '\n'; + m_indent += 2; + + print_stat_value( ostr, tr.p_test_cases_passed , m_indent, total_tc , "test case", "passed" ); + print_stat_value( ostr, tr.p_test_cases_warned , m_indent, total_tc , "test case", "passed with warnings" ); + print_stat_value( ostr, tr.p_test_cases_failed , m_indent, total_tc , "test case", "failed" ); + print_stat_value( ostr, tr.p_test_cases_skipped, m_indent, total_tc , "test case", "skipped" ); + print_stat_value( ostr, tr.p_test_cases_aborted, m_indent, total_tc , "test case", "aborted" ); + print_stat_value( ostr, tr.p_assertions_passed , m_indent, total_assertions, "assertion", "passed" ); + print_stat_value( ostr, tr.p_assertions_failed , m_indent, total_assertions, "assertion", "failed" ); + print_stat_value( ostr, tr.p_warnings_failed , m_indent, 0 , "warning" , "failed" ); + print_stat_value( ostr, tr.p_expected_failures , m_indent, 0 , "failure" , "expected" ); + + ostr << '\n'; +} + +//____________________________________________________________________________// + +void +plain_report_formatter::test_unit_report_finish( test_unit const&, std::ostream& ) +{ + m_indent -= 2; +} + +//____________________________________________________________________________// + +void +plain_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr ) +{ + test_results const& tr = results_collector.results( tu.p_id ); + + if( tr.passed() ) { + BOOST_TEST_SCOPE_SETCOLOR( m_color_output, ostr, term_attr::BRIGHT, term_color::GREEN ); + + ostr << "*** No errors detected\n"; + return; + } + + BOOST_TEST_SCOPE_SETCOLOR( m_color_output, ostr, term_attr::BRIGHT, term_color::RED ); + + if( tr.p_skipped ) { + ostr << "*** The test " << tu.p_type_name << ' ' << quote() << tu.full_name() << " was skipped" + << "; see standard output for details\n"; + return; + } + + if( tr.p_aborted ) { + ostr << "*** The test " << tu.p_type_name << ' ' << quote() << tu.full_name() << " was aborted" + << "; see standard output for details\n"; + } + + if( tr.p_assertions_failed == 0 ) { + if( !tr.p_aborted ) + ostr << "*** Errors were detected in the test " << tu.p_type_name << ' ' << quote() << tu.full_name() + << "; see standard output for details\n"; + return; + } + + counter_t num_failures = tr.p_assertions_failed; + + ostr << "*** " << num_failures << " failure" << ( num_failures != 1 ? "s are" : " is" ) << " detected"; + + if( tr.p_expected_failures > 0 ) + ostr << " (" << tr.p_expected_failures << " failure" << ( tr.p_expected_failures != 1 ? "s are" : " is" ) << " expected)"; + + ostr << " in the test " << tu.p_type_name << " " << quote() << tu.full_name() << "\n"; +} + +//____________________________________________________________________________// + +} // namespace output +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/progress_monitor.ipp b/libraries/boost/include/boost/test/impl/progress_monitor.ipp new file mode 100644 index 0000000000..34149745cf --- /dev/null +++ b/libraries/boost/include/boost/test/impl/progress_monitor.ipp @@ -0,0 +1,185 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : implements simple text based progress monitor +// *************************************************************************** + +#ifndef BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER +#define BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER + +// Boost.Test +#include +#include + +#include + +#include +#include +#include + +// Boost +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** progress_monitor ************** // +// ************************************************************************** // + +struct progress_display { + progress_display( counter_t expected_count, std::ostream& os ) + : m_os(os) + , m_count( 0 ) + , m_expected_count( expected_count ) + , m_next_tic_count( 0 ) + , m_tic( 0 ) + { + + m_os << "\n0% 10 20 30 40 50 60 70 80 90 100%" + << "\n|----|----|----|----|----|----|----|----|----|----|" + << std::endl; + + if( !m_expected_count ) + m_expected_count = 1; // prevent divide by zero + } + + unsigned long operator+=( unsigned long increment ) + { + if( (m_count += increment) < m_next_tic_count ) + return m_count; + + // use of floating point ensures that both large and small counts + // work correctly. static_cast<>() is also used several places + // to suppress spurious compiler warnings. + unsigned int tics_needed = static_cast( + (static_cast(m_count)/m_expected_count)*50.0 ); + + do { + m_os << '*' << std::flush; + } while( ++m_tic < tics_needed ); + + m_next_tic_count = static_cast((m_tic/50.0) * m_expected_count); + + if( m_count == m_expected_count ) { + if( m_tic < 51 ) + m_os << '*'; + + m_os << std::endl; + } + + return m_count; + } + unsigned long operator++() { return operator+=( 1 ); } + unsigned long count() const { return m_count; } + +private: + BOOST_DELETED_FUNCTION(progress_display(progress_display const&)) + BOOST_DELETED_FUNCTION(progress_display& operator=(progress_display const&)) + + std::ostream& m_os; // may not be present in all imps + + unsigned long m_count; + unsigned long m_expected_count; + unsigned long m_next_tic_count; + unsigned int m_tic; +}; + +namespace { + +struct progress_monitor_impl { + // Constructor + progress_monitor_impl() + : m_stream( &std::cout ) + , m_color_output( false ) + { + } + + std::ostream* m_stream; + scoped_ptr m_progress_display; + bool m_color_output; +}; + +progress_monitor_impl& s_pm_impl() { static progress_monitor_impl the_inst; return the_inst; } + +#define PM_SCOPED_COLOR() \ + BOOST_TEST_SCOPE_SETCOLOR( s_pm_impl().m_color_output, *s_pm_impl().m_stream, term_attr::BRIGHT, term_color::MAGENTA ) + +} // local namespace + +//____________________________________________________________________________// + +void +progress_monitor_t::test_start( counter_t test_cases_amount ) +{ + s_pm_impl().m_color_output = runtime_config::get( runtime_config::btrt_color_output ); + + PM_SCOPED_COLOR(); + + s_pm_impl().m_progress_display.reset( new progress_display( test_cases_amount, *s_pm_impl().m_stream ) ); +} + +//____________________________________________________________________________// + +void +progress_monitor_t::test_aborted() +{ + PM_SCOPED_COLOR(); + + (*s_pm_impl().m_progress_display) += s_pm_impl().m_progress_display->count(); +} + +//____________________________________________________________________________// + +void +progress_monitor_t::test_unit_finish( test_unit const& tu, unsigned long ) +{ + PM_SCOPED_COLOR(); + + if( tu.p_type == TUT_CASE ) + ++(*s_pm_impl().m_progress_display); +} + +//____________________________________________________________________________// + +void +progress_monitor_t::test_unit_skipped( test_unit const& tu, const_string /*reason*/ ) +{ + PM_SCOPED_COLOR(); + + test_case_counter tcc; + traverse_test_tree( tu, tcc ); + + (*s_pm_impl().m_progress_display) += tcc.p_count; +} + +//____________________________________________________________________________// + +void +progress_monitor_t::set_stream( std::ostream& ostr ) +{ + s_pm_impl().m_stream = &ostr; +} + +//____________________________________________________________________________// + +#undef PM_SCOPED_COLOR + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/results_collector.ipp b/libraries/boost/include/boost/test/impl/results_collector.ipp new file mode 100644 index 0000000000..fd74bdb65c --- /dev/null +++ b/libraries/boost/include/boost/test/impl/results_collector.ipp @@ -0,0 +1,285 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : implements Unit Test results collecting facility. +// *************************************************************************** + +#ifndef BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER +#define BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER + +// Boost.Test +#include +#include +#include + +#include +#include +#include +#include + +// Boost +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** test_results ************** // +// ************************************************************************** // + +test_results::test_results() +{ + clear(); +} + +//____________________________________________________________________________// + +bool +test_results::passed() const +{ + return !p_skipped && + p_test_cases_failed == 0 && + p_assertions_failed <= p_expected_failures && + p_test_cases_skipped == 0 && + !p_aborted; +} + +bool +test_results::aborted() const +{ + return p_aborted; +} + +//____________________________________________________________________________// + +int +test_results::result_code() const +{ + return passed() ? exit_success + : ( (p_assertions_failed > p_expected_failures || p_skipped ) + ? exit_test_failure + : exit_exception_failure ); +} + +//____________________________________________________________________________// + +void +test_results::operator+=( test_results const& tr ) +{ + p_assertions_passed.value += tr.p_assertions_passed; + p_assertions_failed.value += tr.p_assertions_failed; + p_warnings_failed.value += tr.p_warnings_failed; + p_test_cases_passed.value += tr.p_test_cases_passed; + p_test_cases_warned.value += tr.p_test_cases_warned; + p_test_cases_failed.value += tr.p_test_cases_failed; + p_test_cases_skipped.value += tr.p_test_cases_skipped; + p_test_cases_aborted.value += tr.p_test_cases_aborted; + p_duration_microseconds.value += tr.p_duration_microseconds; +} + +//____________________________________________________________________________// + +void +test_results::clear() +{ + p_assertions_passed.value = 0; + p_assertions_failed.value = 0; + p_warnings_failed.value = 0; + p_expected_failures.value = 0; + p_test_cases_passed.value = 0; + p_test_cases_warned.value = 0; + p_test_cases_failed.value = 0; + p_test_cases_skipped.value = 0; + p_test_cases_aborted.value = 0; + p_duration_microseconds.value= 0; + p_aborted.value = false; + p_skipped.value = false; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** results_collector ************** // +// ************************************************************************** // + +namespace { + +struct results_collector_impl { + std::map m_results_store; +}; + +results_collector_impl& s_rc_impl() { static results_collector_impl the_inst; return the_inst; } + +} // local namespace + +//____________________________________________________________________________// + +void +results_collector_t::test_start( counter_t ) +{ + s_rc_impl().m_results_store.clear(); +} + +//____________________________________________________________________________// + +void +results_collector_t::test_unit_start( test_unit const& tu ) +{ + // init test_results entry + test_results& tr = s_rc_impl().m_results_store[tu.p_id]; + + tr.clear(); + + tr.p_expected_failures.value = tu.p_expected_failures; +} + +//____________________________________________________________________________// + +class results_collect_helper : public test_tree_visitor { +public: + explicit results_collect_helper( test_results& tr, test_unit const& ts ) : m_tr( tr ), m_ts( ts ) {} + + void visit( test_case const& tc ) + { + test_results const& tr = results_collector.results( tc.p_id ); + m_tr += tr; + + if( tr.passed() ) { + if( tr.p_warnings_failed ) + m_tr.p_test_cases_warned.value++; + else + m_tr.p_test_cases_passed.value++; + } + else if( tr.p_skipped ) + m_tr.p_test_cases_skipped.value++; + else { + if( tr.p_aborted ) + m_tr.p_test_cases_aborted.value++; + + m_tr.p_test_cases_failed.value++; + } + } + bool test_suite_start( test_suite const& ts ) + { + if( m_ts.p_id == ts.p_id ) + return true; + + m_tr += results_collector.results( ts.p_id ); + return false; + } + +private: + // Data members + test_results& m_tr; + test_unit const& m_ts; +}; + +//____________________________________________________________________________// + +void +results_collector_t::test_unit_finish( test_unit const& tu, unsigned long elapsed_in_microseconds ) +{ + if( tu.p_type == TUT_SUITE ) { + results_collect_helper ch( s_rc_impl().m_results_store[tu.p_id], tu ); + + traverse_test_tree( tu, ch ); + } + else { + test_results & tr = s_rc_impl().m_results_store[tu.p_id]; + tr.p_duration_microseconds.value = elapsed_in_microseconds; + + bool num_failures_match = tr.p_aborted || tr.p_assertions_failed >= tr.p_expected_failures; + if( !num_failures_match ) + BOOST_TEST_FRAMEWORK_MESSAGE( "Test case " << tu.full_name() << " has fewer failures than expected" ); + + bool check_any_assertions = tr.p_aborted || (tr.p_assertions_failed != 0) || (tr.p_assertions_passed != 0); + if( !check_any_assertions ) + BOOST_TEST_FRAMEWORK_MESSAGE( "Test case " << tu.full_name() << " did not check any assertions" ); + } +} + +//____________________________________________________________________________// + +void +results_collector_t::test_unit_skipped( test_unit const& tu, const_string /*reason*/ ) +{ + test_results& tr = s_rc_impl().m_results_store[tu.p_id]; + + tr.clear(); + + tr.p_skipped.value = true; + + if( tu.p_type == TUT_SUITE ) { + test_case_counter tcc; + traverse_test_tree( tu, tcc ); + + tr.p_test_cases_skipped.value = tcc.p_count; + } +} + +//____________________________________________________________________________// + +void +results_collector_t::assertion_result( unit_test::assertion_result ar ) +{ + test_results& tr = s_rc_impl().m_results_store[framework::current_test_case_id()]; + + switch( ar ) { + case AR_PASSED: tr.p_assertions_passed.value++; break; + case AR_FAILED: tr.p_assertions_failed.value++; break; + case AR_TRIGGERED: tr.p_warnings_failed.value++; break; + } + + if( tr.p_assertions_failed == 1 ) + first_failed_assertion(); +} + +//____________________________________________________________________________// + +void +results_collector_t::exception_caught( execution_exception const& ) +{ + test_results& tr = s_rc_impl().m_results_store[framework::current_test_case_id()]; + + tr.p_assertions_failed.value++; +} + +//____________________________________________________________________________// + +void +results_collector_t::test_unit_aborted( test_unit const& tu ) +{ + s_rc_impl().m_results_store[tu.p_id].p_aborted.value = true; +} + +//____________________________________________________________________________// + +test_results const& +results_collector_t::results( test_unit_id id ) const +{ + return s_rc_impl().m_results_store[id]; +} + +//____________________________________________________________________________// + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER diff --git a/libraries/boost/include/boost/test/impl/results_reporter.ipp b/libraries/boost/include/boost/test/impl/results_reporter.ipp new file mode 100644 index 0000000000..87c1172e12 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/results_reporter.ipp @@ -0,0 +1,197 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : result reporting facilties +// *************************************************************************** + +#ifndef BOOST_TEST_RESULTS_REPORTER_IPP_020105GER +#define BOOST_TEST_RESULTS_REPORTER_IPP_020105GER + +// Boost.Test +#include +#include +#include + +#include +#include + +#include +#include +#include + +// Boost +#include +#include +typedef ::boost::io::ios_base_all_saver io_saver_type; + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace results_reporter { + +// ************************************************************************** // +// ************** result reporter implementation ************** // +// ************************************************************************** // + +namespace { + +struct results_reporter_impl : test_tree_visitor { + // Constructor + results_reporter_impl() + : m_stream( &std::cerr ) + , m_stream_state_saver( new io_saver_type( std::cerr ) ) + , m_report_level( CONFIRMATION_REPORT ) + , m_formatter( new output::plain_report_formatter ) + {} + + // test tree visitor interface implementation + void visit( test_case const& tc ) + { + m_formatter->test_unit_report_start( tc, *m_stream ); + m_formatter->test_unit_report_finish( tc, *m_stream ); + } + bool test_suite_start( test_suite const& ts ) + { + m_formatter->test_unit_report_start( ts, *m_stream ); + + if( m_report_level == DETAILED_REPORT && !results_collector.results( ts.p_id ).p_skipped ) + return true; + + m_formatter->test_unit_report_finish( ts, *m_stream ); + return false; + } + void test_suite_finish( test_suite const& ts ) + { + m_formatter->test_unit_report_finish( ts, *m_stream ); + } + + typedef scoped_ptr saver_ptr; + + // Data members + std::ostream* m_stream; + saver_ptr m_stream_state_saver; + report_level m_report_level; + scoped_ptr m_formatter; +}; + +results_reporter_impl& s_rr_impl() { static results_reporter_impl the_inst; return the_inst; } + +} // local namespace + +// ************************************************************************** // +// ************** report configuration ************** // +// ************************************************************************** // + +void +set_level( report_level l ) +{ + if( l != INV_REPORT_LEVEL ) + s_rr_impl().m_report_level = l; +} + +//____________________________________________________________________________// + +void +set_stream( std::ostream& ostr ) +{ + s_rr_impl().m_stream = &ostr; + s_rr_impl().m_stream_state_saver.reset( new io_saver_type( ostr ) ); +} + +//____________________________________________________________________________// + +std::ostream& +get_stream() +{ + return *s_rr_impl().m_stream; +} + +//____________________________________________________________________________// + +void +set_format( output_format rf ) +{ + switch( rf ) { + default: + case OF_CLF: + set_format( new output::plain_report_formatter ); + break; + case OF_XML: + set_format( new output::xml_report_formatter ); + break; + } +} + +//____________________________________________________________________________// + +void +set_format( results_reporter::format* f ) +{ + if( f ) + s_rr_impl().m_formatter.reset( f ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** report initiation ************** // +// ************************************************************************** // + +void +make_report( report_level l, test_unit_id id ) +{ + if( l == INV_REPORT_LEVEL ) + l = s_rr_impl().m_report_level; + + if( l == NO_REPORT ) + return; + + if( id == INV_TEST_UNIT_ID ) + id = framework::master_test_suite().p_id; + + s_rr_impl().m_stream_state_saver->restore(); + + report_level bkup = s_rr_impl().m_report_level; + s_rr_impl().m_report_level = l; + + s_rr_impl().m_formatter->results_report_start( *s_rr_impl().m_stream ); + + switch( l ) { + case CONFIRMATION_REPORT: + s_rr_impl().m_formatter->do_confirmation_report( framework::get( id ), *s_rr_impl().m_stream ); + break; + case SHORT_REPORT: + case DETAILED_REPORT: + traverse_test_tree( id, s_rr_impl() ); + break; + default: + break; + } + + s_rr_impl().m_formatter->results_report_finish( *s_rr_impl().m_stream ); + s_rr_impl().m_report_level = bkup; +} + +//____________________________________________________________________________// + +} // namespace results_reporter +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_RESULTS_REPORTER_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/test_framework_init_observer.ipp b/libraries/boost/include/boost/test/impl/test_framework_init_observer.ipp new file mode 100644 index 0000000000..89f854aaed --- /dev/null +++ b/libraries/boost/include/boost/test/impl/test_framework_init_observer.ipp @@ -0,0 +1,109 @@ +// (c) Copyright Raffi Enficiaud 2017. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! An observer for monitoring the success/failure of the other observers +// *************************************************************************** + +#ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER +#define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER + +// Boost.Test +#include +#include +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** framework_init_observer_t ************** // +// ************************************************************************** // + +namespace { + +struct test_init_observer_check { + bool has_failure; + + void clear() + { + has_failure = false; + } +}; + + +test_init_observer_check& s_tioc_impl() { static test_init_observer_check the_inst; return the_inst; } + +} // local namespace + +void +framework_init_observer_t::clear() +{ + if(!framework::test_in_progress()) + s_tioc_impl().clear(); +} + +//____________________________________________________________________________// + +void +framework_init_observer_t::test_start( counter_t ) +{ + clear(); +} + +//____________________________________________________________________________// + +void +framework_init_observer_t::assertion_result( unit_test::assertion_result ar ) +{ + test_init_observer_check& tr = s_tioc_impl(); + switch( ar ) { + case AR_TRIGGERED: break; + case AR_PASSED: break; + case AR_FAILED: tr.has_failure = true; break; + default: + break; + } +} + +//____________________________________________________________________________// + +void +framework_init_observer_t::exception_caught( execution_exception const& ) +{ + test_init_observer_check& tr = s_tioc_impl(); + tr.has_failure = true; +} + +void +framework_init_observer_t::test_aborted() +{ + s_tioc_impl().has_failure = true; +} + + +//____________________________________________________________________________// + +bool +framework_init_observer_t::has_failed() const +{ + return s_tioc_impl().has_failure; +} + +//____________________________________________________________________________// + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER diff --git a/libraries/boost/include/boost/test/impl/test_main.ipp b/libraries/boost/include/boost/test/impl/test_main.ipp new file mode 100644 index 0000000000..6adc5bb9c2 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/test_main.ipp @@ -0,0 +1,65 @@ +// (C) Copyright Gennadiy Rozental 2001. +// (C) Copyright Beman Dawes 1995-2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Implements main function for Test Execution Monitor. +// *************************************************************************** + +#ifndef BOOST_TEST_TEST_MAIN_IPP_012205GER +#define BOOST_TEST_TEST_MAIN_IPP_012205GER + +// Boost.Test +#include +#include +#include + +// Boost +#include + +#include + +//____________________________________________________________________________// + +extern int test_main( int argc, char* argv[] ); // prototype for user's test_main() + +struct test_main_caller { + test_main_caller( int argc, char** argv ) : m_argc( argc ), m_argv( argv ) {} + + void operator()() { + int test_main_result = test_main( m_argc, m_argv ); + + // translate a test_main non-success return into a test error + BOOST_CHECK( test_main_result == 0 || test_main_result == boost::exit_success ); + } + +private: + // Data members + int m_argc; + char** m_argv; +}; + +// ************************************************************************** // +// ************** test main ************** // +// ************************************************************************** // + +::boost::unit_test::test_suite* +init_unit_test_suite( int argc, char* argv[] ) { + using namespace ::boost::unit_test; + + framework::master_test_suite().p_name.value = "Test Program"; + + framework::master_test_suite().add( BOOST_TEST_CASE( test_main_caller( argc, argv ) ) ); + + return 0; +} + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_TEST_MAIN_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/test_tools.ipp b/libraries/boost/include/boost/test/impl/test_tools.ipp new file mode 100644 index 0000000000..2956879326 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/test_tools.ipp @@ -0,0 +1,823 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : supplies offline implementation for the Test Tools +// *************************************************************************** + +#ifndef BOOST_TEST_TEST_TOOLS_IPP_012205GER +#define BOOST_TEST_TEST_TOOLS_IPP_012205GER + +// Boost.Test +#include +#include +#include + +#include +#include + +#include +#include +#include // execution_aborted + +#include + +#include + +// Boost +#include + +// STL +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// !! should we use #include +#include + +#include + +//____________________________________________________________________________// + +# ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::strcmp; using ::strlen; using ::isprint; } +#if !defined( BOOST_NO_CWCHAR ) +namespace std { using ::wcscmp; } +#endif +# endif + +namespace boost { +namespace test_tools { +namespace tt_detail { + +// ************************************************************************** // +// ************** print_log_value ************** // +// ************************************************************************** // + +void +print_log_value::operator()( std::ostream& ostr, bool t ) +{ + ostr << std::boolalpha << t; +} + +void +print_log_value::operator()( std::ostream& ostr, char t ) +{ + if( (std::isprint)( static_cast(t) ) ) + ostr << '\'' << t << '\''; + else + ostr << std::hex +#if BOOST_TEST_USE_STD_LOCALE + << std::showbase +#else + << "0x" +#endif + << static_cast(t); +} + +//____________________________________________________________________________// + +void +print_log_value::operator()( std::ostream& ostr, unsigned char t ) +{ + ostr << std::hex + // showbase is only available for new style streams: +#if BOOST_TEST_USE_STD_LOCALE + << std::showbase +#else + << "0x" +#endif + << static_cast(t); +} + +//____________________________________________________________________________// + +void +print_log_value::operator()( std::ostream& ostr, char const* t ) +{ + ostr << ( t ? t : "null string" ); +} + +//____________________________________________________________________________// + +void +print_log_value::operator()( std::ostream& ostr, wchar_t const* t ) +{ + ostr << ( t ? t : L"null string" ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** TOOL BOX Implementation ************** // +// ************************************************************************** // + +using ::boost::unit_test::lazy_ostream; + +static char const* check_str [] = { " == ", " != ", " < " , " <= ", " > " , " >= " }; +static char const* rever_str [] = { " != ", " == ", " >= ", " > " , " <= ", " < " }; + +template +void +format_report( OutStream& os, assertion_result const& pr, unit_test::lazy_ostream const& assertion_descr, + tool_level tl, check_type ct, + std::size_t num_args, va_list args, + char const* prefix, char const* suffix ) +{ + using namespace unit_test; + + switch( ct ) { + case CHECK_PRED: + os << prefix << assertion_descr << suffix; + + if( !pr.has_empty_message() ) + os << ". " << pr.message(); + break; + + case CHECK_BUILT_ASSERTION: { + os << prefix << assertion_descr << suffix; + + if( tl != PASS ) { + const_string details_message = pr.message(); + + if( !details_message.is_empty() ) { + os << details_message; + } + } + break; + } + + case CHECK_MSG: + if( tl == PASS ) + os << prefix << "'" << assertion_descr << "'" << suffix; + else + os << assertion_descr; + + if( !pr.has_empty_message() ) + os << ". " << pr.message(); + break; + + case CHECK_EQUAL: + case CHECK_NE: + case CHECK_LT: + case CHECK_LE: + case CHECK_GT: + case CHECK_GE: { + char const* arg1_descr = va_arg( args, char const* ); + lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* ); + char const* arg2_descr = va_arg( args, char const* ); + lazy_ostream const* arg2_val = va_arg( args, lazy_ostream const* ); + + os << prefix << arg1_descr << check_str[ct-CHECK_EQUAL] << arg2_descr << suffix; + + if( tl != PASS ) + os << " [" << *arg1_val << rever_str[ct-CHECK_EQUAL] << *arg2_val << "]" ; + + if( !pr.has_empty_message() ) + os << ". " << pr.message(); + break; + } + + case CHECK_CLOSE: + case CHECK_CLOSE_FRACTION: { + char const* arg1_descr = va_arg( args, char const* ); + lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* ); + char const* arg2_descr = va_arg( args, char const* ); + lazy_ostream const* arg2_val = va_arg( args, lazy_ostream const* ); + /* toler_descr = */ va_arg( args, char const* ); + lazy_ostream const* toler_val = va_arg( args, lazy_ostream const* ); + + os << "difference{" << pr.message() + << "} between " << arg1_descr << "{" << *arg1_val + << "} and " << arg2_descr << "{" << *arg2_val + << ( tl == PASS ? "} doesn't exceed " : "} exceeds " ) + << *toler_val; + if( ct == CHECK_CLOSE ) + os << "%"; + break; + } + case CHECK_SMALL: { + char const* arg1_descr = va_arg( args, char const* ); + lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* ); + /* toler_descr = */ va_arg( args, char const* ); + lazy_ostream const* toler_val = va_arg( args, lazy_ostream const* ); + + os << "absolute value of " << arg1_descr << "{" << *arg1_val << "}" + << ( tl == PASS ? " doesn't exceed " : " exceeds " ) + << *toler_val; + + if( !pr.has_empty_message() ) + os << ". " << pr.message(); + break; + } + + case CHECK_PRED_WITH_ARGS: { + std::vector< std::pair > args_copy; + args_copy.reserve( num_args ); + for( std::size_t i = 0; i < num_args; ++i ) { + char const* desc = va_arg( args, char const* ); + lazy_ostream const* value = va_arg( args, lazy_ostream const* ); + args_copy.push_back( std::make_pair( desc, value ) ); + } + + os << prefix << assertion_descr; + + // print predicate call description + os << "( "; + for( std::size_t i = 0; i < num_args; ++i ) { + os << args_copy[i].first; + + if( i != num_args-1 ) + os << ", "; + } + os << " )" << suffix; + + if( tl != PASS ) { + os << " for ( "; + for( std::size_t i = 0; i < num_args; ++i ) { + os << *args_copy[i].second; + + if( i != num_args-1 ) + os << ", "; + } + os << " )"; + } + + if( !pr.has_empty_message() ) + os << ". " << pr.message(); + break; + } + + case CHECK_EQUAL_COLL: { + char const* left_begin_descr = va_arg( args, char const* ); + char const* left_end_descr = va_arg( args, char const* ); + char const* right_begin_descr = va_arg( args, char const* ); + char const* right_end_descr = va_arg( args, char const* ); + + os << prefix << "{ " << left_begin_descr << ", " << left_end_descr << " } == { " + << right_begin_descr << ", " << right_end_descr << " }" + << suffix; + + if( !pr.has_empty_message() ) + os << ". " << pr.message(); + break; + } + + case CHECK_BITWISE_EQUAL: { + char const* left_descr = va_arg( args, char const* ); + char const* right_descr = va_arg( args, char const* ); + + os << prefix << left_descr << " =.= " << right_descr << suffix; + + if( !pr.has_empty_message() ) + os << ". " << pr.message(); + break; + } + } +} + +//____________________________________________________________________________// + +bool +report_assertion( assertion_result const& ar, + lazy_ostream const& assertion_descr, + const_string file_name, + std::size_t line_num, + tool_level tl, + check_type ct, + std::size_t num_args, ... ) +{ + using namespace unit_test; + + if( !framework::test_in_progress() ) { + // in case no test is in progress, we do not throw anything: + // raising an exception here may result in raising an exception in a destructor of a global fixture + // which will abort the process + // We flag this as aborted instead + + //BOOST_TEST_I_ASSRT( framework::current_test_case_id() != INV_TEST_UNIT_ID, + // std::runtime_error( "Can't use testing tools outside of test case implementation." ) ); + + framework::test_aborted(); + return false; + } + + + if( !!ar ) + tl = PASS; + + log_level ll; + char const* prefix; + char const* suffix; + + switch( tl ) { + case PASS: + ll = log_successful_tests; + prefix = "check "; + suffix = " has passed"; + break; + case WARN: + ll = log_warnings; + prefix = "condition "; + suffix = " is not satisfied"; + break; + case CHECK: + ll = log_all_errors; + prefix = "check "; + suffix = " has failed"; + break; + case REQUIRE: + ll = log_fatal_errors; + prefix = "critical check "; + suffix = " has failed"; + break; + default: + return true; + } + + unit_test_log << unit_test::log::begin( file_name, line_num ) << ll; + va_list args; + va_start( args, num_args ); + + format_report( unit_test_log, ar, assertion_descr, tl, ct, num_args, args, prefix, suffix ); + + va_end( args ); + unit_test_log << unit_test::log::end(); + + switch( tl ) { + case PASS: + framework::assertion_result( AR_PASSED ); + return true; + + case WARN: + framework::assertion_result( AR_TRIGGERED ); + return false; + + case CHECK: + framework::assertion_result( AR_FAILED ); + return false; + + case REQUIRE: + framework::assertion_result( AR_FAILED ); + framework::test_unit_aborted( framework::current_test_unit() ); + BOOST_TEST_I_THROW( execution_aborted() ); + return false; + } + + return true; +} + +//____________________________________________________________________________// + +assertion_result +format_assertion_result( const_string expr_val, const_string details ) +{ + assertion_result res(false); + + bool starts_new_line = first_char( expr_val ) == '\n'; + + if( !starts_new_line && !expr_val.is_empty() ) + res.message().stream() << " [" << expr_val << "]"; + + if( !details.is_empty() ) { + if( first_char(details) != '[' ) + res.message().stream() << ". "; + else + res.message().stream() << " "; + + res.message().stream() << details; + } + + if( starts_new_line ) + res.message().stream() << "." << expr_val; + + return res; +} + +//____________________________________________________________________________// + +BOOST_TEST_DECL std::string +prod_report_format( assertion_result const& ar, unit_test::lazy_ostream const& assertion_descr, check_type ct, std::size_t num_args, ... ) +{ + std::ostringstream msg_buff; + + va_list args; + va_start( args, num_args ); + + format_report( msg_buff, ar, assertion_descr, CHECK, ct, num_args, args, "assertion ", " failed" ); + + va_end( args ); + + return msg_buff.str(); +} + +//____________________________________________________________________________// + +assertion_result +equal_impl( char const* left, char const* right ) +{ + return (left && right) ? std::strcmp( left, right ) == 0 : (left == right); +} + +//____________________________________________________________________________// + +#if !defined( BOOST_NO_CWCHAR ) + +assertion_result +equal_impl( wchar_t const* left, wchar_t const* right ) +{ + return (left && right) ? std::wcscmp( left, right ) == 0 : (left == right); +} + +#endif // !defined( BOOST_NO_CWCHAR ) + +//____________________________________________________________________________// + +bool +is_defined_impl( const_string symbol_name, const_string symbol_value ) +{ + symbol_value.trim_left( 2 ); + return symbol_name != symbol_value; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** context_frame ************** // +// ************************************************************************** // + +context_frame::context_frame( ::boost::unit_test::lazy_ostream const& context_descr ) +: m_frame_id( unit_test::framework::add_context( context_descr, true ) ) +{ +} + +//____________________________________________________________________________// + +context_frame::~context_frame() +{ + unit_test::framework::clear_context( m_frame_id ); +} + +//____________________________________________________________________________// + +context_frame::operator bool() +{ + return true; +} + +//____________________________________________________________________________// + +} // namespace tt_detail + +// ************************************************************************** // +// ************** output_test_stream ************** // +// ************************************************************************** // + +struct output_test_stream::Impl +{ + std::fstream m_pattern; + bool m_match_or_save; + bool m_text_or_binary; + std::string m_synced_string; + + char get_char() + { + char res = 0; + do { + m_pattern.get( res ); + } while( m_text_or_binary && res == '\r' && !m_pattern.fail() && !m_pattern.eof() ); + + return res; + } + + void check_and_fill( assertion_result& res ) + { + if( !res.p_predicate_value ) + res.message() << "Output content: \"" << m_synced_string << '\"'; + } +}; + +//____________________________________________________________________________// + +output_test_stream::output_test_stream( const_string pattern_file_name, bool match_or_save, bool text_or_binary ) +: m_pimpl( new Impl ) +{ + if( !pattern_file_name.is_empty() ) { + std::ios::openmode m = match_or_save ? std::ios::in : std::ios::out; + if( !text_or_binary ) + m |= std::ios::binary; + + m_pimpl->m_pattern.open( pattern_file_name.begin(), m ); + + if( !m_pimpl->m_pattern.is_open() ) + BOOST_TEST_FRAMEWORK_MESSAGE( "Can't open pattern file " << pattern_file_name << " for " << (match_or_save ? "reading" : "writing") ); + } + + m_pimpl->m_match_or_save = match_or_save; + m_pimpl->m_text_or_binary = text_or_binary; +} + +//____________________________________________________________________________// + +output_test_stream::~output_test_stream() +{ + delete m_pimpl; +} + +//____________________________________________________________________________// + +assertion_result +output_test_stream::is_empty( bool flush_stream ) +{ + sync(); + + assertion_result res( m_pimpl->m_synced_string.empty() ); + + m_pimpl->check_and_fill( res ); + + if( flush_stream ) + flush(); + + return res; +} + +//____________________________________________________________________________// + +assertion_result +output_test_stream::check_length( std::size_t length_, bool flush_stream ) +{ + sync(); + + assertion_result res( m_pimpl->m_synced_string.length() == length_ ); + + m_pimpl->check_and_fill( res ); + + if( flush_stream ) + flush(); + + return res; +} + +//____________________________________________________________________________// + +assertion_result +output_test_stream::is_equal( const_string arg, bool flush_stream ) +{ + sync(); + + assertion_result res( const_string( m_pimpl->m_synced_string ) == arg ); + + m_pimpl->check_and_fill( res ); + + if( flush_stream ) + flush(); + + return res; +} + +//____________________________________________________________________________// + +std::string pretty_print_log(std::string str) { + + static const std::string to_replace[] = { "\r", "\n" }; + static const std::string replacement[] = { "\\r", "\\n" }; + + return unit_test::utils::replace_all_occurrences_of( + str, + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]), + replacement, replacement + sizeof(replacement)/sizeof(replacement[0])); +} + +assertion_result +output_test_stream::match_pattern( bool flush_stream ) +{ + const std::string::size_type n_chars_presuffix = 10; + sync(); + + assertion_result result( true ); + + const std::string stream_string_repr = get_stream_string_representation(); + + if( !m_pimpl->m_pattern.is_open() ) { + result = false; + result.message() << "Pattern file can't be opened!"; + } + else { + if( m_pimpl->m_match_or_save ) { + + int offset = 0; + std::vector last_elements; + for ( std::string::size_type i = 0; static_cast(i + offset) < static_cast(stream_string_repr.length()); ++i ) { + + char c = m_pimpl->get_char(); + + if( last_elements.size() <= n_chars_presuffix ) { + last_elements.push_back( c ); + } + else { + last_elements[ i % last_elements.size() ] = c; + } + + bool is_same = !m_pimpl->m_pattern.fail() && + !m_pimpl->m_pattern.eof() && + (stream_string_repr[i+offset] == c); + + if( !is_same ) { + + result = false; + + std::string::size_type prefix_size = (std::min)( i + offset, n_chars_presuffix ); + + std::string::size_type suffix_size = (std::min)( stream_string_repr.length() - i - offset, + n_chars_presuffix ); + + // try to log area around the mismatch + std::string substr = stream_string_repr.substr(0, i+offset); + std::size_t line = std::count(substr.begin(), substr.end(), '\n'); + std::size_t column = i + offset - substr.rfind('\n'); + + result.message() + << "Mismatch at position " << i + << " (line " << line + << ", column " << column + << "): '" << pretty_print_log(std::string(1, stream_string_repr[i+offset])) << "' != '" << pretty_print_log(std::string(1, c)) << "' :\n"; + + // we already escape this substring because we need its actual size for the pretty print + // of the difference location. + std::string sub_str_prefix(pretty_print_log(stream_string_repr.substr( i + offset - prefix_size, prefix_size ))); + + // we need this substring as is because we compute the best matching substrings on it. + std::string sub_str_suffix(stream_string_repr.substr( i + offset, suffix_size)); + result.message() << "... " << sub_str_prefix + pretty_print_log(sub_str_suffix) << " ..." << '\n'; + + result.message() << "... "; + for( std::size_t j = 0; j < last_elements.size() ; j++ ) + result.message() << pretty_print_log(std::string(1, last_elements[(i + j + 1) % last_elements.size()])); + + std::vector last_elements_ordered; + last_elements_ordered.push_back(c); + for( std::string::size_type counter = 0; counter < suffix_size - 1 ; counter++ ) { + char c2 = m_pimpl->get_char(); + + if( m_pimpl->m_pattern.fail() || m_pimpl->m_pattern.eof() ) + break; + + result.message() << pretty_print_log(std::string(1, c2)); + + last_elements_ordered.push_back(c2); + } + + // tries to find the best substring matching in the remainder of the + // two strings + std::size_t max_nb_char_in_common = 0; + std::size_t best_pattern_start_index = 0; + std::size_t best_stream_start_index = 0; + for( std::size_t pattern_start_index = best_pattern_start_index; + pattern_start_index < last_elements_ordered.size(); + pattern_start_index++ ) { + for( std::size_t stream_start_index = best_stream_start_index; + stream_start_index < sub_str_suffix.size(); + stream_start_index++ ) { + + std::size_t max_size = (std::min)( last_elements_ordered.size() - pattern_start_index, sub_str_suffix.size() - stream_start_index ); + if( max_nb_char_in_common > max_size ) + break; // safely break to go to the outer loop + + std::size_t nb_char_in_common = 0; + for( std::size_t k = 0; k < max_size; k++) { + if( last_elements_ordered[pattern_start_index + k] == sub_str_suffix[stream_start_index + k] ) + nb_char_in_common ++; + else + break; // we take fully matching substring only + } + + if( nb_char_in_common > max_nb_char_in_common ) { + max_nb_char_in_common = nb_char_in_common; + best_pattern_start_index = pattern_start_index; + best_stream_start_index = stream_start_index; + } + } + } + + // indicates with more precision the location of the mismatchs in "ascii arts" ... + result.message() << " ...\n... "; + for( std::string::size_type j = 0; j < sub_str_prefix.size(); j++) { + result.message() << ' '; + } + + result.message() << '~'; // places the first tilde at the current char that mismatches + + for( std::size_t k = 1; k < (std::max)(best_pattern_start_index, best_stream_start_index); k++ ) { // 1 is for the current char c + std::string s1(pretty_print_log(std::string(1, last_elements_ordered[(std::min)(k, best_pattern_start_index)]))); + std::string s2(pretty_print_log(std::string(1, sub_str_suffix[(std::min)(k, best_stream_start_index)]))); + for( int h = (std::max)(s1.size(), s2.size()); h > 0; h--) + result.message() << "~"; + } + + if( m_pimpl->m_pattern.eof() ) { + result.message() << " (reference string shorter than current stream)"; + } + + result.message() << "\n"; + + // no need to continue if the EOF is reached + if( m_pimpl->m_pattern.eof() ) { + break; + } + + // first char is a replicat of c, so we do not copy it. + for(std::string::size_type counter = 0; counter < last_elements_ordered.size() - 1 ; counter++) + last_elements[ (i + 1 + counter) % last_elements.size() ] = last_elements_ordered[counter + 1]; + + i += last_elements_ordered.size()-1; + offset += best_stream_start_index - best_pattern_start_index; + + } + + } + + // not needed anymore + /* + if(offset > 0 && false) { + m_pimpl->m_pattern.ignore( + static_cast( offset )); + } + */ + } + else { + m_pimpl->m_pattern.write( stream_string_repr.c_str(), + static_cast( stream_string_repr.length() ) ); + m_pimpl->m_pattern.flush(); + } + } + + if( flush_stream ) + flush(); + + return result; +} + +//____________________________________________________________________________// + +void +output_test_stream::flush() +{ + m_pimpl->m_synced_string.erase(); + +#ifndef BOOST_NO_STRINGSTREAM + str( std::string() ); +#else + seekp( 0, std::ios::beg ); +#endif +} + + +std::string +output_test_stream::get_stream_string_representation() const { + return m_pimpl->m_synced_string; +} + +//____________________________________________________________________________// + +std::size_t +output_test_stream::length() +{ + sync(); + + return m_pimpl->m_synced_string.length(); +} + +//____________________________________________________________________________// + +void +output_test_stream::sync() +{ +#ifdef BOOST_NO_STRINGSTREAM + m_pimpl->m_synced_string.assign( str(), pcount() ); + freeze( false ); +#else + m_pimpl->m_synced_string = str(); +#endif +} + +//____________________________________________________________________________// + +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TEST_TOOLS_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/test_tree.ipp b/libraries/boost/include/boost/test/impl/test_tree.ipp new file mode 100644 index 0000000000..e0839e3dd1 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/test_tree.ipp @@ -0,0 +1,504 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Provides core implementation for Unit Test Framework. +/// Extensions can be provided in separate files +// *************************************************************************** + +#ifndef BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER +#define BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER + +// Boost.Test +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include + +// Boost +#include + +// STL +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** test_unit ************** // +// ************************************************************************** // + +test_unit::test_unit( const_string name, const_string file_name, std::size_t line_num, test_unit_type t ) +: p_type( t ) +, p_type_name( t == TUT_CASE ? "case" : "suite" ) +, p_file_name( file_name ) +, p_line_num( line_num ) +, p_id( INV_TEST_UNIT_ID ) +, p_parent_id( INV_TEST_UNIT_ID ) +, p_name( std::string( name.begin(), name.size() ) ) +, p_timeout( 0 ) +, p_expected_failures( 0 ) +, p_default_status( RS_INHERIT ) +, p_run_status( RS_INVALID ) +, p_sibling_rank(0) +{ +} + +//____________________________________________________________________________// + +test_unit::test_unit( const_string module_name ) +: p_type( TUT_SUITE ) +, p_type_name( "module" ) +, p_line_num( 0 ) +, p_id( INV_TEST_UNIT_ID ) +, p_parent_id( INV_TEST_UNIT_ID ) +, p_name( std::string( module_name.begin(), module_name.size() ) ) +, p_timeout( 0 ) +, p_expected_failures( 0 ) +, p_default_status( RS_INHERIT ) +, p_run_status( RS_INVALID ) +, p_sibling_rank(0) +{ +} + +//____________________________________________________________________________// + +test_unit::~test_unit() +{ + framework::deregister_test_unit( this ); +} + +//____________________________________________________________________________// + +void +test_unit::depends_on( test_unit* tu ) +{ + BOOST_TEST_SETUP_ASSERT( p_id != framework::master_test_suite().p_id, + "Can't add dependency to the master test suite" ); + + p_dependencies.value.push_back( tu->p_id ); +} + +//____________________________________________________________________________// + +void +test_unit::add_precondition( precondition_t const& pc ) +{ + p_preconditions.value.push_back( pc ); +} + +//____________________________________________________________________________// + +test_tools::assertion_result +test_unit::check_preconditions() const +{ + BOOST_TEST_FOREACH( test_unit_id, dep_id, p_dependencies.get() ) { + test_unit const& dep = framework::get( dep_id, TUT_ANY ); + + if( !dep.is_enabled() ) { + test_tools::assertion_result res(false); + res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << "\" is disabled"; + return res; + } + + test_results const& test_rslt = unit_test::results_collector.results( dep_id ); + if( !test_rslt.passed() ) { + test_tools::assertion_result res(false); + res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << "\" has failed"; + return res; + } + + if( test_rslt.p_test_cases_skipped > 0 ) { + test_tools::assertion_result res(false); + res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << "\" has skipped test cases"; + return res; + } + } + + BOOST_TEST_FOREACH( precondition_t, precondition, p_preconditions.get() ) { + test_tools::assertion_result res = precondition( p_id ); + if( !res ) { + test_tools::assertion_result res_out(false); + res_out.message() << "precondition failed"; + if( !res.has_empty_message() ) + res_out.message() << ": " << res.message(); + return res_out; + } + } + + return true; +} + +//____________________________________________________________________________// + +void +test_unit::increase_exp_fail( counter_t num ) +{ + p_expected_failures.value += num; + + if( p_parent_id != INV_TEST_UNIT_ID ) + framework::get( p_parent_id ).increase_exp_fail( num ); +} + +//____________________________________________________________________________// + +std::string +test_unit::full_name() const +{ + if( p_parent_id == INV_TEST_UNIT_ID || p_parent_id == framework::master_test_suite().p_id ) + return p_name; + + std::string res = framework::get( p_parent_id ).full_name(); + res.append("/"); + + res.append( p_name ); + + return res; +} + +//____________________________________________________________________________// + +void +test_unit::add_label( const_string l ) +{ + p_labels.value.push_back( std::string() + l ); +} + +//____________________________________________________________________________// + +bool +test_unit::has_label( const_string l ) const +{ + return std::find( p_labels->begin(), p_labels->end(), l ) != p_labels->end(); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** test_case ************** // +// ************************************************************************** // + +test_case::test_case( const_string name, boost::function const& test_func ) +: test_unit( name, "", 0, static_cast(type) ) +, p_test_func( test_func ) +{ + framework::register_test_unit( this ); +} + +//____________________________________________________________________________// + +test_case::test_case( const_string name, const_string file_name, std::size_t line_num, boost::function const& test_func ) +: test_unit( name, file_name, line_num, static_cast(type) ) +, p_test_func( test_func ) +{ + framework::register_test_unit( this ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** test_suite ************** // +// ************************************************************************** // + +//____________________________________________________________________________// + +test_suite::test_suite( const_string name, const_string file_name, std::size_t line_num ) +: test_unit( ut_detail::normalize_test_case_name( name ), file_name, line_num, static_cast(type) ) +{ + framework::register_test_unit( this ); +} + +//____________________________________________________________________________// + +test_suite::test_suite( const_string module_name ) +: test_unit( module_name ) +{ + framework::register_test_unit( this ); +} + +//____________________________________________________________________________// + +void +test_suite::add( test_unit* tu, counter_t expected_failures, unsigned timeout ) +{ + // check for clashing names #12597 + for( test_unit_id_list::const_iterator it(m_children.begin()), ite(m_children.end()); + it < ite; + ++it) { + BOOST_TEST_SETUP_ASSERT( tu->p_name != framework::get(*it, TUT_ANY).p_name, + "test unit with name '" + tu->p_name.value + std::string("' registered multiple times") ); + } + + tu->p_timeout.value = timeout; + + m_children.push_back( tu->p_id ); + tu->p_parent_id.value = p_id; + + if( tu->p_expected_failures != 0 ) + increase_exp_fail( tu->p_expected_failures ); + + if( expected_failures ) + tu->increase_exp_fail( expected_failures ); +} + +//____________________________________________________________________________// + +void +test_suite::add( test_unit_generator const& gen, unsigned timeout ) +{ + test_unit* tu; + while((tu = gen.next()) != 0) + add( tu, 0, timeout ); +} + +//____________________________________________________________________________// + +void +test_suite::add( test_unit_generator const& gen, decorator::collector& decorators ) +{ + test_unit* tu; + while((tu = gen.next()) != 0) { + decorators.store_in( *tu ); + add( tu, 0 ); + } + + decorators.reset(); +} + +//____________________________________________________________________________// + +void +test_suite::remove( test_unit_id id ) +{ + test_unit_id_list::iterator it = std::find( m_children.begin(), m_children.end(), id ); + + if( it != m_children.end() ) + m_children.erase( it ); +} + +//____________________________________________________________________________// + +test_unit_id +test_suite::get( const_string tu_name ) const +{ + BOOST_TEST_FOREACH( test_unit_id, id, m_children ) { + if( tu_name == framework::get( id, ut_detail::test_id_2_unit_type( id ) ).p_name.get() ) + return id; + } + + return INV_TEST_UNIT_ID; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** master_test_suite ************** // +// ************************************************************************** // + +master_test_suite_t::master_test_suite_t() +: test_suite( "Master Test Suite" ) +, argc( 0 ) +, argv( 0 ) +{ + p_default_status.value = RS_ENABLED; +} + +// ************************************************************************** // +// ************** traverse_test_tree ************** // +// ************************************************************************** // + +void +traverse_test_tree( test_case const& tc, test_tree_visitor& V, bool ignore_status ) +{ + if( tc.is_enabled() || ignore_status ) + V.visit( tc ); +} + +//____________________________________________________________________________// + +void +traverse_test_tree( test_suite const& suite, test_tree_visitor& V, bool ignore_status ) +{ + // skip disabled test suite unless we asked to ignore this condition + if( !ignore_status && !suite.is_enabled() ) + return; + + // Invoke test_suite_start callback + if( !V.test_suite_start( suite ) ) + return; + + // Recurse into children + std::size_t total_children = suite.m_children.size(); + for( std::size_t i=0; i < total_children; ) { + // this statement can remove the test unit from this list + traverse_test_tree( suite.m_children[i], V, ignore_status ); + if( total_children > suite.m_children.size() ) + total_children = suite.m_children.size(); + else + ++i; + } + + // Invoke test_suite_finish callback + V.test_suite_finish( suite ); +} + +//____________________________________________________________________________// + +void +traverse_test_tree( test_unit_id id, test_tree_visitor& V, bool ignore_status ) +{ + if( ut_detail::test_id_2_unit_type( id ) == TUT_CASE ) + traverse_test_tree( framework::get( id ), V, ignore_status ); + else + traverse_test_tree( framework::get( id ), V, ignore_status ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** object generators ************** // +// ************************************************************************** // + +namespace ut_detail { + +std::string +normalize_test_case_name( const_string name ) +{ + std::string norm_name( name.begin(), name.size() ); + + if( name[0] == '&' ) + norm_name = norm_name.substr( 1 ); + + // trim spaces + std::size_t first_not_space = norm_name.find_first_not_of(' '); + if( first_not_space ) { + norm_name.erase(0, first_not_space); + } + + std::size_t last_not_space = norm_name.find_last_not_of(' '); + if( last_not_space !=std::string::npos ) { + norm_name.erase(last_not_space + 1); + } + + // sanitize all chars that might be used in runtime filters + static const char to_replace[] = { ':', '*', '@', '+', '!', '/' }; + for(std::size_t index = 0; + index < sizeof(to_replace)/sizeof(to_replace[0]); + index++) { + std::replace(norm_name.begin(), norm_name.end(), to_replace[index], '_'); + } + + return norm_name; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** auto_test_unit_registrar ************** // +// ************************************************************************** // + +auto_test_unit_registrar::auto_test_unit_registrar( test_case* tc, decorator::collector& decorators, counter_t exp_fail ) +{ + framework::current_auto_test_suite().add( tc, exp_fail ); + + decorators.store_in( *tc ); + decorators.reset(); +} + +//____________________________________________________________________________// + +auto_test_unit_registrar::auto_test_unit_registrar( const_string ts_name, const_string ts_file, std::size_t ts_line, decorator::collector& decorators ) +{ + test_unit_id id = framework::current_auto_test_suite().get( ts_name ); + + test_suite* ts; + + if( id != INV_TEST_UNIT_ID ) { + ts = &framework::get( id ); + BOOST_ASSERT( ts->p_parent_id == framework::current_auto_test_suite().p_id ); + } + else { + ts = new test_suite( ts_name, ts_file, ts_line ); + framework::current_auto_test_suite().add( ts ); + } + + decorators.store_in( *ts ); + decorators.reset(); + + framework::current_auto_test_suite( ts ); +} + +//____________________________________________________________________________// + +auto_test_unit_registrar::auto_test_unit_registrar( test_unit_generator const& tc_gen, decorator::collector& decorators ) +{ + framework::current_auto_test_suite().add( tc_gen, decorators ); +} + +//____________________________________________________________________________// + +auto_test_unit_registrar::auto_test_unit_registrar( int ) +{ + framework::current_auto_test_suite( 0, false ); +} + +//____________________________________________________________________________// + +} // namespace ut_detail + +// ************************************************************************** // +// ************** global_fixture ************** // +// ************************************************************************** // + +global_fixture::global_fixture() +{ + framework::register_global_fixture( *this ); +} + +global_fixture::~global_fixture() +{ + framework::deregister_global_fixture( *this ); +} + +// ************************************************************************** // +// ************** global_configuration ************** // +// ************************************************************************** // + +global_configuration::global_configuration() +{ + framework::register_observer( *this ); +} + +global_configuration::~global_configuration() +{ + framework::deregister_observer( *this ); +} + +//____________________________________________________________________________// + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/unit_test_log.ipp b/libraries/boost/include/boost/test/impl/unit_test_log.ipp new file mode 100644 index 0000000000..2a6c0f4bc6 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/unit_test_log.ipp @@ -0,0 +1,691 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : implemets Unit Test Log +// *************************************************************************** + +#ifndef BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER +#define BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER + +// Boost.Test +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +// Boost +#include +#include +typedef ::boost::io::ios_base_all_saver io_saver_type; + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** entry_value_collector ************** // +// ************************************************************************** // + +namespace ut_detail { + +entry_value_collector const& +entry_value_collector::operator<<( lazy_ostream const& v ) const +{ + unit_test_log << v; + + return *this; +} + +//____________________________________________________________________________// + +entry_value_collector const& +entry_value_collector::operator<<( const_string v ) const +{ + unit_test_log << v; + + return *this; +} + +//____________________________________________________________________________// + +entry_value_collector::~entry_value_collector() +{ + if( m_last ) + unit_test_log << log::end(); +} + +//____________________________________________________________________________// + +} // namespace ut_detail + +// ************************************************************************** // +// ************** unit_test_log ************** // +// ************************************************************************** // + +namespace { + +// log data +struct unit_test_log_data_helper_impl { + typedef boost::shared_ptr formatter_ptr; + typedef boost::shared_ptr saver_ptr; + + bool m_enabled; + output_format m_format; + std::ostream* m_stream; + saver_ptr m_stream_state_saver; + formatter_ptr m_log_formatter; + bool m_entry_in_progress; + + unit_test_log_data_helper_impl(unit_test_log_formatter* p_log_formatter, output_format format, bool enabled = false) + : m_enabled( enabled ) + , m_format( format ) + , m_stream( &std::cout ) + , m_stream_state_saver( new io_saver_type( std::cout ) ) + , m_log_formatter() + , m_entry_in_progress( false ) + { + m_log_formatter.reset(p_log_formatter); + m_log_formatter->set_log_level(log_all_errors); + } + + // helper functions + std::ostream& stream() + { + return *m_stream; + } + + log_level get_log_level() const + { + return m_log_formatter->get_log_level(); + } +}; + +struct unit_test_log_impl { + // Constructor + unit_test_log_impl() + { + m_log_formatter_data.push_back( unit_test_log_data_helper_impl(new output::compiler_log_formatter, OF_CLF, true) ); // only this one is active by default, + m_log_formatter_data.push_back( unit_test_log_data_helper_impl(new output::xml_log_formatter, OF_XML, false) ); + m_log_formatter_data.push_back( unit_test_log_data_helper_impl(new output::junit_log_formatter, OF_JUNIT, false) ); + } + + typedef std::vector v_formatter_data_t; + v_formatter_data_t m_log_formatter_data; + + // entry data + log_entry_data m_entry_data; + + bool has_entry_in_progress() const { + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl const&, current_logger_data, m_log_formatter_data ) { + if( current_logger_data.m_entry_in_progress ) + return true; + } + return false; + } + + // check point data + log_checkpoint_data m_checkpoint_data; + + void set_checkpoint( const_string file, std::size_t line_num, const_string msg ) + { + assign_op( m_checkpoint_data.m_message, msg, 0 ); + m_checkpoint_data.m_file_name = file; + m_checkpoint_data.m_line_num = line_num; + } +}; + +unit_test_log_impl& s_log_impl() { static unit_test_log_impl the_inst; return the_inst; } + +} // local namespace + +//____________________________________________________________________________// + +void +unit_test_log_t::test_start( counter_t test_cases_amount ) +{ + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( !current_logger_data.m_enabled || current_logger_data.get_log_level() == log_nothing ) + continue; + + current_logger_data.m_log_formatter->log_start( current_logger_data.stream(), test_cases_amount ); + + if( runtime_config::get( runtime_config::btrt_build_info ) ) + current_logger_data.m_log_formatter->log_build_info( current_logger_data.stream() ); + + //current_logger_data.stream().flush(); + + current_logger_data.m_entry_in_progress = false; + } +} + +//____________________________________________________________________________// + +void +unit_test_log_t::test_finish() +{ + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( !current_logger_data.m_enabled || current_logger_data.get_log_level() == log_nothing ) + continue; + + current_logger_data.m_log_formatter->log_finish( current_logger_data.stream() ); + + current_logger_data.stream().flush(); + } +} + +//____________________________________________________________________________// + +void +unit_test_log_t::test_aborted() +{ + BOOST_TEST_LOG_ENTRY( log_messages ) << "Test is aborted"; +} + +//____________________________________________________________________________// + +void +unit_test_log_t::test_unit_start( test_unit const& tu ) +{ + if( s_log_impl().has_entry_in_progress() ) + *this << log::end(); + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) + continue; + current_logger_data.m_log_formatter->test_unit_start( current_logger_data.stream(), tu ); + } +} + +//____________________________________________________________________________// + +void +unit_test_log_t::test_unit_finish( test_unit const& tu, unsigned long elapsed ) +{ + s_log_impl().m_checkpoint_data.clear(); + + if( s_log_impl().has_entry_in_progress() ) + *this << log::end(); + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + + if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) + continue; + + current_logger_data.m_log_formatter->test_unit_finish( current_logger_data.stream(), tu, elapsed ); + } +} + +//____________________________________________________________________________// + +void +unit_test_log_t::test_unit_skipped( test_unit const& tu, const_string reason ) +{ + if( s_log_impl().has_entry_in_progress() ) + *this << log::end(); + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) + continue; + + current_logger_data.m_log_formatter->test_unit_skipped( current_logger_data.stream(), tu, reason ); + } +} + +void +unit_test_log_t::test_unit_aborted( test_unit const& tu ) +{ + if( s_log_impl().has_entry_in_progress() ) + *this << log::end(); + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) + continue; + + current_logger_data.m_log_formatter->test_unit_aborted(current_logger_data.stream(), tu ); + } +} + +//____________________________________________________________________________// + +void +unit_test_log_t::exception_caught( execution_exception const& ex ) +{ + log_level l = + ex.code() <= execution_exception::cpp_exception_error ? log_cpp_exception_errors : + (ex.code() <= execution_exception::timeout_error ? log_system_errors + : log_fatal_errors ); + + if( s_log_impl().has_entry_in_progress() ) + *this << log::end(); + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + + if( current_logger_data.m_enabled && l >= current_logger_data.get_log_level() ) { + + current_logger_data.m_log_formatter->log_exception_start( current_logger_data.stream(), s_log_impl().m_checkpoint_data, ex ); + + log_entry_context( l ); + + current_logger_data.m_log_formatter->log_exception_finish( current_logger_data.stream() ); + } + } + clear_entry_context(); +} + +//____________________________________________________________________________// + +void +unit_test_log_t::set_checkpoint( const_string file, std::size_t line_num, const_string msg ) +{ + s_log_impl().set_checkpoint( file, line_num, msg ); +} + +//____________________________________________________________________________// + +char +set_unix_slash( char in ) +{ + return in == '\\' ? '/' : in; +} + +unit_test_log_t& +unit_test_log_t::operator<<( log::begin const& b ) +{ + if( s_log_impl().has_entry_in_progress() ) + *this << log::end(); + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_enabled ) { + current_logger_data.m_stream_state_saver->restore(); + } + } + + s_log_impl().m_entry_data.clear(); + + assign_op( s_log_impl().m_entry_data.m_file_name, b.m_file_name, 0 ); + + // normalize file name + std::transform( s_log_impl().m_entry_data.m_file_name.begin(), s_log_impl().m_entry_data.m_file_name.end(), + s_log_impl().m_entry_data.m_file_name.begin(), + &set_unix_slash ); + + s_log_impl().m_entry_data.m_line_num = b.m_line_num; + + return *this; +} + +//____________________________________________________________________________// + +unit_test_log_t& +unit_test_log_t::operator<<( log::end const& ) +{ + if( s_log_impl().has_entry_in_progress() ) { + log_entry_context( s_log_impl().m_entry_data.m_level ); + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_enabled && current_logger_data.m_entry_in_progress ) { + current_logger_data.m_log_formatter->log_entry_finish( current_logger_data.stream() ); + } + current_logger_data.m_entry_in_progress = false; + } + } + + clear_entry_context(); + + return *this; +} + +//____________________________________________________________________________// + +unit_test_log_t& +unit_test_log_t::operator<<( log_level l ) +{ + s_log_impl().m_entry_data.m_level = l; + + return *this; +} + +//____________________________________________________________________________// + +ut_detail::entry_value_collector +unit_test_log_t::operator()( log_level l ) +{ + *this << l; + + return ut_detail::entry_value_collector(); +} + +//____________________________________________________________________________// + +bool +unit_test_log_t::log_entry_start(output_format log_format) +{ + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + + if( current_logger_data.m_format != log_format ) + continue; + + if( current_logger_data.m_entry_in_progress ) + return true; + + if( !current_logger_data.m_enabled ) + return false; + + switch( s_log_impl().m_entry_data.m_level ) { + case log_successful_tests: + current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_INFO ); + break; + case log_messages: + current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_MESSAGE ); + break; + case log_warnings: + current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_WARNING ); + break; + case log_all_errors: + case log_cpp_exception_errors: + case log_system_errors: + current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_ERROR ); + break; + case log_fatal_errors: + current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR ); + break; + case log_nothing: + case log_test_units: + case invalid_log_level: + return false; + } + + current_logger_data.m_entry_in_progress = true; + return true; + } + + return false; +} + +//____________________________________________________________________________// + +unit_test_log_t& +unit_test_log_t::operator<<( const_string value ) +{ + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_enabled && s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() && !value.empty() && log_entry_start(current_logger_data.m_format) ) + current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value ); + + } + return *this; +} + +//____________________________________________________________________________// + +unit_test_log_t& +unit_test_log_t::operator<<( lazy_ostream const& value ) +{ + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_enabled && s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() && !value.empty() ) { + if( log_entry_start(current_logger_data.m_format) ) { + current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value ); + } + } + } + return *this; +} + +//____________________________________________________________________________// + +void +unit_test_log_t::log_entry_context( log_level l ) +{ + framework::context_generator const& context = framework::get_context(); + if( context.is_empty() ) + return; + + const_string frame; + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_enabled ) { + current_logger_data.m_log_formatter->entry_context_start( current_logger_data.stream(), l ); + } + } + + while( !(frame=context.next()).is_empty() ) + { + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_enabled ) { + current_logger_data.m_log_formatter->log_entry_context( current_logger_data.stream(), l, frame ); + } + } + } + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_enabled ) { + current_logger_data.m_log_formatter->entry_context_finish( current_logger_data.stream(), l ); + } + } +} + +//____________________________________________________________________________// + +void +unit_test_log_t::clear_entry_context() +{ + framework::clear_context(); +} + +//____________________________________________________________________________// + +void +unit_test_log_t::set_stream( std::ostream& str ) +{ + if( s_log_impl().has_entry_in_progress() ) + return; + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + current_logger_data.m_stream = &str; + current_logger_data.m_stream_state_saver.reset( new io_saver_type( str ) ); + } +} + +//____________________________________________________________________________// + +void +unit_test_log_t::set_stream( output_format log_format, std::ostream& str ) +{ + if( s_log_impl().has_entry_in_progress() ) + return; + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_format == log_format) { + current_logger_data.m_stream = &str; + current_logger_data.m_stream_state_saver.reset( new io_saver_type( str ) ); + break; + } + } +} + +std::ostream* +unit_test_log_t::get_stream( output_format log_format ) const +{ + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_format == log_format) { + return current_logger_data.m_stream; + } + } + return 0; +} + +//____________________________________________________________________________// + +void +unit_test_log_t::set_threshold_level( log_level lev ) +{ + if( s_log_impl().has_entry_in_progress() || lev == invalid_log_level ) + return; + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + current_logger_data.m_log_formatter->set_log_level( lev ); + } +} + +//____________________________________________________________________________// + +void +unit_test_log_t::set_threshold_level( output_format log_format, log_level lev ) +{ + if( s_log_impl().has_entry_in_progress() || lev == invalid_log_level ) + return; + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_format == log_format) { + current_logger_data.m_log_formatter->set_log_level( lev ); + break; + } + } +} + +//____________________________________________________________________________// + +void +unit_test_log_t::set_format( output_format log_format ) +{ + if( s_log_impl().has_entry_in_progress() ) + return; + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + current_logger_data.m_enabled = current_logger_data.m_format == log_format; + } +} + +//____________________________________________________________________________// + +void +unit_test_log_t::add_format( output_format log_format ) +{ + if( s_log_impl().has_entry_in_progress() ) + return; + + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_format == log_format) { + current_logger_data.m_enabled = true; + break; + } + } +} + +//____________________________________________________________________________// + +unit_test_log_formatter* +unit_test_log_t::get_formatter( output_format log_format ) { + BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + if( current_logger_data.m_format == log_format) { + return current_logger_data.m_log_formatter.get(); + } + } + return 0; +} + + +void +unit_test_log_t::add_formatter( unit_test_log_formatter* the_formatter ) +{ + // remove only user defined logger + for(unit_test_log_impl::v_formatter_data_t::iterator it(s_log_impl().m_log_formatter_data.begin()), + ite(s_log_impl().m_log_formatter_data.end()); + it != ite; + ++it) + { + if( it->m_format == OF_CUSTOM_LOGGER) { + s_log_impl().m_log_formatter_data.erase(it); + break; + } + } + + if( the_formatter ) { + s_log_impl().m_log_formatter_data.push_back( unit_test_log_data_helper_impl(the_formatter, OF_CUSTOM_LOGGER, true) ); + } +} + +void +unit_test_log_t::set_formatter( unit_test_log_formatter* the_formatter ) +{ + // remove only user defined logger + log_level current_level = invalid_log_level; + std::ostream *current_stream = 0; + output_format previous_format = OF_INVALID; + for(unit_test_log_impl::v_formatter_data_t::iterator it(s_log_impl().m_log_formatter_data.begin()), + ite(s_log_impl().m_log_formatter_data.end()); + it != ite; + ++it) + { + if( it->m_enabled ) { + if( current_level == invalid_log_level || it->m_format < previous_format || it->m_format == OF_CUSTOM_LOGGER) { + current_level = it->get_log_level(); + current_stream = &(it->stream()); + previous_format = it->m_format; + } + } + } + + if( the_formatter ) { + add_formatter(the_formatter); + set_format(OF_CUSTOM_LOGGER); + set_threshold_level(OF_CUSTOM_LOGGER, current_level); + set_stream(OF_CUSTOM_LOGGER, *current_stream); + } +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** unit_test_log_formatter ************** // +// ************************************************************************** // + +void +unit_test_log_formatter::log_entry_value( std::ostream& ostr, lazy_ostream const& value ) +{ + log_entry_value( ostr, (wrap_stringstream().ref() << value).str() ); +} + +void +unit_test_log_formatter::set_log_level(log_level new_log_level) +{ + m_log_level = new_log_level; +} + +log_level +unit_test_log_formatter::get_log_level() const +{ + return m_log_level; +} + +//____________________________________________________________________________// + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER + diff --git a/libraries/boost/include/boost/test/impl/unit_test_main.ipp b/libraries/boost/include/boost/test/impl/unit_test_main.ipp new file mode 100644 index 0000000000..1780c6b93b --- /dev/null +++ b/libraries/boost/include/boost/test/impl/unit_test_main.ipp @@ -0,0 +1,293 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : main function implementation for Unit Test Framework +// *************************************************************************** + +#ifndef BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER +#define BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER + +// Boost.Test +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +// Boost +#include + +// STL +#include +#include +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +namespace ut_detail { + +// ************************************************************************** // +// ************** hrf_content_reporter ************** // +// ************************************************************************** // + +struct hrf_content_reporter : test_tree_visitor { + explicit hrf_content_reporter( std::ostream& os ) : m_os( os ), m_indent( -4 ) {} // skip master test suite + +private: + void report_test_unit( test_unit const& tu ) + { + m_os << std::setw( m_indent ) << "" << tu.p_name; + m_os << (tu.p_default_status == test_unit::RS_ENABLED ? "*" : " "); + //m_os << '[' << tu.p_sibling_rank << ']'; + if( !tu.p_description->empty() ) + m_os << ": " << tu.p_description; + + m_os << "\n"; + } + virtual void visit( test_case const& tc ) { report_test_unit( tc ); } + virtual bool test_suite_start( test_suite const& ts ) + { + if( m_indent >= 0 ) + report_test_unit( ts ); + m_indent += 4; + return true; + } + virtual void test_suite_finish( test_suite const& ) + { + m_indent -= 4; + } + + // Data members + std::ostream& m_os; + int m_indent; +}; + +// ************************************************************************** // +// ************** dot_content_reporter ************** // +// ************************************************************************** // + +struct dot_content_reporter : test_tree_visitor { + explicit dot_content_reporter( std::ostream& os ) : m_os( os ) {} + +private: + void report_test_unit( test_unit const& tu ) + { + bool master_ts = tu.p_parent_id == INV_TEST_UNIT_ID; + + m_os << "tu" << tu.p_id; + + m_os << (master_ts ? "[shape=ellipse,peripheries=2" : "[shape=Mrecord" ); + + m_os << ",fontname=Helvetica"; + + m_os << (tu.p_default_status == test_unit::RS_ENABLED ? ",color=green" : ",color=yellow"); + + if( master_ts ) + m_os << ",label=\"" << tu.p_name << "\"];\n"; + else { + m_os << ",label=\"" << tu.p_name << "|" << tu.p_file_name << "(" << tu.p_line_num << ")"; + if( tu.p_timeout > 0 ) + m_os << "|timeout=" << tu.p_timeout; + if( tu.p_expected_failures != 0 ) + m_os << "|expected failures=" << tu.p_expected_failures; + if( !tu.p_labels->empty() ) { + m_os << "|labels:"; + + BOOST_TEST_FOREACH( std::string const&, l, tu.p_labels.get() ) + m_os << " @" << l; + } + m_os << "\"];\n"; + } + + if( !master_ts ) + m_os << "tu" << tu.p_parent_id << " -> " << "tu" << tu.p_id << ";\n"; + + BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) { + test_unit const& dep = framework::get( dep_id, TUT_ANY ); + + m_os << "tu" << tu.p_id << " -> " << "tu" << dep.p_id << "[color=red,style=dotted,constraint=false];\n"; + } + + } + virtual void visit( test_case const& tc ) + { + report_test_unit( tc ); + } + virtual bool test_suite_start( test_suite const& ts ) + { + if( ts.p_parent_id == INV_TEST_UNIT_ID ) + m_os << "digraph G {rankdir=LR;\n"; + + report_test_unit( ts ); + + m_os << "{\n"; + + return true; + } + virtual void test_suite_finish( test_suite const& ts ) + { + m_os << "}\n"; + if( ts.p_parent_id == INV_TEST_UNIT_ID ) + m_os << "}\n"; + } + + std::ostream& m_os; +}; + +// ************************************************************************** // +// ************** labels_collector ************** // +// ************************************************************************** // + +struct labels_collector : test_tree_visitor { + std::set const& labels() const { return m_labels; } + +private: + virtual bool visit( test_unit const& tu ) + { + m_labels.insert( tu.p_labels->begin(), tu.p_labels->end() ); + return true; + } + + // Data members + std::set m_labels; +}; + +} // namespace ut_detail + +// ************************************************************************** // +// ************** unit_test_main ************** // +// ************************************************************************** // + +int BOOST_TEST_DECL +unit_test_main( init_unit_test_func init_func, int argc, char* argv[] ) +{ + int result_code = 0; + + BOOST_TEST_I_TRY { + framework::init( init_func, argc, argv ); + + if( runtime_config::get( runtime_config::btrt_wait_for_debugger ) ) { + results_reporter::get_stream() << "Press any key to continue..." << std::endl; + + // getchar is defined as a macro in uClibc. Use parenthesis to fix + // gcc bug 58952 for gcc <= 4.8.2. + (std::getchar)(); + results_reporter::get_stream() << "Continuing..." << std::endl; + } + + framework::finalize_setup_phase(); + + output_format list_cont = runtime_config::get( runtime_config::btrt_list_content ); + if( list_cont != unit_test::OF_INVALID ) { + if( list_cont == unit_test::OF_DOT ) { + ut_detail::dot_content_reporter reporter( results_reporter::get_stream() ); + + traverse_test_tree( framework::master_test_suite().p_id, reporter, true ); + } + else { + ut_detail::hrf_content_reporter reporter( results_reporter::get_stream() ); + + traverse_test_tree( framework::master_test_suite().p_id, reporter, true ); + } + + return boost::exit_success; + } + + if( runtime_config::get( runtime_config::btrt_list_labels ) ) { + ut_detail::labels_collector collector; + + traverse_test_tree( framework::master_test_suite().p_id, collector, true ); + + results_reporter::get_stream() << "Available labels:\n "; + std::copy( collector.labels().begin(), collector.labels().end(), + std::ostream_iterator( results_reporter::get_stream(), "\n " ) ); + results_reporter::get_stream() << "\n"; + + return boost::exit_success; + } + + framework::run(); + + result_code = !runtime_config::get( runtime_config::btrt_result_code ) + ? boost::exit_success + : results_collector.results( framework::master_test_suite().p_id ).result_code(); + } + BOOST_TEST_I_CATCH( framework::nothing_to_test, ex ) { + result_code = ex.m_result_code; + } + BOOST_TEST_I_CATCH( framework::internal_error, ex ) { + results_reporter::get_stream() << "Boost.Test framework internal error: " << ex.what() << std::endl; + + result_code = boost::exit_exception_failure; + } + BOOST_TEST_I_CATCH( framework::setup_error, ex ) { + results_reporter::get_stream() << "Test setup error: " << ex.what() << std::endl; + + result_code = boost::exit_exception_failure; + } + BOOST_TEST_I_CATCHALL() { + results_reporter::get_stream() << "Boost.Test framework internal error: unknown reason" << std::endl; + + result_code = boost::exit_exception_failure; + } + + framework::shutdown(); + + return result_code; +} + +} // namespace unit_test +} // namespace boost + +#if !defined(BOOST_TEST_DYN_LINK) && !defined(BOOST_TEST_NO_MAIN) + +// ************************************************************************** // +// ************** main function for tests using lib ************** // +// ************************************************************************** // + +int BOOST_TEST_CALL_DECL +main( int argc, char* argv[] ) +{ + // prototype for user's unit test init function +#ifdef BOOST_TEST_ALTERNATIVE_INIT_API + extern bool init_unit_test(); + + boost::unit_test::init_unit_test_func init_func = &init_unit_test; +#else + extern ::boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] ); + + boost::unit_test::init_unit_test_func init_func = &init_unit_test_suite; +#endif + + return ::boost::unit_test::unit_test_main( init_func, argc, argv ); +} + +#endif // !BOOST_TEST_DYN_LINK && !BOOST_TEST_NO_MAIN + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/unit_test_monitor.ipp b/libraries/boost/include/boost/test/impl/unit_test_monitor.ipp new file mode 100644 index 0000000000..cfb41a239c --- /dev/null +++ b/libraries/boost/include/boost/test/impl/unit_test_monitor.ipp @@ -0,0 +1,75 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : implements specific subclass of Executon Monitor used by Unit +// Test Framework to monitor test cases run. +// *************************************************************************** + +#ifndef BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER +#define BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER + +// Boost.Test +#include +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** unit_test_monitor ************** // +// ************************************************************************** // + +unit_test_monitor_t::error_level +unit_test_monitor_t::execute_and_translate( boost::function const& func, unsigned timeout ) +{ + BOOST_TEST_I_TRY { + p_catch_system_errors.value = runtime_config::get( runtime_config::btrt_catch_sys_errors ); + p_timeout.value = timeout; + p_auto_start_dbg.value = runtime_config::get( runtime_config::btrt_auto_start_dbg ); + p_use_alt_stack.value = runtime_config::get( runtime_config::btrt_use_alt_stack ); + p_detect_fp_exceptions.value = runtime_config::get( runtime_config::btrt_detect_fp_except ); + + vexecute( func ); + } + BOOST_TEST_I_CATCH( execution_exception, ex ) { + framework::exception_caught( ex ); + framework::test_unit_aborted( framework::current_test_unit() ); + + // translate execution_exception::error_code to error_level + switch( ex.code() ) { + case execution_exception::no_error: return test_ok; + case execution_exception::user_error: return unexpected_exception; + case execution_exception::cpp_exception_error: return unexpected_exception; + case execution_exception::system_error: return os_exception; + case execution_exception::timeout_error: return os_timeout; + case execution_exception::user_fatal_error: + case execution_exception::system_fatal_error: return fatal_error; + default: return unexpected_exception; + } + } + + return test_ok; +} + +//____________________________________________________________________________// + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/unit_test_parameters.ipp b/libraries/boost/include/boost/test/impl/unit_test_parameters.ipp new file mode 100644 index 0000000000..428c10116f --- /dev/null +++ b/libraries/boost/include/boost/test/impl/unit_test_parameters.ipp @@ -0,0 +1,772 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : simple implementation for Unit Test Framework parameter +// handling routines. May be rewritten in future to use some kind of +// command-line arguments parsing facility and environment variable handling +// facility +// *************************************************************************** + +#ifndef BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER +#define BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER + +// Boost.Test +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +// Boost.Runtime.Param +#include +#include +#include +#include +#include + +// Boost +#include +#include +#include +#include + +// STL +#include +#include +#include + +#include + +//____________________________________________________________________________// + +# ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::getenv; using ::strncmp; using ::strcmp; } +# endif + +namespace boost { +namespace unit_test { + +namespace rt = boost::runtime; + +// ************************************************************************** // +// ************** runtime_config ************** // +// ************************************************************************** // + +namespace runtime_config { + +// UTF parameters +std::string btrt_auto_start_dbg = "auto_start_dbg"; +std::string btrt_break_exec_path = "break_exec_path"; +std::string btrt_build_info = "build_info"; +std::string btrt_catch_sys_errors = "catch_system_errors"; +std::string btrt_color_output = "color_output"; +std::string btrt_detect_fp_except = "detect_fp_exceptions"; +std::string btrt_detect_mem_leaks = "detect_memory_leaks"; +std::string btrt_list_content = "list_content"; +std::string btrt_list_labels = "list_labels"; +std::string btrt_log_format = "log_format"; +std::string btrt_log_level = "log_level"; +std::string btrt_log_sink = "log_sink"; +std::string btrt_combined_logger = "logger"; +std::string btrt_output_format = "output_format"; +std::string btrt_random_seed = "random"; +std::string btrt_report_format = "report_format"; +std::string btrt_report_level = "report_level"; +std::string btrt_report_mem_leaks = "report_memory_leaks_to"; +std::string btrt_report_sink = "report_sink"; +std::string btrt_result_code = "result_code"; +std::string btrt_run_filters = "run_test"; +std::string btrt_save_test_pattern = "save_pattern"; +std::string btrt_show_progress = "show_progress"; +std::string btrt_use_alt_stack = "use_alt_stack"; +std::string btrt_wait_for_debugger = "wait_for_debugger"; + +std::string btrt_help = "help"; +std::string btrt_usage = "usage"; +std::string btrt_version = "version"; + +//____________________________________________________________________________// + +namespace { + +void +register_parameters( rt::parameters_store& store ) +{ + rt::option auto_start_dbg( btrt_auto_start_dbg, ( + rt::description = "Automatically attaches debugger in case of system level failure (signal).", + rt::env_var = "BOOST_TEST_AUTO_START_DBG", + + rt::help = "Specifies whether Boost.Test should attempt " + "to attach a debugger when fatal system error occurs. At the moment this feature " + "is only available on a few selected platforms: Win32 and *nix. There is a " + "default debugger configured for these platforms. You can manually configure " + "different debugger. For more details on how to configure the debugger see the " + "Boost.Test debug API, specifically the function boost::debug::set_debugger." + )); + + auto_start_dbg.add_cla_id( "--", btrt_auto_start_dbg, "=" ); + auto_start_dbg.add_cla_id( "-", "d", " " ); + store.add( auto_start_dbg ); + + /////////////////////////////////////////////// + + rt::parameter break_exec_path( btrt_break_exec_path, ( + rt::description = "For the exception safety testing allows to break at specific execution path.", + rt::env_var = "BOOST_TEST_BREAK_EXEC_PATH" +#ifndef BOOST_NO_CXX11_LAMBDAS + , + rt::callback = [](rt::cstring) { + BOOST_TEST_SETUP_ASSERT( false, "parameter break_exec_path is disabled in this release" ); + } +#endif + )); + + break_exec_path.add_cla_id( "--", btrt_break_exec_path, "=" ); + store.add( break_exec_path ); + + /////////////////////////////////////////////// + + rt::option build_info( btrt_build_info, ( + rt::description = "Displays library build information.", + rt::env_var = "BOOST_TEST_BUILD_INFO", + rt::help = "Displays library build information, including: platform, " + "compiler, STL version and Boost version." + )); + + build_info.add_cla_id( "--", btrt_build_info, "=" ); + build_info.add_cla_id( "-", "i", " " ); + store.add( build_info ); + + /////////////////////////////////////////////// + + rt::option catch_sys_errors( btrt_catch_sys_errors, ( + rt::description = "Allows to switch between catching and ignoring system errors (signals).", + rt::env_var = "BOOST_TEST_CATCH_SYSTEM_ERRORS", + rt::default_value = +#ifdef BOOST_TEST_DEFAULTS_TO_CORE_DUMP + false, +#else + true, +#endif + rt::help = "If option " + btrt_catch_sys_errors + " has value 'no' the frameworks does not attempt to catch " + "asynchronous system failure events (signals on *NIX platforms or structured exceptions on Windows). " + " Default value is " +#ifdef BOOST_TEST_DEFAULTS_TO_CORE_DUMP + "no." +#else + "true." +#endif + )); + + catch_sys_errors.add_cla_id( "--", btrt_catch_sys_errors, "=", true ); + catch_sys_errors.add_cla_id( "-", "s", " " ); + store.add( catch_sys_errors ); + + /////////////////////////////////////////////// + + rt::option color_output( btrt_color_output, ( + rt::description = "Enables color output of the framework log and report messages.", + rt::env_var = "BOOST_TEST_COLOR_OUTPUT", + rt::default_value = true, + rt::help = "Produces color output for logs, reports and help. " + "Defaults to true. " + )); + + color_output.add_cla_id( "--", btrt_color_output, "=", true ); + color_output.add_cla_id( "-", "x", " " ); + store.add( color_output ); + + /////////////////////////////////////////////// + + rt::option detect_fp_except( btrt_detect_fp_except, ( + rt::description = "Enables/disables floating point exceptions traps.", + rt::env_var = "BOOST_TEST_DETECT_FP_EXCEPTIONS", + rt::help = "Enables/disables hardware traps for the floating " + "point exceptions (if supported on your platfrom)." + )); + + detect_fp_except.add_cla_id( "--", btrt_detect_fp_except, "=", true ); + store.add( detect_fp_except ); + + /////////////////////////////////////////////// + + rt::parameter detect_mem_leaks( btrt_detect_mem_leaks, ( + rt::description = "Turns on/off memory leaks detection (optionally breaking on specified alloc order number).", + rt::env_var = "BOOST_TEST_DETECT_MEMORY_LEAK", + rt::default_value = 1L, + rt::optional_value = 1L, + rt::value_hint = "", + rt::help = "Enables/disables memory leaks detection. " + "This parameter has optional long integer value. The default value is 1, which " + "enables the memory leak detection. The value 0 disables memory leak detection. " + "Any value N greater than 1 is treated as leak allocation number and tells the " + "framework to setup runtime breakpoint at Nth heap allocation. If value is " + "omitted the default value is assumed." + )); + + detect_mem_leaks.add_cla_id( "--", btrt_detect_mem_leaks, "=" ); + store.add( detect_mem_leaks ); + + /////////////////////////////////////////////// + + rt::enum_parameter list_content( btrt_list_content, ( + rt::description = "Lists the content of test tree - names of all test suites and test cases.", + rt::env_var = "BOOST_TEST_LIST_CONTENT", + rt::default_value = OF_INVALID, + rt::optional_value = OF_CLF, + rt::enum_values::value = +#if defined(BOOST_TEST_CLA_NEW_API) + { + { "HRF", OF_CLF }, + { "DOT", OF_DOT } + }, +#else + rt::enum_values_list() + ( "HRF", OF_CLF ) + ( "DOT", OF_DOT ) + , +#endif + rt::help = "Lists the test suites and cases " + "of the test module instead of executing the test cases. The format of the " + "desired output can be passed to the command. Currently the " + "framework supports two formats: human readable format (HRF) and dot graph " + "format (DOT). If value is omitted HRF value is assumed." + )); + list_content.add_cla_id( "--", btrt_list_content, "=" ); + store.add( list_content ); + + /////////////////////////////////////////////// + + rt::option list_labels( btrt_list_labels, ( + rt::description = "Lists all available labels.", + rt::env_var = "BOOST_TEST_LIST_LABELS", + rt::help = "Option " + btrt_list_labels + " instructs the framework to list all the the labels " + "defined in the test module instead of executing the test cases." + )); + + list_labels.add_cla_id( "--", btrt_list_labels, "=" ); + store.add( list_labels ); + + /////////////////////////////////////////////// + + rt::enum_parameter log_format( btrt_log_format, ( + rt::description = "Specifies log format.", + rt::env_var = "BOOST_TEST_LOG_FORMAT", + rt::default_value = OF_CLF, + rt::enum_values::value = +#if defined(BOOST_TEST_CLA_NEW_API) + { + { "HRF", OF_CLF }, + { "CLF", OF_CLF }, + { "XML", OF_XML }, + { "JUNIT", OF_JUNIT }, + }, +#else + rt::enum_values_list() + ( "HRF", OF_CLF ) + ( "CLF", OF_CLF ) + ( "XML", OF_XML ) + ( "JUNIT", OF_JUNIT ) + , +#endif + rt::help = "Set the frameowrk's log format to one " + "of the formats supplied by the framework. The only acceptable values for this " + "parameter are the names of the output formats supplied by the framework. By " + "default the framework uses human readable format (HRF) for testing log. This " + "format is similar to compiler error format. Alternatively you can specify XML " + "or JUNIT as log format, which are easier to process by testing automation tools." + )); + + log_format.add_cla_id( "--", btrt_log_format, "=" ); + log_format.add_cla_id( "-", "f", " " ); + store.add( log_format ); + + /////////////////////////////////////////////// + + rt::enum_parameter log_level( btrt_log_level, ( + rt::description = "Specifies the logging level of the test execution.", + rt::env_var = "BOOST_TEST_LOG_LEVEL", + rt::default_value = log_all_errors, + rt::enum_values::value = +#if defined(BOOST_TEST_CLA_NEW_API) + { + { "all" , log_successful_tests }, + { "success" , log_successful_tests }, + { "test_suite" , log_test_units }, + { "unit_scope" , log_test_units }, + { "message" , log_messages }, + { "warning" , log_warnings }, + { "error" , log_all_errors }, + { "cpp_exception" , log_cpp_exception_errors }, + { "system_error" , log_system_errors }, + { "fatal_error" , log_fatal_errors }, + { "nothing" , log_nothing } + }, +#else + rt::enum_values_list() + ( "all" , log_successful_tests ) + ( "success" , log_successful_tests ) + ( "test_suite" , log_test_units ) + ( "unit_scope" , log_test_units ) + ( "message" , log_messages ) + ( "warning" , log_warnings ) + ( "error" , log_all_errors ) + ( "cpp_exception" , log_cpp_exception_errors ) + ( "system_error" , log_system_errors ) + ( "fatal_error" , log_fatal_errors ) + ( "nothing" , log_nothing ) + , +#endif + rt::help = "Set the framework's log level. " + "The log level defines the verbosity of the testing logs produced by a test " + "module. The verbosity ranges from a complete log, when all assertions " + "(both successful and failing) are reported, all notifications about " + "test units start and finish are included, to an empty log when nothing " + "is reported to a testing log stream." + )); + + log_level.add_cla_id( "--", btrt_log_level, "=" ); + log_level.add_cla_id( "-", "l", " " ); + store.add( log_level ); + + /////////////////////////////////////////////// + + rt::parameter log_sink( btrt_log_sink, ( + rt::description = "Specifies log sink: stdout (default), stderr or file name.", + rt::env_var = "BOOST_TEST_LOG_SINK", + rt::value_hint = "", + rt::help = "Sets the log sink - the location " + "where Boost.Test writes the logs of the test execution. it allows to easily redirect the " + "test logs to file or standard streams. By default testing log is " + "directed to standard output." + )); + + log_sink.add_cla_id( "--", btrt_log_sink, "=" ); + log_sink.add_cla_id( "-", "k", " " ); + store.add( log_sink ); + + /////////////////////////////////////////////// + + rt::enum_parameter output_format( btrt_output_format, ( + rt::description = "Specifies output format (both log and report).", + rt::env_var = "BOOST_TEST_OUTPUT_FORMAT", + rt::enum_values::value = +#if defined(BOOST_TEST_CLA_NEW_API) + { + { "HRF", OF_CLF }, + { "CLF", OF_CLF }, + { "XML", OF_XML } + }, +#else + rt::enum_values_list() + ( "HRF", OF_CLF ) + ( "CLF", OF_CLF ) + ( "XML", OF_XML ) + , +#endif + rt::help = "Combines an effect of " + btrt_report_format + + " and " + btrt_log_format + " parameters. This parameter has higher priority " + "than either one of them. In other words if this parameter is specified " + "it overrides the value of other two parameters. This parameter does not " + "have a default value. The only acceptable values are string names of " + "output formats: HRF - human readable format and XML - XML formats for " + "automation tools processing." + )); + + output_format.add_cla_id( "--", btrt_output_format, "=" ); + output_format.add_cla_id( "-", "o", " " ); + store.add( output_format ); + + /////////////////////////////////////////////// combined logger option + + rt::parameter combined_logger( btrt_combined_logger, ( + rt::description = "Specifies log level and sink for one or several log format", + rt::env_var = "BOOST_TEST_LOGGER", + rt::value_hint = "log_format,log_level,log_sink[:log_format,log_level,log_sink]", + rt::help = "Specify one or more logging definition, which include the logger type, level and sink. " + "The log format, level and sink follow the same format as for the argument '--" + btrt_log_format + + "', '--" + btrt_log_level + "' and '--" + btrt_log_sink + "' respetively. " + "This command can take several logging definition separated by a ':', or be repeated " + "on the command line." + )); + + combined_logger.add_cla_id( "--", btrt_combined_logger, "=" ); + store.add( combined_logger ); + + /////////////////////////////////////////////// + + rt::parameter random_seed( btrt_random_seed, ( + rt::description = "Allows to switch between sequential and random order of test units execution." + " Optionally allows to specify concrete seed for random number generator.", + rt::env_var = "BOOST_TEST_RANDOM", + rt::default_value = 0U, + rt::optional_value = 1U, + rt::value_hint = "", + rt::help = "Instructs the framework to execute the " + "test cases in random order. This parameter accepts an optional unsigned " + "integer argument. If parameter is specified without the argument value testing " + "order is randomized based on current time. Alternatively you can specify " + "any positive value greater than 1 and it will be used as random seed for " + "the run. " + "By default, the test cases are executed in an " + "order defined by their declaration and the optional dependencies among the test units." + )); + + random_seed.add_cla_id( "--", btrt_random_seed, "=" ); + store.add( random_seed ); + + /////////////////////////////////////////////// + + rt::enum_parameter report_format( btrt_report_format, ( + rt::description = "Specifies the test report format.", + rt::env_var = "BOOST_TEST_REPORT_FORMAT", + rt::default_value = OF_CLF, + rt::enum_values::value = +#if defined(BOOST_TEST_CLA_NEW_API) + { + { "HRF", OF_CLF }, + { "CLF", OF_CLF }, + { "XML", OF_XML } + }, +#else + rt::enum_values_list() + ( "HRF", OF_CLF ) + ( "CLF", OF_CLF ) + ( "XML", OF_XML ) + , +#endif + rt::help = "Set the framework's report format " + "to one of the formats supplied by the framework. The only acceptable values " + "for this parameter are the names of the output formats. By default the framework " + "uses human readable format (HRF) for results reporting. Alternatively you can " + "specify XML as report format. This format is easier to process by testing " + "automation tools." + )); + + report_format.add_cla_id( "--", btrt_report_format, "=" ); + report_format.add_cla_id( "-", "m", " " ); + store.add( report_format ); + + /////////////////////////////////////////////// + + rt::enum_parameter report_level( btrt_report_level, ( + rt::description = "Specifies test report level.", + rt::env_var = "BOOST_TEST_REPORT_LEVEL", + rt::default_value = CONFIRMATION_REPORT, + rt::enum_values::value = +#if defined(BOOST_TEST_CLA_NEW_API) + { + { "confirm", CONFIRMATION_REPORT }, + { "short", SHORT_REPORT }, + { "detailed", DETAILED_REPORT }, + { "no", NO_REPORT } + }, +#else + rt::enum_values_list() + ( "confirm", CONFIRMATION_REPORT ) + ( "short", SHORT_REPORT ) + ( "detailed", DETAILED_REPORT ) + ( "no", NO_REPORT ) + , +#endif + rt::help = "Set the verbosity level of the " + "result report generated by the testing framework. Use value 'no' to " + "disable the results report completely." + )); + + report_level.add_cla_id( "--", btrt_report_level, "=" ); + report_level.add_cla_id( "-", "r", " " ); + store.add( report_level ); + + /////////////////////////////////////////////// + + rt::parameter report_mem_leaks( btrt_report_mem_leaks, ( + rt::description = "File where to report memory leaks to.", + rt::env_var = "BOOST_TEST_REPORT_MEMORY_LEAKS_TO", + rt::default_value = std::string(), + rt::value_hint = "", + rt::help = "Parameter " + btrt_report_mem_leaks + " allows to specify a file where to report " + "memory leaks to. The parameter does not have default value. If it is not specified, " + "memory leaks (if any) are reported to the standard error stream." + )); + + report_mem_leaks.add_cla_id( "--", btrt_report_mem_leaks, "=" ); + store.add( report_mem_leaks ); + + /////////////////////////////////////////////// + + rt::parameter report_sink( btrt_report_sink, ( + rt::description = "Specifies report sink: stderr(default), stdout or file name.", + rt::env_var = "BOOST_TEST_REPORT_SINK", + rt::value_hint = "", + rt::help = "Sets the result report sink - " + "the location where the framework writes the result report to. " + "The sink may be a a file or a standard " + "stream. The default is 'stderr': the " + "standard error stream." + )); + + report_sink.add_cla_id( "--", btrt_report_sink, "=" ); + report_sink.add_cla_id( "-", "e", " " ); + store.add( report_sink ); + + /////////////////////////////////////////////// + + rt::option result_code( btrt_result_code, ( + rt::description = "Disables test modules's result code generation.", + rt::env_var = "BOOST_TEST_RESULT_CODE", + rt::default_value = true, + rt::help = "The 'no' argument value for the parameter " + btrt_result_code + " instructs the " + "framework to always return zero result code. This can be used for test programs " + "executed within IDE. By default this parameter has value 'yes'." + )); + + result_code.add_cla_id( "--", btrt_result_code, "=", true ); + result_code.add_cla_id( "-", "c", " " ); + store.add( result_code ); + + /////////////////////////////////////////////// + + rt::parameter tests_to_run( btrt_run_filters, ( + rt::description = "Filters which tests to execute.", + rt::env_var = "BOOST_TEST_RUN_FILTERS", + rt::value_hint = "", + rt::help = "Filters which test units to execute. " + "The framework supports both 'selection filters', which allow to select " + "which test units to enable from the set of available test units, and 'disabler " + "filters', which allow to disable some test units. Boost.test also supports " + "enabling/disabling test units at compile time. These settings identify the default " + "set of test units to run. Parameter " + btrt_run_filters + " is used to change this default. " + "This parameter is repeatable, so you can specify more than one filter if necessary." + )); + + tests_to_run.add_cla_id( "--", btrt_run_filters, "=" ); + tests_to_run.add_cla_id( "-", "t", " " ); + store.add( tests_to_run ); + + /////////////////////////////////////////////// + + rt::option save_test_pattern( btrt_save_test_pattern, ( + rt::description = "Allows to switch between saving or matching test pattern file.", + rt::env_var = "BOOST_TEST_SAVE_PATTERN", + rt::help = "Parameter " + btrt_save_test_pattern + " facilitates switching mode of operation for " + "testing output streams.\n\nThis parameter serves no particular purpose within the " + "framework itself. It can be used by test modules relying on output_test_stream to " + "implement testing logic. Default mode is 'match' (false)." + )); + + save_test_pattern.add_cla_id( "--", btrt_save_test_pattern, "=" ); + store.add( save_test_pattern ); + + /////////////////////////////////////////////// + + rt::option show_progress( btrt_show_progress, ( + rt::description = "Turns on progress display.", + rt::env_var = "BOOST_TEST_SHOW_PROGRESS", + rt::help = "Instructs the framework to display the progress of the tests. " + "This feature is turned off by default." + )); + + show_progress.add_cla_id( "--", btrt_show_progress, "=" ); + show_progress.add_cla_id( "-", "p", " " ); + store.add( show_progress ); + + /////////////////////////////////////////////// + + rt::option use_alt_stack( btrt_use_alt_stack, ( + rt::description = "Turns on/off usage of an alternative stack for signal handling.", + rt::env_var = "BOOST_TEST_USE_ALT_STACK", + rt::default_value = true, + rt::help = "Instructs the framework to use an alternative " + "stack for operating system's signals handling (on platforms where this is supported). " + "The feature is enabled by default, but can be disabled using this command line switch." + )); + + use_alt_stack.add_cla_id( "--", btrt_use_alt_stack, "=", true ); + store.add( use_alt_stack ); + + /////////////////////////////////////////////// + + rt::option wait_for_debugger( btrt_wait_for_debugger, ( + rt::description = "Forces test module to wait for button to be pressed before starting test run.", + rt::env_var = "BOOST_TEST_WAIT_FOR_DEBUGGER", + rt::help = "Instructs the framework to pause before starting " + "test units execution, so that you can attach a debugger to the test module process. " + "This feature is turned off by default." + )); + + wait_for_debugger.add_cla_id( "--", btrt_wait_for_debugger, "=" ); + wait_for_debugger.add_cla_id( "-", "w", " " ); + store.add( wait_for_debugger ); + + /////////////////////////////////////////////// + + rt::parameter help( btrt_help, ( + rt::description = "Help for framework parameters.", + rt::optional_value = std::string(), + rt::value_hint = "", + rt::help = "Displays help on the framework's parameters. " + "The parameter accepts an optional argument value. If present, an argument value is " + "interpreted as a parameter name (name guessing works as well, so for example " + "'--help=rand' displays help on the parameter 'random'). If the parameter name is unknown " + "or ambiguous error is reported. If argument value is absent, a summary of all " + "framework's parameter is displayed." + )); + help.add_cla_id( "--", btrt_help, "=" ); + store.add( help ); + + /////////////////////////////////////////////// + + rt::option usage( btrt_usage, ( + rt::description = "Short message explaining usage of Boost.Test parameters." + )); + usage.add_cla_id( "-", "?", " " ); + store.add( usage ); + + /////////////////////////////////////////////// + + rt::option version( btrt_version, ( + rt::description = "Prints Boost.Test version and exits." + )); + version.add_cla_id( "--", btrt_version, " " ); + store.add( version ); +} + +static rt::arguments_store s_arguments_store; +static rt::parameters_store s_parameters_store; + +//____________________________________________________________________________// + +} // local namespace + +void +init( int& argc, char** argv ) +{ + shared_ptr parser; + + BOOST_TEST_I_TRY { + // Initialize parameters list + if( s_parameters_store.is_empty() ) + register_parameters( s_parameters_store ); + + // Clear up arguments store just in case (of multiple init invocations) + s_arguments_store.clear(); + + // Parse CLA they take precedence over environment + parser.reset( new rt::cla::parser( s_parameters_store, (rt::end_of_params = "--", rt::negation_prefix = "no_") ) ); + argc = parser->parse( argc, argv, s_arguments_store ); + + // Try to fetch missing arguments from environment + rt::env::fetch_absent( s_parameters_store, s_arguments_store ); + + // Set arguments to default values if defined and perform all the validations + rt::finalize_arguments( s_parameters_store, s_arguments_store ); + + // check if colorized output is enabled + bool use_color = true; + if( s_arguments_store.has(btrt_color_output ) ) { + use_color = runtime_config::get(runtime_config::btrt_color_output); + } + + // Report help if requested + if( runtime_config::get( btrt_version ) ) { + parser->version( std::cerr ); + BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_success ) ); + } + else if( runtime_config::get( btrt_usage ) ) { + parser->usage( std::cerr, runtime::cstring(), use_color ); + BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_success ) ); + } + else if( s_arguments_store.has( btrt_help ) ) { + parser->help(std::cerr, + s_parameters_store, + runtime_config::get( btrt_help ), + use_color ); + BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_success ) ); + } + + // A bit of business logic: output_format takes precedence over log/report formats + if( s_arguments_store.has( btrt_output_format ) ) { + unit_test::output_format of = s_arguments_store.get( btrt_output_format ); + s_arguments_store.set( btrt_report_format, of ); + s_arguments_store.set( btrt_log_format, of ); + } + + } + BOOST_TEST_I_CATCH( rt::init_error, ex ) { + BOOST_TEST_SETUP_ASSERT( false, ex.msg ); + } + BOOST_TEST_I_CATCH( rt::ambiguous_param, ex ) { + std::cerr << ex.msg << "\n Did you mean one of these?\n"; + + BOOST_TEST_FOREACH( rt::cstring, name, ex.m_amb_candidates ) + std::cerr << " " << name << "\n"; + + BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); + } + BOOST_TEST_I_CATCH( rt::unrecognized_param, ex ) { + std::cerr << ex.msg << "\n"; + + if( !ex.m_typo_candidates.empty() ) { + std::cerr << " Did you mean one of these?\n"; + + BOOST_TEST_FOREACH( rt::cstring, name, ex.m_typo_candidates ) + std::cerr << " " << name << "\n"; + } + else if( parser ) { + std::cerr << "\n"; + parser->usage( std::cerr ); + } + + BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); + } + BOOST_TEST_I_CATCH( rt::input_error, ex ) { + std::cerr << ex.msg << "\n\n"; + + if( parser ) + parser->usage( std::cerr, ex.param_name ); + + BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); + } +} + +//____________________________________________________________________________// + +rt::arguments_store const& +argument_store() +{ + return s_arguments_store; +} + +//____________________________________________________________________________// + +bool +save_pattern() +{ + return runtime_config::get( btrt_save_test_pattern ); +} + +//____________________________________________________________________________// + +} // namespace runtime_config +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/xml_log_formatter.ipp b/libraries/boost/include/boost/test/impl/xml_log_formatter.ipp new file mode 100644 index 0000000000..ef44f1eade --- /dev/null +++ b/libraries/boost/include/boost/test/impl/xml_log_formatter.ipp @@ -0,0 +1,223 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : implements OF_XML Log formatter +// *************************************************************************** + +#ifndef BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER +#define BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER + +// Boost.Test +#include +#include +#include +#include +#include +#include + +// Boost +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace output { + +static const_string tu_type_name( test_unit const& tu ) +{ + return tu.p_type == TUT_CASE ? "TestCase" : "TestSuite"; +} + +// ************************************************************************** // +// ************** xml_log_formatter ************** // +// ************************************************************************** // + +void +xml_log_formatter::log_start( std::ostream& ostr, counter_t ) +{ + ostr << ""; +} + +//____________________________________________________________________________// + +void +xml_log_formatter::log_finish( std::ostream& ostr ) +{ + ostr << ""; +} + +//____________________________________________________________________________// + +void +xml_log_formatter::log_build_info( std::ostream& ostr ) +{ + ostr << ""; +} + +//____________________________________________________________________________// + +void +xml_log_formatter::test_unit_start( std::ostream& ostr, test_unit const& tu ) +{ + ostr << "<" << tu_type_name( tu ) << " name" << utils::attr_value() << tu.p_name.get(); + + if( !tu.p_file_name.empty() ) + ostr << BOOST_TEST_L( " file" ) << utils::attr_value() << tu.p_file_name + << BOOST_TEST_L( " line" ) << utils::attr_value() << tu.p_line_num; + + ostr << ">"; +} + +//____________________________________________________________________________// + +void +xml_log_formatter::test_unit_finish( std::ostream& ostr, test_unit const& tu, unsigned long elapsed ) +{ + if( tu.p_type == TUT_CASE ) + ostr << "" << elapsed << ""; + + ostr << ""; +} + +//____________________________________________________________________________// + +void +xml_log_formatter::test_unit_skipped( std::ostream& ostr, test_unit const& tu, const_string reason ) +{ + ostr << "<" << tu_type_name( tu ) + << " name" << utils::attr_value() << tu.p_name + << " skipped" << utils::attr_value() << "yes" + << " reason" << utils::attr_value() << reason + << "/>"; +} + +//____________________________________________________________________________// + +void +xml_log_formatter::log_exception_start( std::ostream& ostr, log_checkpoint_data const& checkpoint_data, execution_exception const& ex ) +{ + execution_exception::location const& loc = ex.where(); + + ostr << "" << utils::cdata() << ex.what(); + + if( !checkpoint_data.m_file_name.is_empty() ) { + ostr << "" + << utils::cdata() << checkpoint_data.m_message + << ""; + } +} + +//____________________________________________________________________________// + +void +xml_log_formatter::log_exception_finish( std::ostream& ostr ) +{ + ostr << ""; +} + +//____________________________________________________________________________// + +void +xml_log_formatter::log_entry_start( std::ostream& ostr, log_entry_data const& entry_data, log_entry_types let ) +{ + static literal_string xml_tags[] = { "Info", "Message", "Warning", "Error", "FatalError" }; + + m_curr_tag = xml_tags[let]; + ostr << '<' << m_curr_tag + << BOOST_TEST_L( " file" ) << utils::attr_value() << entry_data.m_file_name + << BOOST_TEST_L( " line" ) << utils::attr_value() << entry_data.m_line_num + << BOOST_TEST_L( ">" ); + m_value_closed = true; + } + + ostr << BOOST_TEST_L( "" ); + + m_curr_tag.clear(); +} + +//____________________________________________________________________________// + +void +xml_log_formatter::entry_context_start( std::ostream& ostr, log_level ) +{ + if( !m_value_closed ) { + ostr << BOOST_TEST_L( "]]>" ); + m_value_closed = true; + } + + ostr << BOOST_TEST_L( "" ); +} + +//____________________________________________________________________________// + +void +xml_log_formatter::entry_context_finish( std::ostream& ostr, log_level ) +{ + ostr << BOOST_TEST_L( "" ); +} + +//____________________________________________________________________________// + +void +xml_log_formatter::log_entry_context( std::ostream& ostr, log_level, const_string context_descr ) +{ + ostr << BOOST_TEST_L( "" ) << utils::cdata() << context_descr << BOOST_TEST_L( "" ); +} + +//____________________________________________________________________________// + +} // namespace output +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/xml_report_formatter.ipp b/libraries/boost/include/boost/test/impl/xml_report_formatter.ipp new file mode 100644 index 0000000000..424ef4ba44 --- /dev/null +++ b/libraries/boost/include/boost/test/impl/xml_report_formatter.ipp @@ -0,0 +1,111 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : OF_XML report formatter +// *************************************************************************** + +#ifndef BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER +#define BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER + +// Boost.Test +#include +#include + +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace output { + +void +xml_report_formatter::results_report_start( std::ostream& ostr ) +{ + ostr << ""; +} + +//____________________________________________________________________________// + +void +xml_report_formatter::results_report_finish( std::ostream& ostr ) +{ + ostr << ""; +} + + +//____________________________________________________________________________// + +void +xml_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream& ostr ) +{ + test_results const& tr = results_collector.results( tu.p_id ); + + const_string descr; + + if( tr.passed() ) + descr = "passed"; + else if( tr.p_skipped ) + descr = "skipped"; + else if( tr.p_aborted ) + descr = "aborted"; + else + descr = "failed"; + + ostr << '<' << ( tu.p_type == TUT_CASE ? "TestCase" : "TestSuite" ) + << " name" << utils::attr_value() << tu.p_name.get() + << " result" << utils::attr_value() << descr + << " assertions_passed" << utils::attr_value() << tr.p_assertions_passed + << " assertions_failed" << utils::attr_value() << tr.p_assertions_failed + << " warnings_failed" << utils::attr_value() << tr.p_warnings_failed + << " expected_failures" << utils::attr_value() << tr.p_expected_failures; + + if( tu.p_type == TUT_SUITE ) { + ostr << " test_cases_passed" << utils::attr_value() << tr.p_test_cases_passed + << " test_cases_passed_with_warnings" << utils::attr_value() << tr.p_test_cases_warned + << " test_cases_failed" << utils::attr_value() << tr.p_test_cases_failed + << " test_cases_skipped" << utils::attr_value() << tr.p_test_cases_skipped + << " test_cases_aborted" << utils::attr_value() << tr.p_test_cases_aborted; + } + + ostr << '>'; +} + +//____________________________________________________________________________// + +void +xml_report_formatter::test_unit_report_finish( test_unit const& tu, std::ostream& ostr ) +{ + ostr << "'; +} + +//____________________________________________________________________________// + +void +xml_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr ) +{ + test_unit_report_start( tu, ostr ); + test_unit_report_finish( tu, ostr ); +} + +//____________________________________________________________________________// + +} // namespace output +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER diff --git a/libraries/boost/include/boost/test/included/execution_monitor.hpp b/libraries/boost/include/boost/test/included/execution_monitor.hpp new file mode 100644 index 0000000000..cff2adc9a0 --- /dev/null +++ b/libraries/boost/include/boost/test/included/execution_monitor.hpp @@ -0,0 +1,21 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : included variant of Execution Monitor to be used independently +// *************************************************************************** + +#ifndef BOOST_INCLUDED_EXECUTION_MONITOR_HPP_051410GER +#define BOOST_INCLUDED_EXECUTION_MONITOR_HPP_051410GER + +#include +#include + +#endif // BOOST_INCLUDED_EXECUTION_MONITOR_HPP_051410GER diff --git a/libraries/boost/include/boost/test/included/prg_exec_monitor.hpp b/libraries/boost/include/boost/test/included/prg_exec_monitor.hpp new file mode 100644 index 0000000000..ff48ce5594 --- /dev/null +++ b/libraries/boost/include/boost/test/included/prg_exec_monitor.hpp @@ -0,0 +1,25 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : included (vs. linked ) version of Program Execution Monitor +// *************************************************************************** + +#ifndef BOOST_INCLUDED_PRG_EXEC_MONITOR_HPP_071894GER +#define BOOST_INCLUDED_PRG_EXEC_MONITOR_HPP_071894GER + +#include +#include +#include + +#define BOOST_TEST_INCLUDED +#include + +#endif // BOOST_INCLUDED_PRG_EXEC_MONITOR_HPP_071894GER diff --git a/libraries/boost/include/boost/test/included/test_exec_monitor.hpp b/libraries/boost/include/boost/test/included/test_exec_monitor.hpp new file mode 100644 index 0000000000..e75b4698f2 --- /dev/null +++ b/libraries/boost/include/boost/test/included/test_exec_monitor.hpp @@ -0,0 +1,40 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// +/// @file +/// @brief Included (vs. linked) version of Test Execution Monitor +// *************************************************************************** + +#ifndef BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP_071894GER +#define BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP_071894GER + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BOOST_TEST_INCLUDED +#include + +#endif // BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP_071894GER diff --git a/libraries/boost/include/boost/test/included/unit_test.hpp b/libraries/boost/include/boost/test/included/unit_test.hpp new file mode 100644 index 0000000000..90882eb178 --- /dev/null +++ b/libraries/boost/include/boost/test/included/unit_test.hpp @@ -0,0 +1,40 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// +//!@file +//!@brief Included (vs. linked) version of Unit Test Framework +// *************************************************************************** + +#ifndef BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER +#define BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER + +#define BOOST_TEST_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#endif // BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER diff --git a/libraries/boost/include/boost/test/included/unit_test_framework.hpp b/libraries/boost/include/boost/test/included/unit_test_framework.hpp new file mode 100644 index 0000000000..5bf366ad80 --- /dev/null +++ b/libraries/boost/include/boost/test/included/unit_test_framework.hpp @@ -0,0 +1,12 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @deprecated +// *************************************************************************** + +#include diff --git a/libraries/boost/include/boost/test/minimal.hpp b/libraries/boost/include/boost/test/minimal.hpp new file mode 100644 index 0000000000..c52295309e --- /dev/null +++ b/libraries/boost/include/boost/test/minimal.hpp @@ -0,0 +1,156 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Deprecated implementation of simple minimal testing +/// @deprecated +/// To convert to Unit Test Framework simply rewrite: +/// @code +/// #include +/// +/// int test_main( int, char *[] ) +/// { +/// ... +/// } +/// @endcode +/// as +/// @code +/// #include +/// +/// BOOST_AUTO_TEST_CASE(test_main) +/// { +/// ... +/// } +/// @endcode +// *************************************************************************** + +#ifndef BOOST_TEST_MINIMAL_HPP_071894GER +#define BOOST_TEST_MINIMAL_HPP_071894GER + +#define BOOST_CHECK(exp) \ + ( (exp) \ + ? static_cast(0) \ + : boost::minimal_test::report_error(#exp,__FILE__,__LINE__, BOOST_CURRENT_FUNCTION) ) + +#define BOOST_REQUIRE(exp) \ + ( (exp) \ + ? static_cast(0) \ + : boost::minimal_test::report_critical_error(#exp,__FILE__,__LINE__,BOOST_CURRENT_FUNCTION)) + +#define BOOST_ERROR( msg_ ) \ + boost::minimal_test::report_error( (msg_),__FILE__,__LINE__, BOOST_CURRENT_FUNCTION, true ) +#define BOOST_FAIL( msg_ ) \ + boost::minimal_test::report_critical_error( (msg_),__FILE__,__LINE__, BOOST_CURRENT_FUNCTION, true ) + +//____________________________________________________________________________// + +// Boost.Test +#include +#include +#include +#include +#include + +// Boost +#include // for exit codes +#include // for BOOST_CURRENT_FUNCTION + +// STL +#include // std::cerr, std::endl +#include // std::string + +#include + +//____________________________________________________________________________// + +int test_main( int argc, char* argv[] ); // prototype for users test_main() + +namespace boost { +namespace minimal_test { + +typedef boost::unit_test::const_string const_string; + +inline unit_test::counter_t& errors_counter() { static unit_test::counter_t ec = 0; return ec; } + +inline void +report_error( const char* msg, const char* file, int line, const_string func_name, bool is_msg = false ) +{ + ++errors_counter(); + std::cerr << file << "(" << line << "): "; + + if( is_msg ) + std::cerr << msg; + else + std::cerr << "test " << msg << " failed"; + + if( func_name != "(unknown)" ) + std::cerr << " in function: '" << func_name << "'"; + + std::cerr << std::endl; +} + +inline void +report_critical_error( const char* msg, const char* file, int line, const_string func_name, bool is_msg = false ) +{ + report_error( msg, file, line, func_name, is_msg ); + + throw boost::execution_aborted(); +} + +class caller { +public: + // constructor + caller( int argc, char** argv ) + : m_argc( argc ), m_argv( argv ) {} + + // execution monitor hook implementation + int operator()() { return test_main( m_argc, m_argv ); } + +private: + // Data members + int m_argc; + char** m_argv; +}; // monitor + +} // namespace minimal_test +} // namespace boost + +//____________________________________________________________________________// + +int BOOST_TEST_CALL_DECL main( int argc, char* argv[] ) +{ + using namespace boost::minimal_test; + + try { + ::boost::execution_monitor ex_mon; + int run_result = ex_mon.execute( caller( argc, argv ) ); + + BOOST_CHECK( run_result == 0 || run_result == boost::exit_success ); + } + catch( boost::execution_exception const& exex ) { + if( exex.code() != boost::execution_exception::no_error ) + BOOST_ERROR( (std::string( "exception \"" ) + exex.what() + "\" caught").c_str() ); + std::cerr << "\n**** Testing aborted."; + } + + if( boost::minimal_test::errors_counter() != 0 ) { + std::cerr << "\n**** " << errors_counter() + << " error" << (errors_counter() > 1 ? "s" : "" ) << " detected\n"; + + return boost::exit_test_failure; + } + + std::cout << "\n**** no errors detected\n"; + + return boost::exit_success; +} + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_MINIMAL_HPP_071894GER diff --git a/libraries/boost/include/boost/test/output/compiler_log_formatter.hpp b/libraries/boost/include/boost/test/output/compiler_log_formatter.hpp new file mode 100644 index 0000000000..50359334b1 --- /dev/null +++ b/libraries/boost/include/boost/test/output/compiler_log_formatter.hpp @@ -0,0 +1,70 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Contains the formatter for the Human Readable Format (HRF) +// *************************************************************************** + +#ifndef BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER +#define BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace output { + +// ************************************************************************** // +// ************** compiler_log_formatter ************** // +// ************************************************************************** // + +//!@brief Log formatter for the Human Readable Format (HRF) log format +class BOOST_TEST_DECL compiler_log_formatter : public unit_test_log_formatter { +public: + compiler_log_formatter() : m_color_output( false ) {} + + // Formatter interface + void log_start( std::ostream&, counter_t test_cases_amount ); + void log_finish( std::ostream& ); + void log_build_info( std::ostream& ); + + void test_unit_start( std::ostream&, test_unit const& tu ); + void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ); + void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason ); + + void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex ); + void log_exception_finish( std::ostream& ); + + void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ); + void log_entry_value( std::ostream&, const_string value ); + void log_entry_value( std::ostream&, lazy_ostream const& value ); + void log_entry_finish( std::ostream& ); + + void entry_context_start( std::ostream&, log_level ); + void log_entry_context( std::ostream&, log_level l, const_string ); + void entry_context_finish( std::ostream&, log_level l ); + +protected: + virtual void print_prefix( std::ostream&, const_string file, std::size_t line ); + + // Data members + bool m_color_output; +}; + +} // namespace output +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER diff --git a/libraries/boost/include/boost/test/output/junit_log_formatter.hpp b/libraries/boost/include/boost/test/output/junit_log_formatter.hpp new file mode 100644 index 0000000000..713d3b016c --- /dev/null +++ b/libraries/boost/include/boost/test/output/junit_log_formatter.hpp @@ -0,0 +1,167 @@ +// (C) Copyright 2016 Raffi Enficiaud. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +///@file +///@brief Contains the definition of the Junit log formatter (OF_JUNIT) +// *************************************************************************** + +#ifndef BOOST_TEST_JUNIT_LOG_FORMATTER__ +#define BOOST_TEST_JUNIT_LOG_FORMATTER__ + +// Boost.Test +#include +#include +#include + +//#include + +// STL +#include // std::size_t +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace output { + + + namespace junit_impl { + + // helper for the JUnit logger + struct junit_log_helper + { + struct assertion_entry { + + enum log_entry_t { + log_entry_info, + log_entry_error, + log_entry_failure + }; + + assertion_entry() : sealed(false) + {} + + std::string logentry_message; // the message associated to the JUnit error/entry + std::string logentry_type; // the one that will get expanded in the final junit (failure, error) + std::string output; // additional information/message generated by the assertion + + log_entry_t log_entry; // the type associated to the assertion (or error) + + bool sealed; // indicates if the entry can accept additional information + }; + + std::list system_out; // sysout: additional information + std::list system_err; // syserr: additional information + std::string skipping_reason; + + // list of failure, errors and messages (assertions message and the full log) + std::vector< assertion_entry > assertion_entries; + + bool skipping; + + junit_log_helper(): skipping(false) + {} + + void clear() { + assertion_entries.clear(); + system_out.clear(); + system_err.clear(); + skipping_reason.clear(); + skipping = false; + } + + }; + } + +// ************************************************************************** // +// ************** junit_log_formatter ************** // +// ************************************************************************** // + +/// JUnit logger class +class junit_log_formatter : public unit_test_log_formatter { +public: + + junit_log_formatter() : m_display_build_info(false) + { + // we log everything from the logger singleton point of view + // because we need to know about all the messages/commands going to the logger + // we decide what we put inside the logs internally + this->m_log_level = log_successful_tests; + m_log_level_internal = log_messages; + } + + // Formatter interface + void log_start( std::ostream&, counter_t test_cases_amount ); + void log_finish( std::ostream& ); + void log_build_info( std::ostream& ); + + void test_unit_start( std::ostream&, test_unit const& tu ); + void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ); + void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason ); + void test_unit_aborted( std::ostream& os, test_unit const& tu ); + + void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex ); + void log_exception_finish( std::ostream& ); + + void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ); + + using unit_test_log_formatter::log_entry_value; // bring base class functions into overload set + void log_entry_value( std::ostream&, const_string value ); + void log_entry_finish( std::ostream& ); + + void entry_context_start( std::ostream&, log_level ); + void log_entry_context( std::ostream&, log_level, const_string ); + void entry_context_finish( std::ostream&, log_level ); + + //! Discards changes in the log level + virtual void set_log_level(log_level ll) + { + if(ll > log_successful_tests && ll < log_messages) + ll = log_successful_tests; + else if (ll > log_all_errors) + ll = log_all_errors; + + this->m_log_level_internal = ll; + } + + //! Instead of a regular stream, returns a file name corresponding to + //! the current master test suite. If the file already exists, adds an index + //! to it. + virtual std::string get_default_stream_description() const; + + +private: + typedef std::map map_trace_t; + map_trace_t map_tests; + junit_impl::junit_log_helper runner_log_entry; + + junit_impl::junit_log_helper& get_current_log_entry() { + if(list_path_to_root.empty()) + return runner_log_entry; + map_trace_t::iterator it = map_tests.find(list_path_to_root.back()); + return (it == map_tests.end() ? runner_log_entry : it->second); + } + + std::list list_path_to_root; + bool m_display_build_info; + bool m_is_last_assertion_or_error; // true if failure, false if error + + log_level m_log_level_internal; + friend class junit_result_helper; +}; + +} // namespace output +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_JUNIT_LOG_FORMATTER__ diff --git a/libraries/boost/include/boost/test/output/plain_report_formatter.hpp b/libraries/boost/include/boost/test/output/plain_report_formatter.hpp new file mode 100644 index 0000000000..8c50964597 --- /dev/null +++ b/libraries/boost/include/boost/test/output/plain_report_formatter.hpp @@ -0,0 +1,59 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : plain report formatter implementation +// *************************************************************************** + +#ifndef BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER +#define BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace output { + +// ************************************************************************** // +// ************** plain_report_formatter ************** // +// ************************************************************************** // + +class plain_report_formatter : public results_reporter::format { +public: + plain_report_formatter() : m_indent( 0 ), m_color_output( false ) {} + + // Formatter interface + void results_report_start( std::ostream& ostr ); + void results_report_finish( std::ostream& ostr ); + + void test_unit_report_start( test_unit const&, std::ostream& ostr ); + void test_unit_report_finish( test_unit const&, std::ostream& ostr ); + + void do_confirmation_report( test_unit const&, std::ostream& ostr ); + +private: + // Data members + counter_t m_indent; + bool m_color_output; +}; + +} // namespace output +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER diff --git a/libraries/boost/include/boost/test/output/xml_log_formatter.hpp b/libraries/boost/include/boost/test/output/xml_log_formatter.hpp new file mode 100644 index 0000000000..1d8dec0f95 --- /dev/null +++ b/libraries/boost/include/boost/test/output/xml_log_formatter.hpp @@ -0,0 +1,72 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : contains OF_XML Log formatter definition +// *************************************************************************** + +#ifndef BOOST_TEST_XML_LOG_FORMATTER_020105GER +#define BOOST_TEST_XML_LOG_FORMATTER_020105GER + +// Boost.Test +#include +#include + +// STL +#include // std::size_t + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace output { + +// ************************************************************************** // +// ************** xml_log_formatter ************** // +// ************************************************************************** // + +class xml_log_formatter : public unit_test_log_formatter { +public: + // Formatter interface + void log_start( std::ostream&, counter_t test_cases_amount ); + void log_finish( std::ostream& ); + void log_build_info( std::ostream& ); + + void test_unit_start( std::ostream&, test_unit const& tu ); + void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ); + void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason ); + + void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex ); + void log_exception_finish( std::ostream& ); + + void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ); + using unit_test_log_formatter::log_entry_value; // bring base class functions into overload set + void log_entry_value( std::ostream&, const_string value ); + void log_entry_finish( std::ostream& ); + + void entry_context_start( std::ostream&, log_level ); + void log_entry_context( std::ostream&, log_level, const_string ); + void entry_context_finish( std::ostream&, log_level ); + +private: + // Data members + const_string m_curr_tag; + bool m_value_closed; +}; + +} // namespace output +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_XML_LOG_FORMATTER_020105GER diff --git a/libraries/boost/include/boost/test/output/xml_report_formatter.hpp b/libraries/boost/include/boost/test/output/xml_report_formatter.hpp new file mode 100644 index 0000000000..ca5e47182f --- /dev/null +++ b/libraries/boost/include/boost/test/output/xml_report_formatter.hpp @@ -0,0 +1,52 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : OF_XML report formatter implementation +// *************************************************************************** + +#ifndef BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER +#define BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace output { + +// ************************************************************************** // +// ************** xml_report_formatter ************** // +// ************************************************************************** // + +class xml_report_formatter : public results_reporter::format { +public: + // Formatter interface + void results_report_start( std::ostream& ostr ); + void results_report_finish( std::ostream& ostr ); + + void test_unit_report_start( test_unit const&, std::ostream& ostr ); + void test_unit_report_finish( test_unit const&, std::ostream& ostr ); + + void do_confirmation_report( test_unit const&, std::ostream& ostr ); +}; + +} // namespace output +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER diff --git a/libraries/boost/include/boost/test/output_test_stream.hpp b/libraries/boost/include/boost/test/output_test_stream.hpp new file mode 100644 index 0000000000..26eaf320ac --- /dev/null +++ b/libraries/boost/include/boost/test/output_test_stream.hpp @@ -0,0 +1,14 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief Deprecated header. +//!@deprecated Use boost/test/tools/output_test_stream.hpp instead +// *************************************************************************** + +// Boost.Test +#include diff --git a/libraries/boost/include/boost/test/parameterized_test.hpp b/libraries/boost/include/boost/test/parameterized_test.hpp new file mode 100644 index 0000000000..cc9487abc2 --- /dev/null +++ b/libraries/boost/include/boost/test/parameterized_test.hpp @@ -0,0 +1,176 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief generators and helper macros for parameterized tests +// *************************************************************************** + +#ifndef BOOST_TEST_PARAMETERIZED_TEST_HPP_021102GER +#define BOOST_TEST_PARAMETERIZED_TEST_HPP_021102GER + +// Boost.Test +#include +#include + +// Boost +#include +#include + +#include +#include + +#include + +//____________________________________________________________________________// + +#define BOOST_PARAM_TEST_CASE( function, begin, end ) \ +boost::unit_test::make_test_case( function, \ + BOOST_TEST_STRINGIZE( function ), \ + __FILE__, __LINE__, \ + (begin), (end) ) \ +/**/ + +#define BOOST_PARAM_CLASS_TEST_CASE( function, tc_instance, begin, end ) \ +boost::unit_test::make_test_case( function, \ + BOOST_TEST_STRINGIZE( function ), \ + __FILE__, __LINE__, \ + (tc_instance), \ + (begin), (end) ) \ +/**/ + +namespace boost { +namespace unit_test { + +namespace ut_detail { + +// ************************************************************************** // +// ************** param_test_case_generator ************** // +// ************************************************************************** // + +template +class param_test_case_generator : public test_unit_generator { +public: + param_test_case_generator( boost::function const& test_func, + const_string tc_name, + const_string tc_file, + std::size_t tc_line, + ParamIter par_begin, + ParamIter par_end ) + : m_test_func( test_func ) + , m_tc_name( ut_detail::normalize_test_case_name( tc_name ) ) + , m_tc_file( tc_file ) + , m_tc_line( tc_line ) + , m_par_begin( par_begin ) + , m_par_end( par_end ) + , m_index( 0 ) + {} + + virtual test_unit* next() const + { + if( m_par_begin == m_par_end ) + return (test_unit*)0; + + test_unit* res = new test_case( m_tc_name + "_" + utils::string_cast(m_index), m_tc_file, m_tc_line, boost::bind( m_test_func, *m_par_begin ) ); + + ++m_par_begin; + ++m_index; + + return res; + } + +private: + // Data members + boost::function m_test_func; + std::string m_tc_name; + const_string m_tc_file; + std::size_t m_tc_line; + mutable ParamIter m_par_begin; + ParamIter m_par_end; + mutable std::size_t m_index; +}; + +//____________________________________________________________________________// + +template +struct user_param_tc_method_invoker { + typedef void (UserTestCase::*test_method)( ParamType ); + + // Constructor + user_param_tc_method_invoker( shared_ptr inst, test_method test_method ) + : m_inst( inst ), m_test_method( test_method ) {} + + void operator()( ParamType p ) { ((*m_inst).*m_test_method)( p ); } + + // Data members + shared_ptr m_inst; + test_method m_test_method; +}; + +//____________________________________________________________________________// + +} // namespace ut_detail + +template +inline ut_detail::param_test_case_generator +make_test_case( boost::function const& test_func, + const_string tc_name, + const_string tc_file, + std::size_t tc_line, + ParamIter par_begin, + ParamIter par_end ) +{ + return ut_detail::param_test_case_generator( test_func, tc_name, tc_file, tc_line, par_begin, par_end ); +} + +//____________________________________________________________________________// + +template +inline ut_detail::param_test_case_generator< + BOOST_DEDUCED_TYPENAME remove_const::type>::type,ParamIter> +make_test_case( void (*test_func)( ParamType ), + const_string tc_name, + const_string tc_file, + std::size_t tc_line, + ParamIter par_begin, + ParamIter par_end ) +{ + typedef BOOST_DEDUCED_TYPENAME remove_const::type>::type param_value_type; + return ut_detail::param_test_case_generator( test_func, tc_name, tc_file, tc_line, par_begin, par_end ); +} + +//____________________________________________________________________________// + +template +inline ut_detail::param_test_case_generator< + BOOST_DEDUCED_TYPENAME remove_const::type>::type,ParamIter> +make_test_case( void (UserTestCase::*test_method )( ParamType ), + const_string tc_name, + const_string tc_file, + std::size_t tc_line, + boost::shared_ptr const& user_test_case, + ParamIter par_begin, + ParamIter par_end ) +{ + typedef BOOST_DEDUCED_TYPENAME remove_const::type>::type param_value_type; + return ut_detail::param_test_case_generator( + ut_detail::user_param_tc_method_invoker( user_test_case, test_method ), + tc_name, + tc_file, + tc_line, + par_begin, + par_end ); +} + +//____________________________________________________________________________// + +} // unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_PARAMETERIZED_TEST_HPP_021102GER + diff --git a/libraries/boost/include/boost/test/predicate_result.hpp b/libraries/boost/include/boost/test/predicate_result.hpp new file mode 100644 index 0000000000..9b57363713 --- /dev/null +++ b/libraries/boost/include/boost/test/predicate_result.hpp @@ -0,0 +1,14 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Deprecated header +/// @deprecated Use boost/test/tools/assertion_result.hpp instead +// *************************************************************************** + +// Boost.Test +#include diff --git a/libraries/boost/include/boost/test/prg_exec_monitor.hpp b/libraries/boost/include/boost/test/prg_exec_monitor.hpp new file mode 100644 index 0000000000..f072e215db --- /dev/null +++ b/libraries/boost/include/boost/test/prg_exec_monitor.hpp @@ -0,0 +1,81 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Entry point for the end user into the Program Execution Monitor. +/// +/// Use this header to forward declare function prg_exec_monitor_main and to automatically define a main +/// function for you. If you prefer to use your own main you are free to do so, but you need to define +/// BOOST_TEST_NO_MAIN before incuding this header. To initiate your main program body execution you +/// would use statement like this: +/// @code ::boost::prg_exec_monitor_main( &my_main, argc, argv ); @endcode +/// Also this header facilitate auto linking with the Program Execution Monitor library if this feature +/// is supported +// *************************************************************************** + +#ifndef BOOST_PRG_EXEC_MONITOR_HPP_071894GER +#define BOOST_PRG_EXEC_MONITOR_HPP_071894GER + +#include + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** Auto Linking ************** // +// ************************************************************************** // + +// Automatically link to the correct build variant where possible. +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \ + !defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED) +# define BOOST_LIB_NAME boost_prg_exec_monitor + +// If we're importing code from a dll, then tell auto_link.hpp about it: +# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TEST_DYN_LINK) +# define BOOST_DYN_LINK +# endif + +# include + +#endif // auto-linking disabled + +// ************************************************************************** // +// ************** prg_exec_monitor_main ************** // +// ************************************************************************** // + +namespace boost { + +/// @brief Wrapper around the main function +/// +/// Call this routine instead of your own main body implementation directly. This routine impements all the monitoring +/// functionality. THe monitor behavior is configurable by using the environment variable BOOST_TEST_CATCH_SYSTEM_ERRORS. +/// If set to string value "no", the monitor will not attempt to catch system errors (signals) +/// @param[in] cpp_main main function body. Should have the same signature as regular main function +/// @param[in] argc, argv command line arguments +int BOOST_TEST_DECL prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char* argv[] ); + +} // boost + +#if defined(BOOST_TEST_DYN_LINK) && !defined(BOOST_TEST_NO_MAIN) + +// ************************************************************************** // +// ************** main function for tests using dll ************** // +// ************************************************************************** // + +// prototype for user's cpp_main() +int cpp_main( int argc, char* argv[] ); + +int BOOST_TEST_CALL_DECL +main( int argc, char* argv[] ) +{ + return ::boost::prg_exec_monitor_main( &cpp_main, argc, argv ); +} + +//____________________________________________________________________________// + +#endif // BOOST_TEST_DYN_LINK && !BOOST_TEST_NO_MAIN + +#endif // BOOST_PRG_EXEC_MONITOR_HPP_071894GER diff --git a/libraries/boost/include/boost/test/progress_monitor.hpp b/libraries/boost/include/boost/test/progress_monitor.hpp new file mode 100644 index 0000000000..2f661f5825 --- /dev/null +++ b/libraries/boost/include/boost/test/progress_monitor.hpp @@ -0,0 +1,66 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief defines simple text based progress monitor +// *************************************************************************** + +#ifndef BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER +#define BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER + +// Boost.Test +#include +#include + +// STL +#include // for std::ostream& + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** progress_monitor ************** // +// ************************************************************************** // + +/// This class implements test observer interface and updates test progress as test units finish or get aborted +class BOOST_TEST_DECL progress_monitor_t : public test_observer, public singleton { +public: + /// @name Test observer interface + /// @{ + virtual void test_start( counter_t test_cases_amount ); + virtual void test_aborted(); + + virtual void test_unit_finish( test_unit const&, unsigned long ); + virtual void test_unit_skipped( test_unit const&, const_string ); + + virtual int priority() { return 4; } + /// @} + + /// @name Configuration + /// @{ + void set_stream( std::ostream& ); + /// @} + +private: + BOOST_TEST_SINGLETON_CONS( progress_monitor_t ) +}; // progress_monitor_t + +BOOST_TEST_SINGLETON_INST( progress_monitor ) + +} // namespace unit_test +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER + diff --git a/libraries/boost/include/boost/test/results_collector.hpp b/libraries/boost/include/boost/test/results_collector.hpp new file mode 100644 index 0000000000..3acd7b87bc --- /dev/null +++ b/libraries/boost/include/boost/test/results_collector.hpp @@ -0,0 +1,143 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Defines testing result collector components +/// +/// Defines classes for keeping track (@ref test_results) and collecting +/// (@ref results_collector_t) the states of the test units. +// *************************************************************************** + +#ifndef BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER +#define BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER + +// Boost.Test +#include + +#include +#include + +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +namespace { + +// ************************************************************************** // +/// First failed assertion debugger hook +/// +/// This function is a placeholder where user can set a breakpoint in debugger to catch the +/// very first assertion failure in each test case +// ************************************************************************** // +inline void first_failed_assertion() {} +} + +// ************************************************************************** // +/// @brief Collection of attributes constituting test unit results +/// +/// This class is a collection of attributes describing a test result. +/// +/// The attributes presented as public properties on +/// an instance of the class. In addition summary conclusion methods are presented to generate simple answer to pass/fail question + +class BOOST_TEST_DECL test_results { +public: + test_results(); + + /// Type representing counter like public property + typedef BOOST_READONLY_PROPERTY( counter_t, (results_collector_t) + (test_results) + (results_collect_helper) ) counter_prop; + /// Type representing boolean like public property + typedef BOOST_READONLY_PROPERTY( bool, (results_collector_t) + (test_results) + (results_collect_helper) ) bool_prop; + + counter_prop p_assertions_passed; //!< Number of successful assertions + counter_prop p_assertions_failed; //!< Number of failing assertions + counter_prop p_warnings_failed; //!< Number of warnings + counter_prop p_expected_failures; + counter_prop p_test_cases_passed; //!< Number of successfull test cases + counter_prop p_test_cases_warned; //!< Number of warnings in test cases + counter_prop p_test_cases_failed; //!< Number of failing test cases + counter_prop p_test_cases_skipped; //!< Number of skipped test cases + counter_prop p_test_cases_aborted; //!< Number of aborted test cases + counter_prop p_duration_microseconds; //!< Duration of the test in microseconds + bool_prop p_aborted; //!< Indicates that the test unit execution has been aborted + bool_prop p_skipped; //!< Indicates that the test unit execution has been skipped + + /// Returns true if test unit passed + bool passed() const; + + /// Returns true if the test unit was aborted (hard failure) + bool aborted() const; + + /// Produces result code for the test unit execution + /// + /// This methhod return one of the result codes defined in @c boost/cstdlib.hpp + /// @returns + /// - @c boost::exit_success on success, + /// - @c boost::exit_exception_failure in case test unit + /// was aborted for any reason (incuding uncaught exception) + /// - and @c boost::exit_test_failure otherwise + int result_code() const; + + //! Combines the results of the current instance with another + //! + //! Only the counters are updated and the @c p_aborted and @c p_skipped are left unchanged. + void operator+=( test_results const& ); + + //! Resets the current state of the result + void clear(); +}; + +// ************************************************************************** // +/// @brief Collects and combines the test results +/// +/// This class collects and combines the results of the test unit during the execution of the +/// test tree. The results_collector_t::results() function combines the test results on a subtree +/// of the test tree. +/// +/// @see boost::unit_test::test_observer +class BOOST_TEST_DECL results_collector_t : public test_observer, public singleton { +public: + + virtual void test_start( counter_t ); + + virtual void test_unit_start( test_unit const& ); + virtual void test_unit_finish( test_unit const&, unsigned long ); + virtual void test_unit_skipped( test_unit const&, const_string ); + virtual void test_unit_aborted( test_unit const& ); + + virtual void assertion_result( unit_test::assertion_result ); + virtual void exception_caught( execution_exception const& ); + + virtual int priority() { return 3; } + + /// Results access per test unit + /// + /// @param[in] tu_id id of a test unit + test_results const& results( test_unit_id tu_id ) const; + +private: + BOOST_TEST_SINGLETON_CONS( results_collector_t ) +}; + +BOOST_TEST_SINGLETON_INST( results_collector ) + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER diff --git a/libraries/boost/include/boost/test/results_reporter.hpp b/libraries/boost/include/boost/test/results_reporter.hpp new file mode 100644 index 0000000000..6f8d8f1105 --- /dev/null +++ b/libraries/boost/include/boost/test/results_reporter.hpp @@ -0,0 +1,122 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief defines testing result reporter interfaces +/// +/// This file defines interfaces that are responsible for results reporting. Interface is presented in a form of +/// free standing function implemented in namespace result_reporter +// *************************************************************************** + +#ifndef BOOST_TEST_RESULTS_REPORTER_HPP_021205GER +#define BOOST_TEST_RESULTS_REPORTER_HPP_021205GER + +// Boost.Test +#include +#include + +// STL +#include // for std::ostream& + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +/// Namespace for results reporter interfaces +namespace results_reporter { + +// ************************************************************************** // +/// @brief Results report formatter interface +/// +/// This is abstract interface for the report formatter used by results reporter routines. +/// You can define a custom formatter by implementing this interface and setting the formatter using set_format function. +/// This is usually done during test module initialization +// ************************************************************************** // + +class BOOST_TEST_DECL format { +public: + // Destructor + virtual ~format() {} + + virtual void results_report_start( std::ostream& ostr ) = 0; + virtual void results_report_finish( std::ostream& ostr ) = 0; + + virtual void test_unit_report_start( test_unit const&, std::ostream& ostr ) = 0; + virtual void test_unit_report_finish( test_unit const&, std::ostream& ostr ) = 0; + + virtual void do_confirmation_report( test_unit const&, std::ostream& ostr ) = 0; +}; + +// ************************************************************************** // +/// @name report configuration +// ************************************************************************** // + +/// Sets reporting level + +/// There are only four possible levels for results report: +/// - confirmation report (boost::unit_test::CONFIRMATION_REPORT). This report level only produces short confirmation +/// message about test module pass/fail status +/// - short report (boost::unit_test::SHORT_REPORT). This report level produces short summary report for failed/passed +/// assertions and test units. +/// - detailed report (boost::unit_test::DETAILED_REPORT). This report level produces detailed report per test unit for +/// passed/failed assertions and uncaught exceptions +/// - no report (boost::unit_test::NO_REPORT). This report level produces no results report. This is used for test modules +/// running as part of some kind of continues integration framework +/// @param[in] l report level +BOOST_TEST_DECL void set_level( report_level l ); + +/// Sets output stream for results reporting + +/// By default std::cerr is used. Use this function to set a different stream. The framework +/// refers to the stream by reference, so you need to make sure the stream object lifetime exceeds the testing main scope. +BOOST_TEST_DECL void set_stream( std::ostream& ); + +/// Sets one of the predefined formats + +/// The framework implements two results report formats: +/// - plain human readable format (boost::unit_test::OF_CLF) +/// - XML format (boost::unit_test::OF_XML) +/// @param[in] of one of the presefined enumeration values for output formats +BOOST_TEST_DECL void set_format( output_format of ); + +/// Sets custom report formatter + +/// The framework takes ownership of the pointer passed as an argument. So this should be a pointer to +/// a heap allocated object +/// @param[in] f pointer to heap allocated instance of custom report formatter class +BOOST_TEST_DECL void set_format( results_reporter::format* f ); + +/// @brief Access to configured results reporter stream +/// +/// Use this stream to report additional information abut test module execution +BOOST_TEST_DECL std::ostream& get_stream(); + +/// @} + +// ************************************************************************** // +// ************** report initiation ************** // +// ************************************************************************** // + +BOOST_TEST_DECL void make_report( report_level l = INV_REPORT_LEVEL, test_unit_id = INV_TEST_UNIT_ID ); +inline void confirmation_report( test_unit_id id = INV_TEST_UNIT_ID ) +{ make_report( CONFIRMATION_REPORT, id ); } +inline void short_report( test_unit_id id = INV_TEST_UNIT_ID ) +{ make_report( SHORT_REPORT, id ); } +inline void detailed_report( test_unit_id id = INV_TEST_UNIT_ID ) +{ make_report( DETAILED_REPORT, id ); } + +} // namespace results_reporter +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_RESULTS_REPORTER_HPP_021205GER + diff --git a/libraries/boost/include/boost/test/test_case_template.hpp b/libraries/boost/include/boost/test/test_case_template.hpp new file mode 100644 index 0000000000..c01bd0738a --- /dev/null +++ b/libraries/boost/include/boost/test/test_case_template.hpp @@ -0,0 +1,13 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Deprecated header. +/// @deprecated Use @c boost/test/unit_test.hpp instead +// *************************************************************************** + +#include diff --git a/libraries/boost/include/boost/test/test_exec_monitor.hpp b/libraries/boost/include/boost/test/test_exec_monitor.hpp new file mode 100644 index 0000000000..0450809335 --- /dev/null +++ b/libraries/boost/include/boost/test/test_exec_monitor.hpp @@ -0,0 +1,53 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Deprecated implementation of Test Execution Monitor +/// +/// To convert to Unit Test Framework simply rewrite: +/// @code +/// #include +/// +/// int test_main( int, char *[] ) +/// { +/// ... +/// } +/// @endcode +/// as +/// @code +/// #include +/// +/// BOOST_AUTO_TEST_CASE(test_main) +/// { +/// ... +/// } +/// @endcode +/// and link with boost_unit_test_framework library *instead of* boost_test_exec_monitor +// *************************************************************************** + +#ifndef BOOST_TEST_EXEC_MONITOR_HPP_071894GER +#define BOOST_TEST_EXEC_MONITOR_HPP_071894GER + +// Boost.Test +#include + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** Auto Linking ************** // +// ************************************************************************** // + +// Automatically link to the correct build variant where possible. +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \ + !defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED) + +# define BOOST_LIB_NAME boost_test_exec_monitor +# include + +#endif // auto-linking disabled + +#endif // BOOST_TEST_EXEC_MONITOR_HPP_071894GER diff --git a/libraries/boost/include/boost/test/test_framework_init_observer.hpp b/libraries/boost/include/boost/test/test_framework_init_observer.hpp new file mode 100644 index 0000000000..cdf5ef5edd --- /dev/null +++ b/libraries/boost/include/boost/test/test_framework_init_observer.hpp @@ -0,0 +1,63 @@ +// (c) Copyright Raffi Enficiaud 2017. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Defines an observer that monitors the init of the unit test framework +// *************************************************************************** + +#ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER +#define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER + +// Boost.Test +#include + +#include +#include + +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +/// @brief Monitors the init of the framework +/// +/// This class collects the state of the init/termination of the unit test framework. +/// +/// @see boost::unit_test::test_observer +class BOOST_TEST_DECL framework_init_observer_t : public test_observer, public singleton { +public: + + virtual void test_start( counter_t ); + + virtual void assertion_result( unit_test::assertion_result ); + virtual void exception_caught( execution_exception const& ); + virtual void test_aborted(); + + virtual int priority() { return 0; } + + void clear(); + + /// Indicates if a failure has been recorded so far + bool has_failed( ) const; + +private: + BOOST_TEST_SINGLETON_CONS( framework_init_observer_t ) +}; + +BOOST_TEST_SINGLETON_INST( framework_init_observer ) + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER diff --git a/libraries/boost/include/boost/test/test_tools.hpp b/libraries/boost/include/boost/test/test_tools.hpp new file mode 100644 index 0000000000..a542d5fcde --- /dev/null +++ b/libraries/boost/include/boost/test/test_tools.hpp @@ -0,0 +1,68 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief test tools compatibility header +/// +/// This file is used to select the test tools implementation and includes all the necessary headers +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_HPP_111812GER +#define BOOST_TEST_TOOLS_HPP_111812GER + +#include + +// brings some compiler configuration like BOOST_PP_VARIADICS +#include + +#include + +#if defined(BOOST_NO_CXX11_VARIADIC_MACROS) \ + || defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \ + || defined(BOOST_NO_CXX11_DECLTYPE) +# define BOOST_TEST_MACRO_LIMITED_SUPPORT +#endif + +// Boost.Test +// #define BOOST_TEST_NO_OLD_TOOLS + +#if defined(BOOST_TEST_MACRO_LIMITED_SUPPORT) \ + && ( !BOOST_PP_VARIADICS \ + || !(__cplusplus >= 201103L) && defined(BOOST_NO_CXX11_VARIADIC_MACROS)) +# define BOOST_TEST_NO_NEW_TOOLS +#endif + +// #define BOOST_TEST_TOOLS_UNDER_DEBUGGER +// #define BOOST_TEST_TOOLS_DEBUGGABLE + +#include + +#ifndef BOOST_TEST_NO_OLD_TOOLS +# include +# include + +# include +#endif + +#ifndef BOOST_TEST_NO_NEW_TOOLS +# include +# include +# include +# include +# include + +# include +# include +# include + +# include +# include +# include +# include +#endif + +#endif // BOOST_TEST_TOOLS_HPP_111812GER diff --git a/libraries/boost/include/boost/test/tools/assertion.hpp b/libraries/boost/include/boost/test/tools/assertion.hpp new file mode 100644 index 0000000000..cca2f52beb --- /dev/null +++ b/libraries/boost/include/boost/test/tools/assertion.hpp @@ -0,0 +1,410 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief Defines framework for automated assertion construction +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER +#define BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER + +// Boost.Test +#include +#include +#include + +// Boost +#include +#include +#include +#include +#include +#include + +// STL +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +#include +#endif + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { +namespace assertion { + +// ************************************************************************** // +// ************** assertion::operators ************** // +// ************************************************************************** // +// precedence 4: ->*, .* +// precedence 5: *, /, % +// precedence 6: +, - +// precedence 7: << , >> +// precedence 8: <, <=, > and >= +// precedence 9: == and != +// precedence 10: bitwise AND +// precedence 11: bitwise XOR +// precedence 12: bitwise OR +// precedence 13: logical AND +// disabled +// precedence 14: logical OR +// disabled +// precedence 15: ternary conditional +// disabled +// precedence 16: = and OP= operators +// precedence 17: throw operator +// not supported +// precedence 18: comma +// not supported + +namespace op { + +#define BOOST_TEST_FOR_EACH_COMP_OP(action) \ + action( < , LT, >= ) \ + action( <=, LE, > ) \ + action( > , GT, <= ) \ + action( >=, GE, < ) \ + action( ==, EQ, != ) \ + action( !=, NE, == ) \ +/**/ + +//____________________________________________________________________________// + +#ifndef BOOST_NO_CXX11_DECLTYPE + +#define BOOST_TEST_FOR_EACH_CONST_OP(action)\ + action(->*, MEMP, ->* ) \ + \ + action( * , MUL, * ) \ + action( / , DIV, / ) \ + action( % , MOD, % ) \ + \ + action( + , ADD, + ) \ + action( - , SUB, - ) \ + \ + action( <<, LSH, << ) \ + action( >>, RSH, >> ) \ + \ + BOOST_TEST_FOR_EACH_COMP_OP(action) \ + \ + action( & , BAND, & ) \ + action( ^ , XOR, ^ ) \ + action( | , BOR, | ) \ +/**/ + +#else + +#define BOOST_TEST_FOR_EACH_CONST_OP(action)\ + BOOST_TEST_FOR_EACH_COMP_OP(action) \ +/**/ + +#endif + +//____________________________________________________________________________// + +#define BOOST_TEST_FOR_EACH_MUT_OP(action) \ + action( = , SET , = ) \ + action( +=, IADD, += ) \ + action( -=, ISUB, -= ) \ + action( *=, IMUL, *= ) \ + action( /=, IDIV, /= ) \ + action( %=, IMOD, %= ) \ + action(<<=, ILSH, <<=) \ + action(>>=, IRSH, >>=) \ + action( &=, IAND, &= ) \ + action( ^=, IXOR, ^= ) \ + action( |=, IOR , |= ) \ +/**/ + +//____________________________________________________________________________// + +#ifndef BOOST_NO_CXX11_DECLTYPE +# define DEDUCE_RESULT_TYPE( oper ) \ + decltype(boost::declval() oper boost::declval() ) optype; \ + typedef typename boost::remove_reference::type \ +/**/ +#else +# define DEDUCE_RESULT_TYPE( oper ) bool +#endif + +#define DEFINE_CONST_OPER( oper, name, rev ) \ +template \ +struct name { \ + typedef DEDUCE_RESULT_TYPE( oper ) result_type; \ + \ + static result_type \ + eval( Lhs const& lhs, Rhs const& rhs ) \ + { \ + return lhs oper rhs; \ + } \ + \ + template \ + static void \ + report( std::ostream& ostr, \ + PrevExprType const& lhs, \ + Rhs const& rhs) \ + { \ + lhs.report( ostr ); \ + ostr << revert() \ + << tt_detail::print_helper( rhs ); \ + } \ + \ + static char const* revert() \ + { return " " #rev " "; } \ +}; \ +/**/ + +BOOST_TEST_FOR_EACH_CONST_OP( DEFINE_CONST_OPER ) + +#undef DEDUCE_RESULT_TYPE +#undef DEFINE_CONST_OPER + +//____________________________________________________________________________// + +} // namespace op + +// ************************************************************************** // +// ************** assertion::expression_base ************** // +// ************************************************************************** // +// Defines expression operators + +template class binary_expr; + +template +class expression_base { +public: + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template + struct RhsT : remove_const::type> {}; + +#define ADD_OP_SUPPORT( oper, name, _ ) \ + template \ + binary_expr::type> > \ + operator oper( T&& rhs ) \ + { \ + return binary_expr::type> > \ + ( std::forward( \ + *static_cast(this) ), \ + std::forward(rhs) ); \ + } \ +/**/ +#else + +#define ADD_OP_SUPPORT( oper, name, _ ) \ + template \ + binary_expr::type, \ + op::name::type> >\ + operator oper( T const& rhs ) const \ + { \ + typedef typename boost::decay::type Rhs; \ + return binary_expr > \ + ( *static_cast(this), \ + rhs ); \ + } \ +/**/ +#endif + + BOOST_TEST_FOR_EACH_CONST_OP( ADD_OP_SUPPORT ) + #undef ADD_OP_SUPPORT + +#ifndef BOOST_NO_CXX11_AUTO_DECLARATIONS + // Disabled operators + template + ExprType& + operator ||( T const& /*rhs*/ ) + { + BOOST_MPL_ASSERT_MSG(false, CANT_USE_LOGICAL_OPERATOR_OR_WITHIN_THIS_TESTING_TOOL, () ); + + return *static_cast(this); + } + + template + ExprType& + operator &&( T const& /*rhs*/ ) + { + BOOST_MPL_ASSERT_MSG(false, CANT_USE_LOGICAL_OPERATOR_AND_WITHIN_THIS_TESTING_TOOL, () ); + + return *static_cast(this); + } + + operator bool() + { + BOOST_MPL_ASSERT_MSG(false, CANT_USE_TERNARY_OPERATOR_WITHIN_THIS_TESTING_TOOL, () ); + + return false; + } +#endif +}; + +// ************************************************************************** // +// ************** assertion::value_expr ************** // +// ************************************************************************** // +// simple value expression + +template +class value_expr : public expression_base,typename remove_const::type>::type> { +public: + // Public types + typedef T result_type; + + // Constructor +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + value_expr( value_expr&& ve ) + : m_value( std::forward(ve.m_value) ) + {} + explicit value_expr( T&& val ) + : m_value( std::forward(val) ) + {} +#else + explicit value_expr( T const& val ) + : m_value( val ) + {} +#endif + + // Specific expression interface + T const& value() const + { + return m_value; + } + void report( std::ostream& ostr ) const + { + ostr << tt_detail::print_helper( m_value ); + } + + // Mutating operators +#define ADD_OP_SUPPORT( OPER, ID, _ ) \ + template \ + value_expr& \ + operator OPER( U const& rhs ) \ + { \ + m_value OPER rhs; \ + \ + return *this; \ + } \ +/**/ + + BOOST_TEST_FOR_EACH_MUT_OP( ADD_OP_SUPPORT ) +#undef ADD_OP_SUPPORT + + // expression interface + assertion_result evaluate( bool no_message = false ) const + { + assertion_result res( value() ); + if( no_message || res ) + return res; + + format_message( res.message(), value() ); + + return tt_detail::format_assertion_result( "", res.message().str() ); + } + +private: + template + static void format_message( wrap_stringstream& ostr, U const& v ) { ostr << "[(bool)" << v << " is false]"; } + static void format_message( wrap_stringstream& /*ostr*/, bool /*v*/ ) {} + static void format_message( wrap_stringstream& /*ostr*/, assertion_result const& /*v*/ ) {} + + // Data members + T m_value; +}; + +// ************************************************************************** // +// ************** assertion::binary_expr ************** // +// ************************************************************************** // +// binary expression + +template +class binary_expr : public expression_base,typename OP::result_type> { +public: + // Public types + typedef typename OP::result_type result_type; + + // Constructor +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + binary_expr( binary_expr&& be ) + : m_lhs( std::forward(be.m_lhs) ) + , m_rhs( std::forward(be.m_rhs) ) + {} + binary_expr( LExpr&& lhs, Rhs&& rhs ) + : m_lhs( std::forward(lhs) ) + , m_rhs( std::forward(rhs) ) + {} +#else + binary_expr( LExpr const& lhs, Rhs const& rhs ) + : m_lhs( lhs ) + , m_rhs( rhs ) + {} +#endif + + // Specific expression interface + result_type value() const + { + return OP::eval( m_lhs.value(), m_rhs ); + } + void report( std::ostream& ostr ) const + { + return OP::report( ostr, m_lhs, m_rhs ); + } + + assertion_result evaluate( bool no_message = false ) const + { + assertion_result const expr_res( value() ); + if( no_message || expr_res ) + return expr_res; + + wrap_stringstream buff; + report( buff.stream() ); + + return tt_detail::format_assertion_result( buff.stream().str(), expr_res.message() ); + } + + // To support custom manipulators + LExpr const& lhs() const { return m_lhs; } + Rhs const& rhs() const { return m_rhs; } +private: + // Data members + LExpr m_lhs; + Rhs m_rhs; +}; + +// ************************************************************************** // +// ************** assertion::seed ************** // +// ************************************************************************** // +// seed added ot the input expression to form an assertion expression + +class seed { +public: + // ->* is highest precedence left to right operator + template + value_expr +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + operator->*( T&& v ) const + { + return value_expr( std::forward( v ) ); + } +#else + operator->*( T const& v ) const + { + return value_expr( v ); + } +#endif +}; + +#undef BOOST_TEST_FOR_EACH_CONST_OP + +} // namespace assertion +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER diff --git a/libraries/boost/include/boost/test/tools/assertion_result.hpp b/libraries/boost/include/boost/test/tools/assertion_result.hpp new file mode 100644 index 0000000000..85eea741f7 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/assertion_result.hpp @@ -0,0 +1,90 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Enhanced result for test predicate that include message explaining failure +// *************************************************************************** + +#ifndef BOOST_TEST_PREDICATE_RESULT_HPP_012705GER +#define BOOST_TEST_PREDICATE_RESULT_HPP_012705GER + +// Boost.Test +#include +#include +#include + +// Boost +#include +#include + +// STL +#include // for std::size_t + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { + +// ************************************************************************** // +// ************** assertion_result ************** // +// ************************************************************************** // + +//!@brief Type used for storing the result of an assertion. +class BOOST_TEST_DECL assertion_result { + + //!@internal + typedef unit_test::const_string const_string; + + //!@internal + struct dummy { void nonnull() {} }; + + //!@internal + typedef void (dummy::*safe_bool)(); + +public: + // Constructor + assertion_result( bool pv_ ) + : p_predicate_value( pv_ ) + {} + + template + assertion_result( BoolConvertable const& pv_ ) : p_predicate_value( !!pv_ ) {} + + // Access methods + bool operator!() const { return !p_predicate_value; } + void operator=( bool pv_ ) { p_predicate_value.value = pv_; } + operator safe_bool() const { return !!p_predicate_value ? &dummy::nonnull : 0; } + + // Public properties + BOOST_READONLY_PROPERTY( bool, (assertion_result) ) p_predicate_value; + + // Access methods + bool has_empty_message() const { return !m_message; } + wrap_stringstream& message() + { + if( !m_message ) + m_message.reset( new wrap_stringstream ); + + return *m_message; + } + const_string message() const { return !m_message ? const_string() : const_string( m_message->str() ); } + +private: + // Data members + shared_ptr m_message; +}; + +typedef assertion_result predicate_result; + +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_PREDICATE_RESULT_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/collection_comparison_op.hpp b/libraries/boost/include/boost/test/tools/collection_comparison_op.hpp new file mode 100644 index 0000000000..864103fb4a --- /dev/null +++ b/libraries/boost/include/boost/test/tools/collection_comparison_op.hpp @@ -0,0 +1,449 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief Collection comparison with enhanced reporting +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER +#define BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER + +// Boost.Test +#include + +#include +#include + +// Boost +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { +namespace assertion { + +// ************************************************************************** // +// ************* selectors for specialized comparizon routines ************** // +// ************************************************************************** // + +template +struct specialized_compare : public mpl::false_ {}; + +template +struct is_c_array : public mpl::false_ {}; + +template +struct is_c_array : public mpl::true_ {}; + +template +struct is_c_array : public mpl::true_ {}; + +#define BOOST_TEST_SPECIALIZED_COLLECTION_COMPARE(Col) \ +namespace boost { namespace test_tools { namespace assertion { \ +template<> \ +struct specialized_compare : public mpl::true_ {}; \ +}}} \ +/**/ + +// ************************************************************************** // +// ************** lexicographic_compare ************** // +// ************************************************************************** // + +namespace op { + +template +inline +typename boost::enable_if_c< + unit_test::is_forward_iterable::value && !unit_test::is_cstring::value + && unit_test::is_forward_iterable::value && !unit_test::is_cstring::value, + assertion_result>::type +lexicographic_compare( Lhs const& lhs, Rhs const& rhs ) +{ + assertion_result ar( true ); + + typedef unit_test::bt_iterator_traits t_Lhs_iterator; + typedef unit_test::bt_iterator_traits t_Rhs_iterator; + + typename t_Lhs_iterator::const_iterator first1 = t_Lhs_iterator::begin(lhs); + typename t_Rhs_iterator::const_iterator first2 = t_Rhs_iterator::begin(rhs); + typename t_Lhs_iterator::const_iterator last1 = t_Lhs_iterator::end(lhs); + typename t_Rhs_iterator::const_iterator last2 = t_Rhs_iterator::end(rhs); + std::size_t pos = 0; + + for( ; (first1 != last1) && (first2 != last2); ++first1, ++first2, ++pos ) { + assertion_result const& element_ar = OP::eval(*first1, *first2); + if( !can_be_equal && element_ar ) + return ar; // a < b + + assertion_result const& reverse_ar = OP::eval(*first2, *first1); + if( element_ar && !reverse_ar ) + return ar; // a<=b and !(b<=a) => a < b => return true + + if( element_ar || !reverse_ar ) + continue; // (a<=b and b<=a) or (!(a a == b => keep looking + + // !(a<=b) and b<=a => b < a => return false + ar = false; + ar.message() << "\nFailure at position " << pos << ": " + << tt_detail::print_helper(*first1) + << OP::revert() + << tt_detail::print_helper(*first2) + << ". " << element_ar.message(); + return ar; + } + + if( first1 != last1 ) { + if( prefer_shorter ) { + ar = false; + ar.message() << "\nFirst collection has extra trailing elements."; + } + } + else if( first2 != last2 ) { + if( !prefer_shorter ) { + ar = false; + ar.message() << "\nSecond collection has extra trailing elements."; + } + } + else if( !can_be_equal ) { + ar = false; + ar.message() << "\nCollections appear to be equal."; + } + + return ar; +} + +template +inline +typename boost::enable_if_c< + (unit_test::is_cstring::value || unit_test::is_cstring::value), + assertion_result>::type +lexicographic_compare( Lhs const& lhs, Rhs const& rhs ) +{ + typedef typename unit_test::deduce_cstring::type lhs_char_type; + typedef typename unit_test::deduce_cstring::type rhs_char_type; + + return lexicographic_compare( + lhs_char_type(lhs), + rhs_char_type(rhs)); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** equality_compare ************** // +// ************************************************************************** // + +template +inline +typename boost::enable_if_c< + unit_test::is_forward_iterable::value && !unit_test::is_cstring::value + && unit_test::is_forward_iterable::value && !unit_test::is_cstring::value, + assertion_result>::type +element_compare( Lhs const& lhs, Rhs const& rhs ) +{ + typedef unit_test::bt_iterator_traits t_Lhs_iterator; + typedef unit_test::bt_iterator_traits t_Rhs_iterator; + + assertion_result ar( true ); + + if( t_Lhs_iterator::size(lhs) != t_Rhs_iterator::size(rhs) ) { + ar = false; + ar.message() << "\nCollections size mismatch: " << t_Lhs_iterator::size(lhs) << " != " << t_Rhs_iterator::size(rhs); + return ar; + } + + typename t_Lhs_iterator::const_iterator left = t_Lhs_iterator::begin(lhs); + typename t_Rhs_iterator::const_iterator right = t_Rhs_iterator::begin(rhs); + std::size_t pos = 0; + + for( ; pos < t_Lhs_iterator::size(lhs); ++left, ++right, ++pos ) { + assertion_result const element_ar = OP::eval( *left, *right ); + if( element_ar ) + continue; + + ar = false; + ar.message() << "\nMismatch at position " << pos << ": " + << tt_detail::print_helper(*left) + << OP::revert() + << tt_detail::print_helper(*right) + << ". " << element_ar.message(); + } + + return ar; +} + +// In case string comparison is branching here +template +inline +typename boost::enable_if_c< + (unit_test::is_cstring::value || unit_test::is_cstring::value), + assertion_result>::type +element_compare( Lhs const& lhs, Rhs const& rhs ) +{ + typedef typename unit_test::deduce_cstring::type lhs_char_type; + typedef typename unit_test::deduce_cstring::type rhs_char_type; + + return element_compare(lhs_char_type(lhs), + rhs_char_type(rhs)); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** non_equality_compare ************** // +// ************************************************************************** // + +template +inline assertion_result +non_equality_compare( Lhs const& lhs, Rhs const& rhs ) +{ + typedef unit_test::bt_iterator_traits t_Lhs_iterator; + typedef unit_test::bt_iterator_traits t_Rhs_iterator; + + assertion_result ar( true ); + + if( t_Lhs_iterator::size(lhs) != t_Rhs_iterator::size(rhs) ) + return ar; + + typename t_Lhs_iterator::const_iterator left = t_Lhs_iterator::begin(lhs); + typename t_Rhs_iterator::const_iterator right = t_Rhs_iterator::begin(rhs); + typename t_Lhs_iterator::const_iterator end = t_Lhs_iterator::end(lhs); + + for( ; left != end; ++left, ++right ) { + if( OP::eval( *left, *right ) ) + return ar; + } + + ar = false; + ar.message() << "\nCollections appear to be equal"; + + return ar; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** cctraits ************** // +// ************************************************************************** // +// set of collection comparison traits per comparison OP + +template +struct cctraits; + +template +struct cctraits > { + typedef specialized_compare is_specialized; +}; + +template +struct cctraits > { + typedef specialized_compare is_specialized; +}; + +template +struct cctraits > { + static const bool can_be_equal = false; + static const bool prefer_short = true; + + typedef specialized_compare is_specialized; +}; + +template +struct cctraits > { + static const bool can_be_equal = true; + static const bool prefer_short = true; + + typedef specialized_compare is_specialized; +}; + +template +struct cctraits > { + static const bool can_be_equal = false; + static const bool prefer_short = false; + + typedef specialized_compare is_specialized; +}; + +template +struct cctraits > { + static const bool can_be_equal = true; + static const bool prefer_short = false; + + typedef specialized_compare is_specialized; +}; + +// ************************************************************************** // +// ************** compare_collections ************** // +// ************************************************************************** // +// Overloaded set of functions dispatching to specific implementation of comparison + +template +inline assertion_result +compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::true_ ) +{ + return assertion::op::element_compare >( lhs, rhs ); +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) +{ + return lhs == rhs; +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::true_ ) +{ + return assertion::op::non_equality_compare >( lhs, rhs ); +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) +{ + return lhs != rhs; +} + +//____________________________________________________________________________// + +template +inline assertion_result +lexicographic_compare( Lhs const& lhs, Rhs const& rhs ) +{ + return assertion::op::lexicographic_compare::can_be_equal, cctraits::prefer_short>( lhs, rhs ); +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type*, mpl::true_ ) +{ + return lexicographic_compare( lhs, rhs ); +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) +{ + return lhs < rhs; +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) +{ + return lhs <= rhs; +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) +{ + return lhs > rhs; +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) +{ + return lhs >= rhs; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ********* specialization of comparison operators for collections ********* // +// ************************************************************************** // + +#define DEFINE_COLLECTION_COMPARISON( oper, name, rev ) \ +template \ +struct name::value \ + && !unit_test::is_cstring_comparable::value \ + && unit_test::is_forward_iterable::value \ + && !unit_test::is_cstring_comparable::value>::type> { \ +public: \ + typedef assertion_result result_type; \ + typedef unit_test::bt_iterator_traits t_Lhs_iterator_helper; \ + typedef unit_test::bt_iterator_traits t_Rhs_iterator_helper; \ + \ + typedef name OP; \ + \ + typedef typename \ + mpl::if_c< \ + mpl::or_< \ + typename is_c_array::type, \ + typename is_c_array::type \ + >::value, \ + mpl::true_, \ + typename \ + mpl::if_c::type, \ + typename decay::type>::value, \ + typename cctraits::is_specialized, \ + mpl::false_>::type \ + >::type is_specialized; \ + \ + typedef name elem_op; \ + \ + static assertion_result \ + eval( Lhs const& lhs, Rhs const& rhs) \ + { \ + return assertion::op::compare_collections( lhs, rhs, \ + (boost::type*)0, \ + is_specialized() ); \ + } \ + \ + template \ + static void \ + report( std::ostream&, \ + PrevExprType const&, \ + Rhs const& ) {} \ + \ + static char const* revert() \ + { return " " #rev " "; } \ + \ +}; \ +/**/ + +BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_COLLECTION_COMPARISON ) +#undef DEFINE_COLLECTION_COMPARISON + +//____________________________________________________________________________// + +} // namespace op +} // namespace assertion +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER diff --git a/libraries/boost/include/boost/test/tools/context.hpp b/libraries/boost/include/boost/test/tools/context.hpp new file mode 100644 index 0000000000..71650065ef --- /dev/null +++ b/libraries/boost/include/boost/test/tools/context.hpp @@ -0,0 +1,65 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 74248 $ +// +// Description : test tools context interfaces +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER +#define BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER + +// Boost.Test +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { +namespace tt_detail { + +// ************************************************************************** // +// ************** context_frame ************** // +// ************************************************************************** // + +struct BOOST_TEST_DECL context_frame { + explicit context_frame( ::boost::unit_test::lazy_ostream const& context_descr ); + ~context_frame(); + + operator bool(); + +private: + // Data members + int m_frame_id; +}; + +//____________________________________________________________________________// + +#define BOOST_TEST_INFO( context_descr ) \ + ::boost::unit_test::framework::add_context( BOOST_TEST_LAZY_MSG( context_descr ) , false ) \ +/**/ + +//____________________________________________________________________________// + +#define BOOST_TEST_CONTEXT( context_descr ) \ + if( ::boost::test_tools::tt_detail::context_frame BOOST_JOIN( context_frame_, __LINE__ ) = \ + ::boost::test_tools::tt_detail::context_frame( BOOST_TEST_LAZY_MSG( context_descr ) ) ) \ +/**/ + +//____________________________________________________________________________// + +} // namespace tt_detail +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER diff --git a/libraries/boost/include/boost/test/tools/cstring_comparison_op.hpp b/libraries/boost/include/boost/test/tools/cstring_comparison_op.hpp new file mode 100644 index 0000000000..50f181d858 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/cstring_comparison_op.hpp @@ -0,0 +1,88 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief C string comparison with enhanced reporting +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER +#define BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER + +// Boost.Test +#include + +#include +#include + +// Boost +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { +namespace assertion { +namespace op { + +// ************************************************************************** // +// ************** string_compare ************** // +// ************************************************************************** // + +#define DEFINE_CSTRING_COMPARISON( oper, name, rev ) \ +template \ +struct name::value \ + && unit_test::is_cstring_comparable::value) \ + >::type > \ +{ \ + typedef typename unit_test::deduce_cstring::type lhs_char_type; \ + typedef typename unit_test::deduce_cstring::type rhs_char_type; \ +public: \ + typedef assertion_result result_type; \ + \ + typedef name< \ + typename lhs_char_type::value_type, \ + typename rhs_char_type::value_type> elem_op; \ + \ + static bool \ + eval( Lhs const& lhs, Rhs const& rhs) \ + { \ + return lhs_char_type(lhs) oper rhs_char_type(rhs); \ + } \ + \ + template \ + static void \ + report( std::ostream& ostr, \ + PrevExprType const& lhs, \ + Rhs const& rhs) \ + { \ + lhs.report( ostr ); \ + ostr << revert() \ + << tt_detail::print_helper( rhs ); \ + } \ + \ + static char const* revert() \ + { return " " #rev " "; } \ +}; \ +/**/ + +BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_CSTRING_COMPARISON ) +#undef DEFINE_CSTRING_COMPARISON + +//____________________________________________________________________________// + +} // namespace op +} // namespace assertion +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER + diff --git a/libraries/boost/include/boost/test/tools/detail/bitwise_manip.hpp b/libraries/boost/include/boost/test/tools/detail/bitwise_manip.hpp new file mode 100644 index 0000000000..f8c9685c10 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/detail/bitwise_manip.hpp @@ -0,0 +1,123 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! Bitwise comparison manipulator implementation +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER +#define BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER + +// Boost Test +#include +#include + +#include +#include + +// STL +#include // for CHAR_BIT + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { + +// ************************************************************************** // +// ************** bitwise comparison manipulator ************** // +// ************************************************************************** // + +//! Bitwise comparison manipulator +struct bitwise {}; + +//____________________________________________________________________________// + +inline int +operator<<( unit_test::lazy_ostream const&, bitwise ) { return 0; } + +//____________________________________________________________________________// + +namespace tt_detail { + +/*!@brief Bitwise comparison of two operands + * + * This class constructs an @ref assertion_result that contains precise bit comparison information. + * In particular the location of the mismatches (if any) are printed in the assertion result. + */ +template +inline assertion_result +bitwise_compare(Lhs const& lhs, Rhs const& rhs, E const& expr ) +{ + assertion_result pr( true ); + + std::size_t left_bit_size = sizeof(Lhs)*CHAR_BIT; + std::size_t right_bit_size = sizeof(Rhs)*CHAR_BIT; + + static Lhs const leftOne( 1 ); + static Rhs const rightOne( 1 ); + + std::size_t total_bits = left_bit_size < right_bit_size ? left_bit_size : right_bit_size; + + for( std::size_t counter = 0; counter < total_bits; ++counter ) { + if( (lhs & ( leftOne << counter )) != (rhs & (rightOne << counter)) ) { + if( pr ) { + pr.message() << " ["; + expr.report( pr.message().stream() ); + pr.message() << "]. Bitwise comparison failed"; + pr = false; + } + pr.message() << "\nMismatch at position " << counter; + } + } + + if( left_bit_size != right_bit_size ) { + if( pr ) { + pr.message() << " ["; + expr.report( pr.message().stream() ); + pr.message() << "]. Bitwise comparison failed"; + pr = false; + } + pr.message() << "\nOperands bit sizes mismatch: " << left_bit_size << " != " << right_bit_size; + } + + return pr; +} + +//____________________________________________________________________________// + +//! Returns an assertion_result using the bitwise comparison out of an expression +//! +//! This is used as a modifer of the normal operator<< on expressions to use the +//! bitwise comparison. +//! +//! @note Available only for compilers supporting the @c auto declaration. +template +inline assertion_result +operator<<(assertion_evaluate_t > > const& ae, bitwise ) +{ + return bitwise_compare( ae.m_e.lhs().value(), ae.m_e.rhs(), ae.m_e ); +} + +//____________________________________________________________________________// + +inline check_type +operator<<( assertion_type const& , bitwise ) +{ + return CHECK_BUILT_ASSERTION; +} + +//____________________________________________________________________________// + +} // namespace tt_detail +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/detail/expression_holder.hpp b/libraries/boost/include/boost/test/tools/detail/expression_holder.hpp new file mode 100644 index 0000000000..694a2d5f4e --- /dev/null +++ b/libraries/boost/include/boost/test/tools/detail/expression_holder.hpp @@ -0,0 +1,70 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 74248 $ +// +// Description : toolbox implementation details +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER +#define BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER + +#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { +namespace tt_detail { + +// ************************************************************************** // +// ************** tt_detail::expression_holder ************** // +// ************************************************************************** // + +class expression_holder { +public: + virtual ~expression_holder() {} + virtual assertion_result evaluate( bool no_message = false ) const = 0; +}; + +//____________________________________________________________________________// + +template +class expression_holder_t: public expression_holder { +public: + explicit expression_holder_t( E const& e ) : m_expr( e ) {} + +private: + virtual assertion_result evaluate( bool no_message = false ) const { return m_expr.evaluate( no_message ); } + + E m_expr; +}; + +//____________________________________________________________________________// + +template +expression_holder_t +hold_expression( E const& e ) +{ + return expression_holder_t( e ); +} + +//____________________________________________________________________________// + +} // namespace tt_detail +} // namespace test_tools +} // namespace boost + +#include + +#endif + +#endif // BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/detail/fwd.hpp b/libraries/boost/include/boost/test/tools/detail/fwd.hpp new file mode 100644 index 0000000000..339ab39eda --- /dev/null +++ b/libraries/boost/include/boost/test/tools/detail/fwd.hpp @@ -0,0 +1,121 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 74248 $ +// +// Description : toolbox implementation types and forward declarations +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER +#define BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER + +// Boost.Test +#include +#include + +// STL +#include // for std::size_t + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +class lazy_ostream; + +} // namespace unit_test + +namespace test_tools { + +using unit_test::const_string; +class assertion_result; + +//____________________________________________________________________________// + +namespace tt_detail { + +inline bool dummy_cond() { return false; } + +// ************************************************************************** // +// ************** types of supported assertions ************** // +// ************************************************************************** // + +//____________________________________________________________________________// + +enum check_type { + CHECK_PRED, + CHECK_MSG, + CHECK_EQUAL, + CHECK_NE, + CHECK_LT, + CHECK_LE, + CHECK_GT, + CHECK_GE, + CHECK_CLOSE, + CHECK_CLOSE_FRACTION, + CHECK_SMALL, + CHECK_BITWISE_EQUAL, + CHECK_PRED_WITH_ARGS, + CHECK_EQUAL_COLL, + CHECK_BUILT_ASSERTION +}; + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** levels of supported assertions ************** // +// ************************************************************************** // + +enum tool_level { + WARN, CHECK, REQUIRE, PASS +}; + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** Tools offline implementation ************** // +// ************************************************************************** // + +BOOST_TEST_DECL bool +report_assertion( assertion_result const& pr, unit_test::lazy_ostream const& assertion_descr, + const_string file_name, std::size_t line_num, + tool_level tl, check_type ct, + std::size_t num_args, ... ); + +//____________________________________________________________________________// + +BOOST_TEST_DECL assertion_result +format_assertion_result( const_string expr_val, const_string details ); + +//____________________________________________________________________________// + +BOOST_TEST_DECL assertion_result +format_fpc_report( const_string expr_val, const_string details ); + +//____________________________________________________________________________// + +BOOST_TEST_DECL bool +is_defined_impl( const_string symbol_name, const_string symbol_value ); + +//____________________________________________________________________________// + +BOOST_TEST_DECL assertion_result +equal_impl( char const* left, char const* right ); + +//____________________________________________________________________________// + +} // namespace tt_detail +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/detail/indirections.hpp b/libraries/boost/include/boost/test/tools/detail/indirections.hpp new file mode 100644 index 0000000000..836218d98d --- /dev/null +++ b/libraries/boost/include/boost/test/tools/detail/indirections.hpp @@ -0,0 +1,94 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 74248 $ +// +// Description : inidiration interfaces to support manipulators and message output +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER +#define BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER + +// Boost.Test +#include + +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { +namespace tt_detail { + +// ************************************************************************** // +// ************** assertion_evaluate indirection ************** // +// ************************************************************************** // + +template +struct assertion_evaluate_t { + assertion_evaluate_t( E const& e ) : m_e( e ) {} + operator assertion_result() { return m_e.evaluate( true ); } + + E const& m_e; +}; + +//____________________________________________________________________________// + +template +inline assertion_evaluate_t +assertion_evaluate( E const& e ) { return assertion_evaluate_t( e ); } + +//____________________________________________________________________________// + +template +inline assertion_evaluate_t +operator<<( assertion_evaluate_t const& ae, T const& ) { return ae; } + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** assertion_text indirection ************** // +// ************************************************************************** // + +template +inline unit_test::lazy_ostream const& +assertion_text( unit_test::lazy_ostream const& /*et*/, T const& m ) { return m; } + +//____________________________________________________________________________// + +inline unit_test::lazy_ostream const& +assertion_text( unit_test::lazy_ostream const& et, int ) { return et; } + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** assertion_evaluate indirection ************** // +// ************************************************************************** // + +struct assertion_type { + operator check_type() { return CHECK_MSG; } +}; + +//____________________________________________________________________________// + +template +inline assertion_type +operator<<( assertion_type const& at, T const& ) { return at; } + +//____________________________________________________________________________// + +} // namespace tt_detail +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER diff --git a/libraries/boost/include/boost/test/tools/detail/it_pair.hpp b/libraries/boost/include/boost/test/tools/detail/it_pair.hpp new file mode 100644 index 0000000000..4352fd464f --- /dev/null +++ b/libraries/boost/include/boost/test/tools/detail/it_pair.hpp @@ -0,0 +1,74 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 74248 $ +// +// Description : support for backward compatible collection comparison interface +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER +#define BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER + +#ifdef BOOST_TEST_NO_OLD_TOOLS + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { +namespace tt_detail { + +// ************************************************************************** // +// ************** backward compatibility support ************** // +// ************************************************************************** // + +template +struct it_pair { + typedef It const_iterator; + typedef typename std::iterator_traits::value_type value_type; + + it_pair( It const& b, It const& e ) : m_begin( b ), m_size( 0 ) + { + It tmp = b; + while( tmp != e ) { ++m_size; ++tmp; } + } + + It begin() const { return m_begin; } + It end() const { return m_begin + m_size; } + size_t size() const { return m_size; } + +private: + It m_begin; + size_t m_size; +}; + +//____________________________________________________________________________// + +template +it_pair +make_it_pair( It const& b, It const& e ) { return it_pair( b, e ); } + +//____________________________________________________________________________// + +template +it_pair +make_it_pair( T const* b, T const* e ) { return it_pair( b, e ); } + +//____________________________________________________________________________// + +} // namespace tt_detail +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_NO_OLD_TOOLS + +#endif // BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER diff --git a/libraries/boost/include/boost/test/tools/detail/lexicographic_manip.hpp b/libraries/boost/include/boost/test/tools/detail/lexicographic_manip.hpp new file mode 100644 index 0000000000..f6ffff7a34 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/detail/lexicographic_manip.hpp @@ -0,0 +1,69 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! Lexicographic comparison manipulator implementation +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER +#define BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER + +// Boost Test +#include +#include + +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { + +// ************************************************************************** // +// ************** per element comparison manipulator ************** // +// ************************************************************************** // + +//! Lexicographic comparison manipulator, for containers +struct lexicographic {}; + +//____________________________________________________________________________// + +inline int +operator<<( unit_test::lazy_ostream const&, lexicographic ) { return 0; } + +//____________________________________________________________________________// + +namespace tt_detail { + +template +inline assertion_result +operator<<(assertion_evaluate_t > const& ae, lexicographic ) +{ + typedef typename OP::elem_op elem_op; + return assertion::op::lexicographic_compare( ae.m_e.lhs().value(), ae.m_e.rhs() ); +} + +//____________________________________________________________________________// + +inline check_type +operator<<( assertion_type const&, lexicographic ) +{ + return CHECK_BUILT_ASSERTION; +} + +//____________________________________________________________________________// + +} // namespace tt_detail +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER diff --git a/libraries/boost/include/boost/test/tools/detail/per_element_manip.hpp b/libraries/boost/include/boost/test/tools/detail/per_element_manip.hpp new file mode 100644 index 0000000000..4a9aebbaaa --- /dev/null +++ b/libraries/boost/include/boost/test/tools/detail/per_element_manip.hpp @@ -0,0 +1,69 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! Per element comparison manipulator implementation +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER +#define BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER + +// Boost Test +#include +#include + +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { + +// ************************************************************************** // +// ************** per element comparison manipulator ************** // +// ************************************************************************** // + +//! Per element comparison manipulator, for containers +struct per_element {}; + +//____________________________________________________________________________// + +inline int +operator<<( unit_test::lazy_ostream const&, per_element ) { return 0; } + +//____________________________________________________________________________// + +namespace tt_detail { + +template +inline assertion_result +operator<<(assertion_evaluate_t > const& ae, per_element ) +{ + typedef typename OP::elem_op elem_op; + return assertion::op::element_compare( ae.m_e.lhs().value(), ae.m_e.rhs() ); +} + +//____________________________________________________________________________// + +inline check_type +operator<<( assertion_type const&, per_element ) +{ + return CHECK_BUILT_ASSERTION; +} + +//____________________________________________________________________________// + +} // namespace tt_detail +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER diff --git a/libraries/boost/include/boost/test/tools/detail/print_helper.hpp b/libraries/boost/include/boost/test/tools/detail/print_helper.hpp new file mode 100644 index 0000000000..2c6a3b5e80 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/detail/print_helper.hpp @@ -0,0 +1,246 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 74248 $ +// +// Description : defines level of indiration facilitating workarounds for non printable types +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER +#define BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER + +// Boost.Test +#include +#include +#include + +// Boost +#include +#include +#include +#include +#include +#include + +#include + +#if !defined(BOOST_NO_CXX11_NULLPTR) +#include +#endif + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { +namespace tt_detail { + +// ************************************************************************** // +// ************** boost_test_print_type ************** // +// ************************************************************************** // + + namespace impl { + template + std::ostream& boost_test_print_type(std::ostream& ostr, T const& t) { + BOOST_STATIC_ASSERT_MSG( (boost::has_left_shift::value), + "Type has to implement operator<< to be printable"); + ostr << t; + return ostr; + } + + struct boost_test_print_type_impl { + template + std::ostream& operator()(std::ostream& ostr, R const& r) const { + return boost_test_print_type(ostr, r); + } + }; + } + + // To avoid ODR violations, see N4381 + template struct static_const { static const T value; }; + template const T static_const::value = T(); + + namespace { + static const impl::boost_test_print_type_impl& boost_test_print_type = + static_const::value; + } + + +// ************************************************************************** // +// ************** print_log_value ************** // +// ************************************************************************** // + +template +struct print_log_value { + void operator()( std::ostream& ostr, T const& t ) + { + typedef typename mpl::or_,is_function,is_abstract >::type cant_use_nl; + + std::streamsize old_precision = set_precision( ostr, cant_use_nl() ); + + //ostr << t; + using boost::test_tools::tt_detail::boost_test_print_type; + boost_test_print_type(ostr, t); + + if( old_precision != (std::streamsize)-1 ) + ostr.precision( old_precision ); + } + + std::streamsize set_precision( std::ostream& ostr, mpl::false_ ) + { + if( std::numeric_limits::is_specialized && std::numeric_limits::radix == 2 ) + return ostr.precision( 2 + std::numeric_limits::digits * 301/1000 ); + else if ( std::numeric_limits::is_specialized && std::numeric_limits::radix == 10 ) { +#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS + // (was BOOST_NO_NUMERIC_LIMITS_LOWEST but now deprecated). + // No support for std::numeric_limits::max_digits10, + // so guess that a couple of guard digits more than digits10 will display any difference. + return ostr.precision( 2 + std::numeric_limits::digits10 ); +#else + // std::numeric_limits::max_digits10; IS supported. + // Any noisy or guard digits needed to display any difference are included in max_digits10. + return ostr.precision( std::numeric_limits::max_digits10 ); +#endif + } + // else if T is not specialized for std::numeric_limits<>, + // then will just get the default precision of 6 digits. + return (std::streamsize)-1; + } + + std::streamsize set_precision( std::ostream&, mpl::true_ ) { return (std::streamsize)-1; } +}; + +//____________________________________________________________________________// + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +template +struct print_log_value< T[N] > { + void operator()( std::ostream& ostr, T const* t ) + { + ostr << t; + } +}; +#endif + +//____________________________________________________________________________// + +template<> +struct BOOST_TEST_DECL print_log_value { + void operator()( std::ostream& ostr, bool t ); +}; + +//____________________________________________________________________________// + +template<> +struct BOOST_TEST_DECL print_log_value { + void operator()( std::ostream& ostr, char t ); +}; + +//____________________________________________________________________________// + +template<> +struct BOOST_TEST_DECL print_log_value { + void operator()( std::ostream& ostr, unsigned char t ); +}; + +//____________________________________________________________________________// + +template<> +struct BOOST_TEST_DECL print_log_value { + void operator()( std::ostream& ostr, char const* t ); +}; + +//____________________________________________________________________________// + +template<> +struct BOOST_TEST_DECL print_log_value { + void operator()( std::ostream& ostr, wchar_t const* t ); +}; + +#if !defined(BOOST_NO_CXX11_NULLPTR) +template<> +struct print_log_value { + // declaration and definition is here because of #12969 https://svn.boost.org/trac10/ticket/12969 + void operator()( std::ostream& ostr, std::nullptr_t /*t*/ ) { + ostr << "nullptr"; + } +}; +#endif + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** print_helper ************** // +// ************************************************************************** // +// Adds level of indirection to the output operation, allowing us to customize +// it for types that do not support operator << directly or for any other reason + +template +struct print_helper_t { + explicit print_helper_t( T const& t ) : m_t( t ) {} + + T const& m_t; +}; + +//____________________________________________________________________________// + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +// Borland suffers premature pointer decay passing arrays by reference +template +struct print_helper_t< T[N] > { + explicit print_helper_t( T const * t ) : m_t( t ) {} + + T const * m_t; +}; +#endif + +//____________________________________________________________________________// + +template +inline print_helper_t +print_helper( T const& t ) +{ + return print_helper_t( t ); +} + +//____________________________________________________________________________// + +template +inline std::ostream& +operator<<( std::ostream& ostr, print_helper_t const& ph ) +{ + print_log_value()( ostr, ph.m_t ); + + return ostr; +} + +//____________________________________________________________________________// + +} // namespace tt_detail + +// ************************************************************************** // +// ************** BOOST_TEST_DONT_PRINT_LOG_VALUE ************** // +// ************************************************************************** // + +#define BOOST_TEST_DONT_PRINT_LOG_VALUE( the_type ) \ +namespace boost{ namespace test_tools{ namespace tt_detail{ \ +template<> \ +struct print_log_value { \ + void operator()( std::ostream&, the_type const& ) {} \ +}; \ +}}} \ +/**/ + +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/detail/tolerance_manip.hpp b/libraries/boost/include/boost/test/tools/detail/tolerance_manip.hpp new file mode 100644 index 0000000000..e07b043591 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/detail/tolerance_manip.hpp @@ -0,0 +1,130 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! @brief Floating point comparison tolerance manipulators +//! +//! This file defines several manipulators for floating point comparison. These +//! manipulators are intended to be used with BOOST_TEST. +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER +#define BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER + +// Boost Test +#include +#include + +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { +namespace tt_detail { + +// ************************************************************************** // +// ************** fpc tolerance manipulator ************** // +// ************************************************************************** // + +template +struct tolerance_manip { + explicit tolerance_manip( FPT const & tol ) : m_value( tol ) {} + + FPT m_value; +}; + +//____________________________________________________________________________// + +struct tolerance_manip_delay {}; + +template +inline tolerance_manip +operator%( FPT v, tolerance_manip_delay const& ) +{ + BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based::value), + "tolerance should be specified using a floating points type" ); + + return tolerance_manip( FPT(v / 100) ); +} + +//____________________________________________________________________________// + +template +inline assertion_result +operator<<(assertion_evaluate_t const& ae, tolerance_manip const& tol) +{ + local_fpc_tolerance lt( tol.m_value ); + + return ae.m_e.evaluate(); +} + +//____________________________________________________________________________// + +template +inline int +operator<<( unit_test::lazy_ostream const&, tolerance_manip const& ) { return 0; } + +//____________________________________________________________________________// + +template +inline check_type +operator<<( assertion_type const& /*at*/, tolerance_manip const& ) { return CHECK_BUILT_ASSERTION; } + +//____________________________________________________________________________// + +} // namespace tt_detail + + +/*! Tolerance manipulator + * + * These functions return a manipulator that can be used in conjunction with BOOST_TEST + * in order to specify the tolerance with which floating point comparisons are made. + */ +template +inline tt_detail::tolerance_manip +tolerance( FPT v ) +{ + BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based::value), + "tolerance only for floating points" ); + + return tt_detail::tolerance_manip( v ); +} + +//____________________________________________________________________________// + +//! @overload tolerance( FPT v ) +template +inline tt_detail::tolerance_manip +tolerance( fpc::percent_tolerance_t v ) +{ + BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based::value), + "tolerance only for floating points" ); + + return tt_detail::tolerance_manip( static_cast(v.m_value / 100) ); +} + +//____________________________________________________________________________// + +//! @overload tolerance( FPT v ) +inline tt_detail::tolerance_manip_delay +tolerance() +{ + return tt_detail::tolerance_manip_delay(); +} + +//____________________________________________________________________________// + +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/floating_point_comparison.hpp b/libraries/boost/include/boost/test/tools/floating_point_comparison.hpp new file mode 100644 index 0000000000..d704a41092 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/floating_point_comparison.hpp @@ -0,0 +1,315 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief algorithms for comparing floating point values +// *************************************************************************** + +#ifndef BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER +#define BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER + +// Boost.Test +#include +#include + +// Boost +#include // for std::numeric_limits +#include +#include +#include +#include +#include +#include +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace math { +namespace fpc { + +// ************************************************************************** // +// ************** fpc::tolerance_based ************** // +// ************************************************************************** // + + +//! @internal +//! Protects the instanciation of std::numeric_limits from non-supported types (eg. T=array) +template +struct tolerance_based_delegate; + +template +struct tolerance_based_delegate : mpl::false_ {}; + +template +struct tolerance_based_delegate +: mpl::bool_< + is_floating_point::value || + (!std::numeric_limits::is_integer && std::numeric_limits::is_specialized && !std::numeric_limits::is_exact)> +{}; + + +/*!@brief Indicates if a type can be compared using a tolerance scheme + * + * This is a metafunction that should evaluate to @c mpl::true_ if the type + * @c T can be compared using a tolerance based method, typically for floating point + * types. + * + * This metafunction can be specialized further to declare user types that are + * floating point (eg. boost.multiprecision). + */ +template +struct tolerance_based : tolerance_based_delegate::value >::type {}; + +// ************************************************************************** // +// ************** fpc::strength ************** // +// ************************************************************************** // + +//! Method for comparing floating point numbers +enum strength { + FPC_STRONG, //!< "Very close" - equation 2' in docs, the default + FPC_WEAK //!< "Close enough" - equation 3' in docs. +}; + + +// ************************************************************************** // +// ************** tolerance presentation types ************** // +// ************************************************************************** // + +template +struct percent_tolerance_t { + explicit percent_tolerance_t( FPT v ) : m_value( v ) {} + + FPT m_value; +}; + +//____________________________________________________________________________// + +template +inline std::ostream& operator<<( std::ostream& out, percent_tolerance_t t ) +{ + return out << t.m_value; +} + +//____________________________________________________________________________// + +template +inline percent_tolerance_t +percent_tolerance( FPT v ) +{ + return percent_tolerance_t( v ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** details ************** // +// ************************************************************************** // + +namespace fpc_detail { + +// FPT is Floating-Point Type: float, double, long double or User-Defined. +template +inline FPT +fpt_abs( FPT fpv ) +{ + return fpv < static_cast(0) ? -fpv : fpv; +} + +//____________________________________________________________________________// + +template +struct fpt_specialized_limits +{ + static FPT min_value() { return (std::numeric_limits::min)(); } + static FPT max_value() { return (std::numeric_limits::max)(); } +}; + +template +struct fpt_non_specialized_limits +{ + static FPT min_value() { return static_cast(0); } + static FPT max_value() { return static_cast(1000000); } // for our purposes it doesn't really matter what value is returned here +}; + +template +struct fpt_limits : boost::conditional::is_specialized, + fpt_specialized_limits, + fpt_non_specialized_limits + >::type +{}; + +//____________________________________________________________________________// + +// both f1 and f2 are unsigned here +template +inline FPT +safe_fpt_division( FPT f1, FPT f2 ) +{ + // Avoid overflow. + if( (f2 < static_cast(1)) && (f1 > f2*fpt_limits::max_value()) ) + return fpt_limits::max_value(); + + // Avoid underflow. + if( (f1 == static_cast(0)) || + ((f2 > static_cast(1)) && (f1 < f2*fpt_limits::min_value())) ) + return static_cast(0); + + return f1/f2; +} + +//____________________________________________________________________________// + +template +inline FPT +fraction_tolerance( ToleranceType tolerance ) +{ + return static_cast(tolerance); +} + +//____________________________________________________________________________// + +template +inline FPT2 +fraction_tolerance( percent_tolerance_t tolerance ) +{ + return FPT2(tolerance.m_value)*FPT2(0.01); +} + +//____________________________________________________________________________// + +} // namespace fpc_detail + +// ************************************************************************** // +// ************** close_at_tolerance ************** // +// ************************************************************************** // + + +/*!@brief Predicate for comparing floating point numbers + * + * This predicate is used to compare floating point numbers. In addition the comparison produces maximum + * related differnce, which can be used to generate detailed error message + * The methods for comparing floating points are detailed in the documentation. The method is chosen + * by the @ref boost::math::fpc::strength given at construction. + */ +template +class close_at_tolerance { +public: + // Public typedefs + typedef bool result_type; + + // Constructor + template + explicit close_at_tolerance( ToleranceType tolerance, fpc::strength fpc_strength = FPC_STRONG ) + : m_fraction_tolerance( fpc_detail::fraction_tolerance( tolerance ) ) + , m_strength( fpc_strength ) + , m_tested_rel_diff( 0 ) + { + BOOST_ASSERT_MSG( m_fraction_tolerance >= FPT(0), "tolerance must not be negative!" ); // no reason for tolerance to be negative + } + + // Access methods + //! Returns the tolerance + FPT fraction_tolerance() const { return m_fraction_tolerance; } + + //! Returns the comparison method + fpc::strength strength() const { return m_strength; } + + //! Returns the failing fraction + FPT tested_rel_diff() const { return m_tested_rel_diff; } + + /*! Compares two floating point numbers a and b such that their "left" relative difference |a-b|/a and/or + * "right" relative difference |a-b|/b does not exceed specified relative (fraction) tolerance. + * + * @param[in] left first floating point number to be compared + * @param[in] right second floating point number to be compared + * + * What is reported by @c tested_rel_diff in case of failure depends on the comparison method: + * - for @c FPC_STRONG: the max of the two fractions + * - for @c FPC_WEAK: the min of the two fractions + * The rationale behind is to report the tolerance to set in order to make a test pass. + */ + bool operator()( FPT left, FPT right ) const + { + FPT diff = fpc_detail::fpt_abs( left - right ); + FPT fraction_of_right = fpc_detail::safe_fpt_division( diff, fpc_detail::fpt_abs( right ) ); + FPT fraction_of_left = fpc_detail::safe_fpt_division( diff, fpc_detail::fpt_abs( left ) ); + + FPT max_rel_diff = (std::max)( fraction_of_left, fraction_of_right ); + FPT min_rel_diff = (std::min)( fraction_of_left, fraction_of_right ); + + m_tested_rel_diff = m_strength == FPC_STRONG ? max_rel_diff : min_rel_diff; + + return m_tested_rel_diff <= m_fraction_tolerance; + } + +private: + // Data members + FPT m_fraction_tolerance; + fpc::strength m_strength; + mutable FPT m_tested_rel_diff; +}; + +// ************************************************************************** // +// ************** small_with_tolerance ************** // +// ************************************************************************** // + + +/*!@brief Predicate for comparing floating point numbers against 0 + * + * Serves the same purpose as boost::math::fpc::close_at_tolerance, but used when one + * of the operand is null. + */ +template +class small_with_tolerance { +public: + // Public typedefs + typedef bool result_type; + + // Constructor + explicit small_with_tolerance( FPT tolerance ) // <= absolute tolerance + : m_tolerance( tolerance ) + { + BOOST_ASSERT( m_tolerance >= FPT(0) ); // no reason for the tolerance to be negative + } + + // Action method + bool operator()( FPT fpv ) const + { + return fpc::fpc_detail::fpt_abs( fpv ) <= m_tolerance; + } + +private: + // Data members + FPT m_tolerance; +}; + +// ************************************************************************** // +// ************** is_small ************** // +// ************************************************************************** // + +template +inline bool +is_small( FPT fpv, FPT tolerance ) +{ + return small_with_tolerance( tolerance )( fpv ); +} + +//____________________________________________________________________________// + +} // namespace fpc +} // namespace math +} // namespace boost + +#include + +#endif // BOOST_FLOATING_POINT_COMAPARISON_HPP_071894GER diff --git a/libraries/boost/include/boost/test/tools/fpc_op.hpp b/libraries/boost/include/boost/test/tools/fpc_op.hpp new file mode 100644 index 0000000000..b879d218f2 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/fpc_op.hpp @@ -0,0 +1,210 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief Floating point comparison with enhanced reporting +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER +#define BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER + +// Boost.Test +#include + +#include +#include + +// Boost +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { +namespace assertion { +namespace op { + +// ************************************************************************** // +// ************** fpctraits ************** // +// ************************************************************************** // +// set of floating point comparison traits per comparison OP + +template +struct fpctraits { + // indicate if we should perform the operation with a "logical OR" + // with the "equality under tolerance". + static const bool equality_logical_disjunction = true; +}; + +template +struct fpctraits > { + static const bool equality_logical_disjunction = false; +}; + +template +struct fpctraits > { + static const bool equality_logical_disjunction = false; +}; + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** set of overloads to select correct fpc algo ************** // +// ************************************************************************** // +// we really only care about EQ vs NE. All other comparisons use direct first +// and then need EQ. For example a <= b (tolerance t) IFF a <= b OR a == b (tolerance t) + +template +inline assertion_result +compare_fpv( Lhs const& lhs, Rhs const& rhs, OP* cmp_operator) +{ + bool result = cmp_operator->eval_direct(lhs, rhs); + if(fpctraits::equality_logical_disjunction) { + return result || compare_fpv(lhs, rhs, (op::EQ*)0); + } + return result && compare_fpv(lhs, rhs, (op::NE*)0); +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_fpv_near_zero( FPT const& fpv, op::EQ* ) +{ + fpc::small_with_tolerance P( fpc_tolerance() ); + + assertion_result ar( P( fpv ) ); + if( !ar ) + ar.message() << "Absolute value exceeds tolerance [|" << fpv << "| > "<< fpc_tolerance() << ']'; + + return ar; +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_fpv_near_zero( FPT const& fpv, op::NE* ) +{ + fpc::small_with_tolerance P( fpc_tolerance() ); + + assertion_result ar( !P( fpv ) ); + if( !ar ) + ar.message() << "Absolute value is within tolerance [|" << fpv << "| < "<< fpc_tolerance() << ']'; + return ar; +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_fpv( Lhs const& lhs, Rhs const& rhs, op::EQ* ) +{ + if( lhs == 0 ) { + return compare_fpv_near_zero( rhs, (op::EQ*)0 ); + } + else if( rhs == 0) { + return compare_fpv_near_zero( lhs, (op::EQ*)0 ); + } + else { + fpc::close_at_tolerance P( fpc_tolerance(), fpc::FPC_STRONG ); + + assertion_result ar( P( lhs, rhs ) ); + if( !ar ) + ar.message() << "Relative difference exceeds tolerance [" + << P.tested_rel_diff() << " > " << P.fraction_tolerance() << ']'; + return ar; + } +} + +//____________________________________________________________________________// + +template +inline assertion_result +compare_fpv( Lhs const& lhs, Rhs const& rhs, op::NE* ) +{ + if( lhs == 0 ) { + return compare_fpv_near_zero( rhs, (op::NE*)0 ); + } + else if( rhs == 0 ) { + return compare_fpv_near_zero( lhs, (op::NE*)0 ); + } + else { + fpc::close_at_tolerance P( fpc_tolerance(), fpc::FPC_WEAK ); + + assertion_result ar( !P( lhs, rhs ) ); + if( !ar ) + ar.message() << "Relative difference is within tolerance [" + << P.tested_rel_diff() << " < " << fpc_tolerance() << ']'; + + return ar; + } +} + +//____________________________________________________________________________// + +#define DEFINE_FPV_COMPARISON( oper, name, rev ) \ +template \ +struct name::value && \ + fpc::tolerance_based::value)>::type> { \ +public: \ + typedef typename common_type::type FPT; \ + typedef name OP; \ + \ + typedef assertion_result result_type; \ + \ + static bool \ + eval_direct( Lhs const& lhs, Rhs const& rhs ) \ + { \ + return lhs oper rhs; \ + } \ + \ + static assertion_result \ + eval( Lhs const& lhs, Rhs const& rhs ) \ + { \ + if( fpc_tolerance() == FPT(0) ) \ + { \ + return eval_direct( lhs, rhs ); \ + } \ + \ + return compare_fpv( lhs, rhs, (OP*)0 ); \ + } \ + \ + template \ + static void \ + report( std::ostream& ostr, \ + PrevExprType const& lhs, \ + Rhs const& rhs ) \ + { \ + lhs.report( ostr ); \ + ostr << revert() \ + << tt_detail::print_helper( rhs ); \ + } \ + \ + static char const* revert() \ + { return " " #rev " "; } \ +}; \ +/**/ + +BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_FPV_COMPARISON ) +#undef DEFINE_FPV_COMPARISON + +//____________________________________________________________________________// + +} // namespace op +} // namespace assertion +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER + diff --git a/libraries/boost/include/boost/test/tools/fpc_tolerance.hpp b/libraries/boost/include/boost/test/tools/fpc_tolerance.hpp new file mode 100644 index 0000000000..c862a17e75 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/fpc_tolerance.hpp @@ -0,0 +1,103 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 74248 $ +// +// Description : FPC tools tolerance holder +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER +#define BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER + +// Boost Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { + +namespace fpc = math::fpc; + +// ************************************************************************** // +// ************** floating point comparison tolerance ************** // +// ************************************************************************** // + +template +inline FPT& +fpc_tolerance() +{ + static FPT s_value = 0; + return s_value; +} + +//____________________________________________________________________________// + +template +struct local_fpc_tolerance { + local_fpc_tolerance( FPT fraction_tolerance ) : m_old_tolerance( fpc_tolerance() ) + { + fpc_tolerance() = fraction_tolerance; + } + + ~local_fpc_tolerance() + { + if( m_old_tolerance != (FPT)-1 ) + fpc_tolerance() = m_old_tolerance; + } + +private: + // Data members + FPT m_old_tolerance; +}; + +//____________________________________________________________________________// + +} // namespace test_tools + +// ************************************************************************** // +// ************** decorator::tolerance ************** // +// ************************************************************************** // + +namespace unit_test { +namespace decorator { + +template +inline fixture_t +tolerance( FPT v ) +{ + return fixture_t( test_unit_fixture_ptr( + new unit_test::class_based_fixture,FPT>( v ) ) ); +} + +//____________________________________________________________________________// + +template +inline fixture_t +tolerance( test_tools::fpc::percent_tolerance_t v ) +{ + return fixture_t( test_unit_fixture_ptr( + new unit_test::class_based_fixture,FPT>( boost::math::fpc::fpc_detail::fraction_tolerance( v ) ) ) ); +} + +//____________________________________________________________________________// + +} // namespace decorator + +using decorator::tolerance; + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER diff --git a/libraries/boost/include/boost/test/tools/interface.hpp b/libraries/boost/include/boost/test/tools/interface.hpp new file mode 100644 index 0000000000..5e84f1c6d4 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/interface.hpp @@ -0,0 +1,369 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 81247 $ +// +// Description : contains definition for all test tools in test toolbox +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER +#define BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER + +// Boost.Test +#include +#ifdef BOOST_TEST_TOOLS_DEBUGGABLE +#include +#endif +#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS +#include +#endif + +#include + +#ifdef BOOST_TEST_NO_OLD_TOOLS +#include + +#include +#endif // BOOST_TEST_NO_OLD_TOOLS + +#include + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** BOOST_TEST_ ************** // +// ************************************************************************** // + +#define BOOST_TEST_BUILD_ASSERTION( P ) \ + (::boost::test_tools::assertion::seed()->*P) \ +/**/ + +//____________________________________________________________________________// + +// Implementation based on direct predicate evaluation +#define BOOST_TEST_TOOL_DIRECT_IMPL( P, level, M ) \ +do { \ + ::boost::test_tools::assertion_result res = (P); \ + report_assertion( \ + res, \ + BOOST_TEST_LAZY_MSG( M ), \ + BOOST_TEST_L(__FILE__), \ + static_cast(__LINE__), \ + ::boost::test_tools::tt_detail::level, \ + ::boost::test_tools::tt_detail::CHECK_MSG, \ + 0 ); \ +} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ +/**/ + +//____________________________________________________________________________// + +// Implementation based on expression template construction +#define BOOST_TEST_TOOL_ET_IMPL( P, level ) \ +do { \ + BOOST_TEST_PASSPOINT(); \ + \ + ::boost::test_tools::tt_detail:: \ + report_assertion( \ + BOOST_TEST_BUILD_ASSERTION( P ).evaluate(), \ + BOOST_TEST_LAZY_MSG( BOOST_TEST_STRINGIZE( P ) ), \ + BOOST_TEST_L(__FILE__), \ + static_cast(__LINE__), \ + ::boost::test_tools::tt_detail::level, \ + ::boost::test_tools::tt_detail::CHECK_BUILT_ASSERTION, \ + 0 ); \ +} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ +/**/ + +//____________________________________________________________________________// + +// Implementation based on expression template construction with extra tool arguments +#define BOOST_TEST_TOOL_ET_IMPL_EX( P, level, arg ) \ +do { \ + BOOST_TEST_PASSPOINT(); \ + \ + ::boost::test_tools::tt_detail:: \ + report_assertion( \ + ::boost::test_tools::tt_detail::assertion_evaluate( \ + BOOST_TEST_BUILD_ASSERTION( P ) ) \ + << arg, \ + ::boost::test_tools::tt_detail::assertion_text( \ + BOOST_TEST_LAZY_MSG( BOOST_TEST_STRINGIZE(P) ), \ + BOOST_TEST_LAZY_MSG( arg ) ), \ + BOOST_TEST_L(__FILE__), \ + static_cast(__LINE__), \ + ::boost::test_tools::tt_detail::level, \ + ::boost::test_tools::tt_detail::assertion_type() \ + << arg, \ + 0 ); \ +} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ +/**/ + +//____________________________________________________________________________// + +#ifdef BOOST_TEST_TOOLS_UNDER_DEBUGGER + +#define BOOST_TEST_TOOL_UNIV( level, P ) \ + BOOST_TEST_TOOL_DIRECT_IMPL( P, level, BOOST_TEST_STRINGIZE( P ) ) \ +/**/ + +#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \ + BOOST_TEST_TOOL_UNIV( level, P ) \ +/**/ + +#elif defined(BOOST_TEST_TOOLS_DEBUGGABLE) + +#define BOOST_TEST_TOOL_UNIV( level, P ) \ +do { \ + if( ::boost::debug::under_debugger() ) \ + BOOST_TEST_TOOL_DIRECT_IMPL( P, level, BOOST_TEST_STRINGIZE( P ) ); \ + else \ + BOOST_TEST_TOOL_ET_IMPL( P, level ); \ +} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ +/**/ + +#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \ + BOOST_TEST_TOOL_UNIV( level, P ) \ +/**/ + +#else + +#define BOOST_TEST_TOOL_UNIV( level, P ) \ + BOOST_TEST_TOOL_ET_IMPL( P, level ) \ +/**/ + +#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \ + BOOST_TEST_TOOL_ET_IMPL_EX( P, level, __VA_ARGS__ ) \ +/**/ + +#endif + +//____________________________________________________________________________// + +#define BOOST_TEST_WARN( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ + 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, WARN, __VA_ARGS__ ) \ +/**/ +#define BOOST_TEST_CHECK( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ + 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, CHECK, __VA_ARGS__ ) \ +/**/ +#define BOOST_TEST_REQUIRE( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ + 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, REQUIRE, __VA_ARGS__ )\ +/**/ + +#define BOOST_TEST( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ + 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, CHECK, __VA_ARGS__ ) \ +/**/ + +//____________________________________________________________________________// + +#define BOOST_TEST_ERROR( M ) BOOST_CHECK_MESSAGE( false, M ) +#define BOOST_TEST_FAIL( M ) BOOST_REQUIRE_MESSAGE( false, M ) + +//____________________________________________________________________________// + +#define BOOST_TEST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( symb, BOOST_STRINGIZE(= symb) ) + +//____________________________________________________________________________// + +#ifdef BOOST_TEST_NO_OLD_TOOLS + +#ifdef BOOST_TEST_TOOLS_UNDER_DEBUGGER + +#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\ +do { try { \ + S; \ + BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \ +} catch( E ) { \ + BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \ +}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ +/**/ + +#elif defined(BOOST_TEST_TOOLS_DEBUGGABLE) + +#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\ +do { try { \ + if( ::boost::debug::under_debugger() ) \ + BOOST_TEST_PASSPOINT(); \ + S; \ + BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \ +} catch( E ) { \ + BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \ +}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ +/**/ + +#else + +#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\ +do { try { \ + BOOST_TEST_PASSPOINT(); \ + S; \ + BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \ +} catch( E ) { \ + BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \ +}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ +/**/ + +#endif + +//____________________________________________________________________________// + +#define BOOST_WARN_THROW( S, E ) \ + BOOST_CHECK_THROW_IMPL(S, E const&, WARN, \ + false, "exception " BOOST_STRINGIZE(E) " is expected", \ + true , "exception " BOOST_STRINGIZE(E) " is caught" ) \ +/**/ +#define BOOST_CHECK_THROW( S, E ) \ + BOOST_CHECK_THROW_IMPL(S, E const&, CHECK, \ + false, "exception " BOOST_STRINGIZE(E) " is expected", \ + true , "exception " BOOST_STRINGIZE(E) " is caught" ) \ +/**/ +#define BOOST_REQUIRE_THROW( S, E ) \ + BOOST_CHECK_THROW_IMPL(S, E const&, REQUIRE, \ + false, "exception " BOOST_STRINGIZE(E) " is expected", \ + true , "exception " BOOST_STRINGIZE(E) " is caught" ) \ +/**/ + +//____________________________________________________________________________// + +#define BOOST_WARN_EXCEPTION( S, E, P ) \ + BOOST_CHECK_THROW_IMPL(S, E const& ex, WARN, \ + false, "exception " BOOST_STRINGIZE(E) " is expected", \ + P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \ +/**/ +#define BOOST_CHECK_EXCEPTION( S, E, P ) \ + BOOST_CHECK_THROW_IMPL(S, E const& ex, CHECK, \ + false, "exception " BOOST_STRINGIZE(E) " is expected", \ + P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \ +/**/ +#define BOOST_REQUIRE_EXCEPTION( S, E, P ) \ + BOOST_CHECK_THROW_IMPL(S, E const& ex, REQUIRE, \ + false, "exception " BOOST_STRINGIZE(E) " is expected", \ + P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \ +/**/ + +//____________________________________________________________________________// + +#define BOOST_WARN_NO_THROW( S ) \ + BOOST_CHECK_THROW_IMPL(S, ..., WARN, \ + true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \ + false, "exception thrown by " BOOST_STRINGIZE( S ) ) \ +/**/ +#define BOOST_CHECK_NO_THROW( S ) \ + BOOST_CHECK_THROW_IMPL(S, ..., CHECK, \ + true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \ + false, "exception thrown by " BOOST_STRINGIZE( S ) ) \ +/**/ +#define BOOST_REQUIRE_NO_THROW( S ) \ + BOOST_CHECK_THROW_IMPL(S, ..., REQUIRE, \ + true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \ + false, "exception thrown by " BOOST_STRINGIZE( S ) ) \ +/**/ + +//____________________________________________________________________________// + +#define BOOST_WARN_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, WARN, M ) +#define BOOST_CHECK_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, CHECK, M ) +#define BOOST_REQUIRE_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, REQUIRE, M ) + +//____________________________________________________________________________// + +//////////////////////////////////////////////////////////////////////////////// +///////////////////////////// DEPRECATED TOOLS ///////////////////////////// + +#define BOOST_WARN( P ) BOOST_TEST_WARN( P ) +#define BOOST_CHECK( P ) BOOST_TEST_CHECK( P ) +#define BOOST_REQUIRE( P ) BOOST_TEST_REQUIRE( P ) + +//____________________________________________________________________________// + +#define BOOST_ERROR( M ) BOOST_TEST_ERROR( M ) +#define BOOST_FAIL( M ) BOOST_TEST_FAIL( M ) + +//____________________________________________________________________________// + +#define BOOST_WARN_EQUAL( L, R ) BOOST_TEST_WARN( L == R ) +#define BOOST_CHECK_EQUAL( L, R ) BOOST_TEST_CHECK( L == R ) +#define BOOST_REQUIRE_EQUAL( L, R ) BOOST_TEST_REQUIRE( L == R ) + +#define BOOST_WARN_NE( L, R ) BOOST_TEST_WARN( L != R ) +#define BOOST_CHECK_NE( L, R ) BOOST_TEST_CHECK( L != R ) +#define BOOST_REQUIRE_NE( L, R ) BOOST_TEST_REQUIRE( L != R ) + +#define BOOST_WARN_LT( L, R ) BOOST_TEST_WARN( L < R ) +#define BOOST_CHECK_LT( L, R ) BOOST_TEST_CHECK( L < R ) +#define BOOST_REQUIRE_LT( L, R ) BOOST_TEST_REQUIRE( L < R ) + +#define BOOST_WARN_LE( L, R ) BOOST_TEST_WARN( L <= R ) +#define BOOST_CHECK_LE( L, R ) BOOST_TEST_CHECK( L <= R ) +#define BOOST_REQUIRE_LE( L, R ) BOOST_TEST_REQUIRE( L <= R ) + +#define BOOST_WARN_GT( L, R ) BOOST_TEST_WARN( L > R ) +#define BOOST_CHECK_GT( L, R ) BOOST_TEST_CHECK( L > R ) +#define BOOST_REQUIRE_GT( L, R ) BOOST_TEST_REQUIRE( L > R ) + +#define BOOST_WARN_GE( L, R ) BOOST_TEST_WARN( L >= R ) +#define BOOST_CHECK_GE( L, R ) BOOST_TEST_CHECK( L >= R ) +#define BOOST_REQUIRE_GE( L, R ) BOOST_TEST_REQUIRE( L >= R ) + +//____________________________________________________________________________// + +#define BOOST_WARN_CLOSE( L, R, T ) BOOST_TEST_WARN( L == R, T % ::boost::test_tools::tolerance() ) +#define BOOST_CHECK_CLOSE( L, R, T ) BOOST_TEST_CHECK( L == R, T % ::boost::test_tools::tolerance() ) +#define BOOST_REQUIRE_CLOSE( L, R, T ) BOOST_TEST_REQUIRE( L == R, T % ::boost::test_tools::tolerance() ) + +#define BOOST_WARN_CLOSE_FRACTION(L, R, T) BOOST_TEST_WARN( L == R, ::boost::test_tools::tolerance( T ) ) +#define BOOST_CHECK_CLOSE_FRACTION(L, R, T) BOOST_TEST_CHECK( L == R, ::boost::test_tools::tolerance( T ) ) +#define BOOST_REQUIRE_CLOSE_FRACTION(L,R,T) BOOST_TEST_REQUIRE( L == R, ::boost::test_tools::tolerance( T ) ) + +#define BOOST_WARN_SMALL( FPV, T ) BOOST_TEST_WARN( FPV == 0., ::boost::test_tools::tolerance( T ) ) +#define BOOST_CHECK_SMALL( FPV, T ) BOOST_TEST_CHECK( FPV == 0., ::boost::test_tools::tolerance( T ) ) +#define BOOST_REQUIRE_SMALL( FPV, T ) BOOST_TEST_REQUIRE( FPV == 0., ::boost::test_tools::tolerance( T ) ) + +//____________________________________________________________________________// + +#define BOOST_WARN_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ + BOOST_TEST_WARN( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\ + ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \ + ::boost::test_tools::per_element() ) \ +/**/ + +#define BOOST_CHECK_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ + BOOST_TEST_CHECK( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\ + ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \ + ::boost::test_tools::per_element() ) \ +/**/ + +#define BOOST_REQUIRE_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ + BOOST_TEST_REQUIRE( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\ + ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \ + ::boost::test_tools::per_element() ) \ +/**/ + +//____________________________________________________________________________// + +#define BOOST_WARN_BITWISE_EQUAL( L, R ) BOOST_TEST_WARN( L == R, ::boost::test_tools::bitwise() ) +#define BOOST_CHECK_BITWISE_EQUAL( L, R ) BOOST_TEST_CHECK( L == R, ::boost::test_tools::bitwise() ) +#define BOOST_REQUIRE_BITWISE_EQUAL( L, R ) BOOST_TEST_REQUIRE( L == R, ::boost::test_tools::bitwise() ) + +//____________________________________________________________________________// + +#define BOOST_WARN_PREDICATE( P, ARGS ) BOOST_TEST_WARN( P BOOST_PP_SEQ_TO_TUPLE(ARGS) ) +#define BOOST_CHECK_PREDICATE( P, ARGS ) BOOST_TEST_CHECK( P BOOST_PP_SEQ_TO_TUPLE(ARGS) ) +#define BOOST_REQUIRE_PREDICATE( P, ARGS ) BOOST_TEST_REQUIRE( P BOOST_PP_SEQ_TO_TUPLE(ARGS) ) + +//____________________________________________________________________________// + +#define BOOST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( #symb, BOOST_STRINGIZE(= symb) ) + +//____________________________________________________________________________// + +#endif // BOOST_TEST_NO_OLD_TOOLS + +#include + +#endif // BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER diff --git a/libraries/boost/include/boost/test/tools/old/impl.hpp b/libraries/boost/include/boost/test/tools/old/impl.hpp new file mode 100644 index 0000000000..b975f61b38 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/old/impl.hpp @@ -0,0 +1,358 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 74248 $ +// +// Description : implementation details for old toolbox +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER +#define BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER + +// Boost.Test +#include +#include +#include + +#include +#include + +// Boost +#include +#include // for numeric::conversion_traits +#include + +#include +#include + +// STL +#include // for std::size_t +#include // for CHAR_BIT + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace test_tools { +namespace tt_detail { + +// ************************************************************************** // +// ************** old TOOLBOX Implementation ************** // +// ************************************************************************** // + +// This function adds level of indirection, but it makes sure we evaluate predicate +// arguments only once + +#ifndef BOOST_TEST_PROD +#define TEMPL_PARAMS( z, m, dummy ) , typename BOOST_JOIN( Arg, m ) + +#define FUNC_PARAMS( z, m, dummy ) \ + , BOOST_JOIN( Arg, m ) const& BOOST_JOIN( arg, m ) \ + , char const* BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \ +/**/ + +#define PRED_PARAMS( z, m, dummy ) BOOST_PP_COMMA_IF( m ) BOOST_JOIN( arg, m ) + +#define ARG_INFO( z, m, dummy ) \ + , BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \ + , &static_cast(unit_test::lazy_ostream::instance() \ + << ::boost::test_tools::tt_detail::print_helper( BOOST_JOIN( arg, m ) )) \ +/**/ + +#define IMPL_FRWD( z, n, dummy ) \ +template \ +inline bool \ +check_frwd( Pred P, unit_test::lazy_ostream const& assertion_descr, \ + const_string file_name, std::size_t line_num, \ + tool_level tl, check_type ct \ + BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), FUNC_PARAMS, _ ) \ +) \ +{ \ + return \ + report_assertion( P( BOOST_PP_REPEAT_ ## z(BOOST_PP_ADD(n, 1), PRED_PARAMS,_) ),\ + assertion_descr, file_name, line_num, tl, ct, \ + BOOST_PP_ADD( n, 1 ) \ + BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), ARG_INFO, _ ) \ + ); \ +} \ +/**/ + +#ifndef BOOST_TEST_MAX_PREDICATE_ARITY +#define BOOST_TEST_MAX_PREDICATE_ARITY 5 +#endif + +BOOST_PP_REPEAT( BOOST_TEST_MAX_PREDICATE_ARITY, IMPL_FRWD, _ ) + +#undef TEMPL_PARAMS +#undef FUNC_PARAMS +#undef PRED_INFO +#undef ARG_INFO +#undef IMPL_FRWD + +#endif + +//____________________________________________________________________________// + +template +inline assertion_result equal_impl( Left const& left, Right const& right ) +{ + return left == right; +} + +//____________________________________________________________________________// + +inline assertion_result equal_impl( char* left, char const* right ) { return equal_impl( static_cast(left), static_cast(right) ); } +inline assertion_result equal_impl( char const* left, char* right ) { return equal_impl( static_cast(left), static_cast(right) ); } +inline assertion_result equal_impl( char* left, char* right ) { return equal_impl( static_cast(left), static_cast(right) ); } + +#if !defined( BOOST_NO_CWCHAR ) +assertion_result BOOST_TEST_DECL equal_impl( wchar_t const* left, wchar_t const* right ); +inline assertion_result equal_impl( wchar_t* left, wchar_t const* right ) { return equal_impl( static_cast(left), static_cast(right) ); } +inline assertion_result equal_impl( wchar_t const* left, wchar_t* right ) { return equal_impl( static_cast(left), static_cast(right) ); } +inline assertion_result equal_impl( wchar_t* left, wchar_t* right ) { return equal_impl( static_cast(left), static_cast(right) ); } +#endif + +//____________________________________________________________________________// + +struct equal_impl_frwd { + template + inline assertion_result + call_impl( Left const& left, Right const& right, mpl::false_ ) const + { + return equal_impl( left, right ); + } + + template + inline assertion_result + call_impl( Left const& left, Right const& right, mpl::true_ ) const + { + return (*this)( right, &left[0] ); + } + + template + inline assertion_result + operator()( Left const& left, Right const& right ) const + { + typedef typename is_array::type left_is_array; + return call_impl( left, right, left_is_array() ); + } +}; + +//____________________________________________________________________________// + +struct ne_impl { + template + assertion_result operator()( Left const& left, Right const& right ) + { + return !equal_impl_frwd()( left, right ); + } +}; + +//____________________________________________________________________________// + +struct lt_impl { + template + assertion_result operator()( Left const& left, Right const& right ) + { + return left < right; + } +}; + +//____________________________________________________________________________// + +struct le_impl { + template + assertion_result operator()( Left const& left, Right const& right ) + { + return left <= right; + } +}; + +//____________________________________________________________________________// + +struct gt_impl { + template + assertion_result operator()( Left const& left, Right const& right ) + { + return left > right; + } +}; + +//____________________________________________________________________________// + +struct ge_impl { + template + assertion_result operator()( Left const& left, Right const& right ) + { + return left >= right; + } +}; + +//____________________________________________________________________________// + +struct equal_coll_impl { + template + assertion_result operator()( Left left_begin, Left left_end, Right right_begin, Right right_end ) + { + assertion_result pr( true ); + std::size_t pos = 0; + + for( ; left_begin != left_end && right_begin != right_end; ++left_begin, ++right_begin, ++pos ) { + if( *left_begin != *right_begin ) { + pr = false; + pr.message() << "\nMismatch at position " << pos << ": " + << ::boost::test_tools::tt_detail::print_helper(*left_begin) + << " != " + << ::boost::test_tools::tt_detail::print_helper(*right_begin); + } + } + + if( left_begin != left_end ) { + std::size_t r_size = pos; + while( left_begin != left_end ) { + ++pos; + ++left_begin; + } + + pr = false; + pr.message() << "\nCollections size mismatch: " << pos << " != " << r_size; + } + + if( right_begin != right_end ) { + std::size_t l_size = pos; + while( right_begin != right_end ) { + ++pos; + ++right_begin; + } + + pr = false; + pr.message() << "\nCollections size mismatch: " << l_size << " != " << pos; + } + + return pr; + } +}; + +//____________________________________________________________________________// + +struct bitwise_equal_impl { + template + assertion_result operator()( Left const& left, Right const& right ) + { + assertion_result pr( true ); + + std::size_t left_bit_size = sizeof(Left)*CHAR_BIT; + std::size_t right_bit_size = sizeof(Right)*CHAR_BIT; + + static Left const leftOne( 1 ); + static Right const rightOne( 1 ); + + std::size_t total_bits = left_bit_size < right_bit_size ? left_bit_size : right_bit_size; + + for( std::size_t counter = 0; counter < total_bits; ++counter ) { + if( ( left & ( leftOne << counter ) ) != ( right & ( rightOne << counter ) ) ) { + pr = false; + pr.message() << "\nMismatch at position " << counter; + } + } + + if( left_bit_size != right_bit_size ) { + pr = false; + pr.message() << "\nOperands bit sizes mismatch: " << left_bit_size << " != " << right_bit_size; + } + + return pr; + } +}; + +//____________________________________________________________________________// + +template +struct comp_supertype { + // deduce "better" type from types of arguments being compared + // if one type is floating and the second integral we use floating type and + // value of integral type is promoted to the floating. The same for float and double + // But we don't want to compare two values of integral types using this tool. + typedef typename numeric::conversion_traits::supertype type; + BOOST_STATIC_ASSERT_MSG( !is_integral::value, "Only floating-point types can be compared!"); +}; + +} // namespace tt_detail + +namespace fpc = math::fpc; + +// ************************************************************************** // +// ************** check_is_close ************** // +// ************************************************************************** // + +struct BOOST_TEST_DECL check_is_close_t { + // Public typedefs + typedef assertion_result result_type; + + template + assertion_result + operator()( FPT1 left, FPT2 right, ToleranceType tolerance ) const + { + fpc::close_at_tolerance::type> pred( tolerance, fpc::FPC_STRONG ); + + assertion_result ar( pred( left, right ) ); + + if( !ar ) + ar.message() << pred.tested_rel_diff(); + + return ar; + } +}; + +//____________________________________________________________________________// + +template +inline assertion_result +check_is_close( FPT1 left, FPT2 right, ToleranceType tolerance ) +{ + return check_is_close_t()( left, right, tolerance ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** check_is_small ************** // +// ************************************************************************** // + +struct BOOST_TEST_DECL check_is_small_t { + // Public typedefs + typedef bool result_type; + + template + bool + operator()( FPT fpv, FPT tolerance ) const + { + return fpc::is_small( fpv, tolerance ); + } +}; + +//____________________________________________________________________________// + +template +inline bool +check_is_small( FPT fpv, FPT tolerance ) +{ + return fpc::is_small( fpv, tolerance ); +} + +//____________________________________________________________________________// + +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/old/interface.hpp b/libraries/boost/include/boost/test/tools/old/interface.hpp new file mode 100644 index 0000000000..2d6f8b78c0 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/old/interface.hpp @@ -0,0 +1,282 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 81247 $ +// +// Description : contains definition for all test tools in old test toolbox +// *************************************************************************** + +#ifndef BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER +#define BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER + +// Boost +#include +#include +#include + +#include + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** TOOL BOX ************** // +// ************************************************************************** // + +// In macros below following argument abbreviations are used: +// P - predicate +// M - message +// S - statement +// E - exception +// L - left argument +// R - right argument +// TL - tool level +// CT - check type +// ARGS - arguments list (as PP sequence) + +// frwd_type: +// 0 - args exists and need to be forwarded; call check_frwd +// 1 - args exists, but do not need to be forwarded; call report_assertion directly +// 2 - no arguments; call report_assertion directly + +#define BOOST_TEST_TOOL_PASS_PRED0( P, ARGS ) P +#define BOOST_TEST_TOOL_PASS_PRED1( P, ARGS ) P BOOST_PP_SEQ_TO_TUPLE(ARGS) +#define BOOST_TEST_TOOL_PASS_PRED2( P, ARGS ) P + +#define BOOST_TEST_TOOL_PASS_ARG( r, _, arg ) , arg, BOOST_STRINGIZE( arg ) +#define BOOST_TEST_TOOL_PASS_ARG_DSCR( r, _, arg ) , BOOST_STRINGIZE( arg ) + +#define BOOST_TEST_TOOL_PASS_ARGS0( ARGS ) \ + BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_TOOL_PASS_ARG, _, ARGS ) +#define BOOST_TEST_TOOL_PASS_ARGS1( ARGS ) \ + , BOOST_PP_SEQ_SIZE(ARGS) BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_TOOL_PASS_ARG_DSCR, _, ARGS ) +#define BOOST_TEST_TOOL_PASS_ARGS2( ARGS ) \ + , 0 + +#define BOOST_TEST_TOOL_IMPL( frwd_type, P, assertion_descr, TL, CT, ARGS ) \ +do { \ + BOOST_TEST_PASSPOINT(); \ + ::boost::test_tools::tt_detail:: \ + BOOST_PP_IF( frwd_type, report_assertion, check_frwd ) ( \ + BOOST_JOIN( BOOST_TEST_TOOL_PASS_PRED, frwd_type )( P, ARGS ), \ + BOOST_TEST_LAZY_MSG( assertion_descr ), \ + BOOST_TEST_L(__FILE__), \ + static_cast(__LINE__), \ + ::boost::test_tools::tt_detail::TL, \ + ::boost::test_tools::tt_detail::CT \ + BOOST_JOIN( BOOST_TEST_TOOL_PASS_ARGS, frwd_type )( ARGS ) ); \ +} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ +/**/ + +//____________________________________________________________________________// + +#define BOOST_WARN( P ) BOOST_TEST_TOOL_IMPL( 2, \ + (P), BOOST_TEST_STRINGIZE( P ), WARN, CHECK_PRED, _ ) +#define BOOST_CHECK( P ) BOOST_TEST_TOOL_IMPL( 2, \ + (P), BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED, _ ) +#define BOOST_REQUIRE( P ) BOOST_TEST_TOOL_IMPL( 2, \ + (P), BOOST_TEST_STRINGIZE( P ), REQUIRE, CHECK_PRED, _ ) + +//____________________________________________________________________________// + +#define BOOST_WARN_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, WARN, CHECK_MSG, _ ) +#define BOOST_CHECK_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, CHECK, CHECK_MSG, _ ) +#define BOOST_REQUIRE_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, REQUIRE, CHECK_MSG, _ ) + +//____________________________________________________________________________// + +#define BOOST_ERROR( M ) BOOST_CHECK_MESSAGE( false, M ) +#define BOOST_FAIL( M ) BOOST_REQUIRE_MESSAGE( false, M ) + +//____________________________________________________________________________// + +#define BOOST_CHECK_THROW_IMPL( S, E, P, postfix, TL ) \ +do { \ + try { \ + BOOST_TEST_PASSPOINT(); \ + S; \ + BOOST_TEST_TOOL_IMPL( 2, false, "exception " BOOST_STRINGIZE(E) " expected but not raised", \ + TL, CHECK_MSG, _ ); \ + } catch( E const& ex ) { \ + ::boost::unit_test::ut_detail::ignore_unused_variable_warning( ex ); \ + BOOST_TEST_TOOL_IMPL( 2, P, \ + "exception \"" BOOST_STRINGIZE( E )"\" raised as expected" postfix, \ + TL, CHECK_MSG, _ ); \ + } \ +} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ +/**/ + +//____________________________________________________________________________// + +#define BOOST_WARN_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "", WARN ) +#define BOOST_CHECK_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "", CHECK ) +#define BOOST_REQUIRE_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "", REQUIRE ) + +//____________________________________________________________________________// + +#define BOOST_WARN_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), \ + ": validation on the raised exception through predicate \"" BOOST_STRINGIZE(P) "\"", WARN ) +#define BOOST_CHECK_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), \ + ": validation on the raised exception through predicate \"" BOOST_STRINGIZE(P) "\"", CHECK ) +#define BOOST_REQUIRE_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), \ + ": validation on the raised exception through predicate \"" BOOST_STRINGIZE(P) "\"", REQUIRE ) + +//____________________________________________________________________________// + +#define BOOST_CHECK_NO_THROW_IMPL( S, TL ) \ +do { \ + try { \ + S; \ + BOOST_TEST_TOOL_IMPL( 2, true, "no exceptions thrown by " BOOST_STRINGIZE( S ), \ + TL, CHECK_MSG, _ ); \ + } catch( ... ) { \ + BOOST_TEST_TOOL_IMPL( 2, false, "unexpected exception thrown by " BOOST_STRINGIZE( S ), \ + TL, CHECK_MSG, _ ); \ + } \ +} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ +/**/ + +#define BOOST_WARN_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, WARN ) +#define BOOST_CHECK_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, CHECK ) +#define BOOST_REQUIRE_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, REQUIRE ) + +//____________________________________________________________________________// + +#define BOOST_WARN_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::equal_impl_frwd(), "", WARN, CHECK_EQUAL, (L)(R) ) +#define BOOST_CHECK_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::equal_impl_frwd(), "", CHECK, CHECK_EQUAL, (L)(R) ) +#define BOOST_REQUIRE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::equal_impl_frwd(), "", REQUIRE, CHECK_EQUAL, (L)(R) ) + +//____________________________________________________________________________// + +#define BOOST_WARN_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::ne_impl(), "", WARN, CHECK_NE, (L)(R) ) +#define BOOST_CHECK_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::ne_impl(), "", CHECK, CHECK_NE, (L)(R) ) +#define BOOST_REQUIRE_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::ne_impl(), "", REQUIRE, CHECK_NE, (L)(R) ) + +//____________________________________________________________________________// + +#define BOOST_WARN_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::lt_impl(), "", WARN, CHECK_LT, (L)(R) ) +#define BOOST_CHECK_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::lt_impl(), "", CHECK, CHECK_LT, (L)(R) ) +#define BOOST_REQUIRE_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::lt_impl(), "", REQUIRE, CHECK_LT, (L)(R) ) + +//____________________________________________________________________________// + +#define BOOST_WARN_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::le_impl(), "", WARN, CHECK_LE, (L)(R) ) +#define BOOST_CHECK_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::le_impl(), "", CHECK, CHECK_LE, (L)(R) ) +#define BOOST_REQUIRE_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::le_impl(), "", REQUIRE, CHECK_LE, (L)(R) ) + +//____________________________________________________________________________// + +#define BOOST_WARN_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::gt_impl(), "", WARN, CHECK_GT, (L)(R) ) +#define BOOST_CHECK_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::gt_impl(), "", CHECK, CHECK_GT, (L)(R) ) +#define BOOST_REQUIRE_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::gt_impl(), "", REQUIRE, CHECK_GT, (L)(R) ) + +//____________________________________________________________________________// + +#define BOOST_WARN_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::ge_impl(), "", WARN, CHECK_GE, (L)(R) ) +#define BOOST_CHECK_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::ge_impl(), "", CHECK, CHECK_GE, (L)(R) ) +#define BOOST_REQUIRE_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::tt_detail::ge_impl(), "", REQUIRE, CHECK_GE, (L)(R) ) + +//____________________________________________________________________________// + +#define BOOST_WARN_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::check_is_close_t(), "", WARN, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) ) +#define BOOST_CHECK_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::check_is_close_t(), "", CHECK, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) ) +#define BOOST_REQUIRE_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::check_is_close_t(), "", REQUIRE, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) ) + +//____________________________________________________________________________// + +#define BOOST_WARN_CLOSE_FRACTION(L, R, T) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::check_is_close_t(), "", WARN, CHECK_CLOSE_FRACTION, (L)(R)(T) ) +#define BOOST_CHECK_CLOSE_FRACTION(L, R, T) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::check_is_close_t(), "", CHECK, CHECK_CLOSE_FRACTION, (L)(R)(T) ) +#define BOOST_REQUIRE_CLOSE_FRACTION(L,R,T) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::check_is_close_t(), "", REQUIRE, CHECK_CLOSE_FRACTION, (L)(R)(T) ) + +//____________________________________________________________________________// + +#define BOOST_WARN_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::check_is_small_t(), "", WARN, CHECK_SMALL, (FPV)(T) ) +#define BOOST_CHECK_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::check_is_small_t(), "", CHECK, CHECK_SMALL, (FPV)(T) ) +#define BOOST_REQUIRE_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \ + ::boost::test_tools::check_is_small_t(), "", REQUIRE, CHECK_SMALL, (FPV)(T) ) + +//____________________________________________________________________________// + +#define BOOST_WARN_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \ + P, BOOST_TEST_STRINGIZE( P ), WARN, CHECK_PRED_WITH_ARGS, ARGS ) +#define BOOST_CHECK_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \ + P, BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED_WITH_ARGS, ARGS ) +#define BOOST_REQUIRE_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \ + P, BOOST_TEST_STRINGIZE( P ), REQUIRE, CHECK_PRED_WITH_ARGS, ARGS ) + +//____________________________________________________________________________// + +#define BOOST_WARN_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ + BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \ + "", WARN, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \ +/**/ +#define BOOST_CHECK_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ + BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \ + "", CHECK, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \ +/**/ +#define BOOST_REQUIRE_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ + BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \ + "", REQUIRE, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \ +/**/ + +//____________________________________________________________________________// + +#define BOOST_WARN_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ + ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", WARN, CHECK_BITWISE_EQUAL, (L)(R) ) +#define BOOST_CHECK_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ + ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", CHECK, CHECK_BITWISE_EQUAL, (L)(R) ) +#define BOOST_REQUIRE_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ + ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", REQUIRE, CHECK_BITWISE_EQUAL, (L)(R) ) + +//____________________________________________________________________________// + +#define BOOST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( #symb, BOOST_STRINGIZE(= symb) ) + +//____________________________________________________________________________// + +#ifdef BOOST_TEST_NO_NEW_TOOLS + +#define BOOST_TEST_WARN( P ) BOOST_WARN( P ) +#define BOOST_TEST_CHECK( P ) BOOST_CHECK( P ) +#define BOOST_TEST_REQUIRE( P ) BOOST_REQUIRE( P ) + +#define BOOST_TEST( P ) BOOST_CHECK( P ) + +#endif + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER diff --git a/libraries/boost/include/boost/test/tools/output_test_stream.hpp b/libraries/boost/include/boost/test/tools/output_test_stream.hpp new file mode 100644 index 0000000000..2abbf7b521 --- /dev/null +++ b/libraries/boost/include/boost/test/tools/output_test_stream.hpp @@ -0,0 +1,107 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief output_test_stream class definition +// *************************************************************************** + +#ifndef BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER +#define BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER + +// Boost.Test +#include +#include +#include + +// STL +#include // for std::size_t + +#include + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** output_test_stream ************** // +// ************************************************************************** // + + + +namespace boost { +namespace test_tools { + +//! Class to be used to simplify testing of ostream-based output operations +class BOOST_TEST_DECL output_test_stream : public wrap_stringstream::wrapped_stream { + typedef unit_test::const_string const_string; +public: + //! Constructor + //! + //!@param[in] pattern_file_name indicates the name of the file for matching. If the + //! string is empty, the standard input or output streams are used instead + //! (depending on match_or_save) + //!@param[in] match_or_save if true, the pattern file will be read, otherwise it will be + //! written + //!@param[in] text_or_binary if false, opens the stream in binary mode. Otherwise the stream + //! is opened with default flags and the carriage returns are ignored. + explicit output_test_stream( const_string pattern_file_name = const_string(), + bool match_or_save = true, + bool text_or_binary = true ); + + // Destructor + virtual ~output_test_stream(); + + //! Checks if the stream is empty + //! + //!@param[in] flush_stream if true, flushes the stream after the call + virtual assertion_result is_empty( bool flush_stream = true ); + + //! Checks the length of the stream + //! + //!@param[in] length target length + //!@param[in] flush_stream if true, flushes the stream after the call. Set to false to call + //! additional checks on the same content. + virtual assertion_result check_length( std::size_t length, bool flush_stream = true ); + + //! Checks the content of the stream against a string + //! + //!@param[in] arg_ the target stream + //!@param[in] flush_stream if true, flushes the stream after the call. + virtual assertion_result is_equal( const_string arg_, bool flush_stream = true ); + + //! Checks the content of the stream against a pattern file + //! + //!@param[in] flush_stream if true, flushes/resets the stream after the call. + virtual assertion_result match_pattern( bool flush_stream = true ); + + //! Flushes the stream + void flush(); + +protected: + + //! Returns the string representation of the stream + //! + //! May be overriden in order to mutate the string before the matching operations. + virtual std::string get_stream_string_representation() const; + +private: + // helper functions + + //! Length of the stream + std::size_t length(); + + //! Synching the stream into an internal string representation + virtual void sync(); + + struct Impl; + Impl* m_pimpl; +}; + +} // namespace test_tools +} // namespace boost + +#include + +#endif // BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tree/auto_registration.hpp b/libraries/boost/include/boost/test/tree/auto_registration.hpp new file mode 100644 index 0000000000..a3fe32fda7 --- /dev/null +++ b/libraries/boost/include/boost/test/tree/auto_registration.hpp @@ -0,0 +1,53 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 74640 $ +// +// Description : defines auto_test_unit_registrar +// *************************************************************************** + +#ifndef BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER +#define BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER + +// Boost.Test +#include +#include +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace ut_detail { + +// ************************************************************************** // +// ************** auto_test_unit_registrar ************** // +// ************************************************************************** // + +struct BOOST_TEST_DECL auto_test_unit_registrar { + // Constructors + auto_test_unit_registrar( test_case* tc, decorator::collector& decorators, counter_t exp_fail = 0 ); + explicit auto_test_unit_registrar( const_string ts_name, const_string ts_file, std::size_t ts_line, decorator::collector& decorators ); + explicit auto_test_unit_registrar( test_unit_generator const& tc_gen, decorator::collector& decorators ); + explicit auto_test_unit_registrar( int ); +}; + +} // namespace ut_detail +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER + diff --git a/libraries/boost/include/boost/test/tree/decorator.hpp b/libraries/boost/include/boost/test/tree/decorator.hpp new file mode 100644 index 0000000000..27c46682a0 --- /dev/null +++ b/libraries/boost/include/boost/test/tree/decorator.hpp @@ -0,0 +1,277 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: 62016 $ +// +// Description : defines decorators to be using with auto registered test units +// *************************************************************************** + +#ifndef BOOST_TEST_TREE_DECORATOR_HPP_091911GER +#define BOOST_TEST_TREE_DECORATOR_HPP_091911GER + +// Boost.Test +#include +#include + +#include + +#include + +#include +#include + +// Boost +#include +#include +#include + +#include + +// STL +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +class test_unit; + +namespace decorator { + +// ************************************************************************** // +// ************** decorator::collector ************** // +// ************************************************************************** // + +class base; +typedef boost::shared_ptr base_ptr; + +class BOOST_TEST_DECL collector : public singleton { +public: + collector& operator*( base const& d ); + + void store_in( test_unit& tu ); + + void reset(); + +private: + BOOST_TEST_SINGLETON_CONS( collector ) + + // Data members + std::vector m_tu_decorators; +}; + +// ************************************************************************** // +// ************** decorator::base ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL base { +public: + // composition interface + collector& operator*() const; + + // application interface + virtual void apply( test_unit& tu ) = 0; + + // deep cloning interface + virtual base_ptr clone() const = 0; + +protected: + virtual ~base() {} +}; + +// ************************************************************************** // +// ************** decorator::label ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL label : public decorator::base { +public: + explicit label( const_string l ) : m_label( l ) {} + +private: + // decorator::base interface + virtual void apply( test_unit& tu ); + virtual base_ptr clone() const { return base_ptr(new label( m_label )); } + + // Data members + const_string m_label; +}; + +// ************************************************************************** // +// ************** decorator::expected_failures ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL expected_failures : public decorator::base { +public: + explicit expected_failures( counter_t ef ) : m_exp_fail( ef ) {} + +private: + // decorator::base interface + virtual void apply( test_unit& tu ); + virtual base_ptr clone() const { return base_ptr(new expected_failures( m_exp_fail )); } + + // Data members + counter_t m_exp_fail; +}; + +// ************************************************************************** // +// ************** decorator::timeout ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL timeout : public decorator::base { +public: + explicit timeout( unsigned t ) : m_timeout( t ) {} + +private: + // decorator::base interface + virtual void apply( test_unit& tu ); + virtual base_ptr clone() const { return base_ptr(new timeout( m_timeout )); } + + // Data members + unsigned m_timeout; +}; + +// ************************************************************************** // +// ************** decorator::description ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL description : public decorator::base { +public: + explicit description( const_string descr ) : m_description( descr ) {} + +private: + // decorator::base interface + virtual void apply( test_unit& tu ); + virtual base_ptr clone() const { return base_ptr(new description( m_description )); } + + // Data members + const_string m_description; +}; + +// ************************************************************************** // +// ************** decorator::depends_on ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL depends_on : public decorator::base { +public: + explicit depends_on( const_string dependency ) : m_dependency( dependency ) {} + +private: + // decorator::base interface + virtual void apply( test_unit& tu ); + virtual base_ptr clone() const { return base_ptr(new depends_on( m_dependency )); } + + // Data members + const_string m_dependency; +}; + +// ************************************************************************** // +// ************** decorator::enable_if/enabled/disabled ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL enable_if_impl : public decorator::base { +protected: + void apply_impl( test_unit& tu, bool condition ); +}; + +template +class enable_if : public enable_if_impl { +private: + // decorator::base interface + virtual void apply( test_unit& tu ) { this->apply_impl( tu, condition ); } + virtual base_ptr clone() const { return base_ptr(new enable_if()); } +}; + +typedef enable_if enabled; +typedef enable_if disabled; + +// ************************************************************************** // +// ************** decorator::fixture ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL fixture_t : public decorator::base { +public: + // Constructor + explicit fixture_t( test_unit_fixture_ptr impl ) : m_impl( impl ) {} + +private: + // decorator::base interface + virtual void apply( test_unit& tu ); + virtual base_ptr clone() const { return base_ptr(new fixture_t( m_impl )); } + + // Data members + test_unit_fixture_ptr m_impl; +}; + +//____________________________________________________________________________// + +template +inline fixture_t +fixture() +{ + return fixture_t( test_unit_fixture_ptr( new unit_test::class_based_fixture() ) ); +} + +//____________________________________________________________________________// + +template +inline fixture_t +fixture( Arg const& arg ) +{ + return fixture_t( test_unit_fixture_ptr( new unit_test::class_based_fixture( arg ) ) ); +} + +//____________________________________________________________________________// + +inline fixture_t +fixture( boost::function const& setup, boost::function const& teardown = boost::function() ) +{ + return fixture_t( test_unit_fixture_ptr( new unit_test::function_based_fixture( setup, teardown ) ) ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** decorator::depends_on ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL precondition : public decorator::base { +public: + typedef boost::function predicate_t; + + explicit precondition( predicate_t p ) : m_precondition( p ) {} + +private: + // decorator::base interface + virtual void apply( test_unit& tu ); + virtual base_ptr clone() const { return base_ptr(new precondition( m_precondition )); } + + // Data members + predicate_t m_precondition; +}; + +} // namespace decorator + +using decorator::label; +using decorator::expected_failures; +using decorator::timeout; +using decorator::description; +using decorator::depends_on; +using decorator::enable_if; +using decorator::enabled; +using decorator::disabled; +using decorator::fixture; +using decorator::precondition; + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TREE_DECORATOR_HPP_091911GER diff --git a/libraries/boost/include/boost/test/tree/fixture.hpp b/libraries/boost/include/boost/test/tree/fixture.hpp new file mode 100644 index 0000000000..8e07b2aa1d --- /dev/null +++ b/libraries/boost/include/boost/test/tree/fixture.hpp @@ -0,0 +1,191 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Defines fixture interface and object makers +// *************************************************************************** + +#ifndef BOOST_TEST_TREE_FIXTURE_HPP_100311GER +#define BOOST_TEST_TREE_FIXTURE_HPP_100311GER + +// Boost.Test +#include + +// Boost +#include +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** test_unit_fixture ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL test_unit_fixture { +public: + virtual ~test_unit_fixture() {} + + // Fixture interface + virtual void setup() = 0; + virtual void teardown() = 0; +}; + +typedef shared_ptr test_unit_fixture_ptr; + +// ************************************************************************** // +// ************** fixture helper functions ************** // +// ************************************************************************** // + +namespace impl_fixture { + +#if defined(BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) + + template struct fixture_detect {}; + + template + struct has_setup { + private: + template static char Test(fixture_detect*); + template static int Test(...); + public: + static const bool value = sizeof(Test(0)) == sizeof(char); + }; + + template + struct has_teardown { + private: + template static char Test(fixture_detect*); + template static int Test(...); + public: + static const bool value = sizeof(Test(0)) == sizeof(char); + }; + +#else + + template struct fixture_detect { typedef char type; }; + template + struct has_setup { + private: + template static auto Test(U*) -> typename fixture_detect().setup())>::type; + template static int Test(...); + public: + static const bool value = sizeof(Test(0)) == sizeof(char); + }; + + template + struct has_teardown { + private: + template static auto Test(U*) -> typename fixture_detect().teardown())>::type; + template static int Test(...); + public: + static const bool value = sizeof(Test(0)) == sizeof(char); + }; + +#endif + + template + struct call_setup { template void operator()(U& ) { } }; + + template <> + struct call_setup { template void operator()(U& u) { u.setup(); } }; + + template + struct call_teardown { template void operator()(U& ) { } }; + + template <> + struct call_teardown { template void operator()(U& u) { u.teardown(); } }; +} + +//! Calls the fixture "setup" if detected by the compiler, otherwise does nothing. +template +void setup_conditional(U& u) { + return impl_fixture::call_setup::value>()(u); +} + +//! Calls the fixture "teardown" if detected by the compiler, otherwise does nothing. +template +void teardown_conditional(U& u) { + return impl_fixture::call_teardown::value>()(u); +} + + +// ************************************************************************** // +// ************** class_based_fixture ************** // +// ************************************************************************** // + +template +class class_based_fixture : public test_unit_fixture { +public: + // Constructor + explicit class_based_fixture( Arg const& arg ) : m_inst(), m_arg( arg ) {} + +private: + // Fixture interface + virtual void setup() { m_inst.reset( new F( m_arg ) ); setup_conditional(*m_inst); } + virtual void teardown() { teardown_conditional(*m_inst); m_inst.reset(); } + + // Data members + scoped_ptr m_inst; + Arg m_arg; +}; + +//____________________________________________________________________________// + +template +class class_based_fixture : public test_unit_fixture { +public: + // Constructor + class_based_fixture() : m_inst( 0 ) {} + +private: + // Fixture interface + virtual void setup() { m_inst.reset( new F ); setup_conditional(*m_inst); } + virtual void teardown() { teardown_conditional(*m_inst); m_inst.reset(); } + + // Data members + scoped_ptr m_inst; +}; + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** function_based_fixture ************** // +// ************************************************************************** // + +class function_based_fixture : public test_unit_fixture { +public: + // Constructor + function_based_fixture( boost::function const& setup_, boost::function const& teardown_ ) + : m_setup( setup_ ) + , m_teardown( teardown_ ) + { + } + +private: + // Fixture interface + virtual void setup() { if( m_setup ) m_setup(); } + virtual void teardown() { if( m_teardown ) m_teardown(); } + + // Data members + boost::function m_setup; + boost::function m_teardown; +}; + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TREE_FIXTURE_HPP_100311GER + diff --git a/libraries/boost/include/boost/test/tree/global_fixture.hpp b/libraries/boost/include/boost/test/tree/global_fixture.hpp new file mode 100644 index 0000000000..7c96d34e89 --- /dev/null +++ b/libraries/boost/include/boost/test/tree/global_fixture.hpp @@ -0,0 +1,123 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Defines global_fixture +// *************************************************************************** + +#ifndef BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER +#define BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER + +// Boost.Test +#include +#include + +#include +#include + +#include + + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** global_configuration ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL global_configuration : public test_observer { + +public: + // Constructor + global_configuration(); + + // Dtor + virtual ~global_configuration(); + + // Happens after the framework global observer init has been done + virtual int priority() { return 1; } +}; + + + +// ************************************************************************** // +// ************** global_fixture ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL global_fixture : public test_unit_fixture { + +public: + // Constructor + global_fixture(); + + // Dtor + virtual ~global_fixture(); +}; + +//____________________________________________________________________________// + +namespace ut_detail { + +template +struct global_configuration_impl : public global_configuration { + // Constructor + global_configuration_impl() : m_configuration_observer( 0 ) { + } + + // test observer interface + virtual void test_start( counter_t ) { + m_configuration_observer = new F; + } + + // test observer interface + virtual void test_finish() { + if(m_configuration_observer) { + delete m_configuration_observer; + m_configuration_observer = 0; + } + } +private: + // Data members + F* m_configuration_observer; +}; + +template +struct global_fixture_impl : public global_fixture { + // Constructor + global_fixture_impl() : m_fixture( 0 ) { + } + + // test fixture interface + virtual void setup() { + m_fixture = new F; + setup_conditional(*m_fixture); + } + + // test fixture interface + virtual void teardown() { + if(m_fixture) { + teardown_conditional(*m_fixture); + } + delete m_fixture; + m_fixture = 0; + } + +private: + // Data members + F* m_fixture; +}; + +} // namespace ut_detail +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER + diff --git a/libraries/boost/include/boost/test/tree/observer.hpp b/libraries/boost/include/boost/test/tree/observer.hpp new file mode 100644 index 0000000000..bd6fc9bff5 --- /dev/null +++ b/libraries/boost/include/boost/test/tree/observer.hpp @@ -0,0 +1,116 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief defines abstract interface for test observer +// *************************************************************************** + +#ifndef BOOST_TEST_TEST_OBSERVER_HPP_021005GER +#define BOOST_TEST_TEST_OBSERVER_HPP_021005GER + +// Boost.Test +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** test_observer ************** // +// ************************************************************************** // + +/// @brief Generic test observer interface +/// +/// This interface is used by observers in order to receive notifications from the +/// Boost.Test framework on the current execution state. +/// +/// Several observers can be running at the same time, and it is not unusual to +/// have interactions among them. The @ref test_observer::priority member function allows the specification +/// of a particular order among them (lowest priority executed first, except specified otherwise). +/// +class BOOST_TEST_DECL test_observer { +public: + + //! Called before the framework starts executing the test cases + //! + //! @param[in] number_of_test_cases indicates the number of test cases. Only active + //! test cases are taken into account. + virtual void test_start( counter_t /* number_of_test_cases */ ) {} + + //! Called after the framework ends executing the test cases + //! + //! @note The call is made with a reversed priority order. + virtual void test_finish() {} + + //! Called when a critical error is detected + //! + //! The critical errors are mainly the signals sent by the system and caught by the Boost.Test framework. + //! Since the running binary may be in incoherent/instable state, the test execution is aborted and all remaining + //! tests are discarded. + //! + //! @note may be called before test_observer::test_unit_finish() + virtual void test_aborted() {} + + //! Called before the framework starts executing a test unit + //! + //! @param[in] test_unit the test being executed + virtual void test_unit_start( test_unit const& /* test */) {} + + //! Called at each end of a test unit. + //! + //! @param elapsed duration of the test unit in microseconds. + virtual void test_unit_finish( test_unit const& /* test */, unsigned long /* elapsed */ ) {} + virtual void test_unit_skipped( test_unit const& tu, const_string ) { test_unit_skipped( tu ); } + virtual void test_unit_skipped( test_unit const& ) {} ///< backward compatibility + + //! Called when a test unit indicates a fatal error. + //! + //! A fatal error happens when + //! - a strong assertion (with @c REQUIRE) fails, which indicates that the test case cannot continue + //! - an unexpected exception is caught by the Boost.Test framework + virtual void test_unit_aborted( test_unit const& ) {} + + virtual void assertion_result( unit_test::assertion_result ar ) + { + switch( ar ) { + case AR_PASSED: assertion_result( true ); break; + case AR_FAILED: assertion_result( false ); break; + case AR_TRIGGERED: break; + default: break; + } + } + + //! Called when an exception is intercepted + //! + //! In case an exception is intercepted, this call happens before the call + //! to @ref test_unit_aborted in order to log + //! additional data about the exception. + virtual void exception_caught( execution_exception const& ) {} + + //! The priority indicates the order at which this observer is initialized + //! and tore down in the UTF framework. The order is lowest to highest priority. + virtual int priority() { return 0; } + +protected: + //! Deprecated + virtual void assertion_result( bool /* passed */ ) {} + + BOOST_TEST_PROTECTED_VIRTUAL ~test_observer() {} +}; + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TEST_OBSERVER_HPP_021005GER + diff --git a/libraries/boost/include/boost/test/tree/test_case_counter.hpp b/libraries/boost/include/boost/test/tree/test_case_counter.hpp new file mode 100644 index 0000000000..a74f37f152 --- /dev/null +++ b/libraries/boost/include/boost/test/tree/test_case_counter.hpp @@ -0,0 +1,52 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Defines @ref test_case_counter +// *************************************************************************** + +#ifndef BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER +#define BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER + +// Boost.Test +#include +#include + +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** test_case_counter ************** // +// ************************************************************************** // + +///! Counts the number of enabled test cases +class test_case_counter : public test_tree_visitor { +public: + // Constructor + test_case_counter() : p_count( 0 ) {} + + BOOST_READONLY_PROPERTY( counter_t, (test_case_counter)) p_count; +private: + // test tree visitor interface + virtual void visit( test_case const& tc ) { if( tc.is_enabled() ) ++p_count.value; } + virtual bool test_suite_start( test_suite const& ts ) { return ts.is_enabled(); } +}; + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER + diff --git a/libraries/boost/include/boost/test/tree/test_case_template.hpp b/libraries/boost/include/boost/test/tree/test_case_template.hpp new file mode 100644 index 0000000000..83a13f00f5 --- /dev/null +++ b/libraries/boost/include/boost/test/tree/test_case_template.hpp @@ -0,0 +1,190 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +///@ file +/// Defines template_test_case_gen +// *************************************************************************** + +#ifndef BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER +#define BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER + +// Boost.Test +#include +#include +#include +#include + +#include + +#include + + +// Boost +#include +#include +#include +#include +#include +#include + +#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI) +# include +#else +# include +#endif + +// STL +#include // for std::string +#include // for std::list + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ + !defined(BOOST_NO_CXX11_HDR_TUPLE) && \ + !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) + #include +#endif + +#include + + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace ut_detail { + +// ************************************************************************** // +// ************** test_case_template_invoker ************** // +// ************************************************************************** // + +template +class test_case_template_invoker { +public: + void operator()() { TestCaseTemplate::run( (boost::type*)0 ); } +}; + +// ************************************************************************** // +// ************** generate_test_case_4_type ************** // +// ************************************************************************** // + +template +struct generate_test_case_4_type { + explicit generate_test_case_4_type( const_string tc_name, const_string tc_file, std::size_t tc_line, Generator& G ) + : m_test_case_name( tc_name ) + , m_test_case_file( tc_file ) + , m_test_case_line( tc_line ) + , m_holder( G ) + {} + + template + void operator()( mpl::identity ) + { + std::string full_name; + assign_op( full_name, m_test_case_name, 0 ); + full_name += '<'; +#if !defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) + full_name += boost::core::demangle(typeid(TestType).name()); // same as execution_monitor.ipp +#else + full_name += BOOST_CURRENT_FUNCTION; +#endif + if( boost::is_const::value ) + full_name += "_const"; + full_name += '>'; + + m_holder.m_test_cases.push_back( new test_case( ut_detail::normalize_test_case_name( full_name ), + m_test_case_file, + m_test_case_line, + test_case_template_invoker() ) ); + } + +private: + // Data members + const_string m_test_case_name; + const_string m_test_case_file; + std::size_t m_test_case_line; + Generator& m_holder; +}; + +// ************************************************************************** // +// ************** test_case_template ************** // +// ************************************************************************** // + +class template_test_case_gen_base : public test_unit_generator { +public: + virtual test_unit* next() const + { + if( m_test_cases.empty() ) + return 0; + + test_unit* res = m_test_cases.front(); + m_test_cases.pop_front(); + + return res; + } + + // Data members + mutable std::list m_test_cases; +}; + +template +class template_test_case_gen : public template_test_case_gen_base { +public: + // Constructor + template_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line ) + { + typedef generate_test_case_4_type,TestCaseTemplate> single_test_gen; + + mpl::for_each >( single_test_gen( tc_name, tc_file, tc_line, *this ) ); + } +}; + +// adding support for tuple +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ + !defined(BOOST_NO_CXX11_HDR_TUPLE) && \ + !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) + +template +class template_test_case_gen > : public template_test_case_gen_base { + + template + struct seq { }; + + template + struct gen_seq : gen_seq { }; + + template + struct gen_seq<0, Is...> : seq { }; + + template + void for_each(F &f, seq) + { + auto l = { (f(mpl::identity::type>()), 0)... }; + (void)l; // silence warning + } + +public: + // Constructor + template_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line ) + { + using tuple_t = std::tuple; + using this_type = template_test_case_gen; + using single_test_gen = generate_test_case_4_type; + + single_test_gen op( tc_name, tc_file, tc_line, *this ); + + this->for_each(op, gen_seq()); + } +}; + +#endif /* C++11 variadic and tuples */ + +} // namespace ut_detail +} // unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER diff --git a/libraries/boost/include/boost/test/tree/test_unit.hpp b/libraries/boost/include/boost/test/tree/test_unit.hpp new file mode 100644 index 0000000000..273fa14ff3 --- /dev/null +++ b/libraries/boost/include/boost/test/tree/test_unit.hpp @@ -0,0 +1,275 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Defines @ref boost::unit_test::test_unit "test_unit", @ref boost::unit_test::test_case "test_case", +/// @ref boost::unit_test::test_suite "test_suite" and @ref boost::unit_test::master_test_suite_t "master_test_suite_t" +// *************************************************************************** + +#ifndef BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER +#define BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER + +// Boost.Test +#include +#include +#include + +#include +#include + +#include + +#include + +// Boost +#include +#include + +// STL +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +namespace framework { +class state; +} + +// ************************************************************************** // +// ************** test_unit ************** // +// ************************************************************************** // + +typedef std::vector test_unit_id_list; + +class BOOST_TEST_DECL test_unit { +public: + enum { type = TUT_ANY }; + enum run_status { RS_DISABLED, RS_ENABLED, RS_INHERIT, RS_INVALID }; + + typedef std::vector id_list; + typedef std::vector fixture_list_t; + typedef BOOST_READONLY_PROPERTY(test_unit_id,(framework::state)) id_t; + typedef BOOST_READONLY_PROPERTY(test_unit_id,(test_suite)) parent_id_t; + typedef BOOST_READONLY_PROPERTY(id_list,(test_unit)) id_list_t; + typedef std::vector decor_list_t; + typedef BOOST_READONLY_PROPERTY(std::vector,(test_unit)) label_list_t; + + typedef boost::function precondition_t; + typedef BOOST_READONLY_PROPERTY(std::vector,(test_unit)) precond_list_t; + + // preconditions management + void depends_on( test_unit* tu ); + void add_precondition( precondition_t const& ); + test_tools::assertion_result check_preconditions() const; + + // labels management + void add_label( const_string l ); + bool has_label( const_string l ) const; + + // helper access methods + void increase_exp_fail( counter_t num ); + bool is_enabled() const { return p_run_status == RS_ENABLED; } + std::string full_name() const; + + // Public r/o properties + test_unit_type const p_type; ///< type for this test unit + const_string const p_type_name; ///< "case"/"suite"/"module" + const_string const p_file_name; + std::size_t const p_line_num; + id_t p_id; ///< unique id for this test unit + parent_id_t p_parent_id; ///< parent test suite id + label_list_t p_labels; ///< list of labels associated with this test unit + + id_list_t p_dependencies; ///< list of test units this one depends on + precond_list_t p_preconditions; ///< user supplied preconditions for this test unit; + + // Public r/w properties + readwrite_property p_name; ///< name for this test unit + readwrite_property p_description; ///< description for this test unit + readwrite_property p_timeout; ///< timeout for the test unit execution in seconds + readwrite_property p_expected_failures; ///< number of expected failures in this test unit + + readwrite_property p_default_status; ///< run status obtained by this unit during setup phase + readwrite_property p_run_status; ///< run status assigned to this unit before execution phase after applying all filters + + readwrite_property p_sibling_rank; ///< rank of this test unit amoung siblings of the same parent + + readwrite_property p_decorators; ///< automatically assigned decorators; execution is delayed till framework::finalize_setup_phase function + readwrite_property p_fixtures; ///< fixtures associated with this test unit + +protected: + ~test_unit(); + // Constructor + test_unit( const_string tu_name, const_string tc_file, std::size_t tc_line, test_unit_type t ); + // Master test suite constructor + explicit test_unit( const_string module_name ); + +private: +}; + +// ************************************************************************** // +// ************** test_unit_generator ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL test_unit_generator { +public: + virtual test_unit* next() const = 0; + +protected: + BOOST_TEST_PROTECTED_VIRTUAL ~test_unit_generator() {} +}; + +// ************************************************************************** // +// ************** test_case ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL test_case : public test_unit { +public: + enum { type = TUT_CASE }; + + // Constructor + test_case( const_string tc_name, boost::function const& test_func ); + test_case( const_string tc_name, const_string tc_file, std::size_t tc_line, boost::function const& test_func ); + + // Public property + typedef BOOST_READONLY_PROPERTY(boost::function,(test_case)) test_func; + + test_func p_test_func; + +private: + friend class framework::state; + ~test_case() {} +}; + +// ************************************************************************** // +// ************** test_suite ************** // +// ************************************************************************** // + +//! Class representing test suites +class BOOST_TEST_DECL test_suite : public test_unit { +public: + enum { type = TUT_SUITE }; + + // Constructor + explicit test_suite( const_string ts_name, const_string ts_file, std::size_t ts_line ); + + // test unit list management + + /*!@brief Adds a test unit to a test suite. + * + * It is possible to specify the timeout and the expected failures. + */ + void add( test_unit* tu, counter_t expected_failures = 0, unsigned timeout = 0 ); + + /// @overload + void add( test_unit_generator const& gen, unsigned timeout = 0 ); + + /// @overload + void add( test_unit_generator const& gen, decorator::collector& decorators ); + + //! Removes a test from the test suite. + void remove( test_unit_id id ); + + + // access methods + test_unit_id get( const_string tu_name ) const; + std::size_t size() const { return m_children.size(); } + +protected: + // Master test suite constructor + explicit test_suite( const_string module_name ); + + friend BOOST_TEST_DECL + void traverse_test_tree( test_suite const&, test_tree_visitor&, bool ); + friend class framework::state; + virtual ~test_suite() {} + + typedef std::multimap children_per_rank; + // Data members + + test_unit_id_list m_children; + children_per_rank m_ranked_children; ///< maps child sibling rank to list of children with that rank +}; + +// ************************************************************************** // +// ************** master_test_suite ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL master_test_suite_t : public test_suite { +public: + master_test_suite_t(); + + // Data members + int argc; + char** argv; +}; + +// ************************************************************************** // +// ************** user_tc_method_invoker ************** // +// ************************************************************************** // + +namespace ut_detail { + +BOOST_TEST_DECL std::string normalize_test_case_name( const_string tu_name ); + +//____________________________________________________________________________// + +template +struct user_tc_method_invoker { + typedef void (UserTestCase::*TestMethod )(); + + user_tc_method_invoker( shared_ptr inst, TestMethod test_method ) + : m_inst( inst ), m_test_method( test_method ) {} + + void operator()() { ((*m_inst).*m_test_method)(); } + + shared_ptr m_inst; + TestMethod m_test_method; +}; + +} // namespace ut_detail + +// ************************************************************************** // +// ************** make_test_case ************** // +// ************************************************************************** // + +inline test_case* +make_test_case( boost::function const& test_func, const_string tc_name, const_string tc_file, std::size_t tc_line ) +{ + return new test_case( ut_detail::normalize_test_case_name( tc_name ), tc_file, tc_line, test_func ); +} + +//____________________________________________________________________________// + +template +inline test_case* +make_test_case( void (UserTestCase::* test_method )(), + const_string tc_name, + const_string tc_file, + std::size_t tc_line, + boost::shared_ptr user_test_case ) +{ + return new test_case( ut_detail::normalize_test_case_name( tc_name ), + tc_file, + tc_line, + ut_detail::user_tc_method_invoker( user_test_case, test_method ) ); +} + +//____________________________________________________________________________// + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER diff --git a/libraries/boost/include/boost/test/tree/traverse.hpp b/libraries/boost/include/boost/test/tree/traverse.hpp new file mode 100644 index 0000000000..d27917cace --- /dev/null +++ b/libraries/boost/include/boost/test/tree/traverse.hpp @@ -0,0 +1,58 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: -1 $ +// +// Description : defines traverse_test_tree algorithm +// *************************************************************************** + +#ifndef BOOST_TEST_TREE_TRAVERSE_HPP_100211GER +#define BOOST_TEST_TREE_TRAVERSE_HPP_100211GER + +// Boost.Test +#include + +#include +#include + +#include + + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** traverse_test_tree ************** // +// ************************************************************************** // + +BOOST_TEST_DECL void traverse_test_tree( test_case const&, test_tree_visitor&, bool ignore_status = false ); +BOOST_TEST_DECL void traverse_test_tree( test_suite const&, test_tree_visitor&, bool ignore_status = false ); +BOOST_TEST_DECL void traverse_test_tree( test_unit_id , test_tree_visitor&, bool ignore_status = false ); + +//____________________________________________________________________________// + +inline void +traverse_test_tree( test_unit const& tu, test_tree_visitor& V, bool ignore_status = false ) +{ + if( tu.p_type == TUT_CASE ) + traverse_test_tree( static_cast( tu ), V, ignore_status ); + else + traverse_test_tree( static_cast( tu ), V, ignore_status ); +} + +//____________________________________________________________________________// + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TREE_TRAVERSE_HPP_100211GER diff --git a/libraries/boost/include/boost/test/tree/visitor.hpp b/libraries/boost/include/boost/test/tree/visitor.hpp new file mode 100644 index 0000000000..8f1bae5c92 --- /dev/null +++ b/libraries/boost/include/boost/test/tree/visitor.hpp @@ -0,0 +1,52 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision: -1 $ +// +// Description : defines test_tree_visitor +// *************************************************************************** + +#ifndef BOOST_TEST_TREE_VISITOR_HPP_100211GER +#define BOOST_TEST_TREE_VISITOR_HPP_100211GER + +// Boost.Test +#include + +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** test_tree_visitor ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL test_tree_visitor { +public: + // test tree visitor interface + virtual bool visit( test_unit const& ) { return true; } + virtual void visit( test_case const& tc ) { visit( (test_unit const&)tc ); } + virtual bool test_suite_start( test_suite const& ts ){ return visit( (test_unit const&)ts ); } + virtual void test_suite_finish( test_suite const& ) {} + +protected: + BOOST_TEST_PROTECTED_VIRTUAL ~test_tree_visitor() {} +}; + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_TREE_VISITOR_HPP_100211GER + diff --git a/libraries/boost/include/boost/test/unit_test.hpp b/libraries/boost/include/boost/test/unit_test.hpp new file mode 100644 index 0000000000..e6a236a1b5 --- /dev/null +++ b/libraries/boost/include/boost/test/unit_test.hpp @@ -0,0 +1,70 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Entry point into the Unit Test Framework +/// +/// This header should be the only header necessary to include to start using the framework +// *************************************************************************** + +#ifndef BOOST_TEST_UNIT_TEST_HPP_071894GER +#define BOOST_TEST_UNIT_TEST_HPP_071894GER + +// Boost.Test +#include +#include + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** Auto Linking ************** // +// ************************************************************************** // + +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \ + !defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED) +# define BOOST_LIB_NAME boost_unit_test_framework + +# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TEST_DYN_LINK) +# define BOOST_DYN_LINK +# endif + +# include + +#endif // auto-linking disabled + +// ************************************************************************** // +// ************** unit_test_main ************** // +// ************************************************************************** // + +namespace boost { namespace unit_test { + +int BOOST_TEST_DECL unit_test_main( init_unit_test_func init_func, int argc, char* argv[] ); + +} + +// !! ?? to remove +namespace unit_test_framework=unit_test; + +} + +#if defined(BOOST_TEST_DYN_LINK) && defined(BOOST_TEST_MAIN) && !defined(BOOST_TEST_NO_MAIN) + +// ************************************************************************** // +// ************** main function for tests using dll ************** // +// ************************************************************************** // + +int BOOST_TEST_CALL_DECL +main( int argc, char* argv[] ) +{ + return ::boost::unit_test::unit_test_main( &init_unit_test, argc, argv ); +} + +//____________________________________________________________________________// + +#endif // BOOST_TEST_DYN_LINK && BOOST_TEST_MAIN && !BOOST_TEST_NO_MAIN + +#endif // BOOST_TEST_UNIT_TEST_HPP_071894GER diff --git a/libraries/boost/include/boost/test/unit_test_log.hpp b/libraries/boost/include/boost/test/unit_test_log.hpp new file mode 100644 index 0000000000..6944ffa79a --- /dev/null +++ b/libraries/boost/include/boost/test/unit_test_log.hpp @@ -0,0 +1,280 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief defines singleton class unit_test_log and all manipulators. +/// unit_test_log has output stream like interface. It's implementation is +/// completely hidden with pimple idiom +// *************************************************************************** + +#ifndef BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER +#define BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER + +// Boost.Test +#include + +#include +#include +#include + +#include +#include +#include + +// Boost + +// STL +#include // for std::ostream& + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** log manipulators ************** // +// ************************************************************************** // + +namespace log { + +struct BOOST_TEST_DECL begin { + begin( const_string fn, std::size_t ln ) + : m_file_name( fn ) + , m_line_num( ln ) + {} + + const_string m_file_name; + std::size_t m_line_num; +}; + +struct end {}; + +} // namespace log + +// ************************************************************************** // +// ************** entry_value_collector ************** // +// ************************************************************************** // + +namespace ut_detail { + +class BOOST_TEST_DECL entry_value_collector { +public: + // Constructors + entry_value_collector() : m_last( true ) {} + entry_value_collector( entry_value_collector const& rhs ) : m_last( true ) { rhs.m_last = false; } + ~entry_value_collector(); + + // collection interface + entry_value_collector const& operator<<( lazy_ostream const& ) const; + entry_value_collector const& operator<<( const_string ) const; + +private: + // Data members + mutable bool m_last; +}; + +} // namespace ut_detail + +// ************************************************************************** // +// ************** unit_test_log ************** // +// ************************************************************************** // + +/// @brief Manages the sets of loggers, their streams and log levels +/// +/// The Boost.Test framework allows for having several formatters/loggers at the same time, each of which +/// having their own log level and output stream. +/// +/// This class serves the purpose of +/// - exposing an interface to the test framework (as a boost::unit_test::test_observer) +/// - exposing an interface to the testing tools +/// - managing several loggers +/// +/// @note Accesses to the functions exposed by this class are made through the singleton +/// @c boost::unit_test::unit_test_log. +/// +/// Users/developers willing to implement their own formatter need to: +/// - implement a boost::unit_test::unit_test_log_formatter that will output the desired format +/// - register the formatter during a eg. global fixture using the method @c set_formatter (though the framework singleton). +/// +/// @warning this observer has a higher priority than the @ref boost::unit_test::results_collector_t. This means +/// that the various @ref boost::unit_test::test_results associated to each test unit may not be available at the time +/// the @c test_unit_start, @c test_unit_finish ... are called. +/// +/// @see +/// - boost::unit_test::test_observer +/// - boost::unit_test::unit_test_log_formatter +class BOOST_TEST_DECL unit_test_log_t : public test_observer, public singleton { +public: + // test_observer interface implementation + virtual void test_start( counter_t test_cases_amount ); + virtual void test_finish(); + virtual void test_aborted(); + + virtual void test_unit_start( test_unit const& ); + virtual void test_unit_finish( test_unit const&, unsigned long elapsed ); + virtual void test_unit_skipped( test_unit const&, const_string ); + virtual void test_unit_aborted( test_unit const& ); + + virtual void exception_caught( execution_exception const& ex ); + + virtual int priority() { return 2; } + + // log configuration methods + //! Sets the stream for all loggers + //! + //! This will override the log sink/stream of all loggers, whether enabled or not. + void set_stream( std::ostream& ); + + //! Sets the stream for specific logger + //! + //! @note Has no effect if the specified format is not found + //! @par Since Boost 1.62 + void set_stream( output_format, std::ostream& ); + + //! Returns a pointer to the stream associated to specific logger + //! + //! @note Returns a null pointer if the format is not found + //! @par Since Boost 1.67 + std::ostream* get_stream( output_format ) const; + + + //! Sets the threshold level for all loggers/formatters. + //! + //! This will override the log level of all loggers, whether enabled or not. + void set_threshold_level( log_level ); + + //! Sets the threshold/log level of a specific format + //! + //! @note Has no effect if the specified format is not found + //! @par Since Boost 1.62 + void set_threshold_level( output_format, log_level ); + + //! Add a format to the set of loggers + //! + //! Adding a logger means that the specified logger is enabled. The log level is managed by the formatter itself + //! and specifies what events are forwarded to the underlying formatter. + //! @par Since Boost 1.62 + void add_format( output_format ); + + //! Sets the format of the logger + //! + //! This will become the only active format of the logs. + void set_format( output_format ); + + //! Returns the logger instance for a specific format. + //! + //! @returns the logger/formatter instance, or @c (unit_test_log_formatter*)0 if the format is not found. + //! @par Since Boost 1.62 + unit_test_log_formatter* get_formatter( output_format ); + + //! Sets the logger instance + //! + //! The specified logger becomes the unique active one. The custom log formatter has the + //! format @c OF_CUSTOM_LOGGER. If such a format exists already, its formatter gets replaced by the one + //! given in argument. + //! + //! The log level and output stream of the new formatter are taken from the currently active logger. In case + //! several loggers are active, the order of priority is CUSTOM, HRF, XML, and JUNIT. + //! If (unit_test_log_formatter*)0 is given as argument, the custom logger (if any) is removed. + //! + //! @note The ownership of the pointer is transfered to the Boost.Test framework. This call is equivalent to + //! - a call to @c add_formatter + //! - a call to @c set_format(OF_CUSTOM_LOGGER) + //! - a configuration of the newly added logger with a previously configured stream and log level. + void set_formatter( unit_test_log_formatter* ); + + //! Adds a custom log formatter to the set of formatters + //! + //! The specified logger is added with the format @c OF_CUSTOM_LOGGER, such that it can + //! be futher selected or its stream/log level can be specified. + //! If there is already a custom logger (with @c OF_CUSTOM_LOGGER), then + //! the existing one gets replaced by the one given in argument. + //! The provided logger is added with an enabled state. + //! If (unit_test_log_formatter*)0 is given as argument, the custom logger (if any) is removed and + //! no other action is performed. + //! + //! @note The ownership of the pointer is transfered to the Boost.Test framework. + //! @par Since Boost 1.62 + void add_formatter( unit_test_log_formatter* the_formatter ); + + // test progress logging + void set_checkpoint( const_string file, std::size_t line_num, const_string msg = const_string() ); + + // entry logging + unit_test_log_t& operator<<( log::begin const& ); // begin entry + unit_test_log_t& operator<<( log::end const& ); // end entry + unit_test_log_t& operator<<( log_level ); // set entry level + unit_test_log_t& operator<<( const_string ); // log entry value + unit_test_log_t& operator<<( lazy_ostream const& ); // log entry value + + ut_detail::entry_value_collector operator()( log_level ); // initiate entry collection + +private: + // Implementation helpers + bool log_entry_start(output_format log_format); + void log_entry_context( log_level l ); + void clear_entry_context(); + + BOOST_TEST_SINGLETON_CONS( unit_test_log_t ) +}; // unit_test_log_t + +BOOST_TEST_SINGLETON_INST( unit_test_log ) + +// helper macros +#define BOOST_TEST_LOG_ENTRY( ll ) \ + (::boost::unit_test::unit_test_log \ + << ::boost::unit_test::log::begin( BOOST_TEST_L(__FILE__), __LINE__ ))(ll) \ +/**/ + +} // namespace unit_test +} // namespace boost + +// ************************************************************************** // +// ************** Unit test log interface helpers ************** // +// ************************************************************************** // + +// messages sent by the framework +#define BOOST_TEST_FRAMEWORK_MESSAGE( M ) \ + (::boost::unit_test::unit_test_log \ + << ::boost::unit_test::log::begin( \ + "boost.test framework", \ + __LINE__ )) \ + ( ::boost::unit_test::log_messages ) \ + << BOOST_TEST_LAZY_MSG( M ) \ +/**/ + + +#define BOOST_TEST_MESSAGE( M ) \ + BOOST_TEST_LOG_ENTRY( ::boost::unit_test::log_messages ) \ + << BOOST_TEST_LAZY_MSG( M ) \ +/**/ + +//____________________________________________________________________________// + +#define BOOST_TEST_PASSPOINT() \ + ::boost::unit_test::unit_test_log.set_checkpoint( \ + BOOST_TEST_L(__FILE__), \ + static_cast(__LINE__) ) \ +/**/ + +//____________________________________________________________________________// + +#define BOOST_TEST_CHECKPOINT( M ) \ + ::boost::unit_test::unit_test_log.set_checkpoint( \ + BOOST_TEST_L(__FILE__), \ + static_cast(__LINE__), \ + (::boost::wrap_stringstream().ref() << M).str() ) \ +/**/ + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER + diff --git a/libraries/boost/include/boost/test/unit_test_log_formatter.hpp b/libraries/boost/include/boost/test/unit_test_log_formatter.hpp new file mode 100644 index 0000000000..79b74e0849 --- /dev/null +++ b/libraries/boost/include/boost/test/unit_test_log_formatter.hpp @@ -0,0 +1,322 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Defines unit test log formatter interface +/// +/// You can define a class with implements this interface and use an instance of it +/// as a Unit Test Framework log formatter +// *************************************************************************** + +#ifndef BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER +#define BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER + +// Boost.Test +#include +#include +#include + +// STL +#include +#include // for std::string +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +/// Collection of log entry attributes +// ************************************************************************** // + +struct BOOST_TEST_DECL log_entry_data { + log_entry_data() + { + m_file_name.reserve( 200 ); + } + + std::string m_file_name; ///< log entry file name + std::size_t m_line_num; ///< log entry line number + log_level m_level; ///< log entry level + + void clear() + { + m_file_name.erase(); + m_line_num = 0; + m_level = log_nothing; + } +}; + +// ************************************************************************** // +/// Collection of log checkpoint attributes +// ************************************************************************** // + +struct BOOST_TEST_DECL log_checkpoint_data +{ + const_string m_file_name; ///< log checkpoint file name + std::size_t m_line_num; ///< log checkpoint file name + std::string m_message; ///< log checkpoint message + + void clear() + { + m_file_name.clear(); + m_line_num = 0; + m_message = std::string(); + } +}; + +// ************************************************************************** // +/// @brief Abstract Unit Test Framework log formatter interface +/// +/// During the test module execution Unit Test Framework can report messages about success +/// or failure of assertions, which test suites are being run and more (specifically which +/// messages are reported depends on log level threshold selected by the user). +/// +/// All these messages constitute Unit Test Framework log. There are many ways (formats) to present +/// these messages to the user. +/// +/// Boost.Test comes with three formats: +/// - Compiler-like log format: intended for human consumption/diagnostic +/// - XML based log format: intended for processing by automated regression test systems. +/// - JUNIT based log format: intended for processing by automated regression test systems. +/// +/// If you want to produce some other format you need to implement class with specific interface and use +/// method @c unit_test_log_t::set_formatter during a test module initialization to set an active formatter. +/// The class unit_test_log_formatter defines this interface. +/// +/// This interface requires you to format all possible messages being produced in the log. +/// These includes error messages about failed assertions, messages about caught exceptions and +/// information messages about test units being started/ended. All the methods in this interface takes +/// a reference to standard stream as a first argument. This is where final messages needs to be directed +/// to. Also you are given all the information necessary to produce a message. +/// +/// @par Since Boost 1.62: +/// - Each formatter may indicate the default output stream. This is convenient for instance for streams intended +/// for automated processing that indicate a file. See @c get_default_stream_description for more details. +/// - Each formatter may manage its own log level through the getter/setter @c get_log_level and @c set_log_level . +/// +/// @see +/// - boost::unit_test::test_observer for an indication of the calls of the test observer interface +class BOOST_TEST_DECL unit_test_log_formatter { +public: + /// Types of log entries (messages written into a log) + enum log_entry_types { BOOST_UTL_ET_INFO, ///< Information message from the framework + BOOST_UTL_ET_MESSAGE, ///< Information message from the user + BOOST_UTL_ET_WARNING, ///< Warning (non error) condition notification message + BOOST_UTL_ET_ERROR, ///< Non fatal error notification message + BOOST_UTL_ET_FATAL_ERROR ///< Fatal error notification message + }; + + //! Constructor + unit_test_log_formatter() + : m_log_level(log_all_errors) + {} + + // Destructor + virtual ~unit_test_log_formatter() {} + + // @name Test start/finish + + /// Invoked at the beginning of test module execution + /// + /// @param[in] os output stream to write a messages to + /// @param[in] test_cases_amount total test case amount to be run + /// @see log_finish + virtual void log_start( std::ostream& os, counter_t test_cases_amount ) = 0; + + /// Invoked at the end of test module execution + /// + /// @param[in] os output stream to write a messages into + /// @see log_start + virtual void log_finish( std::ostream& os ) = 0; + + /// Invoked when Unit Test Framework build information is requested + /// + /// @param[in] os output stream to write a messages into + virtual void log_build_info( std::ostream& os ) = 0; + // @} + + // @name Test unit start/finish + + /// Invoked when test unit starts (either test suite or test case) + /// + /// @param[in] os output stream to write a messages into + /// @param[in] tu test unit being started + /// @see test_unit_finish + virtual void test_unit_start( std::ostream& os, test_unit const& tu ) = 0; + + /// Invoked when test unit finishes + /// + /// @param[in] os output stream to write a messages into + /// @param[in] tu test unit being finished + /// @param[in] elapsed time in microseconds spend executing this test unit + /// @see test_unit_start + virtual void test_unit_finish( std::ostream& os, test_unit const& tu, unsigned long elapsed ) = 0; + + /// Invoked if test unit skipped for any reason + /// + /// @param[in] os output stream to write a messages into + /// @param[in] tu skipped test unit + /// @param[in] reason explanation why was it skipped + virtual void test_unit_skipped( std::ostream& os, test_unit const& tu, const_string /* reason */) + { + test_unit_skipped( os, tu ); + } + + /// Deprecated version of this interface + virtual void test_unit_skipped( std::ostream& /* os */, test_unit const& /* tu */) {} + + /// Invoked when a test unit is aborted + virtual void test_unit_aborted( std::ostream& /* os */, test_unit const& /* tu */) {} + + // @} + + // @name Uncaught exception report + + /// Invoked when Unit Test Framework detects uncaught exception + /// + /// The framwork calls this function when an uncaught exception it detected. + /// This call is followed by context information: + /// - one call to @c entry_context_start, + /// - as many calls to @c log_entry_context as there are context entries + /// - one call to @c entry_context_finish + /// + /// The logging of the exception information is finilized by a call to @c log_exception_finish. + /// + /// @param[in] os output stream to write a messages into + /// @param[in] lcd information about the last checkpoint before the exception was triggered + /// @param[in] ex information about the caught exception + /// @see log_exception_finish + virtual void log_exception_start( std::ostream& os, log_checkpoint_data const& lcd, execution_exception const& ex ) = 0; + + /// Invoked when Unit Test Framework detects uncaught exception + /// + /// Call to this function finishes uncaught exception report. + /// @param[in] os output stream to write a messages into + /// @see log_exception_start + virtual void log_exception_finish( std::ostream& os ) = 0; + // @} + + // @name Regular log entry + + /// Invoked by Unit Test Framework to start new log entry + + /// Call to this function starts new log entry. It is followed by series of log_entry_value calls and finally call to log_entry_finish. + /// A log entry may consist of one or more values being reported. Some of these values will be plain strings, while others can be complicated + /// expressions in a form of "lazy" expression template lazy_ostream. + /// @param[in] os output stream to write a messages into + /// @param[in] led log entry attributes + /// @param[in] let log entry type log_entry_finish + /// @see log_entry_value, log_entry_finish + /// + /// @note call to this function may happen before any call to test_unit_start or all calls to test_unit_finish as the + /// framework might log errors raised during global initialization/shutdown. + virtual void log_entry_start( std::ostream& os, log_entry_data const& led, log_entry_types let ) = 0; + + /// Invoked by Unit Test Framework to report a log entry content + /// + /// This is one of two overloaded methods to report log entry content. This one is used to report plain string value. + /// @param[in] os output stream to write a messages into. + /// @param[in] value log entry string value + /// @see log_entry_start, log_entry_finish + virtual void log_entry_value( std::ostream& os, const_string value ) = 0; + + /// Invoked by Unit Test Framework to report a log entry content + + /// This is one of two overloaded methods to report log entry content. This one is used to report some complicated expression passed as + /// an expression template lazy_ostream. In most cases default implementation provided by the framework should work as is (it just converts + /// the lazy expression into a string. + /// @param[in] os output stream to write a messages into + /// @param[in] value log entry "lazy" value + /// @see log_entry_start, log_entry_finish + virtual void log_entry_value( std::ostream& os, lazy_ostream const& value ); // there is a default impl + + /// Invoked by Unit Test Framework to finish a log entry report + + /// @param[in] os output stream to write a messages into + /// @see log_entry_start, log_entry_start + virtual void log_entry_finish( std::ostream& os ) = 0; + // @} + + // @name Log entry context report + + /// Invoked by Unit Test Framework to start log entry context report + // + /// Unit Test Framework logs for failed assertions and uncaught exceptions context if one was defined by a test module. + /// Context consists of multiple "scopes" identified by description messages assigned by the test module using + /// BOOST_TEST_INFO/BOOST_TEST_CONTEXT statements. + /// @param[in] os output stream to write a messages into + /// @param[in] l entry log_level, to be used to fine tune the message + /// @see log_entry_context, entry_context_finish + virtual void entry_context_start( std::ostream& os, log_level l ) = 0; + + /// Invoked by Unit Test Framework to report log entry context "scope" description + // + /// Each "scope" description is reported by separate call to log_entry_context. + /// @param[in] os output stream to write a messages into + /// @param[in] l entry log_level, to be used to fine tune the message + /// @param[in] value context "scope" description + /// @see log_entry_start, entry_context_finish + virtual void log_entry_context( std::ostream& os, log_level l, const_string value ) = 0; + + /// Invoked by Unit Test Framework to finish log entry context report + /// + /// @param[in] os output stream to write a messages into + /// @param[in] l entry log_level, to be used to fine tune the message + /// @see log_entry_start, entry_context_context + virtual void entry_context_finish( std::ostream& os, log_level l ) = 0; + // @} + + // @name Log level management + + /// Sets the log level of the logger/formatter + /// + /// Some loggers need to manage the log level by their own. This + /// member function let the implementation decide of that. + /// @par Since Boost 1.62 + virtual void set_log_level(log_level new_log_level); + + /// Returns the log level of the logger/formatter + /// @par Since Boost 1.62 + virtual log_level get_log_level() const; + // @} + + + // @name Stream management + + /// Returns a default stream for this logger. + /// + /// The returned string describes the stream as if it was passed from + /// the command line @c "--log_sink" parameter. With that regards, @b stdout and @b stderr + /// have special meaning indicating the standard output or error stream respectively. + /// + /// @par Since Boost 1.62 + virtual std::string get_default_stream_description() const + { + return "stdout"; + } + + // @} + + +protected: + log_level m_log_level; + +}; + +} // namespace unit_test +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER + diff --git a/libraries/boost/include/boost/test/unit_test_monitor.hpp b/libraries/boost/include/boost/test/unit_test_monitor.hpp new file mode 100644 index 0000000000..1f937fa674 --- /dev/null +++ b/libraries/boost/include/boost/test/unit_test_monitor.hpp @@ -0,0 +1,60 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief defines specific version of execution monitor used to managed run unit of test cases +/// +/// Translates execution exception into error level +// *************************************************************************** + +#ifndef BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER +#define BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER + +// Boost.Test +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** unit_test_monitor ************** // +// ************************************************************************** // + +class BOOST_TEST_DECL unit_test_monitor_t : public singleton, public execution_monitor { +public: + enum error_level { + test_ok = 0, + precondition_failure = -1, + unexpected_exception = -2, + os_exception = -3, + os_timeout = -4, + fatal_error = -5 // includes both system and user + }; + + static bool is_critical_error( error_level e ) { return e <= fatal_error; } + + // monitor method + error_level execute_and_translate( boost::function const& func, unsigned timeout = 0 ); + +private: + BOOST_TEST_SINGLETON_CONS( unit_test_monitor_t ) +}; + +BOOST_TEST_SINGLETON_INST( unit_test_monitor ) + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER diff --git a/libraries/boost/include/boost/test/unit_test_parameters.hpp b/libraries/boost/include/boost/test/unit_test_parameters.hpp new file mode 100644 index 0000000000..e01bbd7aed --- /dev/null +++ b/libraries/boost/include/boost/test/unit_test_parameters.hpp @@ -0,0 +1,158 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Provides access to various Unit Test Framework runtime parameters +/// +/// Primarily for use by the framework itself +// *************************************************************************** + +#ifndef BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER +#define BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER + +// Boost.Test +#include +#include +#include + +// Boost +#include + +// STL +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace runtime_config { + +// ************************************************************************** // +// ************** runtime_config ************** // +// ************************************************************************** // + +// UTF parameters +BOOST_TEST_DECL extern std::string btrt_auto_start_dbg; +BOOST_TEST_DECL extern std::string btrt_break_exec_path; +BOOST_TEST_DECL extern std::string btrt_build_info; +BOOST_TEST_DECL extern std::string btrt_catch_sys_errors; +BOOST_TEST_DECL extern std::string btrt_color_output; +BOOST_TEST_DECL extern std::string btrt_detect_fp_except; +BOOST_TEST_DECL extern std::string btrt_detect_mem_leaks; +BOOST_TEST_DECL extern std::string btrt_list_content; +BOOST_TEST_DECL extern std::string btrt_list_labels; +BOOST_TEST_DECL extern std::string btrt_log_format; +BOOST_TEST_DECL extern std::string btrt_log_level; +BOOST_TEST_DECL extern std::string btrt_log_sink; +BOOST_TEST_DECL extern std::string btrt_combined_logger; +BOOST_TEST_DECL extern std::string btrt_output_format; +BOOST_TEST_DECL extern std::string btrt_random_seed; +BOOST_TEST_DECL extern std::string btrt_report_format; +BOOST_TEST_DECL extern std::string btrt_report_level; +BOOST_TEST_DECL extern std::string btrt_report_mem_leaks; +BOOST_TEST_DECL extern std::string btrt_report_sink; +BOOST_TEST_DECL extern std::string btrt_result_code; +BOOST_TEST_DECL extern std::string btrt_run_filters; +BOOST_TEST_DECL extern std::string btrt_save_test_pattern; +BOOST_TEST_DECL extern std::string btrt_show_progress; +BOOST_TEST_DECL extern std::string btrt_use_alt_stack; +BOOST_TEST_DECL extern std::string btrt_wait_for_debugger; +BOOST_TEST_DECL extern std::string btrt_help; +BOOST_TEST_DECL extern std::string btrt_usage; +BOOST_TEST_DECL extern std::string btrt_version; + +BOOST_TEST_DECL void init( int& argc, char** argv ); + +// ************************************************************************** // +// ************** runtime_param::get ************** // +// ************************************************************************** // + +/// Access to arguments +BOOST_TEST_DECL runtime::arguments_store const& argument_store(); + +template +inline T const& +get( runtime::cstring parameter_name ) +{ + return argument_store().get( parameter_name ); +} + +inline bool has( runtime::cstring parameter_name ) +{ + return argument_store().has( parameter_name ); +} + +/// For public access +BOOST_TEST_DECL bool save_pattern(); + +// ************************************************************************** // +// ************** stream_holder ************** // +// ************************************************************************** // + +class stream_holder { +public: + // Constructor + explicit stream_holder( std::ostream& default_stream = std::cout ) + : m_stream( &default_stream ) + { + } + + void setup( const const_string& stream_name, + boost::function const &cleaner_callback = boost::function() ) + { + if(stream_name.empty()) + return; + + if( stream_name == "stderr" ) { + m_stream = &std::cerr; + m_cleaner.reset(); + } + else if( stream_name == "stdout" ) { + m_stream = &std::cout; + m_cleaner.reset(); + } + else { + m_cleaner = boost::make_shared(cleaner_callback); + m_cleaner->m_file.open( std::string(stream_name.begin(), stream_name.end()).c_str() ); + m_stream = &m_cleaner->m_file; + } + } + + // Access methods + std::ostream& ref() const { return *m_stream; } + +private: + struct callback_cleaner { + callback_cleaner(boost::function cleaner_callback) + : m_cleaner_callback(cleaner_callback) + , m_file() { + } + ~callback_cleaner() { + if( m_cleaner_callback ) + m_cleaner_callback(); + } + boost::function m_cleaner_callback; + std::ofstream m_file; + }; + + // Data members + boost::shared_ptr m_cleaner; + std::ostream* m_stream; +}; + +} // namespace runtime_config +} // namespace unit_test +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER diff --git a/libraries/boost/include/boost/test/unit_test_suite.hpp b/libraries/boost/include/boost/test/unit_test_suite.hpp new file mode 100644 index 0000000000..13ff804b44 --- /dev/null +++ b/libraries/boost/include/boost/test/unit_test_suite.hpp @@ -0,0 +1,403 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// @brief Defines Unit Test Framework public API +// *************************************************************************** + +#ifndef BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER +#define BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER + +// Boost.Test +#include +#include +#include +#include + + +#include + + +#include + + + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** Non-auto (explicit) test case interface ************** // +// ************************************************************************** // + +#define BOOST_TEST_CASE( test_function ) \ +boost::unit_test::make_test_case( boost::function(test_function), \ + BOOST_TEST_STRINGIZE( test_function ), \ + __FILE__, __LINE__ ) +#define BOOST_CLASS_TEST_CASE( test_function, tc_instance ) \ +boost::unit_test::make_test_case( (test_function), \ + BOOST_TEST_STRINGIZE( test_function ), \ + __FILE__, __LINE__, tc_instance ) + +// ************************************************************************** // +// ************** BOOST_TEST_SUITE ************** // +// ************************************************************************** // + +#define BOOST_TEST_SUITE( testsuite_name ) \ +( new boost::unit_test::test_suite( testsuite_name, __FILE__, __LINE__ ) ) + +// ************************************************************************** // +// ************** BOOST_AUTO_TEST_SUITE ************** // +// ************************************************************************** // + +#define BOOST_AUTO_TEST_SUITE_WITH_DECOR( suite_name, decorators ) \ +namespace suite_name { \ +BOOST_AUTO_TU_REGISTRAR( suite_name )( \ + BOOST_STRINGIZE( suite_name ), \ + __FILE__, __LINE__, \ + decorators ); \ +/**/ + +#define BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \ + BOOST_AUTO_TEST_SUITE_WITH_DECOR( \ + suite_name, \ + boost::unit_test::decorator::collector::instance() ) \ +/**/ + +#if BOOST_PP_VARIADICS +#define BOOST_AUTO_TEST_SUITE( ... ) \ + BOOST_TEST_INVOKE_IF_N_ARGS( 1, \ + BOOST_AUTO_TEST_SUITE_NO_DECOR, \ + BOOST_AUTO_TEST_SUITE_WITH_DECOR, \ + __VA_ARGS__) \ +/**/ + +#else /* BOOST_PP_VARIADICS */ + +#define BOOST_AUTO_TEST_SUITE( suite_name ) \ + BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \ +/**/ + + +#endif /* BOOST_PP_VARIADICS */ + +// ************************************************************************** // +// ************** BOOST_FIXTURE_TEST_SUITE ************** // +// ************************************************************************** // + +#define BOOST_FIXTURE_TEST_SUITE_WITH_DECOR(suite_name, F, decorators) \ + BOOST_AUTO_TEST_SUITE_WITH_DECOR( suite_name, decorators ) \ +typedef F BOOST_AUTO_TEST_CASE_FIXTURE; \ +/**/ + +#define BOOST_FIXTURE_TEST_SUITE_NO_DECOR( suite_name, F ) \ + BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \ +typedef F BOOST_AUTO_TEST_CASE_FIXTURE; \ +/**/ + +#if BOOST_PP_VARIADICS + +#define BOOST_FIXTURE_TEST_SUITE( ... ) \ + BOOST_TEST_INVOKE_IF_N_ARGS( 2, \ + BOOST_FIXTURE_TEST_SUITE_NO_DECOR, \ + BOOST_FIXTURE_TEST_SUITE_WITH_DECOR, \ + __VA_ARGS__) \ +/**/ + +#else /* BOOST_PP_VARIADICS */ + +#define BOOST_FIXTURE_TEST_SUITE( suite_name, F ) \ + BOOST_FIXTURE_TEST_SUITE_NO_DECOR( suite_name, F ) \ +/**/ + + +#endif /* BOOST_PP_VARIADICS */ + + +// ************************************************************************** // +// ************** BOOST_AUTO_TEST_SUITE_END ************** // +// ************************************************************************** // + +#define BOOST_AUTO_TEST_SUITE_END() \ +BOOST_AUTO_TU_REGISTRAR( end_suite )( 1 ); \ +} \ +/**/ + +// ************************************************************************** // +// ************** BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES ************** // +// ************************************************************************** // + +/// @deprecated use decorator instead +#define BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES( test_name, n ) \ +BOOST_TEST_DECORATOR( * boost::unit_test::expected_failures( n ) ) \ +/**/ + +// ************************************************************************** // +// ************** BOOST_FIXTURE_TEST_CASE ************** // +// ************************************************************************** // + +#define BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, F, decorators ) \ +struct test_name : public F { void test_method(); }; \ + \ +static void BOOST_AUTO_TC_INVOKER( test_name )() \ +{ \ + BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture ctor"); \ + test_name t; \ + BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture setup"); \ + boost::unit_test::setup_conditional(t); \ + BOOST_TEST_CHECKPOINT('"' << #test_name << "\" test entry"); \ + t.test_method(); \ + BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture teardown"); \ + boost::unit_test::teardown_conditional(t); \ + BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture dtor"); \ +} \ + \ +struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {}; \ + \ +BOOST_AUTO_TU_REGISTRAR( test_name )( \ + boost::unit_test::make_test_case( \ + &BOOST_AUTO_TC_INVOKER( test_name ), \ + #test_name, __FILE__, __LINE__ ), \ + decorators ); \ + \ +void test_name::test_method() \ +/**/ + +#define BOOST_FIXTURE_TEST_CASE_NO_DECOR( test_name, F ) \ +BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, F, \ + boost::unit_test::decorator::collector::instance() ) \ +/**/ + +#if BOOST_PP_VARIADICS + +#define BOOST_FIXTURE_TEST_CASE( ... ) \ + BOOST_TEST_INVOKE_IF_N_ARGS( 2, \ + BOOST_FIXTURE_TEST_CASE_NO_DECOR, \ + BOOST_FIXTURE_TEST_CASE_WITH_DECOR, \ + __VA_ARGS__) \ +/**/ + +#else /* BOOST_PP_VARIADICS */ + +#define BOOST_FIXTURE_TEST_CASE( test_name, F ) \ + BOOST_FIXTURE_TEST_CASE_NO_DECOR(test_name, F) \ +/**/ + + +#endif /* BOOST_PP_VARIADICS */ + +// ************************************************************************** // +// ************** BOOST_AUTO_TEST_CASE ************** // +// ************************************************************************** // + +#define BOOST_AUTO_TEST_CASE_NO_DECOR( test_name ) \ + BOOST_FIXTURE_TEST_CASE_NO_DECOR( test_name, \ + BOOST_AUTO_TEST_CASE_FIXTURE ) \ +/**/ + +#define BOOST_AUTO_TEST_CASE_WITH_DECOR( test_name, decorators ) \ + BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, \ + BOOST_AUTO_TEST_CASE_FIXTURE, decorators ) \ +/**/ + +#if BOOST_PP_VARIADICS + +#define BOOST_AUTO_TEST_CASE( ... ) \ + BOOST_TEST_INVOKE_IF_N_ARGS( 1, \ + BOOST_AUTO_TEST_CASE_NO_DECOR, \ + BOOST_AUTO_TEST_CASE_WITH_DECOR, \ + __VA_ARGS__) \ +/**/ + +#else /* BOOST_PP_VARIADICS */ + +#define BOOST_AUTO_TEST_CASE( test_name ) \ + BOOST_AUTO_TEST_CASE_NO_DECOR( test_name ) \ +/**/ + + +#endif /* BOOST_PP_VARIADICS */ + +// ************************************************************************** // +// ************** BOOST_FIXTURE_TEST_CASE_TEMPLATE ************** // +// ************************************************************************** // + +#define BOOST_FIXTURE_TEST_CASE_TEMPLATE( test_name, type_name, TL, F ) \ +template \ +struct test_name : public F \ +{ void test_method(); }; \ + \ +struct BOOST_AUTO_TC_INVOKER( test_name ) { \ + template \ + static void run( boost::type* = 0 ) \ + { \ + BOOST_TEST_CHECKPOINT('"' << #test_name <<"\" fixture entry."); \ + test_name t; boost::unit_test::setup_conditional(t); \ + BOOST_TEST_CHECKPOINT('"' << #test_name << "\" entry."); \ + t.test_method(); \ + BOOST_TEST_CHECKPOINT('"' << #test_name << "\" exit."); \ + boost::unit_test::teardown_conditional(t); \ + } \ +}; \ + \ +BOOST_AUTO_TU_REGISTRAR( test_name )( \ + boost::unit_test::ut_detail::template_test_case_gen< \ + BOOST_AUTO_TC_INVOKER( test_name ),TL >( \ + BOOST_STRINGIZE( test_name ), __FILE__, __LINE__ ), \ + boost::unit_test::decorator::collector::instance() ); \ + \ +template \ +void test_name::test_method() \ +/**/ + +// ************************************************************************** // +// ************** BOOST_AUTO_TEST_CASE_TEMPLATE ************** // +// ************************************************************************** // + +#define BOOST_AUTO_TEST_CASE_TEMPLATE( test_name, type_name, TL ) \ +BOOST_FIXTURE_TEST_CASE_TEMPLATE( test_name, type_name, TL, \ + BOOST_AUTO_TEST_CASE_FIXTURE ) \ +/**/ + +// ************************************************************************** // +// ************** BOOST_TEST_CASE_TEMPLATE ************** // +// ************************************************************************** // + +#define BOOST_TEST_CASE_TEMPLATE( name, typelist ) \ + boost::unit_test::ut_detail::template_test_case_gen( \ + BOOST_TEST_STRINGIZE( name ), __FILE__, __LINE__ ) \ +/**/ + +// ************************************************************************** // +// ************** BOOST_TEST_CASE_TEMPLATE_FUNCTION ************** // +// ************************************************************************** // + +#define BOOST_TEST_CASE_TEMPLATE_FUNCTION( name, type_name ) \ +template \ +void BOOST_JOIN( name, _impl )( boost::type* ); \ + \ +struct name { \ + template \ + static void run( boost::type* frwrd = 0 ) \ + { \ + BOOST_JOIN( name, _impl )( frwrd ); \ + } \ +}; \ + \ +template \ +void BOOST_JOIN( name, _impl )( boost::type* ) \ +/**/ + +// ************************************************************************** // +// ************** BOOST_GLOBAL_FIXTURE ************** // +// ************************************************************************** // + +#define BOOST_GLOBAL_FIXTURE( F ) \ +static boost::unit_test::ut_detail::global_configuration_impl BOOST_JOIN( gf_, F ) \ +/**/ + +// ************************************************************************** // +// ************** BOOST_TEST_GLOBAL_CONFIGURATION ************** // +// ************************************************************************** // + +#define BOOST_TEST_GLOBAL_CONFIGURATION( F ) \ +static boost::unit_test::ut_detail::global_configuration_impl BOOST_JOIN( gf_, F ) \ +/**/ + +// ************************************************************************** // +// ************** BOOST_TEST_GLOBAL_FIXTURE ************** // +// ************************************************************************** // + +#define BOOST_TEST_GLOBAL_FIXTURE( F ) \ +static boost::unit_test::ut_detail::global_fixture_impl BOOST_JOIN( gf_, F ) \ +/**/ + +// ************************************************************************** // +// ************** BOOST_TEST_DECORATOR ************** // +// ************************************************************************** // + +#define BOOST_TEST_DECORATOR( D ) \ +static boost::unit_test::decorator::collector const& \ +BOOST_TEST_APPEND_UNIQUE_ID(decorator_collector) = D; \ +/**/ + +// ************************************************************************** // +// ************** BOOST_AUTO_TEST_CASE_FIXTURE ************** // +// ************************************************************************** // + +namespace boost { namespace unit_test { namespace ut_detail { + +struct nil_t {}; + +} // namespace ut_detail +} // unit_test +} // namespace boost + +// Intentionally is in global namespace, so that FIXTURE_TEST_SUITE can reset it in user code. +typedef ::boost::unit_test::ut_detail::nil_t BOOST_AUTO_TEST_CASE_FIXTURE; + +// ************************************************************************** // +// ************** Auto registration facility helper macros ************** // +// ************************************************************************** // + +// Facility for having a unique name based on __LINE__ and __COUNTER__ (later if available) +#if defined(__COUNTER__) + #define BOOST_TEST_INTERNAL_HAS_COUNTER +#endif + +#if defined(BOOST_TEST_INTERNAL_HAS_COUNTER) + #define BOOST_TEST_APPEND_UNIQUE_ID( name ) \ + BOOST_JOIN( BOOST_JOIN( name, __LINE__ ), __COUNTER__) + /**/ +#else + #define BOOST_TEST_APPEND_UNIQUE_ID( name ) \ + BOOST_JOIN( name, __LINE__ ) + /**/ +#endif +/**/ + +#define BOOST_AUTO_TU_REGISTRAR( test_name ) \ +static boost::unit_test::ut_detail::auto_test_unit_registrar \ +BOOST_TEST_APPEND_UNIQUE_ID( BOOST_JOIN( test_name, _registrar ) ) \ +/**/ +#define BOOST_AUTO_TC_INVOKER( test_name ) BOOST_JOIN( test_name, _invoker ) +#define BOOST_AUTO_TC_UNIQUE_ID( test_name ) BOOST_JOIN( test_name, _id ) + +// ************************************************************************** // +// ************** BOOST_TEST_MAIN ************** // +// ************************************************************************** // + +#if defined(BOOST_TEST_MAIN) + +#ifdef BOOST_TEST_ALTERNATIVE_INIT_API +bool init_unit_test() { +#else +::boost::unit_test::test_suite* +init_unit_test_suite( int, char* [] ) { +#endif + +#ifdef BOOST_TEST_MODULE + using namespace ::boost::unit_test; + assign_op( framework::master_test_suite().p_name.value, BOOST_TEST_STRINGIZE( BOOST_TEST_MODULE ).trim( "\"" ), 0 ); + +#endif + +#ifdef BOOST_TEST_ALTERNATIVE_INIT_API + return true; +} +#else + return 0; +} +#endif + +#endif + +//____________________________________________________________________________// + +#include + + +#endif // BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER + diff --git a/libraries/boost/include/boost/test/utils/algorithm.hpp b/libraries/boost/include/boost/test/utils/algorithm.hpp new file mode 100644 index 0000000000..7f16816c3a --- /dev/null +++ b/libraries/boost/include/boost/test/utils/algorithm.hpp @@ -0,0 +1,326 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +/// @file +/// Addition to STL algorithms +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_ALGORITHM_HPP +#define BOOST_TEST_UTILS_ALGORITHM_HPP + +// STL +#include +#include // std::find +#include // std::bind1st or std::bind + +#include + +#ifdef BOOST_NO_CXX98_BINDERS +#define BOOST_TEST_BIND1ST(F,A) std::bind( (F), (A), std::placeholders::_1 ) +#else +#define BOOST_TEST_BIND1ST(F,A) std::bind1st( (F), (A) ) +#endif + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace utils { + +/// @brief this algorithm search through two collections for first mismatch position that get returned as a pair +/// of iterators, first pointing to the mismatch position in first collection, second iterator in second one +/// +/// @param first1 - first collection begin iterator +/// @param last1 - first collection end iterator +/// @param first2 - second collection begin iterator +/// @param last2 - second collection end iterator +template +inline std::pair +mismatch( InputIter1 first1, InputIter1 last1, + InputIter2 first2, InputIter2 last2 ) +{ + while( first1 != last1 && first2 != last2 && *first1 == *first2 ) { + ++first1; + ++first2; + } + + return std::pair(first1, first2); +} + +//____________________________________________________________________________// + +/// @brief this algorithm search through two collections for first mismatch position that get returned as a pair +/// of iterators, first pointing to the mismatch position in first collection, second iterator in second one. This algorithms +/// uses supplied predicate for collection elements comparison +/// +/// @param first1 - first collection begin iterator +/// @param last1 - first collection end iterator +/// @param first2 - second collection begin iterator +/// @param last2 - second collection end iterator +/// @param pred - predicate to be used for search +template +inline std::pair +mismatch( InputIter1 first1, InputIter1 last1, + InputIter2 first2, InputIter2 last2, + Predicate pred ) +{ + while( first1 != last1 && first2 != last2 && pred( *first1, *first2 ) ) { + ++first1; + ++first2; + } + + return std::pair(first1, first2); +} + +//____________________________________________________________________________// + +/// @brief this algorithm search through first collection for first element that does not belong a second one +/// +/// @param first1 - first collection begin iterator +/// @param last1 - first collection end iterator +/// @param first2 - second collection begin iterator +/// @param last2 - second collection end iterator +template +inline ForwardIterator1 +find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2 ) +{ + while( first1 != last1 ) { + if( std::find( first2, last2, *first1 ) == last2 ) + break; + ++first1; + } + + return first1; +} + +//____________________________________________________________________________// + +/// @brief this algorithm search through first collection for first element that does not satisfy binary +/// predicate in conjunction will any element in second collection +/// +/// @param first1 - first collection begin iterator +/// @param last1 - first collection end iterator +/// @param first2 - second collection begin iterator +/// @param last2 - second collection end iterator +/// @param pred - predicate to be used for search +template +inline ForwardIterator1 +find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + Predicate pred ) +{ + while( first1 != last1 ) { + if( std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *first1 ) ) == last2 ) + break; + ++first1; + } + + return first1; +} + +//____________________________________________________________________________// + +/// @brief this algorithm search through first collection for last element that belongs to a second one +/// +/// @param first1 - first collection begin iterator +/// @param last1 - first collection end iterator +/// @param first2 - second collection begin iterator +/// @param last2 - second collection end iterator +template +inline BidirectionalIterator1 +find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2 ) +{ + if( first1 == last1 || first2 == last2 ) + return last1; + + BidirectionalIterator1 it1 = last1; + while( --it1 != first1 && std::find( first2, last2, *it1 ) == last2 ) {} + + return it1 == first1 && std::find( first2, last2, *it1 ) == last2 ? last1 : it1; +} + +//____________________________________________________________________________// + +/// @brief this algorithm search through first collection for last element that satisfy binary +/// predicate in conjunction will at least one element in second collection +/// +/// @param first1 - first collection begin iterator +/// @param last1 - first collection end iterator +/// @param first2 - second collection begin iterator +/// @param last2 - second collection end iterator +/// @param pred - predicate to be used for search +template +inline BidirectionalIterator1 +find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + Predicate pred ) +{ + if( first1 == last1 || first2 == last2 ) + return last1; + + BidirectionalIterator1 it1 = last1; + while( --it1 != first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ) {} + + return it1 == first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ? last1 : it1; +} + +//____________________________________________________________________________// + +/// @brief this algorithm search through first collection for last element that does not belong to a second one +/// +/// @param first1 - first collection begin iterator +/// @param last1 - first collection end iterator +/// @param first2 - second collection begin iterator +/// @param last2 - second collection end iterator +template +inline BidirectionalIterator1 +find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2 ) +{ + if( first1 == last1 || first2 == last2 ) + return last1; + + BidirectionalIterator1 it1 = last1; + while( --it1 != first1 && std::find( first2, last2, *it1 ) != last2 ) {} + + return it1 == first1 && std::find( first2, last2, *it1 ) != last2 ? last1 : it1; +} + +//____________________________________________________________________________// + +/// @brief this algorithm search through first collection for last element that does not satisfy binary +/// predicate in conjunction will any element in second collection +/// +/// @param first1 - first collection begin iterator +/// @param last1 - first collection end iterator +/// @param first2 - second collection begin iterator +/// @param last2 - second collection end iterator +/// @param pred - predicate to be used for search +template +inline BidirectionalIterator1 +find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + Predicate pred ) +{ + if( first1 == last1 || first2 == last2 ) + return last1; + + BidirectionalIterator1 it1 = last1; + while( --it1 != first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) != last2 ) {} + + return it1 == first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ? last1 : it1; +} + +//____________________________________________________________________________// + + +/// @brief This algorithm replaces all occurrences of a set of substrings by another substrings +/// +/// @param str - string of operation +/// @param first1 - iterator to the beginning of the substrings to replace +/// @param last1 - iterator to the end of the substrings to replace +/// @param first2 - iterator to the beginning of the substrings to replace with +/// @param last2 - iterator to the end of the substrings to replace with +template +inline StringClass +replace_all_occurrences_of( StringClass str, + ForwardIterator first1, ForwardIterator last1, + ForwardIterator first2, ForwardIterator last2) +{ + for(; first1 != last1 && first2 != last2; ++first1, ++first2) { + std::size_t found = str.find( *first1 ); + while( found != StringClass::npos ) { + str.replace(found, first1->size(), *first2 ); + found = str.find( *first1, found + first2->size() ); + } + } + + return str; +} + +/// @brief This algorithm replaces all occurrences of a string with basic wildcards +/// with another (optionally containing wildcards as well). +/// +/// @param str - string to transform +/// @param it_string_to_find - iterator to the beginning of the substrings to replace +/// @param it_string_to_find_end - iterator to the end of the substrings to replace +/// @param it_string_to_replace - iterator to the beginning of the substrings to replace with +/// @param it_string_to_replace_end - iterator to the end of the substrings to replace with +/// +/// The wildcard is the symbol '*'. Only a unique wildcard per string is supported. The replacement +/// string may also contain a wildcard, in which case it is considered as a placeholder to the content +/// of the wildcard in the source string. +/// Example: +/// - In order to replace the occurrences of @c 'time=\"some-variable-value\"' to a constant string, +/// one may use @c 'time=\"*\"' as the string to search for, and 'time=\"0.0\"' as the replacement string. +/// - In order to replace the occurrences of 'file.cpp(XX)' per 'file.cpp:XX', where XX is a variable to keep, +/// on may use @c 'file.cpp(*)' as the string to search for, and 'file.cpp:*' as the replacement string. +template +inline StringClass +replace_all_occurrences_with_wildcards( + StringClass str, + ForwardIterator it_string_to_find, ForwardIterator it_string_to_find_end, + ForwardIterator it_string_to_replace, ForwardIterator it_string_to_replace_end) +{ + for(; it_string_to_find != it_string_to_find_end && it_string_to_replace != it_string_to_replace_end; + ++it_string_to_find, ++ it_string_to_replace) { + + std::size_t wildcard_pos = it_string_to_find->find("*"); + if(wildcard_pos == StringClass::npos) { + ForwardIterator it_to_find_current_end(it_string_to_find); + ForwardIterator it_to_replace_current_end(it_string_to_replace); + str = replace_all_occurrences_of( + str, + it_string_to_find, ++it_to_find_current_end, + it_string_to_replace, ++it_to_replace_current_end); + continue; + } + + std::size_t wildcard_pos_replace = it_string_to_replace->find("*"); + + std::size_t found_begin = str.find( it_string_to_find->substr(0, wildcard_pos) ); + while( found_begin != StringClass::npos ) { + std::size_t found_end = str.find(it_string_to_find->substr(wildcard_pos+1), found_begin + wildcard_pos + 1); // to simplify + if( found_end != StringClass::npos ) { + + if( wildcard_pos_replace == StringClass::npos ) { + StringClass replace_content = *it_string_to_replace; + str.replace( + found_begin, + found_end + (it_string_to_find->size() - wildcard_pos - 1 ) - found_begin, + replace_content); + } else { + StringClass replace_content = + it_string_to_replace->substr(0, wildcard_pos_replace) + + str.substr(found_begin + wildcard_pos, + found_end - found_begin - wildcard_pos) + + it_string_to_replace->substr(wildcard_pos_replace+1) ; + str.replace( + found_begin, + found_end + (it_string_to_find->size() - wildcard_pos - 1 ) - found_begin, + replace_content); + + } + } + + // may adapt the restart to the replacement and be more efficient + found_begin = str.find( it_string_to_find->substr(0, wildcard_pos), found_begin + 1 ); + } + } + + return str; +} + +} // namespace utils +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_ALGORITHM_HPP diff --git a/libraries/boost/include/boost/test/utils/assign_op.hpp b/libraries/boost/include/boost/test/utils/assign_op.hpp new file mode 100644 index 0000000000..89d8bfa956 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/assign_op.hpp @@ -0,0 +1,39 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : overloadable assignment +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_ASSIGN_OP_HPP +#define BOOST_TEST_UTILS_ASSIGN_OP_HPP + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** generic assign operator ************** // +// ************************************************************************** // + +// generic +template +inline void +assign_op( T& t, S const& s, long ) +{ + t = s; +} + +//____________________________________________________________________________// + +} // namespace unit_test +} // namespace boost + +#endif // BOOST_TEST_UTILS_ASSIGN_OP_HPP + diff --git a/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring.hpp b/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring.hpp new file mode 100644 index 0000000000..cec0214b73 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring.hpp @@ -0,0 +1,749 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : class basic_cstring wraps C string and provide std_string like +// interface +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_HPP +#define BOOST_TEST_UTILS_BASIC_CSTRING_HPP + +// Boost.Test +#include +#include + +// Boost +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +// ************************************************************************** // +// ************** basic_cstring ************** // +// ************************************************************************** // + +template +class basic_cstring { + typedef basic_cstring self_type; +public: + // Subtypes + typedef ut_detail::bcs_char_traits traits_type; + typedef typename traits_type::std_string std_string; + + typedef CharT value_type; + typedef typename remove_cv::type value_ret_type; + typedef value_type* pointer; + typedef value_type const* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + typedef value_type const* const_iterator; + typedef value_type* iterator; + + // !! should also present reverse_iterator, const_reverse_iterator + +#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) && !defined(__DCC__) + BOOST_STATIC_CONSTANT(size_type, npos = static_cast(-1)); +#else + // IBM/VisualAge version 6 is not able to handle enums larger than 4 bytes. + // But size_type is 8 bytes in 64bit mode. + static const size_type npos = -1 ; +#endif + + static pointer null_str(); + + // Constructors; default copy constructor is generated by compiler + basic_cstring(); + basic_cstring( basic_cstring const & ); + basic_cstring( std_string const& s ); + basic_cstring( pointer s ); + template + basic_cstring( pointer s, LenType len ) : m_begin( s ), m_end( m_begin + len ) {} + basic_cstring( pointer first, pointer last ); + + // data access methods + value_ret_type operator[]( size_type index ) const; + value_ret_type at( size_type index ) const; + + // size operators + size_type size() const; + bool is_empty() const; + void clear(); + void resize( size_type new_len ); + + // !! only for STL container conformance use is_empty instead + bool empty() const; + + // Trimming + self_type& trim_right( size_type trim_size ); + self_type& trim_left( size_type trim_size ); + self_type& trim_right( iterator it ); + self_type& trim_left( iterator it ); +#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(800)) + self_type& trim_left( self_type exclusions = self_type() ) ; + self_type& trim_right( self_type exclusions = self_type() ) ; + self_type& trim( self_type exclusions = self_type() ) ; +#else + // VA C++/XL C++ v6 and v8 has in this case a problem with the default arguments. + self_type& trim_left( self_type exclusions ); + self_type& trim_right( self_type exclusions ); + self_type& trim( self_type exclusions ); + self_type& trim_left() { return trim_left( self_type() ); } + self_type& trim_right() { return trim_right( self_type() ); } + self_type& trim() { return trim( self_type() ); } +#endif + + // Assignment operators + basic_cstring& operator=( self_type const& s ); + basic_cstring& operator=( std_string const& s ); + basic_cstring& operator=( pointer s ); + + template + basic_cstring& assign( basic_cstring const& s ) + { + return *this = basic_cstring( s.begin(), s.end() ); + } + template + basic_cstring& assign( self_type const& s, PosType pos, LenType len ) + { + return *this = self_type( s.m_begin + pos, len ); + } + + basic_cstring& assign( std_string const& s ); + template + basic_cstring& assign( std_string const& s, PosType pos, LenType len ) + { + return *this = self_type( s.c_str() + pos, len ); + } + basic_cstring& assign( pointer s ); + template + basic_cstring& assign( pointer s, LenType len ) + { + return *this = self_type( s, len ); + } + basic_cstring& assign( pointer f, pointer l ); + + // swapping + void swap( self_type& s ); + + // Iterators + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + + // !! should have rbegin, rend + + // substring search operation + size_type find( basic_cstring ) const; + size_type rfind( basic_cstring ) const; + self_type substr( size_type beg_index, size_type end_index = npos ) const; + +private: + static self_type default_trim_ex(); + + // Data members + iterator m_begin; + iterator m_end; +}; + +//____________________________________________________________________________// + +template +inline typename basic_cstring::pointer +basic_cstring::null_str() +{ + static CharT null = 0; + return &null; +} + +//____________________________________________________________________________// + +template +inline +basic_cstring::basic_cstring() +: m_begin( null_str() ) +, m_end( m_begin ) +{ +} + +//____________________________________________________________________________// + +template +inline +basic_cstring::basic_cstring(basic_cstring const & s) +: m_begin( s.m_begin ) +, m_end( s.m_end ) +{ +} + +//____________________________________________________________________________// + +template +inline +basic_cstring::basic_cstring( std_string const& s ) +: m_begin( s.c_str() ) +, m_end( m_begin + s.size() ) +{ +} + +//____________________________________________________________________________// + +template +inline +basic_cstring::basic_cstring( pointer s ) +: m_begin( s ? s : null_str() ) +, m_end ( m_begin + (s ? traits_type::length( s ) : 0 ) ) +{ +} + +//____________________________________________________________________________// + +template +inline +basic_cstring::basic_cstring( pointer first, pointer last ) +: m_begin( first ) +, m_end( last ) +{ +} + +//____________________________________________________________________________// + +template +inline typename basic_cstring::value_ret_type +basic_cstring::operator[]( size_type index ) const +{ + return m_begin[index]; +} + +//____________________________________________________________________________// + +template +inline typename basic_cstring::value_ret_type +basic_cstring::at( size_type index ) const +{ + if( m_begin + index >= m_end ) + return static_cast(0); + + return m_begin[index]; +} + +//____________________________________________________________________________// + +template +inline typename basic_cstring::size_type +basic_cstring::size() const +{ + return static_cast(m_end - m_begin); +} + +//____________________________________________________________________________// + +template +inline bool +basic_cstring::is_empty() const +{ + return m_end == m_begin; +} + +//____________________________________________________________________________// + +template +inline bool +basic_cstring::empty() const +{ + return is_empty(); +} + +//____________________________________________________________________________// + +template +inline void +basic_cstring::clear() +{ + m_begin = m_end; +} + +//____________________________________________________________________________// + +template +inline void +basic_cstring::resize( size_type new_len ) +{ + if( m_begin + new_len < m_end ) + m_end = m_begin + new_len; +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::trim_left( size_type trim_size ) +{ + m_begin += trim_size; + if( m_end <= m_begin ) + clear(); + + return *this; +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::trim_left( iterator it ) +{ + m_begin = it; + if( m_end <= m_begin ) + clear(); + + return *this; +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::trim_left( basic_cstring exclusions ) +{ + if( exclusions.is_empty() ) + exclusions = default_trim_ex(); + + iterator it; + for( it = begin(); it != end(); ++it ) { + if( traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast(0) ) + break; + } + + return trim_left( it ); +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::trim_right( size_type trim_size ) +{ + m_end -= trim_size; + if( m_end <= m_begin ) + clear(); + + return *this; +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::trim_right( iterator it ) +{ + m_end = it; + if( m_end <= m_begin ) + clear(); + + return *this; +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::trim_right( basic_cstring exclusions ) +{ + if( exclusions.is_empty() ) + exclusions = default_trim_ex(); + + iterator it; + + for( it = end()-1; it != begin()-1; --it ) { + if( self_type::traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast(0) ) + break; + } + + return trim_right( it+1 ); +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::trim( basic_cstring exclusions ) +{ + trim_left( exclusions ); + trim_right( exclusions ); + + return *this; +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::operator=( basic_cstring const& s ) +{ + m_begin = s.m_begin; + m_end = s.m_end; + + return *this; +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::operator=( std_string const& s ) +{ + return *this = self_type( s ); +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::operator=( pointer s ) +{ + return *this = self_type( s ); +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::assign( std_string const& s ) +{ + return *this = self_type( s ); +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::assign( pointer s ) +{ + return *this = self_type( s ); +} + +//____________________________________________________________________________// + +template +inline basic_cstring& +basic_cstring::assign( pointer f, pointer l ) +{ + return *this = self_type( f, l ); +} + +//____________________________________________________________________________// + +template +inline void +basic_cstring::swap( basic_cstring& s ) +{ + // do not want to include alogrithm + pointer tmp1 = m_begin; + pointer tmp2 = m_end; + + m_begin = s.m_begin; + m_end = s.m_end; + + s.m_begin = tmp1; + s.m_end = tmp2; +} + +//____________________________________________________________________________// + +template +inline typename basic_cstring::iterator +basic_cstring::begin() +{ + return m_begin; +} + +//____________________________________________________________________________// + +template +inline typename basic_cstring::const_iterator +basic_cstring::begin() const +{ + return m_begin; +} + +//____________________________________________________________________________// + +template +inline typename basic_cstring::iterator +basic_cstring::end() +{ + return m_end; +} + +//____________________________________________________________________________// + +template +inline typename basic_cstring::const_iterator +basic_cstring::end() const +{ + return m_end; +} + +//____________________________________________________________________________// + +template +inline typename basic_cstring::size_type +basic_cstring::find( basic_cstring str ) const +{ + if( str.is_empty() || str.size() > size() ) + return static_cast(npos); + + const_iterator it = begin(); + const_iterator last = end() - str.size() + 1; + + while( it != last ) { + if( traits_type::compare( it, str.begin(), str.size() ) == 0 ) + break; + + ++it; + } + + return it == last ? npos : static_cast(it - begin()); +} + +//____________________________________________________________________________// + +template +inline typename basic_cstring::size_type +basic_cstring::rfind( basic_cstring str ) const +{ + if( str.is_empty() || str.size() > size() ) + return static_cast(npos); + + const_iterator it = end() - str.size(); + const_iterator last = begin()-1; + + while( it != last ) { + if( traits_type::compare( it, str.begin(), str.size() ) == 0 ) + break; + + --it; + } + + return it == last ? static_cast(npos) : static_cast(it - begin()); +} + +//____________________________________________________________________________// + +template +inline basic_cstring +basic_cstring::substr( size_type beg_index, size_type end_index ) const +{ + return beg_index > size() + ? self_type() + : end_index > size() + ? self_type( m_begin + beg_index, m_end ) + : self_type( m_begin + beg_index, m_begin + end_index ); +} + +//____________________________________________________________________________// + +template +inline basic_cstring +basic_cstring::default_trim_ex() +{ + static CharT ws[3] = { CharT(' '), CharT('\t'), CharT('\n') }; // !! wide case + + return self_type( ws, 3 ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** comparison operators ************** // +// ************************************************************************** // + +template +inline bool +operator==( basic_cstring const& s1, basic_cstring const& s2 ) +{ + typedef typename basic_cstring::traits_type traits_type; + return s1.size() == s2.size() && + traits_type::compare( s1.begin(), s2.begin(), s1.size() ) == 0; +} + +//____________________________________________________________________________// + +template +inline bool +operator==( basic_cstring const& s1, CharT2* s2 ) +{ +#if !defined(__DMC__) + return s1 == basic_cstring( s2 ); +#else + return s1 == basic_cstring( s2 ); +#endif +} + +//____________________________________________________________________________// + +template +inline bool +operator==( basic_cstring const& s1, typename basic_cstring::std_string const& s2 ) +{ + return s1 == basic_cstring( s2 ); +} + +//____________________________________________________________________________// + +template +inline bool +operator==( CharT1* s2, basic_cstring const& s1 ) +{ + return s1 == s2; +} + +//____________________________________________________________________________// + +template +inline bool +operator==( typename basic_cstring::std_string const& s2, basic_cstring const& s1 ) +{ + return s1 == s2; +} + +//____________________________________________________________________________// + +template +inline bool +operator!=( basic_cstring const& s1, CharT* s2 ) +{ + return !(s1 == s2); +} + +//____________________________________________________________________________// + +template +inline bool +operator!=( CharT* s2, basic_cstring const& s1 ) +{ + return !(s1 == s2); +} + +//____________________________________________________________________________// + +template +inline bool +operator!=( basic_cstring const& s1, basic_cstring const& s2 ) +{ + return !(s1 == s2); +} + +//____________________________________________________________________________// + +template +inline bool +operator!=( basic_cstring const& s1, typename basic_cstring::std_string const& s2 ) +{ + return !(s1 == s2); +} + +//____________________________________________________________________________// + +template +inline bool +operator!=( typename basic_cstring::std_string const& s2, basic_cstring const& s1 ) +{ + return !(s1 == s2); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** first_char ************** // +// ************************************************************************** // + +template +inline typename basic_cstring::value_ret_type +first_char( basic_cstring source ) +{ + typedef typename basic_cstring::value_ret_type res_type; + + return source.is_empty() ? static_cast(0) : *source.begin(); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** last_char ************** // +// ************************************************************************** // + +template +inline typename basic_cstring::value_ret_type +last_char( basic_cstring source ) +{ + typedef typename basic_cstring::value_ret_type res_type; + + return source.is_empty() ? static_cast(0) : *(source.end()-1); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** assign_op ************** // +// ************************************************************************** // + +template +inline void +assign_op( std::basic_string& target, basic_cstring src, int ) +{ + target.assign( src.begin(), src.size() ); +} + +//____________________________________________________________________________// + +template +inline std::basic_string& +operator+=( std::basic_string& target, basic_cstring const& str ) +{ + target.append( str.begin(), str.end() ); + return target; +} + +//____________________________________________________________________________// + +template +inline std::basic_string +operator+( std::basic_string const& lhs, basic_cstring const& rhs ) +{ + std::basic_string res( lhs ); + + res.append( rhs.begin(), rhs.end() ); + return res; +} + +//____________________________________________________________________________// + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_UTILS_BASIC_CSTRING_HPP diff --git a/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp b/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp new file mode 100644 index 0000000000..f0622263d1 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp @@ -0,0 +1,40 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : basic_cstring class wrap C string and provide std_string like +// interface +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP +#define BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP + +#include + +namespace boost { + +namespace unit_test { + +template class basic_cstring; +typedef basic_cstring const_string; +#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590041)) +typedef const_string literal_string; +#else +typedef const_string const literal_string; +#endif + +typedef char const* const c_literal_string; + +} // namespace unit_test + +} // namespace boost + +#endif // BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP + diff --git a/libraries/boost/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp b/libraries/boost/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp new file mode 100644 index 0000000000..eb77f474c7 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp @@ -0,0 +1,150 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : generic char traits class; wraps std::char_traits +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP +#define BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP + +// Boost +#include +#include +#include +#include + +// STL +#include // std::char_traits +#include // std::size_t + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +namespace ut_detail { + +template struct bcs_base_char { typedef CharT type; }; + +template<> struct bcs_base_char { typedef char type; }; +template<> struct bcs_base_char { typedef char type; }; +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +template<> struct bcs_base_char { typedef char type; }; +#endif + +template<> struct bcs_base_char { typedef wchar_t type; }; + +// ************************************************************************** // +// ************** bcs_char_traits ************** // +// ************************************************************************** // + +template +struct bcs_char_traits_impl +{ +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) + typedef CharT const const_char; +#else + typedef typename boost::add_const::type const_char; +#endif + static bool eq( CharT c1, CharT c2 ) + { + return c1 == c2; + } + static bool lt( CharT c1, CharT c2 ) + { + return c1 < c2; + } + + static int compare( const_char* cstr1, const_char* cstr2, std::size_t n ) + { + while( n > 0 ) { + if( !eq( *cstr1, *cstr2 ) ) + return lt( *cstr1, *cstr2 ) ? -1 : 1; + ++cstr1; + ++cstr2; + --n; + } + + return 0; + } + + static std::size_t length( const_char* cstr ) + { + const_char null_char = CharT(); + + const_char* ptr = cstr; + while( !eq( *ptr, null_char ) ) + ++ptr; + + return ptr - cstr; + } + + static const_char* find( const_char* s, std::size_t n, CharT c ) + { + while( n > 0 ) { + if( eq( *s, c ) ) + return s; + + ++s; + --n; + } + return 0; + } +}; + +#ifdef BOOST_CLASSIC_IOSTREAMS +template +struct char_traits_with_find : std::string_char_traits { + static CharT const* find( CharT const* s, std::size_t n, CharT c ) + { + while( n > 0 ) { + if( eq( *s, c ) ) + return s; + + ++s; + --n; + } + return 0; + } +}; + +template<> struct bcs_char_traits_impl : public char_traits_with_find {}; +template<> struct bcs_char_traits_impl : public char_traits_with_find {}; +#else +template<> struct bcs_char_traits_impl : public std::char_traits {}; +template<> struct bcs_char_traits_impl : public std::char_traits {}; +#endif + +template +class bcs_char_traits : public bcs_char_traits_impl { + typedef typename ut_detail::bcs_base_char::type the_base_char; +public: +#ifdef BOOST_CLASSIC_IOSTREAMS + typedef std::basic_string > std_string; +#else + typedef std::basic_string > std_string; +#endif +}; + +} // namespace ut_detail + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP diff --git a/libraries/boost/include/boost/test/utils/basic_cstring/compare.hpp b/libraries/boost/include/boost/test/utils/basic_cstring/compare.hpp new file mode 100644 index 0000000000..2a256fc6be --- /dev/null +++ b/libraries/boost/include/boost/test/utils/basic_cstring/compare.hpp @@ -0,0 +1,151 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : class basic_cstring comparisons implementation +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP +#define BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP + +// Boost.Test +#include + +// STL +#include +#include + +#include + +//____________________________________________________________________________// + +# if defined(BOOST_NO_STDC_NAMESPACE) && !BOOST_WORKAROUND(__BORLANDC__, <= 0x570) +namespace std { using ::toupper; } +# endif + +namespace boost { + +namespace unit_test { + +// ************************************************************************** // +// ************** case_ins_compare ************** // +// ************************************************************************** // + +namespace ut_detail { + +template +struct case_ins +{ + static bool eq( CharT c1, CharT c2 ) { return (std::toupper)( c1 ) == (std::toupper)( c2 ); } + static bool lt( CharT c1, CharT c2 ) { return (std::toupper)( c1 ) < (std::toupper)( c2 ); } + + static int compare( CharT const* s1, CharT const* s2, std::size_t n ) + { + for( std::size_t i = 0; i < n; ++i ) { + if( !eq( s1[i], s2[i] ) ) + return lt( s1[i], s2[i] ) ? -1 : 1; + } + return 0; + } +}; + +} // namespace ut_detail + +// ************************************************************************** // +// ************** case_ins_eq ************** // +// ************************************************************************** // + +template +inline bool +case_ins_eq( basic_cstring x, basic_cstring y ) +{ + return x.size() == y.size() && ut_detail::case_ins::compare( x.begin(), y.begin(), x.size() ) == 0; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** case_ins_less ************** // +// ************************************************************************** // + +template +class case_ins_less +{ +public: + typedef bool result_type; + typedef basic_cstring first_argument_type; + typedef basic_cstring second_argument_type; + + bool operator()( basic_cstring x, basic_cstring y ) const + { + return x.size() != y.size() + ? x.size() < y.size() + : ut_detail::case_ins::compare( x.begin(), y.begin(), x.size() ) < 0; + } +}; + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** operators <,> ************** // +// ************************************************************************** // + +template +inline bool +operator <( boost::unit_test::basic_cstring const& x, + boost::unit_test::basic_cstring const& y ) +{ + typedef typename boost::unit_test::basic_cstring::traits_type traits_type; + return x.size() != y.size() + ? x.size() < y.size() + : traits_type::compare( x.begin(), y.begin(), x.size() ) < 0; +} + +//____________________________________________________________________________// + +template +inline bool +operator <=( boost::unit_test::basic_cstring const& x, + boost::unit_test::basic_cstring const& y ) +{ + return !(y < x); +} + +//____________________________________________________________________________// + +template +inline bool +operator >( boost::unit_test::basic_cstring const& x, + boost::unit_test::basic_cstring const& y ) +{ + return y < x; +} + +//____________________________________________________________________________// + +template +inline bool +operator >=( boost::unit_test::basic_cstring const& x, + boost::unit_test::basic_cstring const& y ) +{ + return !(x < y); +} + +//____________________________________________________________________________// + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_BASIC_CSTRING_COMPARE_HPP_071894GER diff --git a/libraries/boost/include/boost/test/utils/basic_cstring/io.hpp b/libraries/boost/include/boost/test/utils/basic_cstring/io.hpp new file mode 100644 index 0000000000..02ccb126f8 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/basic_cstring/io.hpp @@ -0,0 +1,73 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : basic_cstring i/o implementation +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_IO_HPP +#define BOOST_TEST_UTILS_BASIC_CSTRING_IO_HPP + +// Boost.Test +#include + +// STL +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +#ifdef BOOST_CLASSIC_IOSTREAMS + +template +inline std::ostream& +operator<<( std::ostream& os, basic_cstring const& str ) +{ + typedef typename ut_detail::bcs_base_char::type char_type; + char_type const* const beg = reinterpret_cast( str.begin() ); + char_type const* const end = reinterpret_cast( str.end() ); + os << std::basic_string( beg, end - beg ); + + return os; +} + +#else + +template +inline std::basic_ostream& +operator<<( std::basic_ostream& os, basic_cstring const& str ) +{ + CharT1 const* const beg = reinterpret_cast( str.begin() ); // !! + CharT1 const* const end = reinterpret_cast( str.end() ); + os << std::basic_string( beg, end - beg ); + + return os; +} + +#endif + +//____________________________________________________________________________// + + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER diff --git a/libraries/boost/include/boost/test/utils/class_properties.hpp b/libraries/boost/include/boost/test/utils/class_properties.hpp new file mode 100644 index 0000000000..d4f3db3f2d --- /dev/null +++ b/libraries/boost/include/boost/test/utils/class_properties.hpp @@ -0,0 +1,195 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : simple facility that mimmic notion of read-only read-write +// properties in C++ classes. Original idea by Henrik Ravn. +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP +#define BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP + +// Boost.Test +#include + +// Boost +#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) +#include +#endif +#include +#include +#include +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** class_property ************** // +// ************************************************************************** // + +template +class class_property { +protected: + typedef typename call_traits::const_reference read_access_t; + typedef typename call_traits::param_type write_param_t; + typedef typename add_pointer::type>::type address_res_t; +public: + // Constructor + class_property() : value( PropertyType() ) {} + explicit class_property( write_param_t init_value ) + : value( init_value ) {} + + // Access methods + operator read_access_t() const { return value; } + read_access_t get() const { return value; } + bool operator!() const { return !value; } + address_res_t operator&() const { return &value; } + + // Data members +#ifndef BOOST_TEST_NO_PROTECTED_USING +protected: +#endif + PropertyType value; +}; + +//____________________________________________________________________________// + +#ifdef BOOST_CLASSIC_IOSTREAMS + +template +inline std::ostream& +operator<<( std::ostream& os, class_property const& p ) + +#else + +template +inline std::basic_ostream& +operator<<( std::basic_ostream& os, class_property const& p ) + +#endif +{ + return os << p.get(); +} + +//____________________________________________________________________________// + +#define DEFINE_PROPERTY_FREE_BINARY_OPERATOR( op ) \ +template \ +inline bool \ +operator op( PropertyType const& lhs, class_property const& rhs ) \ +{ \ + return lhs op rhs.get(); \ +} \ +template \ +inline bool \ +operator op( class_property const& lhs, PropertyType const& rhs ) \ +{ \ + return lhs.get() op rhs; \ +} \ +template \ +inline bool \ +operator op( class_property const& lhs, \ + class_property const& rhs ) \ +{ \ + return lhs.get() op rhs.get(); \ +} \ +/**/ + +DEFINE_PROPERTY_FREE_BINARY_OPERATOR( == ) +DEFINE_PROPERTY_FREE_BINARY_OPERATOR( != ) + +#undef DEFINE_PROPERTY_FREE_BINARY_OPERATOR + +// ************************************************************************** // +// ************** readonly_property ************** // +// ************************************************************************** // + +template +class readonly_property : public class_property { + typedef class_property base_prop; + typedef typename base_prop::address_res_t arrow_res_t; +protected: + typedef typename base_prop::write_param_t write_param_t; +public: + // Constructor + readonly_property() {} + explicit readonly_property( write_param_t init_value ) : base_prop( init_value ) {} + + // access methods + arrow_res_t operator->() const { return boost::addressof( base_prop::value ); } +}; + +//____________________________________________________________________________// + +#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) + +#define BOOST_READONLY_PROPERTY( property_type, friends ) boost::unit_test::readwrite_property + +#else + +#define BOOST_READONLY_PROPERTY_DECLARE_FRIEND(r, data, elem) friend class elem; + +#define BOOST_READONLY_PROPERTY( property_type, friends ) \ +class BOOST_JOIN( readonly_property, __LINE__ ) \ +: public boost::unit_test::readonly_property { \ + typedef boost::unit_test::readonly_property base_prop; \ + BOOST_PP_SEQ_FOR_EACH( BOOST_READONLY_PROPERTY_DECLARE_FRIEND, ' ', friends ) \ + typedef base_prop::write_param_t write_param_t; \ +public: \ + BOOST_JOIN( readonly_property, __LINE__ )() {} \ + explicit BOOST_JOIN( readonly_property, __LINE__ )( write_param_t init_v ) \ + : base_prop( init_v ) {} \ +} \ +/**/ + +#endif + +// ************************************************************************** // +// ************** readwrite_property ************** // +// ************************************************************************** // + +template +class readwrite_property : public class_property { + typedef class_property base_prop; + typedef typename add_pointer::type arrow_res_t; + typedef typename base_prop::address_res_t const_arrow_res_t; + typedef typename base_prop::write_param_t write_param_t; +public: + readwrite_property() : base_prop() {} + explicit readwrite_property( write_param_t init_value ) : base_prop( init_value ) {} + + // access methods + void set( write_param_t v ) { base_prop::value = v; } + arrow_res_t operator->() { return boost::addressof( base_prop::value ); } + const_arrow_res_t operator->() const { return boost::addressof( base_prop::value ); } + +#ifndef BOOST_TEST_NO_PROTECTED_USING + using base_prop::value; +#endif +}; + +//____________________________________________________________________________// + +} // unit_test +} // namespace boost + +#include + +#undef BOOST_TEST_NO_PROTECTED_USING + +#endif // BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP diff --git a/libraries/boost/include/boost/test/utils/custom_manip.hpp b/libraries/boost/include/boost/test/utils/custom_manip.hpp new file mode 100644 index 0000000000..d5ddaf5c07 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/custom_manip.hpp @@ -0,0 +1,61 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : simple helpers for creating cusom output manipulators +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_CUSTOM_MANIP_HPP +#define BOOST_TEST_UTILS_CUSTOM_MANIP_HPP + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace utils { + +// ************************************************************************** // +// ************** custom manipulators helpers ************** // +// ************************************************************************** // + +template +struct custom_printer { + explicit custom_printer( std::ostream& ostr ) : m_ostr( &ostr ) {} + + std::ostream& operator*() const { return *m_ostr; } + +private: + std::ostream* const m_ostr; +}; + +//____________________________________________________________________________// + +template struct custom_manip {}; + +//____________________________________________________________________________// + +template +inline custom_printer > +operator<<( std::ostream& ostr, custom_manip const& ) { return custom_printer >( ostr ); } + +//____________________________________________________________________________// + +} // namespace utils +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_CUSTOM_MANIP_HPP diff --git a/libraries/boost/include/boost/test/utils/foreach.hpp b/libraries/boost/include/boost/test/utils/foreach.hpp new file mode 100644 index 0000000000..68462ae719 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/foreach.hpp @@ -0,0 +1,316 @@ +// (C) Copyright Eric Niebler 2004-2005 +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : this is an abridged version of an excelent BOOST_FOREACH facility +// presented by Eric Niebler. I am so fond of it so I can't wait till it +// going to be accepted into Boost. Also I need version with less number of dependencies +// and more portable. This version doesn't support rvalues and will reeveluate it's +// parameters, but should be good enough for my purposes. +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_FOREACH_HPP +#define BOOST_TEST_UTILS_FOREACH_HPP + +// Boost.Test +#include + +// Boost +#include +#include +#include + +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace for_each { + +// ************************************************************************** // +// ************** static_any ************** // +// ************************************************************************** // + +struct static_any_base +{ + operator bool() const { return false; } +}; + +//____________________________________________________________________________// + +template +struct static_any : static_any_base +{ + static_any( Iter const& t ) : m_it( t ) {} + + mutable Iter m_it; +}; + +//____________________________________________________________________________// + +typedef static_any_base const& static_any_t; + +//____________________________________________________________________________// + +template +inline Iter& +static_any_cast( static_any_t a, Iter* = 0 ) +{ + return static_cast( static_cast const&>( a ).m_it ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** is_const ************** // +// ************************************************************************** // + +template +inline is_const +is_const_coll( C& ) +{ + return is_const(); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** begin ************** // +// ************************************************************************** // + +template +inline static_any +begin( C& t, mpl::false_ ) +{ + return static_any( t.begin() ); +} + +//____________________________________________________________________________// + +template +inline static_any +begin( C const& t, mpl::true_ ) +{ + return static_any( t.begin() ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** end ************** // +// ************************************************************************** // + +template +inline static_any +end( C& t, mpl::false_ ) +{ + return static_any( t.end() ); +} + +//____________________________________________________________________________// + +template +inline static_any +end( C const& t, mpl::true_ ) +{ + return static_any( t.end() ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** done ************** // +// ************************************************************************** // + +template +inline bool +done( static_any_t cur, static_any_t end, C&, mpl::false_ ) +{ + return static_any_cast( cur ) == + static_any_cast( end ); +} + +//____________________________________________________________________________// + +template +inline bool +done( static_any_t cur, static_any_t end, C const&, mpl::true_ ) +{ + return static_any_cast( cur ) == + static_any_cast( end ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** next ************** // +// ************************************************************************** // + +template +inline void +next( static_any_t cur, C&, mpl::false_ ) +{ + ++static_any_cast( cur ); +} + +//____________________________________________________________________________// + +template +inline void +next( static_any_t cur, C const&, mpl::true_ ) +{ + ++static_any_cast( cur ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** prev ************** // +// ************************************************************************** // + +template +inline void +prev( static_any_t cur, C&, mpl::false_ ) +{ + --static_any_cast( cur ); +} + +//____________________________________________________________________________// + +template +inline void +prev( static_any_t cur, C const&, mpl::true_ ) +{ + --static_any_cast( cur ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** deref ************** // +// ************************************************************************** // + +template +inline RefType +deref( static_any_t cur, C&, ::boost::type, mpl::false_ ) +{ + return *static_any_cast( cur ); +} + +//____________________________________________________________________________// + +template +inline RefType +deref( static_any_t cur, C const&, ::boost::type, mpl::true_ ) +{ + return *static_any_cast( cur ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** BOOST_TEST_FOREACH ************** // +// ************************************************************************** // + +#define BOOST_TEST_FE_ANY ::boost::unit_test::for_each::static_any_t +#define BOOST_TEST_FE_IS_CONST( COL ) ::boost::unit_test::for_each::is_const_coll( COL ) + +#define BOOST_TEST_FE_BEG( COL ) \ + ::boost::unit_test::for_each::begin( \ + COL, \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + +#define BOOST_TEST_FE_END( COL ) \ + ::boost::unit_test::for_each::end( \ + COL, \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + +#define BOOST_TEST_FE_DONE( COL ) \ + ::boost::unit_test::for_each::done( \ + BOOST_TEST_FE_CUR_VAR, \ + BOOST_TEST_FE_END_VAR, \ + COL, \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + +#define BOOST_TEST_FE_NEXT( COL ) \ + ::boost::unit_test::for_each::next( \ + BOOST_TEST_FE_CUR_VAR, \ + COL, \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + +#define BOOST_TEST_FE_PREV( COL ) \ + ::boost::unit_test::for_each::prev( \ + BOOST_TEST_FE_CUR_VAR, \ + COL, \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + +#define BOOST_FOREACH_NOOP(COL) \ + ((void)&(COL)) + +#define BOOST_TEST_FE_DEREF( COL, RefType ) \ + ::boost::unit_test::for_each::deref( \ + BOOST_TEST_FE_CUR_VAR, \ + COL, \ + ::boost::type(), \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + +#if BOOST_WORKAROUND( BOOST_MSVC, == 1310 ) +#define BOOST_TEST_LINE_NUM +#else +#define BOOST_TEST_LINE_NUM __LINE__ +#endif + +#define BOOST_TEST_FE_CUR_VAR BOOST_JOIN( _fe_cur_, BOOST_TEST_LINE_NUM ) +#define BOOST_TEST_FE_END_VAR BOOST_JOIN( _fe_end_, BOOST_TEST_LINE_NUM ) +#define BOOST_TEST_FE_CON_VAR BOOST_JOIN( _fe_con_, BOOST_TEST_LINE_NUM ) + +#define BOOST_TEST_FOREACH( RefType, var, COL ) \ +if( BOOST_TEST_FE_ANY BOOST_TEST_FE_CUR_VAR = BOOST_TEST_FE_BEG( COL ) ) {} else \ +if( BOOST_TEST_FE_ANY BOOST_TEST_FE_END_VAR = BOOST_TEST_FE_END( COL ) ) {} else \ +for( bool BOOST_TEST_FE_CON_VAR = true; \ + BOOST_TEST_FE_CON_VAR && !BOOST_TEST_FE_DONE( COL ); \ + BOOST_TEST_FE_CON_VAR ? BOOST_TEST_FE_NEXT( COL ) : BOOST_FOREACH_NOOP( COL )) \ + \ + if( (BOOST_TEST_FE_CON_VAR = false, false) ) {} else \ + for( RefType var = BOOST_TEST_FE_DEREF( COL, RefType ); \ + !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \ +/**/ + +#define BOOST_TEST_REVERSE_FOREACH( RefType, var, COL ) \ +if( BOOST_TEST_FE_ANY BOOST_TEST_FE_CUR_VAR = BOOST_TEST_FE_END( COL ) ) {} else \ +if( BOOST_TEST_FE_ANY BOOST_TEST_FE_END_VAR = BOOST_TEST_FE_BEG( COL ) ) {} else \ +for( bool BOOST_TEST_FE_CON_VAR = true; \ + BOOST_TEST_FE_CON_VAR && !BOOST_TEST_FE_DONE( COL ); ) \ + \ + if( (BOOST_TEST_FE_CON_VAR = false, false) ) {} else \ + if( (BOOST_TEST_FE_PREV( COL ), false) ) {} else \ + for( RefType var = BOOST_TEST_FE_DEREF( COL, RefType ); \ + !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \ +/**/ + +//____________________________________________________________________________// + +} // namespace for_each +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_FOREACH_HPP diff --git a/libraries/boost/include/boost/test/utils/is_cstring.hpp b/libraries/boost/include/boost/test/utils/is_cstring.hpp new file mode 100644 index 0000000000..12326b0418 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/is_cstring.hpp @@ -0,0 +1,116 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : defines the is_cstring type trait +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_IS_CSTRING_HPP +#define BOOST_TEST_UTILS_IS_CSTRING_HPP + +// Boost +#include +#include +#include +#include +#include +#include + +#include +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** is_cstring ************** // +// ************************************************************************** // + +namespace ut_detail { + +template +struct is_cstring_impl : public mpl::false_ {}; + +template +struct is_cstring_impl : public is_cstring_impl {}; + +template +struct is_cstring_impl : public is_cstring_impl {}; + +template<> +struct is_cstring_impl : public mpl::true_ {}; + +template<> +struct is_cstring_impl : public mpl::true_ {}; + +template ::type>::value > +struct deduce_cstring_impl; + +template +struct deduce_cstring_impl : public deduce_cstring_impl{}; + +template +struct deduce_cstring_impl : public deduce_cstring_impl{}; + +template +struct deduce_cstring_impl { + typedef typename boost::add_const< + typename boost::remove_pointer< + typename boost::decay::type + >::type + >::type U; + typedef boost::unit_test::basic_cstring type; +}; + +template +struct deduce_cstring_impl< T, false > { + typedef typename + boost::remove_const< + typename boost::remove_reference::type + >::type type; +}; + +template +struct deduce_cstring_impl< std::basic_string >, false > { + typedef boost::unit_test::basic_cstring::type> type; +}; + +} // namespace ut_detail + +template +struct is_cstring : public ut_detail::is_cstring_impl::type> {}; + +template::type>::value > +struct is_cstring_comparable: public mpl::false_ {}; + +template +struct is_cstring_comparable< T, true > : public mpl::true_ {}; + +template +struct is_cstring_comparable< std::basic_string >, false > : public mpl::true_ {}; + +template +struct is_cstring_comparable< boost::unit_test::basic_cstring, false > : public mpl::true_ {}; + +template +struct deduce_cstring { + typedef typename + boost::remove_const< + typename boost::remove_reference::type + >::type U; + typedef typename ut_detail::deduce_cstring_impl::type>::type type; +}; + +} // namespace unit_test +} // namespace boost + +#endif // BOOST_TEST_UTILS_IS_CSTRING_HPP diff --git a/libraries/boost/include/boost/test/utils/is_forward_iterable.hpp b/libraries/boost/include/boost/test/utils/is_forward_iterable.hpp new file mode 100644 index 0000000000..1c9108054b --- /dev/null +++ b/libraries/boost/include/boost/test/utils/is_forward_iterable.hpp @@ -0,0 +1,267 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! Defines the is_forward_iterable collection type trait +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP +#define BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP + +#if defined(BOOST_NO_CXX11_DECLTYPE) || \ + defined(BOOST_NO_CXX11_NULLPTR) || \ + defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) + + // this feature works with VC2012 upd 5 while BOOST_NO_CXX11_TRAILING_RESULT_TYPES is defined + #if !defined(BOOST_MSVC) || BOOST_MSVC_FULL_VER < 170061030 /* VC2012 upd 5 */ + #define BOOST_TEST_FWD_ITERABLE_CXX03 + #endif +#endif + +#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) +// Boost +#include + +// STL +#include +#include +#include +#include + +#else + +// Boost +#include +#include +#include +#include +#include +#include + +// STL +#include +#include + +#endif +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +template +struct is_forward_iterable; + +// ************************************************************************** // +// ************** is_forward_iterable ************** // +// ************************************************************************** // + +#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) && !defined(BOOST_TEST_DOXYGEN_DOC__) +template +struct is_forward_iterable : public mpl::false_ {}; + +template +struct is_forward_iterable : public is_forward_iterable {}; + +template +struct is_forward_iterable : public is_forward_iterable {}; + +template +struct is_forward_iterable< T [N] > : public mpl::true_ {}; + +template +struct is_forward_iterable< std::vector > : public mpl::true_ {}; + +template +struct is_forward_iterable< std::list > : public mpl::true_ {}; + +template +struct is_forward_iterable< std::map > : public mpl::true_ {}; + +template +struct is_forward_iterable< std::set > : public mpl::true_ {}; + +// string is also forward iterable, even if sometimes we want to treat the +// assertions differently. +template<> +struct is_forward_iterable< std::string > : public mpl::true_ {}; + +#else + +namespace ut_detail { + +// SFINAE helper +template +struct is_present : public mpl::true_ {}; + +//____________________________________________________________________________// + +// some compiler do not implement properly decltype non expression involving members (eg. VS2013) +// a workaround is to use -> decltype syntax. +template +struct has_member_size { +private: + struct nil_t {}; + template static auto test( U* ) -> decltype(boost::declval().size()); + template static nil_t test( ... ); + +public: + static bool const value = !std::is_same< decltype(test( nullptr )), nil_t>::value; +}; + +//____________________________________________________________________________// + +template +struct has_member_begin { +private: + struct nil_t {}; + template static auto test( U* ) -> decltype(std::begin(boost::declval())); // does not work with boost::begin + template static nil_t test( ... ); +public: + static bool const value = !std::is_same< decltype(test( nullptr )), nil_t>::value; +}; + +//____________________________________________________________________________// + +template +struct has_member_end { +private: + struct nil_t {}; + template static auto test( U* ) -> decltype(std::end(boost::declval())); // does not work with boost::end + template static nil_t test( ... ); +public: + static bool const value = !std::is_same< decltype(test( nullptr )), nil_t>::value; +}; + +//____________________________________________________________________________// + +template +struct is_forward_iterable_impl : std::false_type { +}; + +template +struct is_forward_iterable_impl< + T, + typename std::enable_if< + has_member_begin::value && + has_member_end::value + >::type +> : std::true_type +{}; + +//____________________________________________________________________________// + +template +struct is_container_forward_iterable_impl : std::false_type { +}; + +template +struct is_container_forward_iterable_impl< + T, + typename std::enable_if< + is_present::value && + is_present::value && + has_member_size::value && + is_forward_iterable_impl::value + >::type +> : is_forward_iterable_impl +{}; + +//____________________________________________________________________________// + +} // namespace ut_detail + +/*! Indicates that a specific type implements the forward iterable concept. */ +template +struct is_forward_iterable { + typedef typename std::remove_reference::type T_ref; + typedef ut_detail::is_forward_iterable_impl is_fwd_it_t; + typedef mpl::bool_ type; + enum { value = is_fwd_it_t::value }; +}; + +/*! Indicates that a specific type implements the forward iterable concept. */ +template +struct is_container_forward_iterable { + typedef typename std::remove_reference::type T_ref; + typedef ut_detail::is_container_forward_iterable_impl is_fwd_it_t; + typedef mpl::bool_ type; + enum { value = is_fwd_it_t::value }; +}; + +#endif /* defined(BOOST_TEST_FWD_ITERABLE_CXX03) */ + + +//! Helper structure for accessing the content of a container or an array +template ::value > +struct bt_iterator_traits; + +template +struct bt_iterator_traits< T, true >{ + BOOST_STATIC_ASSERT((is_forward_iterable::value)); + +#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) || \ + (defined(BOOST_MSVC) && (BOOST_MSVC_FULL_VER <= 170061030)) + typedef typename T::const_iterator const_iterator; + typedef typename std::iterator_traits::value_type value_type; +#else + typedef decltype(boost::declval< + typename boost::add_const< + typename boost::remove_reference::type + >::type>().begin()) const_iterator; + + typedef typename std::iterator_traits::value_type value_type; +#endif /* BOOST_TEST_FWD_ITERABLE_CXX03 */ + + static const_iterator begin(T const& container) { + return container.begin(); + } + static const_iterator end(T const& container) { + return container.end(); + } + +#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) || \ + (defined(BOOST_MSVC) && (BOOST_MSVC_FULL_VER <= 170061030)) + static std::size_t + size(T const& container) { + return container.size(); + } +#else + static std::size_t + size(T const& container) { + return size(container, + std::integral_constant::value>()); + } +private: + static std::size_t + size(T const& container, std::true_type) { return container.size(); } + + static std::size_t + size(T const& container, std::false_type) { return std::distance(begin(container), end(container)); } +#endif /* BOOST_TEST_FWD_ITERABLE_CXX03 */ +}; + +template +struct bt_iterator_traits< T [N], true > { + typedef typename boost::add_const::type T_const; + typedef typename boost::add_pointer::type const_iterator; + typedef T value_type; + + static const_iterator begin(T_const (&array)[N]) { + return &array[0]; + } + static const_iterator end(T_const (&array)[N]) { + return &array[N]; + } + static std::size_t size(T_const (&)[N]) { + return N; + } +}; + +} // namespace unit_test +} // namespace boost + +#endif // BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP diff --git a/libraries/boost/include/boost/test/utils/iterator/input_iterator_facade.hpp b/libraries/boost/include/boost/test/utils/iterator/input_iterator_facade.hpp new file mode 100644 index 0000000000..d695ee3a87 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/iterator/input_iterator_facade.hpp @@ -0,0 +1,105 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//! Input iterator facade +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP +#define BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP + +// Boost +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace utils { + +// ************************************************************************** // +// ************** input_iterator_core_access ************** // +// ************************************************************************** // + +class input_iterator_core_access +{ +#if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +public: +#else + template friend class input_iterator_facade; +#endif + + template + static bool get( Facade& f ) + { + return f.get(); + } + +private: + // objects of this class are useless + input_iterator_core_access(); //undefined +}; + +// ************************************************************************** // +// ************** input_iterator_facade ************** // +// ************************************************************************** // + +template +class input_iterator_facade : public iterator_facade +{ +public: + // Constructor + input_iterator_facade() : m_valid( false ), m_value() {} + +protected: // provide access to the Derived + void init() + { + m_valid = true; + increment(); + } + + // Data members + mutable bool m_valid; + ValueType m_value; + +private: + friend class boost::iterator_core_access; + + // iterator facade interface implementation + void increment() + { + // we make post-end incrementation indefinetly safe + if( m_valid ) + m_valid = input_iterator_core_access::get( *static_cast(this) ); + } + Reference dereference() const + { + return m_value; + } + + // iterator facade interface implementation + bool equal( input_iterator_facade const& rhs ) const + { + // two invalid iterator equals, inequal otherwise + return !m_valid && !rhs.m_valid; + } +}; + +} // namespace utils +} // namespace unit_test +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP diff --git a/libraries/boost/include/boost/test/utils/iterator/token_iterator.hpp b/libraries/boost/include/boost/test/utils/iterator/token_iterator.hpp new file mode 100644 index 0000000000..e3a923a2ee --- /dev/null +++ b/libraries/boost/include/boost/test/utils/iterator/token_iterator.hpp @@ -0,0 +1,421 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : token iterator for string and range tokenization +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP +#define BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP + +// Boost +#include +#include + +#include +#include + +#include +#include +#include +#include + +// STL +#include +#include + +#include + +//____________________________________________________________________________// + +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::ispunct; using ::isspace; } +#endif + +namespace boost { +namespace unit_test { +namespace utils { + +// ************************************************************************** // +// ************** ti_delimeter_type ************** // +// ************************************************************************** // + +enum ti_delimeter_type { + dt_char, // character is delimeter if it among explicit list of some characters + dt_ispunct, // character is delimeter if it satisfies ispunct functor + dt_isspace, // character is delimeter if it satisfies isspace functor + dt_none // no character is delimeter +}; + +namespace ut_detail { + +// ************************************************************************** // +// ************** default_char_compare ************** // +// ************************************************************************** // + +template +class default_char_compare { +public: + bool operator()( CharT c1, CharT c2 ) + { +#ifdef BOOST_CLASSIC_IOSTREAMS + return std::string_char_traits::eq( c1, c2 ); +#else + return std::char_traits::eq( c1, c2 ); +#endif + } +}; + +// ************************************************************************** // +// ************** delim_policy ************** // +// ************************************************************************** // + +template +class delim_policy { + typedef basic_cstring cstring; +public: + // Constructor + explicit delim_policy( ti_delimeter_type type_ = dt_char, cstring delimeters_ = cstring() ) + : m_type( type_ ) + { + set_delimeters( delimeters_ ); + } + + void set_delimeters( ti_delimeter_type type_ ) { m_type = type_; } + void set_delimeters( cstring delimeters_ ) + { + m_delimeters = delimeters_; + + if( !m_delimeters.is_empty() ) + m_type = dt_char; + } + void set_delimeters( nfp::nil ) {} + bool operator()( CharT c ) + { + switch( m_type ) { + case dt_char: { + BOOST_TEST_FOREACH( CharT, delim, m_delimeters ) + if( CharCompare()( delim, c ) ) + return true; + + return false; + } + case dt_ispunct: + return (std::ispunct)( c ) != 0; + case dt_isspace: + return (std::isspace)( c ) != 0; + case dt_none: + return false; + } + + return false; + } + +private: + // Data members + cstring m_delimeters; + ti_delimeter_type m_type; +}; + +// ************************************************************************** // +// ************** token_assigner ************** // +// ************************************************************************** // + +template +struct token_assigner { +#if BOOST_WORKAROUND( BOOST_DINKUMWARE_STDLIB, < 306 ) + template + static void assign( Iterator b, Iterator e, std::basic_string& t ) + { for( ; b != e; ++b ) t += *b; } + + template + static void assign( Iterator b, Iterator e, basic_cstring& t ) { t.assign( b, e ); } +#else + template + static void assign( Iterator b, Iterator e, Token& t ) { t.assign( b, e ); } +#endif + template + static void append_move( Iterator& b, Token& ) { ++b; } +}; + +//____________________________________________________________________________// + +template<> +struct token_assigner { + template + static void assign( Iterator /*b*/, Iterator /*e*/, Token& /*t*/ ) {} + + template + static void append_move( Iterator& b, Token& t ) { t += *b; ++b; } +}; + +} // namespace ut_detail + +// ************************************************************************** // +// ************** modifiers ************** // +// ************************************************************************** // + +namespace { +nfp::keyword dropped_delimeters; +nfp::keyword kept_delimeters; +nfp::typed_keyword keep_empty_tokens; +nfp::typed_keyword max_tokens; +} + +// ************************************************************************** // +// ************** token_iterator_base ************** // +// ************************************************************************** // + +template, + typename ValueType = basic_cstring, + typename Reference = basic_cstring, + typename Traversal = forward_traversal_tag> +class token_iterator_base +: public input_iterator_facade { + typedef basic_cstring cstring; + typedef ut_detail::delim_policy delim_policy; + typedef input_iterator_facade base; + +protected: + // Constructor + explicit token_iterator_base() + : m_is_dropped( dt_isspace ) + , m_is_kept( dt_ispunct ) + , m_keep_empty_tokens( false ) + , m_tokens_left( static_cast(-1) ) + , m_token_produced( false ) + { + } + + template + void + apply_modifier( Modifier const& m ) + { + if( m.has( dropped_delimeters ) ) + m_is_dropped.set_delimeters( m[dropped_delimeters] ); + + if( m.has( kept_delimeters ) ) + m_is_kept.set_delimeters( m[kept_delimeters] ); + + if( m.has( keep_empty_tokens ) ) + m_keep_empty_tokens = true; + + nfp::opt_assign( m_tokens_left, m, max_tokens ); + } + + template + bool get( Iter& begin, Iter end ) + { + typedef ut_detail::token_assigner::type> Assigner; + Iter check_point; + + this->m_value.clear(); + + if( !m_keep_empty_tokens ) { + while( begin != end && m_is_dropped( *begin ) ) + ++begin; + + if( begin == end ) + return false; + + check_point = begin; + + if( m_tokens_left == 1 ) + while( begin != end ) + Assigner::append_move( begin, this->m_value ); + else if( m_is_kept( *begin ) ) + Assigner::append_move( begin, this->m_value ); + else + while( begin != end && !m_is_dropped( *begin ) && !m_is_kept( *begin ) ) + Assigner::append_move( begin, this->m_value ); + + --m_tokens_left; + } + else { // m_keep_empty_tokens is true + check_point = begin; + + if( begin == end ) { + if( m_token_produced ) + return false; + + m_token_produced = true; + } + if( m_is_kept( *begin ) ) { + if( m_token_produced ) + Assigner::append_move( begin, this->m_value ); + + m_token_produced = !m_token_produced; + } + else if( !m_token_produced && m_is_dropped( *begin ) ) + m_token_produced = true; + else { + if( m_is_dropped( *begin ) ) + check_point = ++begin; + + while( begin != end && !m_is_dropped( *begin ) && !m_is_kept( *begin ) ) + Assigner::append_move( begin, this->m_value ); + + m_token_produced = true; + } + } + + Assigner::assign( check_point, begin, this->m_value ); + + return true; + } + +private: + // Data members + delim_policy m_is_dropped; + delim_policy m_is_kept; + bool m_keep_empty_tokens; + std::size_t m_tokens_left; + bool m_token_produced; +}; + +// ************************************************************************** // +// ************** basic_string_token_iterator ************** // +// ************************************************************************** // + +template > +class basic_string_token_iterator +: public token_iterator_base,CharT,CharCompare> { + typedef basic_cstring cstring; + typedef token_iterator_base,CharT,CharCompare> base; +public: + explicit basic_string_token_iterator() {} + explicit basic_string_token_iterator( cstring src ) + : m_src( src ) + { + this->init(); + } + + // warning: making the constructor accept anything else than a cstring should + // ensure that no temporary object is created during string creation (previous + // definition was "template basic_string_token_iterator( Src src ..." + // which may create a temporary string copy when called with an std::string. + template + basic_string_token_iterator( cstring src, Modifier const& m ) + : m_src( src ) + { + this->apply_modifier( m ); + + this->init(); + } + +private: + friend class input_iterator_core_access; + + // input iterator implementation + bool get() + { + typename cstring::iterator begin = m_src.begin(); + bool res = base::get( begin, m_src.end() ); + + m_src.assign( begin, m_src.end() ); + + return res; + } + + // Data members + cstring m_src; +}; + +typedef basic_string_token_iterator string_token_iterator; +typedef basic_string_token_iterator wstring_token_iterator; + +// ************************************************************************** // +// ************** range_token_iterator ************** // +// ************************************************************************** // + +template::type>, + typename ValueType = std::basic_string::type>, + typename Reference = ValueType const&> +class range_token_iterator +: public token_iterator_base, + typename iterator_value::type,CharCompare,ValueType,Reference> { + typedef basic_cstring cstring; + typedef token_iterator_base, + typename iterator_value::type,CharCompare,ValueType,Reference> base; +public: + explicit range_token_iterator() {} + explicit range_token_iterator( Iter begin, Iter end = Iter() ) + : m_begin( begin ), m_end( end ) + { + this->init(); + } + range_token_iterator( range_token_iterator const& rhs ) + : base( rhs ) + { + if( this->m_valid ) { + m_begin = rhs.m_begin; + m_end = rhs.m_end; + } + } + + template + range_token_iterator( Iter begin, Iter end, Modifier const& m ) + : m_begin( begin ), m_end( end ) + { + this->apply_modifier( m ); + + this->init(); + } + +private: + friend class input_iterator_core_access; + + // input iterator implementation + bool get() + { + return base::get( m_begin, m_end ); + } + + // Data members + Iter m_begin; + Iter m_end; +}; + +// ************************************************************************** // +// ************** make_range_token_iterator ************** // +// ************************************************************************** // + +template +inline range_token_iterator +make_range_token_iterator( Iter begin, Iter end = Iter() ) +{ + return range_token_iterator( begin, end ); +} + +//____________________________________________________________________________// + +template +inline range_token_iterator +make_range_token_iterator( Iter begin, Iter end, Modifier const& m ) +{ + return range_token_iterator( begin, end, m ); +} + +//____________________________________________________________________________// + +} // namespace utils +} // namespace unit_test +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP + diff --git a/libraries/boost/include/boost/test/utils/lazy_ostream.hpp b/libraries/boost/include/boost/test/utils/lazy_ostream.hpp new file mode 100644 index 0000000000..26bd8ed385 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/lazy_ostream.hpp @@ -0,0 +1,128 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// Description : contains definition for all test tools in test toolbox +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_LAZY_OSTREAM_HPP +#define BOOST_TEST_UTILS_LAZY_OSTREAM_HPP + +// Boost.Test +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** lazy_ostream ************** // +// ************************************************************************** // + +namespace boost { +namespace unit_test { + +class lazy_ostream { +public: + virtual ~lazy_ostream() {} + + static lazy_ostream& instance() { static lazy_ostream inst; return inst; } + + friend std::ostream& operator<<( std::ostream& ostr, lazy_ostream const& o ) { return o( ostr ); } + + // access method + bool empty() const { return m_empty; } + + // actual printing interface; to be accessed only by this class and children + virtual std::ostream& operator()( std::ostream& ostr ) const { return ostr; } +protected: + explicit lazy_ostream( bool p_empty = true ) : m_empty( p_empty ) {} + +private: + // Data members + bool m_empty; +}; + +//____________________________________________________________________________// + +template +class lazy_ostream_impl : public lazy_ostream { +public: + lazy_ostream_impl( PrevType const& prev, T const& value ) + : lazy_ostream( false ) + , m_prev( prev ) + , m_value( value ) + { + } + + virtual std::ostream& operator()( std::ostream& ostr ) const + { + return m_prev(ostr) << m_value; + } +private: + // Data members + PrevType const& m_prev; + StorageT m_value; +}; + +//____________________________________________________________________________// + +template +inline lazy_ostream_impl +operator<<( lazy_ostream const& prev, T const& v ) +{ + return lazy_ostream_impl( prev, v ); +} + +//____________________________________________________________________________// + +template +inline lazy_ostream_impl,T> +operator<<( lazy_ostream_impl const& prev, T const& v ) +{ + typedef lazy_ostream_impl PrevType; + return lazy_ostream_impl( prev, v ); +} + +//____________________________________________________________________________// + +#if BOOST_TEST_USE_STD_LOCALE + +template +inline lazy_ostream_impl +operator<<( lazy_ostream const& prev, R& (BOOST_TEST_CALL_DECL *man)(S&) ) +{ + typedef R& (BOOST_TEST_CALL_DECL * ManipType)(S&); + + return lazy_ostream_impl( prev, man ); +} + +//____________________________________________________________________________// + +template +inline lazy_ostream_impl,R& (BOOST_TEST_CALL_DECL *)(S&),R& (BOOST_TEST_CALL_DECL *)(S&)> +operator<<( lazy_ostream_impl const& prev, R& (BOOST_TEST_CALL_DECL *man)(S&) ) +{ + typedef R& (BOOST_TEST_CALL_DECL * ManipType)(S&); + + return lazy_ostream_impl,ManipType,ManipType>( prev, man ); +} + +//____________________________________________________________________________// + +#endif + +#define BOOST_TEST_LAZY_MSG( M ) (::boost::unit_test::lazy_ostream::instance() << M) + +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_LAZY_OSTREAM_HPP diff --git a/libraries/boost/include/boost/test/utils/named_params.hpp b/libraries/boost/include/boost/test/utils/named_params.hpp new file mode 100644 index 0000000000..50de5bfba0 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/named_params.hpp @@ -0,0 +1,388 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : named function parameters library +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_NAMED_PARAM +#define BOOST_TEST_UTILS_NAMED_PARAM + +// Boost +#include +#include + +// Boost.Test +#include +#include + +#include +#include + +#include + +// Boost +#include +#include +#include +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace nfp { // named function parameters + +// ************************************************************************** // +// ************** forward declarations ************** // +// ************************************************************************** // + +template struct keyword; +template struct typed_keyword; + +template struct named_parameter; +template struct named_parameter_combine; + +// ************************************************************************** // +// ************** is_named_param_pack ************** // +// ************************************************************************** // + +/// is_named_param_pack::value is true if T is parameters pack + +template +struct is_named_param_pack : public mpl::false_ {}; + +template +struct is_named_param_pack > : public mpl::true_ {}; + +template +struct is_named_param_pack > : public mpl::true_ {}; + +// ************************************************************************** // +// ************** param_type ************** // +// ************************************************************************** // + +/// param_type::type is the type of the parameter +/// corresponding to the Keyword (if parameter is present) or Default + +template +struct param_type +: mpl::if_::type, + typename remove_cv::type, + DefaultType> {}; + +template +struct param_type,Keyword,DefaultType> +: mpl::if_::type, + typename remove_cv::type, + typename param_type::type> {}; + +// ************************************************************************** // +// ************** has_param ************** // +// ************************************************************************** // + +/// has_param::value is true if Params has parameter corresponding +/// to the Keyword + +template +struct has_param : is_same {}; + +template +struct has_param,Keyword> +: mpl::or_::type, + typename has_param::type> {}; + +// ************************************************************************** // +// ************** access_to_invalid_parameter ************** // +// ************************************************************************** // + +namespace nfp_detail { + +struct access_to_invalid_parameter {}; + +//____________________________________________________________________________// + +inline void +report_access_to_invalid_parameter( bool v ) +{ + BOOST_TEST_I_ASSRT( !v, access_to_invalid_parameter() ); +} + +} // namespace nfp_detail + +// ************************************************************************** // +// ************** nil ************** // +// ************************************************************************** // + +struct nil { + template +#if defined(__GNUC__) || defined(__HP_aCC) || defined(__EDG__) || defined(__SUNPRO_CC) + operator T() const +#else + operator T const&() const +#endif + { nfp_detail::report_access_to_invalid_parameter(true); static T* v = 0; return *v; } + + template + T any_cast() const + { nfp_detail::report_access_to_invalid_parameter(true); static typename remove_reference::type* v = 0; return *v; } + + template + nil operator()( Arg1 const& ) + { nfp_detail::report_access_to_invalid_parameter(true); return nil(); } + + template + nil operator()( Arg1 const&, Arg2 const& ) + { nfp_detail::report_access_to_invalid_parameter(true); return nil(); } + + template + nil operator()( Arg1 const&, Arg2 const&, Arg3 const& ) + { nfp_detail::report_access_to_invalid_parameter(true); return nil(); } + + // Visitation support + template + void apply_to( Visitor& /*v*/ ) const {} + + static nil& inst() { static nil s_inst; return s_inst; } +private: + nil() {} +}; + +// ************************************************************************** // +// ************** named_parameter_base ************** // +// ************************************************************************** // + +namespace nfp_detail { + +template +struct named_parameter_base { + template + named_parameter_combine + operator,( NP const& np ) const { return named_parameter_combine( np, *static_cast(this) ); } +}; + +} // namespace nfp_detail + +// ************************************************************************** // +// ************** named_parameter_combine ************** // +// ************************************************************************** // + +template +struct named_parameter_combine +: Rest +, nfp_detail::named_parameter_base > { + typedef typename NP::ref_type res_type; + typedef named_parameter_combine self_type; + + // Constructor + named_parameter_combine( NP const& np, Rest const& r ) + : Rest( r ) + , m_param( np ) + { + } + + // Access methods + res_type operator[]( keyword kw ) const { return m_param[kw]; } + res_type operator[]( keyword kw ) const { return m_param[kw]; } + using Rest::operator[]; + + bool has( keyword kw ) const { return m_param.has( kw ); } + using Rest::has; + + void erase( keyword kw ) const { m_param.erase( kw ); } + using Rest::erase; + + using nfp_detail::named_parameter_base >::operator,; + + // Visitation support + template + void apply_to( Visitor& V ) const + { + m_param.apply_to( V ); + + Rest::apply_to( V ); + } +private: + // Data members + NP m_param; +}; + +// ************************************************************************** // +// ************** named_parameter ************** // +// ************************************************************************** // + +template +struct named_parameter +: nfp_detail::named_parameter_base > +{ + typedef T data_type; + typedef RefType ref_type; + typedef unique_id id; + + // Constructor + explicit named_parameter( ref_type v ) + : m_value( v ) + , m_erased( false ) + {} + named_parameter( named_parameter const& np ) + : m_value( np.m_value ) + , m_erased( np.m_erased ) + {} + + // Access methods + ref_type operator[]( keyword ) const { return m_erased ? nil::inst().template any_cast() : m_value; } + ref_type operator[]( keyword ) const { return m_erased ? nil::inst().template any_cast() : m_value; } + template + nil operator[]( keyword ) const { return nil::inst(); } + + bool has( keyword ) const { return !m_erased; } + template + bool has( keyword ) const { return false; } + + void erase( keyword ) const { m_erased = true; } + template + void erase( keyword ) const {} + + // Visitation support + template + void apply_to( Visitor& V ) const + { + V.set_parameter( rtti::type_id(), m_value ); + } + +private: + // Data members + ref_type m_value; + mutable bool m_erased; +}; + +// ************************************************************************** // +// ************** no_params ************** // +// ************************************************************************** // + +typedef named_parameter no_params_type; + +namespace { +no_params_type no_params( '\0' ); +} // local namespace + +// ************************************************************************** // +// ************** keyword ************** // +// ************************************************************************** // + +template +struct keyword { + typedef unique_id id; + + template + named_parameter + operator=( T const& t ) const { return named_parameter( t ); } + + template + named_parameter + operator=( T& t ) const { return named_parameter( t ); } + + named_parameter + operator=( char const* t ) const { return named_parameter( t ); } +}; + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** typed_keyword ************** // +// ************************************************************************** // + +template +struct typed_keyword : keyword { + named_parameter + operator=( T const& t ) const { return named_parameter( t ); } + + named_parameter + operator=( T& t ) const { return named_parameter( t ); } +}; + +//____________________________________________________________________________// + +template +struct typed_keyword +: keyword +, named_parameter { + typedef unique_id id; + + typed_keyword() : named_parameter( true ) {} + + named_parameter + operator!() const { return named_parameter( false ); } +}; + +// ************************************************************************** // +// ************** opt_assign ************** // +// ************************************************************************** // + +template +inline typename enable_if_c::value,void>::type +opt_assign( T& /*target*/, Params const& /*p*/, Keyword /*k*/ ) +{ +} + +//____________________________________________________________________________// + +template +inline typename enable_if_c::value,void>::type +opt_assign( T& target, Params const& p, Keyword k ) +{ + using namespace unit_test; + + assign_op( target, p[k], static_cast(0) ); +} + +// ************************************************************************** // +// ************** opt_get ************** // +// ************************************************************************** // + +template +inline T +opt_get( Params const& p, Keyword k, T default_val ) +{ + opt_assign( default_val, p, k ); + + return default_val; +} + +// ************************************************************************** // +// ************** opt_get ************** // +// ************************************************************************** // + +template +inline typename enable_if_c >::value, +named_parameter_combine >::type +opt_append( Params const& params, NP const& np ) +{ + return (params,np); +} + +//____________________________________________________________________________// + +template +inline typename enable_if_c >::value,Params>::type +opt_append( Params const& params, NP const& ) +{ + return params; +} + +} // namespace nfp +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_NAMED_PARAM diff --git a/libraries/boost/include/boost/test/utils/nullstream.hpp b/libraries/boost/include/boost/test/utils/nullstream.hpp new file mode 100644 index 0000000000..27b17fae14 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/nullstream.hpp @@ -0,0 +1,103 @@ +// (C) Copyright Gennadiy Rozental 2001. +// (C) Copyright Daryle Walker 2000-2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : simulate /dev/null stream +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_NULLSTREAM_HPP +#define BOOST_TEST_UTILS_NULLSTREAM_HPP + +// STL +#include // for std::basic_ostream +#include // for std::basic_streambuf +#include // for std::char_traits + +// Boost +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +// ************************************************************************** // +// ************** basic_nullbuf ************** // +// ************************************************************************** // +// Class for a buffer that reads nothing and writes to nothing. +// Idea from an Usenet post by Tom at +// 27 Oct 2000 14:06:21 GMT on comp.lang.c++. + +template > +class basic_nullbuf : public ::std::basic_streambuf { + typedef ::std::basic_streambuf base_type; +public: + // Types + typedef typename base_type::char_type char_type; + typedef typename base_type::traits_type traits_type; + typedef typename base_type::int_type int_type; + typedef typename base_type::pos_type pos_type; + typedef typename base_type::off_type off_type; + + // Use automatic default constructor and destructor + +protected: + // The default implementations of the miscellaneous virtual + // member functions are sufficient. + + // The default implementations of the input & putback virtual + // member functions, being nowhere but EOF, are sufficient. + + // The output virtual member functions need to be changed to + // accept anything without any problems, instead of being at EOF. + virtual ::std::streamsize xsputn( char_type const* /*s*/, ::std::streamsize n ) { return n; } // "s" is unused + virtual int_type overflow( int_type c = traits_type::eof() ) { return traits_type::not_eof( c ); } +}; + +typedef basic_nullbuf nullbuf; +typedef basic_nullbuf wnullbuf; + +// ************************************************************************** // +// ************** basic_onullstream ************** // +// ************************************************************************** // +// Output streams based on basic_nullbuf. + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4355) // 'this' : used in base member initializer list +#endif + +template< typename CharType, class CharTraits = ::std::char_traits > +class basic_onullstream : private boost::base_from_member > + , public ::std::basic_ostream { + typedef boost::base_from_member > pbase_type; + typedef ::std::basic_ostream base_type; +public: + // Constructor + basic_onullstream() : pbase_type(), base_type( &this->pbase_type::member ) {} +}; + +#ifdef BOOST_MSVC +# pragma warning(default: 4355) +# pragma warning(pop) +#endif + +typedef basic_onullstream onullstream; +typedef basic_onullstream wonullstream; + +} // namespace boost + +//____________________________________________________________________________// + +#include + +#endif // BOOST_TEST_UTILS_NULLSTREAM_HPP diff --git a/libraries/boost/include/boost/test/utils/rtti.hpp b/libraries/boost/include/boost/test/utils/rtti.hpp new file mode 100644 index 0000000000..b230692d80 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/rtti.hpp @@ -0,0 +1,63 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : simple facilities for accessing type information at runtime +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_RTTI_HPP +#define BOOST_TEST_UTILS_RTTI_HPP + +// C Runtime +#include + +namespace boost { +namespace rtti { + +// ************************************************************************** // +// ************** rtti::type_id ************** // +// ************************************************************************** // + +typedef std::ptrdiff_t id_t; + +namespace rtti_detail { + +template +struct rttid_holder { + static id_t id() { return reinterpret_cast( &inst() ); } + +private: + struct rttid {}; + + static rttid const& inst() { static rttid s_inst; return s_inst; } +}; + +} // namespace rtti_detail + +//____________________________________________________________________________// + +template +inline id_t +type_id() +{ + return rtti_detail::rttid_holder::id(); +} + +//____________________________________________________________________________// + +#define BOOST_RTTI_SWITCH( type_id_ ) if( ::boost::rtti::id_t switch_by_id = type_id_ ) +#define BOOST_RTTI_CASE( type ) if( switch_by_id == ::boost::rtti::type_id() ) + +//____________________________________________________________________________// + +} // namespace rtti +} // namespace boost + +#endif // BOOST_TEST_UTILS_RTTI_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/argument.hpp b/libraries/boost/include/boost/test/utils/runtime/argument.hpp new file mode 100644 index 0000000000..879ee96f9f --- /dev/null +++ b/libraries/boost/include/boost/test/utils/runtime/argument.hpp @@ -0,0 +1,131 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : model of actual argument (both typed and abstract interface) +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP +#define BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP + +// Boost.Test Runtime parameters +#include +#include + +// Boost.Test +#include +#include +#include +#include + +// STL +#include + +#include + +namespace boost { +namespace runtime { + +// ************************************************************************** // +// ************** runtime::argument ************** // +// ************************************************************************** // + +class argument { +public: + // Constructor + argument( rtti::id_t value_type ) + : p_value_type( value_type ) + {} + + // Destructor + virtual ~argument() {} + + // Public properties + rtti::id_t const p_value_type; +}; + +// ************************************************************************** // +// ************** runtime::typed_argument ************** // +// ************************************************************************** // + +template +class typed_argument : public argument { +public: + // Constructor + explicit typed_argument( T const& v ) + : argument( rtti::type_id() ) + , p_value( v ) + {} + + unit_test::readwrite_property p_value; +}; + +// ************************************************************************** // +// ************** runtime::arguments_store ************** // +// ************************************************************************** // + +class arguments_store { +public: + typedef std::map storage_type; + + /// Returns number of arguments in the store; mostly used for testing + std::size_t size() const { return m_arguments.size(); } + + /// Clears the store for reuse + void clear() { m_arguments.clear(); } + + /// Returns true if there is an argument corresponding to the specified parameter name + bool has( cstring parameter_name ) const + { + return m_arguments.find( parameter_name ) != m_arguments.end(); + } + + /// Provides types access to argument value by parameter name + template + T const& get( cstring parameter_name ) const { + return const_cast(this)->get( parameter_name ); + } + + template + T& get( cstring parameter_name ) { + storage_type::const_iterator found = m_arguments.find( parameter_name ); + BOOST_TEST_I_ASSRT( found != m_arguments.end(), + access_to_missing_argument() + << "There is no argument provided for parameter " + << parameter_name ); + + argument_ptr arg = found->second; + + BOOST_TEST_I_ASSRT( arg->p_value_type == rtti::type_id(), + arg_type_mismatch() + << "Access with invalid type for argument corresponding to parameter " + << parameter_name ); + + return static_cast&>( *arg ).p_value.value; + } + + /// Set's the argument value for specified parameter name + template + void set( cstring parameter_name, T const& value ) + { + m_arguments[parameter_name] = argument_ptr( new typed_argument( value ) ); + } + +private: + // Data members + storage_type m_arguments; +}; + +} // namespace runtime +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/argument_factory.hpp b/libraries/boost/include/boost/test/utils/runtime/argument_factory.hpp new file mode 100644 index 0000000000..f3448f8cc4 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/runtime/argument_factory.hpp @@ -0,0 +1,242 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : argument factories for different kinds of parameters +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_RUNTIME_ARGUMENT_FACTORY_HPP +#define BOOST_TEST_UTILS_RUNTIME_ARGUMENT_FACTORY_HPP + +// Boost.Test Runtime parameters +#include +#include + +// Boost.Test +#include +#include +#include + +// Boost +#include + +// STL +#include + +#include + +namespace boost { +namespace runtime { + +// ************************************************************************** // +// ************** runtime::value_interpreter ************** // +// ************************************************************************** // + +template +struct value_interpreter; + +//____________________________________________________________________________// + +template +struct value_interpreter { + template + explicit value_interpreter( Modifiers const& ) {} + + ValueType interpret( cstring param_name, cstring source ) const + { + ValueType res; + if( !unit_test::utils::string_as( source, res ) ) + BOOST_TEST_I_THROW( format_error( param_name ) << source << + " can't be interpreted as value of parameter " << param_name << "." ); + return res; + } +}; + +//____________________________________________________________________________// + +template<> +struct value_interpreter { + template + explicit value_interpreter( Modifiers const& ) {} + + std::string interpret( cstring, cstring source ) const + { + return std::string( source.begin(), source.size() ); + } +}; + +//____________________________________________________________________________// + +template<> +struct value_interpreter { + template + explicit value_interpreter( Modifiers const& ) {} + + cstring interpret( cstring, cstring source ) const + { + return source; + } +}; + +//____________________________________________________________________________// + +template<> +struct value_interpreter { + template + explicit value_interpreter( Modifiers const& ) {} + + bool interpret( cstring param_name, cstring source ) const + { + static cstring const s_YES( "YES" ); + static cstring const s_Y( "Y" ); + static cstring const s_NO( "NO" ); + static cstring const s_N( "N" ); + static cstring const s_TRUE( "TRUE" ); + static cstring const s_FALSE( "FALSE" ); + static cstring const s_one( "1" ); + static cstring const s_zero( "0" ); + + source.trim(); + + if( source.is_empty() || + case_ins_eq( source, s_YES ) || + case_ins_eq( source, s_Y ) || + case_ins_eq( source, s_one ) || + case_ins_eq( source, s_TRUE ) ) + return true; + + if( case_ins_eq( source, s_NO ) || + case_ins_eq( source, s_N ) || + case_ins_eq( source, s_zero ) || + case_ins_eq( source, s_FALSE ) ) + return false; + + BOOST_TEST_I_THROW( format_error( param_name ) << source << " can't be interpreted as bool value." ); + } +}; + +//____________________________________________________________________________// + +template +struct value_interpreter { + template + explicit value_interpreter( Modifiers const& m ) +#if defined(BOOST_TEST_CLA_NEW_API) + : m_name_to_value( m[enum_values::value] ) + { + } +#else + { + std::vector > const& values = m[enum_values::value]; + + m_name_to_value.insert( values.begin(), values.end() ); + } +#endif + + EnumType interpret( cstring param_name, cstring source ) const + { + typename std::map::const_iterator found = m_name_to_value.find( source ); + + BOOST_TEST_I_ASSRT( found != m_name_to_value.end(), + format_error( param_name ) << source << + " is not a valid enumeration value name for parameter " << param_name << "." ); + + return found->second; + } + +private: + // Data members + std::map m_name_to_value; +}; + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** runtime::argument_factory ************** // +// ************************************************************************** // + +template +class argument_factory; + +//____________________________________________________________________________// + +template +class argument_factory { +public: + template + explicit argument_factory( Modifiers const& m ) + : m_interpreter( m ) + , m_optional_value( nfp::opt_get( m, optional_value, ValueType() ) ) + , m_default_value( nfp::opt_get( m, default_value, ValueType() ) ) + { + } + + void produce_argument( cstring source, cstring param_name, arguments_store& store ) const + { + store.set( param_name, source.empty() ? m_optional_value : m_interpreter.interpret( param_name, source ) ); + } + + void produce_default( cstring param_name, arguments_store& store ) const + { + store.set( param_name, m_default_value ); + } + +private: + // Data members + typedef value_interpreter interp_t; + interp_t m_interpreter; + ValueType m_optional_value; + ValueType m_default_value; +}; + +//____________________________________________________________________________// + +template +class argument_factory { +public: + template + explicit argument_factory( Modifiers const& m ) + : m_interpreter( m ) + { + } + + void produce_argument( cstring source, cstring param_name, arguments_store& store ) const + { + ValueType value = m_interpreter.interpret( param_name, source ); + + if( store.has( param_name ) ) { + std::vector& values = store.get >( param_name ); + values.push_back( value ); + } + else { + std::vector values( 1, value ); + + store.set( param_name, values ); + } + + } + void produce_default( cstring param_name, arguments_store& store ) const + { + store.set( param_name, std::vector() ); + } + +private: + // Data members + value_interpreter m_interpreter; +}; + +//____________________________________________________________________________// + +} // namespace runtime +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_RUNTIME_ARGUMENT_FACTORY_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/cla/argv_traverser.hpp b/libraries/boost/include/boost/test/utils/runtime/cla/argv_traverser.hpp new file mode 100644 index 0000000000..10fb67bde4 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/runtime/cla/argv_traverser.hpp @@ -0,0 +1,105 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Use, modification, and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : defines facility to hide input traversing details +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP + +// Boost.Test Runtime parameters +#include + +#include + +namespace boost { +namespace runtime { +namespace cla { + +// ************************************************************************** // +// ************** runtime::cla::argv_traverser ************** // +// ************************************************************************** // + +class argv_traverser { + typedef char const** argv_type; +public: + /// Constructs traverser based on argc/argv pair + /// argv is taken "by reference" and later can be + /// updated in remainder method + argv_traverser( int argc, argv_type argv ) + : m_argc( argc ) + , m_curr_token( 0 ) + , m_token_size( 0 ) + , m_argv( argv ) + { + // save program name + save_token(); + } + + /// Returns new argc + int remainder() + { + return m_argc; + } + + /// Returns true, if we reached end on input + bool eoi() const + { + return m_curr_token == m_argc; + } + + /// Returns current token in the input + cstring current_token() + { + if( eoi() ) + return cstring(); + + return cstring( m_argv[m_curr_token], m_token_size ); + } + + /// Saves current token for remainder + void save_token() + { + ++m_curr_token; + + if( !eoi() ) + m_token_size = ::strlen( m_argv[m_curr_token] ); + } + + /// Commit current token and iterate to next one + void next_token() + { + if( !eoi() ) { + for( std::size_t i = m_curr_token; i < m_argc-1; ++i ) + m_argv[i] = m_argv[i + 1]; + + --m_argc; + + m_token_size = ::strlen( m_argv[m_curr_token] ); + } + } + +private: + + // Data members + std::size_t m_argc; // total number of arguments + std::size_t m_curr_token; // current token index in argv + std::size_t m_token_size; // current token size + argv_type m_argv; // all arguments +}; + +} // namespace cla +} // namespace runtime +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/cla/parser.hpp b/libraries/boost/include/boost/test/utils/runtime/cla/parser.hpp new file mode 100644 index 0000000000..a57091b474 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/runtime/cla/parser.hpp @@ -0,0 +1,584 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Use, modification, and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +//!@file +//!@brief CLA parser +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP + +// Boost.Test Runtime parameters +#include +#include +#include + +#include + +// Boost.Test +#include +#include +#include +#include + +#include // !! ?? unnecessary after cxx11 + +// STL +// !! ?? #include +#include +#include + +#include + +namespace boost { +namespace runtime { +namespace cla { + +// ************************************************************************** // +// ************** runtime::cla::parameter_trie ************** // +// ************************************************************************** // + +namespace rt_cla_detail { + +struct parameter_trie; +typedef shared_ptr parameter_trie_ptr; +typedef std::map trie_per_char; +typedef std::vector > param_cla_id_list; + +struct parameter_trie { + parameter_trie() : m_has_final_candidate( false ) {} + + /// If subtrie corresponding to the char c exists returns it otherwise creates new + parameter_trie_ptr make_subtrie( char c ) + { + trie_per_char::const_iterator it = m_subtrie.find( c ); + + if( it == m_subtrie.end() ) + it = m_subtrie.insert( std::make_pair( c, parameter_trie_ptr( new parameter_trie ) ) ).first; + + return it->second; + } + + /// Creates series of sub-tries per characters in a string + parameter_trie_ptr make_subtrie( cstring s ) + { + parameter_trie_ptr res; + + BOOST_TEST_FOREACH( char, c, s ) + res = (res ? res->make_subtrie( c ) : make_subtrie( c )); + + return res; + } + + /// Registers candidate parameter for this subtrie. If final, it needs to be unique + void add_candidate_id( parameter_cla_id const& param_id, basic_param_ptr param_candidate, bool final ) + { + BOOST_TEST_I_ASSRT( !m_has_final_candidate && (!final || m_id_candidates.empty()), + conflicting_param() << "Parameter cla id " << param_id.m_tag << " conflicts with the " + << "parameter cla id " << m_id_candidates.back().get().m_tag ); + + m_has_final_candidate = final; + m_id_candidates.push_back( ref(param_id) ); + + if( m_id_candidates.size() == 1 ) + m_param_candidate = param_candidate; + else + m_param_candidate.reset(); + } + + /// Gets subtrie for specified char if present or nullptr otherwise + parameter_trie_ptr get_subtrie( char c ) const + { + trie_per_char::const_iterator it = m_subtrie.find( c ); + + return it != m_subtrie.end() ? it->second : parameter_trie_ptr(); + } + + // Data members + trie_per_char m_subtrie; + param_cla_id_list m_id_candidates; + basic_param_ptr m_param_candidate; + bool m_has_final_candidate; +}; + +// ************************************************************************** // +// ************** runtime::cla::report_foreing_token ************** // +// ************************************************************************** // + +static void +report_foreing_token( cstring program_name, cstring token ) +{ + std::cerr << "Boost.Test WARNING: token \"" << token << "\" does not correspond to the Boost.Test argument \n" + << " and should be placed after all Boost.Test arguments and the -- separator.\n" + << " For example: " << program_name << " --random -- " << token << "\n"; +} + +} // namespace rt_cla_detail + +// ************************************************************************** // +// ************** runtime::cla::parser ************** // +// ************************************************************************** // + +class parser { +public: + /// Initializes a parser and builds internal trie representation used for + /// parsing based on the supplied parameters +#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS + template + parser( parameters_store const& parameters, Modifiers const& m = nfp::no_params ) +#else + template + parser( parameters_store const& parameters, Modifiers const& m ) +#endif + { + nfp::opt_assign( m_end_of_param_indicator, m, end_of_params ); + nfp::opt_assign( m_negation_prefix, m, negation_prefix ); + + BOOST_TEST_I_ASSRT( algorithm::all_of( m_end_of_param_indicator.begin(), + m_end_of_param_indicator.end(), + parameter_cla_id::valid_prefix_char ), + invalid_cla_id() << "End of parameters indicator can only consist of prefix characters." ); + + BOOST_TEST_I_ASSRT( algorithm::all_of( m_negation_prefix.begin(), + m_negation_prefix.end(), + parameter_cla_id::valid_name_char ), + invalid_cla_id() << "Negation prefix can only consist of prefix characters." ); + + build_trie( parameters ); + } + + // input processing method + int + parse( int argc, char** argv, runtime::arguments_store& res ) + { + // save program name for help message + m_program_name = argv[0]; + cstring path_sep( "\\/" ); + + cstring::iterator it = unit_test::utils::find_last_of( m_program_name.begin(), m_program_name.end(), + path_sep.begin(), path_sep.end() ); + if( it != m_program_name.end() ) + m_program_name.trim_left( it + 1 ); + + // Set up the traverser + argv_traverser tr( argc, (char const**)argv ); + + // Loop till we reach end of input + while( !tr.eoi() ) { + cstring curr_token = tr.current_token(); + + cstring prefix; + cstring name; + cstring value_separator; + bool negative_form = false; + + // Perform format validations and split the argument into prefix, name and separator + // False return value indicates end of params indicator is met + if( !validate_token_format( curr_token, prefix, name, value_separator, negative_form ) ) { + // get rid of "end of params" token + tr.next_token(); + break; + } + + // Locate trie corresponding to found prefix and skip it in the input + trie_ptr curr_trie = m_param_trie[prefix]; + + if( !curr_trie ) { + // format_error() << "Unrecognized parameter prefix in the argument " << tr.current_token() + rt_cla_detail::report_foreing_token( m_program_name, curr_token ); + tr.save_token(); + continue; + } + + curr_token.trim_left( prefix.size() ); + + // Locate parameter based on a name and skip it in the input + locate_result locate_res = locate_parameter( curr_trie, name, curr_token ); + parameter_cla_id const& found_id = locate_res.first; + basic_param_ptr found_param = locate_res.second; + + if( negative_form ) { + BOOST_TEST_I_ASSRT( found_id.m_negatable, + format_error( found_param->p_name ) + << "Parameter tag " << found_id.m_tag << " is not negatable." ); + + curr_token.trim_left( m_negation_prefix.size() ); + } + + curr_token.trim_left( name.size() ); + + cstring value; + + // Skip validations if parameter has optional value and we are at the end of token + if( !value_separator.is_empty() || !found_param->p_has_optional_value ) { + // Validate and skip value separator in the input + BOOST_TEST_I_ASSRT( found_id.m_value_separator == value_separator, + format_error( found_param->p_name ) + << "Invalid separator for the parameter " + << found_param->p_name + << " in the argument " << tr.current_token() ); + + curr_token.trim_left( value_separator.size() ); + + // Deduce value source + value = curr_token; + if( value.is_empty() ) { + tr.next_token(); + value = tr.current_token(); + } + + BOOST_TEST_I_ASSRT( !value.is_empty(), + format_error( found_param->p_name ) + << "Missing an argument value for the parameter " + << found_param->p_name + << " in the argument " << tr.current_token() ); + } + + // Validate against argument duplication + BOOST_TEST_I_ASSRT( !res.has( found_param->p_name ) || found_param->p_repeatable, + duplicate_arg( found_param->p_name ) + << "Duplicate argument value for the parameter " + << found_param->p_name + << " in the argument " << tr.current_token() ); + + // Produce argument value + found_param->produce_argument( value, negative_form, res ); + + tr.next_token(); + } + + // generate the remainder and return it's size + return tr.remainder(); + } + + // help/usage/version + void + version( std::ostream& ostr ) + { + ostr << "Boost.Test module "; + +#if defined(BOOST_TEST_MODULE) + // we do not want to refer to the master test suite there + ostr << '\'' << BOOST_TEST_STRINGIZE( BOOST_TEST_MODULE ).trim( "\"" ) << "' "; +#endif + + ostr << "in executable '" << m_program_name << "'\n"; + ostr << "Compiled from Boost version " + << BOOST_VERSION/100000 << "." + << BOOST_VERSION/100 % 1000 << "." + << BOOST_VERSION % 100 ; + ostr << " with "; +#if defined(BOOST_TEST_INCLUDED) + ostr << "single header inclusion of"; +#elif defined(BOOST_TEST_DYN_LINK) + ostr << "dynamic linking to"; +#else + ostr << "static linking to"; +#endif + ostr << " Boost.Test\n"; + ostr << "- Compiler: " << BOOST_COMPILER << '\n' + << "- Platform: " << BOOST_PLATFORM << '\n' + << "- STL : " << BOOST_STDLIB; + ostr << std::endl; + } + + void + usage(std::ostream& ostr, + cstring param_name = cstring(), + bool use_color = true) + { + namespace utils = unit_test::utils; + namespace ut_detail = unit_test::ut_detail; + + if( !param_name.is_empty() ) { + basic_param_ptr param = locate_parameter( m_param_trie[help_prefix], param_name, "" ).second; + param->usage( ostr, m_negation_prefix ); + } + else { + ostr << "\n The program '" << m_program_name << "' is a Boost.test module containing unit tests."; + + { + BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL ); + ostr << "\n\n Usage\n "; + } + + { + BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); + ostr << m_program_name << " [Boost.Test argument]... "; + } + if( !m_end_of_param_indicator.empty() ) { + BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); + ostr << '[' << m_end_of_param_indicator << " [custom test module argument]...]"; + } + } + + ostr << "\n\n Use\n "; + { + + BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); + ostr << m_program_name << " --help"; + } + ostr << "\n or "; + { + BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); + ostr << m_program_name << " --help="; + } + ostr << "\n for detailed help on Boost.Test parameters.\n"; + } + + void + help(std::ostream& ostr, + parameters_store const& parameters, + cstring param_name, + bool use_color = true) + { + namespace utils = unit_test::utils; + namespace ut_detail = unit_test::ut_detail; + + if( !param_name.is_empty() ) { + basic_param_ptr param = locate_parameter( m_param_trie[help_prefix], param_name, "" ).second; + param->help( ostr, m_negation_prefix, use_color); + return; + } + + usage(ostr, cstring(), use_color); + + ostr << "\n\n"; + { + BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL ); + ostr << " Command line flags:\n"; + } + runtime::commandline_pretty_print( + ostr, + " ", + "The command line flags of Boost.Test are listed below. " + "All parameters are optional. You can specify parameter value either " + "as a command line argument or as a value of its corresponding environment " + "variable. If a flag is specified as a command line argument and an environment variable " + "at the same time, the command line takes precedence. " + "The command line argument " + "support name guessing, and works with shorter names as long as those are not ambiguous." + ); + + if( !m_end_of_param_indicator.empty() ) { + ostr << "\n\n All the arguments after the '"; + { + BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); + ostr << m_end_of_param_indicator; + } + ostr << "' are ignored by Boost.Test."; + } + + + { + BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL ); + ostr << "\n\n Environment variables:\n"; + } + runtime::commandline_pretty_print( + ostr, + " ", + "Every argument listed below may also be set by a corresponding environment" + "variable. For an argument '--argument_x=', the corresponding " + "environment variable is 'BOOST_TEST_ARGUMENT_X=value" + ); + + + + ostr << "\n\n The following parameters are supported:\n"; + + BOOST_TEST_FOREACH( + parameters_store::storage_type::value_type const&, + v, + parameters.all() ) + { + basic_param_ptr param = v.second; + ostr << "\n"; + param->usage( ostr, m_negation_prefix, use_color); + } + + } + +private: + typedef rt_cla_detail::parameter_trie_ptr trie_ptr; + typedef rt_cla_detail::trie_per_char trie_per_char; + typedef std::map str_to_trie; + + void + build_trie( parameters_store const& parameters ) + { + // Iterate over all parameters + BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, parameters.all() ) { + basic_param_ptr param = v.second; + + // Register all parameter's ids in trie. + BOOST_TEST_FOREACH( parameter_cla_id const&, id, param->cla_ids() ) { + // This is the trie corresponding to the prefix. + trie_ptr next_trie = m_param_trie[id.m_prefix]; + if( !next_trie ) + next_trie = m_param_trie[id.m_prefix] = trie_ptr( new rt_cla_detail::parameter_trie ); + + // Build the trie, by following name's characters + // and register this parameter as candidate on each level + for( size_t index = 0; index < id.m_tag.size(); ++index ) { + next_trie = next_trie->make_subtrie( id.m_tag[index] ); + + next_trie->add_candidate_id( id, param, index == (id.m_tag.size() - 1) ); + } + } + } + } + + bool + validate_token_format( cstring token, cstring& prefix, cstring& name, cstring& separator, bool& negative_form ) + { + // Match prefix + cstring::iterator it = token.begin(); + while( it != token.end() && parameter_cla_id::valid_prefix_char( *it ) ) + ++it; + + prefix.assign( token.begin(), it ); + + if( prefix.empty() ) + return true; + + // Match name + while( it != token.end() && parameter_cla_id::valid_name_char( *it ) ) + ++it; + + name.assign( prefix.end(), it ); + + if( name.empty() ) { + if( prefix == m_end_of_param_indicator ) + return false; + + BOOST_TEST_I_THROW( format_error() << "Invalid format for an actual argument " << token ); + } + + // Match value separator + while( it != token.end() && parameter_cla_id::valid_separator_char( *it ) ) + ++it; + + separator.assign( name.end(), it ); + + // Match negation prefix + negative_form = !m_negation_prefix.empty() && ( name.substr( 0, m_negation_prefix.size() ) == m_negation_prefix ); + if( negative_form ) + name.trim_left( m_negation_prefix.size() ); + + return true; + } + + // C++03: cannot have references as types + typedef std::pair locate_result; + + locate_result + locate_parameter( trie_ptr curr_trie, cstring name, cstring token ) + { + std::vector typo_candidates; + std::vector next_typo_candidates; + trie_ptr next_trie; + + BOOST_TEST_FOREACH( char, c, name ) { + if( curr_trie ) { + // locate next subtrie corresponding to the char + next_trie = curr_trie->get_subtrie( c ); + + if( next_trie ) + curr_trie = next_trie; + else { + // Initiate search for typo candicates. We will account for 'wrong char' typo + // 'missing char' typo and 'extra char' typo + BOOST_TEST_FOREACH( trie_per_char::value_type const&, typo_cand, curr_trie->m_subtrie ) { + // 'wrong char' typo + typo_candidates.push_back( typo_cand.second ); + + // 'missing char' typo + if( (next_trie = typo_cand.second->get_subtrie( c )) ) + typo_candidates.push_back( next_trie ); + } + + // 'extra char' typo + typo_candidates.push_back( curr_trie ); + + curr_trie.reset(); + } + } + else { + // go over existing typo candidates and see if they are still viable + BOOST_TEST_FOREACH( trie_ptr, typo_cand, typo_candidates ) { + trie_ptr next_typo_cand = typo_cand->get_subtrie( c ); + + if( next_typo_cand ) + next_typo_candidates.push_back( next_typo_cand ); + } + + next_typo_candidates.swap( typo_candidates ); + next_typo_candidates.clear(); + } + } + + if( !curr_trie ) { + std::vector typo_candidate_names; + std::set unique_typo_candidate; // !! ?? unordered_set + typo_candidate_names.reserve( typo_candidates.size() ); +// !! ?? unique_typo_candidate.reserve( typo_candidates.size() ); + + BOOST_TEST_FOREACH( trie_ptr, trie_cand, typo_candidates ) { + // avoid ambiguos candidate trie + if( trie_cand->m_id_candidates.size() > 1 ) + continue; + + BOOST_TEST_FOREACH( parameter_cla_id const&, param_cand, trie_cand->m_id_candidates ) { + if( !unique_typo_candidate.insert( ¶m_cand ).second ) + continue; + + typo_candidate_names.push_back( param_cand.m_tag ); + } + } + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + BOOST_TEST_I_THROW( unrecognized_param( std::move(typo_candidate_names) ) + << "An unrecognized parameter in the argument " + << token ); +#else + BOOST_TEST_I_THROW( unrecognized_param( typo_candidate_names ) + << "An unrecognized parameter in the argument " + << token ); +#endif + } + + if( curr_trie->m_id_candidates.size() > 1 ) { + std::vector amb_names; + BOOST_TEST_FOREACH( parameter_cla_id const&, param_id, curr_trie->m_id_candidates ) + amb_names.push_back( param_id.m_tag ); + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + BOOST_TEST_I_THROW( ambiguous_param( std::move( amb_names ) ) + << "An ambiguous parameter name in the argument " << token ); +#else + BOOST_TEST_I_THROW( ambiguous_param( amb_names ) + << "An ambiguous parameter name in the argument " << token ); +#endif + } + + return locate_result( curr_trie->m_id_candidates.back().get(), curr_trie->m_param_candidate ); + } + + // Data members + cstring m_program_name; + std::string m_end_of_param_indicator; + std::string m_negation_prefix; + str_to_trie m_param_trie; +}; + +} // namespace cla +} // namespace runtime +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/env/fetch.hpp b/libraries/boost/include/boost/test/utils/runtime/env/fetch.hpp new file mode 100644 index 0000000000..97d54d4905 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/runtime/env/fetch.hpp @@ -0,0 +1,108 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : implements fetching absent parameter athuments from environment +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_FETCH_HPP +#define BOOST_TEST_UTILS_RUNTIME_ENV_FETCH_HPP + +// Boost.Test Runtime parameters +#include +#include + +#include + +// C Runtime +#include + +namespace boost { +namespace runtime { +namespace env { + +namespace env_detail { + +#ifndef UNDER_CE + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4996) // getenv +#endif + +inline std::pair +sys_read_var( cstring var_name ) +{ + using namespace std; + char const* res = getenv( var_name.begin() ); + + return std::make_pair( cstring(res), res != NULL ); +} + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#else + +inline std::pair +sys_read_var( cstring var_name ) +{ + return std::make_pair( cstring(), false ); +} + +#endif + +//____________________________________________________________________________// + +template +inline void +fetch_absent( parameters_store const& params, runtime::arguments_store& args, ReadFunc read_func ) +{ + BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, params.all() ) { + basic_param_ptr param = v.second; + + if( args.has( param->p_name ) || param->p_env_var.empty() ) + continue; + + std::pair value = read_func( param->p_env_var ); + + if( !value.second ) + continue; + + // Validate against unexpected empty value + BOOST_TEST_I_ASSRT( !value.first.is_empty() || param->p_has_optional_value, + format_error( param->p_name ) + << "Missing an argument value for the parameter " << param->p_name + << " in the environment." ); + + // Produce argument value + param->produce_argument( value.first, false, args ); + + } +} + +//____________________________________________________________________________// + +} // namespace env_detail + +inline void +fetch_absent( parameters_store const& params, runtime::arguments_store& args ) +{ + env_detail::fetch_absent( params, args, &env_detail::sys_read_var ); +} + +} // namespace env +} // namespace runtime +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_RUNTIME_ENV_FETCH_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/errors.hpp b/libraries/boost/include/boost/test/utils/runtime/errors.hpp new file mode 100644 index 0000000000..5b263d21c5 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/runtime/errors.hpp @@ -0,0 +1,195 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : defines runtime parameters setup error +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP +#define BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP + +// Boost.Test Runtime parameters +#include + +// Boost.Test +#include + +// Boost.Test +#include + +// STL +#include +#include + +#include + +namespace boost { +namespace runtime { + +// ************************************************************************** // +// ************** runtime::param_error ************** // +// ************************************************************************** // + +class param_error : public std::exception { +public: + ~param_error() BOOST_NOEXCEPT_OR_NOTHROW {} + + virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW + { + return msg.c_str(); + } + + cstring param_name; + std::string msg; + +protected: + explicit param_error( cstring param_name_ ) : param_name( param_name_) {} +}; + +//____________________________________________________________________________// + +class init_error : public param_error { +protected: + explicit init_error( cstring param_name ) : param_error( param_name ) {} + ~init_error() BOOST_NOEXCEPT_OR_NOTHROW {} +}; + +class input_error : public param_error { +protected: + explicit input_error( cstring param_name ) : param_error( param_name ) {} + ~input_error() BOOST_NOEXCEPT_OR_NOTHROW {} +}; + +//____________________________________________________________________________// + +template +class specific_param_error : public Base { +protected: + explicit specific_param_error( cstring param_name ) : Base( param_name ) {} + ~specific_param_error() BOOST_NOEXCEPT_OR_NOTHROW {} + +public: + +//____________________________________________________________________________// + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ + !defined(BOOST_NO_CXX11_REF_QUALIFIERS) + + Derived operator<<(char const* val) && + { + this->msg.append( val ); + + return static_cast(*this); + } + + //____________________________________________________________________________// + + template + Derived operator<<(T const& val) && + { + this->msg.append( unit_test::utils::string_cast( val ) ); + + return static_cast(*this); + } + + //____________________________________________________________________________// + +#else + + Derived const& operator<<(char const* val) const + { + const_cast&>(*this).msg.append( val ); + + return static_cast(*this); + } + + //____________________________________________________________________________// + + template + Derived const& operator<<(T const& val) const + { + const_cast&>(*this).msg.append( unit_test::utils::string_cast( val ) ); + + return static_cast(*this); + } + + //____________________________________________________________________________// + +#endif + +}; + + + +// ************************************************************************** // +// ************** specific exception types ************** // +// ************************************************************************** // + +#define SPECIFIC_EX_TYPE( type, base ) \ +class type : public specific_param_error { \ +public: \ + explicit type( cstring param_name = cstring() ) \ + : specific_param_error( param_name ) \ + {} \ +} \ +/**/ + +SPECIFIC_EX_TYPE( invalid_cla_id, init_error ); +SPECIFIC_EX_TYPE( duplicate_param, init_error ); +SPECIFIC_EX_TYPE( conflicting_param, init_error ); +SPECIFIC_EX_TYPE( unknown_param, init_error ); +SPECIFIC_EX_TYPE( access_to_missing_argument, init_error ); +SPECIFIC_EX_TYPE( arg_type_mismatch, init_error ); +SPECIFIC_EX_TYPE( invalid_param_spec, init_error ); + +SPECIFIC_EX_TYPE( format_error, input_error ); +SPECIFIC_EX_TYPE( duplicate_arg, input_error ); +SPECIFIC_EX_TYPE( missing_req_arg, input_error ); + +#undef SPECIFIC_EX_TYPE + +class ambiguous_param : public specific_param_error { +public: +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + explicit ambiguous_param( std::vector&& amb_candidates ) + : specific_param_error( "" ) + , m_amb_candidates( std::move( amb_candidates ) ) {} +#else + explicit ambiguous_param( std::vector const& amb_candidates ) + : specific_param_error( "" ) + , m_amb_candidates( amb_candidates ) {} +#endif + ~ambiguous_param() BOOST_NOEXCEPT_OR_NOTHROW {} + + std::vector m_amb_candidates; +}; + +class unrecognized_param : public specific_param_error { +public: +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + explicit unrecognized_param( std::vector&& type_candidates ) + : specific_param_error( "" ) + , m_typo_candidates( std::move( type_candidates ) ) {} +#else + explicit unrecognized_param( std::vector const& type_candidates ) + : specific_param_error( "" ) + , m_typo_candidates( type_candidates ) {} +#endif + ~unrecognized_param() BOOST_NOEXCEPT_OR_NOTHROW {} + + std::vector m_typo_candidates; +}; + +} // namespace runtime +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/finalize.hpp b/libraries/boost/include/boost/test/utils/runtime/finalize.hpp new file mode 100644 index 0000000000..181428550c --- /dev/null +++ b/libraries/boost/include/boost/test/utils/runtime/finalize.hpp @@ -0,0 +1,56 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : runtime parameters initialization final step +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP +#define BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP + +// Boost.Test Runtime parameters +#include +#include + +// Boost.Test +#include + +#include + +namespace boost { +namespace runtime { + +inline void +finalize_arguments( parameters_store const& params, runtime::arguments_store& args ) +{ + BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, params.all() ) { + basic_param_ptr param = v.second; + + if( !args.has( param->p_name ) ) { + if( param->p_has_default_value ) + param->produce_default( args ); + + if( !args.has( param->p_name ) ) { + BOOST_TEST_I_ASSRT( param->p_optional, + missing_req_arg( param->p_name ) << "Missing argument for required parameter " << param->p_name << "." ); + } + } + + if( args.has( param->p_name ) && !!param->p_callback ) + param->p_callback( param->p_name ); + } +} + +} // namespace runtime +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/fwd.hpp b/libraries/boost/include/boost/test/utils/runtime/fwd.hpp new file mode 100644 index 0000000000..17ae881222 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/runtime/fwd.hpp @@ -0,0 +1,45 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : runtime parameters forward declaration +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_RUNTIME_FWD_HPP +#define BOOST_TEST_UTILS_RUNTIME_FWD_HPP + +// Boost.Test +#include +#include +#include // operator<<(boost::runtime::cstring) + +// Boost +#include + +// STL +#include + +namespace boost { +namespace runtime { + +typedef unit_test::const_string cstring; + +class argument; +typedef shared_ptr argument_ptr; + +template class typed_argument; + +class basic_param; +typedef shared_ptr basic_param_ptr; + +} // namespace runtime +} // namespace boost + +#endif // BOOST_TEST_UTILS_RUNTIME_FWD_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/modifier.hpp b/libraries/boost/include/boost/test/utils/runtime/modifier.hpp new file mode 100644 index 0000000000..f4f5a42baa --- /dev/null +++ b/libraries/boost/include/boost/test/utils/runtime/modifier.hpp @@ -0,0 +1,106 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Use, modification, and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : parameter modifiers +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP +#define BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP + +// Boost.Test Runtime parameters +#include + +// Boost.Test +#include + +#include + + +// New CLA API available only for some C++11 compilers +#if !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \ + && !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) \ + && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) \ + && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) +#define BOOST_TEST_CLA_NEW_API +#endif + +namespace boost { +namespace runtime { + +// ************************************************************************** // +// ************** environment variable modifiers ************** // +// ************************************************************************** // + +namespace { + +#ifdef BOOST_TEST_CLA_NEW_API +auto const& description = unit_test::static_constant>::value; +auto const& help = unit_test::static_constant>::value; +auto const& env_var = unit_test::static_constant>::value; +auto const& end_of_params = unit_test::static_constant>::value; +auto const& negation_prefix = unit_test::static_constant>::value; +auto const& value_hint = unit_test::static_constant>::value; +auto const& optional_value = unit_test::static_constant>::value; +auto const& default_value = unit_test::static_constant>::value; +auto const& callback = unit_test::static_constant>::value; + +template +using enum_values = unit_test::static_constant< + nfp::typed_keyword>, struct enum_values_t> +>; + +#else + +nfp::typed_keyword description; +nfp::typed_keyword help; +nfp::typed_keyword env_var; +nfp::typed_keyword end_of_params; +nfp::typed_keyword negation_prefix; +nfp::typed_keyword value_hint; +nfp::keyword optional_value; +nfp::keyword default_value; +nfp::keyword callback; + +template +struct enum_values_list { + typedef std::pair ElemT; + typedef std::vector ValuesT; + + enum_values_list const& + operator()( cstring k, EnumType v ) const + { + const_cast(this)->m_values.push_back( ElemT( k, v ) ); + + return *this; + } + + operator ValuesT const&() const { return m_values; } + +private: + ValuesT m_values; +}; + +template +struct enum_values : unit_test::static_constant< + nfp::typed_keyword, struct enum_values_t> > +{ +}; + +#endif + +} // local namespace + +} // namespace runtime +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/parameter.hpp b/libraries/boost/include/boost/test/utils/runtime/parameter.hpp new file mode 100644 index 0000000000..420b60264d --- /dev/null +++ b/libraries/boost/include/boost/test/utils/runtime/parameter.hpp @@ -0,0 +1,526 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : formal parameter definition +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP +#define BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP + +// Boost.Test Runtime parameters +#include +#include +#include +#include + +// Boost.Test +#include +#include +#include + +// Boost +#include +#include + +// STL +#include + +#include + +namespace boost { +namespace runtime { + +inline +std::ostream& commandline_pretty_print( + std::ostream& ostr, + std::string const& prefix, + std::string const& to_print) { + + const int split_at = 80; + + std::string::size_type current = 0; + + while(current < to_print.size()) { + + // discards spaces at the beginning + std::string::size_type startpos = to_print.find_first_not_of(" \t\n", current); + current += startpos - current; + + bool has_more_lines = (current + split_at) < to_print.size(); + + if(has_more_lines) { + std::string::size_type endpos = to_print.find_last_of(" \t\n", current + split_at); + std::string sub(to_print.substr(current, endpos - current)); + ostr << prefix << sub; + ostr << "\n"; + current += endpos - current; + } + else + { + ostr << prefix << to_print.substr(current, split_at); + current += split_at; + } + } + return ostr; +} + +// ************************************************************************** // +// ************** runtime::parameter_cla_id ************** // +// ************************************************************************** // +// set of attributes identifying the parameter in the command line + +struct parameter_cla_id { + parameter_cla_id( cstring prefix, cstring tag, cstring value_separator, bool negatable ) + : m_prefix( prefix.begin(), prefix.size() ) + , m_tag( tag.begin(), tag.size() ) + , m_value_separator( value_separator.begin(), value_separator.size() ) + , m_negatable( negatable ) + { + + BOOST_TEST_I_ASSRT( algorithm::all_of( m_prefix.begin(), m_prefix.end(), valid_prefix_char ), + invalid_cla_id() << "Parameter " << m_tag + << " has invalid characters in prefix." ); + + BOOST_TEST_I_ASSRT( algorithm::all_of( m_tag.begin(), m_tag.end(), valid_name_char ), + invalid_cla_id() << "Parameter " << m_tag + << " has invalid characters in name." ); + + BOOST_TEST_I_ASSRT( algorithm::all_of( m_value_separator.begin(), m_value_separator.end(), valid_separator_char ), + invalid_cla_id() << "Parameter " << m_tag + << " has invalid characters in value separator." ); + } + + static bool valid_prefix_char( char c ) + { + return c == '-' || c == '/' ; + } + static bool valid_separator_char( char c ) + { + return c == '=' || c == ':' || c == ' ' || c == '\0'; + } + static bool valid_name_char( char c ) + { + return std::isalnum( c ) || c == '+' || c == '_' || c == '?'; + } + + std::string m_prefix; + std::string m_tag; + std::string m_value_separator; + bool m_negatable; +}; + +typedef std::vector param_cla_ids; + +// ************************************************************************** // +// ************** runtime::basic_param ************** // +// ************************************************************************** // + +cstring const help_prefix("////"); + +class basic_param { + typedef function callback_type; + typedef unit_test::readwrite_property bool_property; + +protected: + /// Constructor with modifiers + template + basic_param( cstring name, bool is_optional, bool is_repeatable, Modifiers const& m ) + : p_name( name.begin(), name.end() ) + , p_description( nfp::opt_get( m, description, std::string() ) ) + , p_help( nfp::opt_get( m, runtime::help, std::string() ) ) + , p_env_var( nfp::opt_get( m, env_var, std::string() ) ) + , p_value_hint( nfp::opt_get( m, value_hint, std::string() ) ) + , p_optional( is_optional ) + , p_repeatable( is_repeatable ) + , p_has_optional_value( m.has( optional_value ) ) + , p_has_default_value( m.has( default_value ) || is_repeatable ) + , p_callback( nfp::opt_get( m, callback, callback_type() ) ) + { + add_cla_id( help_prefix, name, ":" ); + } + +public: + virtual ~basic_param() {} + + // Pubic properties + std::string const p_name; + std::string const p_description; + std::string const p_help; + std::string const p_env_var; + std::string const p_value_hint; + bool const p_optional; + bool const p_repeatable; + bool_property p_has_optional_value; + bool_property p_has_default_value; + callback_type const p_callback; + + /// interface for cloning typed parameters + virtual basic_param_ptr clone() const = 0; + + /// Access methods + param_cla_ids const& cla_ids() const { return m_cla_ids; } + void add_cla_id( cstring prefix, cstring tag, cstring value_separator ) + { + add_cla_id_impl( prefix, tag, value_separator, false, true ); + } + + /// interface for producing argument values for this parameter + virtual void produce_argument( cstring token, bool negative_form, arguments_store& store ) const = 0; + virtual void produce_default( arguments_store& store ) const = 0; + + /// interfaces for help message reporting + virtual void usage( std::ostream& ostr, cstring negation_prefix_, bool use_color = true ) + { + namespace utils = unit_test::utils; + namespace ut_detail = unit_test::ut_detail; + + // + ostr << " "; + { + + BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); + ostr << p_name; + } + + ostr << '\n'; + + if( !p_description.empty() ) { + commandline_pretty_print(ostr, " ", p_description) << '\n'; + } + + BOOST_TEST_FOREACH( parameter_cla_id const&, id, cla_ids() ) { + if( id.m_prefix == help_prefix ) + continue; + + ostr << " " << id.m_prefix; + + if( id.m_negatable ) + cla_name_help( ostr, id.m_tag, negation_prefix_, use_color ); + else + cla_name_help( ostr, id.m_tag, "", use_color ); + + BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); + bool optional_value_ = false; + + if( p_has_optional_value ) { + optional_value_ = true; + ostr << '['; + } + + + if( id.m_value_separator.empty() ) + ostr << ' '; + else { + ostr << id.m_value_separator; + } + + value_help( ostr ); + + if( optional_value_ ) + ostr << ']'; + + ostr << '\n'; + } + } + + virtual void help( std::ostream& ostr, cstring negation_prefix_, bool use_color = true ) + { + usage( ostr, negation_prefix_, use_color ); + + if( !p_help.empty() ) { + ostr << '\n'; + commandline_pretty_print(ostr, " ", p_help); + } + } + +protected: + void add_cla_id_impl( cstring prefix, + cstring tag, + cstring value_separator, + bool negatable, + bool validate_value_separator ) + { + BOOST_TEST_I_ASSRT( !tag.is_empty(), + invalid_cla_id() << "Parameter can't have an empty name." ); + + BOOST_TEST_I_ASSRT( !prefix.is_empty(), + invalid_cla_id() << "Parameter " << tag + << " can't have an empty prefix." ); + + BOOST_TEST_I_ASSRT( !value_separator.is_empty(), + invalid_cla_id() << "Parameter " << tag + << " can't have an empty value separator." ); + + // We trim value separator from all the spaces, so token end will indicate separator + value_separator.trim(); + BOOST_TEST_I_ASSRT( !validate_value_separator || !value_separator.is_empty() || !p_has_optional_value, + invalid_cla_id() << "Parameter " << tag + << " with optional value attribute can't use space as value separator." ); + + m_cla_ids.push_back( parameter_cla_id( prefix, tag, value_separator, negatable ) ); + } + +private: + /// interface for usage/help customization + virtual void cla_name_help( std::ostream& ostr, cstring cla_tag, cstring /*negation_prefix_*/, bool /*use_color*/ = true) const + { + ostr << cla_tag; + } + virtual void value_help( std::ostream& ostr ) const + { + if( p_value_hint.empty() ) + ostr << ""; + else + ostr << p_value_hint; + } + + // Data members + param_cla_ids m_cla_ids; +}; + +// ************************************************************************** // +// ************** runtime::parameter ************** // +// ************************************************************************** // + +enum args_amount { + OPTIONAL_PARAM, // 0-1 + REQUIRED_PARAM, // exactly 1 + REPEATABLE_PARAM // 0-N +}; + +//____________________________________________________________________________// + +template +class parameter : public basic_param { +public: + /// Constructor with modifiers +#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS + template + parameter( cstring name, Modifiers const& m = nfp::no_params ) +#else + template + parameter( cstring name, Modifiers const& m ) +#endif + : basic_param( name, a != runtime::REQUIRED_PARAM, a == runtime::REPEATABLE_PARAM, m ) + , m_arg_factory( m ) + { + BOOST_TEST_I_ASSRT( !m.has( default_value ) || a == runtime::OPTIONAL_PARAM, + invalid_param_spec() << "Parameter " << name + << " is not optional and can't have default_value." ); + + BOOST_TEST_I_ASSRT( !m.has( optional_value ) || !this->p_repeatable, + invalid_param_spec() << "Parameter " << name + << " is repeatable and can't have optional_value." ); + } + +private: + virtual basic_param_ptr clone() const + { + return basic_param_ptr( new parameter( *this ) ); + } + virtual void produce_argument( cstring token, bool , arguments_store& store ) const + { + m_arg_factory.produce_argument( token, this->p_name, store ); + } + virtual void produce_default( arguments_store& store ) const + { + if( !this->p_has_default_value ) + return; + + m_arg_factory.produce_default( this->p_name, store ); + } + + // Data members + typedef argument_factory factory_t; + factory_t m_arg_factory; +}; + +//____________________________________________________________________________// + +class option : public basic_param { +public: + /// Constructor with modifiers +#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS + template + option( cstring name, Modifiers const& m = nfp::no_params ) +#else + template + option( cstring name, Modifiers const& m ) +#endif + : basic_param( name, true, false, nfp::opt_append( nfp::opt_append( m, optional_value = true), default_value = false) ) + , m_arg_factory( nfp::opt_append( nfp::opt_append( m, optional_value = true), default_value = false) ) + { + } + + void add_cla_id( cstring prefix, cstring tag, cstring value_separator, bool negatable = false ) + { + add_cla_id_impl( prefix, tag, value_separator, negatable, false ); + } + +private: + virtual basic_param_ptr clone() const + { + return basic_param_ptr( new option( *this ) ); + } + + virtual void produce_argument( cstring token, bool negative_form, arguments_store& store ) const + { + if( token.empty() ) + store.set( p_name, !negative_form ); + else { + BOOST_TEST_I_ASSRT( !negative_form, + format_error( p_name ) << "Can't set value to negative form of the argument." ); + + m_arg_factory.produce_argument( token, p_name, store ); + } + } + + virtual void produce_default( arguments_store& store ) const + { + m_arg_factory.produce_default( p_name, store ); + } + virtual void cla_name_help( std::ostream& ostr, cstring cla_tag, cstring negation_prefix_, bool use_color = true ) const + { + namespace utils = unit_test::utils; + namespace ut_detail = unit_test::ut_detail; + + if( !negation_prefix_.is_empty() ) { + BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); + ostr << '[' << negation_prefix_ << ']'; + } + ostr << cla_tag; + } + virtual void value_help( std::ostream& ostr ) const + { + if( p_value_hint.empty() ) + ostr << ""; + else + ostr << p_value_hint; + } + + // Data members + typedef argument_factory factory_t; + factory_t m_arg_factory; +}; + +//____________________________________________________________________________// + +template +class enum_parameter : public parameter { + typedef parameter base; +public: + /// Constructor with modifiers +#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS + template + enum_parameter( cstring name, Modifiers const& m = nfp::no_params ) +#else + template + enum_parameter( cstring name, Modifiers const& m ) +#endif + : base( name, m ) + { +#ifdef BOOST_TEST_CLA_NEW_API + auto const& values = m[enum_values::value]; + auto it = values.begin(); +#else + std::vector > const& values = m[enum_values::value]; + typename std::vector >::const_iterator it = values.begin(); +#endif + while( it != values.end() ) { + m_valid_names.push_back( it->first ); + ++it; + } + } + +private: + virtual basic_param_ptr clone() const + { + return basic_param_ptr( new enum_parameter( *this ) ); + } + + virtual void value_help( std::ostream& ostr ) const + { + if( this->p_value_hint.empty() ) { + ostr << "<"; + bool first = true; + BOOST_TEST_FOREACH( cstring, name, m_valid_names ) { + if( first ) + first = false; + else + ostr << '|'; + ostr << name; + } + ostr << ">"; + } + else + ostr << this->p_value_hint; + } + + // Data members + std::vector m_valid_names; +}; + + +// ************************************************************************** // +// ************** runtime::parameters_store ************** // +// ************************************************************************** // + +class parameters_store { + struct lg_compare { + bool operator()( cstring lh, cstring rh ) const + { + return std::lexicographical_compare(lh.begin(), lh.end(), + rh.begin(), rh.end()); + } + }; +public: + + typedef std::map storage_type; + + /// Adds parameter into the persistent store + void add( basic_param const& in ) + { + basic_param_ptr p = in.clone(); + + BOOST_TEST_I_ASSRT( m_parameters.insert( std::make_pair( cstring(p->p_name), p ) ).second, + duplicate_param() << "Parameter " << p->p_name << " is duplicate." ); + } + + /// Returns true if there is no parameters registered + bool is_empty() const { return m_parameters.empty(); } + /// Returns map of all the registered parameter + storage_type const& all() const { return m_parameters; } + /// Returns true if parameter with psecified name is registered + bool has( cstring name ) const + { + return m_parameters.find( name ) != m_parameters.end(); + } + /// Returns map of all the registered parameter + basic_param_ptr get( cstring name ) const + { + storage_type::const_iterator const& found = m_parameters.find( name ); + BOOST_TEST_I_ASSRT( found != m_parameters.end(), + unknown_param() << "Parameter " << name << " is unknown." ); + + return found->second; + } + +private: + // Data members + storage_type m_parameters; +}; + +} // namespace runtime +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP diff --git a/libraries/boost/include/boost/test/utils/setcolor.hpp b/libraries/boost/include/boost/test/utils/setcolor.hpp new file mode 100644 index 0000000000..91b068ae6f --- /dev/null +++ b/libraries/boost/include/boost/test/utils/setcolor.hpp @@ -0,0 +1,315 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : contains definition for setcolor iostream manipulator +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_SETCOLOR_HPP +#define BOOST_TEST_UTILS_SETCOLOR_HPP + +// Boost.Test +#include + +// STL +#include +#include + +#include + +#ifdef _WIN32 + #include + + #if defined(__MINGW32__) && !defined(COMMON_LVB_UNDERSCORE) + // mingw badly mimicking windows.h + #define COMMON_LVB_UNDERSCORE 0x8000 + #endif +#endif + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace utils { + +// ************************************************************************** // +// ************** term_attr ************** // +// ************************************************************************** // + +struct term_attr { enum _ { + NORMAL = 0, + BRIGHT = 1, + DIM = 2, + UNDERLINE = 4, + BLINK = 5, + REVERSE = 7, + CROSSOUT = 9 +}; }; + +// ************************************************************************** // +// ************** term_color ************** // +// ************************************************************************** // + +struct term_color { enum _ { + BLACK = 0, + RED = 1, + GREEN = 2, + YELLOW = 3, + BLUE = 4, + MAGENTA = 5, + CYAN = 6, + WHITE = 7, + ORIGINAL = 9 +}; }; + +// ************************************************************************** // +// ************** setcolor ************** // +// ************************************************************************** // + +#ifndef _WIN32 +class setcolor { +public: + // Constructor + explicit setcolor( term_attr::_ attr = term_attr::NORMAL, + term_color::_ fg = term_color::ORIGINAL, + term_color::_ bg = term_color::ORIGINAL ) + { + m_command_size = std::sprintf( m_control_command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40 ); + } + + friend std::ostream& + operator<<( std::ostream& os, setcolor const& sc ) + { + if (&os == &std::cout || &os == &std::cerr) { + return os.write( sc.m_control_command, sc.m_command_size ); + } + return os; + } + +private: + // Data members + char m_control_command[13]; + int m_command_size; +}; + +#else + +class setcolor { + +protected: + void set_console_color(std::ostream& os, WORD *attributes = NULL) const { + DWORD console_type; + if (&os == &std::cout) { + console_type = STD_OUTPUT_HANDLE; + } + else if (&os == &std::cerr) { + console_type = STD_ERROR_HANDLE; + } + else { + return; + } + HANDLE hConsole = GetStdHandle(console_type); + + if(hConsole == INVALID_HANDLE_VALUE || hConsole == NULL ) + return; + + if(attributes != NULL) { + SetConsoleTextAttribute(hConsole, *attributes); + return; + } + + CONSOLE_SCREEN_BUFFER_INFO consoleInfo; + GetConsoleScreenBufferInfo(hConsole, &consoleInfo); + //if(!has_written_console_ext) { + saved_attributes = consoleInfo.wAttributes; + //} + + WORD fg_attr = 0; + switch(m_fg) + { + case term_color::WHITE: + fg_attr = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; + break; + case term_color::BLACK: + fg_attr = 0; + break; + case term_color::RED: + fg_attr = FOREGROUND_RED; + break; + case term_color::GREEN: + fg_attr = FOREGROUND_GREEN; + break; + case term_color::CYAN: + fg_attr = FOREGROUND_GREEN | FOREGROUND_BLUE; + break; + case term_color::MAGENTA: + fg_attr = FOREGROUND_RED | FOREGROUND_BLUE; + break; + case term_color::BLUE: + fg_attr = FOREGROUND_BLUE; + break; + case term_color::YELLOW: + fg_attr = FOREGROUND_RED | FOREGROUND_GREEN; + break; + case term_color::ORIGINAL: + default: + fg_attr = saved_attributes & (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); + break; + } + + WORD bg_attr = 0; + switch(m_bg) + { + case term_color::BLACK: + bg_attr = 0; + break; + case term_color::WHITE: + bg_attr = BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE; + break; + case term_color::RED: + bg_attr = BACKGROUND_RED; + break; + case term_color::GREEN: + bg_attr = BACKGROUND_GREEN; + break; + case term_color::BLUE: + bg_attr = BACKGROUND_BLUE; + break; + case term_color::ORIGINAL: + default: + bg_attr = saved_attributes & (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE); + break; + } + + WORD text_attr = 0; + switch(m_attr) + { + case term_attr::BRIGHT: + text_attr = FOREGROUND_INTENSITY; + break; + case term_attr::UNDERLINE: + text_attr = COMMON_LVB_UNDERSCORE; + break; + default: + break; + } + + SetConsoleTextAttribute(hConsole, fg_attr | bg_attr | text_attr); + + //has_written_console_ext = true; + return; + } + +public: + // Constructor + explicit setcolor( + term_attr::_ attr = term_attr::NORMAL, + term_color::_ fg = term_color::ORIGINAL, + term_color::_ bg = term_color::ORIGINAL ) + : /*has_written_console_ext(false) + , */m_attr(attr) + , m_fg(fg) + , m_bg(bg) + {} + + friend std::ostream& + operator<<( std::ostream& os, setcolor const& sc ) + { + sc.set_console_color(os); + return os; + } + +private: + term_attr::_ m_attr; + term_color::_ m_fg; + term_color::_ m_bg; + +protected: + // Data members + mutable WORD saved_attributes; + //mutable bool has_written_console_ext; +}; + +#endif +// ************************************************************************** // +// ************** scope_setcolor ************** // +// ************************************************************************** // + +#ifndef _WIN32 + +struct scope_setcolor { + scope_setcolor() : m_os( 0 ) {} + explicit scope_setcolor( std::ostream& os, + term_attr::_ attr = term_attr::NORMAL, + term_color::_ fg = term_color::ORIGINAL, + term_color::_ bg = term_color::ORIGINAL ) + : m_os( &os ) + { + os << setcolor( attr, fg, bg ); + } + ~scope_setcolor() + { + if( m_os ) + *m_os << setcolor(); + } +private: + scope_setcolor(const scope_setcolor& r); + scope_setcolor& operator=(const scope_setcolor& r); + // Data members + std::ostream* m_os; +}; + +#else + +struct scope_setcolor : setcolor { + scope_setcolor() : m_os( 0 ) {} + explicit scope_setcolor( + std::ostream& os, + term_attr::_ attr = term_attr::NORMAL, + term_color::_ fg = term_color::ORIGINAL, + term_color::_ bg = term_color::ORIGINAL ) + : + setcolor(attr, fg, bg), + m_os( &os ) + { + os << *this; + } + + ~scope_setcolor() + { + if (m_os) { + set_console_color(*m_os, &this->saved_attributes); + } + } +private: + scope_setcolor(const scope_setcolor& r); + scope_setcolor& operator=(const scope_setcolor& r); + // Data members + std::ostream* m_os; +}; + + +#endif + +#define BOOST_TEST_SCOPE_SETCOLOR( is_color_output, os, attr, color ) \ + utils::scope_setcolor const sc( \ + os, \ + is_color_output ? utils::attr : utils::term_attr::NORMAL, \ + is_color_output ? utils::color : utils::term_color::ORIGINAL);\ + ut_detail::ignore_unused_variable_warning( sc ) \ +/**/ + +} // namespace utils +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_SETCOLOR_HPP diff --git a/libraries/boost/include/boost/test/utils/string_cast.hpp b/libraries/boost/include/boost/test/utils/string_cast.hpp new file mode 100644 index 0000000000..3c069a8403 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/string_cast.hpp @@ -0,0 +1,69 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : trivial utility to cast to/from strings +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_STRING_CAST_HPP +#define BOOST_TEST_UTILS_STRING_CAST_HPP + +// Boost.Test +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace utils { + +// ************************************************************************** // +// ************** string_cast ************** // +// ************************************************************************** // + +template +inline std::string +string_cast( T const& t ) +{ + std::ostringstream buff; + buff << t; + return buff.str(); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** string_as ************** // +// ************************************************************************** // + +template +inline bool +string_as( const_string str, T& res ) +{ + std::istringstream buff( std::string( str.begin(), str.end() ) ); + buff >> res; + + return !buff.fail() && buff.eof(); +} + +//____________________________________________________________________________// + +} // namespace utils +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_STRING_CAST_HPP diff --git a/libraries/boost/include/boost/test/utils/trivial_singleton.hpp b/libraries/boost/include/boost/test/utils/trivial_singleton.hpp new file mode 100644 index 0000000000..ac612b6393 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/trivial_singleton.hpp @@ -0,0 +1,79 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : simple helpers for creating cusom output manipulators +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP +#define BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP + +// Boost.Test +#include +#include + +// Boost +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** singleton ************** // +// ************************************************************************** // + +template +class singleton { +public: + static Derived& instance() { static Derived the_inst; return the_inst; } + + BOOST_DELETED_FUNCTION(singleton(singleton const&)) + BOOST_DELETED_FUNCTION(singleton& operator=(singleton const&)) + +protected: + BOOST_DEFAULTED_FUNCTION(singleton(), {}) + BOOST_DEFAULTED_FUNCTION(~singleton(), {}) +}; + +//____________________________________________________________________________// + +#define BOOST_TEST_SINGLETON_CONS( type ) \ +friend class boost::unit_test::singleton; \ +type() {} \ +/**/ + +#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) + +#define BOOST_TEST_SINGLETON_INST( inst ) \ +template class unit_test::singleton< BOOST_JOIN( inst, _t ) > ; \ +namespace { BOOST_JOIN( inst, _t)& inst = BOOST_JOIN( inst, _t)::instance(); } + +#elif defined(__APPLE_CC__) && defined(__GNUC__) && __GNUC__ < 4 +#define BOOST_TEST_SINGLETON_INST( inst ) \ +static BOOST_JOIN( inst, _t)& inst = BOOST_JOIN (inst, _t)::instance(); + +#else + +#define BOOST_TEST_SINGLETON_INST( inst ) \ +namespace { BOOST_JOIN( inst, _t)& inst = BOOST_JOIN( inst, _t)::instance(); } + +#endif + +//____________________________________________________________________________// + +} // namespace unit_test +} // namespace boost + + +#include + +#endif // BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP diff --git a/libraries/boost/include/boost/test/utils/wrap_stringstream.hpp b/libraries/boost/include/boost/test/utils/wrap_stringstream.hpp new file mode 100644 index 0000000000..425d7ed75b --- /dev/null +++ b/libraries/boost/include/boost/test/utils/wrap_stringstream.hpp @@ -0,0 +1,162 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : wraps strstream and stringstream (depends with one is present) +// to provide the unified interface +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP +#define BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP + +// Boost.Test +#include + +// STL +#ifdef BOOST_NO_STRINGSTREAM +#include // for std::ostrstream +#else +#include // for std::ostringstream +#endif // BOOST_NO_STRINGSTREAM + +#include + +//____________________________________________________________________________// + +namespace boost { + +// ************************************************************************** // +// ************** basic_wrap_stringstream ************** // +// ************************************************************************** // + +template +class basic_wrap_stringstream { +public: +#if defined(BOOST_CLASSIC_IOSTREAMS) + typedef std::ostringstream wrapped_stream; +#elif defined(BOOST_NO_STRINGSTREAM) + typedef std::basic_ostrstream wrapped_stream; +#else + typedef std::basic_ostringstream wrapped_stream; +#endif // BOOST_NO_STRINGSTREAM + // Access methods + basic_wrap_stringstream& ref(); + wrapped_stream& stream(); + std::basic_string const& str(); + +private: + // Data members + wrapped_stream m_stream; + std::basic_string m_str; +}; + +//____________________________________________________________________________// + +template +inline basic_wrap_stringstream& +operator<<( basic_wrap_stringstream& targ, T const& t ) +{ + targ.stream() << t; + return targ; +} + +//____________________________________________________________________________// + +template +inline typename basic_wrap_stringstream::wrapped_stream& +basic_wrap_stringstream::stream() +{ + return m_stream; +} + +//____________________________________________________________________________// + +template +inline basic_wrap_stringstream& +basic_wrap_stringstream::ref() +{ + return *this; +} + +//____________________________________________________________________________// + +template +inline std::basic_string const& +basic_wrap_stringstream::str() +{ + +#ifdef BOOST_NO_STRINGSTREAM + m_str.assign( m_stream.str(), m_stream.pcount() ); + m_stream.freeze( false ); +#else + m_str = m_stream.str(); +#endif + + return m_str; +} + +//____________________________________________________________________________// + +template +inline basic_wrap_stringstream& +operator<<( basic_wrap_stringstream& targ, basic_wrap_stringstream& src ) +{ + targ << src.str(); + return targ; +} + +//____________________________________________________________________________// + +#if BOOST_TEST_USE_STD_LOCALE + +template +inline basic_wrap_stringstream& +operator<<( basic_wrap_stringstream& targ, std::ios_base& (BOOST_TEST_CALL_DECL *man)(std::ios_base&) ) +{ + targ.stream() << man; + return targ; +} + +//____________________________________________________________________________// + +template +inline basic_wrap_stringstream& +operator<<( basic_wrap_stringstream& targ, std::basic_ostream& (BOOST_TEST_CALL_DECL *man)(std::basic_ostream&) ) +{ + targ.stream() << man; + return targ; +} + +//____________________________________________________________________________// + +template +inline basic_wrap_stringstream& +operator<<( basic_wrap_stringstream& targ, std::basic_ios& (BOOST_TEST_CALL_DECL *man)(std::basic_ios&) ) +{ + targ.stream() << man; + return targ; +} + +//____________________________________________________________________________// + +#endif + +// ************************************************************************** // +// ************** wrap_stringstream ************** // +// ************************************************************************** // + +typedef basic_wrap_stringstream wrap_stringstream; +typedef basic_wrap_stringstream wrap_wstringstream; + +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP diff --git a/libraries/boost/include/boost/test/utils/xml_printer.hpp b/libraries/boost/include/boost/test/utils/xml_printer.hpp new file mode 100644 index 0000000000..ffaf8fcc05 --- /dev/null +++ b/libraries/boost/include/boost/test/utils/xml_printer.hpp @@ -0,0 +1,143 @@ +// (C) Copyright Gennadiy Rozental 2001. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : common code used by any agent serving as OF_XML printer +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_XML_PRINTER_HPP +#define BOOST_TEST_UTILS_XML_PRINTER_HPP + +// Boost.Test +#include +#include +#include +#include + +// Boost +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { +namespace utils { + +// ************************************************************************** // +// ************** xml print helpers ************** // +// ************************************************************************** // + +inline void +print_escaped( std::ostream& where_to, const_string value ) +{ +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) + static std::map const char_type{{ + {'<' , "lt"}, + {'>' , "gt"}, + {'&' , "amp"}, + {'\'', "apos"}, + {'"' , "quot"} + }}; +#else + static std::map char_type; + + if( char_type.empty() ) { + char_type['<'] = "lt"; + char_type['>'] = "gt"; + char_type['&'] = "amp"; + char_type['\'']= "apos"; + char_type['"'] = "quot"; + } +#endif + + BOOST_TEST_FOREACH( char, c, value ) { + std::map::const_iterator found_ref = char_type.find( c ); + + if( found_ref != char_type.end() ) + where_to << '&' << found_ref->second << ';'; + else + where_to << c; + } +} + +//____________________________________________________________________________// + +inline void +print_escaped( std::ostream& where_to, std::string const& value ) +{ + print_escaped( where_to, const_string( value ) ); +} + +//____________________________________________________________________________// + +template +inline void +print_escaped( std::ostream& where_to, T const& value ) +{ + where_to << value; +} + +//____________________________________________________________________________// + +inline void +print_escaped_cdata( std::ostream& where_to, const_string value ) +{ + static const_string cdata_end( "]]>" ); + + const_string::size_type pos = value.find( cdata_end ); + if( pos == const_string::npos ) + where_to << value; + else { + where_to << value.substr( 0, pos+2 ) << cdata_end + << BOOST_TEST_L( " attr_value; + +template +inline std::ostream& +operator<<( custom_printer const& p, T const& value ) +{ + *p << "=\""; + print_escaped( *p, value ); + *p << '"'; + + return *p; +} + +//____________________________________________________________________________// + +typedef custom_manip cdata; + +inline std::ostream& +operator<<( custom_printer const& p, const_string value ) +{ + *p << BOOST_TEST_L( "" ); +} + +//____________________________________________________________________________// + +} // namespace utils +} // namespace unit_test +} // namespace boost + +#include + +#endif // BOOST_TEST_UTILS_XML_PRINTER_HPP diff --git a/libraries/boost/include/boost/throw_exception.hpp b/libraries/boost/include/boost/throw_exception.hpp new file mode 100644 index 0000000000..aa977dfc79 --- /dev/null +++ b/libraries/boost/include/boost/throw_exception.hpp @@ -0,0 +1,102 @@ +#ifndef UUID_AA15E74A856F11E08B8D93F24824019B +#define UUID_AA15E74A856F11E08B8D93F24824019B +#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/throw_exception.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2008-2009 Emil Dotchevski and Reverge Studios, Inc. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// http://www.boost.org/libs/utility/throw_exception.html +// + +#include +#include +#include + +#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) ) +# define BOOST_EXCEPTION_DISABLE +#endif + +#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1310 ) +# define BOOST_EXCEPTION_DISABLE +#endif + +#if !defined( BOOST_EXCEPTION_DISABLE ) +# include +#if !defined(BOOST_THROW_EXCEPTION_CURRENT_FUNCTION) +# include +# define BOOST_THROW_EXCEPTION_CURRENT_FUNCTION BOOST_CURRENT_FUNCTION +#endif +# define BOOST_THROW_EXCEPTION(x) ::boost::exception_detail::throw_exception_(x,BOOST_THROW_EXCEPTION_CURRENT_FUNCTION,__FILE__,__LINE__) +#else +# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x) +#endif + +namespace boost +{ +#ifdef BOOST_NO_EXCEPTIONS + +void throw_exception( std::exception const & e ); // user defined + +#else + +inline void throw_exception_assert_compatibility( std::exception const & ) { } + +template BOOST_NORETURN inline void throw_exception( E const & e ) +{ + //All boost exceptions are required to derive from std::exception, + //to ensure compatibility with BOOST_NO_EXCEPTIONS. + throw_exception_assert_compatibility(e); + +#ifndef BOOST_EXCEPTION_DISABLE + throw enable_current_exception(enable_error_info(e)); +#else + throw e; +#endif +} + +#endif + +#if !defined( BOOST_EXCEPTION_DISABLE ) + namespace + exception_detail + { + template + BOOST_NORETURN + void + throw_exception_( E const & x, char const * current_function, char const * file, int line ) + { + boost::throw_exception( + set_info( + set_info( + set_info( + enable_error_info(x), + throw_function(current_function)), + throw_file(file)), + throw_line(line))); + } + } +#endif +} // namespace boost + +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/libraries/boost/include/boost/timer.hpp b/libraries/boost/include/boost/timer.hpp new file mode 100644 index 0000000000..1e3571e417 --- /dev/null +++ b/libraries/boost/include/boost/timer.hpp @@ -0,0 +1,72 @@ +// boost timer.hpp header file ---------------------------------------------// + +// Copyright Beman Dawes 1994-99. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/timer for documentation. + +// Revision History +// 01 Apr 01 Modified to use new header. (JMaddock) +// 12 Jan 01 Change to inline implementation to allow use without library +// builds. See docs for more rationale. (Beman Dawes) +// 25 Sep 99 elapsed_max() and elapsed_min() added (John Maddock) +// 16 Jul 99 Second beta +// 6 Jul 99 Initial boost version + +#ifndef BOOST_TIMER_HPP +#define BOOST_TIMER_HPP + +#include +#include +#include + +# ifdef BOOST_NO_STDC_NAMESPACE + namespace std { using ::clock_t; using ::clock; } +# endif + + +namespace boost { + +// timer -------------------------------------------------------------------// + +// A timer object measures elapsed time. + +// It is recommended that implementations measure wall clock rather than CPU +// time since the intended use is performance measurement on systems where +// total elapsed time is more important than just process or CPU time. + +// Warnings: The maximum measurable elapsed time may well be only 596.5+ hours +// due to implementation limitations. The accuracy of timings depends on the +// accuracy of timing information provided by the underlying platform, and +// this varies a great deal from platform to platform. + +class timer +{ + public: + timer() { _start_time = std::clock(); } // postcondition: elapsed()==0 +// timer( const timer& src ); // post: elapsed()==src.elapsed() +// ~timer(){} +// timer& operator=( const timer& src ); // post: elapsed()==src.elapsed() + void restart() { _start_time = std::clock(); } // post: elapsed()==0 + double elapsed() const // return elapsed time in seconds + { return double(std::clock() - _start_time) / CLOCKS_PER_SEC; } + + double elapsed_max() const // return estimated maximum value for elapsed() + // Portability warning: elapsed_max() may return too high a value on systems + // where std::clock_t overflows or resets at surprising values. + { + return (double((std::numeric_limits::max)()) + - double(_start_time)) / double(CLOCKS_PER_SEC); + } + + double elapsed_min() const // return minimum value for elapsed() + { return double(1)/double(CLOCKS_PER_SEC); } + + private: + std::clock_t _start_time; +}; // timer + +} // namespace boost + +#endif // BOOST_TIMER_HPP diff --git a/libraries/boost/include/boost/type.hpp b/libraries/boost/include/boost/type.hpp new file mode 100644 index 0000000000..ab81c916d7 --- /dev/null +++ b/libraries/boost/include/boost/type.hpp @@ -0,0 +1,18 @@ +// (C) Copyright David Abrahams 2001. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_TYPE_DWA20010120_HPP +# define BOOST_TYPE_DWA20010120_HPP + +namespace boost { + + // Just a simple "type envelope". Useful in various contexts, mostly to work + // around some MSVC deficiencies. + template + struct type {}; + +} + +#endif // BOOST_TYPE_DWA20010120_HPP diff --git a/libraries/boost/include/boost/type_index.hpp b/libraries/boost/include/boost/type_index.hpp new file mode 100644 index 0000000000..5311ac8795 --- /dev/null +++ b/libraries/boost/include/boost/type_index.hpp @@ -0,0 +1,265 @@ +// +// Copyright (c) Antony Polukhin, 2012-2018. +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_TYPE_INDEX_HPP +#define BOOST_TYPE_INDEX_HPP + +/// \file boost/type_index.hpp +/// \brief Includes minimal set of headers required to use the Boost.TypeIndex library. +/// +/// By inclusion of this file most optimal type index classes will be included and used +/// as a boost::typeindex::type_index and boost::typeindex::type_info. + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +#if defined(BOOST_TYPE_INDEX_USER_TYPEINDEX) +# include BOOST_TYPE_INDEX_USER_TYPEINDEX +# ifdef BOOST_HAS_PRAGMA_DETECT_MISMATCH +# pragma detect_mismatch( "boost__type_index__abi", "user defined type_index class is used: " BOOST_STRINGIZE(BOOST_TYPE_INDEX_USER_TYPEINDEX)) +# endif +#elif (!defined(BOOST_NO_RTTI) && !defined(BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)) || defined(BOOST_MSVC) +# include +# if defined(BOOST_NO_RTTI) || defined(BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY) +# include +# ifdef BOOST_HAS_PRAGMA_DETECT_MISMATCH +# pragma detect_mismatch( "boost__type_index__abi", "RTTI is off - typeid() is used only for templates") +# endif +# else +# ifdef BOOST_HAS_PRAGMA_DETECT_MISMATCH +# pragma detect_mismatch( "boost__type_index__abi", "RTTI is used") +# endif +# endif +#else +# include +# include +# ifdef BOOST_HAS_PRAGMA_DETECT_MISMATCH +# pragma detect_mismatch( "boost__type_index__abi", "RTTI is off - using CTTI") +# endif +#endif + +#ifndef BOOST_TYPE_INDEX_REGISTER_CLASS +#define BOOST_TYPE_INDEX_REGISTER_CLASS +#endif + +namespace boost { namespace typeindex { + +#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) + +/// \def BOOST_TYPE_INDEX_FUNCTION_SIGNATURE +/// BOOST_TYPE_INDEX_FUNCTION_SIGNATURE is used by boost::typeindex::ctti_type_index class to +/// deduce the name of a type. If your compiler is not recognized +/// by the TypeIndex library and you wish to work with boost::typeindex::ctti_type_index, you may +/// define this macro by yourself. +/// +/// BOOST_TYPE_INDEX_FUNCTION_SIGNATURE must be defined to a compiler specific macro +/// that outputs the \b whole function signature \b including \b template \b parameters. +/// +/// If your compiler is not recognised and BOOST_TYPE_INDEX_FUNCTION_SIGNATURE is not defined, +/// then a compile-time error will arise at any attempt to use boost::typeindex::ctti_type_index classes. +/// +/// See BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS and BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING +/// for an information of how to tune the implementation to make a nice pretty_name() output. +#define BOOST_TYPE_INDEX_FUNCTION_SIGNATURE BOOST_CURRENT_FUNCTION + +/// \def BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING +/// This is a helper macro for making correct pretty_names() with RTTI off. +/// +/// BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING macro may be defined to +/// '(begin_skip, end_skip, runtime_skip, runtime_skip_until)' with parameters for adding a +/// support for compilers, that by default are not recognized by TypeIndex library. +/// +/// \b Example: +/// +/// Imagine the situation when +/// \code boost::typeindex::ctti_type_index::type_id().pretty_name() \endcode +/// returns the following string: +/// \code "static const char *boost::detail::ctti::n() [T = int]" \endcode +/// and \code boost::typeindex::ctti_type_index::type_id().pretty_name() \endcode returns the following: +/// \code "static const char *boost::detail::ctti::n() [T = short]" \endcode +/// +/// As we may see first 39 characters are "static const char *boost::detail::ctti<" and they do not depend on +/// the type T. After first 39 characters we have a human readable type name which is duplicated at the end +/// of a string. String always ends on ']', which consumes 1 character. +/// +/// Now if we define `BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING` to +/// `(39, 1, false, "")` we'll be getting \code "int>::n() [T = int" \endcode +/// for `boost::typeindex::ctti_type_index::type_id().pretty_name()` and \code "short>::n() [T = short" \endcode +/// for `boost::typeindex::ctti_type_index::type_id().pretty_name()`. +/// +/// Now we need to take additional care of the characters that go before the last mention of our type. We'll +/// do that by telling the macro that we need to cut off everything that goes before the "T = " including the "T = " +/// itself: +/// +/// \code (39, 1, true, "T = ") \endcode +/// +/// In case of GCC or Clang command line we need to add the following line while compiling all the sources: +/// +/// \code +/// -DBOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING='(39, 1, true, "T = ")' +/// \endcode +/// \param begin_skip How many characters must be skipped at the beginning of the type holding string. +/// Must be a compile time constant. +/// \param end_skip How many characters must be skipped at the end of the type holding string. +/// Must be a compile time constant. +/// \param runtime_skip Do we need additional checks at runtime to cut off the more characters. +/// Must be `true` or `false`. +/// \param runtime_skip_until Skip all the characters before the following string (including the string itself). +/// Must be a compile time array of characters. +/// +/// See [RTTI emulation limitations](boost_typeindex/rtti_emulation_limitations.html) for more info. +#define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING (0, 0, false, "") + + + /// Depending on a compiler flags, optimal implementation of type_index will be used + /// as a default boost::typeindex::type_index. + /// + /// Could be a boost::typeindex::stl_type_index, boost::typeindex::ctti_type_index or + /// user defined type_index class. + /// + /// \b See boost::typeindex::type_index_facade for a full description of type_index functions. + typedef platform_specific type_index; +#elif defined(BOOST_TYPE_INDEX_USER_TYPEINDEX) + // Nothing to do +#elif (!defined(BOOST_NO_RTTI) && !defined(BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)) || defined(BOOST_MSVC) + typedef boost::typeindex::stl_type_index type_index; +#else + typedef boost::typeindex::ctti_type_index type_index; +#endif + +/// Depending on a compiler flags, optimal implementation of type_info will be used +/// as a default boost::typeindex::type_info. +/// +/// Could be a std::type_info, boost::typeindex::detail::ctti_data or +/// some user defined class. +/// +/// type_info \b is \b not copyable or default constructible. It is \b not assignable too! +typedef type_index::type_info_t type_info; + +#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) + +/// \def BOOST_TYPE_INDEX_USER_TYPEINDEX +/// BOOST_TYPE_INDEX_USER_TYPEINDEX can be defined to the path to header file +/// with user provided implementation of type_index. +/// +/// See [Making a custom type_index](boost_typeindex/making_a_custom_type_index.html) section +/// of documentation for usage example. +#define BOOST_TYPE_INDEX_USER_TYPEINDEX + + +/// \def BOOST_TYPE_INDEX_REGISTER_CLASS +/// BOOST_TYPE_INDEX_REGISTER_CLASS is used to help to emulate RTTI. +/// Put this macro into the public section of polymorphic class to allow runtime type detection. +/// +/// Depending on the typeid() availability this macro will expand to nothing or to virtual helper function +/// `virtual const type_info& boost_type_info_type_id_runtime_() const noexcept`. +/// +/// \b Example: +/// \code +/// class A { +/// public: +/// BOOST_TYPE_INDEX_REGISTER_CLASS +/// virtual ~A(){} +/// }; +/// +/// struct B: public A { +/// BOOST_TYPE_INDEX_REGISTER_CLASS +/// }; +/// +/// struct C: public B { +/// BOOST_TYPE_INDEX_REGISTER_CLASS +/// }; +/// +/// ... +/// +/// C c1; +/// A* pc1 = &c1; +/// assert(boost::typeindex::type_id() == boost::typeindex::type_id_runtime(*pc1)); +/// \endcode +#define BOOST_TYPE_INDEX_REGISTER_CLASS nothing-or-some-virtual-functions + +/// \def BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY +/// BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY is a helper macro that must be defined if mixing +/// RTTI on/off modules. See +/// [Mixing sources with RTTI on and RTTI off](boost_typeindex/mixing_sources_with_rtti_on_and_.html) +/// section of documentation for more info. +#define BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY + +#endif // defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) + + +/// Function to get boost::typeindex::type_index for a type T. +/// Removes const, volatile && and & modifiers from T. +/// +/// \b Example: +/// \code +/// type_index ti = type_id(); +/// std::cout << ti.pretty_name(); // Outputs 'int' +/// \endcode +/// +/// \tparam T Type for which type_index must be created. +/// \throw Nothing. +/// \return boost::typeindex::type_index with information about the specified type T. +template +inline type_index type_id() BOOST_NOEXCEPT { + return type_index::type_id(); +} + +/// Function for constructing boost::typeindex::type_index instance for type T. +/// Does not remove const, volatile, & and && modifiers from T. +/// +/// If T has no const, volatile, & and && modifiers, then returns exactly +/// the same result as in case of calling `type_id()`. +/// +/// \b Example: +/// \code +/// type_index ti = type_id_with_cvr(); +/// std::cout << ti.pretty_name(); // Outputs 'int&' +/// \endcode +/// +/// \tparam T Type for which type_index must be created. +/// \throw Nothing. +/// \return boost::typeindex::type_index with information about the specified type T. +template +inline type_index type_id_with_cvr() BOOST_NOEXCEPT { + return type_index::type_id_with_cvr(); +} + +/// Function that works exactly like C++ typeid(rtti_val) call, but returns boost::type_index. +/// +/// Returns runtime information about specified type. +/// +/// \b Requirements: RTTI available or Base and Derived classes must be marked with BOOST_TYPE_INDEX_REGISTER_CLASS. +/// +/// \b Example: +/// \code +/// struct Base { virtual ~Base(){} }; +/// struct Derived: public Base {}; +/// ... +/// Derived d; +/// Base& b = d; +/// type_index ti = type_id_runtime(b); +/// std::cout << ti.pretty_name(); // Outputs 'Derived' +/// \endcode +/// +/// \param runtime_val Variable which runtime type must be returned. +/// \throw Nothing. +/// \return boost::typeindex::type_index with information about the specified variable. +template +inline type_index type_id_runtime(const T& runtime_val) BOOST_NOEXCEPT { + return type_index::type_id_runtime(runtime_val); +} + +}} // namespace boost::typeindex + + + +#endif // BOOST_TYPE_INDEX_HPP + diff --git a/libraries/boost/include/boost/type_index/ctti_type_index.hpp b/libraries/boost/include/boost/type_index/ctti_type_index.hpp new file mode 100644 index 0000000000..a59b2d80a7 --- /dev/null +++ b/libraries/boost/include/boost/type_index/ctti_type_index.hpp @@ -0,0 +1,213 @@ +// +// Copyright (c) Antony Polukhin, 2013-2018. +// +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_TYPE_INDEX_CTTI_TYPE_INDEX_HPP +#define BOOST_TYPE_INDEX_CTTI_TYPE_INDEX_HPP + +/// \file ctti_type_index.hpp +/// \brief Contains boost::typeindex::ctti_type_index class that is constexpr if C++14 constexpr is supported by compiler. +/// +/// boost::typeindex::ctti_type_index class can be used as a drop-in replacement +/// for std::type_index. +/// +/// It is used in situations when typeid() method is not available or +/// BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY macro is defined. + +#include +#include + +#include +#include +#include +#include +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +namespace boost { namespace typeindex { + +namespace detail { + +// That's the most trickiest part of the TypeIndex library: +// 1) we do not want to give user ability to manually construct and compare `struct-that-represents-type` +// 2) we need to distinguish between `struct-that-represents-type` and `const char*` +// 3) we need a thread-safe way to have references to instances `struct-that-represents-type` +// 4) we need a compile-time control to make sure that user does not copy or +// default construct `struct-that-represents-type` +// +// Solution would be the following: + +/// \class ctti_data +/// Standard-layout class with private constructors and assignment operators. +/// +/// You can not work with this class directly. The purpose of this class is to hold type info +/// \b when \b RTTI \b is \b off and allow ctti_type_index construction from itself. +/// +/// \b Example: +/// \code +/// const detail::ctti_data& foo(); +/// ... +/// type_index ti = type_index(foo()); +/// std::cout << ti.pretty_name(); +/// \endcode +class ctti_data { +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +public: + ctti_data() = delete; + ctti_data(const ctti_data&) = delete; + ctti_data& operator=(const ctti_data&) = delete; +#else +private: + ctti_data(); + ctti_data(const ctti_data&); + ctti_data& operator=(const ctti_data&); +#endif +}; + +} // namespace detail + +/// Helper method for getting detail::ctti_data of a template parameter T. +template +inline const detail::ctti_data& ctti_construct() BOOST_NOEXCEPT { + // Standard C++11, 5.2.10 Reinterpret cast: + // An object pointer can be explicitly converted to an object pointer of a different type. When a prvalue + // v of type "pointer to T1" is converted to the type "pointer to cv T2", the result is static_cast(static_cast(v)) if both T1 and T2 are standard-layout types (3.9) and the alignment + // requirements of T2 are no stricter than those of T1, or if either type is void. Converting a prvalue of type + // "pointer to T1" to the type "pointer to T2" (where T1 and T2 are object types and where the alignment + // requirements of T2 are no stricter than those of T1) and back to its original type yields the original pointer + // value. + // + // Alignments are checked in `type_index_test_ctti_alignment.cpp` test. + return *reinterpret_cast(boost::detail::ctti::n()); +} + +/// \class ctti_type_index +/// This class is a wrapper that pretends to work exactly like stl_type_index, but does +/// not require RTTI support. \b For \b description \b of \b functions \b see type_index_facade. +/// +/// This class on C++14 compatible compilers has following functions marked as constexpr: +/// * default constructor +/// * copy constructors and assignemnt operations +/// * class methods: name(), before(const ctti_type_index& rhs), equal(const ctti_type_index& rhs) +/// * static methods type_id(), type_id_with_cvr() +/// * comparison operators +/// +/// This class produces slightly longer type names, so consider using stl_type_index +/// in situations when typeid() is working. +class ctti_type_index: public type_index_facade { + const char* data_; + + inline std::size_t get_raw_name_length() const BOOST_NOEXCEPT; + + BOOST_CXX14_CONSTEXPR inline explicit ctti_type_index(const char* data) BOOST_NOEXCEPT + : data_(data) + {} + +public: + typedef detail::ctti_data type_info_t; + + BOOST_CXX14_CONSTEXPR inline ctti_type_index() BOOST_NOEXCEPT + : data_(boost::detail::ctti::n()) + {} + + inline ctti_type_index(const type_info_t& data) BOOST_NOEXCEPT + : data_(reinterpret_cast(&data)) + {} + + inline const type_info_t& type_info() const BOOST_NOEXCEPT; + BOOST_CXX14_CONSTEXPR inline const char* raw_name() const BOOST_NOEXCEPT; + BOOST_CXX14_CONSTEXPR inline const char* name() const BOOST_NOEXCEPT; + inline std::string pretty_name() const; + inline std::size_t hash_code() const BOOST_NOEXCEPT; + + BOOST_CXX14_CONSTEXPR inline bool equal(const ctti_type_index& rhs) const BOOST_NOEXCEPT; + BOOST_CXX14_CONSTEXPR inline bool before(const ctti_type_index& rhs) const BOOST_NOEXCEPT; + + template + BOOST_CXX14_CONSTEXPR inline static ctti_type_index type_id() BOOST_NOEXCEPT; + + template + BOOST_CXX14_CONSTEXPR inline static ctti_type_index type_id_with_cvr() BOOST_NOEXCEPT; + + template + inline static ctti_type_index type_id_runtime(const T& variable) BOOST_NOEXCEPT; +}; + + +inline const ctti_type_index::type_info_t& ctti_type_index::type_info() const BOOST_NOEXCEPT { + return *reinterpret_cast(data_); +} + + +BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::equal(const ctti_type_index& rhs) const BOOST_NOEXCEPT { + const char* const left = raw_name(); + const char* const right = rhs.raw_name(); + return /*left == right ||*/ !boost::typeindex::detail::constexpr_strcmp(left, right); +} + +BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::before(const ctti_type_index& rhs) const BOOST_NOEXCEPT { + const char* const left = raw_name(); + const char* const right = rhs.raw_name(); + return /*left != right &&*/ boost::typeindex::detail::constexpr_strcmp(left, right) < 0; +} + + +template +BOOST_CXX14_CONSTEXPR inline ctti_type_index ctti_type_index::type_id() BOOST_NOEXCEPT { + typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type no_ref_t; + typedef BOOST_DEDUCED_TYPENAME boost::remove_cv::type no_cvr_t; + return ctti_type_index(boost::detail::ctti::n()); +} + + + +template +BOOST_CXX14_CONSTEXPR inline ctti_type_index ctti_type_index::type_id_with_cvr() BOOST_NOEXCEPT { + return ctti_type_index(boost::detail::ctti::n()); +} + + +template +inline ctti_type_index ctti_type_index::type_id_runtime(const T& variable) BOOST_NOEXCEPT { + return variable.boost_type_index_type_id_runtime_(); +} + + +BOOST_CXX14_CONSTEXPR inline const char* ctti_type_index::raw_name() const BOOST_NOEXCEPT { + return data_; +} + + +BOOST_CXX14_CONSTEXPR inline const char* ctti_type_index::name() const BOOST_NOEXCEPT { + return data_; +} + +inline std::size_t ctti_type_index::get_raw_name_length() const BOOST_NOEXCEPT { + return std::strlen(raw_name() + detail::ctti_skip_size_at_end); +} + + +inline std::string ctti_type_index::pretty_name() const { + std::size_t len = get_raw_name_length(); + while (raw_name()[len - 1] == ' ') --len; // MSVC sometimes adds whitespaces + return std::string(raw_name(), len); +} + + +inline std::size_t ctti_type_index::hash_code() const BOOST_NOEXCEPT { + return boost::hash_range(raw_name(), raw_name() + get_raw_name_length()); +} + + +}} // namespace boost::typeindex + +#endif // BOOST_TYPE_INDEX_CTTI_TYPE_INDEX_HPP + diff --git a/libraries/boost/include/boost/type_index/detail/compile_time_type_info.hpp b/libraries/boost/include/boost/type_index/detail/compile_time_type_info.hpp new file mode 100644 index 0000000000..4eb2017ffc --- /dev/null +++ b/libraries/boost/include/boost/type_index/detail/compile_time_type_info.hpp @@ -0,0 +1,291 @@ +// +// Copyright (c) Antony Polukhin, 2012-2016. +// +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_TYPE_INDEX_DETAIL_COMPILE_TIME_TYPE_INFO_HPP +#define BOOST_TYPE_INDEX_DETAIL_COMPILE_TIME_TYPE_INFO_HPP + +/// \file compile_time_type_info.hpp +/// \brief Contains helper macros and implementation details of boost::typeindex::ctti_type_index. +/// Not intended for inclusion from user's code. + +#include +#include +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +/// @cond +#define BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(begin_skip, end_skip, runtime_skip, runtime_skip_until) \ + namespace boost { namespace typeindex { namespace detail { \ + BOOST_STATIC_CONSTEXPR std::size_t ctti_skip_size_at_begin = begin_skip; \ + BOOST_STATIC_CONSTEXPR std::size_t ctti_skip_size_at_end = end_skip; \ + BOOST_STATIC_CONSTEXPR bool ctti_skip_more_at_runtime = runtime_skip; \ + BOOST_STATIC_CONSTEXPR char ctti_skip_until_runtime[] = runtime_skip_until; \ + }}} /* namespace boost::typeindex::detail */ \ + /**/ +/// @endcond + + +#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) + /* Nothing to document. All the macro docs are moved to */ +#elif defined(BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING) +# include + BOOST_PP_EXPAND( BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING ) +#elif defined(_MSC_VER) && defined (BOOST_NO_CXX11_NOEXCEPT) + // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void)") - 1 + BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 10, false, "") +#elif defined(_MSC_VER) && !defined (BOOST_NO_CXX11_NOEXCEPT) + // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void) noexcept") - 1 + BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 19, false, "") +#elif defined(__clang__) && defined(__APPLE__) + // Someone made __clang_major__ equal to LLVM version rather than compiler version + // on APPLE platform. + // + // Using less efficient solution because there is no good way to detect real version of Clang. + // sizeof("static const char *boost::detail::ctti<") - 1, sizeof("]") - 1, true, "???????????>::n() [T = int" + BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 1, true, "T = ") +#elif defined(__clang__) && (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ == 0)) + // sizeof("static const char *boost::detail::ctti<") - 1, sizeof(">::n()") - 1 + // note: checked on 3.0 + BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 6, false, "") +#elif defined(__clang__) && (__clang_major__ >= 4 || (__clang_major__ == 3 && __clang_minor__ > 0)) + // sizeof("static const char *boost::detail::ctti<") - 1, sizeof("]") - 1, true, "int>::n() [T = int" + // note: checked on 3.1, 3.4 + BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 1, true, "T = ") +#elif defined(__GNUC__) && (__GNUC__ < 7) && !defined(BOOST_NO_CXX14_CONSTEXPR) + // sizeof("static constexpr char boost::detail::ctti::s() [with unsigned int I = 0u; T = ") - 1, sizeof("]") - 1 + BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(81, 1, false, "") +#elif defined(__GNUC__) && (__GNUC__ >= 7) && !defined(BOOST_NO_CXX14_CONSTEXPR) + // sizeof("static constexpr char boost::detail::ctti::s() [with unsigned int I = 0; T = ") - 1, sizeof("]") - 1 + BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(80, 1, false, "") +#elif defined(__GNUC__) && defined(BOOST_NO_CXX14_CONSTEXPR) + // sizeof("static const char* boost::detail::ctti::n() [with T = ") - 1, sizeof("]") - 1 + BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(57, 1, false, "") +#else + // Deafult code for other platforms... Just skip nothing! + BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(0, 0, false, "") +#endif + +#undef BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS + +namespace boost { namespace typeindex { namespace detail { + template + BOOST_CXX14_CONSTEXPR inline void assert_compile_time_legths() BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT_MSG( + Condition, + "TypeIndex library is misconfigured for your compiler. " + "Please define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING to correct values. See section " + "'RTTI emulation limitations' of the documentation for more information." + ); + } + + template + BOOST_CXX14_CONSTEXPR inline void failed_to_get_function_name() BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT_MSG( + sizeof(T) && false, + "TypeIndex library could not detect your compiler. " + "Please make the BOOST_TYPE_INDEX_FUNCTION_SIGNATURE macro use " + "correct compiler macro for getting the whole function name. " + "Define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING to correct value after that." + ); + } + + template + BOOST_CXX14_CONSTEXPR inline const char* skip_begining_runtime(const char* begin, boost::mpl::false_) BOOST_NOEXCEPT { + return begin; + } + + template + BOOST_CXX14_CONSTEXPR inline ForwardIterator1 constexpr_search( + ForwardIterator1 first1, + ForwardIterator1 last1, + ForwardIterator2 first2, + ForwardIterator2 last2) BOOST_NOEXCEPT + { + if (first2 == last2) { + return first1; // specified in C++11 + } + + while (first1 != last1) { + ForwardIterator1 it1 = first1; + ForwardIterator2 it2 = first2; + + while (*it1 == *it2) { + ++it1; + ++it2; + if (it2 == last2) return first1; + if (it1 == last1) return last1; + } + + ++first1; + } + + return last1; + } + + BOOST_CXX14_CONSTEXPR inline int constexpr_strcmp(const char *v1, const char *v2) BOOST_NOEXCEPT { + while (*v1 != '\0' && *v1 == *v2) { + ++v1; + ++v2; + }; + + return static_cast(*v1) - *v2; + } + + template + BOOST_CXX14_CONSTEXPR inline const char* skip_begining_runtime(const char* begin, boost::mpl::true_) BOOST_NOEXCEPT { + const char* const it = constexpr_search( + begin, begin + ArrayLength, + ctti_skip_until_runtime, ctti_skip_until_runtime + sizeof(ctti_skip_until_runtime) - 1 + ); + return (it == begin + ArrayLength ? begin : it + sizeof(ctti_skip_until_runtime) - 1); + } + + template + BOOST_CXX14_CONSTEXPR inline const char* skip_begining(const char* begin) BOOST_NOEXCEPT { + assert_compile_time_legths<(ArrayLength > ctti_skip_size_at_begin + ctti_skip_size_at_end)>(); + return skip_begining_runtime( + begin + ctti_skip_size_at_begin, + boost::mpl::bool_() + ); + } + +#if !defined(__clang__) && defined(__GNUC__) && !defined(BOOST_NO_CXX14_CONSTEXPR) + template + struct index_seq {}; + + template + struct make_index_sequence_join; + + template + struct make_index_sequence_join, index_seq > { + typedef index_seq type; + }; + + template + struct make_index_seq_impl { + typedef typename make_index_sequence_join< + typename make_index_seq_impl::type, + typename make_index_seq_impl::type + >::type type; + }; + + template + struct make_index_seq_impl { + typedef index_seq<> type; + }; + + template + struct make_index_seq_impl { + typedef index_seq type; + }; + + template + struct cstring { + static constexpr unsigned int size_ = sizeof...(C); + static constexpr char data_[size_] = { C... }; + }; + + template + constexpr char cstring::data_[]; +#endif + +}}} // namespace boost::typeindex::detail + +namespace boost { namespace detail { + +/// Noncopyable type_info that does not require RTTI. +/// CTTI == Compile Time Type Info. +/// This name must be as short as possible, to avoid code bloat +template +struct ctti { + +#if !defined(__clang__) && defined(__GNUC__) && !defined(BOOST_NO_CXX14_CONSTEXPR) + //helper functions + template + constexpr static char s() BOOST_NOEXCEPT { // step + constexpr unsigned int offset = + (I >= 10u ? 1u : 0u) + + (I >= 100u ? 1u : 0u) + + (I >= 1000u ? 1u : 0u) + + (I >= 10000u ? 1u : 0u) + + (I >= 100000u ? 1u : 0u) + + (I >= 1000000u ? 1u : 0u) + ; + + #if defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) + return BOOST_TYPE_INDEX_FUNCTION_SIGNATURE[I + offset]; + #elif defined(__FUNCSIG__) + return __FUNCSIG__[I + offset]; + #else + return __PRETTY_FUNCTION__[I + offset]; + #endif + } + + template + constexpr static const char* impl(::boost::typeindex::detail::index_seq ) BOOST_NOEXCEPT { + return ::boost::typeindex::detail::cstring()...>::data_; + } + + template // `D` means `Dummy` + constexpr static const char* n() BOOST_NOEXCEPT { + #if defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) + constexpr unsigned int size = sizeof(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE); + #elif defined(__FUNCSIG__) + constexpr unsigned int size = sizeof(__FUNCSIG__); + #elif defined(__PRETTY_FUNCTION__) \ + || defined(__GNUC__) \ + || (defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)) \ + || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) \ + || (defined(__ICC) && (__ICC >= 600)) \ + || defined(__ghs__) \ + || defined(__DMC__) + constexpr unsigned int size = sizeof(__PRETTY_FUNCTION__); + #else + boost::typeindex::detail::failed_to_get_function_name(); + #endif + + boost::typeindex::detail::assert_compile_time_legths< + (size > boost::typeindex::detail::ctti_skip_size_at_begin + boost::typeindex::detail::ctti_skip_size_at_end + sizeof("const *") - 1) + >(); + static_assert(!boost::typeindex::detail::ctti_skip_more_at_runtime, "Skipping for GCC in C++14 mode is unsupported"); + + typedef typename boost::typeindex::detail::make_index_seq_impl< + boost::typeindex::detail::ctti_skip_size_at_begin, + size - sizeof("const *") + 1 - boost::typeindex::detail::ctti_skip_size_at_begin + >::type idx_seq; + return impl(idx_seq()); + } +#else + /// Returns raw name. Must be as short, as possible, to avoid code bloat + BOOST_CXX14_CONSTEXPR static const char* n() BOOST_NOEXCEPT { + #if defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) + return boost::typeindex::detail::skip_begining< sizeof(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) >(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE); + #elif defined(__FUNCSIG__) + return boost::typeindex::detail::skip_begining< sizeof(__FUNCSIG__) >(__FUNCSIG__); + #elif defined(__PRETTY_FUNCTION__) \ + || defined(__GNUC__) \ + || (defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)) \ + || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) \ + || (defined(__ICC) && (__ICC >= 600)) \ + || defined(__ghs__) \ + || defined(__DMC__) + return boost::typeindex::detail::skip_begining< sizeof(__PRETTY_FUNCTION__) >(__PRETTY_FUNCTION__); + #else + boost::typeindex::detail::failed_to_get_function_name(); + return ""; + #endif + } +#endif +}; + +}} // namespace boost::detail + +#endif // BOOST_TYPE_INDEX_DETAIL_COMPILE_TIME_TYPE_INFO_HPP diff --git a/libraries/boost/include/boost/type_index/detail/ctti_register_class.hpp b/libraries/boost/include/boost/type_index/detail/ctti_register_class.hpp new file mode 100644 index 0000000000..a8cef2c497 --- /dev/null +++ b/libraries/boost/include/boost/type_index/detail/ctti_register_class.hpp @@ -0,0 +1,40 @@ +// +// Copyright (c) Antony Polukhin, 2013-2014. +// +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_TYPE_INDEX_CTTI_REGISTER_CLASS_HPP +#define BOOST_TYPE_INDEX_CTTI_REGISTER_CLASS_HPP + +/// \file ctti_register_class.hpp +/// \brief Contains BOOST_TYPE_INDEX_REGISTER_CLASS macro implementation that uses boost::typeindex::ctti_type_index. +/// Not intended for inclusion from user's code. + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +namespace boost { namespace typeindex { namespace detail { + +template +inline const ctti_data& ctti_construct_typeid_ref(const T*) BOOST_NOEXCEPT { + return ctti_construct(); +} + +}}} // namespace boost::typeindex::detail + +/// @cond +#define BOOST_TYPE_INDEX_REGISTER_CLASS \ + virtual const boost::typeindex::detail::ctti_data& boost_type_index_type_id_runtime_() const BOOST_NOEXCEPT { \ + return boost::typeindex::detail::ctti_construct_typeid_ref(this); \ + } \ +/**/ +/// @endcond + +#endif // BOOST_TYPE_INDEX_CTTI_REGISTER_CLASS_HPP + diff --git a/libraries/boost/include/boost/type_index/detail/stl_register_class.hpp b/libraries/boost/include/boost/type_index/detail/stl_register_class.hpp new file mode 100644 index 0000000000..95a26f7b0e --- /dev/null +++ b/libraries/boost/include/boost/type_index/detail/stl_register_class.hpp @@ -0,0 +1,40 @@ +// +// Copyright (c) Antony Polukhin, 2013-2014. +// +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP +#define BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP + +/// \file stl_register_class.hpp +/// \brief Contains BOOST_TYPE_INDEX_REGISTER_CLASS macro implementation that uses boost::typeindex::stl_type_index. +/// Not intended for inclusion from user's code. + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +namespace boost { namespace typeindex { namespace detail { + +template +inline const stl_type_index::type_info_t& stl_construct_typeid_ref(const T*) BOOST_NOEXCEPT { + return typeid(T); +} + +}}} // namespace boost::typeindex::detail + +/// @cond +#define BOOST_TYPE_INDEX_REGISTER_CLASS \ + virtual const boost::typeindex::stl_type_index::type_info_t& boost_type_index_type_id_runtime_() const BOOST_NOEXCEPT { \ + return boost::typeindex::detail::stl_construct_typeid_ref(this); \ + } \ +/**/ +/// @endcond + +#endif // BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP + diff --git a/libraries/boost/include/boost/type_index/stl_type_index.hpp b/libraries/boost/include/boost/type_index/stl_type_index.hpp new file mode 100644 index 0000000000..3a9834d685 --- /dev/null +++ b/libraries/boost/include/boost/type_index/stl_type_index.hpp @@ -0,0 +1,276 @@ +// +// Copyright (c) Antony Polukhin, 2013-2018. +// +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_TYPE_INDEX_STL_TYPE_INDEX_HPP +#define BOOST_TYPE_INDEX_STL_TYPE_INDEX_HPP + +/// \file stl_type_index.hpp +/// \brief Contains boost::typeindex::stl_type_index class. +/// +/// boost::typeindex::stl_type_index class can be used as a drop-in replacement +/// for std::type_index. +/// +/// It is used in situations when RTTI is enabled or typeid() method is available. +/// When typeid() is disabled or BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY macro +/// is defined boost::typeindex::ctti is usually used instead of boost::typeindex::stl_type_index. + +#include + +// MSVC is capable of calling typeid(T) even when RTTI is off +#if defined(BOOST_NO_RTTI) && !defined(BOOST_MSVC) +#error "File boost/type_index/stl_type_index.ipp is not usable when typeid() is not available." +#endif + +#include +#include // std::strcmp, std::strlen, std::strstr +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \ + || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744) +# include +# include +# include +#endif + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +namespace boost { namespace typeindex { + +/// \class stl_type_index +/// This class is a wrapper around std::type_info, that workarounds issues and provides +/// much more rich interface. \b For \b description \b of \b functions \b see type_index_facade. +/// +/// This class requires typeid() to work. For cases when RTTI is disabled see ctti_type_index. +class stl_type_index + : public type_index_facade< + stl_type_index, + #ifdef BOOST_NO_STD_TYPEINFO + type_info + #else + std::type_info + #endif + > +{ +public: +#ifdef BOOST_NO_STD_TYPEINFO + typedef type_info type_info_t; +#else + typedef std::type_info type_info_t; +#endif + +private: + const type_info_t* data_; + +public: + inline stl_type_index() BOOST_NOEXCEPT + : data_(&typeid(void)) + {} + + inline stl_type_index(const type_info_t& data) BOOST_NOEXCEPT + : data_(&data) + {} + + inline const type_info_t& type_info() const BOOST_NOEXCEPT; + + inline const char* raw_name() const BOOST_NOEXCEPT; + inline const char* name() const BOOST_NOEXCEPT; + inline std::string pretty_name() const; + + inline std::size_t hash_code() const BOOST_NOEXCEPT; + inline bool equal(const stl_type_index& rhs) const BOOST_NOEXCEPT; + inline bool before(const stl_type_index& rhs) const BOOST_NOEXCEPT; + + template + inline static stl_type_index type_id() BOOST_NOEXCEPT; + + template + inline static stl_type_index type_id_with_cvr() BOOST_NOEXCEPT; + + template + inline static stl_type_index type_id_runtime(const T& value) BOOST_NOEXCEPT; +}; + +inline const stl_type_index::type_info_t& stl_type_index::type_info() const BOOST_NOEXCEPT { + return *data_; +} + + +inline const char* stl_type_index::raw_name() const BOOST_NOEXCEPT { +#ifdef _MSC_VER + return data_->raw_name(); +#else + return data_->name(); +#endif +} + +inline const char* stl_type_index::name() const BOOST_NOEXCEPT { + return data_->name(); +} + +inline std::string stl_type_index::pretty_name() const { + static const char cvr_saver_name[] = "boost::typeindex::detail::cvr_saver<"; + static BOOST_CONSTEXPR_OR_CONST std::string::size_type cvr_saver_name_len = sizeof(cvr_saver_name) - 1; + + // In case of MSVC demangle() is a no-op, and name() already returns demangled name. + // In case of GCC and Clang (on non-Windows systems) name() returns mangled name and demangle() undecorates it. + const boost::core::scoped_demangled_name demangled_name(data_->name()); + + const char* begin = demangled_name.get(); + if (!begin) { + boost::throw_exception(std::runtime_error("Type name demangling failed")); + } + + const std::string::size_type len = std::strlen(begin); + const char* end = begin + len; + + if (len > cvr_saver_name_len) { + const char* b = std::strstr(begin, cvr_saver_name); + if (b) { + b += cvr_saver_name_len; + + // Trim leading spaces + while (*b == ' ') { // the string is zero terminated, we won't exceed the buffer size + ++ b; + } + + // Skip the closing angle bracket + const char* e = end - 1; + while (e > b && *e != '>') { + -- e; + } + + // Trim trailing spaces + while (e > b && *(e - 1) == ' ') { + -- e; + } + + if (b < e) { + // Parsing seems to have succeeded, the type name is not empty + begin = b; + end = e; + } + } + } + + return std::string(begin, end); +} + + +inline std::size_t stl_type_index::hash_code() const BOOST_NOEXCEPT { +#if (defined(_MSC_VER) && _MSC_VER > 1600) \ + || (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ > 5 && defined(__GXX_EXPERIMENTAL_CXX0X__)) \ + || (defined(__GNUC__) && __GNUC__ > 4 && __cplusplus >= 201103) + return data_->hash_code(); +#else + return boost::hash_range(raw_name(), raw_name() + std::strlen(raw_name())); +#endif +} + + +/// @cond + +// for this compiler at least, cross-shared-library type_info +// comparisons don't work, so we are using typeid(x).name() instead. +# if (defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))) \ + || defined(_AIX) \ + || (defined(__sgi) && defined(__host_mips)) \ + || (defined(__hpux) && defined(__HP_aCC)) \ + || (defined(linux) && defined(__INTEL_COMPILER) && defined(__ICC)) +# define BOOST_CLASSINFO_COMPARE_BY_NAMES +# endif + +/// @endcond + +inline bool stl_type_index::equal(const stl_type_index& rhs) const BOOST_NOEXCEPT { +#ifdef BOOST_CLASSINFO_COMPARE_BY_NAMES + return raw_name() == rhs.raw_name() || !std::strcmp(raw_name(), rhs.raw_name()); +#else + return !!(*data_ == *rhs.data_); +#endif +} + +inline bool stl_type_index::before(const stl_type_index& rhs) const BOOST_NOEXCEPT { +#ifdef BOOST_CLASSINFO_COMPARE_BY_NAMES + return raw_name() != rhs.raw_name() && std::strcmp(raw_name(), rhs.raw_name()) < 0; +#else + return !!data_->before(*rhs.data_); +#endif +} + +#ifdef BOOST_CLASSINFO_COMPARE_BY_NAMES +#undef BOOST_CLASSINFO_COMPARE_BY_NAMES +#endif + + + +template +inline stl_type_index stl_type_index::type_id() BOOST_NOEXCEPT { + typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type no_ref_t; + typedef BOOST_DEDUCED_TYPENAME boost::remove_cv::type no_cvr_prefinal_t; + + # if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \ + || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744) + + // Old EDG-based compilers seem to mistakenly distinguish 'integral' from 'signed integral' + // in typeid() expressions. Full template specialization for 'integral' fixes that issue: + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< + boost::is_signed, + boost::make_signed, + boost::mpl::identity + >::type no_cvr_prefinal_lazy_t; + + typedef BOOST_DEDUCED_TYPENAME no_cvr_prefinal_t::type no_cvr_t; + #else + typedef no_cvr_prefinal_t no_cvr_t; + #endif + + return typeid(no_cvr_t); +} + +namespace detail { + template class cvr_saver{}; +} + +template +inline stl_type_index stl_type_index::type_id_with_cvr() BOOST_NOEXCEPT { + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< + boost::mpl::or_, boost::is_const, boost::is_volatile >, + detail::cvr_saver, + T + >::type type; + + return typeid(type); +} + + +template +inline stl_type_index stl_type_index::type_id_runtime(const T& value) BOOST_NOEXCEPT { +#ifdef BOOST_NO_RTTI + return value.boost_type_index_type_id_runtime_(); +#else + return typeid(value); +#endif +} + +}} // namespace boost::typeindex + +#endif // BOOST_TYPE_INDEX_STL_TYPE_INDEX_HPP diff --git a/libraries/boost/include/boost/type_index/type_index_facade.hpp b/libraries/boost/include/boost/type_index/type_index_facade.hpp new file mode 100644 index 0000000000..e6dde8f3f9 --- /dev/null +++ b/libraries/boost/include/boost/type_index/type_index_facade.hpp @@ -0,0 +1,297 @@ +// +// Copyright (c) Antony Polukhin, 2013-2018. +// +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef BOOST_TYPE_INDEX_TYPE_INDEX_FACADE_HPP +#define BOOST_TYPE_INDEX_TYPE_INDEX_FACADE_HPP + +#include +#include +#include +#include + +#if !defined(BOOST_NO_IOSTREAM) +#if !defined(BOOST_NO_IOSFWD) +#include // for std::basic_ostream +#else +#include +#endif +#endif + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +namespace boost { namespace typeindex { + +/// \class type_index_facade +/// +/// This class takes care about the comparison operators, hash functions and +/// ostream operators. Use this class as a public base class for defining new +/// type_info-conforming classes. +/// +/// \b Example: +/// \code +/// class stl_type_index: public type_index_facade +/// { +/// public: +/// typedef std::type_info type_info_t; +/// private: +/// const type_info_t* data_; +/// +/// public: +/// stl_type_index(const type_info_t& data) noexcept +/// : data_(&data) +/// {} +/// // ... +/// }; +/// \endcode +/// +/// \tparam Derived Class derived from type_index_facade. +/// \tparam TypeInfo Class that will be used as a base type_info class. +/// \note Take a look at the protected methods. They are \b not \b defined in type_index_facade. +/// Protected member functions raw_name() \b must be defined in Derived class. All the other +/// methods are mandatory. +/// \see 'Making a custom type_index' section for more information about +/// creating your own type_index using type_index_facade. +template +class type_index_facade { +private: + /// @cond + BOOST_CXX14_CONSTEXPR const Derived & derived() const BOOST_NOEXCEPT { + return *static_cast(this); + } + /// @endcond +public: + typedef TypeInfo type_info_t; + + /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. + /// \return Name of a type. By default returns Derived::raw_name(). + inline const char* name() const BOOST_NOEXCEPT { + return derived().raw_name(); + } + + /// \b Override: This function \b may be redefined in Derived class. Overrides may throw. + /// \return Human readable type name. By default returns Derived::name(). + inline std::string pretty_name() const { + return derived().name(); + } + + /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. + /// \return True if two types are equal. By default compares types by raw_name(). + inline bool equal(const Derived& rhs) const BOOST_NOEXCEPT { + const char* const left = derived().raw_name(); + const char* const right = rhs.raw_name(); + return left == right || !std::strcmp(left, right); + } + + /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. + /// \return True if rhs is greater than this. By default compares types by raw_name(). + inline bool before(const Derived& rhs) const BOOST_NOEXCEPT { + const char* const left = derived().raw_name(); + const char* const right = rhs.raw_name(); + return left != right && std::strcmp(left, right) < 0; + } + + /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. + /// \return Hash code of a type. By default hashes types by raw_name(). + /// \note Derived class header \b must include , \b unless this function is redefined in + /// Derived class to not use boost::hash_range(). + inline std::size_t hash_code() const BOOST_NOEXCEPT { + const char* const name_raw = derived().raw_name(); + return boost::hash_range(name_raw, name_raw + std::strlen(name_raw)); + } + +#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) +protected: + /// \b Override: This function \b must be redefined in Derived class. Overrides \b must not throw. + /// \return Pointer to unredable/raw type name. + inline const char* raw_name() const BOOST_NOEXCEPT; + + /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. + /// \return Const reference to underlying low level type_info_t. + inline const type_info_t& type_info() const BOOST_NOEXCEPT; + + /// This is a factory method that is used to create instances of Derived classes. + /// boost::typeindex::type_id() will call this method, if Derived has same type as boost::typeindex::type_index. + /// + /// \b Override: This function \b may be redefined and made public in Derived class. Overrides \b must not throw. + /// Overrides \b must remove const, volatile && and & modifiers from T. + /// \tparam T Type for which type_index must be created. + /// \return type_index for type T. + template + static Derived type_id() BOOST_NOEXCEPT; + + /// This is a factory method that is used to create instances of Derived classes. + /// boost::typeindex::type_id_with_cvr() will call this method, if Derived has same type as boost::typeindex::type_index. + /// + /// \b Override: This function \b may be redefined and made public in Derived class. Overrides \b must not throw. + /// Overrides \b must \b not remove const, volatile && and & modifiers from T. + /// \tparam T Type for which type_index must be created. + /// \return type_index for type T. + template + static Derived type_id_with_cvr() BOOST_NOEXCEPT; + + /// This is a factory method that is used to create instances of Derived classes. + /// boost::typeindex::type_id_runtime(const T&) will call this method, if Derived has same type as boost::typeindex::type_index. + /// + /// \b Override: This function \b may be redefined and made public in Derived class. + /// \param variable Variable which runtime type will be stored in type_index. + /// \return type_index with runtime type of variable. + template + static Derived type_id_runtime(const T& variable) BOOST_NOEXCEPT; + +#endif + +}; + +/// @cond +template +BOOST_CXX14_CONSTEXPR inline bool operator == (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return static_cast(lhs).equal(static_cast(rhs)); +} + +template +BOOST_CXX14_CONSTEXPR inline bool operator < (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return static_cast(lhs).before(static_cast(rhs)); +} + + + +template +BOOST_CXX14_CONSTEXPR inline bool operator > (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return rhs < lhs; +} + +template +BOOST_CXX14_CONSTEXPR inline bool operator <= (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return !(lhs > rhs); +} + +template +BOOST_CXX14_CONSTEXPR inline bool operator >= (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return !(lhs < rhs); +} + +template +BOOST_CXX14_CONSTEXPR inline bool operator != (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return !(lhs == rhs); +} + +// ######################### COMPARISONS with Derived ############################ // +template +inline bool operator == (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return Derived(lhs) == rhs; +} + +template +inline bool operator < (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return Derived(lhs) < rhs; +} + +template +inline bool operator > (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return rhs < Derived(lhs); +} + +template +inline bool operator <= (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return !(Derived(lhs) > rhs); +} + +template +inline bool operator >= (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return !(Derived(lhs) < rhs); +} + +template +inline bool operator != (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { + return !(Derived(lhs) == rhs); +} + + +template +inline bool operator == (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { + return lhs == Derived(rhs); +} + +template +inline bool operator < (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { + return lhs < Derived(rhs); +} + +template +inline bool operator > (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { + return Derived(rhs) < lhs; +} + +template +inline bool operator <= (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { + return !(lhs > Derived(rhs)); +} + +template +inline bool operator >= (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { + return !(lhs < Derived(rhs)); +} + +template +inline bool operator != (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { + return !(lhs == Derived(rhs)); +} + +// ######################### COMPARISONS with Derived END ############################ // + +/// @endcond + +#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) + +/// noexcept comparison operators for type_index_facade classes. +bool operator ==, !=, <, ... (const type_index_facade& lhs, const type_index_facade& rhs) noexcept; + +/// noexcept comparison operators for type_index_facade and it's TypeInfo classes. +bool operator ==, !=, <, ... (const type_index_facade& lhs, const TypeInfo& rhs) noexcept; + +/// noexcept comparison operators for type_index_facade's TypeInfo and type_index_facade classes. +bool operator ==, !=, <, ... (const TypeInfo& lhs, const type_index_facade& rhs) noexcept; + +#endif + +#ifndef BOOST_NO_IOSTREAM +#ifdef BOOST_NO_TEMPLATED_IOSTREAMS +/// @cond +/// Ostream operator that will output demangled name +template +inline std::ostream& operator<<(std::ostream& ostr, const type_index_facade& ind) { + ostr << static_cast(ind).pretty_name(); + return ostr; +} +/// @endcond +#else +/// Ostream operator that will output demangled name. +template +inline std::basic_ostream& operator<<( + std::basic_ostream& ostr, + const type_index_facade& ind) +{ + ostr << static_cast(ind).pretty_name(); + return ostr; +} +#endif // BOOST_NO_TEMPLATED_IOSTREAMS +#endif // BOOST_NO_IOSTREAM + +/// This free function is used by Boost's unordered containers. +/// \note has to be included if this function is used. +template +inline std::size_t hash_value(const type_index_facade& lhs) BOOST_NOEXCEPT { + return static_cast(lhs).hash_code(); +} + +}} // namespace boost::typeindex + +#endif // BOOST_TYPE_INDEX_TYPE_INDEX_FACADE_HPP + diff --git a/libraries/boost/include/boost/visit_each.hpp b/libraries/boost/include/boost/visit_each.hpp new file mode 100644 index 0000000000..6463ca9c2f --- /dev/null +++ b/libraries/boost/include/boost/visit_each.hpp @@ -0,0 +1,27 @@ +// Boost.Signals library + +// Copyright Douglas Gregor 2001-2003. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// For more information, see http://www.boost.org/libs/signals + +#ifndef BOOST_VISIT_EACH_HPP +#define BOOST_VISIT_EACH_HPP + +namespace boost { + template + inline void visit_each(Visitor& visitor, const T& t, long) + { + visitor(t); + } + + template + inline void visit_each(Visitor& visitor, const T& t) + { + visit_each(visitor, t, 0); + } +} + +#endif // BOOST_VISIT_EACH_HPP diff --git a/libraries/eosiolib/CMakeLists.txt b/libraries/eosiolib/CMakeLists.txt index e8c6966938..935578396d 100644 --- a/libraries/eosiolib/CMakeLists.txt +++ b/libraries/eosiolib/CMakeLists.txt @@ -23,6 +23,29 @@ add_library(eosio_tester tester/fpconv.c ${HEADERS}) +set(tester_includes -I${CMAKE_SOURCE_DIR}/libc++/libcxx/include + -I${CMAKE_SOURCE_DIR}/libc/musl/include + -I${CMAKE_SOURCE_DIR}/libc/musl/src/internal + -I${CMAKE_SOURCE_DIR}/libc/musl/src/crypt + -I${CMAKE_SOURCE_DIR}/libc/musl/arch/eos + -I${CMAKE_SOURCE_DIR}/eosiolib/tester + -I${CMAKE_SOURCE_DIR}/eosiolib/core + -I${CMAKE_SOURCE_DIR}/eosiolib/contracts + -I${CMAKE_SOURCE_DIR}/abieos/src + -I${CMAKE_SOURCE_DIR}/abieos/external/date/include + -I${CMAKE_SOURCE_DIR}/abieos/external/rapidjson/include + -I${CMAKE_SOURCE_DIR}/Catch2/single_include + -I${CMAKE_SOURCE_DIR}/fmt/include) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/crt0.o + COMMAND ${CMAKE_CXX_COMPILER} -c -o ${CMAKE_CURRENT_BINARY_DIR}/crt0.o ${tester_includes} ${CMAKE_SOURCE_DIR}/eosiolib/tester/crt0.cpp + DEPENDS ${CMAKE_SOURCE_DIR}/eosiolib/tester/crt0.cpp + COMMENT "Building C++ object crt0.o" +) +add_custom_target(crt0.o.target DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/crt0.o) +add_dependencies(eosio_tester crt0.o.target) + add_native_library(native_eosio eosiolib.cpp crypto.cpp @@ -36,7 +59,7 @@ target_include_directories(eosio PUBLIC ${CMAKE_SOURCE_DIR}/libc/musl/src/internal ${CMAKE_SOURCE_DIR}/libc/musl/src/crypt ${CMAKE_SOURCE_DIR}/libc/musl/arch/eos - ${CMAKE_SOURCE_DIR}/libcxx/include + ${CMAKE_SOURCE_DIR}/libc++/libcxx/include ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/boost/include) @@ -49,6 +72,7 @@ add_custom_command( TARGET eosio_dsm POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy add_custom_command( TARGET eosio_cmem POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${BASE_BINARY_DIR}/lib ) add_custom_command( TARGET eosio_tester POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${BASE_BINARY_DIR}/lib ) add_custom_command( TARGET native_eosio POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${BASE_BINARY_DIR}/lib ) +add_custom_command( TARGET eosio_tester POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/crt0.o ${BASE_BINARY_DIR}/lib ) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../eosiolib DESTINATION ${BASE_BINARY_DIR}/include FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos.h DESTINATION ${BASE_BINARY_DIR}/include/abieos) @@ -58,3 +82,4 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos_ripemd160.hpp DESTINA file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/external/date/include/date DESTINATION ${BASE_BINARY_DIR}/include/date FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/external/rapidjson/include/rapidjson DESTINATION ${BASE_BINARY_DIR}/include/rapidjson FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../fmt/include/fmt DESTINATION ${BASE_BINARY_DIR}/include/fmt FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../Catch2/single_include/catch2 DESTINATION ${BASE_BINARY_DIR}/include FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") diff --git a/libraries/eosiolib/tester/crt0.cpp b/libraries/eosiolib/tester/crt0.cpp new file mode 100644 index 0000000000..a98524b504 --- /dev/null +++ b/libraries/eosiolib/tester/crt0.cpp @@ -0,0 +1,18 @@ + +#include + +int main(int argc, char** argv); + +eosio::internal_use_do_not_use::link::link() {} + +extern "C" __attribute__((eosio_wasm_entry)) void initialize() {} +extern "C" __attribute__((eosio_wasm_entry)) void start(void (*f)()) { + std::vector args = eosio::get_args(); + char buf[] = "eosio-tester"; + std::vector argv; + argv.push_back(buf); + for(std::string& s : args) { + argv.push_back(const_cast(s.data())); + } + main(argv.size(), argv.data()); +} diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index e46eda9ee7..094d2f3da1 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -7,26 +7,10 @@ #include #include #include -#include - -// TODO: move to -namespace std { -inline int fputws(const wchar_t* ws, FILE* stream) { return ::fputws(ws, stream); } -} // namespace std +#include #include -#define TESTER_STRINGIFY1(x) #x -#define TESTER_STRINGIFY(x) TESTER_STRINGIFY1(x) - -#define TESTER_REQUIRE_EQUAL(EXPECTED, ACTUAL) \ - if ((EXPECTED) != (ACTUAL)) \ - eosio::check(false, "expected value doesn't match at " __FILE__ ":" TESTER_STRINGIFY(__LINE__)); - -#define TESTER_REQUIRE(ACTUAL) \ - if (!(ACTUAL)) \ - eosio::check(false, "expected value doesn't match at " __FILE__ ":" TESTER_STRINGIFY(__LINE__)); - #define TESTER_INTRINSIC extern "C" __attribute__((eosio_wasm_import)) namespace eosio { @@ -149,56 +133,6 @@ bool reenter(void (*f)(), E e) { return false; } -inline int32_t open_file(std::string_view filename, std::string_view mode) { - return internal_use_do_not_use::open_file(filename.data(), filename.data() + filename.size(), mode.data(), - mode.data() + mode.size()); -} - -inline void close_file(int32_t file_index) { return internal_use_do_not_use::close_file(file_index); } - -inline bool write_file(int32_t file_index, std::string_view content) { - return internal_use_do_not_use::write_file(file_index, content.data(), content.data() + content.size()); -} - -struct file { - int32_t file_index = -1; - std::string fmt_buffer; - - file(std::string_view filename, std::string_view mode, bool check = true) { - file_index = open_file(filename, mode); - if (check && file_index < 0) - eosio::check(false, "open " + std::string(filename) + " failed"); - } - - file(const file&) = delete; - file(file&&) = delete; - - ~file() { close(); } - - void close() { - if (file_index >= 0) - close_file(file_index); - file_index = -1; - } - - void write(std::string_view content) { write_file(file_index, content); } - - template - void format(const S& format_str, Args&&... args) { - fmt_buffer.clear(); - fmt::format_to(std::back_inserter(fmt_buffer), format_str, std::forward(args)...); - write(fmt_buffer); - } -}; - -template -inline void print_fmt(const S& format_str, Args&&... args) { - static std::string fmt_buffer; - fmt_buffer.clear(); - fmt::format_to(std::back_inserter(fmt_buffer), format_str, std::forward(args)...); - print(fmt_buffer); -} - inline std::vector read_whole_file(std::string_view filename) { std::vector result; if (!internal_use_do_not_use::read_whole_file(filename.data(), filename.data() + filename.size(), [&](size_t size) { @@ -512,102 +446,4 @@ class test_chain { } }; -struct test_case { - const char* name; - void (*f)() = {}; - - test_case(const char* name, void (*f)()) : name{ name }, f{ f } { get_tests().push_back(this); } - test_case(const test_case&) = delete; - test_case(test_case&&) = delete; - - static std::vector& get_tests() { - static std::vector tests; - return tests; - } -}; -#define TEST_CASE(N, ...) eosio::test_case N{ #N, __VA_ARGS__ }; - -struct comparison_file { - std::string filename; - eosio::file file; - - comparison_file(const std::string& filename) : filename(filename), file(filename + ".actual", "w") {} - - ~comparison_file() { close(); } - - void write(std::string_view content) { file.write(content); } - - template - void format(const S& format_str, Args&&... args) { - file.format(format_str, std::forward(args)...); - } - - void close() { - file.close(); - bool write = false; - for (auto& arg : get_args()) - if (arg == "--write") - write = true; - if (write) { - auto cmd = "cp " + filename + ".actual " + filename + ".expected"; - if (execute(cmd)) - check(false, "copy failed"); - } else { - check(!execute("colordiff -u " + filename + ".expected " + filename + ".actual"), - "files are different; use --write to overwrite"); - } - } -}; - -inline void run_tests(void (*f)()) { - if (f) - return f(); - int num_passed = 0; - int num_failed = 0; - auto run = [&](auto& test) { - auto ok = reenter(test->f, [&](auto& error) { print(error, "\n"); }); - if (ok) { - ++num_passed; - print_fmt("\033[96m{:60} \033[32mpassed\033[0m\n", std::string{ test->name }); - } else { - ++num_failed; - print_fmt("\033[96m{:60} \033[31mfailed\033[0m\n", std::string{ test->name }); - } - }; - bool manual = false; - auto& args = get_args(); - for (size_t i = 0; i + 1 < args.size(); ++i) { - if (args[i] == "-t") { - manual = true; - bool found = false; - for (auto* test : test_case::get_tests()) { - if (test->name == args[i + 1]) { - found = true; - run(test); - } - } - if (!found) { - ++num_failed; - print_fmt("\033[96m{:60} \033[31mnot found\033[0m\n", args[i + 1]); - } - } - } - if (!manual) - for (auto* test : test_case::get_tests()) run(test); - if (num_passed) - print_fmt("\033[32m{} tests passed\033[0m", num_passed); - if (num_failed) { - if (num_passed) - print_fmt(", "); - print_fmt("\033[31m{} tests failed\033[0m\n", num_failed); - check(false, "test(s) failed"); - } else { - print_fmt("\n"); - } -} - } // namespace eosio - -#define TEST_ENTRY \ - extern "C" __attribute__((eosio_wasm_entry)) void initialize() {} \ - extern "C" __attribute__((eosio_wasm_entry)) void start(void (*f)()) { eosio::run_tests(f); } diff --git a/libraries/libc/musl b/libraries/libc/musl index 4a7013c9b1..054f5e11a9 160000 --- a/libraries/libc/musl +++ b/libraries/libc/musl @@ -1 +1 @@ -Subproject commit 4a7013c9b1f26d7a8cc2967179603c3963ead9ac +Subproject commit 054f5e11a9b6a4e90a7cb295e7e67f1a30479e90 diff --git a/tools/include/compiler_options.hpp.in b/tools/include/compiler_options.hpp.in index dfcb4d5c84..6b6ad51645 100644 --- a/tools/include/compiler_options.hpp.in +++ b/tools/include/compiler_options.hpp.in @@ -503,6 +503,7 @@ static void GetLdDefaults(std::vector& ldopts) { if (fquery_opt || fquery_server_opt || fquery_client_opt || ftester_opt) ldopts.emplace_back("-leosio_cmem"); if (ftester_opt) { + ldopts.emplace_back(eosio::cdt::whereami::where()+"/../lib/crt0.o"); ldopts.emplace_back("-leosio_tester"); } for (auto e : only_export_opt) { @@ -750,6 +751,7 @@ static Options CreateOptions(bool add_defaults=true) { copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/date"); copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/fmt"); copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/rapidjson"); + copts.emplace_back("-DCATCH_CONFIG_NO_POSIX_SIGNALS"); } #ifndef __APPLE__ diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index 2070fdd5b0..8e70891375 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -475,8 +475,10 @@ struct callbacks { ::state& state; void check_bounds(const char* begin, const char* end) { - if (begin > end) + if (begin > end) { + std::cerr << (void*)begin << " " << (void*)end << std::endl; throw std::runtime_error("bad memory"); + } // todo: check bounds } @@ -609,6 +611,12 @@ struct callbacks { return fwrite(content_begin, content_end - content_begin, 1, f.f) == 1; } + int32_t read_file(int32_t file_index, char* content_begin, char * content_end) { + check_bounds(content_begin, content_end); + auto& f = assert_file(file_index); + return fread(content_begin, 1, content_end - content_begin, f.f); + } + bool read_whole_file(const char* filename_begin, const char* filename_end, uint32_t cb_alloc_data, uint32_t cb_alloc) { check_bounds(filename_begin, filename_end); @@ -650,6 +658,9 @@ struct callbacks { void destroy_chain(uint32_t chain) { assert_chain(chain); state.chains[chain].reset(); + while(!state.chains.empty() && !state.chains.back()) { + state.chains.pop_back(); + } } void start_block(uint32_t chain_index, int64_t skip_miliseconds) { @@ -811,6 +822,7 @@ void register_callbacks() { rhf_t::add("env", "isatty"); rhf_t::add("env", "close_file"); rhf_t::add("env", "write_file"); + rhf_t::add("env", "read_file"); rhf_t::add("env", "read_whole_file"); rhf_t::add("env", "execute"); rhf_t::add("env", "create_chain"); From e1d59f25265dc5fde7d9a3ff7b15cca68cf49371 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 15 Jan 2020 15:14:32 -0500 Subject: [PATCH 16/50] Clean up temporary files --- tools/tester/src/eosio-tester.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index 8e70891375..9b1dc010bc 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -146,20 +146,18 @@ protocol_feature_set make_protocol_feature_set() { } struct test_chain { + fc::temp_directory dir; eosio::chain::private_key_type producer_key{ "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"s }; std::unique_ptr cfg; std::unique_ptr control; std::unique_ptr intr_ctx; test_chain() { - std::string dir = "testchain-XXXXXX"; - if (mkdtemp(dir.data()) != dir.data()) - throw std::runtime_error("could not create directory " + dir); eosio::chain::genesis_state genesis; genesis.initial_timestamp = fc::time_point::from_iso_string("2020-01-01T00:00:00.000"); cfg = std::make_unique(); - cfg->blocks_dir = dir + "/blocks"; - cfg->state_dir = dir + "/state"; + cfg->blocks_dir = dir.path() / "blocks"; + cfg->state_dir = dir.path() / "state"; cfg->contracts_console = true; control = std::make_unique(*cfg, make_protocol_feature_set(), genesis.compute_chain_id()); From 740292300fcde0dce88418c2f934000347e01497 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 15 Jan 2020 17:04:27 -0500 Subject: [PATCH 17/50] Support gcc-7 --- libraries/abieos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/abieos b/libraries/abieos index 1af9a7c4a6..d9aff3073b 160000 --- a/libraries/abieos +++ b/libraries/abieos @@ -1 +1 @@ -Subproject commit 1af9a7c4a67273409aa3f7de94e2be0e0e70174e +Subproject commit d9aff3073be151ff402e33406378ad7e67fbeb47 From e2adcf34aef11ae8d8ecfc5d656350180fc74409 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 15 Jan 2020 17:05:19 -0500 Subject: [PATCH 18/50] Remove definition that's no longer needed and fails. --- libraries/eosiolib/tester/crt0.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries/eosiolib/tester/crt0.cpp b/libraries/eosiolib/tester/crt0.cpp index a98524b504..2dab93fe57 100644 --- a/libraries/eosiolib/tester/crt0.cpp +++ b/libraries/eosiolib/tester/crt0.cpp @@ -3,8 +3,6 @@ int main(int argc, char** argv); -eosio::internal_use_do_not_use::link::link() {} - extern "C" __attribute__((eosio_wasm_entry)) void initialize() {} extern "C" __attribute__((eosio_wasm_entry)) void start(void (*f)()) { std::vector args = eosio::get_args(); From 99c522dba8377684141f13ae241c49f687f54a1c Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 15 Jan 2020 17:06:42 -0500 Subject: [PATCH 19/50] Don't allow more than one chain, as it isn't needed and it make the (global) database API more error prone. --- tools/tester/src/eosio-tester.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index 9b1dc010bc..b770abe882 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -650,6 +650,8 @@ struct callbacks { state.chains.push_back(std::make_unique()); if (state.chains.size() == 1) state.selected_chain_index = 0; + else + throw std::runtime_error("Chain already exists"); return state.chains.size() - 1; } From 3afd51fa90bc110c24d81b164cadd28b67cbc610 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 15 Jan 2020 17:07:11 -0500 Subject: [PATCH 20/50] Start adding documentation of test_chain. --- libraries/eosiolib/tester/eosio/tester.hpp | 42 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index 094d2f3da1..9ade13c0c1 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -174,6 +174,11 @@ inline symbol convert(abieos::symbol s) { return symbol(s.value); } inline asset convert(const abieos::asset& a) { return { a.amount, convert(a.sym) }; } inline asset s2a(const char* s) { return convert(string_to_asset(s)); } +/** + * Validates the status of a transaction. If expected_except is nullptr, then the + * transaction should succeed. Otherwise it represents a string which should be + * part of the error message. + */ inline void expect(const chain_types::transaction_trace& ttrace, const char* expected_except = nullptr) { auto& tt = std::get<0>(ttrace); if (expected_except) { @@ -227,6 +232,11 @@ struct tester_authority { EOSLIB_SERIALIZE(tester_authority, (threshold)(keys)(accounts)(waits)) }; +/** + * Manages a chain. + * Only one test_chain can exist at a time. + * The test chain uses simulated time starting at 2020-01-01T00:00:00.000. + */ class test_chain { private: uint32_t id; @@ -244,6 +254,11 @@ class test_chain { test_chain& operator=(const test_chain&) = delete; test_chain& operator=(test_chain&&) = default; + /** + * Start a new pending block. If a block is currently pending, finishes it first. + * + * @param skip_milliseconds The amount of time to skip in addition to the 500 ms block time. + */ void start_block(int64_t skip_miliseconds = 0) { head_block_info.reset(); if (skip_miliseconds > 500) { @@ -254,13 +269,14 @@ class test_chain { } } + /** + * Finish the current pending block. If no block is pending, creates an empty block. + */ void finish_block() { head_block_info.reset(); internal_use_do_not_use::finish_block(id); } - void select_chain_for_db() { internal_use_do_not_use::select_chain_for_db(id); } - const chain_types::block_info& get_head_block_info() { if (!head_block_info) { std::vector bin; @@ -293,6 +309,10 @@ class test_chain { return t; } + /** + * Pushes a transaction onto the chain. If no block is currently pending, starts one. + */ + [[nodiscard]] chain_types::transaction_trace push_transaction(const transaction& trx, const std::vector& keys, const std::vector>& context_free_data = {}, const std::vector& signatures = {}) { @@ -311,10 +331,16 @@ class test_chain { return chain_types::assert_bin_to_native(bin); } + [[nodiscard]] chain_types::transaction_trace push_transaction(const transaction& trx) { return push_transaction(trx, { default_priv_key }); } + /** + * Pushes a transaction onto the chain. If no block is currently pending, starts one. + * + * Validates the transaction status according to @ref eosio::expect. + */ chain_types::transaction_trace transact(std::vector&& actions, const std::vector& keys, const char* expected_except = nullptr) { auto trace = push_transaction(make_transaction(std::move(actions)), keys); @@ -326,6 +352,14 @@ class test_chain { return transact(std::move(actions), { default_priv_key }, expected_except); } + /** + * Executes a single deferred transaction and returns the action trace. + * If there are no available deferred transactions that are ready to execute + * in the current pending block, returns an empty optional. + * + * If no block is currently pending, starts one. + */ + [[nodiscard]] std::optional exec_deferred() { std::vector bin; if (!internal_use_do_not_use::exec_deferred(id, [&](size_t size) { @@ -388,6 +422,10 @@ class test_chain { return create_code_account(ac, convert(default_pub_key), false, expected_except); } + /* + * Set the code for an account. + * Validates the transaction status as with @ref eosio::expect. + */ chain_types::transaction_trace set_code(name ac, const char* filename, const char* expected_except = nullptr) { return transact({ action{ { { ac, "active"_n } }, "eosio"_n, From e72db1ac52134b02ba92a7e3a45cdce1a53e1091 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 15 Jan 2020 17:10:54 -0500 Subject: [PATCH 21/50] Fix Catch2 submodule definition. --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index ff00ed0b15..be774abfd4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -21,6 +21,6 @@ [submodule "libraries/fmt"] path = libraries/fmt url = https://github.com/fmtlib/fmt.git -[submodule "external/Catch2"] - path = external/Catch2 +[submodule "libraries/Catch2"] + path = libraries/Catch2 url = https://github.com/catchorg/Catch2 From 7249abe5a8c150585b80b7394f8de7c24b7e0836 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 17 Jan 2020 10:54:45 -0500 Subject: [PATCH 22/50] Update to use abieos/refactor branch. --- .gitmodules | 2 +- libraries/abieos | 2 +- libraries/eosiolib/CMakeLists.txt | 4 ++ .../eosiolib/tester/eosio/chain_types.hpp | 53 +++++++++++-------- libraries/eosiolib/tester/eosio/tester.hpp | 45 +++++++++------- tools/tester/CMakeLists.txt | 2 + tools/tester/src/eosio-tester.cpp | 45 +++++++++------- 7 files changed, 91 insertions(+), 62 deletions(-) diff --git a/.gitmodules b/.gitmodules index be774abfd4..c2a8d8a73e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -23,4 +23,4 @@ url = https://github.com/fmtlib/fmt.git [submodule "libraries/Catch2"] path = libraries/Catch2 - url = https://github.com/catchorg/Catch2 + url = https://github.com/catchorg/Catch2.git diff --git a/libraries/abieos b/libraries/abieos index d9aff3073b..5af644ff96 160000 --- a/libraries/abieos +++ b/libraries/abieos @@ -1 +1 @@ -Subproject commit d9aff3073be151ff402e33406378ad7e67fbeb47 +Subproject commit 5af644ff9680e0377113e0e0b9f420b453019ff6 diff --git a/libraries/eosiolib/CMakeLists.txt b/libraries/eosiolib/CMakeLists.txt index 935578396d..5391f63624 100644 --- a/libraries/eosiolib/CMakeLists.txt +++ b/libraries/eosiolib/CMakeLists.txt @@ -31,7 +31,9 @@ set(tester_includes -I${CMAKE_SOURCE_DIR}/libc++/libcxx/include -I${CMAKE_SOURCE_DIR}/eosiolib/tester -I${CMAKE_SOURCE_DIR}/eosiolib/core -I${CMAKE_SOURCE_DIR}/eosiolib/contracts + -I${CMAKE_SOURCE_DIR}/abieos/include -I${CMAKE_SOURCE_DIR}/abieos/src + -I${CMAKE_SOURCE_DIR}/abieos/external/outcome/single-header -I${CMAKE_SOURCE_DIR}/abieos/external/date/include -I${CMAKE_SOURCE_DIR}/abieos/external/rapidjson/include -I${CMAKE_SOURCE_DIR}/Catch2/single_include @@ -75,6 +77,7 @@ add_custom_command( TARGET native_eosio POST_BUILD COMMAND ${CMAKE_COMMAND} -E c add_custom_command( TARGET eosio_tester POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/crt0.o ${BASE_BINARY_DIR}/lib ) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../eosiolib DESTINATION ${BASE_BINARY_DIR}/include FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/include/eosio DESTINATION ${BASE_BINARY_DIR}/include/eosiolib/tester FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos.h DESTINATION ${BASE_BINARY_DIR}/include/abieos) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos.hpp DESTINATION ${BASE_BINARY_DIR}/include/abieos) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos_numeric.hpp DESTINATION ${BASE_BINARY_DIR}/include/abieos) @@ -83,3 +86,4 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/external/date/include/date DESTI file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/external/rapidjson/include/rapidjson DESTINATION ${BASE_BINARY_DIR}/include/rapidjson FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../fmt/include/fmt DESTINATION ${BASE_BINARY_DIR}/include/fmt FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../Catch2/single_include/catch2 DESTINATION ${BASE_BINARY_DIR}/include FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/external/outcome/single-header/outcome-basic.hpp DESTINATION ${BASE_BINARY_DIR}/include) diff --git a/libraries/eosiolib/tester/eosio/chain_types.hpp b/libraries/eosiolib/tester/eosio/chain_types.hpp index 7cf5b62e2a..bdc78fa3ee 100644 --- a/libraries/eosiolib/tester/eosio/chain_types.hpp +++ b/libraries/eosiolib/tester/eosio/chain_types.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #ifdef EOSIO_CDT_COMPILATION # include @@ -17,6 +18,7 @@ namespace chain_types { [[noreturn]] inline void report_error(const std::string& s) { throw std::runtime_error(s); } #endif +#if 0 template T read_raw(abieos::input_buffer& bin) { T result{}; @@ -25,15 +27,16 @@ T read_raw(abieos::input_buffer& bin) { report_error(error); return result; } +#endif template T assert_bin_to_native(const std::vector& bin) { - T result{}; - std::string error; - abieos::input_buffer b{ bin.data(), bin.data() + bin.size() }; - if (!abieos::bin_to_native(result, error, b)) - report_error(error); - return result; + return eosio::check(eosio::convert_from_bin(bin)).value(); +} + +template +auto assert_native_to_bin(const T& t) { + return eosio::check(eosio::convert_to_bin(t)).value(); } struct extension { @@ -79,6 +82,7 @@ inline transaction_status get_transaction_status(const std::string& s) { report_error("unknown status: " + s); } +#if 0 inline bool bin_to_native(transaction_status& status, abieos::bin_to_native_state& state, bool) { status = transaction_status(read_raw(state.bin)); return true; @@ -92,6 +96,7 @@ inline bool json_to_native(transaction_status&, abieos::json_to_native_state& st inline void native_to_bin(const transaction_status& obj, std::vector& bin) { abieos::push_raw(bin, static_cast(obj)); } +#endif struct permission_level { abieos::name actor = {}; @@ -118,10 +123,14 @@ struct account_delta { int64_t delta = {}; }; +EOSIO_REFLECT(account_delta, account, delta) + +#if 0 ABIEOS_REFLECT(account_delta) { ABIEOS_MEMBER(account_delta, account) ABIEOS_MEMBER(account_delta, delta) } +#endif struct action_receipt_v0 { abieos::name receiver = {}; @@ -255,6 +264,17 @@ struct recurse_transaction_trace { transaction_trace recurse = {}; }; +template +eosio::result from_bin(recurse_transaction_trace& obj, S& stream) { + return from_bin(obj.recurse, stream); +} + +template +eosio::result to_bin(const recurse_transaction_trace& obj, S& stream) { + return to_bin(obj.recurse, stream); +} + +#if 0 inline bool bin_to_native(recurse_transaction_trace& obj, abieos::bin_to_native_state& state, bool start) { return abieos::bin_to_native(obj.recurse, state, start); } @@ -267,6 +287,7 @@ inline bool json_to_native(recurse_transaction_trace& obj, abieos::json_to_nativ inline void native_to_bin(const recurse_transaction_trace& obj, std::vector& bin) { abieos::native_to_bin(obj.recurse, bin); } +#endif struct producer_key { abieos::name producer_name = {}; @@ -320,10 +341,7 @@ struct transaction_receipt : transaction_receipt_header { transaction_variant trx = {}; }; -ABIEOS_REFLECT(transaction_receipt) { - ABIEOS_BASE(transaction_receipt_header) - ABIEOS_MEMBER(transaction_receipt, trx) -} +EOSIO_REFLECT(transaction_receipt, base transaction_receipt_header, trx); struct block_header { abieos::block_timestamp timestamp = {}; @@ -337,17 +355,10 @@ struct block_header { std::vector header_extensions = {}; }; -ABIEOS_REFLECT(block_header) { - ABIEOS_MEMBER(block_header, timestamp) - ABIEOS_MEMBER(block_header, producer) - ABIEOS_MEMBER(block_header, confirmed) - ABIEOS_MEMBER(block_header, previous) - ABIEOS_MEMBER(block_header, transaction_mroot) - ABIEOS_MEMBER(block_header, action_mroot) - ABIEOS_MEMBER(block_header, schedule_version) - ABIEOS_MEMBER(block_header, new_producers) - ABIEOS_MEMBER(block_header, header_extensions) -} +EOSIO_REFLECT(block_header, + timestamp, producer, confirmed, previous, transaction_mroot, action_mroot, + schedule_version, new_producers, header_extensions +) struct signed_block_header : block_header { abieos::signature producer_signature = {}; diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index 9ade13c0c1..a6d2a4b283 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -111,10 +112,8 @@ inline const std::vector& get_args() { static std::optional> args; if (!args) { auto& bytes = internal_use_do_not_use::get_args(); - abieos::input_buffer bin{ bytes.data(), bytes.data() + bytes.size() }; - std::string error; args.emplace(); - check(abieos::bin_to_native>(*args, error, bin), error); + args = check(convert_from_bin>(bytes)).value(); } return *args; } @@ -161,13 +160,10 @@ inline abieos::private_key string_to_private_key(std::string_view s) { return result; } -inline public_key convert(const abieos::public_key& k) { return unpack(abieos::native_to_bin(k)); } +inline public_key convert(const abieos::public_key& k) { return unpack(check(convert_to_bin(k)).value()); } inline abieos::asset string_to_asset(const char* s) { - std::string error; - abieos::asset result; - check(abieos::string_to_asset(result, error, s), error); - return result; + return check(eosio::convert_from_string(s)).value(); } inline symbol convert(abieos::symbol s) { return symbol(s.value); } @@ -284,7 +280,7 @@ class test_chain { bin.resize(size); return bin.data(); }); - head_block_info = chain_types::assert_bin_to_native(bin); + head_block_info = check(convert_from_bin(bin)).value(); } return *head_block_info; } @@ -319,16 +315,16 @@ class test_chain { std::vector packed_trx = pack(trx); std::vector args; - abieos::native_to_bin(packed_trx, args); - abieos::native_to_bin(context_free_data, args); - abieos::native_to_bin(signatures, args); - abieos::native_to_bin(keys, args); + check_discard(convert_to_bin(packed_trx, args)); + check_discard(convert_to_bin(context_free_data, args)); + check_discard(convert_to_bin(signatures, args)); + check_discard(convert_to_bin(keys, args)); std::vector bin; internal_use_do_not_use::push_transaction(id, args.data(), args.data() + args.size(), [&](size_t size) { bin.resize(size); return bin.data(); }); - return chain_types::assert_bin_to_native(bin); + return check(convert_from_bin(bin)).value(); } [[nodiscard]] @@ -367,7 +363,7 @@ class test_chain { return bin.data(); })) return {}; - return chain_types::assert_bin_to_native(bin); + return check(convert_from_bin(bin)).value(); } chain_types::transaction_trace create_account(name ac, const public_key& pub_key, @@ -387,7 +383,14 @@ class test_chain { return create_account(ac, convert(default_pub_key), expected_except); } - chain_types::transaction_trace create_code_account(name ac, const public_key& pub_key, bool is_priv = false, + /** + * Create an account that can have a contract set on it. + * @param account The name of the account + * @param pub_key The public key to use for the account. Defaults to default_pub_key. + * @param is_priv Determines whether the contract should be privileged. Defaults to false. + * @param expected_except Used to validate the transaction status according to @ref eosio::expect. + */ + chain_types::transaction_trace create_code_account(name account, const public_key& pub_key, bool is_priv = false, const char* expected_except = nullptr) { tester_authority simple_auth{ .threshold = 1, @@ -396,15 +399,15 @@ class test_chain { tester_authority code_auth{ .threshold = 1, .keys = { { pub_key, 1 } }, - .accounts = { { { ac, "eosio.code"_n }, 1 } }, + .accounts = { { { account, "eosio.code"_n }, 1 } }, }; return transact( { action{ { { "eosio"_n, "active"_n } }, "eosio"_n, "newaccount"_n, - std::make_tuple("eosio"_n, ac, simple_auth, code_auth) }, - action{ { { "eosio"_n, "active"_n } }, "eosio"_n, "setpriv"_n, std::make_tuple(ac, is_priv) }, + std::make_tuple("eosio"_n, account, simple_auth, code_auth) }, + action{ { { "eosio"_n, "active"_n } }, "eosio"_n, "setpriv"_n, std::make_tuple(account, is_priv) }, }, expected_except); } @@ -434,6 +437,10 @@ class test_chain { expected_except); } + /** + * Creates a new token. + * The eosio.token contract should be deployed on the @c contract account. + */ chain_types::transaction_trace create_token(name contract, name signer, name issuer, asset maxsupply, const char* expected_except = nullptr) { return transact( diff --git a/tools/tester/CMakeLists.txt b/tools/tester/CMakeLists.txt index 19baab77ac..872049589b 100644 --- a/tools/tester/CMakeLists.txt +++ b/tools/tester/CMakeLists.txt @@ -74,7 +74,9 @@ target_include_directories(eosio_chain PUBLIC add_executable(eosio-tester src/eosio-tester.cpp) target_include_directories(eosio-tester PRIVATE + ../../libraries/abieos/include ../../libraries/abieos/src + ../../libraries/abieos/external/outcome/single-header ../../libraries/abieos/external/date/include ../../libraries/abieos/external/rapidjson/include ../../libraries/eos/libraries/chain/include diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index b770abe882..f08390e819 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include #include @@ -17,6 +19,8 @@ using eosio::chain::builtin_protocol_feature_t; using eosio::chain::digest_type; using eosio::chain::protocol_feature_exception; using eosio::chain::protocol_feature_set; +using eosio::check; +using eosio::convert_to_bin; struct callbacks; using backend_t = eosio::vm::backend; @@ -675,7 +679,7 @@ struct callbacks { info.block_num = chain.control->head_block_num(); info.block_id = convert(chain.control->head_block_id()); info.timestamp.slot = chain.control->head_block_state()->header.timestamp.slot; - set_data(cb_alloc_data, cb_alloc, abieos::native_to_bin(info)); + set_data(cb_alloc_data, cb_alloc, check(convert_to_bin(info)).value()); } void push_transaction(uint32_t chain_index, const char* args_begin, const char* args_end, uint32_t cb_alloc_data, @@ -693,7 +697,7 @@ struct callbacks { ptrx, chain.control->get_thread_pool(), chain.control->get_chain_id(), fc::microseconds::maximum()); auto result = chain.control->push_transaction( fut.get(), fc::time_point::maximum(), 2000); // ilog("${r}", ("r", fc::json::to_pretty_string(result))); - set_data(cb_alloc_data, cb_alloc, abieos::native_to_bin(chain_types::transaction_trace{ convert(*result) })); + set_data(cb_alloc_data, cb_alloc, check(convert_to_bin(chain_types::transaction_trace{ convert(*result) })).value()); } bool exec_deferred(uint32_t chain_index, uint32_t cb_alloc_data, uint32_t cb_alloc) { @@ -705,7 +709,7 @@ struct callbacks { if (itr != idx.end() && itr->delay_until <= chain.control->pending_block_time()) { auto trace = chain.control->push_scheduled_transaction(itr->trx_id, fc::time_point::maximum(), billed_cpu_time_use); - set_data(cb_alloc_data, cb_alloc, abieos::native_to_bin(chain_types::transaction_trace{ convert(*trace) })); + set_data(cb_alloc_data, cb_alloc, check(convert_to_bin(chain_types::transaction_trace{ convert(*trace) })).value()); return true; } return false; @@ -715,25 +719,26 @@ struct callbacks { uint32_t cb_alloc) { auto& chain = assert_chain(chain_index); check_bounds(req_begin, req_end); - abieos::input_buffer query_bin{ req_begin, req_end }; + eosio::input_stream query_bin{ req_begin, req_end }; abieos::name query_name; - abieos::bin_to_native(query_name, query_bin); + eosio::check_discard(from_bin(query_name, query_bin)); if (query_name == "cr.ctsp"_n) return set_data(cb_alloc_data, cb_alloc, query_contract_row_range_code_table_scope_pk(chain, query_bin)); throw std::runtime_error("query_database: unknown query: " + (std::string)query_name); } - std::vector query_contract_row_range_code_table_scope_pk(test_chain& chain, abieos::input_buffer query_bin) { - auto snapshot_block = abieos::bin_to_native(query_bin); - auto first_code = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; - auto first_table = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; - auto first_scope = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; - auto first_primary_key = abieos::bin_to_native(query_bin); - auto last_code = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; - auto last_table = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; - auto last_scope = eosio::chain::name{ abieos::bin_to_native(query_bin).value }; - auto last_primary_key = abieos::bin_to_native(query_bin); - auto max_results = abieos::bin_to_native(query_bin); + std::vector query_contract_row_range_code_table_scope_pk(test_chain& chain, eosio::input_stream& query_bin) { + using eosio::from_bin; // ADL required + auto snapshot_block = eosio::check(from_bin(query_bin)).value(); + auto first_code = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto first_table = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto first_scope = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto first_primary_key = eosio::check(from_bin(query_bin)).value(); + auto last_code = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto last_table = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto last_scope = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto last_primary_key = eosio::check(from_bin(query_bin)).value(); + auto max_results = eosio::check(from_bin(query_bin)).value(); if (first_code != last_code) throw std::runtime_error("query_database: first.code != last.code"); @@ -755,7 +760,7 @@ struct callbacks { kv_it != kv_index.end(); ++kv_it) { if (kv_it->t_id != table_it->id || kv_it->primary_key > last_primary_key || rows.size() >= max_results) break; - rows.emplace_back(abieos::native_to_bin( + rows.emplace_back(eosio::check(eosio::convert_to_bin( contract_row{ uint32_t(0), bool(true), abieos::name{ to_uint64_t(table_it->code) }, @@ -763,10 +768,10 @@ struct callbacks { abieos::name{ to_uint64_t(table_it->table) }, kv_it->primary_key, abieos::name{ to_uint64_t(kv_it->payer) }, - { kv_it->value.data(), kv_it->value.data() + kv_it->value.size() } })); + { kv_it->value.data(), kv_it->value.data() + kv_it->value.size() } })).value()); }; } - return abieos::native_to_bin(rows); + return eosio::check(eosio::convert_to_bin(rows)).value(); } // query_contract_row_range_code_table_scope_pk void select_chain_for_db(uint32_t chain_index) { @@ -853,7 +858,7 @@ static void run(const char* wasm, const std::vector& args) { eosio::vm::wasm_allocator wa; auto code = backend_t::read_wasm(wasm); backend_t backend(code); - ::state state{ wasm, wa, backend, abieos::native_to_bin(args) }; + ::state state{ wasm, wa, backend, eosio::check(eosio::convert_to_bin(args)).value() }; callbacks cb{ state }; state.files.emplace_back(stdin, false); state.files.emplace_back(stdout, false); From 2492007d25361164079092388fe9f18f8c42ebd7 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 17 Jan 2020 11:36:24 -0500 Subject: [PATCH 23/50] Use new abieos reflection api --- .../eosiolib/tester/eosio/chain_types.hpp | 157 +++--------------- tools/tester/src/eosio-tester.cpp | 11 +- 2 files changed, 20 insertions(+), 148 deletions(-) diff --git a/libraries/eosiolib/tester/eosio/chain_types.hpp b/libraries/eosiolib/tester/eosio/chain_types.hpp index bdc78fa3ee..9198f02255 100644 --- a/libraries/eosiolib/tester/eosio/chain_types.hpp +++ b/libraries/eosiolib/tester/eosio/chain_types.hpp @@ -44,10 +44,7 @@ struct extension { abieos::input_buffer data = {}; }; -ABIEOS_REFLECT(extension) { - ABIEOS_MEMBER(extension, type) - ABIEOS_MEMBER(extension, data) -} +EOSIO_REFLECT(extension, type, data); enum class transaction_status : uint8_t { executed = 0, // succeed, no error handler executed @@ -82,55 +79,26 @@ inline transaction_status get_transaction_status(const std::string& s) { report_error("unknown status: " + s); } -#if 0 -inline bool bin_to_native(transaction_status& status, abieos::bin_to_native_state& state, bool) { - status = transaction_status(read_raw(state.bin)); - return true; -} - -inline bool json_to_native(transaction_status&, abieos::json_to_native_state& state, abieos::event_type, bool) { - state.error = "json_to_native: transaction_status unsupported"; - return false; -} - -inline void native_to_bin(const transaction_status& obj, std::vector& bin) { - abieos::push_raw(bin, static_cast(obj)); -} -#endif - struct permission_level { abieos::name actor = {}; abieos::name permission = {}; }; -ABIEOS_REFLECT(permission_level) { - ABIEOS_MEMBER(permission_level, actor) - ABIEOS_MEMBER(permission_level, permission) -} +EOSIO_REFLECT(permission_level, actor, permission); struct account_auth_sequence { abieos::name account = {}; uint64_t sequence = {}; }; -ABIEOS_REFLECT(account_auth_sequence) { - ABIEOS_MEMBER(account_auth_sequence, account) - ABIEOS_MEMBER(account_auth_sequence, sequence) -} +EOSIO_REFLECT(account_auth_sequence, account, sequence); struct account_delta { abieos::name account = {}; int64_t delta = {}; }; -EOSIO_REFLECT(account_delta, account, delta) - -#if 0 -ABIEOS_REFLECT(account_delta) { - ABIEOS_MEMBER(account_delta, account) - ABIEOS_MEMBER(account_delta, delta) -} -#endif +EOSIO_REFLECT(account_delta, account, delta); struct action_receipt_v0 { abieos::name receiver = {}; @@ -142,15 +110,7 @@ struct action_receipt_v0 { abieos::varuint32 abi_sequence = {}; }; -ABIEOS_REFLECT(action_receipt_v0) { - ABIEOS_MEMBER(action_receipt_v0, receiver) - ABIEOS_MEMBER(action_receipt_v0, act_digest) - ABIEOS_MEMBER(action_receipt_v0, global_sequence) - ABIEOS_MEMBER(action_receipt_v0, recv_sequence) - ABIEOS_MEMBER(action_receipt_v0, auth_sequence) - ABIEOS_MEMBER(action_receipt_v0, code_sequence) - ABIEOS_MEMBER(action_receipt_v0, abi_sequence) -} +EOSIO_REFLECT(action_receipt_v0, receiver, act_digest, global_sequence, recv_sequence, auth_sequence, code_sequence, abi_sequence); using action_receipt = std::variant; @@ -161,12 +121,7 @@ struct action { abieos::input_buffer data = {}; }; -ABIEOS_REFLECT(action) { - ABIEOS_MEMBER(action, account) - ABIEOS_MEMBER(action, name) - ABIEOS_MEMBER(action, authorization) - ABIEOS_MEMBER(action, data) -} +EOSIO_REFLECT(action, account, name, authorization, data); struct action_trace_v0 { abieos::varuint32 action_ordinal = {}; @@ -182,19 +137,8 @@ struct action_trace_v0 { std::optional error_code = {}; }; -ABIEOS_REFLECT(action_trace_v0) { - ABIEOS_MEMBER(action_trace_v0, action_ordinal) - ABIEOS_MEMBER(action_trace_v0, creator_action_ordinal) - ABIEOS_MEMBER(action_trace_v0, receipt) - ABIEOS_MEMBER(action_trace_v0, receiver) - ABIEOS_MEMBER(action_trace_v0, act) - ABIEOS_MEMBER(action_trace_v0, context_free) - ABIEOS_MEMBER(action_trace_v0, elapsed) - ABIEOS_MEMBER(action_trace_v0, console) - ABIEOS_MEMBER(action_trace_v0, account_ram_deltas) - ABIEOS_MEMBER(action_trace_v0, except) - ABIEOS_MEMBER(action_trace_v0, error_code) -} +EOSIO_REFLECT(action_trace_v0, action_ordinal, creator_action_ordinal, receipt, receiver, act, + context_free, elapsed, console, account_ram_deltas, except, error_code); using action_trace = std::variant; @@ -210,17 +154,8 @@ struct partial_transaction_v0 { std::vector context_free_data = {}; }; -ABIEOS_REFLECT(partial_transaction_v0) { - ABIEOS_MEMBER(partial_transaction_v0, expiration) - ABIEOS_MEMBER(partial_transaction_v0, ref_block_num) - ABIEOS_MEMBER(partial_transaction_v0, ref_block_prefix) - ABIEOS_MEMBER(partial_transaction_v0, max_net_usage_words) - ABIEOS_MEMBER(partial_transaction_v0, max_cpu_usage_ms) - ABIEOS_MEMBER(partial_transaction_v0, delay_sec) - ABIEOS_MEMBER(partial_transaction_v0, transaction_extensions) - ABIEOS_MEMBER(partial_transaction_v0, signatures) - ABIEOS_MEMBER(partial_transaction_v0, context_free_data) -} +EOSIO_REFLECT(partial_transaction_v0, expiration, ref_block_num, ref_block_prefix, max_net_usage_words, + max_cpu_usage_ms, delay_sec, transaction_extensions, signatures, context_free_data); using partial_transaction = std::variant; @@ -242,21 +177,8 @@ struct transaction_trace_v0 { std::optional reserved_do_not_use = {}; }; -ABIEOS_REFLECT(transaction_trace_v0) { - ABIEOS_MEMBER(transaction_trace_v0, id) - ABIEOS_MEMBER(transaction_trace_v0, status) - ABIEOS_MEMBER(transaction_trace_v0, cpu_usage_us) - ABIEOS_MEMBER(transaction_trace_v0, net_usage_words) - ABIEOS_MEMBER(transaction_trace_v0, elapsed) - ABIEOS_MEMBER(transaction_trace_v0, net_usage) - ABIEOS_MEMBER(transaction_trace_v0, scheduled) - ABIEOS_MEMBER(transaction_trace_v0, action_traces) - ABIEOS_MEMBER(transaction_trace_v0, account_ram_delta) - ABIEOS_MEMBER(transaction_trace_v0, except) - ABIEOS_MEMBER(transaction_trace_v0, error_code) - ABIEOS_MEMBER(transaction_trace_v0, failed_dtrx_trace) - ABIEOS_MEMBER(transaction_trace_v0, reserved_do_not_use) -} +EOSIO_REFLECT(transaction_trace_v0, id, status, cpu_usage_us, elapsed, net_usage_words, scheduled, action_traces, + account_ram_delta, except, error_code, failed_dtrx_trace, reserved_do_not_use); using transaction_trace = std::variant; @@ -274,40 +196,19 @@ eosio::result to_bin(const recurse_transaction_trace& obj, S& stream) { return to_bin(obj.recurse, stream); } -#if 0 -inline bool bin_to_native(recurse_transaction_trace& obj, abieos::bin_to_native_state& state, bool start) { - return abieos::bin_to_native(obj.recurse, state, start); -} - -inline bool json_to_native(recurse_transaction_trace& obj, abieos::json_to_native_state& state, - abieos::event_type event, bool start) { - return abieos::json_to_native(obj.recurse, state, event, start); -} - -inline void native_to_bin(const recurse_transaction_trace& obj, std::vector& bin) { - abieos::native_to_bin(obj.recurse, bin); -} -#endif - struct producer_key { abieos::name producer_name = {}; abieos::public_key block_signing_key = {}; }; -ABIEOS_REFLECT(producer_key) { - ABIEOS_MEMBER(producer_key, producer_name) - ABIEOS_MEMBER(producer_key, block_signing_key) -} +EOSIO_REFLECT(producer_key, producer_name, block_signing_key); struct producer_schedule { uint32_t version = {}; std::vector producers = {}; }; -ABIEOS_REFLECT(producer_schedule) { - ABIEOS_MEMBER(producer_schedule, version) - ABIEOS_MEMBER(producer_schedule, producers) -} +EOSIO_REFLECT(producer_schedule, version, producers); struct transaction_receipt_header { transaction_status status = {}; @@ -315,11 +216,7 @@ struct transaction_receipt_header { abieos::varuint32 net_usage_words = {}; }; -ABIEOS_REFLECT(transaction_receipt_header) { - ABIEOS_MEMBER(transaction_receipt_header, status) - ABIEOS_MEMBER(transaction_receipt_header, cpu_usage_us) - ABIEOS_MEMBER(transaction_receipt_header, net_usage_words) -} +EOSIO_REFLECT(transaction_receipt_header, status, cpu_usage_us, net_usage_words); struct packed_transaction { std::vector signatures = {}; @@ -328,12 +225,7 @@ struct packed_transaction { abieos::input_buffer packed_trx = {}; }; -ABIEOS_REFLECT(packed_transaction) { - ABIEOS_MEMBER(packed_transaction, signatures) - ABIEOS_MEMBER(packed_transaction, compression) - ABIEOS_MEMBER(packed_transaction, packed_context_free_data) - ABIEOS_MEMBER(packed_transaction, packed_trx) -} +EOSIO_REFLECT(packed_transaction, signatures, compression, packed_context_free_data, packed_trx); using transaction_variant = std::variant; @@ -364,21 +256,14 @@ struct signed_block_header : block_header { abieos::signature producer_signature = {}; }; -ABIEOS_REFLECT(signed_block_header) { - ABIEOS_BASE(block_header) - ABIEOS_MEMBER(signed_block_header, producer_signature) -} +EOSIO_REFLECT(signed_block_header, base block_header, producer_signature); struct signed_block : signed_block_header { std::vector transactions = {}; std::vector block_extensions = {}; }; -ABIEOS_REFLECT(signed_block) { - ABIEOS_BASE(signed_block_header) - ABIEOS_MEMBER(signed_block, transactions) - ABIEOS_MEMBER(signed_block, block_extensions) -} +EOSIO_REFLECT(signed_block, base signed_block_header, transactions, block_extensions); struct block_info { uint32_t block_num = {}; @@ -386,10 +271,6 @@ struct block_info { abieos::block_timestamp timestamp = {}; }; -ABIEOS_REFLECT(block_info) { - ABIEOS_MEMBER(block_info, block_num) - ABIEOS_MEMBER(block_info, block_id) - ABIEOS_MEMBER(block_info, timestamp) -} +EOSIO_REFLECT(block_info, block_num, block_id, timestamp); } // namespace chain_types diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index f08390e819..bb1c3302ec 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -298,16 +298,7 @@ struct contract_row { abieos::input_buffer value = {}; }; -ABIEOS_REFLECT(contract_row) { - ABIEOS_MEMBER(contract_row, block_num); - ABIEOS_MEMBER(contract_row, present); - ABIEOS_MEMBER(contract_row, code); - ABIEOS_MEMBER(contract_row, scope); - ABIEOS_MEMBER(contract_row, table); - ABIEOS_MEMBER(contract_row, primary_key); - ABIEOS_MEMBER(contract_row, payer); - ABIEOS_MEMBER(contract_row, value); -} +EOSIO_REFLECT(contract_row, block_num, present, code, scope, table, primary_key, payer, value); struct file { FILE* f = nullptr; From fcfadb6c3383d739f8ac14382dce2d128c7b9ba4 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 17 Jan 2020 16:43:37 -0500 Subject: [PATCH 24/50] Simplify access to transaction_trace, action_trace, &c. Instead of using std::variant, use a custom type that serializes like variant, but directly exposes the latest version of the type. Only one type is supported for now. Handling more than one type would require the ability to convert from old formats. --- .../eosiolib/tester/eosio/chain_types.hpp | 62 +++++++++---------- libraries/eosiolib/tester/eosio/tester.hpp | 3 +- tools/tester/src/eosio-tester.cpp | 2 +- 3 files changed, 33 insertions(+), 34 deletions(-) diff --git a/libraries/eosiolib/tester/eosio/chain_types.hpp b/libraries/eosiolib/tester/eosio/chain_types.hpp index 9198f02255..bfddc75459 100644 --- a/libraries/eosiolib/tester/eosio/chain_types.hpp +++ b/libraries/eosiolib/tester/eosio/chain_types.hpp @@ -18,17 +18,6 @@ namespace chain_types { [[noreturn]] inline void report_error(const std::string& s) { throw std::runtime_error(s); } #endif -#if 0 -template -T read_raw(abieos::input_buffer& bin) { - T result{}; - std::string error; - if (!abieos::read_raw(bin, error, result)) - report_error(error); - return result; -} -#endif - template T assert_bin_to_native(const std::vector& bin) { return eosio::check(eosio::convert_from_bin(bin)).value(); @@ -112,7 +101,31 @@ struct action_receipt_v0 { EOSIO_REFLECT(action_receipt_v0, receiver, act_digest, global_sequence, recv_sequence, auth_sequence, code_sequence, abi_sequence); -using action_receipt = std::variant; +template +struct variant : T { + constexpr variant() = default; + constexpr variant(T&& obj) : T(std::move(obj)) {} + constexpr variant(const T& obj) : T(obj) {} +}; + +template +eosio::result to_bin(const variant& obj, S& stream) { + uint8_t idx = 0; + OUTCOME_TRY(to_bin(idx, stream)); + return to_bin(static_cast(obj), stream); +} + +template +eosio::result from_bin(variant& obj, S& stream) { + uint8_t idx = 0; + OUTCOME_TRY(from_bin(idx, stream)); + if(idx != 0) { + return eosio::stream_error::bad_variant_index; + } + return from_bin(static_cast(obj), stream); +} + +using action_receipt = variant; struct action { abieos::name account = {}; @@ -140,7 +153,7 @@ struct action_trace_v0 { EOSIO_REFLECT(action_trace_v0, action_ordinal, creator_action_ordinal, receipt, receiver, act, context_free, elapsed, console, account_ram_deltas, except, error_code); -using action_trace = std::variant; +using action_trace = variant; struct partial_transaction_v0 { abieos::time_point_sec expiration = {}; @@ -157,10 +170,13 @@ struct partial_transaction_v0 { EOSIO_REFLECT(partial_transaction_v0, expiration, ref_block_num, ref_block_prefix, max_net_usage_words, max_cpu_usage_ms, delay_sec, transaction_extensions, signatures, context_free_data); -using partial_transaction = std::variant; +using partial_transaction = variant; struct recurse_transaction_trace; +struct transaction_trace_v0; +using transaction_trace = variant; + struct transaction_trace_v0 { abieos::checksum256 id = {}; transaction_status status = {}; @@ -173,29 +189,13 @@ struct transaction_trace_v0 { std::optional account_ram_delta = {}; std::optional except = {}; std::optional error_code = {}; - std::vector failed_dtrx_trace = {}; + std::vector failed_dtrx_trace = {}; std::optional reserved_do_not_use = {}; }; EOSIO_REFLECT(transaction_trace_v0, id, status, cpu_usage_us, elapsed, net_usage_words, scheduled, action_traces, account_ram_delta, except, error_code, failed_dtrx_trace, reserved_do_not_use); -using transaction_trace = std::variant; - -struct recurse_transaction_trace { - transaction_trace recurse = {}; -}; - -template -eosio::result from_bin(recurse_transaction_trace& obj, S& stream) { - return from_bin(obj.recurse, stream); -} - -template -eosio::result to_bin(const recurse_transaction_trace& obj, S& stream) { - return to_bin(obj.recurse, stream); -} - struct producer_key { abieos::name producer_name = {}; abieos::public_key block_signing_key = {}; diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index a6d2a4b283..9c8fcd9e11 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -175,8 +175,7 @@ inline asset s2a(const char* s) { return convert(string_to_asset(s)); } * transaction should succeed. Otherwise it represents a string which should be * part of the error message. */ -inline void expect(const chain_types::transaction_trace& ttrace, const char* expected_except = nullptr) { - auto& tt = std::get<0>(ttrace); +inline void expect(const chain_types::transaction_trace& tt, const char* expected_except = nullptr) { if (expected_except) { if (tt.status == chain_types::transaction_status::executed) eosio::check(false, "transaction succeeded, but was expected to fail with: " + std::string(expected_except)); diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index bb1c3302ec..134f6744c5 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -283,7 +283,7 @@ chain_types::transaction_trace_v0 convert(const eosio::chain::transaction_trace& if (obj.error_code) result.error_code = *obj.error_code; if (obj.failed_dtrx_trace) - result.failed_dtrx_trace.push_back({ chain_types::recurse_transaction_trace{ convert(*obj.failed_dtrx_trace) } }); + result.failed_dtrx_trace.push_back({ convert(*obj.failed_dtrx_trace) }); return result; } From f70b3b51948168c9f0b2004df4abedcb8f85c0e2 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 17 Jan 2020 17:31:09 -0500 Subject: [PATCH 25/50] Replace abieos::input_buffer with eosio::input_stream. --- libraries/eosiolib/tester/eosio/chain_types.hpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libraries/eosiolib/tester/eosio/chain_types.hpp b/libraries/eosiolib/tester/eosio/chain_types.hpp index bfddc75459..03a68bc877 100644 --- a/libraries/eosiolib/tester/eosio/chain_types.hpp +++ b/libraries/eosiolib/tester/eosio/chain_types.hpp @@ -2,6 +2,9 @@ #include #include +#include +#include +#include #ifdef EOSIO_CDT_COMPILATION # include @@ -30,7 +33,7 @@ auto assert_native_to_bin(const T& t) { struct extension { uint16_t type = {}; - abieos::input_buffer data = {}; + eosio::input_stream data = {}; }; EOSIO_REFLECT(extension, type, data); @@ -131,7 +134,7 @@ struct action { abieos::name account = {}; abieos::name name = {}; std::vector authorization = {}; - abieos::input_buffer data = {}; + eosio::input_stream data = {}; }; EOSIO_REFLECT(action, account, name, authorization, data); @@ -164,7 +167,7 @@ struct partial_transaction_v0 { abieos::varuint32 delay_sec = {}; std::vector transaction_extensions = {}; std::vector signatures = {}; - std::vector context_free_data = {}; + std::vector context_free_data = {}; }; EOSIO_REFLECT(partial_transaction_v0, expiration, ref_block_num, ref_block_prefix, max_net_usage_words, @@ -172,8 +175,6 @@ EOSIO_REFLECT(partial_transaction_v0, expiration, ref_block_num, ref_block_prefi using partial_transaction = variant; -struct recurse_transaction_trace; - struct transaction_trace_v0; using transaction_trace = variant; @@ -221,8 +222,8 @@ EOSIO_REFLECT(transaction_receipt_header, status, cpu_usage_us, net_usage_words) struct packed_transaction { std::vector signatures = {}; uint8_t compression = {}; - abieos::input_buffer packed_context_free_data = {}; - abieos::input_buffer packed_trx = {}; + eosio::input_stream packed_context_free_data = {}; + eosio::input_stream packed_trx = {}; }; EOSIO_REFLECT(packed_transaction, signatures, compression, packed_context_free_data, packed_trx); From 45174ad5a915c351f9a4ce50b7e20cd53c1ab91c Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 22 Jan 2020 13:32:06 -0500 Subject: [PATCH 26/50] Use eosio types for transaction_trace. --- libraries/abieos | 2 +- .../eosiolib/tester/eosio/chain_types.hpp | 32 +--- libraries/eosiolib/tester/eosio/tester.hpp | 179 +++++++++++++----- 3 files changed, 132 insertions(+), 81 deletions(-) diff --git a/libraries/abieos b/libraries/abieos index 5af644ff96..b563a1c807 160000 --- a/libraries/abieos +++ b/libraries/abieos @@ -1 +1 @@ -Subproject commit 5af644ff9680e0377113e0e0b9f420b453019ff6 +Subproject commit b563a1c8076bd0b99587a0c4a76d950e1113eec0 diff --git a/libraries/eosiolib/tester/eosio/chain_types.hpp b/libraries/eosiolib/tester/eosio/chain_types.hpp index 03a68bc877..5e1b4dc8d6 100644 --- a/libraries/eosiolib/tester/eosio/chain_types.hpp +++ b/libraries/eosiolib/tester/eosio/chain_types.hpp @@ -104,31 +104,7 @@ struct action_receipt_v0 { EOSIO_REFLECT(action_receipt_v0, receiver, act_digest, global_sequence, recv_sequence, auth_sequence, code_sequence, abi_sequence); -template -struct variant : T { - constexpr variant() = default; - constexpr variant(T&& obj) : T(std::move(obj)) {} - constexpr variant(const T& obj) : T(obj) {} -}; - -template -eosio::result to_bin(const variant& obj, S& stream) { - uint8_t idx = 0; - OUTCOME_TRY(to_bin(idx, stream)); - return to_bin(static_cast(obj), stream); -} - -template -eosio::result from_bin(variant& obj, S& stream) { - uint8_t idx = 0; - OUTCOME_TRY(from_bin(idx, stream)); - if(idx != 0) { - return eosio::stream_error::bad_variant_index; - } - return from_bin(static_cast(obj), stream); -} - -using action_receipt = variant; +using action_receipt = std::variant; struct action { abieos::name account = {}; @@ -156,7 +132,7 @@ struct action_trace_v0 { EOSIO_REFLECT(action_trace_v0, action_ordinal, creator_action_ordinal, receipt, receiver, act, context_free, elapsed, console, account_ram_deltas, except, error_code); -using action_trace = variant; +using action_trace = std::variant; struct partial_transaction_v0 { abieos::time_point_sec expiration = {}; @@ -173,10 +149,10 @@ struct partial_transaction_v0 { EOSIO_REFLECT(partial_transaction_v0, expiration, ref_block_num, ref_block_prefix, max_net_usage_words, max_cpu_usage_ms, delay_sec, transaction_extensions, signatures, context_free_data); -using partial_transaction = variant; +using partial_transaction = std::variant; struct transaction_trace_v0; -using transaction_trace = variant; +using transaction_trace = std::variant; struct transaction_trace_v0 { abieos::checksum256 id = {}; diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index 9c8fcd9e11..18834f346f 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -170,29 +170,6 @@ inline symbol convert(abieos::symbol s) { return symbol(s.value); } inline asset convert(const abieos::asset& a) { return { a.amount, convert(a.sym) }; } inline asset s2a(const char* s) { return convert(string_to_asset(s)); } -/** - * Validates the status of a transaction. If expected_except is nullptr, then the - * transaction should succeed. Otherwise it represents a string which should be - * part of the error message. - */ -inline void expect(const chain_types::transaction_trace& tt, const char* expected_except = nullptr) { - if (expected_except) { - if (tt.status == chain_types::transaction_status::executed) - eosio::check(false, "transaction succeeded, but was expected to fail with: " + std::string(expected_except)); - if (!tt.except) - eosio::check(false, "transaction has no failure message. expected: " + std::string(expected_except)); - if (tt.except->find(expected_except) == std::string::npos) - eosio::check(false, "transaction failed with <<<" + *tt.except + ">>>, but was expected to fail with: <<<" + - expected_except + ">>>"); - } else { - if (tt.status == chain_types::transaction_status::executed) - return; - if (tt.except) - eosio::print(*tt.except, "\n"); - eosio::check(false, "transaction has status " + to_string(tt.status)); - } -} - // TODO: move struct tester_key_weight { eosio::public_key key = {}; @@ -227,6 +204,104 @@ struct tester_authority { EOSLIB_SERIALIZE(tester_authority, (threshold)(keys)(accounts)(waits)) }; +using chain_types::transaction_status; + +auto conversion_kind(chain_types::permission_level, permission_level) -> strict_conversion; +auto conversion_kind(chain_types::action, action) -> strict_conversion; + +struct account_auth_sequence { + name account = {}; + uint64_t sequence = {}; +}; + +auto conversion_kind(chain_types::account_auth_sequence, account_auth_sequence) -> strict_conversion; + +struct account_delta { + name account = {}; + int64_t delta = {}; +}; + +auto conversion_kind(chain_types::account_delta, account_delta) -> strict_conversion; + +template +void convert(const abieos::fixed_binary& src, eosio::fixed_bytes& dst, F&& f) { + dst = src.value; +} + +struct action_receipt { + name receiver = {}; + checksum256 act_digest = {}; + uint64_t global_sequence = {}; + uint64_t recv_sequence = {}; + std::vector auth_sequence = {}; + uint32_t code_sequence = {}; + uint32_t abi_sequence = {}; +}; + +template +void convert(const abieos::name& src, eosio::name& dst, F&&) { + dst.value = src.value; +} + +auto conversion_kind(chain_types::action_receipt_v0, action_receipt) -> strict_conversion; + +struct action_trace { + uint32_t action_ordinal = {}; + uint32_t creator_action_ordinal = {}; + std::optional receipt = {}; + name receiver = {}; + action act = {}; + bool context_free = {}; + int64_t elapsed = {}; + std::string console = {}; + std::vector account_ram_deltas = {}; + std::optional except = {}; + std::optional error_code = {}; +}; + +auto conversion_kind(chain_types::action_trace_v0, action_trace) -> strict_conversion; + +struct transaction_trace { + checksum256 id = {}; + transaction_status status = {}; + uint32_t cpu_usage_us = {}; + uint32_t net_usage_words = {}; + int64_t elapsed = {}; + uint64_t net_usage = {}; + bool scheduled = {}; + std::vector action_traces = {}; + std::optional account_ram_delta = {}; + std::optional except = {}; + std::optional error_code = {}; + std::vector failed_dtrx_trace = {}; +}; + +auto conversion_kind(chain_types::transaction_trace_v0, transaction_trace) -> narrowing_conversion; +auto serialize_as(const transaction_trace&) -> chain_types::transaction_trace; + +/** + * Validates the status of a transaction. If expected_except is nullptr, then the + * transaction should succeed. Otherwise it represents a string which should be + * part of the error message. + */ +inline void expect(const transaction_trace& tt, const char* expected_except = nullptr) { + if (expected_except) { + if (tt.status == chain_types::transaction_status::executed) + eosio::check(false, "transaction succeeded, but was expected to fail with: " + std::string(expected_except)); + if (!tt.except) + eosio::check(false, "transaction has no failure message. expected: " + std::string(expected_except)); + if (tt.except->find(expected_except) == std::string::npos) + eosio::check(false, "transaction failed with <<<" + *tt.except + ">>>, but was expected to fail with: <<<" + + expected_except + ">>>"); + } else { + if (tt.status == chain_types::transaction_status::executed) + return; + if (tt.except) + eosio::print(*tt.except, "\n"); + eosio::check(false, "transaction has status " + to_string(tt.status)); + } +} + /** * Manages a chain. * Only one test_chain can exist at a time. @@ -308,9 +383,9 @@ class test_chain { * Pushes a transaction onto the chain. If no block is currently pending, starts one. */ [[nodiscard]] - chain_types::transaction_trace push_transaction(const transaction& trx, const std::vector& keys, - const std::vector>& context_free_data = {}, - const std::vector& signatures = {}) { + transaction_trace push_transaction(const transaction& trx, const std::vector& keys, + const std::vector>& context_free_data = {}, + const std::vector& signatures = {}) { std::vector packed_trx = pack(trx); std::vector args; @@ -323,11 +398,11 @@ class test_chain { bin.resize(size); return bin.data(); }); - return check(convert_from_bin(bin)).value(); + return check(convert_from_bin(bin)).value(); } [[nodiscard]] - chain_types::transaction_trace push_transaction(const transaction& trx) { + transaction_trace push_transaction(const transaction& trx) { return push_transaction(trx, { default_priv_key }); } @@ -336,14 +411,14 @@ class test_chain { * * Validates the transaction status according to @ref eosio::expect. */ - chain_types::transaction_trace transact(std::vector&& actions, const std::vector& keys, - const char* expected_except = nullptr) { + transaction_trace transact(std::vector&& actions, const std::vector& keys, + const char* expected_except = nullptr) { auto trace = push_transaction(make_transaction(std::move(actions)), keys); expect(trace, expected_except); return trace; } - chain_types::transaction_trace transact(std::vector&& actions, const char* expected_except = nullptr) { + transaction_trace transact(std::vector&& actions, const char* expected_except = nullptr) { return transact(std::move(actions), { default_priv_key }, expected_except); } @@ -355,18 +430,18 @@ class test_chain { * If no block is currently pending, starts one. */ [[nodiscard]] - std::optional exec_deferred() { + std::optional exec_deferred() { std::vector bin; if (!internal_use_do_not_use::exec_deferred(id, [&](size_t size) { bin.resize(size); return bin.data(); })) return {}; - return check(convert_from_bin(bin)).value(); + return check(convert_from_bin(bin)).value(); } - chain_types::transaction_trace create_account(name ac, const public_key& pub_key, - const char* expected_except = nullptr) { + transaction_trace create_account(name ac, const public_key& pub_key, + const char* expected_except = nullptr) { tester_authority simple_auth{ .threshold = 1, .keys = { { pub_key, 1 } }, @@ -378,7 +453,7 @@ class test_chain { expected_except); } - chain_types::transaction_trace create_account(name ac, const char* expected_except = nullptr) { + transaction_trace create_account(name ac, const char* expected_except = nullptr) { return create_account(ac, convert(default_pub_key), expected_except); } @@ -389,8 +464,8 @@ class test_chain { * @param is_priv Determines whether the contract should be privileged. Defaults to false. * @param expected_except Used to validate the transaction status according to @ref eosio::expect. */ - chain_types::transaction_trace create_code_account(name account, const public_key& pub_key, bool is_priv = false, - const char* expected_except = nullptr) { + transaction_trace create_code_account(name account, const public_key& pub_key, bool is_priv = false, + const char* expected_except = nullptr) { tester_authority simple_auth{ .threshold = 1, .keys = { { pub_key, 1 } }, @@ -411,16 +486,16 @@ class test_chain { expected_except); } - chain_types::transaction_trace create_code_account(name ac, const public_key& pub_key, const char* expected_except) { + transaction_trace create_code_account(name ac, const public_key& pub_key, const char* expected_except) { return create_code_account(ac, pub_key, false, expected_except); } - chain_types::transaction_trace create_code_account(name ac, bool is_priv = false, - const char* expected_except = nullptr) { + transaction_trace create_code_account(name ac, bool is_priv = false, + const char* expected_except = nullptr) { return create_code_account(ac, convert(default_pub_key), is_priv, expected_except); } - chain_types::transaction_trace create_code_account(name ac, const char* expected_except) { + transaction_trace create_code_account(name ac, const char* expected_except) { return create_code_account(ac, convert(default_pub_key), false, expected_except); } @@ -428,7 +503,7 @@ class test_chain { * Set the code for an account. * Validates the transaction status as with @ref eosio::expect. */ - chain_types::transaction_trace set_code(name ac, const char* filename, const char* expected_except = nullptr) { + transaction_trace set_code(name ac, const char* filename, const char* expected_except = nullptr) { return transact({ action{ { { ac, "active"_n } }, "eosio"_n, "setcode"_n, @@ -440,15 +515,15 @@ class test_chain { * Creates a new token. * The eosio.token contract should be deployed on the @c contract account. */ - chain_types::transaction_trace create_token(name contract, name signer, name issuer, asset maxsupply, - const char* expected_except = nullptr) { + transaction_trace create_token(name contract, name signer, name issuer, asset maxsupply, + const char* expected_except = nullptr) { return transact( { action{ { { signer, "active"_n } }, contract, "create"_n, std::make_tuple(issuer, maxsupply) } }, expected_except); } - chain_types::transaction_trace issue(const name& contract, const name& issuer, const asset& amount, - const char* expected_except = nullptr) { + transaction_trace issue(const name& contract, const name& issuer, const asset& amount, + const char* expected_except = nullptr) { return transact({ action{ { { issuer, "active"_n } }, contract, "issue"_n, @@ -456,17 +531,17 @@ class test_chain { expected_except); } - chain_types::transaction_trace transfer(const name& contract, const name& from, const name& to, const asset& amount, - const std::string& memo = "", const char* expected_except = nullptr) { + transaction_trace transfer(const name& contract, const name& from, const name& to, const asset& amount, + const std::string& memo = "", const char* expected_except = nullptr) { return transact( { action{ { { from, "active"_n } }, contract, "transfer"_n, std::make_tuple(from, to, amount, memo) } }, expected_except); } - chain_types::transaction_trace issue_and_transfer(const name& contract, const name& issuer, const name& to, - const asset& amount, const std::string& memo = "", - const char* expected_except = nullptr) { + transaction_trace issue_and_transfer(const name& contract, const name& issuer, const name& to, + const asset& amount, const std::string& memo = "", + const char* expected_except = nullptr) { return transact( { action{ { { issuer, "active"_n } }, From aca577272ac7ebf3302360960780337cd6980a21 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 22 Jan 2020 14:31:47 -0500 Subject: [PATCH 27/50] Fully remove chain_types from the public API of the tester. --- libraries/abieos | 2 +- libraries/eosiolib/tester/eosio/tester.hpp | 25 ++++++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/libraries/abieos b/libraries/abieos index b563a1c807..3fb725a49b 160000 --- a/libraries/abieos +++ b/libraries/abieos @@ -1 +1 @@ -Subproject commit b563a1c8076bd0b99587a0c4a76d950e1113eec0 +Subproject commit 3fb725a49b3ef9f9aed3bd24df0eecc2bd6515d9 diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index 18834f346f..e8cbc0b2e0 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -279,6 +279,17 @@ struct transaction_trace { auto conversion_kind(chain_types::transaction_trace_v0, transaction_trace) -> narrowing_conversion; auto serialize_as(const transaction_trace&) -> chain_types::transaction_trace; +auto conversion_kind(abieos::block_timestamp, block_timestamp) -> strict_conversion; + +struct block_info { + uint32_t block_num = {}; + checksum256 block_id = {}; + block_timestamp timestamp; +}; + +auto conversion_kind(chain_types::block_info, block_info) -> strict_conversion; +auto serialize_as(block_info) -> chain_types::block_info; + /** * Validates the status of a transaction. If expected_except is nullptr, then the * transaction should succeed. Otherwise it represents a string which should be @@ -286,7 +297,7 @@ auto serialize_as(const transaction_trace&) -> chain_types::transaction_trace; */ inline void expect(const transaction_trace& tt, const char* expected_except = nullptr) { if (expected_except) { - if (tt.status == chain_types::transaction_status::executed) + if (tt.status == transaction_status::executed) eosio::check(false, "transaction succeeded, but was expected to fail with: " + std::string(expected_except)); if (!tt.except) eosio::check(false, "transaction has no failure message. expected: " + std::string(expected_except)); @@ -294,7 +305,7 @@ inline void expect(const transaction_trace& tt, const char* expected_except = nu eosio::check(false, "transaction failed with <<<" + *tt.except + ">>>, but was expected to fail with: <<<" + expected_except + ">>>"); } else { - if (tt.status == chain_types::transaction_status::executed) + if (tt.status == transaction_status::executed) return; if (tt.except) eosio::print(*tt.except, "\n"); @@ -310,7 +321,7 @@ inline void expect(const transaction_trace& tt, const char* expected_except = nu class test_chain { private: uint32_t id; - std::optional head_block_info; + std::optional head_block_info; public: abieos::public_key default_pub_key = string_to_public_key("EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"); @@ -347,23 +358,23 @@ class test_chain { internal_use_do_not_use::finish_block(id); } - const chain_types::block_info& get_head_block_info() { + const block_info& get_head_block_info() { if (!head_block_info) { std::vector bin; internal_use_do_not_use::get_head_block_info(id, [&](size_t size) { bin.resize(size); return bin.data(); }); - head_block_info = check(convert_from_bin(bin)).value(); + head_block_info = check(convert_from_bin(bin)).value(); } return *head_block_info; } void fill_tapos(transaction& t, uint32_t expire_sec = 1) { auto& info = get_head_block_info(); - t.expiration = time_point_sec(((abieos::time_point)info.timestamp).microseconds / 1'000'000 + expire_sec); + t.expiration = time_point_sec(info.timestamp) + expire_sec; t.ref_block_num = info.block_num; - memcpy(&t.ref_block_prefix, info.block_id.value.data() + 8, sizeof(t.ref_block_prefix)); + memcpy(&t.ref_block_prefix, info.block_id.extract_as_byte_array().data() + 8, sizeof(t.ref_block_prefix)); } transaction make_transaction() { From 6ca7ab14d63ce7f46b25e311f889c0120861ec1f Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 23 Jan 2020 17:18:06 -0500 Subject: [PATCH 28/50] action::data_as should be const --- libraries/eosiolib/contracts/eosio/action.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/eosiolib/contracts/eosio/action.hpp b/libraries/eosiolib/contracts/eosio/action.hpp index 44d81e233d..47b387a696 100644 --- a/libraries/eosiolib/contracts/eosio/action.hpp +++ b/libraries/eosiolib/contracts/eosio/action.hpp @@ -363,7 +363,7 @@ namespace eosio { * @return the action data */ template - T data_as() { + T data_as() const { return unpack( &data[0], data.size() ); } From 692ebc4ec75375547875672f940b2b7848d19f29 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 23 Jan 2020 17:38:26 -0500 Subject: [PATCH 29/50] Start adding tests for the tester. Only start_block is tested. --- libraries/eosiolib/core/eosio/fixed_bytes.hpp | 4 +- .../eosiolib/tester/eosio/chain_types.hpp | 10 --- libraries/eosiolib/tester/eosio/tester.hpp | 18 +++-- tests/CMakeLists.txt | 13 ++++ tests/tester/CMakeLists.txt | 17 +++++ tests/tester/tester.cpp | 70 +++++++++++++++++++ 6 files changed, 116 insertions(+), 16 deletions(-) create mode 100644 tests/tester/CMakeLists.txt create mode 100644 tests/tester/tester.cpp diff --git a/libraries/eosiolib/core/eosio/fixed_bytes.hpp b/libraries/eosiolib/core/eosio/fixed_bytes.hpp index 97cbf40bb8..13c08b4d67 100644 --- a/libraries/eosiolib/core/eosio/fixed_bytes.hpp +++ b/libraries/eosiolib/core/eosio/fixed_bytes.hpp @@ -363,7 +363,7 @@ namespace eosio { * @return DataStream& - Reference to the datastream */ template - inline DataStream& operator<<(DataStream& ds, const fixed_bytes& d) { + inline datastream& operator<<(datastream& ds, const fixed_bytes& d) { auto arr = d.extract_as_byte_array(); ds.write( (const char*)arr.data(), arr.size() ); return ds; @@ -379,7 +379,7 @@ namespace eosio { * @return DataStream& - Reference to the datastream */ template - inline DataStream& operator>>(DataStream& ds, fixed_bytes& d) { + inline datastream& operator>>(datastream& ds, fixed_bytes& d) { std::array arr; ds.read( (char*)arr.data(), arr.size() ); d = fixed_bytes( arr ); diff --git a/libraries/eosiolib/tester/eosio/chain_types.hpp b/libraries/eosiolib/tester/eosio/chain_types.hpp index 5e1b4dc8d6..5e228bcec8 100644 --- a/libraries/eosiolib/tester/eosio/chain_types.hpp +++ b/libraries/eosiolib/tester/eosio/chain_types.hpp @@ -21,16 +21,6 @@ namespace chain_types { [[noreturn]] inline void report_error(const std::string& s) { throw std::runtime_error(s); } #endif -template -T assert_bin_to_native(const std::vector& bin) { - return eosio::check(eosio::convert_from_bin(bin)).value(); -} - -template -auto assert_native_to_bin(const T& t) { - return eosio::check(eosio::convert_to_bin(t)).value(); -} - struct extension { uint16_t type = {}; eosio::input_stream data = {}; diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index e8cbc0b2e0..f1efc8c6d3 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -313,6 +313,13 @@ inline void expect(const transaction_trace& tt, const char* expected_except = nu } } +template +std::ostream& operator<<(std::ostream& os, const fixed_bytes& d) { + auto arr = d.extract_as_byte_array(); + abieos::hex(arr.begin(), arr.end(), std::ostreambuf_iterator(os.rdbuf())); + return os; +} + /** * Manages a chain. * Only one test_chain can exist at a time. @@ -337,12 +344,15 @@ class test_chain { /** * Start a new pending block. If a block is currently pending, finishes it first. + * May push additional blocks if any time is skipped. * * @param skip_milliseconds The amount of time to skip in addition to the 500 ms block time. + * truncated to a multiple of 500 ms. */ void start_block(int64_t skip_miliseconds = 0) { head_block_info.reset(); - if (skip_miliseconds > 500) { + if (skip_miliseconds >= 500) { + // Guarantee that there is a recent block for fill_tapos to use. internal_use_do_not_use::start_block(id, skip_miliseconds - 500); internal_use_do_not_use::start_block(id, 0); } else { @@ -350,9 +360,9 @@ class test_chain { } } - /** - * Finish the current pending block. If no block is pending, creates an empty block. - */ + /** + * Finish the current pending block. If no block is pending, creates an empty block. + */ void finish_block() { head_block_info.reset(); internal_use_do_not_use::finish_block(id); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9094d77b7c..f5aaeed248 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -46,3 +46,16 @@ if (eosio_FOUND AND EOSIO_RUN_INTEGRATION_TESTS) add_test(integration_tests ${CMAKE_BINARY_DIR}/tests/integration/integration_tests) set_property(TEST integration_tests PROPERTY LABELS integration_tests) endif() + +ExternalProject_Add( + TesterTests + SOURCE_DIR "${CMAKE_SOURCE_DIR}/tests/tester" + BINARY_DIR "${CMAKE_BINARY_DIR}/tests/tester" + CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_BINARY_DIR}/lib/cmake/eosio.cdt/EosioWasmToolchain.cmake -DEOSIO_CDT_BIN=${CMAKE_BINARY_DIR}/lib/cmake/eosio.cdt/ -DBASE_BINARY_DIR=${CMAKE_BINARY_DIR} -D__APPLE=${APPLE} + UPDATE_COMMAND "" + PATCH_COMMAND "" + TEST_COMMAND "" + INSTALL_COMMAND "" + BUILD_ALWAYS 1 + DEPENDS tester EosioTools EosioWasmLibraries +) diff --git a/tests/tester/CMakeLists.txt b/tests/tester/CMakeLists.txt new file mode 100644 index 0000000000..a0c749e7c3 --- /dev/null +++ b/tests/tester/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.5) + +project(tests) + +set(EOSIO_WASM_OLD_BEHAVIOR "off") +find_package(eosio.cdt) + +function(add_test TARGET SRC) + add_executable(${TARGET} ${SRC}) + target_link_libraries(${TARGET} -ftester -stack-size=65536) + target_compile_options(${TARGET} PUBLIC -ftester -Os) + set_target_properties(${TARGET} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +endfunction() + +add_test(tester tester.cpp) diff --git a/tests/tester/tester.cpp b/tests/tester/tester.cpp new file mode 100644 index 0000000000..b25eb7a524 --- /dev/null +++ b/tests/tester/tester.cpp @@ -0,0 +1,70 @@ +#include +#include + +#define BOOST_TEST_MAIN +#include + +eosio::checksum256 make_checksum256(std::string_view src) { + std::array buf; + eosio::unhex(buf.begin(), src.begin(), src.end()); + return eosio::checksum256(buf); +} + +BOOST_FIXTURE_TEST_CASE(start_finish_block, eosio::test_chain) +{ + { + eosio::block_info info = get_head_block_info(); + BOOST_TEST(info.block_num == 1); + BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("00000001F9175EC5AE6DA2F9FE99481374AC391603400534E0562E9124325F75")); + BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304000)); + } + start_block(); + { + eosio::block_info info = get_head_block_info(); + BOOST_TEST(info.block_num == 2); + BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("00000002273D84013E8FC942B2F11646B07E8E31774951C5CE19ABD663A1999B")); + BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304001)); + } + finish_block(); + { + eosio::block_info info = get_head_block_info(); + BOOST_TEST(info.block_num == 3); + BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("00000003082FC6F82362072BA12D953FF3A9F0F4AC6FEC83072417662212E993")); + BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304002)); + } + start_block(); // no pending block to finish + { + eosio::block_info info = get_head_block_info(); + BOOST_TEST(info.block_num == 3); + BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("00000003082FC6F82362072BA12D953FF3A9F0F4AC6FEC83072417662212E993")); + BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304002)); + } + start_block(499); // finish block 4 + finish_block(); + { + eosio::block_info info = get_head_block_info(); + BOOST_TEST(info.block_num == 5); + BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("00000005D4C5FF96B4FBB319E1CB81E581B518AC8133B490C1BB78216B14A0B5")); + BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304004)); + } + start_block(500); + finish_block(); + { + eosio::block_info info = get_head_block_info(); + BOOST_TEST(info.block_num == 7); + BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("000000075DC2520236FAF327E55690B73039EA1AFB6D522C86CBD2A053DB167E")); + BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304006)); + } +} + +BOOST_FIXTURE_TEST_CASE(start_block_skip, eosio::test_chain) { + eosio::action empty{ { { "eosio"_n, "active"_n } }, "eosio"_n, eosio::name(), std::tuple() }; + start_block(500); + transact({empty}); + start_block(1000); + transact({empty}); + start_block(1500); + transact({empty}); + start_block(1000000); + transact({empty}); +} From 599aac1addb546e1bed66fad92c012e195c90f16 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Tue, 11 Feb 2020 14:27:17 -0500 Subject: [PATCH 30/50] Port to the current abieos refactor branch. - A number of types were replaced with the version in abieos. - Use style includes so that #include_next works. --- libraries/abieos | 2 +- libraries/eosiolib/CMakeLists.txt | 38 +- libraries/eosiolib/contracts/eosio/action.hpp | 10 +- .../contracts/eosio/producer_schedule.hpp | 5 +- libraries/eosiolib/contracts/eosio/system.hpp | 8 +- .../eosiolib/contracts/eosio/transaction.hpp | 4 +- libraries/eosiolib/core/eosio/asset.hpp | 498 +------------ libraries/eosiolib/core/eosio/crypto.hpp | 222 +----- libraries/eosiolib/core/eosio/datastream.hpp | 665 +----------------- libraries/eosiolib/core/eosio/fixed_bytes.hpp | 385 +--------- libraries/eosiolib/core/eosio/name.hpp | 286 +------- libraries/eosiolib/core/eosio/powers.hpp | 2 +- libraries/eosiolib/core/eosio/serialize.hpp | 45 +- libraries/eosiolib/core/eosio/string.hpp | 4 +- libraries/eosiolib/core/eosio/symbol.hpp | 449 +----------- libraries/eosiolib/core/eosio/time.hpp | 211 ------ libraries/eosiolib/core/eosio/varint.hpp | 465 ------------ libraries/eosiolib/crypto.cpp | 4 +- libraries/eosiolib/eosiolib.cpp | 1 - .../eosiolib/tester/eosio/chain_types.hpp | 73 +- libraries/eosiolib/tester/eosio/tester.hpp | 103 ++- .../eosiolib/tester/tester_intrinsics.cpp | 5 +- libraries/native/CMakeLists.txt | 2 +- tests/unit/asset_tests.cpp | 72 +- tests/unit/datastream_tests.cpp | 18 +- tests/unit/name_tests.cpp | 54 -- tests/unit/serialize_tests.cpp | 10 +- tests/unit/symbol_tests.cpp | 24 +- tests/unit/varint_tests.cpp | 4 +- tools/include/compiler_options.hpp.in | 16 +- tools/tester/src/eosio-tester.cpp | 47 +- 31 files changed, 299 insertions(+), 3433 deletions(-) delete mode 100644 libraries/eosiolib/core/eosio/time.hpp delete mode 100644 libraries/eosiolib/core/eosio/varint.hpp diff --git a/libraries/abieos b/libraries/abieos index 3fb725a49b..8f371b7835 160000 --- a/libraries/abieos +++ b/libraries/abieos @@ -1 +1 @@ -Subproject commit 3fb725a49b3ef9f9aed3bd24df0eecc2bd6515d9 +Subproject commit 8f371b783557d26ce3706cbe43c92ccea599ba0f diff --git a/libraries/eosiolib/CMakeLists.txt b/libraries/eosiolib/CMakeLists.txt index 5391f63624..018e949c1f 100644 --- a/libraries/eosiolib/CMakeLists.txt +++ b/libraries/eosiolib/CMakeLists.txt @@ -21,8 +21,28 @@ add_library(eosio_cmem add_library(eosio_tester tester/tester_intrinsics.cpp tester/fpconv.c + ${CMAKE_SOURCE_DIR}/abieos/src/crypto.cpp ${HEADERS}) +set(std_includes ${CMAKE_SOURCE_DIR}/libc++/libcxx/include + ${CMAKE_SOURCE_DIR}/libc/musl/include + ${CMAKE_SOURCE_DIR}/libc/musl/src/internal + ${CMAKE_SOURCE_DIR}/libc/musl/src/crypt + ${CMAKE_SOURCE_DIR}/libc/musl/arch/eos) +set(abieos_includes ${CMAKE_SOURCE_DIR}/abieos/include + ${CMAKE_SOURCE_DIR}/abieos/src + ${CMAKE_SOURCE_DIR}/abieos/external/outcome/single-header + ${CMAKE_SOURCE_DIR}/abieos/external/date/include + ${CMAKE_SOURCE_DIR}/abieos/external/rapidjson/include) + +target_include_directories(eosio_tester PUBLIC + ${std_includes} + ${CMAKE_SOURCE_DIR}/eosiolib/tester + ${CMAKE_SOURCE_DIR}/eosiolib/core + ${CMAKE_SOURCE_DIR}/eosiolib/contract + ${abieos_includes} + ${CMAKE_SOURCE_DIR}/boost/include) + set(tester_includes -I${CMAKE_SOURCE_DIR}/libc++/libcxx/include -I${CMAKE_SOURCE_DIR}/libc/musl/include -I${CMAKE_SOURCE_DIR}/libc/musl/src/internal @@ -57,12 +77,18 @@ add_native_library(native_eosio set_target_properties(eosio_malloc PROPERTIES LINKER_LANGUAGE C) target_include_directories(eosio PUBLIC - ${CMAKE_SOURCE_DIR}/libc/musl/include - ${CMAKE_SOURCE_DIR}/libc/musl/src/internal - ${CMAKE_SOURCE_DIR}/libc/musl/src/crypt - ${CMAKE_SOURCE_DIR}/libc/musl/arch/eos - ${CMAKE_SOURCE_DIR}/libc++/libcxx/include + ${std_includes} ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/eosiolib/core + ${CMAKE_SOURCE_DIR}/eosiolib/contract + ${abieos_includes} + ${CMAKE_SOURCE_DIR}/boost/include) + +target_include_directories(native_eosio PUBLIC + ${std_includes} + ${CMAKE_SOURCE_DIR}/eosiolib/core + ${CMAKE_SOURCE_DIR}/eosiolib/contract + ${abieos_includes} ${CMAKE_SOURCE_DIR}/boost/include) target_link_libraries( eosio c c++ ) @@ -77,7 +103,7 @@ add_custom_command( TARGET native_eosio POST_BUILD COMMAND ${CMAKE_COMMAND} -E c add_custom_command( TARGET eosio_tester POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/crt0.o ${BASE_BINARY_DIR}/lib ) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../eosiolib DESTINATION ${BASE_BINARY_DIR}/include FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") -file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/include/eosio DESTINATION ${BASE_BINARY_DIR}/include/eosiolib/tester FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/include/eosio DESTINATION ${BASE_BINARY_DIR}/include/abieos FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp") file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos.h DESTINATION ${BASE_BINARY_DIR}/include/abieos) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos.hpp DESTINATION ${BASE_BINARY_DIR}/include/abieos) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../abieos/src/abieos_numeric.hpp DESTINATION ${BASE_BINARY_DIR}/include/abieos) diff --git a/libraries/eosiolib/contracts/eosio/action.hpp b/libraries/eosiolib/contracts/eosio/action.hpp index 47b387a696..2a843d39fc 100644 --- a/libraries/eosiolib/contracts/eosio/action.hpp +++ b/libraries/eosiolib/contracts/eosio/action.hpp @@ -5,11 +5,11 @@ #pragma once #include -#include "../../core/eosio/serialize.hpp" -#include "../../core/eosio/datastream.hpp" -#include "../../core/eosio/name.hpp" -#include "../../core/eosio/ignore.hpp" -#include "../../core/eosio/time.hpp" +#include +#include +#include +#include +#include #include #include diff --git a/libraries/eosiolib/contracts/eosio/producer_schedule.hpp b/libraries/eosiolib/contracts/eosio/producer_schedule.hpp index 0c1c800fc4..3fc25eac5d 100644 --- a/libraries/eosiolib/contracts/eosio/producer_schedule.hpp +++ b/libraries/eosiolib/contracts/eosio/producer_schedule.hpp @@ -1,7 +1,8 @@ #pragma once #include -#include "../../core/eosio/name.hpp" -#include "../../core/eosio/crypto.hpp" +#include +#include +#include namespace eosio { diff --git a/libraries/eosiolib/contracts/eosio/system.hpp b/libraries/eosiolib/contracts/eosio/system.hpp index 5c5c21926b..b303d6c1cd 100644 --- a/libraries/eosiolib/contracts/eosio/system.hpp +++ b/libraries/eosiolib/contracts/eosio/system.hpp @@ -3,10 +3,10 @@ * @copyright defined in eos/LICENSE */ #pragma once -#include "../../core/eosio/time.hpp" -#include "../../core/eosio/check.hpp" -#include "../../core/eosio/fixed_bytes.hpp" -#include "../../core/eosio/name.hpp" +#include +#include +#include +#include namespace eosio { namespace internal_use_do_not_use { diff --git a/libraries/eosiolib/contracts/eosio/transaction.hpp b/libraries/eosiolib/contracts/eosio/transaction.hpp index b1306ddfca..7735d13a4c 100644 --- a/libraries/eosiolib/contracts/eosio/transaction.hpp +++ b/libraries/eosiolib/contracts/eosio/transaction.hpp @@ -5,8 +5,8 @@ #pragma once #include "action.hpp" #include "system.hpp" -#include "../../core/eosio/time.hpp" -#include "../../core/eosio/serialize.hpp" +#include +#include #include diff --git a/libraries/eosiolib/core/eosio/asset.hpp b/libraries/eosiolib/core/eosio/asset.hpp index 8ffd57704d..085fd03da3 100644 --- a/libraries/eosiolib/core/eosio/asset.hpp +++ b/libraries/eosiolib/core/eosio/asset.hpp @@ -1,498 +1,16 @@ #pragma once -#include "serialize.hpp" -#include "print.hpp" -#include "check.hpp" -#include "symbol.hpp" - -#include -#include +#include_next +#include namespace eosio { - char* write_decimal( char* begin, char* end, bool dry_run, uint64_t number, uint8_t num_decimal_places, bool negative ); - - /** - * @defgroup asset Asset - * @ingroup core - * @brief Defines C++ API for managing assets - */ - - /** - * Stores information for owner of asset - * - * @ingroup asset - */ - struct asset { - /** - * The amount of the asset - */ - int64_t amount = 0; - - /** - * The symbol name of the asset - */ - symbol symbol; - - /** - * Maximum amount possible for this asset. It's capped to 2^62 - 1 - */ - static constexpr int64_t max_amount = (1LL << 62) - 1; - - asset() {} - - /** - * Construct a new asset given the symbol name and the amount - * - * @param a - The amount of the asset - * @param s - The name of the symbol - */ - asset( int64_t a, class symbol s ) - :amount(a),symbol{s} - { - eosio::check( is_amount_within_range(), "magnitude of asset amount must be less than 2^62" ); - eosio::check( symbol.is_valid(), "invalid symbol name" ); - } - - /** - * Check if the amount doesn't exceed the max amount - * - * @return true - if the amount doesn't exceed the max amount - * @return false - otherwise - */ - bool is_amount_within_range()const { return -max_amount <= amount && amount <= max_amount; } - - /** - * Check if the asset is valid. %A valid asset has its amount <= max_amount and its symbol name valid - * - * @return true - if the asset is valid - * @return false - otherwise - */ - bool is_valid()const { return is_amount_within_range() && symbol.is_valid(); } - - /** - * Set the amount of the asset - * - * @param a - New amount for the asset - */ - void set_amount( int64_t a ) { - amount = a; - eosio::check( is_amount_within_range(), "magnitude of asset amount must be less than 2^62" ); - } - - /// @cond OPERATORS - - /** - * Unary minus operator - * - * @return asset - New asset with its amount is the negative amount of this asset - */ - asset operator-()const { - asset r = *this; - r.amount = -r.amount; - return r; - } - - /** - * Subtraction assignment operator - * - * @param a - Another asset to subtract this asset with - * @return asset& - Reference to this asset - * @post The amount of this asset is subtracted by the amount of asset a - */ - asset& operator-=( const asset& a ) { - eosio::check( a.symbol == symbol, "attempt to subtract asset with different symbol" ); - amount -= a.amount; - eosio::check( -max_amount <= amount, "subtraction underflow" ); - eosio::check( amount <= max_amount, "subtraction overflow" ); - return *this; - } - - /** - * Addition Assignment operator - * - * @param a - Another asset to subtract this asset with - * @return asset& - Reference to this asset - * @post The amount of this asset is added with the amount of asset a - */ - asset& operator+=( const asset& a ) { - eosio::check( a.symbol == symbol, "attempt to add asset with different symbol" ); - amount += a.amount; - eosio::check( -max_amount <= amount, "addition underflow" ); - eosio::check( amount <= max_amount, "addition overflow" ); - return *this; - } - - /** - * Addition operator - * - * @param a - The first asset to be added - * @param b - The second asset to be added - * @return asset - New asset as the result of addition - */ - inline friend asset operator+( const asset& a, const asset& b ) { - asset result = a; - result += b; - return result; - } - - /** - * Subtraction operator - * - * @param a - The asset to be subtracted - * @param b - The asset used to subtract - * @return asset - New asset as the result of subtraction of a with b - */ - inline friend asset operator-( const asset& a, const asset& b ) { - asset result = a; - result -= b; - return result; - } - - /** - * Multiplication assignment operator, with a number - * - * @details Multiplication assignment operator. Multiply the amount of this asset with a number and then assign the value to itself. - * @param a - The multiplier for the asset's amount - * @return asset - Reference to this asset - * @post The amount of this asset is multiplied by a - */ - asset& operator*=( int64_t a ) { - int128_t tmp = (int128_t)amount * (int128_t)a; - eosio::check( tmp <= max_amount, "multiplication overflow" ); - eosio::check( tmp >= -max_amount, "multiplication underflow" ); - amount = (int64_t)tmp; - return *this; - } - - /** - * Multiplication operator, with a number proceeding - * - * @brief Multiplication operator, with a number proceeding - * @param a - The asset to be multiplied - * @param b - The multiplier for the asset's amount - * @return asset - New asset as the result of multiplication - */ - friend asset operator*( const asset& a, int64_t b ) { - asset result = a; - result *= b; - return result; - } - - - /** - * Multiplication operator, with a number preceeding - * - * @param a - The multiplier for the asset's amount - * @param b - The asset to be multiplied - * @return asset - New asset as the result of multiplication - */ - friend asset operator*( int64_t b, const asset& a ) { - asset result = a; - result *= b; - return result; - } - - /** - * @brief Division assignment operator, with a number - * - * @details Division assignment operator. Divide the amount of this asset with a number and then assign the value to itself. - * @param a - The divisor for the asset's amount - * @return asset - Reference to this asset - * @post The amount of this asset is divided by a - */ - asset& operator/=( int64_t a ) { - eosio::check( a != 0, "divide by zero" ); - eosio::check( !(amount == std::numeric_limits::min() && a == -1), "signed division overflow" ); - amount /= a; - return *this; - } - - /** - * Division operator, with a number proceeding - * - * @param a - The asset to be divided - * @param b - The divisor for the asset's amount - * @return asset - New asset as the result of division - */ - friend asset operator/( const asset& a, int64_t b ) { - asset result = a; - result /= b; - return result; - } - - /** - * Division operator, with another asset - * - * @param a - The asset which amount acts as the dividend - * @param b - The asset which amount acts as the divisor - * @return int64_t - the resulted amount after the division - * @pre Both asset must have the same symbol - */ - friend int64_t operator/( const asset& a, const asset& b ) { - eosio::check( b.amount != 0, "divide by zero" ); - eosio::check( a.symbol == b.symbol, "comparison of assets with different symbols is not allowed" ); - return a.amount / b.amount; - } - - /** - * Equality operator - * - * @param a - The first asset to be compared - * @param b - The second asset to be compared - * @return true - if both asset has the same amount - * @return false - otherwise - * @pre Both asset must have the same symbol - */ - friend bool operator==( const asset& a, const asset& b ) { - eosio::check( a.symbol == b.symbol, "comparison of assets with different symbols is not allowed" ); - return a.amount == b.amount; - } - - /** - * Inequality operator - * - * @param a - The first asset to be compared - * @param b - The second asset to be compared - * @return true - if both asset doesn't have the same amount - * @return false - otherwise - * @pre Both asset must have the same symbol - */ - friend bool operator!=( const asset& a, const asset& b ) { - return !( a == b); - } - - /** - * Less than operator - * - * @param a - The first asset to be compared - * @param b - The second asset to be compared - * @return true - if the first asset's amount is less than the second asset amount - * @return false - otherwise - * @pre Both asset must have the same symbol - */ - friend bool operator<( const asset& a, const asset& b ) { - eosio::check( a.symbol == b.symbol, "comparison of assets with different symbols is not allowed" ); - return a.amount < b.amount; - } - - /** - * Less or equal to operator - * - * @param a - The first asset to be compared - * @param b - The second asset to be compared - * @return true - if the first asset's amount is less or equal to the second asset amount - * @return false - otherwise - * @pre Both asset must have the same symbol - */ - friend bool operator<=( const asset& a, const asset& b ) { - eosio::check( a.symbol == b.symbol, "comparison of assets with different symbols is not allowed" ); - return a.amount <= b.amount; - } - - /** - * Greater than operator - * - * @param a - The first asset to be compared - * @param b - The second asset to be compared - * @return true - if the first asset's amount is greater than the second asset amount - * @return false - otherwise - * @pre Both asset must have the same symbol - */ - friend bool operator>( const asset& a, const asset& b ) { - eosio::check( a.symbol == b.symbol, "comparison of assets with different symbols is not allowed" ); - return a.amount > b.amount; - } - - /** - * Greater or equal to operator - * - * @param a - The first asset to be compared - * @param b - The second asset to be compared - * @return true - if the first asset's amount is greater or equal to the second asset amount - * @return false - otherwise - * @pre Both asset must have the same symbol - */ - friend bool operator>=( const asset& a, const asset& b ) { - eosio::check( a.symbol == b.symbol, "comparison of assets with different symbols is not allowed" ); - return a.amount >= b.amount; - } - - /// @endcond - - /** - * Writes the asset as a string to the provided char buffer - * - * @brief Writes the asset as a string to the provided char buffer - * @pre is_valid() == true - * @pre The range [begin, end) must be a valid range of memory to write to. - * @param begin - The start of the char buffer - * @param end - Just past the end of the char buffer - * @param dry_run - If true, do not actually write anything into the range. - * @return char* - Just past the end of the last character that would be written assuming dry_run == false and end was large enough to provide sufficient space. (Meaning only applies if returned pointer >= begin.) - * @post If the output string fits within the range [begin, end) and dry_run == false, the range [begin, returned pointer) contains the string representation of the asset. Nothing is written if dry_run == true or returned pointer > end (insufficient space) or if returned pointer < begin (overflow in calculating desired end). - */ - char* write_as_string( char* begin, char* end, bool dry_run = false )const { - bool negative = (amount < 0); - uint64_t abs_amount = static_cast(negative ? -amount : amount); - // 0 <= abs_amount <= std::numeric_limits::max() < 10^19 < std::numeric_limits::max() - - uint8_t precision = symbol.precision(); - - int sufficient_size = std::max(static_cast(precision), 19) + 11; - if( dry_run || (begin + sufficient_size < begin) || (begin + sufficient_size > end) ) { - char* start_of_symbol = write_decimal( begin, end, true, abs_amount, precision, negative ) + 1; - char* actual_end = symbol.code().write_as_string( start_of_symbol, end, true ); - if( dry_run || (actual_end < begin) || (actual_end > end) ) return actual_end; - } - - char* end_of_number = write_decimal( begin, end, false, abs_amount, precision, negative ); - *(end_of_number) = ' '; - - return symbol.code().write_as_string( end_of_number + 1, end ); - } - - /** - * %asset to std::string - * - * @brief %asset to std::string - */ - std::string to_string()const { - int buffer_size = std::max(static_cast(symbol.precision()), 19) + 11; - char buffer[buffer_size]; - char* end = write_as_string( buffer, buffer + buffer_size ); - check( end <= buffer + buffer_size, "insufficient space in buffer" ); // should never fail - - return {buffer, end}; - } - - /** - * %Print the asset - * - * @brief %Print the asset - */ - void print()const { - int buffer_size = std::max(static_cast(symbol.precision()), 19) + 11; - char buffer[buffer_size]; - char* end = write_as_string( buffer, buffer + buffer_size ); - check( end <= buffer + buffer_size, "insufficient space in buffer" ); // should never fail - - if( buffer < end ) - printl( buffer, (end-buffer) ); - } - - EOSLIB_SERIALIZE( asset, (amount)(symbol) ) - }; - - /** - * Extended asset which stores the information of the owner of the asset - * - * @ingroup asset - */ - struct extended_asset { - /** - * The asset - */ - asset quantity; - - /** - * The owner of the asset - */ - name contract; - - /** - * Get the extended symbol of the asset - * - * @return extended_symbol - The extended symbol of the asset - */ - extended_symbol get_extended_symbol()const { return extended_symbol{ quantity.symbol, contract }; } - - /** - * Default constructor - */ - extended_asset() = default; - - /** - * Construct a new extended asset given the amount and extended symbol - */ - extended_asset( int64_t v, extended_symbol s ):quantity(v,s.get_symbol()),contract(s.get_contract()){} - /** - * Construct a new extended asset given the asset and owner name - */ - extended_asset( asset a, name c ):quantity(a),contract(c){} - - /** - * %Print the extended asset - */ - void print()const { - quantity.print(); - ::eosio::print("@", contract); - } - - /// @cond OPERATORS - - // Unary minus operator - extended_asset operator-()const { - return {-quantity, contract}; - } - - // Subtraction operator - friend extended_asset operator - ( const extended_asset& a, const extended_asset& b ) { - eosio::check( a.contract == b.contract, "type mismatch" ); - return {a.quantity - b.quantity, a.contract}; - } - - // Addition operator - friend extended_asset operator + ( const extended_asset& a, const extended_asset& b ) { - eosio::check( a.contract == b.contract, "type mismatch" ); - return {a.quantity + b.quantity, a.contract}; - } - - /// Addition operator. - friend extended_asset& operator+=( extended_asset& a, const extended_asset& b ) { - eosio::check( a.contract == b.contract, "type mismatch" ); - a.quantity += b.quantity; - return a; - } - - /// Subtraction operator. - friend extended_asset& operator-=( extended_asset& a, const extended_asset& b ) { - eosio::check( a.contract == b.contract, "type mismatch" ); - a.quantity -= b.quantity; - return a; - } - - /// Less than operator - friend bool operator<( const extended_asset& a, const extended_asset& b ) { - eosio::check( a.contract == b.contract, "type mismatch" ); - return a.quantity < b.quantity; - } - - - /// Comparison operator - friend bool operator==( const extended_asset& a, const extended_asset& b ) { - return std::tie(a.quantity, a.contract) == std::tie(b.quantity, b.contract); - } - - /// Comparison operator - friend bool operator!=( const extended_asset& a, const extended_asset& b ) { - return std::tie(a.quantity, a.contract) != std::tie(b.quantity, b.contract); - } - - /// Comparison operator - friend bool operator<=( const extended_asset& a, const extended_asset& b ) { - eosio::check( a.contract == b.contract, "type mismatch" ); - return a.quantity <= b.quantity; - } - - /// Comparison operator - friend bool operator>=( const extended_asset& a, const extended_asset& b ) { - eosio::check( a.contract == b.contract, "type mismatch" ); - return a.quantity >= b.quantity; - } +void print(asset obj) { + print(obj.to_string()); +} - /// @endcond +void print(extended_asset obj) { + print(obj.to_string()); +} - EOSLIB_SERIALIZE( extended_asset, (quantity)(contract) ) - }; } diff --git a/libraries/eosiolib/core/eosio/crypto.hpp b/libraries/eosiolib/core/eosio/crypto.hpp index b7ca46a980..fb3f812590 100644 --- a/libraries/eosiolib/core/eosio/crypto.hpp +++ b/libraries/eosiolib/core/eosio/crypto.hpp @@ -4,229 +4,11 @@ */ #pragma once -#include "fixed_bytes.hpp" -#include "varint.hpp" -#include "serialize.hpp" - -#include +#include_next +#include namespace eosio { - /** - * @defgroup public_key Public Key Type - * @ingroup core - * @ingroup types - * @brief Specifies public key type - */ - - /** - * EOSIO ECC public key data - * - * Fixed size representation of either a K1 or R1 compressed public key - - * @ingroup public_key - */ - using ecc_public_key = std::array; - - /** - * EOSIO WebAuthN public key - * - * @ingroup public_key - */ - struct webauthn_public_key { - /** - * Enumeration of the various results of a Test of User Presence - * @see https://w3c.github.io/webauthn/#test-of-user-presence - */ - enum class user_presence_t : uint8_t { - USER_PRESENCE_NONE, - USER_PRESENCE_PRESENT, - USER_PRESENCE_VERIFIED - }; - - /** - * The ECC key material - */ - ecc_public_key key; - - /** - * expected result of the test of user presence for a valid signature - * @see https://w3c.github.io/webauthn/#test-of-user-presence - */ - user_presence_t user_presence; - - /** - * the Relying Party Identifier for WebAuthN - * @see https://w3c.github.io/webauthn/#relying-party-identifier - */ - std::string rpid; - - /// @cond OPERATORS - - friend bool operator == ( const webauthn_public_key& a, const webauthn_public_key& b ) { - return std::tie(a.key,a.user_presence,a.rpid) == std::tie(b.key,b.user_presence,b.rpid); - } - friend bool operator != ( const webauthn_public_key& a, const webauthn_public_key& b ) { - return std::tie(a.key,a.user_presence,a.rpid) != std::tie(b.key,b.user_presence,b.rpid); - } - friend bool operator < ( const webauthn_public_key& a, const webauthn_public_key& b ) { - return std::tie(a.key,a.user_presence,a.rpid) < std::tie(b.key,b.user_presence,b.rpid); - } - friend bool operator <= ( const webauthn_public_key& a, const webauthn_public_key& b ) { - return std::tie(a.key,a.user_presence,a.rpid) <= std::tie(b.key,b.user_presence,b.rpid); - } - friend bool operator > ( const webauthn_public_key& a, const webauthn_public_key& b ) { - return std::tie(a.key,a.user_presence,a.rpid) > std::tie(b.key,b.user_presence,b.rpid); - } - friend bool operator >= ( const webauthn_public_key& a, const webauthn_public_key& b ) { - return std::tie(a.key,a.user_presence,a.rpid) >= std::tie(b.key,b.user_presence,b.rpid); - } - - /// @cond - }; - - /** - * EOSIO Public Key - * - * A public key is a variant of - * 0 : a ECC K1 public key - * 1 : a ECC R1 public key - * 2 : a WebAuthN public key (requires the host chain to activate the WEBAUTHN_KEY consensus upgrade) - * - * @ingroup public_key - */ - using public_key = std::variant; - - - /// @cond IMPLEMENTATIONS - - /** - * Serialize an eosio::webauthn_public_key into a stream - * - * @ingroup public_key - * @param ds - The stream to write - * @param pubkey - The value to serialize - * @tparam DataStream - Type of datastream buffer - * @return DataStream& - Reference to the datastream - */ - template - inline DataStream& operator<<(DataStream& ds, const eosio::webauthn_public_key& pubkey) { - ds << pubkey.key << pubkey.user_presence << pubkey.rpid; - return ds; - } - - /** - * Deserialize an eosio::webauthn_public_key from a stream - * - * @ingroup public_key - * @param ds - The stream to read - * @param pubkey - The destination for deserialized value - * @tparam DataStream - Type of datastream buffer - * @return DataStream& - Reference to the datastream - */ - template - inline DataStream& operator>>(DataStream& ds, eosio::webauthn_public_key& pubkey) { - ds >> pubkey.key >> pubkey.user_presence >> pubkey.rpid; - return ds; - } - - /// @endcond - - /** - * @defgroup signature Signature - * @ingroup core - * @ingroup types - * @brief Specifies signature type - */ - - /** - * EOSIO ECC signature data - * - * Fixed size representation of either a K1 or R1 ECC compact signature - - * @ingroup signature - */ - using ecc_signature = std::array; - - /** - * EOSIO WebAuthN signature - * - * @ingroup signature - */ - struct webauthn_signature { - /** - * The ECC signature data - */ - ecc_signature compact_signature; - - /** - * The Encoded Authenticator Data returned from WebAuthN ceremony - * @see https://w3c.github.io/webauthn/#sctn-authenticator-data - */ - std::vector auth_data; - - /** - * the JSON encoded Collected Client Data from a WebAuthN ceremony - * @see https://w3c.github.io/webauthn/#dictdef-collectedclientdata - */ - std::string client_json; - - /// @cond OPERATORS - - friend bool operator == ( const webauthn_signature& a, const webauthn_signature& b ) { - return std::tie(a.compact_signature,a.auth_data,a.client_json) == std::tie(b.compact_signature,b.auth_data,b.client_json); - } - friend bool operator != ( const webauthn_signature& a, const webauthn_signature& b ) { - return std::tie(a.compact_signature,a.auth_data,a.client_json) != std::tie(b.compact_signature,b.auth_data,b.client_json); - } - - /// @cond - }; - - /** - * EOSIO Signature - * - * A signature is a variant of - * 0 : a ECC K1 signature - * 1 : a ECC R1 signatre - * 2 : a WebAuthN signature (requires the host chain to activate the WEBAUTHN_KEY consensus upgrade) - * - * @ingroup signature - */ - using signature = std::variant; - - /// @cond IMPLEMENTATIONS - - /** - * Serialize an eosio::webauthn_signature into a stream - * - * @param ds - The stream to write - * @param sig - The value to serialize - * @tparam DataStream - Type of datastream buffer - * @return DataStream& - Reference to the datastream - */ - template - inline DataStream& operator<<(DataStream& ds, const eosio::webauthn_signature& sig) { - ds << sig.compact_signature << sig.auth_data << sig.client_json; - return ds; - } - - /** - * Deserialize an eosio::webauthn_signature from a stream - * - * @param ds - The stream to read - * @param sig - The destination for deserialized value - * @tparam DataStream - Type of datastream buffer - * @return DataStream& - Reference to the datastream - */ - template - inline DataStream& operator>>(DataStream& ds, eosio::webauthn_signature& sig) { - ds >> sig.compact_signature >> sig.auth_data >> sig.client_json; - return ds; - } - - /// @endcond - /** * @defgroup crypto Crypto * @ingroup core diff --git a/libraries/eosiolib/core/eosio/datastream.hpp b/libraries/eosiolib/core/eosio/datastream.hpp index acbdbf3b47..1f90ddb1e2 100644 --- a/libraries/eosiolib/core/eosio/datastream.hpp +++ b/libraries/eosiolib/core/eosio/datastream.hpp @@ -3,8 +3,11 @@ * @copyright defined in eos/LICENSE */ #pragma once -#include "check.hpp" -#include "varint.hpp" +#include +#include +#include +#include +#include #include #include @@ -50,6 +53,12 @@ class datastream { datastream( T start, size_t s ) :_start(start),_pos(start),_end(start+s){} + result check_available(size_t size) { + if (size > size_t(_end - _pos)) + return stream_error::overrun; + return outcome::success(); + } + /** * Skips a specified number of bytes from this stream * @@ -64,11 +73,11 @@ class datastream { * @param s - the number of bytes to read * @return true */ - inline bool read( char* d, size_t s ) { + inline result read( char* d, size_t s ) { eosio::check( size_t(_end - _pos) >= (size_t)s, "read" ); memcpy( d, _pos, s ); _pos += s; - return true; + return outcome::success(); } /** @@ -78,11 +87,11 @@ class datastream { * @param s - The number of bytes to write * @return true */ - inline bool write( const char* d, size_t s ) { + inline result write( const char* d, size_t s ) { eosio::check( _end - _pos >= (int32_t)s, "write" ); memcpy( (void*)_pos, d, s ); _pos += s; - return true; + return outcome::success(); } /** @@ -92,13 +101,15 @@ class datastream { * @param c byte to write * @return true */ - inline bool put(char c) { + inline result put(char c) { eosio::check( _pos < _end, "put" ); *_pos = c; ++_pos; - return true; + return outcome::success(); } + inline result write(char c) { return put(c); } + /** * Reads a byte from the stream * @@ -106,7 +117,7 @@ class datastream { * @param c - The reference to destination byte * @return true */ - inline bool get( unsigned char& c ) { return get( *(char*)&c ); } + inline result get( unsigned char& c ) { return get( *(char*)&c ); } /** * Reads a byte from the stream @@ -115,12 +126,12 @@ class datastream { * @param c - The reference to destination byte * @return true */ - inline bool get( char& c ) + inline result get( char& c ) { eosio::check( _pos < _end, "get" ); c = *_pos; ++_pos; - return true; + return outcome::success(); } /** @@ -205,14 +216,16 @@ class datastream { * @param s - The amount of size to increase * @return true */ - inline bool write( const char* ,size_t s ) { _size += s; return true; } + inline result write( const char* ,size_t s ) { _size += s; return outcome::success(); } /** * Increment the size by one * * @return true */ - inline bool put(char ) { ++_size; return true; } + inline result put(char ) { ++_size; return outcome::success(); } + + inline result write(char c) { return put(c); } /** * Check validity. It's always valid @@ -250,295 +263,6 @@ class datastream { size_t _size; }; -/** - * Serialize an std::list into a stream - * - * @param ds - The stream to write - * @param opt - The value to serialize - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -inline datastream& operator<<(datastream& ds, const std::list& l) { - ds << unsigned_int( l.size() ); - for ( const auto& elem : l ) - ds << elem; - return ds; -} - -/** - * Deserialize an std::list from a stream - * - * @param ds - The stream to read - * @param opt - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -inline datastream& operator>>(datastream& ds, std::list& l) { - unsigned_int s; - ds >> s; - l.resize(s.value); - for( auto& i : l ) - ds >> i; - return ds; -} - -/** - * Serialize an std::deque into a stream - * - * @param ds - The stream to write - * @param opt - The value to serialize - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -inline datastream& operator<<(datastream& ds, const std::deque& d) { - ds << unsigned_int( d.size() ); - for ( const auto& elem : d ) - ds << elem; - return ds; -} - -/** - * Deserialize an std::deque from a stream - * - * @param ds - The stream to read - * @param opt - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -inline datastream& operator>>(datastream& ds, std::deque& d) { - unsigned_int s; - ds >> s; - d.resize(s.value); - for( auto& i : d ) - ds >> i; - return ds; -} - -/** - * Serialize an std::variant into a stream - * - * @param ds - The stream to write - * @param opt - The value to serialize - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -inline datastream& operator<<(datastream& ds, const std::variant& var) { - unsigned_int index = var.index(); - ds << index; - std::visit([&ds](auto& val){ ds << val; }, var); - return ds; -} - -template -void deserialize(datastream& ds, std::variant& var, int i) { - if constexpr (I < std::variant_size_v>) { - if (i == I) { - std::variant_alternative_t> tmp; - ds >> tmp; - var.template emplace(std::move(tmp)); - } else { - deserialize(ds,var,i); - } - } else { - eosio::check(false, "invalid variant index"); - } -} - -/** - * Deserialize an std::variant from a stream - * - * @param ds - The stream to read - * @param opt - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -inline datastream& operator>>(datastream& ds, std::variant& var) { - unsigned_int index; - ds >> index; - deserialize<0>(ds,var,index); - return ds; -} - -/** - * Serialize an std::pair - * - * @param ds - The stream to write - * @param t - The value to serialize - * @tparam Stream - Type of datastream buffer - * @tparam Args - Type of the objects contained in the tuple - * @return datastream& - Reference to the datastream - */ -template -datastream& operator<<( datastream& ds, const std::pair& t ) { - ds << std::get<0>(t); - ds << std::get<1>(t); - return ds; -} - -/** - * Deserialize an std::pair - * - * @param ds - The stream to read - * @param t - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @tparam Args - Type of the objects contained in the tuple - * @return datastream& - Reference to the datastream - */ -template -datastream& operator>>( datastream& ds, std::pair& t ) { - T1 t1; - T2 t2; - ds >> t1; - ds >> t2; - t = std::pair{t1, t2}; - return ds; -} - -/** - * Serialize an optional into a stream - * - * @param ds - The stream to write - * @param opt - The value to serialize - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -inline datastream& operator<<(datastream& ds, const std::optional& opt) { - char valid = opt.has_value(); - ds << valid; - if (valid) - ds << *opt; - return ds; -} - -/** - * Deserialize an optional from a stream - * - * @param ds - The stream to read - * @param opt - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -inline datastream& operator>>(datastream& ds, std::optional& opt) { - char valid = 0; - ds >> valid; - if (valid) { - T val; - ds >> val; - opt = val; - } - return ds; -} - - -/** - * Serialize a bool into a stream - * - * @param ds - The stream to read - * @param d - The value to serialize - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -inline datastream& operator<<(datastream& ds, const bool& d) { - return ds << uint8_t(d); -} - -/** - * Deserialize a bool from a stream - * - * @brief Deserialize a bool - * @param ds - The stream to read - * @param d - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -inline datastream& operator>>(datastream& ds, bool& d) { - uint8_t t; - ds >> t; - d = t; - return ds; -} - -/** - * Serialize a string into a stream - * - * @param ds - The stream to write - * @param v - The value to serialize - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -datastream& operator << ( datastream& ds, const std::string& v ) { - ds << unsigned_int( v.size() ); - if (v.size()) - ds.write(v.data(), v.size()); - return ds; -} - -/** - * Deserialize a string from a stream - * - * @param ds - The stream to read - * @param v - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -datastream& operator >> ( datastream& ds, std::string& v ) { - std::vector tmp; - ds >> tmp; - if( tmp.size() ) - v = std::string(tmp.data(),tmp.data()+tmp.size()); - else - v = std::string(); - return ds; -} - -/** - * Serialize a fixed size std::array - * - * @param ds - The stream to write - * @param v - The value to serialize - * @tparam Stream - Type of datastream buffer - * @tparam T - Type of the object contained in the array - * @tparam N - Size of the array - * @return datastream& - Reference to the datastream - */ -template -datastream& operator << ( datastream& ds, const std::array& v ) { - for( const auto& i : v ) - ds << i; - return ds; -} - - -/** - * Deserialize a fixed size std::array - * - * @brief Deserialize a fixed size std::array - * @param ds - The stream to read - * @param v - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @tparam T - Type of the object contained in the array - * @tparam N - Size of the array - * @return datastream& - Reference to the datastream - */ -template -datastream& operator >> ( datastream& ds, std::array& v ) { - for( auto& i : v ) - ds >> i; - return ds; -} - namespace _datastream_detail { /** * Check if type T is a pointer @@ -581,299 +305,6 @@ namespace _datastream_detail { struct is_datastream> { static constexpr bool value = true; }; } -/** - * Pointer should not be serialized, so this function will always throws an error - * - * @brief Deserialize a a pointer - * @param ds - The stream to read - * @tparam Stream - Type of datastream buffer - * @tparam T - Type of the pointer - * @return datastream& - Reference to the datastream - * @post Throw an exception if it is a pointer - */ -template()>* = nullptr> -datastream& operator >> ( datastream& ds, T ) { - static_assert(!_datastream_detail::is_pointer(), "Pointers should not be serialized" ); - return ds; -} - -/** - * Serialize a fixed size C array of non-primitive and non-pointer type - * - * @brief Serialize a fixed size C array of non-primitive and non-pointer type - * @param ds - The stream to write - * @param v - The value to serialize - * @tparam Stream - Type of datastream buffer - * @tparam T - Type of the pointer - * @return datastream& - Reference to the datastream - */ -template() && - !_datastream_detail::is_pointer()>* = nullptr> -datastream& operator << ( datastream& ds, const T (&v)[N] ) { - ds << unsigned_int( N ); - for( uint32_t i = 0; i < N; ++i ) - ds << v[i]; - return ds; -} - -/** - * Serialize a fixed size C array of primitive type - * - * @brief Serialize a fixed size C array of primitive type - * @param ds - The stream to write - * @param v - The value to serialize - * @tparam Stream - Type of datastream buffer - * @tparam T - Type of the pointer - * @return datastream& - Reference to the datastream - */ -template()>* = nullptr> -datastream& operator << ( datastream& ds, const T (&v)[N] ) { - ds << unsigned_int( N ); - ds.write((char*)&v[0], sizeof(v)); - return ds; -} - -/** - * Deserialize a fixed size C array of non-primitive and non-pointer type - * - * @brief Deserialize a fixed size C array of non-primitive and non-pointer type - * @param ds - The stream to read - * @param v - The destination for deserialized value - * @tparam T - Type of the object contained in the array - * @tparam N - Size of the array - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template() && - !_datastream_detail::is_pointer()>* = nullptr> -datastream& operator >> ( datastream& ds, T (&v)[N] ) { - unsigned_int s; - ds >> s; - eosio::check( N == s.value, "T[] size and unpacked size don't match"); - for( uint32_t i = 0; i < N; ++i ) - ds >> v[i]; - return ds; -} - -/** - * Deserialize a fixed size C array of primitive type - * - * @brief Deserialize a fixed size C array of primitive type - * @param ds - The stream to read - * @param v - The destination for deserialized value - * @tparam T - Type of the object contained in the array - * @tparam N - Size of the array - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template()>* = nullptr> -datastream& operator >> ( datastream& ds, T (&v)[N] ) { - unsigned_int s; - ds >> s; - eosio::check( N == s.value, "T[] size and unpacked size don't match"); - ds.read((char*)&v[0], sizeof(v)); - return ds; -} - -/** - * Serialize a vector of char - * - * @brief Serialize a vector of char - * @param ds - The stream to write - * @param v - The value to serialize - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -datastream& operator << ( datastream& ds, const std::vector& v ) { - ds << unsigned_int( v.size() ); - ds.write( v.data(), v.size() ); - return ds; -} - -/** - * Serialize a vector - * - * @brief Serialize a vector - * @param ds - The stream to write - * @param v - The value to serialize - * @tparam Stream - Type of datastream buffer - * @tparam T - Type of the object contained in the vector - * @return datastream& - Reference to the datastream - */ -template -datastream& operator << ( datastream& ds, const std::vector& v ) { - ds << unsigned_int( v.size() ); - for( const auto& i : v ) - ds << i; - return ds; -} - -/** - * Deserialize a vector of char - * - * @brief Deserialize a vector of char - * @param ds - The stream to read - * @param v - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @return datastream& - Reference to the datastream - */ -template -datastream& operator >> ( datastream& ds, std::vector& v ) { - unsigned_int s; - ds >> s; - v.resize( s.value ); - ds.read( v.data(), v.size() ); - return ds; -} - -/** - * Deserialize a vector - * - * @brief Deserialize a vector - * @param ds - The stream to read - * @param v - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @tparam T - Type of the object contained in the vector - * @return datastream& - Reference to the datastream - */ -template -datastream& operator >> ( datastream& ds, std::vector& v ) { - unsigned_int s; - ds >> s; - v.resize(s.value); - for( auto& i : v ) - ds >> i; - return ds; -} - -/** - * Serialize a set - * - * @brief Serialize a set - * @param ds - The stream to write - * @param s - The value to serialize - * @tparam Stream - Type of datastream buffer - * @tparam T - Type of the object contained in the set - * @return datastream& - Reference to the datastream - */ -template -datastream& operator << ( datastream& ds, const std::set& s ) { - ds << unsigned_int( s.size() ); - for( const auto& i : s ) { - ds << i; - } - return ds; -} - - -/** - * Deserialize a set - * - * @brief Deserialize a set - * @param ds - The stream to read - * @param s - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @tparam T - Type of the object contained in the set - * @return datastream& - Reference to the datastream - */ -template -datastream& operator >> ( datastream& ds, std::set& s ) { - s.clear(); - unsigned_int sz; ds >> sz; - - for( uint32_t i = 0; i < sz.value; ++i ) { - T v; - ds >> v; - s.emplace( std::move(v) ); - } - return ds; -} - -/** - * Serialize a map - * - * @brief Serialize a map - * @param ds - The stream to write - * @param m - The value to serialize - * @tparam Stream - Type of datastream buffer - * @tparam K - Type of the key contained in the map - * @tparam V - Type of the value contained in the map - * @return datastream& - Reference to the datastream - */ -template -datastream& operator << ( datastream& ds, const std::map& m ) { - ds << unsigned_int( m.size() ); - for( const auto& i : m ) { - ds << i.first << i.second; - } - return ds; -} - -/** - * Deserialize a map - * - * @brief Deserialize a map - * @param ds - The stream to read - * @param m - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @tparam K - Type of the key contained in the map - * @tparam V - Type of the value contained in the map - * @return datastream& - Reference to the datastream - */ -template -datastream& operator >> ( datastream& ds, std::map& m ) { - m.clear(); - unsigned_int s; ds >> s; - - for (uint32_t i = 0; i < s.value; ++i) { - K k; V v; - ds >> k >> v; - m.emplace( std::move(k), std::move(v) ); - } - return ds; -} - -/** - * Serialize a tuple - * - * @brief Serialize a tuple - * @param ds - The stream to write - * @param t - The value to serialize - * @tparam Stream - Type of datastream buffer - * @tparam Args - Type of the objects contained in the tuple - * @return datastream& - Reference to the datastream - */ -template -datastream& operator<<( datastream& ds, const std::tuple& t ) { - boost::fusion::for_each( t, [&]( const auto& i ) { - ds << i; - }); - return ds; -} - -/** - * Deserialize a tuple - * - * @brief Deserialize a tuple - * @param ds - The stream to read - * @param t - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @tparam Args - Type of the objects contained in the tuple - * @return datastream& - Reference to the datastream - */ -template -datastream& operator>>( datastream& ds, std::tuple& t ) { - boost::fusion::for_each( t, [&]( auto& i ) { - ds >> i; - }); - return ds; -} - /** * Serialize a class * @@ -884,11 +315,9 @@ datastream& operator>>( datastream& ds, std::tuple& t ) * @tparam T - Type of class * @return DataStream& - Reference to the datastream */ -template::value && _datastream_detail::is_datastream::value>* = nullptr> +template::value>* = nullptr> DataStream& operator<<( DataStream& ds, const T& v ) { - boost::pfr::for_each_field(v, [&](const auto& field) { - ds << field; - }); + check_discard(to_bin(v, ds)); return ds; } @@ -902,43 +331,9 @@ DataStream& operator<<( DataStream& ds, const T& v ) { * @tparam T - Type of class * @return DataStream& - Reference to the datastream */ -template::value && _datastream_detail::is_datastream::value>* = nullptr> +template::value>* = nullptr> DataStream& operator>>( DataStream& ds, T& v ) { - boost::pfr::for_each_field(v, [&](auto& field) { - ds >> field; - }); - return ds; -} - -/** - * Serialize a primitive type - * - * @brief Serialize a primitive type - * @param ds - The stream to write - * @param v - The value to serialize - * @tparam Stream - Type of datastream buffer - * @tparam T - Type of the primitive type - * @return datastream& - Reference to the datastream - */ -template()>* = nullptr> -datastream& operator<<( datastream& ds, const T& v ) { - ds.write( (const char*)&v, sizeof(T) ); - return ds; -} - -/** - * Deserialize a primitive type - * - * @brief Deserialize a primitive type - * @param ds - The stream to read - * @param v - The destination for deserialized value - * @tparam Stream - Type of datastream buffer - * @tparam T - Type of the primitive type - * @return datastream& - Reference to the datastream - */ -template()>* = nullptr> -datastream& operator>>( datastream& ds, T& v ) { - ds.read( (char*)&v, sizeof(T) ); + check_discard(from_bin(v, ds)); return ds; } diff --git a/libraries/eosiolib/core/eosio/fixed_bytes.hpp b/libraries/eosiolib/core/eosio/fixed_bytes.hpp index 13c08b4d67..f7d11b6159 100644 --- a/libraries/eosiolib/core/eosio/fixed_bytes.hpp +++ b/libraries/eosiolib/core/eosio/fixed_bytes.hpp @@ -3,388 +3,15 @@ * @copyright defined in eos/LICENSE */ #pragma once -#include "datastream.hpp" -#include -#include -#include -#include +#include_next +#include "print.hpp" namespace eosio { - /// @cond IMPLEMENTATIONS - - template - class fixed_bytes; - - template - bool operator ==(const fixed_bytes &c1, const fixed_bytes &c2); - - template - bool operator !=(const fixed_bytes &c1, const fixed_bytes &c2); - - template - bool operator >(const fixed_bytes &c1, const fixed_bytes &c2); - - template - bool operator <(const fixed_bytes &c1, const fixed_bytes &c2); - - template - bool operator >=(const fixed_bytes &c1, const fixed_bytes &c2); - - template - bool operator <=(const fixed_bytes &c1, const fixed_bytes &c2); - - /// @endcond - - /** - * @defgroup fixed_bytes Fixed Size Byte Array - * @ingroup core - * @ingroup types - * @brief Fixed size array of bytes sorted lexicographically - */ - - /** - * Fixed size byte array sorted lexicographically - * - * @ingroup fixed_bytes - * @tparam Size - Size of the fixed_bytes object - */ - template - class fixed_bytes { - private: - - template struct bool_pack; - template - using all_true = std::is_same< bool_pack, bool_pack >; - - template - static void set_from_word_sequence(const Word* arr_begin, const Word* arr_end, fixed_bytes& key) - { - auto itr = key._data.begin(); - word_t temp_word = 0; - const size_t sub_word_shift = 8 * sizeof(Word); - const size_t num_sub_words = sizeof(word_t) / sizeof(Word); - auto sub_words_left = num_sub_words; - for( auto w_itr = arr_begin; w_itr != arr_end; ++w_itr ) { - if( sub_words_left > 1 ) { - temp_word |= static_cast(*w_itr); - temp_word <<= sub_word_shift; - --sub_words_left; - continue; - } - - eosio::check( sub_words_left == 1, "unexpected error in fixed_bytes constructor" ); - temp_word |= static_cast(*w_itr); - sub_words_left = num_sub_words; - - *itr = temp_word; - temp_word = 0; - ++itr; - } - if( sub_words_left != num_sub_words ) { - if( sub_words_left > 1 ) - temp_word <<= 8 * (sub_words_left-1); - *itr = temp_word; - } - } - - public: - - typedef uint128_t word_t; - - /** - * Get number of words contained in this fixed_bytes object. A word is defined to be 16 bytes in size - */ - - static constexpr size_t num_words() { return (Size + sizeof(word_t) - 1) / sizeof(word_t); } - - /** - * Get number of padded bytes contained in this fixed_bytes object. Padded bytes are the remaining bytes - * inside the fixed_bytes object after all the words are allocated - */ - static constexpr size_t padded_bytes() { return num_words() * sizeof(word_t) - Size; } - - /** - * Default constructor to fixed_bytes object which initializes all bytes to zero - */ - constexpr fixed_bytes() : _data() {} - - /** - * Constructor to fixed_bytes object from std::array of num_words() word_t types - * - * @param arr data - */ - fixed_bytes(const std::array& arr) - { - std::copy(arr.begin(), arr.end(), _data.begin()); - } - - /** - * Constructor to fixed_bytes object from std::array of Word types smaller in size than word_t - * - * @param arr - Source data - */ - template::value && - std::is_unsigned::value && - !std::is_same::value && - std::less{}(sizeof(Word), sizeof(word_t))>::type > - fixed_bytes(const std::array& arr) - { - static_assert( sizeof(word_t) == (sizeof(word_t)/sizeof(Word)) * sizeof(Word), - "size of the backing word size is not divisible by the size of the array element" ); - static_assert( sizeof(Word) * NumWords <= Size, "too many words supplied to fixed_bytes constructor" ); - - set_from_word_sequence(arr.data(), arr.data() + arr.size(), *this); - } - - /** - * Constructor to fixed_bytes object from fixed-sized C array of Word types smaller in size than word_t - * - * @param arr - Source data - */ - template::value && - std::is_unsigned::value && - !std::is_same::value && - std::less{}(sizeof(Word), sizeof(word_t))>::type > - fixed_bytes(const Word(&arr)[NumWords]) - { - static_assert( sizeof(word_t) == (sizeof(word_t)/sizeof(Word)) * sizeof(Word), - "size of the backing word size is not divisible by the size of the array element" ); - static_assert( sizeof(Word) * NumWords <= Size, "too many words supplied to fixed_bytes constructor" ); - - set_from_word_sequence(arr, arr + NumWords, *this); - } - - /** - * Create a new fixed_bytes object from a sequence of words - * - * @tparam FirstWord - The type of the first word in the sequence - * @tparam Rest - The type of the remaining words in the sequence - * @param first_word - The first word in the sequence - * @param rest - The remaining words in the sequence - */ - template - static - fixed_bytes - make_from_word_sequence(typename std::enable_if::value && - std::is_unsigned::value && - !std::is_same::value && - sizeof(FirstWord) <= sizeof(word_t) && - all_true<(std::is_same::value)...>::value, - FirstWord>::type first_word, - Rest... rest) - { - static_assert( sizeof(word_t) == (sizeof(word_t)/sizeof(FirstWord)) * sizeof(FirstWord), - "size of the backing word size is not divisible by the size of the words supplied as arguments" ); - static_assert( sizeof(FirstWord) * (1 + sizeof...(Rest)) <= Size, "too many words supplied to make_from_word_sequence" ); - - fixed_bytes key; - std::array arr{{ first_word, rest... }}; - set_from_word_sequence(arr.data(), arr.data() + arr.size(), key); - return key; - } - - /** - * Get the contained std::array - */ - const auto& get_array()const { return _data; } - - /** - * Get the underlying data of the contained std::array - */ - auto data() { return _data.data(); } - - /// @cond INTERNAL - - /** - * Get the underlying data of the contained std::array - */ - auto data()const { return _data.data(); } - - /// @endcond - - /** - * Get the size of the contained std::array - */ - auto size()const { return _data.size(); } - - - /** - * Extract the contained data as an array of bytes - * - * @return - the extracted data as array of bytes - */ - std::array extract_as_byte_array()const { - std::array arr; - - const size_t num_sub_words = sizeof(word_t); - - auto arr_itr = arr.begin(); - auto data_itr = _data.begin(); - - for( size_t counter = _data.size(); counter > 0; --counter, ++data_itr ) { - size_t sub_words_left = num_sub_words; - - auto temp_word = *data_itr; - if( counter == 1 ) { // If last word in _data array... - sub_words_left -= padded_bytes(); - temp_word >>= 8*padded_bytes(); - } - for( ; sub_words_left > 0; --sub_words_left ) { - *(arr_itr + sub_words_left - 1) = static_cast(temp_word & 0xFF); - temp_word >>= 8; - } - arr_itr += num_sub_words; - } - - return arr; - } - - /** - * Prints fixed_bytes as a hexidecimal string - * - * @param val to be printed - */ - inline void print()const { - auto arr = extract_as_byte_array(); - printhex(static_cast(arr.data()), arr.size()); - } - - /// @cond OPERATORS - - friend bool operator == <>(const fixed_bytes &c1, const fixed_bytes &c2); - - friend bool operator != <>(const fixed_bytes &c1, const fixed_bytes &c2); - - friend bool operator > <>(const fixed_bytes &c1, const fixed_bytes &c2); - - friend bool operator < <>(const fixed_bytes &c1, const fixed_bytes &c2); - - friend bool operator >= <>(const fixed_bytes &c1, const fixed_bytes &c2); - - friend bool operator <= <>(const fixed_bytes &c1, const fixed_bytes &c2); - - /// @endcond - - private: - - std::array _data; - }; - - /// @cond IMPLEMENTATIONS - - /** - * Lexicographically compares two fixed_bytes variables c1 and c2 - * - * @param c1 - First fixed_bytes object to compare - * @param c2 - Second fixed_bytes object to compare - * @return if c1 == c2, return true, otherwise false - */ - template - bool operator ==(const fixed_bytes &c1, const fixed_bytes &c2) { - return c1._data == c2._data; + template + inline void print(const fixed_bytes& d) { + auto arr = d.extract_as_byte_array(); + printhex(static_cast(arr.data()), arr.size()); } - - /** - * Lexicographically compares two fixed_bytes variables c1 and c2 - * - * @param c1 - First fixed_bytes object to compare - * @param c2 - Second fixed_bytes object to compare - * @return if c1 != c2, return true, otherwise false - */ - template - bool operator !=(const fixed_bytes &c1, const fixed_bytes &c2) { - return c1._data != c2._data; - } - - /** - * Lexicographically compares two fixed_bytes variables c1 and c2 - * - * @param c1 - First fixed_bytes object to compare - * @param c2 - Second fixed_bytes object to compare - * @return if c1 > c2, return true, otherwise false - */ - template - bool operator >(const fixed_bytes& c1, const fixed_bytes& c2) { - return c1._data > c2._data; - } - - /** - * Lexicographically compares two fixed_bytes variables c1 and c2 - * - * @param c1 - First fixed_bytes object to compare - * @param c2 - Second fixed_bytes object to compare - * @return if c1 < c2, return true, otherwise false - */ - template - bool operator <(const fixed_bytes &c1, const fixed_bytes &c2) { - return c1._data < c2._data; - } - - /** - * Lexicographically compares two fixed_bytes variables c1 and c2 - * - * @param c1 - First fixed_bytes object to compare - * @param c2 - Second fixed_bytes object to compare - * @return if c1 >= c2, return true, otherwise false - */ - template - bool operator >=(const fixed_bytes& c1, const fixed_bytes& c2) { - return c1._data >= c2._data; - } - - /** - * Lexicographically compares two fixed_bytes variables c1 and c2 - * - * @param c1 - First fixed_bytes object to compare - * @param c2 - Second fixed_bytes object to compare - * @return if c1 <= c2, return true, otherwise false - */ - template - bool operator <=(const fixed_bytes &c1, const fixed_bytes &c2) { - return c1._data <= c2._data; - } - - - using checksum160 = fixed_bytes<20>; - using checksum256 = fixed_bytes<32>; - using checksum512 = fixed_bytes<64>; - - /** - * Serialize a fixed_bytes into a stream - * - * @brief Serialize a fixed_bytes - * @param ds - The stream to write - * @param d - The value to serialize - * @tparam DataStream - Type of datastream buffer - * @return DataStream& - Reference to the datastream - */ - template - inline datastream& operator<<(datastream& ds, const fixed_bytes& d) { - auto arr = d.extract_as_byte_array(); - ds.write( (const char*)arr.data(), arr.size() ); - return ds; - } - - /** - * Deserialize a fixed_bytes from a stream - * - * @brief Deserialize a fixed_bytes - * @param ds - The stream to read - * @param d - The destination for deserialized value - * @tparam DataStream - Type of datastream buffer - * @return DataStream& - Reference to the datastream - */ - template - inline datastream& operator>>(datastream& ds, fixed_bytes& d) { - std::array arr; - ds.read( (char*)arr.data(), arr.size() ); - d = fixed_bytes( arr ); - return ds; - } - - /// @endcond } diff --git a/libraries/eosiolib/core/eosio/name.hpp b/libraries/eosiolib/core/eosio/name.hpp index 525377104a..bcba4f14d2 100644 --- a/libraries/eosiolib/core/eosio/name.hpp +++ b/libraries/eosiolib/core/eosio/name.hpp @@ -4,11 +4,9 @@ */ #pragma once -#include "check.hpp" -#include "serialize.hpp" +#include_next -#include -#include +/// @cond IMPLEMENTATIONS namespace eosio { namespace internal_use_do_not_use { @@ -18,282 +16,12 @@ namespace eosio { } } - /** - * @defgroup name - * @ingroup core - * @ingroup types - * @brief EOSIO Name Type - */ - - /** - * Wraps a %uint64_t to ensure it is only passed to methods that expect a %name. - * Ensures value is only passed to methods that expect a %name and that no mathematical - * operations occur. Also enables specialization of print - * - * @ingroup name - */ - struct name { - public: - enum class raw : uint64_t {}; - - /** - * Construct a new name - * - * @brief Construct a new name object defaulting to a value of 0 - * - */ - constexpr name() : value(0) {} - - /** - * Construct a new name given a unit64_t value - * - * @brief Construct a new name object initialising value with v - * @param v - The unit64_t value - * - */ - constexpr explicit name( uint64_t v ) - :value(v) - {} - - /** - * Construct a new name given a scoped enumerated type of raw (uint64_t). - * - * @brief Construct a new name object initialising value with r - * @param r - The raw value which is a scoped enumerated type of unit64_t - * - */ - constexpr explicit name( name::raw r ) - :value(static_cast(r)) - {} - - /** - * Construct a new name given an string. - * - * @brief Construct a new name object initialising value with str - * @param str - The string value which validated then converted to unit64_t - * - */ - constexpr explicit name( std::string_view str ) - :value(0) - { - if( str.size() > 13 ) { - eosio::check( false, "string is too long to be a valid name" ); - } - if( str.empty() ) { - return; - } - - auto n = std::min( (uint32_t)str.size(), (uint32_t)12u ); - for( decltype(n) i = 0; i < n; ++i ) { - value <<= 5; - value |= char_to_value( str[i] ); - } - value <<= ( 4 + 5*(12 - n) ); - if( str.size() == 13 ) { - uint64_t v = char_to_value( str[12] ); - if( v > 0x0Full ) { - eosio::check(false, "thirteenth character in name cannot be a letter that comes after j"); - } - value |= v; - } - } - - /** - * Converts a %name Base32 symbol into its corresponding value - * - * @param c - Character to be converted - * @return constexpr char - Converted value - */ - static constexpr uint8_t char_to_value( char c ) { - if( c == '.') - return 0; - else if( c >= '1' && c <= '5' ) - return (c - '1') + 1; - else if( c >= 'a' && c <= 'z' ) - return (c - 'a') + 6; - else - eosio::check( false, "character is not in allowed character set for names" ); - - return 0; // control flow will never reach here; just added to suppress warning - } - - /** - * Returns the length of the %name - */ - constexpr uint8_t length()const { - constexpr uint64_t mask = 0xF800000000000000ull; - - if( value == 0 ) - return 0; - - uint8_t l = 0; - uint8_t i = 0; - for( auto v = value; i < 13; ++i, v <<= 5 ) { - if( (v & mask) > 0 ) { - l = i; - } - } - - return l + 1; - } - - /** - * Returns the suffix of the %name - */ - constexpr name suffix()const { - uint32_t remaining_bits_after_last_actual_dot = 0; - uint32_t tmp = 0; - for( int32_t remaining_bits = 59; remaining_bits >= 4; remaining_bits -= 5 ) { // Note: remaining_bits must remain signed integer - // Get characters one-by-one in name in order from left to right (not including the 13th character) - auto c = (value >> remaining_bits) & 0x1Full; - if( !c ) { // if this character is a dot - tmp = static_cast(remaining_bits); - } else { // if this character is not a dot - remaining_bits_after_last_actual_dot = tmp; - } - } - - uint64_t thirteenth_character = value & 0x0Full; - if( thirteenth_character ) { // if 13th character is not a dot - remaining_bits_after_last_actual_dot = tmp; - } - - if( remaining_bits_after_last_actual_dot == 0 ) // there is no actual dot in the %name other than potentially leading dots - return name{value}; - - // At this point remaining_bits_after_last_actual_dot has to be within the range of 4 to 59 (and restricted to increments of 5). - - // Mask for remaining bits corresponding to characters after last actual dot, except for 4 least significant bits (corresponds to 13th character). - uint64_t mask = (1ull << remaining_bits_after_last_actual_dot) - 16; - uint32_t shift = 64 - remaining_bits_after_last_actual_dot; - - return name{ ((value & mask) << shift) + (thirteenth_character << (shift-1)) }; - } - - /** - * Casts a name to raw - * - * @return Returns an instance of raw based on the value of a name - */ - constexpr operator raw()const { return raw(value); } - - /** - * Explicit cast to bool of the uint64_t value of the name - * - * @return Returns true if the name is set to the default value of 0 else true. - */ - constexpr explicit operator bool()const { return value != 0; } - - /** - * Writes the %name as a string to the provided char buffer - * - * @pre The range [begin, end) must be a valid range of memory to write to. - * @param begin - The start of the char buffer - * @param end - Just past the end of the char buffer - * @param dry_run - If true, do not actually write anything into the range. - * @return char* - Just past the end of the last character that would be written assuming dry_run == false and end was large enough to provide sufficient space. (Meaning only applies if returned pointer >= begin.) - * @post If the output string fits within the range [begin, end) and dry_run == false, the range [begin, returned pointer) contains the string representation of the %name. Nothing is written if dry_run == true or returned pointer > end (insufficient space) or if returned pointer < begin (overflow in calculating desired end). - */ - char* write_as_string( char* begin, char* end, bool dry_run = false )const { - static const char* charmap = ".12345abcdefghijklmnopqrstuvwxyz"; - constexpr uint64_t mask = 0xF800000000000000ull; - - if( dry_run || (begin + 13 < begin) || (begin + 13 > end) ) { - char* actual_end = begin + length(); - if( dry_run || (actual_end < begin) || (actual_end > end) ) return actual_end; - } - - auto v = value; - for( auto i = 0; i < 13; ++i, v <<= 5 ) { - if( v == 0 ) return begin; - - auto indx = (v & mask) >> (i == 12 ? 60 : 59); - *begin = charmap[indx]; - ++begin; - } - - return begin; - } - - /** - * Returns the name as a string. - * - * @brief Returns the name value as a string by calling write_as_string() and returning the buffer produced by write_as_string() - */ - std::string to_string()const { - char buffer[13]; - auto end = write_as_string( buffer, buffer + sizeof(buffer) ); - return {buffer, end}; - } - - /** - * Prints an names as base32 encoded string - * - * @param name to be printed - */ - inline void print()const { - internal_use_do_not_use::printn(value); - } - - /// @cond INTERNAL - - /** - * Equivalency operator. Returns true if a == b (are the same) - * - * @return boolean - true if both provided %name values are the same - */ - friend constexpr bool operator == ( const name& a, const name& b ) { - return a.value == b.value; - } - - /** - * Inverted equivalency operator. Returns true if a != b (are different) - * - * @return boolean - true if both provided %name values are not the same - */ - friend constexpr bool operator != ( const name& a, const name& b ) { - return a.value != b.value; - } - - /** - * Less than operator. Returns true if a < b. - * - * @return boolean - true if %name `a` is less than `b` - */ - friend constexpr bool operator < ( const name& a, const name& b ) { - return a.value < b.value; - } - - /// @endcond - - uint64_t value = 0; - - EOSLIB_SERIALIZE( name, (value) ) - }; - - namespace detail { - template - struct to_const_char_arr { - static constexpr const char value[] = {Str...}; - }; - } /// namespace detail -} /// namespace eosio - -/// @cond IMPLEMENTATIONS + inline void print(name obj) { + internal_use_do_not_use::printn(obj.value); + } -/** - * %name literal operator - * - * @ingroup name - * @brief "foo"_n is a shortcut for name("foo") - */ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wgnu-string-literal-operator-template" -template -inline constexpr eosio::name operator""_n() { - constexpr auto x = eosio::name{std::string_view{eosio::detail::to_const_char_arr::value, sizeof...(Str)}}; - return x; } -#pragma clang diagnostic pop + +using namespace eosio::literals; /// @endcond diff --git a/libraries/eosiolib/core/eosio/powers.hpp b/libraries/eosiolib/core/eosio/powers.hpp index b0d53369d4..d5956025e1 100644 --- a/libraries/eosiolib/core/eosio/powers.hpp +++ b/libraries/eosiolib/core/eosio/powers.hpp @@ -1,6 +1,6 @@ #pragma once -#include "check.hpp" +#include #include #include diff --git a/libraries/eosiolib/core/eosio/serialize.hpp b/libraries/eosiolib/core/eosio/serialize.hpp index ccb6553f07..88a5829192 100644 --- a/libraries/eosiolib/core/eosio/serialize.hpp +++ b/libraries/eosiolib/core/eosio/serialize.hpp @@ -1,11 +1,10 @@ +#pragma once + #include -#include -#include -#include -#include +#include -#define EOSLIB_REFLECT_MEMBER_OP( r, OP, elem ) \ - OP t.elem +#define EOSLIB_REFLECT_MEMBER_OP( r, STRUCT, elem ) \ + EOSIO_REFLECT_MEMBER(STRUCT, elem); /** * @defgroup serialize Serialize @@ -20,15 +19,12 @@ * @param TYPE - the class to have its serialization and deserialization defined * @param MEMBERS - a sequence of member names. (field1)(field2)(field3) */ -#define EOSLIB_SERIALIZE( TYPE, MEMBERS ) \ - template \ - friend DataStream& operator << ( DataStream& ds, const TYPE& t ){ \ - return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, <<, MEMBERS );\ - }\ - template \ - friend DataStream& operator >> ( DataStream& ds, TYPE& t ){ \ - return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, >>, MEMBERS );\ - } +#define EOSLIB_SERIALIZE( STRUCT, MEMBERS ) \ + friend constexpr const char* get_type_name(STRUCT*) { return #STRUCT; } \ + template \ + friend constexpr void eosio_for_each_field(STRUCT*, F f) { \ + BOOST_PP_SEQ_FOR_EACH(EOSLIB_REFLECT_MEMBER_OP, ~, MEMBERS); \ + } /** * Defines serialization and deserialization for a class which inherits from other classes that @@ -39,14 +35,11 @@ * @param BASE - a sequence of base class names (basea)(baseb)(basec) * @param MEMBERS - a sequence of member names. (field1)(field2)(field3) */ -#define EOSLIB_SERIALIZE_DERIVED( TYPE, BASE, MEMBERS ) \ - template \ - friend DataStream& operator << ( DataStream& ds, const TYPE& t ){ \ - ds << static_cast(t); \ - return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, <<, MEMBERS );\ - }\ - template \ - friend DataStream& operator >> ( DataStream& ds, TYPE& t ){ \ - ds >> static_cast(t); \ - return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, >>, MEMBERS );\ - } + +#define EOSLIB_SERIALIZE_DERIVED( STRUCT, BASE, MEMBERS ) \ + friend constexpr const char* get_type_name(STRUCT*) { return #STRUCT; } \ + template \ + friend constexpr void eosio_for_each_field(STRUCT*, F f) { \ + eosio_for_each_field((BASE*)nullptr, f); \ + BOOST_PP_SEQ_FOR_EACH(EOSLIB_REFLECT_MEMBER_OP, ~, MEMBERS); \ + } diff --git a/libraries/eosiolib/core/eosio/string.hpp b/libraries/eosiolib/core/eosio/string.hpp index cbb5c8e5c2..5eae547104 100644 --- a/libraries/eosiolib/core/eosio/string.hpp +++ b/libraries/eosiolib/core/eosio/string.hpp @@ -11,8 +11,8 @@ #include // std::variant #include // std::vector -#include "datastream.hpp" // eosio::datastream -#include "varint.hpp" // eosio::unsigned_int +#include // eosio::datastream +#include // eosio::unsigned_int namespace eosio { diff --git a/libraries/eosiolib/core/eosio/symbol.hpp b/libraries/eosiolib/core/eosio/symbol.hpp index e02c86ad07..b6c0432bf8 100644 --- a/libraries/eosiolib/core/eosio/symbol.hpp +++ b/libraries/eosiolib/core/eosio/symbol.hpp @@ -4,452 +4,13 @@ */ #pragma once -#include "check.hpp" -#include "name.hpp" -#include "serialize.hpp" -#include "print.hpp" -#include "datastream.hpp" - -#include -#include -#include +#include_next +#include namespace eosio { - /** - * @defgroup symbol Symbol - * @ingroup core - * @brief Defines C++ API for managing symbols - */ - - /** - * Stores the symbol code as a uint64_t value - * - * @ingroup symbol - */ - class symbol_code { - public: - - /** - * Default constructor, construct a new symbol_code - * - * @brief Construct a new symbol_code object defaulting to a value of 0 - * - */ - constexpr symbol_code() : value(0) {} - - /** - * Construct a new symbol_code given a scoped enumerated type of raw (uint64_t). - * - * @brief Construct a new symbol_code object initialising value with raw - * @param raw - The raw value which is a scoped enumerated type of unit64_t - * - */ - constexpr explicit symbol_code( uint64_t raw ) - :value(raw) - {} - - /** - * Construct a new symbol_code given an string. - * - * @brief Construct a new symbol_code object initialising value with str - * @param str - The string value which validated then converted to unit64_t - * - */ - constexpr explicit symbol_code( std::string_view str ) - :value(0) - { - if( str.size() > 7 ) { - eosio::check( false, "string is too long to be a valid symbol_code" ); - } - for( auto itr = str.rbegin(); itr != str.rend(); ++itr ) { - if( *itr < 'A' || *itr > 'Z') { - eosio::check( false, "only uppercase letters allowed in symbol_code string" ); - } - value <<= 8; - value |= *itr; - } - } - - /** - * Checks if the symbol code is valid - * @return true - if symbol is valid - */ - constexpr bool is_valid()const { - auto sym = value; - for ( int i=0; i < 7; i++ ) { - char c = (char)(sym & 0xFF); - if ( !('A' <= c && c <= 'Z') ) return false; - sym >>= 8; - if ( !(sym & 0xFF) ) { - do { - sym >>= 8; - if ( (sym & 0xFF) ) return false; - i++; - } while( i < 7 ); - } - } - return true; - } - - /** - * Returns the character length of the provided symbol - * - * @return length - character length of the provided symbol - */ - constexpr uint32_t length()const { - auto sym = value; - uint32_t len = 0; - while (sym & 0xFF && len <= 7) { - len++; - sym >>= 8; - } - return len; - } - - /** - * Casts a symbol code to raw - * - * @return Returns an instance of raw based on the value of a symbol_code - */ - constexpr uint64_t raw()const { return value; } - - /** - * Explicit cast to bool of the symbol_code - * - * @return Returns true if the symbol_code is set to the default value of 0 else true. - */ - constexpr explicit operator bool()const { return value != 0; } - - /** - * Writes the symbol_code as a string to the provided char buffer - * - * - * @brief Writes the symbol_code as a string to the provided char buffer - * @pre is_valid() == true - * @pre The range [begin, end) must be a valid range of memory to write to. - * @param begin - The start of the char buffer - * @param end - Just past the end of the char buffer - * @param dry_run - If true, do not actually write anything into the range. - * @return char* - Just past the end of the last character that would be written assuming dry_run == false and end was large enough to provide sufficient space. (Meaning only applies if returned pointer >= begin.) - * @post If the output string fits within the range [begin, end) and dry_run == false, the range [begin, returned pointer) contains the string representation of the symbol_code. Nothing is written if dry_run == true or returned pointer > end (insufficient space) or if returned pointer < begin (overflow in calculating desired end). - */ - char* write_as_string( char* begin, char* end, bool dry_run = false )const { - constexpr uint64_t mask = 0xFFull; - - if( dry_run || (begin + 7 < begin) || (begin + 7 > end) ) { - char* actual_end = begin + length(); - if( dry_run || (actual_end < begin) || (actual_end > end) ) return actual_end; - } - - auto v = value; - for( auto i = 0; i < 7; ++i, v >>= 8 ) { - if( v == 0 ) return begin; - - *begin = static_cast(v & mask); - ++begin; - } - - return begin; - } - - /** - * Returns the name value as a string by calling write_as_string() and returning the buffer produced by write_as_string() - */ - std::string to_string()const { - char buffer[7]; - auto end = write_as_string( buffer, buffer + sizeof(buffer) ); - return {buffer, end}; - } - - /** - * Prints a symbol_code - * - * @param sym_code symbol code to be printed - */ - inline void print()const { - char buffer[7]; - auto end = write_as_string( buffer, buffer + sizeof(buffer) ); - if( buffer < end ) - printl( buffer, (end-buffer) ); - } - - /** - * Equivalency operator. Returns true if a == b (are the same) - * - * @return boolean - true if both provided symbol_codes are the same - */ - friend constexpr bool operator == ( const symbol_code& a, const symbol_code& b ) { - return a.value == b.value; - } - - /** - * Inverted equivalency operator. Returns true if a != b (are different) - * - * @return boolean - true if both provided symbol_codes are not the same - */ - friend constexpr bool operator != ( const symbol_code& a, const symbol_code& b ) { - return a.value != b.value; - } - - /** - * Less than operator. Returns true if a < b. - * @brief Less than operator - * @return boolean - true if symbol_code `a` is less than `b` - */ - friend constexpr bool operator < ( const symbol_code& a, const symbol_code& b ) { - return a.value < b.value; - } - - private: - uint64_t value = 0; - }; - - /** - * Serialize a symbol_code into a stream - * - * @param ds - The stream to write - * @param sym - The value to serialize - * @tparam DataStream - Type of datastream buffer - * @return DataStream& - Reference to the datastream - */ - template - inline DataStream& operator<<(DataStream& ds, const eosio::symbol_code sym_code) { - uint64_t raw = sym_code.raw(); - ds.write( (const char*)&raw, sizeof(raw)); - return ds; - } - - /** - * Deserialize a symbol_code from a stream - * - * @param ds - The stream to read - * @param symbol - The destination for deserialized value - * @tparam DataStream - Type of datastream buffer - * @return DataStream& - Reference to the datastream - */ - template - inline DataStream& operator>>(DataStream& ds, eosio::symbol_code& sym_code) { - uint64_t raw = 0; - ds.read((char*)&raw, sizeof(raw)); - sym_code = symbol_code(raw); - return ds; - } - - /** - * Stores information about a symbol, the symbol can be 7 characters long. - * - * @ingroup symbol - */ - class symbol { - public: - /** - * Construct a new symbol object defaulting to a value of 0 - */ - constexpr symbol() : value(0) {} - - /** - * Construct a new symbol given a scoped enumerated type of raw (uint64_t). - * - * @param raw - The raw value which is a scoped enumerated type of unit64_t - */ - constexpr explicit symbol( uint64_t raw ) : value(raw) {} - /** - * Construct a new symbol given a symbol_code and a uint8_t precision. - * - * @param sc - The symbol_code - * @param precision - The number of decimal places used for the symbol - */ - constexpr symbol( symbol_code sc, uint8_t precision ) - : value( (sc.raw() << 8) | static_cast(precision) ) - {} - - /** - * Construct a new symbol given a string and a uint8_t precision. - * - * @param ss - The string containing the symbol - * @param precision - The number of decimal places used for the symbol - */ - constexpr symbol( std::string_view ss, uint8_t precision ) - : value( (symbol_code(ss).raw() << 8) | static_cast(precision) ) - {} - - /** - * Is this symbol valid - */ - constexpr bool is_valid()const { return code().is_valid(); } - - /** - * This symbol's precision - */ - constexpr uint8_t precision()const { return static_cast( value & 0xFFull ); } - - /** - * Returns representation of symbol name - */ - constexpr symbol_code code()const { return symbol_code{value >> 8}; } - - /** - * Returns uint64_t repreresentation of the symbol - */ - constexpr uint64_t raw()const { return value; } - - constexpr explicit operator bool()const { return value != 0; } - - /** - * %Print the symbol - */ - void print( bool show_precision = true )const { - if( show_precision ){ - ::eosio::print( static_cast(precision()), "," ); - } - char buffer[7]; - auto end = code().write_as_string( buffer, buffer + sizeof(buffer) ); - if( buffer < end ) - printl( buffer, (end-buffer) ); - } - - /** - * Equivalency operator. Returns true if a == b (are the same) - * - * @return boolean - true if both provided symbols are the same - */ - friend constexpr bool operator == ( const symbol& a, const symbol& b ) { - return a.value == b.value; - } - - /** - * Inverted equivalency operator. Returns true if a != b (are different) - * - * @return boolean - true if both provided symbols are not the same - */ - friend constexpr bool operator != ( const symbol& a, const symbol& b ) { - return a.value != b.value; - } - - /** - * Less than operator. Returns true if a < b. - * @brief Less than operator - * @return boolean - true if symbol `a` is less than `b` - */ - friend constexpr bool operator < ( const symbol& a, const symbol& b ) { - return a.value < b.value; - } - - private: - uint64_t value = 0; - }; - - /** - * Serialize a symbol into a stream - * - * @brief Serialize a symbol - * @param ds - The stream to write - * @param sym - The value to serialize - * @tparam DataStream - Type of datastream buffer - * @return DataStream& - Reference to the datastream - */ - template - inline DataStream& operator<<(DataStream& ds, const eosio::symbol sym) { - uint64_t raw = sym.raw(); - ds.write( (const char*)&raw, sizeof(raw)); - return ds; - } - - /** - * Deserialize a symbol from a stream - * - * @brief Deserialize a symbol - * @param ds - The stream to read - * @param symbol - The destination for deserialized value - * @tparam DataStream - Type of datastream buffer - * @return DataStream& - Reference to the datastream - */ - template - inline DataStream& operator>>(DataStream& ds, eosio::symbol& sym) { - uint64_t raw = 0; - ds.read((char*)&raw, sizeof(raw)); - sym = symbol(raw); - return ds; - } - - /** - * Extended asset which stores the information of the owner of the symbol - * - * @ingroup symbol - */ - class extended_symbol - { - public: - - /** - * Default constructor, construct a new extended_symbol - */ - constexpr extended_symbol() {} - - /** - * Construct a new symbol_code object initialising symbol and contract with the passed in symbol and name - * - * @param sym - The symbol - * @param con - The name of the contract - */ - constexpr extended_symbol( symbol s, name con ) : sym(s), contract(con) {} - - /** - * Returns the symbol in the extended_contract - * - * @return symbol - */ - constexpr symbol get_symbol() const { return sym; } - - /** - * Returns the name of the contract in the extended_symbol - * - * @return name - */ - constexpr name get_contract() const { return contract; } - - /** - * %Print the extended symbol - * - * @brief %Print the extended symbol - */ - void print( bool show_precision = true )const { - sym.print( show_precision ); - ::eosio::print("@", contract); - } - - /** - * Equivalency operator. Returns true if a == b (are the same) - * - * @return boolean - true if both provided extended_symbols are the same - */ - friend constexpr bool operator == ( const extended_symbol& a, const extended_symbol& b ) { - return std::tie( a.sym, a.contract ) == std::tie( b.sym, b.contract ); - } - - /** - * Inverted equivalency operator. Returns true if a != b (are different) - * - * @return boolean - true if both provided extended_symbols are not the same - */ - friend constexpr bool operator != ( const extended_symbol& a, const extended_symbol& b ) { - return std::tie( a.sym, a.contract ) != std::tie( b.sym, b.contract ); - } - - /** - * Less than operator. Returns true if a < b. - * - * @return boolean - true if extended_symbol `a` is less than `b` - */ - friend constexpr bool operator < ( const extended_symbol& a, const extended_symbol& b ) { - return std::tie( a.sym, a.contract ) < std::tie( b.sym, b.contract ); - } - - private: - symbol sym; ///< the symbol - name contract; ///< the token contract hosting the symbol +inline void print(symbol obj) { + print(obj.to_string()); +} - EOSLIB_SERIALIZE( extended_symbol, (sym)(contract) ) - }; } diff --git a/libraries/eosiolib/core/eosio/time.hpp b/libraries/eosiolib/core/eosio/time.hpp deleted file mode 100644 index 9bdc0ad10d..0000000000 --- a/libraries/eosiolib/core/eosio/time.hpp +++ /dev/null @@ -1,211 +0,0 @@ -#pragma once -#include -#include -#include "check.hpp" -#include "serialize.hpp" - -namespace eosio { - /** - * @defgroup time - * @ingroup core - * @brief Classes for working with time. - */ - - - - class microseconds { - public: - explicit microseconds( int64_t c = 0) :_count(c){} - - /// @cond INTERNAL - static microseconds maximum() { return microseconds(0x7fffffffffffffffll); } - friend microseconds operator + (const microseconds& l, const microseconds& r ) { return microseconds(l._count+r._count); } - friend microseconds operator - (const microseconds& l, const microseconds& r ) { return microseconds(l._count-r._count); } - - - bool operator==(const microseconds& c)const { return _count == c._count; } - bool operator!=(const microseconds& c)const { return _count != c._count; } - friend bool operator>(const microseconds& a, const microseconds& b){ return a._count > b._count; } - friend bool operator>=(const microseconds& a, const microseconds& b){ return a._count >= b._count; } - friend bool operator<(const microseconds& a, const microseconds& b){ return a._count < b._count; } - friend bool operator<=(const microseconds& a, const microseconds& b){ return a._count <= b._count; } - microseconds& operator+=(const microseconds& c) { _count += c._count; return *this; } - microseconds& operator-=(const microseconds& c) { _count -= c._count; return *this; } - int64_t count()const { return _count; } - int64_t to_seconds()const { return _count/1000000; } - - int64_t _count; - /// @endcond - EOSLIB_SERIALIZE( microseconds, (_count) ) - private: - friend class time_point; - }; - - inline microseconds seconds( int64_t s ) { return microseconds( s * 1000000 ); } - inline microseconds milliseconds( int64_t s ) { return microseconds( s * 1000 ); } - inline microseconds minutes(int64_t m) { return seconds(60*m); } - inline microseconds hours(int64_t h) { return minutes(60*h); } - inline microseconds days(int64_t d) { return hours(24*d); } - - /** - * High resolution time point in microseconds - * - * @ingroup time - */ - class time_point { - public: - explicit time_point( microseconds e = microseconds() ) :elapsed(e){} - const microseconds& time_since_epoch()const { return elapsed; } - uint32_t sec_since_epoch()const { return uint32_t(elapsed.count() / 1000000); } - - /// @cond INTERNAL - bool operator > ( const time_point& t )const { return elapsed._count > t.elapsed._count; } - bool operator >=( const time_point& t )const { return elapsed._count >=t.elapsed._count; } - bool operator < ( const time_point& t )const { return elapsed._count < t.elapsed._count; } - bool operator <=( const time_point& t )const { return elapsed._count <=t.elapsed._count; } - bool operator ==( const time_point& t )const { return elapsed._count ==t.elapsed._count; } - bool operator !=( const time_point& t )const { return elapsed._count !=t.elapsed._count; } - time_point& operator += ( const microseconds& m) { elapsed+=m; return *this; } - time_point& operator -= ( const microseconds& m) { elapsed-=m; return *this; } - time_point operator + (const microseconds& m) const { return time_point(elapsed+m); } - time_point operator + (const time_point& m) const { return time_point(elapsed+m.elapsed); } - time_point operator - (const microseconds& m) const { return time_point(elapsed-m); } - microseconds operator - (const time_point& m) const { return microseconds(elapsed.count() - m.elapsed.count()); } - microseconds elapsed; - /// @endcond - - EOSLIB_SERIALIZE( time_point, (elapsed) ) - }; - - /** - * A lower resolution time_point accurate only to seconds from 1970 - * - * @ingroup time - */ - class time_point_sec - { - public: - time_point_sec() - :utc_seconds(0){} - - explicit time_point_sec(uint32_t seconds ) - :utc_seconds(seconds){} - - time_point_sec( const time_point& t ) - :utc_seconds( uint32_t(t.time_since_epoch().count() / 1000000ll) ){} - - static time_point_sec maximum() { return time_point_sec(0xffffffff); } - static time_point_sec min() { return time_point_sec(0); } - - operator time_point()const { return time_point( eosio::seconds( utc_seconds) ); } - uint32_t sec_since_epoch()const { return utc_seconds; } - - /// @cond INTERNAL - time_point_sec operator = ( const eosio::time_point& t ) - { - utc_seconds = uint32_t(t.time_since_epoch().count() / 1000000ll); - return *this; - } - friend bool operator < ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds < b.utc_seconds; } - friend bool operator > ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds > b.utc_seconds; } - friend bool operator <= ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds <= b.utc_seconds; } - friend bool operator >= ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds >= b.utc_seconds; } - friend bool operator == ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds == b.utc_seconds; } - friend bool operator != ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds != b.utc_seconds; } - time_point_sec& operator += ( uint32_t m ) { utc_seconds+=m; return *this; } - time_point_sec& operator += ( microseconds m ) { utc_seconds+=m.to_seconds(); return *this; } - time_point_sec& operator += ( time_point_sec m ) { utc_seconds+=m.utc_seconds; return *this; } - time_point_sec& operator -= ( uint32_t m ) { utc_seconds-=m; return *this; } - time_point_sec& operator -= ( microseconds m ) { utc_seconds-=m.to_seconds(); return *this; } - time_point_sec& operator -= ( time_point_sec m ) { utc_seconds-=m.utc_seconds; return *this; } - time_point_sec operator +( uint32_t offset )const { return time_point_sec(utc_seconds + offset); } - time_point_sec operator -( uint32_t offset )const { return time_point_sec(utc_seconds - offset); } - - friend time_point operator + ( const time_point_sec& t, const microseconds& m ) { return time_point(t) + m; } - friend time_point operator - ( const time_point_sec& t, const microseconds& m ) { return time_point(t) - m; } - friend microseconds operator - ( const time_point_sec& t, const time_point_sec& m ) { return time_point(t) - time_point(m); } - friend microseconds operator - ( const time_point& t, const time_point_sec& m ) { return time_point(t) - time_point(m); } - uint32_t utc_seconds; - - /// @endcond - - EOSLIB_SERIALIZE( time_point_sec, (utc_seconds) ) - }; - - /** - * This class is used in the block headers to represent the block time - * It is a parameterised class that takes an Epoch in milliseconds and - * and an interval in milliseconds and computes the number of slots. - * - * @ingroup time - **/ - class block_timestamp { - public: - explicit block_timestamp( uint32_t s=0 ) :slot(s){} - - block_timestamp(const time_point& t) { - set_time_point(t); - } - - block_timestamp(const time_point_sec& t) { - set_time_point(t); - } - - static block_timestamp maximum() { return block_timestamp( 0xffff ); } - static block_timestamp min() { return block_timestamp(0); } - - block_timestamp next() const { - eosio::check( std::numeric_limits::max() - slot >= 1, "block timestamp overflow" ); - auto result = block_timestamp(*this); - result.slot += 1; - return result; - } - - time_point to_time_point() const { - return (time_point)(*this); - } - - operator time_point() const { - int64_t msec = slot * (int64_t)block_interval_ms; - msec += block_timestamp_epoch; - return time_point(milliseconds(msec)); - } - - /// @cond INTERNAL - void operator = (const time_point& t ) { - set_time_point(t); - } - - bool operator > ( const block_timestamp& t )const { return slot > t.slot; } - bool operator >=( const block_timestamp& t )const { return slot >= t.slot; } - bool operator < ( const block_timestamp& t )const { return slot < t.slot; } - bool operator <=( const block_timestamp& t )const { return slot <= t.slot; } - bool operator ==( const block_timestamp& t )const { return slot == t.slot; } - bool operator !=( const block_timestamp& t )const { return slot != t.slot; } - uint32_t slot; - static constexpr int32_t block_interval_ms = 500; - static constexpr int64_t block_timestamp_epoch = 946684800000ll; // epoch is year 2000 - /// @endcond - - EOSLIB_SERIALIZE( block_timestamp, (slot) ) - private: - - - void set_time_point(const time_point& t) { - int64_t micro_since_epoch = t.time_since_epoch().count(); - int64_t msec_since_epoch = micro_since_epoch / 1000; - slot = uint32_t(( msec_since_epoch - block_timestamp_epoch ) / int64_t(block_interval_ms)); - } - - void set_time_point(const time_point_sec& t) { - int64_t sec_since_epoch = t.sec_since_epoch(); - slot = uint32_t((sec_since_epoch * 1000 - block_timestamp_epoch) / block_interval_ms); - } - }; // block_timestamp - - /** - * @ingroup time - */ - typedef block_timestamp block_timestamp_type; - -} // namespace eosio diff --git a/libraries/eosiolib/core/eosio/varint.hpp b/libraries/eosiolib/core/eosio/varint.hpp deleted file mode 100644 index f3a8804961..0000000000 --- a/libraries/eosiolib/core/eosio/varint.hpp +++ /dev/null @@ -1,465 +0,0 @@ -/** - * @file - * @copyright defined in eos/LICENSE - */ -#pragma once - -namespace eosio { - /** - * @defgroup varint Variable Length Integer Type - * @ingroup core - * @ingroup types - * @brief Defines variable length integer type which provides more efficient serialization - */ - - /** - * Variable Length Unsigned Integer. This provides more efficient serialization of 32-bit unsigned int. - * It serialuzes a 32-bit unsigned integer in as few bytes as possible - * `varuint32` is unsigned and uses [VLQ or Base-128 encoding](https://en.wikipedia.org/wiki/Variable-length_quantity) - * - * @ingroup varint - */ - struct unsigned_int { - /** - * Construct a new unsigned int object - * - * @param v - Source - */ - unsigned_int( uint32_t v = 0 ):value(v){} - - /** - * Construct a new unsigned int object from a type that is convertible to uint32_t - * - * @tparam T - Type of the source - * @param v - Source - * @pre T must be convertible to uint32_t - */ - template - unsigned_int( T v ):value(v){} - - //operator uint32_t()const { return value; } - //operator uint64_t()const { return value; } - - /** - * Convert unsigned_int as T - * - * @tparam T - Target type of conversion - * @return T - Converted target - */ - template - operator T()const { return static_cast(value); } - - /// @cond OPERATORS - - /** - * Assign 32-bit unsigned integer - * - * @param v - Soruce - * @return unsigned_int& - Reference to this object - */ - unsigned_int& operator=( uint32_t v ) { value = v; return *this; } - - /// @endcond - - /** - * Contained value - */ - uint32_t value; - - /// @cond OPERATORS - - /** - * Check equality between a unsigned_int object and 32-bit unsigned integer - * - * @param i - unsigned_int object to compare - * @param v - 32-bit unsigned integer to compare - * @return true - if equal - * @return false - otherwise - */ - friend bool operator==( const unsigned_int& i, const uint32_t& v ) { return i.value == v; } - - /** - * Check equality between 32-bit unsigned integer and a unsigned_int object - * - * @param i - 32-bit unsigned integer to compare - * @param v - unsigned_int object to compare - * @return true - if equal - * @return false - otherwise - */ - friend bool operator==( const uint32_t& i, const unsigned_int& v ) { return i == v.value; } - - /** - * Check equality between two unsigned_int objects - * - * @param i - First unsigned_int object to compare - * @param v - Second unsigned_int object to compare - * @return true - if equal - * @return false - otherwise - */ - friend bool operator==( const unsigned_int& i, const unsigned_int& v ) { return i.value == v.value; } - - /** - * Check inequality between a unsigned_int object and 32-bit unsigned integer - * - * @param i - unsigned_int object to compare - * @param v - 32-bit unsigned integer to compare - * @return true - if inequal - * @return false - otherwise - */ - friend bool operator!=( const unsigned_int& i, const uint32_t& v ) { return i.value != v; } - - /** - * Check inequality between 32-bit unsigned integer and a unsigned_int object - * - * @param i - 32-bit unsigned integer to compare - * @param v - unsigned_int object to compare - * @return true - if unequal - * @return false - otherwise - */ - friend bool operator!=( const uint32_t& i, const unsigned_int& v ) { return i != v.value; } - - /** - * Check inequality between two unsigned_int objects - * - * @param i - First unsigned_int object to compare - * @param v - Second unsigned_int object to compare - * @return true - if inequal - * @return false - otherwise - */ - friend bool operator!=( const unsigned_int& i, const unsigned_int& v ) { return i.value != v.value; } - - /** - * Check if the given unsigned_int object is less than the given 32-bit unsigned integer - * - * @param i - unsigned_int object to compare - * @param v - 32-bit unsigned integer to compare - * @return true - if i less than v - * @return false - otherwise - */ - friend bool operator<( const unsigned_int& i, const uint32_t& v ) { return i.value < v; } - - /** - * Check if the given 32-bit unsigned integer is less than the given unsigned_int object - * - * @param i - 32-bit unsigned integer to compare - * @param v - unsigned_int object to compare - * @return true - if i less than v - * @return false - otherwise - */ - friend bool operator<( const uint32_t& i, const unsigned_int& v ) { return i < v.value; } - - /** - * Check if the first given unsigned_int is less than the second given unsigned_int object - * - * @param i - First unsigned_int object to compare - * @param v - Second unsigned_int object to compare - * @return true - if i less than v - * @return false - otherwise - */ - friend bool operator<( const unsigned_int& i, const unsigned_int& v ) { return i.value < v.value; } - - /** - * Check if the given unsigned_int object is greater or equal to the given 32-bit unsigned integer - * - * @param i - unsigned_int object to compare - * @param v - 32-bit unsigned integer to compare - * @return true - if i is greater or equal to v - * @return false - otherwise - */ - friend bool operator>=( const unsigned_int& i, const uint32_t& v ) { return i.value >= v; } - - /** - * Check if the given 32-bit unsigned integer is greater or equal to the given unsigned_int object - * - * @param i - 32-bit unsigned integer to compare - * @param v - unsigned_int object to compare - * @return true - if i is greater or equal to v - * @return false - otherwise - */ - friend bool operator>=( const uint32_t& i, const unsigned_int& v ) { return i >= v.value; } - - /** - * Check if the first given unsigned_int is greater or equal to the second given unsigned_int object - * - * @param i - First unsigned_int object to compare - * @param v - Second unsigned_int object to compare - * @return true - if i is greater or equal to v - * @return false - otherwise - */ - friend bool operator>=( const unsigned_int& i, const unsigned_int& v ) { return i.value >= v.value; } - - - /// @endcond - - /// @cond IMPLEMENTATIONS - - /** - * Serialize an unsigned_int object with as few bytes as possible - * - * @param ds - The stream to write - * @param v - The value to serialize - * @tparam DataStream - Type of datastream - * @return DataStream& - Reference to the datastream - */ - template - friend DataStream& operator << ( DataStream& ds, const unsigned_int& v ){ - uint64_t val = v.value; - do { - uint8_t b = uint8_t(val) & 0x7f; - val >>= 7; - b |= ((val > 0) << 7); - ds.write((char*)&b,1);//.put(b); - } while( val ); - return ds; - } - - /** - * Deserialize an unsigned_int object - * - * @param ds - The stream to read - * @param vi - The destination for deserialized value - * @tparam DataStream - Type of datastream - * @return DataStream& - Reference to the datastream - */ - template - friend DataStream& operator >> ( DataStream& ds, unsigned_int& vi ){ - uint64_t v = 0; char b = 0; uint8_t by = 0; - do { - ds.get(b); - v |= uint32_t(uint8_t(b) & 0x7f) << by; - by += 7; - } while( uint8_t(b) & 0x80 ); - vi.value = static_cast(v); - return ds; - } - - /// @endcond - }; - - /** - * Variable Length Signed Integer. This provides more efficient serialization of 32-bit signed int. - * It serializes a 32-bit signed integer in as few bytes as possible. - * - * @ingroup varint - * @note `varint32' is signed and uses [Zig-Zag encoding](https://developers.google.com/protocol-buffers/docs/encoding#signed-integers) - */ - struct signed_int { - /** - * Construct a new signed int object - * - * @param v - Source - */ - signed_int( int32_t v = 0 ):value(v){} - - /// @cond OPERATORS - - /** - * Convert signed_int to primitive 32-bit signed integer - * - * @return int32_t - The converted result - */ - operator int32_t()const { return value; } - - - /** - * Assign an object that is convertible to int32_t - * - * @tparam T - Type of the assignment object - * @param v - Source - * @return unsigned_int& - Reference to this object - */ - template - signed_int& operator=( const T& v ) { value = v; return *this; } - - /** - * Increment operator - * - * @return signed_int - New signed_int with value incremented from the current object's value - */ - signed_int operator++(int) { return value++; } - - /** - * Increment operator - * - * @return signed_int - Reference to current object - */ - signed_int& operator++(){ ++value; return *this; } - - /// @endcond - - /** - * Contained value - */ - int32_t value; - - /// @cond OPERATORS - - /** - * Check equality between a signed_int object and 32-bit integer - * - * @param i - signed_int object to compare - * @param v - 32-bit integer to compare - * @return true - if equal - * @return false - otherwise - */ - friend bool operator==( const signed_int& i, const int32_t& v ) { return i.value == v; } - - /** - * Check equality between 32-bit integer and a signed_int object - * - * @param i - 32-bit integer to compare - * @param v - signed_int object to compare - * @return true - if equal - * @return false - otherwise - */ - friend bool operator==( const int32_t& i, const signed_int& v ) { return i == v.value; } - - /** - * Check equality between two signed_int objects - * - * @param i - First signed_int object to compare - * @param v - Second signed_int object to compare - * @return true - if equal - * @return false - otherwise - */ - friend bool operator==( const signed_int& i, const signed_int& v ) { return i.value == v.value; } - - - /** - * Check inequality between a signed_int object and 32-bit integer - * - * @param i - signed_int object to compare - * @param v - 32-bit integer to compare - * @return true - if inequal - * @return false - otherwise - */ - friend bool operator!=( const signed_int& i, const int32_t& v ) { return i.value != v; } - - /** - * Check inequality between 32-bit integer and a signed_int object - * - * @param i - 32-bit integer to compare - * @param v - signed_int object to compare - * @return true - if unequal - * @return false - otherwise - */ - friend bool operator!=( const int32_t& i, const signed_int& v ) { return i != v.value; } - - /** - * Check inequality between two signed_int objects - * - * @param i - First signed_int object to compare - * @param v - Second signed_int object to compare - * @return true - if inequal - * @return false - otherwise - */ - friend bool operator!=( const signed_int& i, const signed_int& v ) { return i.value != v.value; } - - /** - * Check if the given signed_int object is less than the given 32-bit integer - * - * @param i - signed_int object to compare - * @param v - 32-bit integer to compare - * @return true - if i less than v - * @return false - otherwise - */ - friend bool operator<( const signed_int& i, const int32_t& v ) { return i.value < v; } - - /** - * Check if the given 32-bit integer is less than the given signed_int object - * - * @param i - 32-bit integer to compare - * @param v - signed_int object to compare - * @return true - if i less than v - * @return false - otherwise - */ - friend bool operator<( const int32_t& i, const signed_int& v ) { return i < v.value; } - - /** - * Check if the first given signed_int is less than the second given signed_int object - * - * @param i - First signed_int object to compare - * @param v - Second signed_int object to compare - * @return true - if i less than v - * @return false - otherwise - */ - friend bool operator<( const signed_int& i, const signed_int& v ) { return i.value < v.value; } - - - /** - * Check if the given signed_int object is greater or equal to the given 32-bit integer - * - * @param i - signed_int object to compare - * @param v - 32-bit integer to compare - * @return true - if i is greater or equal to v - * @return false - otherwise - */ - friend bool operator>=( const signed_int& i, const int32_t& v ) { return i.value >= v; } - - /** - * Check if the given 32-bit integer is greater or equal to the given signed_int object - * - * @param i - 32-bit integer to compare - * @param v - signed_int object to compare - * @return true - if i is greater or equal to v - * @return false - otherwise - */ - friend bool operator>=( const int32_t& i, const signed_int& v ) { return i >= v.value; } - - /** - * Check if the first given signed_int is greater or equal to the second given signed_int object - * - * @param i - First signed_int object to compare - * @param v - Second signed_int object to compare - * @return true - if i is greater or equal to v - * @return false - otherwise - */ - friend bool operator>=( const signed_int& i, const signed_int& v ) { return i.value >= v.value; } - - /// @endcond - - /// @cond IMPLEMENTATIONS - - /** - * Serialize an signed_int object with as few bytes as possible - * - * @param ds - The stream to write - * @param v - The value to serialize - * @tparam DataStream - Type of datastream - * @return DataStream& - Reference to the datastream - */ - template - friend DataStream& operator << ( DataStream& ds, const signed_int& v ){ - uint32_t val = uint32_t((v.value<<1) ^ (v.value>>31)); - do { - uint8_t b = uint8_t(val) & 0x7f; - val >>= 7; - b |= ((val > 0) << 7); - ds.write((char*)&b,1);//.put(b); - } while( val ); - return ds; - } - - /** - * Deserialize an signed_int object - * - * @param ds - The stream to read - * @param vi - The destination for deserialized value - * @tparam DataStream - Type of datastream - * @return DataStream& - Reference to the datastream - */ - template - friend DataStream& operator >> ( DataStream& ds, signed_int& vi ){ - uint32_t v = 0; char b = 0; int by = 0; - do { - ds.get(b); - v |= uint32_t(uint8_t(b) & 0x7f) << by; - by += 7; - } while( uint8_t(b) & 0x80 ); - vi.value = (v>>1) ^ (~(v&1)+1ull); - return ds; - } - - /// @endcond - }; -} diff --git a/libraries/eosiolib/crypto.cpp b/libraries/eosiolib/crypto.cpp index 6df7d145ae..0569bf6a57 100644 --- a/libraries/eosiolib/crypto.cpp +++ b/libraries/eosiolib/crypto.cpp @@ -2,8 +2,8 @@ * @file * @copyright defined in eos/LICENSE */ -#include "core/eosio/crypto.hpp" -#include "core/eosio/datastream.hpp" +#include +#include extern "C" { struct __attribute__((aligned (16))) capi_checksum160 { uint8_t hash[20]; }; diff --git a/libraries/eosiolib/eosiolib.cpp b/libraries/eosiolib/eosiolib.cpp index 12eac10a0d..fc51fdb64c 100644 --- a/libraries/eosiolib/eosiolib.cpp +++ b/libraries/eosiolib/eosiolib.cpp @@ -107,7 +107,6 @@ namespace eosio { * @post If the output string fits within the range [begin, end), the range [begin, returned pointer) contains the string representation of the number. Nothing is written if dry_run == true or returned pointer > end (insufficient space) or if returned pointer < begin (overflow in calculating desired end). */ char* write_decimal( char* begin, char* end, bool dry_run, uint64_t number, uint8_t num_decimal_places, bool negative ) { - constexpr static uint8_t log10_max_uint64 = powers_of_base<10, uint64_t>.size() - 1; // 19 const auto& powers_of_ten = powers_of_base<10, uint64_t>; uint8_t num_digits = (std::upper_bound( powers_of_ten.begin(), powers_of_ten.end(), number ) - powers_of_ten.begin()); // num_digits == 0 iff number == 0 diff --git a/libraries/eosiolib/tester/eosio/chain_types.hpp b/libraries/eosiolib/tester/eosio/chain_types.hpp index 5e228bcec8..99806ac0b6 100644 --- a/libraries/eosiolib/tester/eosio/chain_types.hpp +++ b/libraries/eosiolib/tester/eosio/chain_types.hpp @@ -1,10 +1,15 @@ #pragma once -#include +#include #include #include #include #include +#include +#include +#include +#include +#include #ifdef EOSIO_CDT_COMPILATION # include @@ -62,34 +67,34 @@ inline transaction_status get_transaction_status(const std::string& s) { } struct permission_level { - abieos::name actor = {}; - abieos::name permission = {}; + eosio::name actor = {}; + eosio::name permission = {}; }; EOSIO_REFLECT(permission_level, actor, permission); struct account_auth_sequence { - abieos::name account = {}; - uint64_t sequence = {}; + eosio::name account = {}; + uint64_t sequence = {}; }; EOSIO_REFLECT(account_auth_sequence, account, sequence); struct account_delta { - abieos::name account = {}; + eosio::name account = {}; int64_t delta = {}; }; EOSIO_REFLECT(account_delta, account, delta); struct action_receipt_v0 { - abieos::name receiver = {}; - abieos::checksum256 act_digest = {}; + eosio::name receiver = {}; + eosio::checksum256 act_digest = {}; uint64_t global_sequence = {}; uint64_t recv_sequence = {}; std::vector auth_sequence = {}; - abieos::varuint32 code_sequence = {}; - abieos::varuint32 abi_sequence = {}; + eosio::varuint32 code_sequence = {}; + eosio::varuint32 abi_sequence = {}; }; EOSIO_REFLECT(action_receipt_v0, receiver, act_digest, global_sequence, recv_sequence, auth_sequence, code_sequence, abi_sequence); @@ -97,8 +102,8 @@ EOSIO_REFLECT(action_receipt_v0, receiver, act_digest, global_sequence, recv_seq using action_receipt = std::variant; struct action { - abieos::name account = {}; - abieos::name name = {}; + eosio::name account = {}; + eosio::name name = {}; std::vector authorization = {}; eosio::input_stream data = {}; }; @@ -106,10 +111,10 @@ struct action { EOSIO_REFLECT(action, account, name, authorization, data); struct action_trace_v0 { - abieos::varuint32 action_ordinal = {}; - abieos::varuint32 creator_action_ordinal = {}; + eosio::varuint32 action_ordinal = {}; + eosio::varuint32 creator_action_ordinal = {}; std::optional receipt = {}; - abieos::name receiver = {}; + eosio::name receiver = {}; action act = {}; bool context_free = {}; int64_t elapsed = {}; @@ -125,14 +130,14 @@ EOSIO_REFLECT(action_trace_v0, action_ordinal, creator_action_ordinal, receipt, using action_trace = std::variant; struct partial_transaction_v0 { - abieos::time_point_sec expiration = {}; + eosio::time_point_sec expiration = {}; uint16_t ref_block_num = {}; uint32_t ref_block_prefix = {}; - abieos::varuint32 max_net_usage_words = {}; + eosio::varuint32 max_net_usage_words = {}; uint8_t max_cpu_usage_ms = {}; - abieos::varuint32 delay_sec = {}; + eosio::varuint32 delay_sec = {}; std::vector transaction_extensions = {}; - std::vector signatures = {}; + std::vector signatures = {}; std::vector context_free_data = {}; }; @@ -145,10 +150,10 @@ struct transaction_trace_v0; using transaction_trace = std::variant; struct transaction_trace_v0 { - abieos::checksum256 id = {}; + eosio::checksum256 id = {}; transaction_status status = {}; uint32_t cpu_usage_us = {}; - abieos::varuint32 net_usage_words = {}; + eosio::varuint32 net_usage_words = {}; int64_t elapsed = {}; uint64_t net_usage = {}; bool scheduled = {}; @@ -164,8 +169,8 @@ EOSIO_REFLECT(transaction_trace_v0, id, status, cpu_usage_us, elapsed, net_usage account_ram_delta, except, error_code, failed_dtrx_trace, reserved_do_not_use); struct producer_key { - abieos::name producer_name = {}; - abieos::public_key block_signing_key = {}; + eosio::name producer_name = {}; + eosio::public_key block_signing_key = {}; }; EOSIO_REFLECT(producer_key, producer_name, block_signing_key); @@ -180,13 +185,13 @@ EOSIO_REFLECT(producer_schedule, version, producers); struct transaction_receipt_header { transaction_status status = {}; uint32_t cpu_usage_us = {}; - abieos::varuint32 net_usage_words = {}; + eosio::varuint32 net_usage_words = {}; }; EOSIO_REFLECT(transaction_receipt_header, status, cpu_usage_us, net_usage_words); struct packed_transaction { - std::vector signatures = {}; + std::vector signatures = {}; uint8_t compression = {}; eosio::input_stream packed_context_free_data = {}; eosio::input_stream packed_trx = {}; @@ -194,7 +199,7 @@ struct packed_transaction { EOSIO_REFLECT(packed_transaction, signatures, compression, packed_context_free_data, packed_trx); -using transaction_variant = std::variant; +using transaction_variant = std::variant; struct transaction_receipt : transaction_receipt_header { transaction_variant trx = {}; @@ -203,12 +208,12 @@ struct transaction_receipt : transaction_receipt_header { EOSIO_REFLECT(transaction_receipt, base transaction_receipt_header, trx); struct block_header { - abieos::block_timestamp timestamp = {}; - abieos::name producer = {}; + eosio::block_timestamp timestamp; + eosio::name producer = {}; uint16_t confirmed = {}; - abieos::checksum256 previous = {}; - abieos::checksum256 transaction_mroot = {}; - abieos::checksum256 action_mroot = {}; + eosio::checksum256 previous = {}; + eosio::checksum256 transaction_mroot = {}; + eosio::checksum256 action_mroot = {}; uint32_t schedule_version = {}; std::optional new_producers = {}; std::vector header_extensions = {}; @@ -220,7 +225,7 @@ EOSIO_REFLECT(block_header, ) struct signed_block_header : block_header { - abieos::signature producer_signature = {}; + eosio::signature producer_signature = {}; }; EOSIO_REFLECT(signed_block_header, base block_header, producer_signature); @@ -234,8 +239,8 @@ EOSIO_REFLECT(signed_block, base signed_block_header, transactions, block_extens struct block_info { uint32_t block_num = {}; - abieos::checksum256 block_id = {}; - abieos::block_timestamp timestamp = {}; + eosio::checksum256 block_id = {}; + eosio::block_timestamp timestamp; }; EOSIO_REFLECT(block_info, block_num, block_id, timestamp); diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index f1efc8c6d3..d061f22bb1 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -146,29 +146,17 @@ inline int32_t execute(std::string_view command) { return internal_use_do_not_use::execute(command.data(), command.data() + command.size()); } -inline abieos::public_key string_to_public_key(std::string_view s) { - std::string error; - abieos::public_key result; - check(abieos::string_to_public_key(result, error, s), error); - return result; -} - -inline abieos::private_key string_to_private_key(std::string_view s) { - std::string error; - abieos::private_key result; - check(abieos::string_to_private_key(result, error, s), error); - return result; -} - -inline public_key convert(const abieos::public_key& k) { return unpack(check(convert_to_bin(k)).value()); } - -inline abieos::asset string_to_asset(const char* s) { - return check(eosio::convert_from_string(s)).value(); + template + T get(result&& obj) { + if(!obj) check(false, obj.error().message()); + return std::move(obj.value()); + } + +inline asset string_to_asset(const char* s) { + return check(eosio::convert_from_string(s)).value(); } -inline symbol convert(abieos::symbol s) { return symbol(s.value); } -inline asset convert(const abieos::asset& a) { return { a.amount, convert(a.sym) }; } -inline asset s2a(const char* s) { return convert(string_to_asset(s)); } +inline asset s2a(const char* s) { return string_to_asset(s); } // TODO: move struct tester_key_weight { @@ -209,24 +197,8 @@ using chain_types::transaction_status; auto conversion_kind(chain_types::permission_level, permission_level) -> strict_conversion; auto conversion_kind(chain_types::action, action) -> strict_conversion; -struct account_auth_sequence { - name account = {}; - uint64_t sequence = {}; -}; - -auto conversion_kind(chain_types::account_auth_sequence, account_auth_sequence) -> strict_conversion; - -struct account_delta { - name account = {}; - int64_t delta = {}; -}; - -auto conversion_kind(chain_types::account_delta, account_delta) -> strict_conversion; - -template -void convert(const abieos::fixed_binary& src, eosio::fixed_bytes& dst, F&& f) { - dst = src.value; -} +using chain_types::account_delta; +using chain_types::account_auth_sequence; struct action_receipt { name receiver = {}; @@ -238,11 +210,6 @@ struct action_receipt { uint32_t abi_sequence = {}; }; -template -void convert(const abieos::name& src, eosio::name& dst, F&&) { - dst.value = src.value; -} - auto conversion_kind(chain_types::action_receipt_v0, action_receipt) -> strict_conversion; struct action_trace { @@ -279,16 +246,7 @@ struct transaction_trace { auto conversion_kind(chain_types::transaction_trace_v0, transaction_trace) -> narrowing_conversion; auto serialize_as(const transaction_trace&) -> chain_types::transaction_trace; -auto conversion_kind(abieos::block_timestamp, block_timestamp) -> strict_conversion; - -struct block_info { - uint32_t block_num = {}; - checksum256 block_id = {}; - block_timestamp timestamp; -}; - -auto conversion_kind(chain_types::block_info, block_info) -> strict_conversion; -auto serialize_as(block_info) -> chain_types::block_info; +using chain_types::block_info; /** * Validates the status of a transaction. If expected_except is nullptr, then the @@ -313,13 +271,32 @@ inline void expect(const transaction_trace& tt, const char* expected_except = nu } } +template +void hex(SrcIt begin, SrcIt end, DestIt dest) { + auto nibble = [&dest](uint8_t i) { + if (i <= 9) + *dest++ = '0' + i; + else + *dest++ = 'A' + i - 10; + }; + while (begin != end) { + nibble(((uint8_t)*begin) >> 4); + nibble(((uint8_t)*begin) & 0xf); + ++begin; + } +} + template std::ostream& operator<<(std::ostream& os, const fixed_bytes& d) { auto arr = d.extract_as_byte_array(); - abieos::hex(arr.begin(), arr.end(), std::ostreambuf_iterator(os.rdbuf())); + hex(arr.begin(), arr.end(), std::ostreambuf_iterator(os.rdbuf())); return os; } +inline std::ostream& operator<<(std::ostream& os, const block_timestamp& obj) { + return os << obj.slot; +} + /** * Manages a chain. * Only one test_chain can exist at a time. @@ -331,8 +308,8 @@ class test_chain { std::optional head_block_info; public: - abieos::public_key default_pub_key = string_to_public_key("EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"); - abieos::private_key default_priv_key = string_to_private_key("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"); + public_key default_pub_key = public_key_from_string("EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV").value(); + private_key default_priv_key = private_key_from_string("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3").value(); test_chain() : id{ internal_use_do_not_use::create_chain() } {} test_chain(const test_chain&) = delete; @@ -404,9 +381,9 @@ class test_chain { * Pushes a transaction onto the chain. If no block is currently pending, starts one. */ [[nodiscard]] - transaction_trace push_transaction(const transaction& trx, const std::vector& keys, + transaction_trace push_transaction(const transaction& trx, const std::vector& keys, const std::vector>& context_free_data = {}, - const std::vector& signatures = {}) { + const std::vector& signatures = {}) { std::vector packed_trx = pack(trx); std::vector args; @@ -432,7 +409,7 @@ class test_chain { * * Validates the transaction status according to @ref eosio::expect. */ - transaction_trace transact(std::vector&& actions, const std::vector& keys, + transaction_trace transact(std::vector&& actions, const std::vector& keys, const char* expected_except = nullptr) { auto trace = push_transaction(make_transaction(std::move(actions)), keys); expect(trace, expected_except); @@ -475,7 +452,7 @@ class test_chain { } transaction_trace create_account(name ac, const char* expected_except = nullptr) { - return create_account(ac, convert(default_pub_key), expected_except); + return create_account(ac, default_pub_key, expected_except); } /** @@ -513,11 +490,11 @@ class test_chain { transaction_trace create_code_account(name ac, bool is_priv = false, const char* expected_except = nullptr) { - return create_code_account(ac, convert(default_pub_key), is_priv, expected_except); + return create_code_account(ac, default_pub_key, is_priv, expected_except); } transaction_trace create_code_account(name ac, const char* expected_except) { - return create_code_account(ac, convert(default_pub_key), false, expected_except); + return create_code_account(ac, default_pub_key, false, expected_except); } /* diff --git a/libraries/eosiolib/tester/tester_intrinsics.cpp b/libraries/eosiolib/tester/tester_intrinsics.cpp index aac893a3a8..26aede789d 100644 --- a/libraries/eosiolib/tester/tester_intrinsics.cpp +++ b/libraries/eosiolib/tester/tester_intrinsics.cpp @@ -7,9 +7,8 @@ extern "C" void prints(const char* cstr) { print_range(cstr, cstr + strlen(cstr) extern "C" void prints_l(const char* cstr, uint32_t len) { print_range(cstr, cstr + len); } extern "C" void printn(uint64_t n) { - char buffer[13]; - auto end = eosio::name{ n }.write_as_string(buffer, buffer + sizeof(buffer)); - print_range(buffer, end); + std::string s = eosio::name_to_string(n); + print_range(s.data(), s.data() + s.size()); } extern "C" void printui(uint64_t value) { diff --git a/libraries/native/CMakeLists.txt b/libraries/native/CMakeLists.txt index 68ed5238ab..e97ed54619 100644 --- a/libraries/native/CMakeLists.txt +++ b/libraries/native/CMakeLists.txt @@ -333,7 +333,7 @@ add_library ( sf STATIC ${softfloat_sources} ) target_include_directories( sf PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/include" "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/8086-SSE" "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/build/Linux-x86_64-GCC" ${CMAKE_SOURCE_DIR}) add_native_library ( native STATIC ${softfloat_sources} intrinsics.cpp crt.cpp ${CRT_ASM} ) -target_include_directories( native PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/include" "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/8086-SSE" "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/build/Linux-x86_64-GCC" ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/eosiolib/capi ${CMAKE_SOURCE_DIR}/eosiolib/contracts ${CMAKE_SOURCE_DIR}/eosiolib/core) +target_include_directories( native PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/include" "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/8086-SSE" "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/build/Linux-x86_64-GCC" ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/eosiolib/capi ${CMAKE_SOURCE_DIR}/eosiolib/contracts ${CMAKE_SOURCE_DIR}/eosiolib/core ${CMAKE_SOURCE_DIR}/abieos/include) add_dependencies(native native_eosio) diff --git a/tests/unit/asset_tests.cpp b/tests/unit/asset_tests.cpp index e52515ca48..57c6a178a7 100644 --- a/tests/unit/asset_tests.cpp +++ b/tests/unit/asset_tests.cpp @@ -150,42 +150,42 @@ EOSIO_TEST_BEGIN(asset_type_test) // ----------------- // void print()const - CHECK_PRINT( "0 SYMBOLL", [&](){asset{0LL, sym_no_prec}.print();} ); - CHECK_PRINT( "0 SYMBOLL", [&](){asset{-0LL, sym_no_prec}.print();} ); + CHECK_PRINT( "0 SYMBOLL", [&](){print(asset{0LL, sym_no_prec});} ); + CHECK_PRINT( "0 SYMBOLL", [&](){print(asset{-0LL, sym_no_prec});} ); CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000000 SYMBOLL", ( [&]() { - asset{0LL, sym_prec}.print(); + print(asset{0LL, sym_prec}); }) ) CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000000 SYMBOLL", ( [&]() { - asset{-0LL, sym_prec}.print(); + print(asset{-0LL, sym_prec}); }) ) - CHECK_PRINT( "1 SYMBOLL", [&](){asset{1LL, sym_no_prec}.print();} ); - CHECK_PRINT( "-1 SYMBOLL", [&](){asset{-1LL, sym_no_prec}.print();} ); + CHECK_PRINT( "1 SYMBOLL", [&](){print(asset{1LL, sym_no_prec});} ); + CHECK_PRINT( "-1 SYMBOLL", [&](){print(asset{-1LL, sym_no_prec});} ); CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000001 SYMBOLL", ( [&]() { - asset{1LL, sym_prec}.print(); + print(asset{1LL, sym_prec}); }) ) CHECK_PRINT( "-0.000000000000000000000000000000000000000000000000000000000000001 SYMBOLL", ( [&]() { - asset{-1LL, sym_prec}.print(); + print(asset{-1LL, sym_prec}); }) ) - CHECK_PRINT( "-4611686018427387903 SYMBOLL", [&](){asset{asset_min, sym_no_prec}.print();} ); - CHECK_PRINT( "4611686018427387903 SYMBOLL", [&](){asset{asset_max, sym_no_prec}.print();} ); + CHECK_PRINT( "-4611686018427387903 SYMBOLL", [&](){print(asset{asset_min, sym_no_prec});} ); + CHECK_PRINT( "4611686018427387903 SYMBOLL", [&](){print(asset{asset_max, sym_no_prec});} ); CHECK_PRINT( "-0.000000000000000000000000000000000000000000004611686018427387903 SYMBOLL", ( [&]() { - asset{asset_min, sym_prec}.print(); + print(asset{asset_min, sym_prec}); }) ) CHECK_PRINT( "0.000000000000000000000000000000000000000000004611686018427387903 SYMBOLL", ( [&]() { - asset{asset_max, sym_prec}.print(); + print(asset{asset_max, sym_prec}); }) ) @@ -386,43 +386,43 @@ EOSIO_TEST_BEGIN(extended_asset_type_test) // ----------------- // void print()const - CHECK_PRINT( "0 A@1", [](){extended_asset{asset{int64_t{0}, symbol{"A", 0}}, name{"1"}}.print();} ) - CHECK_PRINT( "0 A@5", [](){extended_asset{asset{int64_t{0}, symbol{"A", 0}}, name{"5"}}.print();} ) - CHECK_PRINT( "0 Z@a", [](){extended_asset{asset{int64_t{0}, symbol{"Z", 0}}, name{"a"}}.print();} ) - CHECK_PRINT( "0 Z@z", [](){extended_asset{asset{int64_t{0}, symbol{"Z", 0}}, name{"z"}}.print();} ) + CHECK_PRINT( "0 A@1", [](){print(extended_asset{asset{int64_t{0}, symbol{"A", 0}}, name{"1"}});} ) + CHECK_PRINT( "0 A@5", [](){print(extended_asset{asset{int64_t{0}, symbol{"A", 0}}, name{"5"}});} ) + CHECK_PRINT( "0 Z@a", [](){print(extended_asset{asset{int64_t{0}, symbol{"Z", 0}}, name{"a"}});} ) + CHECK_PRINT( "0 Z@z", [](){print(extended_asset{asset{int64_t{0}, symbol{"Z", 0}}, name{"z"}});} ) - CHECK_PRINT( "1.1 A@1", [](){extended_asset{asset{int64_t{11}, symbol{"A", 1}}, name{"1"}}.print();} ) - CHECK_PRINT( "1.1 A@5", [](){extended_asset{asset{int64_t{11}, symbol{"A", 1}}, name{"5"}}.print();} ) - CHECK_PRINT( "1.1 Z@a", [](){extended_asset{asset{int64_t{11}, symbol{"Z", 1}}, name{"a"}}.print();} ) - CHECK_PRINT( "1.1 Z@z", [](){extended_asset{asset{int64_t{11}, symbol{"Z", 1}}, name{"z"}}.print();} ) + CHECK_PRINT( "1.1 A@1", [](){print(extended_asset{asset{int64_t{11}, symbol{"A", 1}}, name{"1"}});} ) + CHECK_PRINT( "1.1 A@5", [](){print(extended_asset{asset{int64_t{11}, symbol{"A", 1}}, name{"5"}});} ) + CHECK_PRINT( "1.1 Z@a", [](){print(extended_asset{asset{int64_t{11}, symbol{"Z", 1}}, name{"a"}});} ) + CHECK_PRINT( "1.1 Z@z", [](){print(extended_asset{asset{int64_t{11}, symbol{"Z", 1}}, name{"z"}});} ) CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 A@1", - [](){extended_asset{asset{int64_t{11}, symbol{"A", 63}}, name{"1"}}.print();} ) + [](){print(extended_asset{asset{int64_t{11}, symbol{"A", 63}}, name{"1"}});} ) CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 A@5", - [](){extended_asset{asset{int64_t{11}, symbol{"A", 63}}, name{"5"}}.print();} ) + [](){print(extended_asset{asset{int64_t{11}, symbol{"A", 63}}, name{"5"}});} ) CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 Z@a", - [](){extended_asset{asset{int64_t{11}, symbol{"Z", 63}}, name{"a"}}.print();} ) + [](){print(extended_asset{asset{int64_t{11}, symbol{"Z", 63}}, name{"a"}});} ) CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 Z@z", - [](){extended_asset{asset{int64_t{11}, symbol{"Z", 63}}, name{"z"}}.print();} ) + [](){print(extended_asset{asset{int64_t{11}, symbol{"Z", 63}}, name{"z"}});} ) - CHECK_PRINT( "0 AAAAAAA@111111111111j", [](){extended_asset{asset{int64_t{0}, symbol{"AAAAAAA", 0}}, name{"111111111111j"}}.print();} ) - CHECK_PRINT( "0 AAAAAAA@555555555555j", [](){extended_asset{asset{int64_t{0}, symbol{"AAAAAAA", 0}}, name{"555555555555j"}}.print();} ) - CHECK_PRINT( "0 ZZZZZZZ@aaaaaaaaaaaaj", [](){extended_asset{asset{int64_t{0}, symbol{"ZZZZZZZ", 0}}, name{"aaaaaaaaaaaaj"}}.print();} ) - CHECK_PRINT( "0 ZZZZZZZ@zzzzzzzzzzzzj", [](){extended_asset{asset{int64_t{0}, symbol{"ZZZZZZZ", 0}}, name{"zzzzzzzzzzzzj"}}.print();} ) + CHECK_PRINT( "0 AAAAAAA@111111111111j", [](){print(extended_asset{asset{int64_t{0}, symbol{"AAAAAAA", 0}}, name{"111111111111j"}});} ) + CHECK_PRINT( "0 AAAAAAA@555555555555j", [](){print(extended_asset{asset{int64_t{0}, symbol{"AAAAAAA", 0}}, name{"555555555555j"}});} ) + CHECK_PRINT( "0 ZZZZZZZ@aaaaaaaaaaaaj", [](){print(extended_asset{asset{int64_t{0}, symbol{"ZZZZZZZ", 0}}, name{"aaaaaaaaaaaaj"}});} ) + CHECK_PRINT( "0 ZZZZZZZ@zzzzzzzzzzzzj", [](){print(extended_asset{asset{int64_t{0}, symbol{"ZZZZZZZ", 0}}, name{"zzzzzzzzzzzzj"}});} ) - CHECK_PRINT( "11 AAAAAAA@111111111111j", [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"111111111111j"}}.print();} ) - CHECK_PRINT( "11 AAAAAAA@555555555555j", [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"555555555555j"}}.print();} ) - CHECK_PRINT( "11 ZZZZZZZ@aaaaaaaaaaaaj", [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"aaaaaaaaaaaaj"}}.print();} ) - CHECK_PRINT( "11 ZZZZZZZ@zzzzzzzzzzzzj", [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"zzzzzzzzzzzzj"}}.print();} ) + CHECK_PRINT( "11 AAAAAAA@111111111111j", [](){print(extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"111111111111j"}});} ) + CHECK_PRINT( "11 AAAAAAA@555555555555j", [](){print(extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"555555555555j"}});} ) + CHECK_PRINT( "11 ZZZZZZZ@aaaaaaaaaaaaj", [](){print(extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"aaaaaaaaaaaaj"}});} ) + CHECK_PRINT( "11 ZZZZZZZ@zzzzzzzzzzzzj", [](){print(extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"zzzzzzzzzzzzj"}});} ) CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 AAAAAAA@111111111111j", - [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 63}}, name{"111111111111j"}}.print();} ) + [](){print(extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 63}}, name{"111111111111j"}});} ) CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 AAAAAAA@555555555555j", - [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 63}}, name{"555555555555j"}}.print();} ) + [](){print(extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 63}}, name{"555555555555j"}});} ) CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 ZZZZZZZ@aaaaaaaaaaaaj", - [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 63}}, name{"aaaaaaaaaaaaj"}}.print();} ) + [](){print(extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 63}}, name{"aaaaaaaaaaaaj"}});} ) CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 ZZZZZZZ@zzzzzzzzzzzzj", - [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 63}}, name{"zzzzzzzzzzzzj"}}.print();} ) + [](){print(extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 63}}, name{"zzzzzzzzzzzzj"}});} ) // ------------------------------- // extended_asset operator-()const diff --git a/tests/unit/datastream_tests.cpp b/tests/unit/datastream_tests.cpp index 98fd528d1c..0abb276a25 100644 --- a/tests/unit/datastream_tests.cpp +++ b/tests/unit/datastream_tests.cpp @@ -76,7 +76,7 @@ EOSIO_TEST_BEGIN(datastream_test) CHECK_EQUAL( ds.pos(), datastream_buffer ) // inline bool read(char*, size_t) - CHECK_EQUAL( ds.read(buffer, 256), true ) + CHECK_EQUAL( !!ds.read(buffer, 256), true ) CHECK_EQUAL( memcmp(buffer, datastream_buffer, 256), 0) CHECK_ASSERT( "read", ([&]() {ds.read(buffer, 1);}) ) @@ -91,14 +91,14 @@ EOSIO_TEST_BEGIN(datastream_test) // inline bool write(const char*, size_t) fill(begin(buffer), end(buffer), 1); // Fill `buffer` with a new set of values - CHECK_EQUAL( ds.write(buffer, 256), true ) + CHECK_EQUAL( !!ds.write(buffer, 256), true ) CHECK_EQUAL( memcmp(buffer, datastream_buffer, 256), 0 ) CHECK_ASSERT( "write", ([&]() {ds.write(buffer, 1);}) ) // inline bool put(char) ds.seekp(0); - CHECK_EQUAL( ds.put('c'), true ) + CHECK_EQUAL( !!ds.put('c'), true ) *buffer = 'c'; CHECK_EQUAL( memcmp(buffer, datastream_buffer, 256), 0 ) @@ -109,14 +109,14 @@ EOSIO_TEST_BEGIN(datastream_test) unsigned char uch{}; ds.seekp(0); - CHECK_EQUAL( ds.get(uch), true ) + CHECK_EQUAL( !!ds.get(uch), true ) CHECK_EQUAL( uch, 'c' ) // inline bool get(char&) char ch{}; ds.seekp(0); - CHECK_EQUAL( ds.get(ch), true ) + CHECK_EQUAL( !!ds.get(ch), true ) CHECK_EQUAL( ch, 'c' ) // inline bool valid()const @@ -175,17 +175,17 @@ EOSIO_TEST_BEGIN(datastream_specialization_test) CHECK_EQUAL( ds.tellp(), 0) // inline bool write(const char*,size_t) - CHECK_EQUAL( ds.write(buffer, 256), true ) + CHECK_EQUAL( !!ds.write(buffer, 256), true ) CHECK_EQUAL( ds.tellp(), 256 ) - CHECK_EQUAL( ds.write(buffer, 1), true ) + CHECK_EQUAL( !!ds.write(buffer, 1), true ) CHECK_EQUAL( ds.tellp(), 257 ) // inline bool put(char) char ch{'c'}; ds.seekp(0); - CHECK_EQUAL( ds.put(ch), true ) + CHECK_EQUAL( !!ds.put(ch), true ) CHECK_EQUAL( ds.tellp(), 1 ) // inline bool valid() @@ -220,7 +220,7 @@ EOSIO_TEST_BEGIN(datastream_stream_test) static constexpr uint16_t buffer_size{256}; char datastream_buffer[buffer_size]; // Buffer for the datastream to point to - datastream ds{datastream_buffer, buffer_size}; + datastream ds{datastream_buffer, buffer_size}; // ------------- // T (primitive) diff --git a/tests/unit/name_tests.cpp b/tests/unit/name_tests.cpp index f5425b56ca..12faaffe60 100644 --- a/tests/unit/name_tests.cpp +++ b/tests/unit/name_tests.cpp @@ -171,60 +171,6 @@ EOSIO_TEST_BEGIN(name_type_test) CHECK_EQUAL( !name{""}.operator bool(), true ) CHECK_EQUAL( !name{"1"}.operator bool(), false ) - // ---------------------------------------- - // char* write_as_string(char*, char*)const - static constexpr uint8_t buffer_size{32}; - char buffer[buffer_size]{}; - - string str{"1"}; - name{str}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = "5"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = "a"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = "z"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - - name{str = "abc"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = "123"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - - // Note: - // Any '.' characters at the end of a name are ignored - name{str = ".abc"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = ".........abc"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = "123."}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp("123", buffer, 3), 0 ) - name{str = "123........."}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp("123", buffer, 3), 0 ) - name{str = ".a.b.c.1.2.3."}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(".a.b.c.1.2.3", buffer, 12), 0 ) - - name{str = "abc.123"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = "123.abc"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - - name{str = "12345abcdefgj"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = "hijklmnopqrsj"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = "tuvwxyz.1234j"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - - name{str = "111111111111j"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = "555555555555j"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = "aaaaaaaaaaaaj"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - name{str = "zzzzzzzzzzzzj"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(str.c_str(), buffer, strlen(str.c_str())), 0 ) - // ----------------------- // string to_string()const CHECK_EQUAL( name{"1"}.to_string(), "1" ) diff --git a/tests/unit/serialize_tests.cpp b/tests/unit/serialize_tests.cpp index 940cf9a7c4..cddb6afbd9 100644 --- a/tests/unit/serialize_tests.cpp +++ b/tests/unit/serialize_tests.cpp @@ -24,7 +24,7 @@ using std::vector; using eosio::datastream; struct B { - const char c{}; + char c{}; EOSLIB_SERIALIZE( B, (c) ) friend bool operator==(const B& lhs, const B& rhs) { @@ -33,7 +33,7 @@ struct B { }; struct D1 : public B { - const int i{}; + int i{}; EOSLIB_SERIALIZE_DERIVED( D1, B, (i) ) friend bool operator==(const D1& lhs, const D1& rhs) { @@ -42,7 +42,7 @@ struct D1 : public B { }; struct D2 : public D1 { - const vector v{}; + vector v{}; EOSLIB_SERIALIZE_DERIVED( D2, D1, (v) ) friend bool operator==(const D2& lhs, const D2& rhs) { @@ -55,8 +55,8 @@ EOSIO_TEST_BEGIN(serialize_test) static constexpr uint16_t buffer_size{256}; char ds_buffer[buffer_size]{}; // Buffer for the datastream to point to char ds_expected_buffer[buffer_size]{}; // Buffer to compare `ds_buffer` with - datastream ds{ds_buffer, buffer_size}; - datastream ds_expected{ds_expected_buffer, buffer_size}; + datastream ds{ds_buffer, buffer_size}; + datastream ds_expected{ds_expected_buffer, buffer_size}; // Testing base structures static constexpr B b{'c'}; diff --git a/tests/unit/symbol_tests.cpp b/tests/unit/symbol_tests.cpp index a5a363a243..c4f55ccff1 100644 --- a/tests/unit/symbol_tests.cpp +++ b/tests/unit/symbol_tests.cpp @@ -76,20 +76,6 @@ EOSIO_TEST_BEGIN(symbol_code_type_test) CHECK_EQUAL( !symbol_code{""}.operator bool(), true ) CHECK_EQUAL( !symbol_code{"SYMBOL"}.operator bool(), false ) - // ---------------------------------------- - // char* write_as_string(char*, char*)const - char buffer[7]{}; - - string test_str{"A"}; - symbol_code{test_str}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(test_str.c_str(), buffer, strlen(test_str.c_str())), 0 ) - symbol_code{test_str = "Z"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(test_str.c_str(), buffer, strlen(test_str.c_str())), 0 ) - symbol_code{test_str = "AAAAAAA"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(test_str.c_str(), buffer, strlen(test_str.c_str())), 0 ) - symbol_code{test_str = "ZZZZZZZ"}.write_as_string( buffer, buffer + sizeof(buffer) ); - CHECK_EQUAL( memcmp(test_str.c_str(), buffer, strlen(test_str.c_str())), 0 ) - // ----------------------- // string to_string()const CHECK_EQUAL( symbol_code{"A"}.to_string(), "A" ) @@ -191,11 +177,11 @@ EOSIO_TEST_BEGIN(symbol_type_test) CHECK_EQUAL( (!symbol{"SYMBOLL", 0}.operator bool()), false ) // --------------------- - // void print(bool)const - CHECK_PRINT( "0,A", [&](){symbol{"A", 0}.print(true);} ); - CHECK_PRINT( "0,Z", [&](){symbol{"Z", 0}.print(true);} ); - CHECK_PRINT( "255,AAAAAAA", [&](){symbol{"AAAAAAA", 255}.print(true);} ); - CHECK_PRINT( "255,ZZZZZZZ", [&](){symbol{"ZZZZZZZ", 255}.print(true);} ); + // void print(symbol)const + CHECK_PRINT( "0,A", [&](){print(symbol{"A", 0});} ); + CHECK_PRINT( "0,Z", [&](){print(symbol{"Z", 0});} ); + CHECK_PRINT( "255,AAAAAAA", [&](){print(symbol{"AAAAAAA", 255});} ); + CHECK_PRINT( "255,ZZZZZZZ", [&](){print(symbol{"ZZZZZZZ", 255});} ); // -------------------------------------------------------------- // friend constexpr bool operator==(const symbol&, const symbol&) diff --git a/tests/unit/varint_tests.cpp b/tests/unit/varint_tests.cpp index f79313ddf0..3b53bbb000 100644 --- a/tests/unit/varint_tests.cpp +++ b/tests/unit/varint_tests.cpp @@ -113,7 +113,7 @@ EOSIO_TEST_BEGIN(unsigned_int_type_test) static constexpr uint16_t buffer_size{256}; char datastream_buffer[buffer_size]; // Buffer for the datastream to point to - datastream ds{datastream_buffer, buffer_size}; + datastream ds{datastream_buffer, buffer_size}; static const unsigned_int cui{42}; unsigned_int ui{}; @@ -238,7 +238,7 @@ EOSIO_TEST_BEGIN(signed_int_type_test) static constexpr uint16_t buffer_size{256}; char datastream_buffer[buffer_size]; // Buffer for the datastream to point to - datastream ds{datastream_buffer, buffer_size}; + datastream ds{datastream_buffer, buffer_size}; static const signed_int csi{-42}; signed_int a{44}, b{(1<<30)+2}, c{-35}, d{-(1<<30)-2}; // Small+, Small-, Large+, Large- diff --git a/tools/include/compiler_options.hpp.in b/tools/include/compiler_options.hpp.in index 6b6ad51645..bc9159cfbc 100644 --- a/tools/include/compiler_options.hpp.in +++ b/tools/include/compiler_options.hpp.in @@ -714,11 +714,11 @@ static Options CreateOptions(bool add_defaults=true) { copts.emplace_back("-I"+sysroot_opt+"/include/eosiolib/contracts"); if (ftester_opt) { copts.emplace_back("-I"+sysroot_opt+"/include/eosiolib/tester"); - copts.emplace_back("-I"+sysroot_opt+"/include/abieos"); - copts.emplace_back("-I"+sysroot_opt+"/include/date"); - copts.emplace_back("-I"+sysroot_opt+"/include/fmt"); - copts.emplace_back("-I"+sysroot_opt+"/include/rapidjson"); } + copts.emplace_back("-I"+sysroot_opt+"/include/abieos"); + copts.emplace_back("-I"+sysroot_opt+"/include/date"); + copts.emplace_back("-I"+sysroot_opt+"/include/fmt"); + copts.emplace_back("-I"+sysroot_opt+"/include/rapidjson"); ldopts.emplace_back("-L"+sysroot_opt+"/lib"); #ifndef __APPLE__ @@ -747,12 +747,12 @@ static Options CreateOptions(bool add_defaults=true) { copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/eosiolib/contracts"); if (ftester_opt) { copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/eosiolib/tester"); - copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/abieos"); - copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/date"); - copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/fmt"); - copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/rapidjson"); copts.emplace_back("-DCATCH_CONFIG_NO_POSIX_SIGNALS"); } + copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/abieos"); + copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/date"); + copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/fmt"); + copts.emplace_back("-I"+eosio::cdt::whereami::where()+"/../include/rapidjson"); #ifndef __APPLE__ ldopts.emplace_back("-L"+eosio::cdt::whereami::where()+"/../lib64"); diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index 134f6744c5..7bddd58b0a 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -1,5 +1,4 @@ #include "../../../libraries/eosiolib/tester/eosio/chain_types.hpp" -#include #include #include #include @@ -13,7 +12,7 @@ #include #include -using namespace abieos::literals; +using namespace eosio::literals; using namespace std::literals; using eosio::chain::builtin_protocol_feature_t; using eosio::chain::digest_type; @@ -207,10 +206,10 @@ struct test_chain { } }; -abieos::checksum256 convert(const eosio::chain::checksum_type& obj) { - abieos::checksum256 result; +eosio::checksum256 convert(const eosio::chain::checksum_type& obj) { + eosio::checksum256 result; static_assert(sizeof(result) == sizeof(obj)); - memcpy(&result, &obj, sizeof(result)); + memcpy(result.data(), &obj, sizeof(result)); return result; } @@ -227,7 +226,7 @@ chain_types::action_receipt_v0 convert(const eosio::chain::action_receipt& obj) result.act_digest = convert(obj.act_digest); result.global_sequence = obj.global_sequence; result.recv_sequence = obj.recv_sequence; - for (auto& auth : obj.auth_sequence) result.auth_sequence.push_back({ abieos::name{ to_uint64_t(auth.first) }, auth.second }); + for (auto& auth : obj.auth_sequence) result.auth_sequence.push_back({ eosio::name{ to_uint64_t(auth.first) }, auth.second }); result.code_sequence.value = obj.code_sequence.value; result.abi_sequence.value = obj.abi_sequence.value; return result; @@ -238,7 +237,7 @@ chain_types::action convert(const eosio::chain::action& obj) { result.account.value = to_uint64_t(obj.account); result.name.value = to_uint64_t(obj.name); for (auto& auth : obj.authorization) - result.authorization.push_back({ abieos::name{ to_uint64_t(auth.actor) }, abieos::name{ to_uint64_t(auth.permission) } }); + result.authorization.push_back({ eosio::name{ to_uint64_t(auth.actor) }, eosio::name{ to_uint64_t(auth.permission) } }); result.data = { obj.data.data(), obj.data.data() + obj.data.size() }; return result; } @@ -268,7 +267,7 @@ chain_types::transaction_trace_v0 convert(const eosio::chain::transaction_trace& if (obj.receipt) { result.status = (chain_types::transaction_status)obj.receipt->status.value; result.cpu_usage_us = obj.receipt->cpu_usage_us; - result.net_usage_words = { obj.receipt->net_usage_words.value }; + result.net_usage_words = obj.receipt->net_usage_words.value; } else { result.status = chain_types::transaction_status::hard_fail; } @@ -290,12 +289,12 @@ chain_types::transaction_trace_v0 convert(const eosio::chain::transaction_trace& struct contract_row { uint32_t block_num = {}; bool present = {}; - abieos::name code = {}; - abieos::name scope = {}; - abieos::name table = {}; + eosio::name code = {}; + eosio::name scope = {}; + eosio::name table = {}; uint64_t primary_key = {}; - abieos::name payer = {}; - abieos::input_buffer value = {}; + eosio::name payer = {}; + eosio::input_stream value = {}; }; EOSIO_REFLECT(contract_row, block_num, present, code, scope, table, primary_key, payer, value); @@ -711,7 +710,7 @@ struct callbacks { auto& chain = assert_chain(chain_index); check_bounds(req_begin, req_end); eosio::input_stream query_bin{ req_begin, req_end }; - abieos::name query_name; + eosio::name query_name; eosio::check_discard(from_bin(query_name, query_bin)); if (query_name == "cr.ctsp"_n) return set_data(cb_alloc_data, cb_alloc, query_contract_row_range_code_table_scope_pk(chain, query_bin)); @@ -721,13 +720,13 @@ struct callbacks { std::vector query_contract_row_range_code_table_scope_pk(test_chain& chain, eosio::input_stream& query_bin) { using eosio::from_bin; // ADL required auto snapshot_block = eosio::check(from_bin(query_bin)).value(); - auto first_code = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; - auto first_table = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; - auto first_scope = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto first_code = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto first_table = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto first_scope = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; auto first_primary_key = eosio::check(from_bin(query_bin)).value(); - auto last_code = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; - auto last_table = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; - auto last_scope = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto last_code = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto last_table = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; + auto last_scope = eosio::chain::name{ eosio::check(from_bin(query_bin)).value().value }; auto last_primary_key = eosio::check(from_bin(query_bin)).value(); auto max_results = eosio::check(from_bin(query_bin)).value(); @@ -754,11 +753,11 @@ struct callbacks { rows.emplace_back(eosio::check(eosio::convert_to_bin( contract_row{ uint32_t(0), bool(true), - abieos::name{ to_uint64_t(table_it->code) }, - abieos::name{ to_uint64_t(table_it->scope) }, - abieos::name{ to_uint64_t(table_it->table) }, + eosio::name{ to_uint64_t(table_it->code) }, + eosio::name{ to_uint64_t(table_it->scope) }, + eosio::name{ to_uint64_t(table_it->table) }, kv_it->primary_key, - abieos::name{ to_uint64_t(kv_it->payer) }, + eosio::name{ to_uint64_t(kv_it->payer) }, { kv_it->value.data(), kv_it->value.data() + kv_it->value.size() } })).value()); }; } From 77ac42c97f69f92bfcda6c9854a9a8f4e59e9608 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Tue, 11 Feb 2020 14:54:48 -0500 Subject: [PATCH 31/50] functions in headers need to be inline. --- libraries/eosiolib/core/eosio/asset.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/eosiolib/core/eosio/asset.hpp b/libraries/eosiolib/core/eosio/asset.hpp index 085fd03da3..3f52dfbca4 100644 --- a/libraries/eosiolib/core/eosio/asset.hpp +++ b/libraries/eosiolib/core/eosio/asset.hpp @@ -5,11 +5,11 @@ namespace eosio { -void print(asset obj) { +inline void print(asset obj) { print(obj.to_string()); } -void print(extended_asset obj) { +inline void print(extended_asset obj) { print(obj.to_string()); } From f1046eb3a43728e367e557035be1f973d0a4a128 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Tue, 11 Feb 2020 14:55:51 -0500 Subject: [PATCH 32/50] Change more includes to --- libraries/eosiolib/contracts/eosio/permission.hpp | 8 ++++---- libraries/eosiolib/contracts/eosio/privileged.hpp | 11 ++++++----- libraries/eosiolib/eosiolib.cpp | 8 ++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/libraries/eosiolib/contracts/eosio/permission.hpp b/libraries/eosiolib/contracts/eosio/permission.hpp index 0d98a18708..8a60bcc669 100644 --- a/libraries/eosiolib/contracts/eosio/permission.hpp +++ b/libraries/eosiolib/contracts/eosio/permission.hpp @@ -4,10 +4,10 @@ */ #pragma once -#include "transaction.hpp" -#include "../../core/eosio/crypto.hpp" -#include "../../core/eosio/name.hpp" -#include "../../core/eosio/time.hpp" +#include +#include +#include +#include #include #include diff --git a/libraries/eosiolib/contracts/eosio/privileged.hpp b/libraries/eosiolib/contracts/eosio/privileged.hpp index 53f194ef09..264e39ad6b 100644 --- a/libraries/eosiolib/contracts/eosio/privileged.hpp +++ b/libraries/eosiolib/contracts/eosio/privileged.hpp @@ -1,9 +1,10 @@ #pragma once -#include "producer_schedule.hpp" -#include "system.hpp" -#include "../../core/eosio/crypto.hpp" -#include "../../core/eosio/name.hpp" -#include "../../core/eosio/serialize.hpp" +#include +#include +#include +#include +#include +#include namespace eosio { diff --git a/libraries/eosiolib/eosiolib.cpp b/libraries/eosiolib/eosiolib.cpp index fc51fdb64c..02a63d6921 100644 --- a/libraries/eosiolib/eosiolib.cpp +++ b/libraries/eosiolib/eosiolib.cpp @@ -1,7 +1,7 @@ -#include "core/eosio/datastream.hpp" -#include "core/eosio/powers.hpp" -#include "contracts/eosio/system.hpp" -#include "contracts/eosio/privileged.hpp" +#include +#include +#include +#include #include From a75e076878ef9ce8711a9009ec8711b0416aec48 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 12 Feb 2020 10:54:41 -0500 Subject: [PATCH 33/50] Don't depend on the storage type of fixed_bytes. --- libraries/abieos | 2 +- .../eosiolib/contracts/eosio/multi_index.hpp | 28 +++++++++++++------ tests/unit/fixed_bytes_tests.cpp | 3 +- tools/tester/src/eosio-tester.cpp | 8 +++--- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/libraries/abieos b/libraries/abieos index 8f371b7835..e095303975 160000 --- a/libraries/abieos +++ b/libraries/abieos @@ -1 +1 @@ -Subproject commit 8f371b783557d26ce3706cbe43c92ccea599ba0f +Subproject commit e095303975651ad4f8730b51837ed617a44c8c35 diff --git a/libraries/eosiolib/contracts/eosio/multi_index.hpp b/libraries/eosiolib/contracts/eosio/multi_index.hpp index 0f03a6585d..076ca6aad2 100644 --- a/libraries/eosiolib/contracts/eosio/multi_index.hpp +++ b/libraries/eosiolib/contracts/eosio/multi_index.hpp @@ -262,7 +262,7 @@ struct secondary_index_db_functions {\ }\ }; -#define WRAP_SECONDARY_ARRAY_TYPE(IDX, TYPE)\ +#define WRAP_SECONDARY_ARRAY_TYPE(IDX, TYPE, ELEMTYPE) \ template<>\ struct secondary_index_db_functions {\ static int32_t db_idx_next( int32_t iterator, uint64_t* primary ) { return internal_use_do_not_use::db_##IDX##_next( iterator, primary ); } \ @@ -270,22 +270,34 @@ struct secondary_index_db_functions {\ static void db_idx_remove( int32_t iterator ) { internal_use_do_not_use::db_##IDX##_remove( iterator ); } \ static int32_t db_idx_end( uint64_t code, uint64_t scope, uint64_t table ) { return internal_use_do_not_use::db_##IDX##_end( code, scope, table ); } \ static int32_t db_idx_store( uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, const TYPE& secondary ) {\ - return internal_use_do_not_use::db_##IDX##_store( scope, table, payer, id, secondary.data(), TYPE::num_words() ); \ + auto arr = secondary.extract_as_word_array(); \ + int32_t result = internal_use_do_not_use::db_##IDX##_store( scope, table, payer, id, arr.data(), arr.size() ); \ }\ static void db_idx_update( int32_t iterator, uint64_t payer, const TYPE& secondary ) {\ - internal_use_do_not_use::db_##IDX##_update( iterator, payer, secondary.data(), TYPE::num_words() ); \ + auto arr = secondary.extract_as_word_array(); \ + internal_use_do_not_use::db_##IDX##_update( iterator, payer, arr.data(), arr.size() ); \ }\ static int32_t db_idx_find_primary( uint64_t code, uint64_t scope, uint64_t table, uint64_t primary, TYPE& secondary ) {\ - return internal_use_do_not_use::db_##IDX##_find_primary( code, scope, table, secondary.data(), TYPE::num_words(), primary ); \ + decltype(secondary.extract_as_word_array()) arr; \ + int32_t result = internal_use_do_not_use::db_##IDX##_find_primary( code, scope, table, arr.data(), arr.size(), primary ); \ + secondary = TYPE(arr); \ + return result; \ }\ static int32_t db_idx_find_secondary( uint64_t code, uint64_t scope, uint64_t table, const TYPE& secondary, uint64_t& primary ) {\ - return internal_use_do_not_use::db_##IDX##_find_secondary( code, scope, table, secondary.data(), TYPE::num_words(), &primary ); \ + auto arr = secondary.extract_as_word_array(); \ + return internal_use_do_not_use::db_##IDX##_find_secondary( code, scope, table, arr.data(), arr.size(), &primary ); \ }\ static int32_t db_idx_lowerbound( uint64_t code, uint64_t scope, uint64_t table, TYPE& secondary, uint64_t& primary ) {\ - return internal_use_do_not_use::db_##IDX##_lowerbound( code, scope, table, secondary.data(), TYPE::num_words(), &primary ); \ + auto arr = secondary.extract_as_word_array(); \ + int32_t result = internal_use_do_not_use::db_##IDX##_lowerbound( code, scope, table, arr.data(), arr.size(), &primary ); \ + secondary = TYPE(arr); \ + return result; \ }\ static int32_t db_idx_upperbound( uint64_t code, uint64_t scope, uint64_t table, TYPE& secondary, uint64_t& primary ) {\ - return internal_use_do_not_use::db_##IDX##_upperbound( code, scope, table, secondary.data(), TYPE::num_words(), &primary ); \ + auto arr = secondary.extract_as_word_array(); \ + int32_t result = internal_use_do_not_use::db_##IDX##_upperbound( code, scope, table, arr.data(), arr.size(), &primary ); \ + secondary = TYPE(arr); \ + return result; \ }\ }; @@ -324,7 +336,7 @@ namespace _multi_index_detail { static constexpr long double true_lowest() { return -std::numeric_limits::infinity(); } }; - WRAP_SECONDARY_ARRAY_TYPE(idx256, eosio::fixed_bytes<32>) + WRAP_SECONDARY_ARRAY_TYPE(idx256, eosio::fixed_bytes<32>, uint128_t) template<> struct secondary_key_traits> { static constexpr eosio::fixed_bytes<32> true_lowest() { return eosio::fixed_bytes<32>(); } diff --git a/tests/unit/fixed_bytes_tests.cpp b/tests/unit/fixed_bytes_tests.cpp index d786aa3c26..aa0121581f 100644 --- a/tests/unit/fixed_bytes_tests.cpp +++ b/tests/unit/fixed_bytes_tests.cpp @@ -10,7 +10,8 @@ using std::array; -using eosio::fixed_bytes; +template +using fixed_bytes = eosio::fixed_bytes; // Definitions in `eosio.cdt/libraries/eosio/fixed_bytes.hpp` EOSIO_TEST_BEGIN(fixed_bytes_test) diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index 7bddd58b0a..dada75ea22 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -207,10 +207,10 @@ struct test_chain { }; eosio::checksum256 convert(const eosio::chain::checksum_type& obj) { - eosio::checksum256 result; - static_assert(sizeof(result) == sizeof(obj)); - memcpy(result.data(), &obj, sizeof(result)); - return result; + std::array bytes; + static_assert(bytes.size() == sizeof(obj)); + memcpy(bytes.data(), &obj, bytes.size()); + return eosio::checksum256(bytes); } chain_types::account_delta convert(const eosio::chain::account_delta& obj) { From 182bd23f1b5bb9fcc16b09f321adfeffa744db2f Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 12 Feb 2020 16:57:32 -0500 Subject: [PATCH 34/50] Add missing return --- libraries/eosiolib/contracts/eosio/multi_index.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/eosiolib/contracts/eosio/multi_index.hpp b/libraries/eosiolib/contracts/eosio/multi_index.hpp index 076ca6aad2..409c2373b1 100644 --- a/libraries/eosiolib/contracts/eosio/multi_index.hpp +++ b/libraries/eosiolib/contracts/eosio/multi_index.hpp @@ -271,7 +271,7 @@ struct secondary_index_db_functions {\ static int32_t db_idx_end( uint64_t code, uint64_t scope, uint64_t table ) { return internal_use_do_not_use::db_##IDX##_end( code, scope, table ); } \ static int32_t db_idx_store( uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, const TYPE& secondary ) {\ auto arr = secondary.extract_as_word_array(); \ - int32_t result = internal_use_do_not_use::db_##IDX##_store( scope, table, payer, id, arr.data(), arr.size() ); \ + return internal_use_do_not_use::db_##IDX##_store( scope, table, payer, id, arr.data(), arr.size() ); \ }\ static void db_idx_update( int32_t iterator, uint64_t payer, const TYPE& secondary ) {\ auto arr = secondary.extract_as_word_array(); \ From 1e44fa7c26acae3b645850712c62673852ce5461 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 12 Feb 2020 16:59:32 -0500 Subject: [PATCH 35/50] Convert integration tests to eosio-tester. Note that there's an issue with the fact that the tester doesn't enable any protocol features by default, so I had to #ifdef out a couple calls in the capi tests. --- modules/TestsExternalProject.txt | 17 +-- tests/CMakeLists.txt | 4 +- tests/integration/CMakeLists.txt | 49 ++------ tests/integration/capi_tests.cpp | 33 ++---- tests/integration/codegen_tests.cpp | 121 ++++++++------------ tests/integration/contracts.hpp.in | 17 +-- tests/integration/main.cpp | 39 +------ tests/integration/memory_tests.cpp | 36 ++---- tests/unit/test_contracts/capi/action.c | 2 + tests/unit/test_contracts/capi/privileged.c | 2 + 10 files changed, 92 insertions(+), 228 deletions(-) diff --git a/modules/TestsExternalProject.txt b/modules/TestsExternalProject.txt index c33d1b6e8f..0e90c5d9c2 100644 --- a/modules/TestsExternalProject.txt +++ b/modules/TestsExternalProject.txt @@ -17,29 +17,16 @@ ExternalProject_Add( if (EOSIO_RUN_INTEGRATION_TESTS) - find_package(eosio) - - if (eosio_FOUND) - if(CMAKE_BUILD_TYPE STREQUAL "Debug") - set(TEST_BUILD_TYPE "Debug") - set(CMAKE_BUILD_TYPE "Release") - else() - set(TEST_BUILD_TYPE ${CMAKE_BUILD_TYPE}) - endif() - - string(REPLACE ";" "|" TEST_FRAMEWORK_PATH "${CMAKE_FRAMEWORK_PATH}") - string(REPLACE ";" "|" TEST_MODULE_PATH "${CMAKE_MODULE_PATH}") - ExternalProject_Add( EosioIntegrationTests SOURCE_DIR "${CMAKE_SOURCE_DIR}/tests/integration" BINARY_DIR "${CMAKE_BINARY_DIR}/tests/integration" - CMAKE_ARGS -DCMAKE_BUILD_TYPE=${TEST_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_FRAMEWORK_PATH=${TEST_FRAMEWORK_PATH} -DCMAKE_MODULE_PATH=${TEST_MODULE_PATH} -DEOSIO_ROOT=${EOSIO_ROOT} -DLLVM_DIR=${LLVM_DIR} -DBOOST_ROOT=${BOOST_ROOT} + CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_BINARY_DIR}/lib/cmake/eosio.cdt/EosioWasmToolchain.cmake -DCMAKE_BUILD_TYPE=Debug -DEOSIO_CDT_BIN=${CMAKE_BINARY_DIR}/lib/cmake/eosio.cdt/ -DBASE_BINARY_DIR=${CMAKE_BINARY_DIR} -D__APPLE=${APPLE} UPDATE_COMMAND "" PATCH_COMMAND "" TEST_COMMAND "" INSTALL_COMMAND "" BUILD_ALWAYS 1 + DEPENDS EosioWasmLibraries EosioTools tester ) - endif() endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f5aaeed248..b95f14815d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -42,8 +42,8 @@ set_property(TEST varint_tests PROPERTY LABELS unit_tests) add_test( NAME toolchain_tests COMMAND ${CMAKE_BINARY_DIR}/tools/toolchain-tester/toolchain-tester ${CMAKE_SOURCE_DIR}/tests/toolchain --cdt ${CMAKE_BINARY_DIR}/bin ) set_property(TEST toolchain_tests PROPERTY LABELS toolchain_tests) -if (eosio_FOUND AND EOSIO_RUN_INTEGRATION_TESTS) - add_test(integration_tests ${CMAKE_BINARY_DIR}/tests/integration/integration_tests) +if (EOSIO_RUN_INTEGRATION_TESTS) + add_test(integration_tests ${CMAKE_BINARY_DIR}/bin/eosio-tester ${CMAKE_BINARY_DIR}/tests/integration/integration_tests.wasm) set_property(TEST integration_tests PROPERTY LABELS integration_tests) endif() diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt index 816b4ad62b..58a7a6b6de 100644 --- a/tests/integration/CMakeLists.txt +++ b/tests/integration/CMakeLists.txt @@ -1,48 +1,17 @@ cmake_minimum_required( VERSION 3.5 ) -set(EOSIO_VERSION_MIN "1.4") -set(EOSIO_VERSION_SOFT_MAX "2.0") -#set(EOSIO_VERSION_HARD_MAX "") +project(integration) -find_package(eosio) - -### Check the version of eosio -set(VERSION_MATCH_ERROR_MSG "") -EOSIO_CHECK_VERSION(VERSION_OUTPUT "${EOSIO_VERSION}" - "${EOSIO_VERSION_MIN}" - "${EOSIO_VERSION_SOFT_MAX}" - "${EOSIO_VERSION_HARD_MAX}" - VERSION_MATCH_ERROR_MSG) -if(VERSION_OUTPUT STREQUAL "MATCH") - message(STATUS "Using eosio version ${EOSIO_VERSION}") -elseif(VERSION_OUTPUT STREQUAL "WARN") - message(WARNING "Using eosio version ${EOSIO_VERSION} even though it exceeds the maximum supported version of ${EOSIO_VERSION_SOFT_MAX}; continuing with configuration, however build may fail.\nIt is recommended to use eosio version ${EOSIO_VERSION_SOFT_MAX}.x") -else() # INVALID OR MISMATCH - message(FATAL_ERROR "Found eosio version ${EOSIO_VERSION} but it does not satisfy version requirements: ${VERSION_MATCH_ERROR_MSG}\nPlease use eosio version ${EOSIO_VERSION_SOFT_MAX}.x") -endif(VERSION_OUTPUT STREQUAL "MATCH") - - -enable_testing() +set(EOSIO_WASM_OLD_BEHAVIOR "off") +find_package(eosio.cdt) configure_file(${CMAKE_SOURCE_DIR}/contracts.hpp.in ${CMAKE_BINARY_DIR}/contracts.hpp) - include_directories(${CMAKE_BINARY_DIR}) file(GLOB INT_TESTS "*.cpp" "*.hpp") - -add_eosio_test_executable( integration_tests ${INT_TESTS} ) - -foreach(TEST_SUITE ${INT_TESTS}) # create an independent target for each test suite - execute_process(COMMAND bash -c "grep -E 'BOOST_AUTO_TEST_SUITE\\s*[(]' ${TEST_SUITE} | grep -vE '//.*BOOST_AUTO_TEST_SUITE\\s*[(]' | cut -d ')' -f 1 | cut -d '(' -f 2" OUTPUT_VARIABLE SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # get the test suite name from the *.cpp file - if (NOT "" STREQUAL "${SUITE_NAME}") # ignore empty lines - execute_process(COMMAND bash -c "echo ${SUITE_NAME} | sed -e 's/s$//' | sed -e 's/_test$//'" OUTPUT_VARIABLE TRIMMED_SUITE_NAME OUTPUT_STRIP_TRAILING_WHITESPACE) # trim "_test" or "_tests" from the end of ${SUITE_NAME} - # to run unit_test with all log from blockchain displayed, put "--verbose" after "--", i.e. "unit_test -- --verbose" - add_test(NAME ${TRIMMED_SUITE_NAME}_integration_test COMMAND integration_tests --run_test=${SUITE_NAME} --report_level=detailed --color_output) - # build list of tests to run during coverage testing - if(ctest_tests) - string(APPEND ctest_tests "|") - endif() - string(APPEND ctest_tests ${TRIMMED_SUITE_NAME}_integration_test) - endif() -endforeach(TEST_SUITE) -set(ctest_tests "'${ctest_tests}' -j8") # surround test list string in apostrophies +add_executable(integration_tests.wasm ${INT_TESTS}) +target_link_libraries(integration_tests.wasm -ftester -stack-size=65536) +target_compile_options(integration_tests.wasm PUBLIC -ftester -Os) +set_target_properties(integration_tests.wasm + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/tests/integration/capi_tests.cpp b/tests/integration/capi_tests.cpp index 632042352b..b7cc065c4e 100644 --- a/tests/integration/capi_tests.cpp +++ b/tests/integration/capi_tests.cpp @@ -1,31 +1,22 @@ -#include -#include -#include - -#include - -#include +#include +#include +#include #include using namespace eosio; -using namespace eosio::testing; -using namespace eosio::chain; -using namespace eosio::testing; -using namespace fc; - -using mvo = fc::mutable_variant_object; +using eosio::testing::contracts; +using std::tuple; BOOST_AUTO_TEST_SUITE(capi_tests) -BOOST_FIXTURE_TEST_CASE( capi_tests, tester ) try { - create_accounts( { N(test) } ); - produce_block(); - set_code( N(test), contracts::capi_tests_wasm() ); - set_abi( N(test), contracts::capi_tests_abi().data() ); - produce_blocks(); +BOOST_FIXTURE_TEST_CASE( capi_tests, test_chain ) { + create_code_account( "test"_n ); + finish_block(); + set_code( "test"_n, contracts::capi_tests_wasm() ); + finish_block(); - push_action(N(test), N(act), N(test), {}); -} FC_LOG_AND_RETHROW() + transact({action({"test"_n, "active"_n}, "test"_n, "act"_n, std::tuple())}); +} BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/integration/codegen_tests.cpp b/tests/integration/codegen_tests.cpp index 6591306fa4..987761c84a 100644 --- a/tests/integration/codegen_tests.cpp +++ b/tests/integration/codegen_tests.cpp @@ -1,97 +1,66 @@ #include -#include -#include - -#include - -#include +#include +#include +#include #include using namespace eosio; -using namespace eosio::testing; -using namespace eosio::chain; -using namespace eosio::testing; -using namespace fc; - -using mvo = fc::mutable_variant_object; +using eosio::testing::contracts; +using namespace std::literals; +using std::tuple; BOOST_AUTO_TEST_SUITE(codegen_tests) -BOOST_FIXTURE_TEST_CASE( simple_tests, tester ) try { - create_accounts( { N(test), N(eosio.token), N(someone), N(other) } ); - produce_block(); +BOOST_FIXTURE_TEST_CASE( simple_tests, test_chain ) { + create_code_account( "test"_n ); + create_code_account( "eosio.token"_n ); + create_code_account( "someone"_n ); + create_code_account( "other"_n ); + finish_block(); - set_code( N(eosio.token), contracts::transfer_wasm() ); - set_abi( N(eosio.token), contracts::transfer_abi().data() ); + set_code( "eosio.token"_n, contracts::transfer_wasm() ); + set_code( "someone"_n, contracts::transfer_wasm() ); + set_code( "test"_n, contracts::simple_wasm() ); + set_code( "other"_n, contracts::simple_wasm() ); - set_code( N(someone), contracts::transfer_wasm() ); - set_abi( N(someone), contracts::transfer_abi().data() ); + finish_block(); + transact({action({"test"_n, "active"_n}, "test"_n, "test1"_n, tuple("bucky"_n))}); - set_code( N(test), contracts::simple_wasm() ); - set_abi( N(test), contracts::simple_abi().data() ); + transact({action({"test"_n, "active"_n}, "test"_n, "test1"_n, tuple("notbucky"_n))}, "not bucky"); - set_code( N(other), contracts::simple_wasm() ); - set_abi( N(other), contracts::simple_abi().data() ); + transact({action({"test"_n, "active"_n}, "test"_n, "test2"_n, tuple(33, "some string"s))}); + transact({action({"test"_n, "active"_n}, "test"_n, "test2"_n, tuple(30, "some string"s))}, "33 does not match"); + transact({action({"test"_n, "active"_n}, "test"_n, "test2"_n, tuple(33, "not some string"s))}, "some string does not match"); - produce_blocks(); - push_action(N(test), N(test1), N(test), - mvo() - ("nm", "bucky")); + transact({action({"test"_n, "active"_n}, "test"_n, "test3"_n, tuple(33, "some string"s))}, "8000000000000000000"); - BOOST_CHECK_THROW(push_action(N(test), N(test1), N(test), mvo()("nm", "notbucky")), - fc::exception); + finish_block(); - push_action(N(test), N(test2), N(test), - mvo() - ("arg0", 33) - ("arg1", "some string")); - BOOST_CHECK_THROW(push_action(N(test), N(test2), N(test), mvo() ("arg0", 30)("arg1", "some string")), fc::exception); - BOOST_CHECK_THROW(push_action(N(test), N(test2), N(test), mvo() ("arg0", 33)("arg1", "not some string")), fc::exception); + transact({{{"test"_n, "active"_n}, "test"_n, "test4"_n, tuple("someone"_n)}}); + transact({{{"test"_n, "active"_n}, "test"_n, "test5"_n, tuple("someone"_n)}}); + transact({{{"test"_n, "active"_n}, "test"_n, "testa"_n, tuple("someone"_n)}}); + transact({{{"test"_n, "active"_n}, "test"_n, "testb"_n, tuple("someone"_n)}}, "should only be eosio for action failure"); - set_abi( N(test), contracts::simple_wrong_abi().data() ); - produce_blocks(); - - BOOST_CHECK_THROW(push_action(N(test), N(test3), N(test), mvo() ("arg0", 33) ("arg1", "some string")), fc::exception); + // test that the pre_dispatch will short circuit dispatching if false + transact({{{"test"_n, "active"_n}, "test"_n, "testc"_n, tuple("bucky"_n)}}); + transact({{{"test"_n, "active"_n}, "test"_n, "testc"_n, tuple("someone"_n)}}, "should be bucky"); + transact({{{"test"_n, "active"_n}, "test"_n, "testc"_n, tuple("quit"_n)}}); - set_abi( N(test), contracts::simple_abi().data() ); - produce_blocks(); +} - push_action(N(test), N(test4), N(test), mvo() ("to", "someone")); - push_action(N(test), N(test5), N(test), mvo() ("to", "someone")); - push_action(N(test), N(testa), N(test), mvo() ("to", "someone")); - BOOST_CHECK_THROW(push_action(N(test), N(testb), N(test), mvo() ("to", "someone")), fc::exception); +BOOST_FIXTURE_TEST_CASE( simple_eosio_tests, test_chain ) { + set_code( "eosio"_n, contracts::simple_wasm() ); + finish_block(); + transact({{{"eosio"_n, "active"_n}, "eosio"_n, "test1"_n, tuple("bucky"_n)}}); - // test that the pre_dispatch will short circuit dispatching if false - push_action(N(test), N(testc), N(test), mvo() ("nm", "bucky")); - BOOST_CHECK_THROW(push_action(N(test), N(testc), N(test), mvo() ("nm", "someone")), fc::exception); - push_action(N(test), N(testc), N(test), mvo() ("nm", "quit")); - -} FC_LOG_AND_RETHROW() - -BOOST_FIXTURE_TEST_CASE( simple_eosio_tests, tester ) try { - set_code( N(eosio), contracts::simple_wasm() ); - set_abi( N(eosio), contracts::simple_wrong_abi().data() ); - produce_blocks(); - push_action(N(eosio), N(test1), N(eosio), - mvo() - ("nm", "bucky")); - - BOOST_CHECK_THROW(push_action(N(eosio), N(test1), N(eosio), mvo()("nm", "notbucky")), - fc::exception); - - push_action(N(eosio), N(test2), N(eosio), - mvo() - ("arg0", 33) - ("arg1", "some string")); - BOOST_CHECK_THROW(push_action(N(eosio), N(test2), N(eosio), mvo() ("arg0", 30)("arg1", "some string")), fc::exception); - BOOST_CHECK_THROW(push_action(N(eosio), N(test2), N(eosio), mvo() ("arg0", 33)("arg1", "not some string")), fc::exception); - - push_action(N(eosio), N(test3), N(eosio), - mvo() - ("arg0", 33) - ("arg1", "some string")); - -} FC_LOG_AND_RETHROW() + transact({{{"eosio"_n, "active"_n}, "eosio"_n, "test1"_n, tuple("notbucky"_n)}}, "not bucky"); + + transact({{{"eosio"_n, "active"_n}, "eosio"_n, "test2"_n, tuple(33, "some string"s)}}); + transact({{{"eosio"_n, "active"_n}, "eosio"_n, "test2"_n, tuple(30, "some string"s)}}, "33 does not match"); + transact({{{"eosio"_n, "active"_n}, "eosio"_n, "test2"_n, tuple(33, "not some string"s)}}, "some string does not match"); + + transact({{{"eosio"_n, "active"_n}, "eosio"_n, "test3"_n, tuple(33, "some string"s)}}); +} BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/integration/contracts.hpp.in b/tests/integration/contracts.hpp.in index 8d0f140bbc..0b0218585c 100644 --- a/tests/integration/contracts.hpp.in +++ b/tests/integration/contracts.hpp.in @@ -1,23 +1,16 @@ #pragma once -#include namespace eosio { namespace testing { struct contracts { - static std::vector malloc_tests_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/malloc_tests.wasm"); } - static std::vector malloc_tests_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/malloc_tests.abi"); } - static std::vector old_malloc_tests_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/old_malloc_tests.wasm"); } - static std::vector old_malloc_tests_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/old_malloc_tests.abi"); } + static const char* malloc_tests_wasm() { return "${CMAKE_BINARY_DIR}/../unit/test_contracts/malloc_tests.wasm"; } + static const char* old_malloc_tests_wasm() { return "${CMAKE_BINARY_DIR}/../unit/test_contracts/old_malloc_tests.wasm"; } - static std::vector simple_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/simple_tests.wasm"); } - static std::vector simple_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/simple_tests.abi"); } - static std::vector simple_wrong_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/simple_wrong.abi"); } + static const char* simple_wasm() { return "${CMAKE_BINARY_DIR}/../unit/test_contracts/simple_tests.wasm"; } - static std::vector transfer_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/transfer_contract.wasm"); } - static std::vector transfer_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/transfer_contract.abi"); } + static const char* transfer_wasm() { return "${CMAKE_BINARY_DIR}/../unit/test_contracts/transfer_contract.wasm"; } - static std::vector capi_tests_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/capi_tests.wasm"); } - static std::vector capi_tests_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/capi_tests.abi"); } + static const char* capi_tests_wasm() { return "${CMAKE_BINARY_DIR}/../unit/test_contracts/capi_tests.wasm"; } }; diff --git a/tests/integration/main.cpp b/tests/integration/main.cpp index f88e58a51d..29469f8044 100644 --- a/tests/integration/main.cpp +++ b/tests/integration/main.cpp @@ -1,39 +1,2 @@ +#define BOOST_TEST_MODULE integration_tests #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BOOST_TEST_STATIC_LINK - -void translate_fc_exception(const fc::exception &e) { - std::cerr << "\033[33m" << e.to_detail_string() << "\033[0m" << std::endl; - BOOST_TEST_FAIL("Caught Unexpected Exception"); -} - -boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { - // Turn off blockchain logging if no --verbose parameter is not added - // To have verbose enabled, call "tests/chain_test -- --verbose" - bool is_verbose = false; - std::string verbose_arg = "--verbose"; - for (int i = 0; i < argc; i++) { - if (verbose_arg == argv[i]) { - is_verbose = true; - break; - } - } - if(!is_verbose) fc::logger::get(DEFAULT_LOGGER).set_log_level(fc::log_level::off); - - // Register fc::exception translator - boost::unit_test::unit_test_monitor.template register_exception_translator(&translate_fc_exception); - - std::srand(time(NULL)); - std::cout << "Random number generator seeded to " << time(NULL) << std::endl; - return nullptr; -} diff --git a/tests/integration/memory_tests.cpp b/tests/integration/memory_tests.cpp index cb25067173..5fb7f2f18a 100644 --- a/tests/integration/memory_tests.cpp +++ b/tests/integration/memory_tests.cpp @@ -1,35 +1,23 @@ #include -#include -#include - -#include - -#include +#include #include using namespace eosio; -using namespace eosio::testing; -using namespace eosio::chain; -using namespace eosio::testing; -using namespace fc; - -using mvo = fc::mutable_variant_object; +using eosio::testing::contracts; +using std::tuple; BOOST_AUTO_TEST_SUITE(memory_tests) -BOOST_FIXTURE_TEST_CASE( malloc_tests, tester ) try { - create_accounts( { N(test) } ); - produce_block(); - set_code( N(test), contracts::malloc_tests_wasm() ); - set_abi( N(test), contracts::malloc_tests_abi().data() ); - produce_blocks(); +BOOST_FIXTURE_TEST_CASE( malloc_tests, test_chain ) { + create_code_account( "test"_n ); + finish_block(); + set_code( "test"_n, contracts::malloc_tests_wasm() ); + finish_block(); - push_action(N(test), N(mallocpass), N(test), {}); - push_action(N(test), N(mallocalign), N(test), {}); - BOOST_CHECK_EXCEPTION( push_action(N(test), N(mallocfail), N(test), {}), - eosio_assert_message_exception, - eosio_assert_message_is("failed to allocate pages") ); -} FC_LOG_AND_RETHROW() + transact({{{"test"_n, "active"_n}, "test"_n, "mallocpass"_n, tuple()}}); + transact({{{"test"_n, "active"_n}, "test"_n, "mallocalign"_n, tuple()}}); + transact({{{"test"_n, "active"_n}, "test"_n, "mallocfail"_n, tuple()}}, "failed to allocate pages"); +} BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/unit/test_contracts/capi/action.c b/tests/unit/test_contracts/capi/action.c index 63824f2bff..592f8ada79 100644 --- a/tests/unit/test_contracts/capi/action.c +++ b/tests/unit/test_contracts/capi/action.c @@ -13,5 +13,7 @@ void test_action( void ) { send_context_free_inline(NULL, 0); publication_time(); current_receiver(); +#if 0 set_action_return_value(NULL, 0); +#endif } diff --git a/tests/unit/test_contracts/capi/privileged.c b/tests/unit/test_contracts/capi/privileged.c index e4ea864c52..ef55caa979 100644 --- a/tests/unit/test_contracts/capi/privileged.c +++ b/tests/unit/test_contracts/capi/privileged.c @@ -5,7 +5,9 @@ void test_privileged( void ) { get_resource_limits(0, NULL, NULL, NULL); set_resource_limits(0, 0, 0, 0); set_proposed_producers(NULL, 0); +#if 0 set_proposed_producers_ex(0, NULL, 0); +#endif is_privileged(0); set_privileged(0, 0); set_blockchain_parameters_packed(NULL, 0); From 58937f5955400ea3df8080959510ecf3dce42d18 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 13 Feb 2020 10:27:17 -0500 Subject: [PATCH 36/50] Add crypto API intrinsics. --- .../eosiolib/tester/tester_intrinsics.cpp | 48 +++++++++++++++++++ tools/tester/src/eosio-tester.cpp | 36 ++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/libraries/eosiolib/tester/tester_intrinsics.cpp b/libraries/eosiolib/tester/tester_intrinsics.cpp index 26aede789d..8d7552beec 100644 --- a/libraries/eosiolib/tester/tester_intrinsics.cpp +++ b/libraries/eosiolib/tester/tester_intrinsics.cpp @@ -30,6 +30,54 @@ extern "C" void printi(int64_t value) { printui(value); } +extern "C" { + struct __attribute__((aligned (16))) capi_checksum160 { uint8_t hash[20]; }; + struct __attribute__((aligned (16))) capi_checksum256 { uint8_t hash[32]; }; + struct __attribute__((aligned (16))) capi_checksum512 { uint8_t hash[64]; }; + + int recover_key( capi_checksum256* digest, const char* sig, uint32_t sig_len, char* pub, uint32_t pub_len) { + eosio::check(false, "recover_key is not available"); + [[unreachable]]; + } + int assert_recover_key( capi_checksum256* digest, const char* sig, uint32_t sig_len, const char* pub, uint32_t pub_len) { + eosio::check(false, "assert_recover_key is not available"); + [[unreachable]]; + } + + __attribute__((eosio_wasm_import)) + void sha256( const char* data, uint32_t length, capi_checksum256* hash ); + + __attribute__((eosio_wasm_import)) + void sha1( const char* data, uint32_t length, capi_checksum160* hash ); + + __attribute__((eosio_wasm_import)) + void sha512( const char* data, uint32_t length, capi_checksum512* hash ); + + __attribute__((eosio_wasm_import)) + void ripemd160( const char* data, uint32_t length, capi_checksum160* hash ); + + void assert_sha1(const char* data, uint32_t len, const capi_checksum160* expected) { + capi_checksum160 actual; + sha1(data, len, &actual); + eosio::check(memcmp(actual.hash, expected->hash, sizeof(actual.hash)) == 0, "hash mismatch"); + } + void assert_sha256(const char* data, uint32_t len, const capi_checksum256* expected) { + capi_checksum256 actual; + sha256(data, len, &actual); + eosio::check(memcmp(actual.hash, expected->hash, sizeof(actual.hash)) == 0, "hash mismatch"); + } + void assert_sha512(const char* data, uint32_t len, const capi_checksum512* expected) { + capi_checksum512 actual; + sha512(data, len, &actual); + eosio::check(memcmp(actual.hash, expected->hash, sizeof(actual.hash)) == 0, "hash mismatch"); + } + void assert_ripemd160(const char* data, uint32_t len, const capi_checksum160* expected) { + capi_checksum160 actual; + ripemd160(data, len, &actual); + eosio::check(memcmp(actual.hash, expected->hash, sizeof(actual.hash)) == 0, "hash mismatch"); + } +} + namespace eosio { void print(std::string_view sv) { print_range(sv.data(), sv.data() + sv.size()); } diff --git a/tools/tester/src/eosio-tester.cpp b/tools/tester/src/eosio-tester.cpp index dada75ea22..b19eae6036 100644 --- a/tools/tester/src/eosio-tester.cpp +++ b/tools/tester/src/eosio-tester.cpp @@ -10,6 +10,10 @@ #include #include #include +#include +#include +#include +#include #include using namespace eosio::literals; @@ -791,6 +795,34 @@ struct callbacks { DB_WRAPPERS_FLOAT_SECONDARY(idx_double, float64_t) DB_WRAPPERS_FLOAT_SECONDARY(idx_long_double, float128_t) // clang-format on + + void sha1(const char* data, uint32_t datalen, void* hash_val) { + check_bounds(data, data + datalen); + auto hash = fc::sha1::hash( data, datalen ); + check_bounds((char*)hash_val, (char*)hash_val + hash.data_size()); + std::memcpy(hash_val, hash.data(), hash.data_size()); + } + + void sha256(const char* data, uint32_t datalen, void* hash_val) { + check_bounds(data, data + datalen); + auto hash = fc::sha256::hash( data, datalen ); + check_bounds((char*)hash_val, (char*)hash_val + hash.data_size()); + std::memcpy(hash_val, hash.data(), hash.data_size()); + } + + void sha512(const char* data, uint32_t datalen, void* hash_val) { + check_bounds(data, data + datalen); + auto hash = fc::sha512::hash( data, datalen ); + check_bounds((char*)hash_val, (char*)hash_val + hash.data_size()); + std::memcpy(hash_val, hash.data(), hash.data_size()); + } + + void ripemd160(const char* data, uint32_t datalen, void* hash_val) { + check_bounds(data, data + datalen); + auto hash = fc::ripemd160::hash( data, datalen ); + check_bounds((char*)hash_val, (char*)hash_val + hash.data_size()); + std::memcpy(hash_val, hash.data(), hash.data_size()); + } }; // callbacks #define DB_REGISTER_SECONDARY(IDX) \ @@ -842,6 +874,10 @@ void register_callbacks() { // DB_REGISTER_SECONDARY(idx256) DB_REGISTER_SECONDARY(idx_double) DB_REGISTER_SECONDARY(idx_long_double) + rhf_t::add("env", "sha1"); + rhf_t::add("env", "sha256"); + rhf_t::add("env", "sha512"); + rhf_t::add("env", "ripemd160"); } static void run(const char* wasm, const std::vector& args) { From 9448b4699c6d1cab9246a71c998000eea82a7134 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 13 Feb 2020 13:36:33 -0500 Subject: [PATCH 37/50] Add basic test of the transaction_trace returned by push_transaction. --- .../eosiolib/tester/eosio/chain_types.hpp | 4 +- libraries/eosiolib/tester/eosio/tester.hpp | 20 +++++++++ .../eosiolib/tester/tester_intrinsics.cpp | 2 +- tests/tester/tester.cpp | 44 +++++++++++++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) diff --git a/libraries/eosiolib/tester/eosio/chain_types.hpp b/libraries/eosiolib/tester/eosio/chain_types.hpp index 99806ac0b6..56006ebabe 100644 --- a/libraries/eosiolib/tester/eosio/chain_types.hpp +++ b/libraries/eosiolib/tester/eosio/chain_types.hpp @@ -79,6 +79,7 @@ struct account_auth_sequence { }; EOSIO_REFLECT(account_auth_sequence, account, sequence); +EOSIO_COMPARE(account_auth_sequence); struct account_delta { eosio::name account = {}; @@ -86,6 +87,7 @@ struct account_delta { }; EOSIO_REFLECT(account_delta, account, delta); +EOSIO_COMPARE(account_delta); struct action_receipt_v0 { eosio::name receiver = {}; @@ -165,7 +167,7 @@ struct transaction_trace_v0 { std::optional reserved_do_not_use = {}; }; -EOSIO_REFLECT(transaction_trace_v0, id, status, cpu_usage_us, elapsed, net_usage_words, scheduled, action_traces, +EOSIO_REFLECT(transaction_trace_v0, id, status, cpu_usage_us, net_usage_words, elapsed, net_usage, scheduled, action_traces, account_ram_delta, except, error_code, failed_dtrx_trace, reserved_do_not_use); struct producer_key { diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index d061f22bb1..1ae854da99 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -297,6 +297,10 @@ inline std::ostream& operator<<(std::ostream& os, const block_timestamp& obj) { return os << obj.slot; } +inline std::ostream& operator<<(std::ostream& os, const name& obj) { + return os << obj.to_string(); +} + /** * Manages a chain. * Only one test_chain can exist at a time. @@ -564,3 +568,19 @@ class test_chain { }; } // namespace eosio + +namespace chain_types { + +inline std::ostream& operator<<(std::ostream& os, transaction_status t) { + return os << to_string(t); +} + +inline std::ostream& operator<<(std::ostream& os, const account_auth_sequence& aas) { + return os << eosio::check(eosio::convert_to_json(aas)).value(); +} + +inline std::ostream& operator<<(std::ostream& os, const account_delta& ad) { + return os << eosio::check(eosio::convert_to_json(ad)).value(); +} + +} diff --git a/libraries/eosiolib/tester/tester_intrinsics.cpp b/libraries/eosiolib/tester/tester_intrinsics.cpp index 8d7552beec..3c01b137fa 100644 --- a/libraries/eosiolib/tester/tester_intrinsics.cpp +++ b/libraries/eosiolib/tester/tester_intrinsics.cpp @@ -39,7 +39,7 @@ extern "C" { eosio::check(false, "recover_key is not available"); [[unreachable]]; } - int assert_recover_key( capi_checksum256* digest, const char* sig, uint32_t sig_len, const char* pub, uint32_t pub_len) { + void assert_recover_key( capi_checksum256* digest, const char* sig, uint32_t sig_len, const char* pub, uint32_t pub_len) { eosio::check(false, "assert_recover_key is not available"); [[unreachable]]; } diff --git a/tests/tester/tester.cpp b/tests/tester/tester.cpp index b25eb7a524..d41789cc8f 100644 --- a/tests/tester/tester.cpp +++ b/tests/tester/tester.cpp @@ -65,6 +65,50 @@ BOOST_FIXTURE_TEST_CASE(start_block_skip, eosio::test_chain) { transact({empty}); start_block(1500); transact({empty}); + // Verify that we can apply a transaction immediately after a large skip start_block(1000000); transact({empty}); } + +template +eosio::checksum256 sha256(const T& t) { + auto packed = eosio::pack(t); + return eosio::sha256(packed.data(), packed.size()); +} + +BOOST_FIXTURE_TEST_CASE(transaction_trace, eosio::test_chain) { + eosio::action empty{ { { "eosio"_n, "active"_n } }, "eosio"_n, eosio::name(), std::tuple() }; + eosio::transaction t = make_transaction( { empty } ); + auto trace = push_transaction( t ); + BOOST_TEST(trace.id == sha256(t)); + BOOST_TEST(trace.status == eosio::transaction_status::executed); + BOOST_TEST(trace.cpu_usage_us == 2000); // The tester always bills 2 ms per transaction. + BOOST_TEST(trace.net_usage_words == 12); // default minimum net usage + BOOST_TEST(trace.elapsed > 0); // Variable + BOOST_TEST(trace.net_usage == 96); // net_usage_words*8 + BOOST_TEST(trace.scheduled == false); + + // action_trace + BOOST_TEST(trace.action_traces.size() == 1); + BOOST_TEST(trace.action_traces[0].action_ordinal == 1); + BOOST_TEST(trace.action_traces[0].creator_action_ordinal == 0); + BOOST_TEST(trace.action_traces[0].receipt->receiver == "eosio"_n); + BOOST_TEST(trace.action_traces[0].receipt->act_digest == sha256(empty)); + BOOST_TEST(trace.action_traces[0].receipt->global_sequence == 2); + BOOST_TEST(trace.action_traces[0].receipt->recv_sequence == 2); + BOOST_TEST(trace.action_traces[0].receipt->auth_sequence == (std::vector{ { "eosio"_n, 2 } }), boost::test_tools::per_element()); + BOOST_TEST(trace.action_traces[0].receipt->code_sequence == 0); + BOOST_TEST(trace.action_traces[0].receipt->abi_sequence == 0); + BOOST_TEST(trace.action_traces[0].receiver == "eosio"_n); + BOOST_TEST(trace.action_traces[0].context_free == false); + BOOST_TEST(trace.action_traces[0].elapsed > 0); + BOOST_TEST(trace.action_traces[0].console == ""); + BOOST_TEST(trace.action_traces[0].account_ram_deltas == std::vector{}, boost::test_tools::per_element()); + BOOST_TEST(!trace.action_traces[0].except); + BOOST_TEST(!trace.action_traces[0].error_code); + + BOOST_TEST(!trace.account_ram_delta); + BOOST_TEST(!trace.except); + BOOST_TEST(!trace.error_code); + BOOST_TEST(trace.failed_dtrx_trace.size() == 0); +} From 2365294c830b0a43f33b036ec340f27ac091ca7f Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 13 Feb 2020 14:26:34 -0500 Subject: [PATCH 38/50] Use key_weight instead of tester_key_weight. --- libraries/eosiolib/tester/eosio/tester.hpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index 1ae854da99..c23db5b361 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -158,14 +159,6 @@ inline asset string_to_asset(const char* s) { inline asset s2a(const char* s) { return string_to_asset(s); } -// TODO: move -struct tester_key_weight { - eosio::public_key key = {}; - uint16_t weight = {}; - - EOSLIB_SERIALIZE(tester_key_weight, (key)(weight)) -}; - // TODO: move struct tester_permission_level_weight { permission_level permission = {}; @@ -185,7 +178,7 @@ struct tester_wait_weight { // TODO: move struct tester_authority { uint32_t threshold = {}; - std::vector keys = {}; + std::vector keys = {}; std::vector accounts = {}; std::vector waits = {}; From c91c613f32771e4c30c6714261b610eb3b92b234 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 13 Feb 2020 14:40:11 -0500 Subject: [PATCH 39/50] Minor cleanup - Remove unused get - Use EOSIO_REFLECT instead of EOSLIB_SERIALIZE --- libraries/eosiolib/tester/eosio/tester.hpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index c23db5b361..f95da17c3d 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -147,12 +147,6 @@ inline int32_t execute(std::string_view command) { return internal_use_do_not_use::execute(command.data(), command.data() + command.size()); } - template - T get(result&& obj) { - if(!obj) check(false, obj.error().message()); - return std::move(obj.value()); - } - inline asset string_to_asset(const char* s) { return check(eosio::convert_from_string(s)).value(); } @@ -163,28 +157,28 @@ inline asset s2a(const char* s) { return string_to_asset(s); } struct tester_permission_level_weight { permission_level permission = {}; uint16_t weight = {}; - - EOSLIB_SERIALIZE(tester_permission_level_weight, (permission)(weight)) }; +EOSIO_REFLECT(tester_permission_level_weight, permission, weight); + // TODO: move struct tester_wait_weight { uint32_t wait_sec = {}; uint16_t weight = {}; - - EOSLIB_SERIALIZE(tester_wait_weight, (wait_sec)(weight)) }; +EOSIO_REFLECT(tester_wait_weight, wait_sec, weight); + // TODO: move struct tester_authority { uint32_t threshold = {}; std::vector keys = {}; std::vector accounts = {}; std::vector waits = {}; - - EOSLIB_SERIALIZE(tester_authority, (threshold)(keys)(accounts)(waits)) }; +EOSIO_REFLECT(tester_authority, threshold, keys, accounts, waits); + using chain_types::transaction_status; auto conversion_kind(chain_types::permission_level, permission_level) -> strict_conversion; From 8eb9e901733f0273e340e7efd8a79b888924d26b Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 14 Feb 2020 12:13:54 -0500 Subject: [PATCH 40/50] Separately compile as much of the tester as possible. --- libraries/eosiolib/CMakeLists.txt | 1 + .../eosiolib/contracts/eosio/contract.hpp | 4 +- libraries/eosiolib/contracts/eosio/eosio.hpp | 10 +- .../eosiolib/contracts/eosio/multi_index.hpp | 8 +- libraries/eosiolib/tester/eosio/tester.hpp | 375 ++--------------- libraries/eosiolib/tester/tester.cpp | 385 ++++++++++++++++++ 6 files changed, 431 insertions(+), 352 deletions(-) create mode 100644 libraries/eosiolib/tester/tester.cpp diff --git a/libraries/eosiolib/CMakeLists.txt b/libraries/eosiolib/CMakeLists.txt index 018e949c1f..28bd5126d2 100644 --- a/libraries/eosiolib/CMakeLists.txt +++ b/libraries/eosiolib/CMakeLists.txt @@ -19,6 +19,7 @@ add_library(eosio_cmem ${HEADERS}) add_library(eosio_tester + tester/tester.cpp tester/tester_intrinsics.cpp tester/fpconv.c ${CMAKE_SOURCE_DIR}/abieos/src/crypto.cpp diff --git a/libraries/eosiolib/contracts/eosio/contract.hpp b/libraries/eosiolib/contracts/eosio/contract.hpp index d60d47241c..2067ae6ccb 100644 --- a/libraries/eosiolib/contracts/eosio/contract.hpp +++ b/libraries/eosiolib/contracts/eosio/contract.hpp @@ -1,7 +1,7 @@ #pragma once -#include "../../core/eosio/name.hpp" -#include "../../core/eosio/datastream.hpp" +#include +#include /** diff --git a/libraries/eosiolib/contracts/eosio/eosio.hpp b/libraries/eosiolib/contracts/eosio/eosio.hpp index 1208ffd5e1..1d996cf46b 100644 --- a/libraries/eosiolib/contracts/eosio/eosio.hpp +++ b/libraries/eosiolib/contracts/eosio/eosio.hpp @@ -3,11 +3,11 @@ * @copyright defined in eos/LICENSE */ #pragma once -#include "action.hpp" -#include "../../core/eosio/print.hpp" -#include "multi_index.hpp" -#include "dispatcher.hpp" -#include "contract.hpp" +#include +#include +#include +#include +#include #ifndef EOSIO_NATIVE static_assert( sizeof(long) == sizeof(int), "unexpected size difference" ); diff --git a/libraries/eosiolib/contracts/eosio/multi_index.hpp b/libraries/eosiolib/contracts/eosio/multi_index.hpp index 409c2373b1..40bfbc7535 100644 --- a/libraries/eosiolib/contracts/eosio/multi_index.hpp +++ b/libraries/eosiolib/contracts/eosio/multi_index.hpp @@ -4,10 +4,10 @@ */ #pragma once -#include "../../contracts/eosio/action.hpp" -#include "../../core/eosio/name.hpp" -#include "../../core/eosio/serialize.hpp" -#include "../../core/eosio/fixed_bytes.hpp" +#include +#include +#include +#include #include #include diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index f95da17c3d..af8e0ce2e7 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -18,85 +18,8 @@ namespace eosio { namespace internal_use_do_not_use { - TESTER_INTRINSIC void get_args(void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - TESTER_INTRINSIC bool reenter(const char* args_begin, const char* args_end, void (*cb)(), void* cb_alloc_data, - void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - TESTER_INTRINSIC int32_t open_file(const char* filename_begin, const char* filename_end, const char* mode_begin, - const char* mode_end); - TESTER_INTRINSIC void close_file(int32_t file_index); - TESTER_INTRINSIC bool write_file(int32_t file_index, const char* content_begin, const char* content_end); - TESTER_INTRINSIC bool read_whole_file(const char* filename_begin, const char* filename_end, void* cb_alloc_data, - void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - TESTER_INTRINSIC int32_t execute(const char* command_begin, const char* command_end); - - TESTER_INTRINSIC uint32_t create_chain(); - TESTER_INTRINSIC void destroy_chain(uint32_t chain); - TESTER_INTRINSIC void start_block(uint32_t chain, int64_t skip_miliseconds); - TESTER_INTRINSIC void finish_block(uint32_t chain); - TESTER_INTRINSIC void get_head_block_info(uint32_t chain, void* cb_alloc_data, - void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - TESTER_INTRINSIC void push_transaction(uint32_t chain, const char* args_begin, const char* args_end, - void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - TESTER_INTRINSIC bool exec_deferred(uint32_t chain, void* cb_alloc_data, - void* (*cb_alloc)(void* cb_alloc_data, size_t size)); TESTER_INTRINSIC void query_database_chain(uint32_t chain, void* req_begin, void* req_end, void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - TESTER_INTRINSIC void select_chain_for_db(uint32_t chain_index); - - template - inline void get_args(Alloc_fn alloc_fn) { - return get_args(&alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // - return (*reinterpret_cast(cb_alloc_data))(size); - }); - } - - inline const std::vector& get_args() { - static std::optional> bytes; - if (!bytes) { - get_args([&](size_t size) { - bytes.emplace(); - bytes->resize(size); - return bytes->data(); - }); - } - return *bytes; - } - - template - inline bool reenter(const char* args_begin, const char* args_end, void (*fn)(), Alloc_fn alloc_fn) { - return reenter(args_begin, args_end, fn, // - &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { - return (*reinterpret_cast(cb_alloc_data))(size); - }); - } - - template - inline bool read_whole_file(const char* filename_begin, const char* filename_end, Alloc_fn alloc_fn) { - return read_whole_file(filename_begin, filename_end, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // - return (*reinterpret_cast(cb_alloc_data))(size); - }); - } - - template - inline void get_head_block_info(uint32_t chain, Alloc_fn alloc_fn) { - get_head_block_info(chain, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // - return (*reinterpret_cast(cb_alloc_data))(size); - }); - } - - template - inline void push_transaction(uint32_t chain, const char* args_begin, const char* args_end, Alloc_fn alloc_fn) { - push_transaction(chain, args_begin, args_end, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // - return (*reinterpret_cast(cb_alloc_data))(size); - }); - } - - template - inline bool exec_deferred(uint32_t chain, Alloc_fn alloc_fn) { - return exec_deferred(chain, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // - return (*reinterpret_cast(cb_alloc_data))(size); - }); - } template inline void query_database_chain(uint32_t chain, const T& req, Alloc_fn alloc_fn) { @@ -109,76 +32,16 @@ namespace internal_use_do_not_use { } // namespace internal_use_do_not_use -inline const std::vector& get_args() { - static std::optional> args; - if (!args) { - auto& bytes = internal_use_do_not_use::get_args(); - args.emplace(); - args = check(convert_from_bin>(bytes)).value(); - } - return *args; -} +const std::vector& get_args(); -template -bool reenter(void (*f)(), E e) { - auto& args = internal_use_do_not_use::get_args(); - std::string error; - bool ok = internal_use_do_not_use::reenter(args.data(), args.data() + args.size(), f, [&](size_t size) { - error.resize(size); - return error.data(); - }); - if (ok) - return true; - e(error); - return false; -} +std::vector read_whole_file(std::string_view filename); -inline std::vector read_whole_file(std::string_view filename) { - std::vector result; - if (!internal_use_do_not_use::read_whole_file(filename.data(), filename.data() + filename.size(), [&](size_t size) { - result.resize(size); - return result.data(); - })) - check(false, "read " + std::string(filename) + " failed"); - return result; -} +int32_t execute(std::string_view command); -inline int32_t execute(std::string_view command) { - return internal_use_do_not_use::execute(command.data(), command.data() + command.size()); -} - -inline asset string_to_asset(const char* s) { - return check(eosio::convert_from_string(s)).value(); -} +asset string_to_asset(const char* s); inline asset s2a(const char* s) { return string_to_asset(s); } -// TODO: move -struct tester_permission_level_weight { - permission_level permission = {}; - uint16_t weight = {}; -}; - -EOSIO_REFLECT(tester_permission_level_weight, permission, weight); - -// TODO: move -struct tester_wait_weight { - uint32_t wait_sec = {}; - uint16_t weight = {}; -}; - -EOSIO_REFLECT(tester_wait_weight, wait_sec, weight); - -// TODO: move -struct tester_authority { - uint32_t threshold = {}; - std::vector keys = {}; - std::vector accounts = {}; - std::vector waits = {}; -}; - -EOSIO_REFLECT(tester_authority, threshold, keys, accounts, waits); - using chain_types::transaction_status; auto conversion_kind(chain_types::permission_level, permission_level) -> strict_conversion; @@ -240,23 +103,7 @@ using chain_types::block_info; * transaction should succeed. Otherwise it represents a string which should be * part of the error message. */ -inline void expect(const transaction_trace& tt, const char* expected_except = nullptr) { - if (expected_except) { - if (tt.status == transaction_status::executed) - eosio::check(false, "transaction succeeded, but was expected to fail with: " + std::string(expected_except)); - if (!tt.except) - eosio::check(false, "transaction has no failure message. expected: " + std::string(expected_except)); - if (tt.except->find(expected_except) == std::string::npos) - eosio::check(false, "transaction failed with <<<" + *tt.except + ">>>, but was expected to fail with: <<<" + - expected_except + ">>>"); - } else { - if (tt.status == transaction_status::executed) - return; - if (tt.except) - eosio::print(*tt.except, "\n"); - eosio::check(false, "transaction has status " + to_string(tt.status)); - } -} +void expect(const transaction_trace& tt, const char* expected_except = nullptr); template void hex(SrcIt begin, SrcIt end, DestIt dest) { @@ -280,13 +127,8 @@ std::ostream& operator<<(std::ostream& os, const fixed_bytes& d) { return os; } -inline std::ostream& operator<<(std::ostream& os, const block_timestamp& obj) { - return os << obj.slot; -} - -inline std::ostream& operator<<(std::ostream& os, const name& obj) { - return os << obj.to_string(); -} +std::ostream& operator<<(std::ostream& os, const block_timestamp& obj); +std::ostream& operator<<(std::ostream& os, const name& obj); /** * Manages a chain. @@ -302,13 +144,11 @@ class test_chain { public_key default_pub_key = public_key_from_string("EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV").value(); private_key default_priv_key = private_key_from_string("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3").value(); - test_chain() : id{ internal_use_do_not_use::create_chain() } {} + test_chain(); test_chain(const test_chain&) = delete; - test_chain(test_chain&&) = delete; - ~test_chain() { internal_use_do_not_use::destroy_chain(id); } + ~test_chain(); test_chain& operator=(const test_chain&) = delete; - test_chain& operator=(test_chain&&) = default; /** * Start a new pending block. If a block is currently pending, finishes it first. @@ -317,56 +157,19 @@ class test_chain { * @param skip_milliseconds The amount of time to skip in addition to the 500 ms block time. * truncated to a multiple of 500 ms. */ - void start_block(int64_t skip_miliseconds = 0) { - head_block_info.reset(); - if (skip_miliseconds >= 500) { - // Guarantee that there is a recent block for fill_tapos to use. - internal_use_do_not_use::start_block(id, skip_miliseconds - 500); - internal_use_do_not_use::start_block(id, 0); - } else { - internal_use_do_not_use::start_block(id, skip_miliseconds); - } - } + void start_block(int64_t skip_miliseconds = 0); /** * Finish the current pending block. If no block is pending, creates an empty block. */ - void finish_block() { - head_block_info.reset(); - internal_use_do_not_use::finish_block(id); - } + void finish_block(); - const block_info& get_head_block_info() { - if (!head_block_info) { - std::vector bin; - internal_use_do_not_use::get_head_block_info(id, [&](size_t size) { - bin.resize(size); - return bin.data(); - }); - head_block_info = check(convert_from_bin(bin)).value(); - } - return *head_block_info; - } - - void fill_tapos(transaction& t, uint32_t expire_sec = 1) { - auto& info = get_head_block_info(); - t.expiration = time_point_sec(info.timestamp) + expire_sec; - t.ref_block_num = info.block_num; - memcpy(&t.ref_block_prefix, info.block_id.extract_as_byte_array().data() + 8, sizeof(t.ref_block_prefix)); - } + const block_info& get_head_block_info(); - transaction make_transaction() { - transaction t{ time_point_sec{} }; - fill_tapos(t); - return t; - } + void fill_tapos(transaction& t, uint32_t expire_sec = 1); - transaction make_transaction(std::vector&& actions) { - transaction t{ time_point_sec{} }; - fill_tapos(t); - t.actions = std::move(actions); - return t; - } + transaction make_transaction(); + transaction make_transaction(std::vector&& actions); /** * Pushes a transaction onto the chain. If no block is currently pending, starts one. @@ -374,26 +177,10 @@ class test_chain { [[nodiscard]] transaction_trace push_transaction(const transaction& trx, const std::vector& keys, const std::vector>& context_free_data = {}, - const std::vector& signatures = {}) { - - std::vector packed_trx = pack(trx); - std::vector args; - check_discard(convert_to_bin(packed_trx, args)); - check_discard(convert_to_bin(context_free_data, args)); - check_discard(convert_to_bin(signatures, args)); - check_discard(convert_to_bin(keys, args)); - std::vector bin; - internal_use_do_not_use::push_transaction(id, args.data(), args.data() + args.size(), [&](size_t size) { - bin.resize(size); - return bin.data(); - }); - return check(convert_from_bin(bin)).value(); - } + const std::vector& signatures = {}); [[nodiscard]] - transaction_trace push_transaction(const transaction& trx) { - return push_transaction(trx, { default_priv_key }); - } + transaction_trace push_transaction(const transaction& trx); /** * Pushes a transaction onto the chain. If no block is currently pending, starts one. @@ -401,15 +188,9 @@ class test_chain { * Validates the transaction status according to @ref eosio::expect. */ transaction_trace transact(std::vector&& actions, const std::vector& keys, - const char* expected_except = nullptr) { - auto trace = push_transaction(make_transaction(std::move(actions)), keys); - expect(trace, expected_except); - return trace; - } + const char* expected_except = nullptr); - transaction_trace transact(std::vector&& actions, const char* expected_except = nullptr) { - return transact(std::move(actions), { default_priv_key }, expected_except); - } + transaction_trace transact(std::vector&& actions, const char* expected_except = nullptr); /** * Executes a single deferred transaction and returns the action trace. @@ -419,32 +200,12 @@ class test_chain { * If no block is currently pending, starts one. */ [[nodiscard]] - std::optional exec_deferred() { - std::vector bin; - if (!internal_use_do_not_use::exec_deferred(id, [&](size_t size) { - bin.resize(size); - return bin.data(); - })) - return {}; - return check(convert_from_bin(bin)).value(); - } + std::optional exec_deferred(); transaction_trace create_account(name ac, const public_key& pub_key, - const char* expected_except = nullptr) { - tester_authority simple_auth{ - .threshold = 1, - .keys = { { pub_key, 1 } }, - }; - return transact({ action{ { { "eosio"_n, "active"_n } }, - "eosio"_n, - "newaccount"_n, - std::make_tuple("eosio"_n, ac, simple_auth, simple_auth) } }, - expected_except); - } + const char* expected_except = nullptr); - transaction_trace create_account(name ac, const char* expected_except = nullptr) { - return create_account(ac, default_pub_key, expected_except); - } + transaction_trace create_account(name ac, const char* expected_except = nullptr); /** * Create an account that can have a contract set on it. @@ -454,94 +215,34 @@ class test_chain { * @param expected_except Used to validate the transaction status according to @ref eosio::expect. */ transaction_trace create_code_account(name account, const public_key& pub_key, bool is_priv = false, - const char* expected_except = nullptr) { - tester_authority simple_auth{ - .threshold = 1, - .keys = { { pub_key, 1 } }, - }; - tester_authority code_auth{ - .threshold = 1, - .keys = { { pub_key, 1 } }, - .accounts = { { { account, "eosio.code"_n }, 1 } }, - }; - return transact( - { - action{ { { "eosio"_n, "active"_n } }, - "eosio"_n, - "newaccount"_n, - std::make_tuple("eosio"_n, account, simple_auth, code_auth) }, - action{ { { "eosio"_n, "active"_n } }, "eosio"_n, "setpriv"_n, std::make_tuple(account, is_priv) }, - }, - expected_except); - } - - transaction_trace create_code_account(name ac, const public_key& pub_key, const char* expected_except) { - return create_code_account(ac, pub_key, false, expected_except); - } - + const char* expected_except = nullptr); + transaction_trace create_code_account(name ac, const public_key& pub_key, const char* expected_except); transaction_trace create_code_account(name ac, bool is_priv = false, - const char* expected_except = nullptr) { - return create_code_account(ac, default_pub_key, is_priv, expected_except); - } - - transaction_trace create_code_account(name ac, const char* expected_except) { - return create_code_account(ac, default_pub_key, false, expected_except); - } + const char* expected_except = nullptr); + transaction_trace create_code_account(name ac, const char* expected_except); /* * Set the code for an account. * Validates the transaction status as with @ref eosio::expect. */ - transaction_trace set_code(name ac, const char* filename, const char* expected_except = nullptr) { - return transact({ action{ { { ac, "active"_n } }, - "eosio"_n, - "setcode"_n, - std::make_tuple(ac, uint8_t{ 0 }, uint8_t{ 0 }, read_whole_file(filename)) } }, - expected_except); - } + transaction_trace set_code(name ac, const char* filename, const char* expected_except = nullptr); /** * Creates a new token. * The eosio.token contract should be deployed on the @c contract account. */ transaction_trace create_token(name contract, name signer, name issuer, asset maxsupply, - const char* expected_except = nullptr) { - return transact( - { action{ { { signer, "active"_n } }, contract, "create"_n, std::make_tuple(issuer, maxsupply) } }, - expected_except); - } + const char* expected_except = nullptr); transaction_trace issue(const name& contract, const name& issuer, const asset& amount, - const char* expected_except = nullptr) { - return transact({ action{ { { issuer, "active"_n } }, - contract, - "issue"_n, - std::make_tuple(issuer, amount, std::string{ "issuing" }) } }, - expected_except); - } + const char* expected_except = nullptr); transaction_trace transfer(const name& contract, const name& from, const name& to, const asset& amount, - const std::string& memo = "", const char* expected_except = nullptr) { - - return transact( - { action{ { { from, "active"_n } }, contract, "transfer"_n, std::make_tuple(from, to, amount, memo) } }, - expected_except); - } + const std::string& memo = "", const char* expected_except = nullptr); transaction_trace issue_and_transfer(const name& contract, const name& issuer, const name& to, const asset& amount, const std::string& memo = "", - const char* expected_except = nullptr) { - return transact( - { - action{ { { issuer, "active"_n } }, - contract, - "issue"_n, - std::make_tuple(issuer, amount, std::string{ "issuing" }) }, - action{ - { { issuer, "active"_n } }, contract, "transfer"_n, std::make_tuple(issuer, to, amount, memo) }, - }, - expected_except); - } + const char* expected_except = nullptr); template inline std::vector query_database(const T& request) { @@ -558,16 +259,8 @@ class test_chain { namespace chain_types { -inline std::ostream& operator<<(std::ostream& os, transaction_status t) { - return os << to_string(t); -} - -inline std::ostream& operator<<(std::ostream& os, const account_auth_sequence& aas) { - return os << eosio::check(eosio::convert_to_json(aas)).value(); -} - -inline std::ostream& operator<<(std::ostream& os, const account_delta& ad) { - return os << eosio::check(eosio::convert_to_json(ad)).value(); -} +std::ostream& operator<<(std::ostream& os, transaction_status t); +std::ostream& operator<<(std::ostream& os, const account_auth_sequence& aas); +std::ostream& operator<<(std::ostream& os, const account_delta& ad); } diff --git a/libraries/eosiolib/tester/tester.cpp b/libraries/eosiolib/tester/tester.cpp new file mode 100644 index 0000000000..bfedf7545c --- /dev/null +++ b/libraries/eosiolib/tester/tester.cpp @@ -0,0 +1,385 @@ +#include +#include + +#define TESTER_INTRINSIC extern "C" __attribute__((eosio_wasm_import)) + +namespace { + + TESTER_INTRINSIC void get_args(void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC bool reenter(const char* args_begin, const char* args_end, void (*cb)(), void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC int32_t open_file(const char* filename_begin, const char* filename_end, const char* mode_begin, + const char* mode_end); + TESTER_INTRINSIC void close_file(int32_t file_index); + TESTER_INTRINSIC bool write_file(int32_t file_index, const char* content_begin, const char* content_end); + TESTER_INTRINSIC bool read_whole_file(const char* filename_begin, const char* filename_end, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC int32_t execute(const char* command_begin, const char* command_end); + + TESTER_INTRINSIC uint32_t create_chain(); + TESTER_INTRINSIC void destroy_chain(uint32_t chain); + TESTER_INTRINSIC void start_block(uint32_t chain, int64_t skip_miliseconds); + TESTER_INTRINSIC void finish_block(uint32_t chain); + TESTER_INTRINSIC void get_head_block_info(uint32_t chain, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC void push_transaction(uint32_t chain, const char* args_begin, const char* args_end, + void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC bool exec_deferred(uint32_t chain, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC void query_database_chain(uint32_t chain, void* req_begin, void* req_end, void* cb_alloc_data, + void* (*cb_alloc)(void* cb_alloc_data, size_t size)); + TESTER_INTRINSIC void select_chain_for_db(uint32_t chain_index); + + template + inline void get_args(Alloc_fn alloc_fn) { + return get_args(&alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + + inline const std::vector& get_args() { + static std::optional> bytes; + if (!bytes) { + get_args([&](size_t size) { + bytes.emplace(); + bytes->resize(size); + return bytes->data(); + }); + } + return *bytes; + } + + template + inline bool reenter(const char* args_begin, const char* args_end, void (*fn)(), Alloc_fn alloc_fn) { + return reenter(args_begin, args_end, fn, // + &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + + template + inline bool read_whole_file(const char* filename_begin, const char* filename_end, Alloc_fn alloc_fn) { + return read_whole_file(filename_begin, filename_end, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + + template + inline void get_head_block_info(uint32_t chain, Alloc_fn alloc_fn) { + get_head_block_info(chain, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + + template + inline void push_transaction(uint32_t chain, const char* args_begin, const char* args_end, Alloc_fn alloc_fn) { + push_transaction(chain, args_begin, args_end, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + + template + inline bool exec_deferred(uint32_t chain, Alloc_fn alloc_fn) { + return exec_deferred(chain, &alloc_fn, [](void* cb_alloc_data, size_t size) -> void* { // + return (*reinterpret_cast(cb_alloc_data))(size); + }); + } + +} // namespace + +const std::vector& eosio::get_args() { + static std::optional> args; + if (!args) { + auto& bytes = ::get_args(); + args.emplace(); + args = check(convert_from_bin>(bytes)).value(); + } + return *args; +} + +std::vector eosio::read_whole_file(std::string_view filename) { + std::vector result; + if (!::read_whole_file(filename.data(), filename.data() + filename.size(), [&](size_t size) { + result.resize(size); + return result.data(); + })) + check(false, "read " + std::string(filename) + " failed"); + return result; +} + +int32_t eosio::execute(std::string_view command) { + return ::execute(command.data(), command.data() + command.size()); +} + +eosio::asset eosio::string_to_asset(const char* s) { + return check(eosio::convert_from_string(s)).value(); +} + +namespace { + +// TODO: move +struct tester_permission_level_weight { + eosio::permission_level permission = {}; + uint16_t weight = {}; +}; + +EOSIO_REFLECT(tester_permission_level_weight, permission, weight); + +// TODO: move +struct tester_wait_weight { + uint32_t wait_sec = {}; + uint16_t weight = {}; +}; + +EOSIO_REFLECT(tester_wait_weight, wait_sec, weight); + +// TODO: move +struct tester_authority { + uint32_t threshold = {}; + std::vector keys = {}; + std::vector accounts = {}; + std::vector waits = {}; +}; + +EOSIO_REFLECT(tester_authority, threshold, keys, accounts, waits); + +} + +/** + * Validates the status of a transaction. If expected_except is nullptr, then the + * transaction should succeed. Otherwise it represents a string which should be + * part of the error message. + */ +void eosio::expect(const transaction_trace& tt, const char* expected_except) { + if (expected_except) { + if (tt.status == transaction_status::executed) + eosio::check(false, "transaction succeeded, but was expected to fail with: " + std::string(expected_except)); + if (!tt.except) + eosio::check(false, "transaction has no failure message. expected: " + std::string(expected_except)); + if (tt.except->find(expected_except) == std::string::npos) + eosio::check(false, "transaction failed with <<<" + *tt.except + ">>>, but was expected to fail with: <<<" + + expected_except + ">>>"); + } else { + if (tt.status == transaction_status::executed) + return; + if (tt.except) + eosio::print(*tt.except, "\n"); + eosio::check(false, "transaction has status " + to_string(tt.status)); + } +} + +std::ostream& eosio::operator<<(std::ostream& os, const block_timestamp& obj) { + return os << obj.slot; +} + +std::ostream& eosio::operator<<(std::ostream& os, const name& obj) { + return os << obj.to_string(); +} + +eosio::test_chain::test_chain() : id{ ::create_chain() } {} +eosio::test_chain::~test_chain() { ::destroy_chain(id); } + +void eosio::test_chain::start_block(int64_t skip_miliseconds) { + head_block_info.reset(); + if (skip_miliseconds >= 500) { + // Guarantee that there is a recent block for fill_tapos to use. + ::start_block(id, skip_miliseconds - 500); + ::start_block(id, 0); + } else { + ::start_block(id, skip_miliseconds); + } +} + +void eosio::test_chain::finish_block() { + head_block_info.reset(); + ::finish_block(id); +} + +const eosio::block_info& eosio::test_chain::get_head_block_info() { + if (!head_block_info) { + std::vector bin; + ::get_head_block_info(id, [&](size_t size) { + bin.resize(size); + return bin.data(); + }); + head_block_info = check(convert_from_bin(bin)).value(); + } + return *head_block_info; +} + +void eosio::test_chain::fill_tapos(transaction& t, uint32_t expire_sec) { + auto& info = get_head_block_info(); + t.expiration = time_point_sec(info.timestamp) + expire_sec; + t.ref_block_num = info.block_num; + memcpy(&t.ref_block_prefix, info.block_id.extract_as_byte_array().data() + 8, sizeof(t.ref_block_prefix)); +} + +eosio::transaction eosio::test_chain::make_transaction() { + transaction t{ time_point_sec{} }; + fill_tapos(t); + return t; +} + +eosio::transaction eosio::test_chain::make_transaction(std::vector&& actions) { + transaction t{ time_point_sec{} }; + fill_tapos(t); + t.actions = std::move(actions); + return t; +} + +[[nodiscard]] +eosio::transaction_trace eosio::test_chain::push_transaction(const transaction& trx, const std::vector& keys, + const std::vector>& context_free_data, + const std::vector& signatures) { + + std::vector packed_trx = pack(trx); + std::vector args; + check_discard(convert_to_bin(packed_trx, args)); + check_discard(convert_to_bin(context_free_data, args)); + check_discard(convert_to_bin(signatures, args)); + check_discard(convert_to_bin(keys, args)); + std::vector bin; + ::push_transaction(id, args.data(), args.data() + args.size(), [&](size_t size) { + bin.resize(size); + return bin.data(); + }); + return check(convert_from_bin(bin)).value(); +} + +[[nodiscard]] +eosio::transaction_trace eosio::test_chain::push_transaction(const transaction& trx) { + return push_transaction(trx, { default_priv_key }); +} + +eosio::transaction_trace eosio::test_chain::transact(std::vector&& actions, const std::vector& keys, + const char* expected_except) { + auto trace = push_transaction(make_transaction(std::move(actions)), keys); + expect(trace, expected_except); + return trace; +} + +eosio::transaction_trace eosio::test_chain::transact(std::vector&& actions, const char* expected_except) { + return transact(std::move(actions), { default_priv_key }, expected_except); +} + +[[nodiscard]] +std::optional eosio::test_chain::exec_deferred() { + std::vector bin; + if (!::exec_deferred(id, [&](size_t size) { + bin.resize(size); + return bin.data(); + })) + return {}; + return check(convert_from_bin(bin)).value(); +} + +eosio::transaction_trace eosio::test_chain::create_account(name ac, const public_key& pub_key, + const char* expected_except) { + tester_authority simple_auth{ + .threshold = 1, + .keys = { { pub_key, 1 } }, + }; + return transact({ action{ { { "eosio"_n, "active"_n } }, + "eosio"_n, + "newaccount"_n, + std::make_tuple("eosio"_n, ac, simple_auth, simple_auth) } }, + expected_except); +} + +eosio::transaction_trace eosio::test_chain::create_account(name ac, const char* expected_except) { + return create_account(ac, default_pub_key, expected_except); +} + +eosio::transaction_trace eosio::test_chain::create_code_account(name account, const public_key& pub_key, bool is_priv, + const char* expected_except) { + tester_authority simple_auth{ + .threshold = 1, + .keys = { { pub_key, 1 } }, + }; + tester_authority code_auth{ + .threshold = 1, + .keys = { { pub_key, 1 } }, + .accounts = { { { account, "eosio.code"_n }, 1 } }, + }; + return transact( + { + action{ { { "eosio"_n, "active"_n } }, + "eosio"_n, + "newaccount"_n, + std::make_tuple("eosio"_n, account, simple_auth, code_auth) }, + action{ { { "eosio"_n, "active"_n } }, "eosio"_n, "setpriv"_n, std::make_tuple(account, is_priv) }, + }, + expected_except); +} + +eosio::transaction_trace eosio::test_chain::create_code_account(name ac, const public_key& pub_key, const char* expected_except) { + return create_code_account(ac, pub_key, false, expected_except); +} + +eosio::transaction_trace eosio::test_chain::create_code_account(name ac, bool is_priv, + const char* expected_except) { + return create_code_account(ac, default_pub_key, is_priv, expected_except); +} + +eosio::transaction_trace eosio::test_chain::create_code_account(name ac, const char* expected_except) { + return create_code_account(ac, default_pub_key, false, expected_except); +} + +eosio::transaction_trace eosio::test_chain::set_code(name ac, const char* filename, const char* expected_except) { + return transact({ action{ { { ac, "active"_n } }, + "eosio"_n, + "setcode"_n, + std::make_tuple(ac, uint8_t{ 0 }, uint8_t{ 0 }, read_whole_file(filename)) } }, + expected_except); +} + +eosio::transaction_trace eosio::test_chain::create_token(name contract, name signer, name issuer, asset maxsupply, + const char* expected_except) { + return transact( + { action{ { { signer, "active"_n } }, contract, "create"_n, std::make_tuple(issuer, maxsupply) } }, + expected_except); +} + +eosio::transaction_trace eosio::test_chain::issue(const name& contract, const name& issuer, const asset& amount, + const char* expected_except) { + return transact({ action{ { { issuer, "active"_n } }, + contract, + "issue"_n, + std::make_tuple(issuer, amount, std::string{ "issuing" }) } }, + expected_except); +} + +eosio::transaction_trace eosio::test_chain::transfer(const name& contract, const name& from, const name& to, const asset& amount, + const std::string& memo, const char* expected_except) { + + return transact( + { action{ { { from, "active"_n } }, contract, "transfer"_n, std::make_tuple(from, to, amount, memo) } }, + expected_except); + } + +eosio::transaction_trace eosio::test_chain::issue_and_transfer(const name& contract, const name& issuer, const name& to, + const asset& amount, const std::string& memo, + const char* expected_except) { + return transact( + { + action{ { { issuer, "active"_n } }, + contract, + "issue"_n, + std::make_tuple(issuer, amount, std::string{ "issuing" }) }, + action{ + { { issuer, "active"_n } }, contract, "transfer"_n, std::make_tuple(issuer, to, amount, memo) }, + }, + expected_except); +} + +std::ostream& chain_types::operator<<(std::ostream& os, transaction_status t) { + return os << to_string(t); +} + +std::ostream& chain_types::operator<<(std::ostream& os, const account_auth_sequence& aas) { + return os << eosio::check(eosio::convert_to_json(aas)).value(); +} + +std::ostream& chain_types::operator<<(std::ostream& os, const account_delta& ad) { + return os << eosio::check(eosio::convert_to_json(ad)).value(); +} From 95422f2d9a25e1458f0f08343b42442afb7d2964 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 14 Feb 2020 14:58:48 -0500 Subject: [PATCH 41/50] Move keys to the source. --- libraries/eosiolib/tester/eosio/tester.hpp | 21 +++++++++++---------- libraries/eosiolib/tester/tester.cpp | 14 +++----------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index af8e0ce2e7..5e96acff4b 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -141,8 +141,8 @@ class test_chain { std::optional head_block_info; public: - public_key default_pub_key = public_key_from_string("EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV").value(); - private_key default_priv_key = private_key_from_string("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3").value(); + static const public_key default_pub_key; + static const private_key default_priv_key; test_chain(); test_chain(const test_chain&) = delete; @@ -166,22 +166,25 @@ class test_chain { const block_info& get_head_block_info(); + /* + * Set the reference block of the transaction to the head block. + */ void fill_tapos(transaction& t, uint32_t expire_sec = 1); - transaction make_transaction(); - transaction make_transaction(std::vector&& actions); + /* + * Creates a transaction. + */ + transaction make_transaction(std::vector&& actions = {}); /** * Pushes a transaction onto the chain. If no block is currently pending, starts one. */ [[nodiscard]] - transaction_trace push_transaction(const transaction& trx, const std::vector& keys, + transaction_trace push_transaction(const transaction& trx, + const std::vector& keys = { default_priv_key }, const std::vector>& context_free_data = {}, const std::vector& signatures = {}); - [[nodiscard]] - transaction_trace push_transaction(const transaction& trx); - /** * Pushes a transaction onto the chain. If no block is currently pending, starts one. * @@ -189,7 +192,6 @@ class test_chain { */ transaction_trace transact(std::vector&& actions, const std::vector& keys, const char* expected_except = nullptr); - transaction_trace transact(std::vector&& actions, const char* expected_except = nullptr); /** @@ -204,7 +206,6 @@ class test_chain { transaction_trace create_account(name ac, const public_key& pub_key, const char* expected_except = nullptr); - transaction_trace create_account(name ac, const char* expected_except = nullptr); /** diff --git a/libraries/eosiolib/tester/tester.cpp b/libraries/eosiolib/tester/tester.cpp index bfedf7545c..cacea32bc7 100644 --- a/libraries/eosiolib/tester/tester.cpp +++ b/libraries/eosiolib/tester/tester.cpp @@ -176,6 +176,9 @@ std::ostream& eosio::operator<<(std::ostream& os, const name& obj) { return os << obj.to_string(); } +const eosio::public_key eosio::test_chain::default_pub_key = public_key_from_string("EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV").value(); +const eosio::private_key eosio::test_chain::default_priv_key = private_key_from_string("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3").value(); + eosio::test_chain::test_chain() : id{ ::create_chain() } {} eosio::test_chain::~test_chain() { ::destroy_chain(id); } @@ -214,12 +217,6 @@ void eosio::test_chain::fill_tapos(transaction& t, uint32_t expire_sec) { memcpy(&t.ref_block_prefix, info.block_id.extract_as_byte_array().data() + 8, sizeof(t.ref_block_prefix)); } -eosio::transaction eosio::test_chain::make_transaction() { - transaction t{ time_point_sec{} }; - fill_tapos(t); - return t; -} - eosio::transaction eosio::test_chain::make_transaction(std::vector&& actions) { transaction t{ time_point_sec{} }; fill_tapos(t); @@ -246,11 +243,6 @@ eosio::transaction_trace eosio::test_chain::push_transaction(const transaction& return check(convert_from_bin(bin)).value(); } -[[nodiscard]] -eosio::transaction_trace eosio::test_chain::push_transaction(const transaction& trx) { - return push_transaction(trx, { default_priv_key }); -} - eosio::transaction_trace eosio::test_chain::transact(std::vector&& actions, const std::vector& keys, const char* expected_except) { auto trace = push_transaction(make_transaction(std::move(actions)), keys); From 44a51166d42b0fa250acad268eb4d3aaf3b138c0 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 14 Feb 2020 15:56:37 -0500 Subject: [PATCH 42/50] Support action::send in the tester --- libraries/eosiolib/tester/tester.cpp | 16 ++++++++++++++-- tests/tester/tester.cpp | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/libraries/eosiolib/tester/tester.cpp b/libraries/eosiolib/tester/tester.cpp index cacea32bc7..b9fa536f69 100644 --- a/libraries/eosiolib/tester/tester.cpp +++ b/libraries/eosiolib/tester/tester.cpp @@ -179,8 +179,13 @@ std::ostream& eosio::operator<<(std::ostream& os, const name& obj) { const eosio::public_key eosio::test_chain::default_pub_key = public_key_from_string("EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV").value(); const eosio::private_key eosio::test_chain::default_priv_key = private_key_from_string("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3").value(); -eosio::test_chain::test_chain() : id{ ::create_chain() } {} -eosio::test_chain::~test_chain() { ::destroy_chain(id); } +// We only allow one chain to exist at a time in the tester. +// If we ever find that we need multiple chains, this will +// need to be kept in sync with whatever updates the native layer. +static eosio::test_chain* current_chain = nullptr; + +eosio::test_chain::test_chain() : id{ ::create_chain() } { current_chain = this; } +eosio::test_chain::~test_chain() { current_chain = nullptr; ::destroy_chain(id); } void eosio::test_chain::start_block(int64_t skip_miliseconds) { head_block_info.reset(); @@ -375,3 +380,10 @@ std::ostream& chain_types::operator<<(std::ostream& os, const account_auth_seque std::ostream& chain_types::operator<<(std::ostream& os, const account_delta& ad) { return os << eosio::check(eosio::convert_to_json(ad)).value(); } + +extern "C" { + void send_inline(char *serialized_action, size_t size) { + eosio::check(current_chain != nullptr, "Cannot send an action without a blockchain"); + current_chain->transact({ eosio::unpack(serialized_action, size) }); + } +} diff --git a/tests/tester/tester.cpp b/tests/tester/tester.cpp index d41789cc8f..589e3ba116 100644 --- a/tests/tester/tester.cpp +++ b/tests/tester/tester.cpp @@ -112,3 +112,8 @@ BOOST_FIXTURE_TEST_CASE(transaction_trace, eosio::test_chain) { BOOST_TEST(!trace.error_code); BOOST_TEST(trace.failed_dtrx_trace.size() == 0); } + +BOOST_FIXTURE_TEST_CASE(send, eosio::test_chain) { + eosio::action empty{ { { "eosio"_n, "active"_n } }, "eosio"_n, eosio::name(), std::tuple() }; + empty.send(); +} From 8314a0dcf9216194388bd78af0131a2df738b673 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 14 Feb 2020 16:24:04 -0500 Subject: [PATCH 43/50] Detemplatify a couple functions and move them to tester.cpp --- libraries/eosiolib/tester/eosio/tester.hpp | 41 +++------------------- libraries/eosiolib/tester/tester.cpp | 28 ++++++++++++++- 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/libraries/eosiolib/tester/eosio/tester.hpp b/libraries/eosiolib/tester/eosio/tester.hpp index 5e96acff4b..71d1a09d18 100644 --- a/libraries/eosiolib/tester/eosio/tester.hpp +++ b/libraries/eosiolib/tester/eosio/tester.hpp @@ -13,22 +13,11 @@ #include -#define TESTER_INTRINSIC extern "C" __attribute__((eosio_wasm_import)) - namespace eosio { namespace internal_use_do_not_use { - TESTER_INTRINSIC void query_database_chain(uint32_t chain, void* req_begin, void* req_end, void* cb_alloc_data, - void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - - template - inline void query_database_chain(uint32_t chain, const T& req, Alloc_fn alloc_fn) { - auto req_data = pack(req); - query_database_chain(chain, req_data.data(), req_data.data() + req_data.size(), &alloc_fn, - [](void* cb_alloc_data, size_t size) -> void* { - return (*reinterpret_cast(cb_alloc_data))(size); - }); - } + std::vector query_database_chain(uint32_t chain, const std::vector& packed_req); + void hex(const uint8_t* begin, const uint8_t* end, std::ostream& os); } // namespace internal_use_do_not_use @@ -105,25 +94,10 @@ using chain_types::block_info; */ void expect(const transaction_trace& tt, const char* expected_except = nullptr); -template -void hex(SrcIt begin, SrcIt end, DestIt dest) { - auto nibble = [&dest](uint8_t i) { - if (i <= 9) - *dest++ = '0' + i; - else - *dest++ = 'A' + i - 10; - }; - while (begin != end) { - nibble(((uint8_t)*begin) >> 4); - nibble(((uint8_t)*begin) & 0xf); - ++begin; - } -} - template std::ostream& operator<<(std::ostream& os, const fixed_bytes& d) { auto arr = d.extract_as_byte_array(); - hex(arr.begin(), arr.end(), std::ostreambuf_iterator(os.rdbuf())); + internal_use_do_not_use::hex(arr.begin(), arr.end(), os); return os; } @@ -246,13 +220,8 @@ class test_chain { const char* expected_except = nullptr); template - inline std::vector query_database(const T& request) { - std::vector result; - internal_use_do_not_use::query_database_chain(id, request, [&result](size_t size) { - result.resize(size); - return result.data(); - }); - return result; + std::vector query_database(const T& request) { + return internal_use_do_not_use::query_database_chain(id, pack(request)); } }; diff --git a/libraries/eosiolib/tester/tester.cpp b/libraries/eosiolib/tester/tester.cpp index b9fa536f69..a739b98dc4 100644 --- a/libraries/eosiolib/tester/tester.cpp +++ b/libraries/eosiolib/tester/tester.cpp @@ -26,7 +26,7 @@ namespace { void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); TESTER_INTRINSIC bool exec_deferred(uint32_t chain, void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); - TESTER_INTRINSIC void query_database_chain(uint32_t chain, void* req_begin, void* req_end, void* cb_alloc_data, + TESTER_INTRINSIC void query_database_chain(uint32_t chain, const void* req_begin, const void* req_end, void* cb_alloc_data, void* (*cb_alloc)(void* cb_alloc_data, size_t size)); TESTER_INTRINSIC void select_chain_for_db(uint32_t chain_index); @@ -87,6 +87,17 @@ namespace { } // namespace +std::vector eosio::internal_use_do_not_use::query_database_chain(uint32_t chain, const std::vector& req_data) { + std::vector result; + ::query_database_chain(chain, req_data.data(), req_data.data() + req_data.size(), &result, + [](void* cb_alloc_data, size_t size) -> void* { + auto& result = *static_cast*>(cb_alloc_data); + result.resize(size); + return result.data(); + }); + return result; +} + const std::vector& eosio::get_args() { static std::optional> args; if (!args) { @@ -168,6 +179,21 @@ void eosio::expect(const transaction_trace& tt, const char* expected_except) { } } +void eosio::internal_use_do_not_use::hex(const uint8_t* begin, const uint8_t* end, std::ostream& os) { + std::ostreambuf_iterator dest(os.rdbuf()); + auto nibble = [&dest](uint8_t i) { + if (i <= 9) + *dest++ = '0' + i; + else + *dest++ = 'A' + i - 10; + }; + while (begin != end) { + nibble(((uint8_t)*begin) >> 4); + nibble(((uint8_t)*begin) & 0xf); + ++begin; + } +} + std::ostream& eosio::operator<<(std::ostream& os, const block_timestamp& obj) { return os << obj.slot; } From 050f6e2393b5b70d5084cdf956c647c344aee272 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Tue, 18 Feb 2020 10:16:30 -0500 Subject: [PATCH 44/50] Allow existing user-defined operator<< and >> for datastream to be found and used by to_bin and from_bin. --- libraries/eosiolib/core/eosio/datastream.hpp | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/libraries/eosiolib/core/eosio/datastream.hpp b/libraries/eosiolib/core/eosio/datastream.hpp index 1f90ddb1e2..809c30cd01 100644 --- a/libraries/eosiolib/core/eosio/datastream.hpp +++ b/libraries/eosiolib/core/eosio/datastream.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -303,6 +304,24 @@ namespace _datastream_detail { struct is_datastream { static constexpr bool value = false; }; template struct is_datastream> { static constexpr bool value = true; }; + + namespace operator_detection { + // These overloads will be ambiguous with the operator in eosio, unless + // the user has provided an operator that is a better match. + template::value>* = nullptr> + DataStream& operator>>( DataStream& ds, T& v ); + template::value>* = nullptr> + DataStream& operator<<( DataStream& ds, const T& v ); + template + using require_specialized_right_shift = std::void_t() >> std::declval())>; + template + using require_specialized_left_shift = std::void_t() << std::declval())>; + } + // Going through enable_if/is_detected is necessary for reasons that I don't entirely understand. + template + using require_specialized_right_shift = std::enable_if_t>; + template + using require_specialized_left_shift = std::enable_if_t>; } /** @@ -321,6 +340,13 @@ DataStream& operator<<( DataStream& ds, const T& v ) { return ds; } +// Backwards compatibility: allow user defined datastream operators to work with from_bin +template,T>* = nullptr> +result to_bin( const T& v, datastream& ds ) { + ds << v; + return outcome::success(); +} + /** * Deserialize a class * @@ -337,6 +363,12 @@ DataStream& operator>>( DataStream& ds, T& v ) { return ds; } +template,T>* = nullptr> +result from_bin( T& v, datastream& ds ) { + ds >> v; + return outcome::success(); +} + /** * Unpack data inside a fixed size buffer as T * From 6ef7046f3f6a03f6af9cb936b014091b6083c534 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Wed, 19 Feb 2020 13:35:30 -0500 Subject: [PATCH 45/50] Add basic tests for test_chain::query_database --- libraries/abieos | 2 +- tests/CMakeLists.txt | 7 +++++++ tests/tester/tester.cpp | 15 +++++++++++++++ tests/unit/test_contracts/CMakeLists.txt | 1 + tests/unit/test_contracts/tester_tests.cpp | 16 ++++++++++++++++ tests/unit/test_contracts/tester_tests.hpp | 19 +++++++++++++++++++ 6 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/unit/test_contracts/tester_tests.cpp create mode 100644 tests/unit/test_contracts/tester_tests.hpp diff --git a/libraries/abieos b/libraries/abieos index e095303975..e5dd28891e 160000 --- a/libraries/abieos +++ b/libraries/abieos @@ -1 +1 @@ -Subproject commit e095303975651ad4f8730b51837ed617a44c8c35 +Subproject commit e5dd28891eebaf54b2d5af7f526c21bde99be8ca diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b95f14815d..2127807ca6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -47,6 +47,13 @@ if (EOSIO_RUN_INTEGRATION_TESTS) set_property(TEST integration_tests PROPERTY LABELS integration_tests) endif() +add_test( + NAME tester_tests + COMMAND ${CMAKE_BINARY_DIR}/bin/eosio-tester ${CMAKE_BINARY_DIR}/tests/tester/tester.wasm + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tests/tester + ) +set_property(TEST tester_tests PROPERTY LABELS tester_tests) + ExternalProject_Add( TesterTests SOURCE_DIR "${CMAKE_SOURCE_DIR}/tests/tester" diff --git a/tests/tester/tester.cpp b/tests/tester/tester.cpp index 589e3ba116..8057d3b50d 100644 --- a/tests/tester/tester.cpp +++ b/tests/tester/tester.cpp @@ -1,5 +1,6 @@ #include #include +#include "../unit/test_contracts/tester_tests.hpp" #define BOOST_TEST_MAIN #include @@ -117,3 +118,17 @@ BOOST_FIXTURE_TEST_CASE(send, eosio::test_chain) { eosio::action empty{ { { "eosio"_n, "active"_n } }, "eosio"_n, eosio::name(), std::tuple() }; empty.send(); } + +BOOST_FIXTURE_TEST_CASE(query, eosio::test_chain) { + create_account("test"_n); + set_code("test"_n, "../unit/test_contracts/tester_tests.wasm"); + tester_tests::putdb_action("test"_n, { "test"_n, "active"_n }).send(1, 2); + eosio::query_contract_row_range_code_table_scope_pk query; + query.first = query.last = { "test"_n, "table"_n, eosio::name(), 0 }; + query.last.primary_key = std::uint64_t(-1); + eosio::for_each_contract_row(query_database(query), [](const eosio::contract_row&, auto* item) { + BOOST_TEST(item->key == 1); + BOOST_TEST(item->value == 2); + return true; + }); +} diff --git a/tests/unit/test_contracts/CMakeLists.txt b/tests/unit/test_contracts/CMakeLists.txt index d5582ac3d0..a85e876bd6 100644 --- a/tests/unit/test_contracts/CMakeLists.txt +++ b/tests/unit/test_contracts/CMakeLists.txt @@ -3,6 +3,7 @@ add_contract(malloc_tests old_malloc_tests malloc_tests.cpp) add_contract(simple_tests simple_tests simple_tests.cpp) add_contract(transfer_contract transfer_contract transfer.cpp) add_contract(minimal_tests minimal_tests minimal_tests.cpp) +add_contract(tester_tests tester_tests tester_tests.cpp) add_contract(capi_tests capi_tests capi/capi.c capi/action.c capi/chain.c capi/crypto.c capi/db.c capi/permission.c capi/print.c capi/privileged.c capi/system.c capi/transaction.c) diff --git a/tests/unit/test_contracts/tester_tests.cpp b/tests/unit/test_contracts/tester_tests.cpp new file mode 100644 index 0000000000..7890cc55db --- /dev/null +++ b/tests/unit/test_contracts/tester_tests.cpp @@ -0,0 +1,16 @@ +#include "tester_tests.hpp" + +using namespace eosio; + +[[eosio::action]] void tester_tests::putdb(int key, int value) { + table t(get_self(), 0); + auto inserter = [=](table_item& item) { + item.key = key; + item.value = value; + }; + if(auto iter = t.find(key); iter == t.end()) { + t.emplace(get_self(), inserter); + } else { + t.modify(iter, get_self(), inserter); + } +} diff --git a/tests/unit/test_contracts/tester_tests.hpp b/tests/unit/test_contracts/tester_tests.hpp new file mode 100644 index 0000000000..fa1d0c1a7c --- /dev/null +++ b/tests/unit/test_contracts/tester_tests.hpp @@ -0,0 +1,19 @@ +#include +#include +#include +#include +#include + +class [[eosio::contract("tester_tests")]] tester_tests : eosio::contract { +public: + using contract::contract; + [[eosio::action]] void putdb(int key, int value); + using putdb_action = eosio::action_wrapper<"putdb"_n, &tester_tests::putdb>; + struct [[eosio::table]] table_item { + int key; + int value; + std::uint64_t primary_key() const { return key; } + std::uint64_t secondary() const { return value; } + }; + using table = eosio::multi_index<"table"_n, table_item, eosio::indexed_by<"value"_n, eosio::const_mem_fun>>; +}; From 1bc4dfbfb2c0013a0aa927e7c5120e3556698896 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 21 Feb 2020 14:11:03 -0500 Subject: [PATCH 46/50] Basic multi_index test --- tests/tester/tester.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/tester/tester.cpp b/tests/tester/tester.cpp index 8057d3b50d..7a70304d04 100644 --- a/tests/tester/tester.cpp +++ b/tests/tester/tester.cpp @@ -119,6 +119,17 @@ BOOST_FIXTURE_TEST_CASE(send, eosio::test_chain) { empty.send(); } +BOOST_FIXTURE_TEST_CASE(multi_index_tests, eosio::test_chain) { + create_account("test"_n); + set_code("test"_n, "../unit/test_contracts/tester_tests.wasm"); + tester_tests::putdb_action("test"_n, { "test"_n, "active"_n }).send(1, 2); + tester_tests::table t("test"_n, 0); + for(auto& item : t) { + BOOST_TEST(item.key == 1); + BOOST_TEST(item.value == 2); + } +} + BOOST_FIXTURE_TEST_CASE(query, eosio::test_chain) { create_account("test"_n); set_code("test"_n, "../unit/test_contracts/tester_tests.wasm"); From 83f83199abeb80e3ef4eb4388daa1eb39bf7f95e Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 21 Feb 2020 14:40:43 -0500 Subject: [PATCH 47/50] Sync with eosio develop --- libraries/eos | 2 +- tools/tester/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/eos b/libraries/eos index f821e6f978..5693fc9666 160000 --- a/libraries/eos +++ b/libraries/eos @@ -1 +1 @@ -Subproject commit f821e6f97870dae20f0e556d9ffbff3766598121 +Subproject commit 5693fc9666846d9abba7a5291ca9d656f844d442 diff --git a/tools/tester/CMakeLists.txt b/tools/tester/CMakeLists.txt index 872049589b..4b849fb015 100644 --- a/tools/tester/CMakeLists.txt +++ b/tools/tester/CMakeLists.txt @@ -88,7 +88,7 @@ target_include_directories(eosio-tester ${ROCKSDB_INCLUDE_DIR} ) target_link_libraries(eosio-tester - eosio_chain wabt Runtime Platform Logging IR fc eos-vm + eosio_chain wabt Runtime Logging IR fc eos-vm Boost::date_time Boost::filesystem Boost::chrono Boost::system Boost::iostreams Boost::program_options -lpthread) From 5ca2910fc7dc1c11d6af1ee6293bf9439bde13cc Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 21 Feb 2020 16:31:53 -0500 Subject: [PATCH 48/50] Fix problems from merge. --- libraries/abieos | 2 +- libraries/eosiolib/core/eosio/varint.hpp | 7 ++++++ libraries/libc/musl | 2 +- tests/integration/action_results_test.cpp | 28 +++++++---------------- 4 files changed, 17 insertions(+), 22 deletions(-) create mode 100644 libraries/eosiolib/core/eosio/varint.hpp diff --git a/libraries/abieos b/libraries/abieos index e5dd28891e..fd0d1b9cd1 160000 --- a/libraries/abieos +++ b/libraries/abieos @@ -1 +1 @@ -Subproject commit e5dd28891eebaf54b2d5af7f526c21bde99be8ca +Subproject commit fd0d1b9cd1174b5dad0c4e4d818e4198af91e1de diff --git a/libraries/eosiolib/core/eosio/varint.hpp b/libraries/eosiolib/core/eosio/varint.hpp new file mode 100644 index 0000000000..ed7ddb0afb --- /dev/null +++ b/libraries/eosiolib/core/eosio/varint.hpp @@ -0,0 +1,7 @@ +/** + * @file + * @copyright defined in eos/LICENSE + */ +#pragma once + +#include_next diff --git a/libraries/libc/musl b/libraries/libc/musl index 054f5e11a9..6e5d8d10ca 160000 --- a/libraries/libc/musl +++ b/libraries/libc/musl @@ -1 +1 @@ -Subproject commit 054f5e11a9b6a4e90a7cb295e7e67f1a30479e90 +Subproject commit 6e5d8d10ca0854e935f676ee61d593d510949e9a diff --git a/tests/integration/action_results_test.cpp b/tests/integration/action_results_test.cpp index 3b9023bcb9..5593fb9456 100644 --- a/tests/integration/action_results_test.cpp +++ b/tests/integration/action_results_test.cpp @@ -1,30 +1,18 @@ -#include -#include -#include - -#include - -#include +#include +#include #include using namespace eosio; -using namespace eosio::testing; -using namespace eosio::chain; -using namespace eosio::testing; -using namespace fc; - -using mvo = fc::mutable_variant_object; BOOST_AUTO_TEST_SUITE(action_results_tests_suite) -BOOST_FIXTURE_TEST_CASE( action_results_tests, tester ) try { - create_accounts( { N(test) } ); - produce_block(); +BOOST_FIXTURE_TEST_CASE( action_results_tests, test_chain ) { + create_account( "test"_n ); + finish_block(); set_code( N(test), contracts::action_results_test_wasm() ); - set_abi( N(test), contracts::action_results_test_abi().data() ); - +#if 0 produce_blocks(); auto trace = push_action(N(test), N(action1), N(test), mvo()); // need to fix this test after Kevin fixes action_return @@ -35,7 +23,7 @@ BOOST_FIXTURE_TEST_CASE( action_results_tests, tester ) try { trace = push_action(N(test), N(action3), N(test), mvo()); wdump((trace)); - -} FC_LOG_AND_RETHROW() +#endif +} BOOST_AUTO_TEST_SUITE_END() From 7669ebecc1f17b3ddebf41eca9f573d6f14dabe6 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 27 Feb 2020 13:46:24 -0500 Subject: [PATCH 49/50] Remove Boost.Test. --- .../include/boost/algorithm/cxx11/all_of.hpp | 83 - .../boost/include/boost/aligned_storage.hpp | 18 - libraries/boost/include/boost/bind.hpp | 41 - libraries/boost/include/boost/bind/arg.hpp | 69 - libraries/boost/include/boost/bind/bind.hpp | 2365 ----------------- .../boost/include/boost/bind/bind_cc.hpp | 117 - .../boost/include/boost/bind/bind_mf2_cc.hpp | 228 -- .../boost/include/boost/bind/bind_mf_cc.hpp | 441 --- .../include/boost/bind/bind_template.hpp | 345 --- libraries/boost/include/boost/bind/mem_fn.hpp | 389 --- .../boost/include/boost/bind/mem_fn_cc.hpp | 103 - .../include/boost/bind/mem_fn_template.hpp | 1047 -------- .../boost/include/boost/bind/mem_fn_vw.hpp | 130 - .../boost/include/boost/bind/placeholders.hpp | 62 - .../boost/include/boost/bind/storage.hpp | 475 ---- libraries/boost/include/boost/call_traits.hpp | 20 - .../boost/include/boost/checked_delete.hpp | 17 - libraries/boost/include/boost/config/user.hpp | 3 - libraries/boost/include/boost/cstdlib.hpp | 41 - .../boost/include/boost/current_function.hpp | 75 - .../exception/current_exception_cast.hpp | 43 - .../exception/detail/error_info_impl.hpp | 102 - .../boost/exception/detail/shared_ptr.hpp | 17 - .../boost/exception/detail/type_info.hpp | 82 - .../include/boost/exception/exception.hpp | 521 ---- .../boost/exception/get_error_info.hpp | 133 - .../boost/function/detail/maybe_include.hpp | 369 --- .../boost/function/detail/prologue.hpp | 26 - .../include/boost/function/function0.hpp | 12 - .../include/boost/function/function1.hpp | 12 - .../include/boost/function/function2.hpp | 12 - .../include/boost/function/function_base.hpp | 886 ------ .../include/boost/function/function_fwd.hpp | 69 - .../boost/function/function_template.hpp | 1187 --------- .../boost/include/boost/function_equal.hpp | 28 - libraries/boost/include/boost/get_pointer.hpp | 76 - libraries/boost/include/boost/integer.hpp | 262 -- .../include/boost/integer/static_log2.hpp | 127 - libraries/boost/include/boost/integer_fwd.hpp | 190 -- .../boost/include/boost/integer_traits.hpp | 256 -- .../boost/include/boost/io/ios_state.hpp | 439 --- libraries/boost/include/boost/io_fwd.hpp | 67 - .../boost/include/boost/is_placeholder.hpp | 31 - .../boost/iterator/detail/config_def.hpp | 128 - .../boost/iterator/detail/config_undef.hpp | 24 - .../boost/iterator/detail/enable_if.hpp | 83 - .../detail/facade_iterator_category.hpp | 193 -- .../include/boost/iterator/interoperable.hpp | 54 - .../boost/iterator/iterator_categories.hpp | 216 -- .../boost/iterator/iterator_facade.hpp | 981 ------- .../boost/iterator/iterator_traits.hpp | 61 - libraries/boost/include/boost/limits.hpp | 146 - libraries/boost/include/boost/make_shared.hpp | 16 - libraries/boost/include/boost/mem_fn.hpp | 24 - libraries/boost/include/boost/noncopyable.hpp | 17 - libraries/boost/include/boost/none.hpp | 59 - libraries/boost/include/boost/none_t.hpp | 39 - .../numeric/conversion/conversion_traits.hpp | 32 - .../conversion/detail/conversion_traits.hpp | 97 - .../conversion/detail/int_float_mixture.hpp | 72 - .../conversion/detail/is_subranged.hpp | 234 -- .../boost/numeric/conversion/detail/meta.hpp | 120 - .../conversion/detail/sign_mixture.hpp | 72 - .../conversion/detail/udt_builtin_mixture.hpp | 69 - .../conversion/int_float_mixture_enum.hpp | 29 - .../numeric/conversion/sign_mixture_enum.hpp | 29 - .../conversion/udt_builtin_mixture_enum.hpp | 26 - libraries/boost/include/boost/optional.hpp | 18 - .../boost/optional/bad_optional_access.hpp | 32 - .../detail/old_optional_implementation.hpp | 1059 -------- .../detail/optional_aligned_storage.hpp | 71 - .../boost/optional/detail/optional_config.hpp | 135 - .../detail/optional_factory_support.hpp | 36 - .../detail/optional_reference_spec.hpp | 253 -- .../boost/optional/detail/optional_relops.hpp | 196 -- .../boost/optional/detail/optional_swap.hpp | 117 - .../optional_trivially_copyable_base.hpp | 499 ---- .../boost/include/boost/optional/optional.hpp | 1490 ----------- .../include/boost/optional/optional_fwd.hpp | 41 - libraries/boost/include/boost/predef.h | 24 - .../boost/include/boost/predef/architecture.h | 32 - .../include/boost/predef/architecture/alpha.h | 59 - .../include/boost/predef/architecture/arm.h | 75 - .../boost/predef/architecture/blackfin.h | 46 - .../boost/predef/architecture/convex.h | 65 - .../include/boost/predef/architecture/ia64.h | 49 - .../include/boost/predef/architecture/m68k.h | 82 - .../include/boost/predef/architecture/mips.h | 73 - .../boost/predef/architecture/parisc.h | 64 - .../include/boost/predef/architecture/ppc.h | 72 - .../boost/predef/architecture/pyramid.h | 42 - .../include/boost/predef/architecture/rs6k.h | 56 - .../include/boost/predef/architecture/sparc.h | 54 - .../boost/predef/architecture/superh.h | 67 - .../boost/predef/architecture/sys370.h | 43 - .../boost/predef/architecture/sys390.h | 43 - .../include/boost/predef/architecture/x86.h | 38 - .../boost/predef/architecture/x86/32.h | 87 - .../boost/predef/architecture/x86/64.h | 50 - .../include/boost/predef/architecture/z.h | 42 - .../boost/include/boost/predef/compiler.h | 43 - .../include/boost/predef/compiler/borland.h | 63 - .../include/boost/predef/compiler/clang.h | 56 - .../include/boost/predef/compiler/comeau.h | 61 - .../include/boost/predef/compiler/compaq.h | 66 - .../include/boost/predef/compiler/diab.h | 56 - .../boost/predef/compiler/digitalmars.h | 56 - .../include/boost/predef/compiler/dignus.h | 56 - .../boost/include/boost/predef/compiler/edg.h | 56 - .../include/boost/predef/compiler/ekopath.h | 57 - .../boost/include/boost/predef/compiler/gcc.h | 68 - .../include/boost/predef/compiler/gcc_xml.h | 53 - .../boost/predef/compiler/greenhills.h | 66 - .../include/boost/predef/compiler/hp_acc.h | 61 - .../boost/include/boost/predef/compiler/iar.h | 56 - .../boost/include/boost/predef/compiler/ibm.h | 72 - .../include/boost/predef/compiler/intel.h | 79 - .../boost/include/boost/predef/compiler/kai.h | 56 - .../include/boost/predef/compiler/llvm.h | 57 - .../include/boost/predef/compiler/metaware.h | 53 - .../boost/predef/compiler/metrowerks.h | 77 - .../include/boost/predef/compiler/microtec.h | 53 - .../boost/include/boost/predef/compiler/mpw.h | 63 - .../include/boost/predef/compiler/palm.h | 56 - .../boost/include/boost/predef/compiler/pgi.h | 60 - .../boost/predef/compiler/sgi_mipspro.h | 66 - .../include/boost/predef/compiler/sunpro.h | 76 - .../include/boost/predef/compiler/tendra.h | 53 - .../include/boost/predef/compiler/visualc.h | 105 - .../include/boost/predef/compiler/watcom.h | 56 - .../include/boost/predef/detail/_cassert.h | 17 - .../include/boost/predef/detail/_exception.h | 15 - .../boost/predef/detail/comp_detected.h | 10 - .../include/boost/predef/detail/os_detected.h | 10 - .../boost/predef/detail/platform_detected.h | 10 - .../boost/include/boost/predef/detail/test.h | 17 - .../boost/include/boost/predef/hardware.h | 16 - .../include/boost/predef/hardware/simd.h | 119 - .../include/boost/predef/hardware/simd/arm.h | 59 - .../boost/predef/hardware/simd/arm/versions.h | 32 - .../include/boost/predef/hardware/simd/ppc.h | 69 - .../boost/predef/hardware/simd/ppc/versions.h | 51 - .../include/boost/predef/hardware/simd/x86.h | 123 - .../boost/predef/hardware/simd/x86/versions.h | 129 - .../boost/predef/hardware/simd/x86_amd.h | 87 - .../predef/hardware/simd/x86_amd/versions.h | 51 - .../boost/include/boost/predef/language.h | 17 - .../include/boost/predef/language/objc.h | 42 - .../include/boost/predef/language/stdc.h | 53 - .../include/boost/predef/language/stdcpp.h | 121 - .../boost/include/boost/predef/library.h | 16 - .../boost/include/boost/predef/library/c.h | 21 - .../include/boost/predef/library/c/_prefix.h | 13 - .../include/boost/predef/library/c/cloudabi.h | 53 - .../include/boost/predef/library/c/gnu.h | 61 - .../boost/include/boost/predef/library/c/uc.h | 47 - .../include/boost/predef/library/c/vms.h | 47 - .../include/boost/predef/library/c/zos.h | 56 - .../boost/include/boost/predef/library/std.h | 25 - .../boost/predef/library/std/_prefix.h | 23 - .../include/boost/predef/library/std/cxx.h | 46 - .../boost/predef/library/std/dinkumware.h | 52 - .../boost/predef/library/std/libcomo.h | 47 - .../include/boost/predef/library/std/modena.h | 45 - .../include/boost/predef/library/std/msl.h | 53 - .../boost/predef/library/std/roguewave.h | 56 - .../include/boost/predef/library/std/sgi.h | 51 - .../boost/predef/library/std/stdcpp3.h | 53 - .../boost/predef/library/std/stlport.h | 59 - .../include/boost/predef/library/std/vacpp.h | 44 - libraries/boost/include/boost/predef/make.h | 93 - libraries/boost/include/boost/predef/os.h | 33 - libraries/boost/include/boost/predef/os/aix.h | 66 - .../boost/include/boost/predef/os/amigaos.h | 46 - .../boost/include/boost/predef/os/android.h | 45 - .../boost/include/boost/predef/os/beos.h | 45 - libraries/boost/include/boost/predef/os/bsd.h | 103 - .../boost/include/boost/predef/os/bsd/bsdi.h | 48 - .../include/boost/predef/os/bsd/dragonfly.h | 50 - .../boost/include/boost/predef/os/bsd/free.h | 67 - .../boost/include/boost/predef/os/bsd/net.h | 84 - .../boost/include/boost/predef/os/bsd/open.h | 251 -- .../boost/include/boost/predef/os/cygwin.h | 45 - .../boost/include/boost/predef/os/haiku.h | 46 - .../boost/include/boost/predef/os/hpux.h | 47 - libraries/boost/include/boost/predef/os/ios.h | 51 - .../boost/include/boost/predef/os/irix.h | 46 - .../boost/include/boost/predef/os/linux.h | 46 - .../boost/include/boost/predef/os/macos.h | 65 - .../boost/include/boost/predef/os/os400.h | 45 - .../boost/include/boost/predef/os/qnxnto.h | 59 - .../boost/include/boost/predef/os/solaris.h | 46 - .../boost/include/boost/predef/os/unix.h | 76 - libraries/boost/include/boost/predef/os/vms.h | 52 - .../boost/include/boost/predef/os/windows.h | 51 - libraries/boost/include/boost/predef/other.h | 16 - .../boost/include/boost/predef/other/endian.h | 204 -- .../boost/include/boost/predef/platform.h | 28 - .../include/boost/predef/platform/cloudabi.h | 43 - .../boost/include/boost/predef/platform/ios.h | 58 - .../include/boost/predef/platform/mingw.h | 69 - .../include/boost/predef/platform/mingw32.h | 63 - .../include/boost/predef/platform/mingw64.h | 63 - .../boost/predef/platform/windows_desktop.h | 51 - .../boost/predef/platform/windows_phone.h | 48 - .../boost/predef/platform/windows_runtime.h | 53 - .../boost/predef/platform/windows_server.h | 47 - .../boost/predef/platform/windows_store.h | 50 - .../boost/predef/platform/windows_system.h | 47 - .../boost/predef/platform/windows_uwp.h | 60 - .../boost/include/boost/predef/version.h | 15 - .../include/boost/predef/version_number.h | 72 - libraries/boost/include/boost/range/begin.hpp | 135 - .../boost/include/boost/range/config.hpp | 56 - .../include/boost/range/const_iterator.hpp | 76 - .../include/boost/range/detail/begin.hpp | 83 - .../include/boost/range/detail/common.hpp | 118 - .../boost/include/boost/range/detail/end.hpp | 86 - .../range/detail/extract_optional_type.hpp | 48 - .../range/detail/implementation_help.hpp | 114 - .../detail/msvc_has_iterator_workaround.hpp | 132 - .../include/boost/range/detail/sfinae.hpp | 77 - libraries/boost/include/boost/range/end.hpp | 128 - .../boost/include/boost/range/iterator.hpp | 74 - .../include/boost/range/mutable_iterator.hpp | 79 - .../boost/include/boost/range/range_fwd.hpp | 63 - .../boost/include/boost/scoped_array.hpp | 15 - libraries/boost/include/boost/scoped_ptr.hpp | 15 - libraries/boost/include/boost/shared_ptr.hpp | 19 - .../boost/smart_ptr/allocate_shared_array.hpp | 703 ----- .../include/boost/smart_ptr/bad_weak_ptr.hpp | 70 - .../smart_ptr/detail/lightweight_mutex.hpp | 42 - .../smart_ptr/detail/local_counted_base.hpp | 148 -- .../smart_ptr/detail/local_sp_deleter.hpp | 91 - .../boost/smart_ptr/detail/lwm_nop.hpp | 37 - .../boost/smart_ptr/detail/lwm_pthreads.hpp | 87 - .../boost/smart_ptr/detail/lwm_win32_cs.hpp | 134 - .../boost/smart_ptr/detail/operator_bool.hpp | 64 - .../smart_ptr/detail/quick_allocator.hpp | 199 -- .../boost/smart_ptr/detail/shared_count.hpp | 667 ----- .../boost/smart_ptr/detail/sp_convertible.hpp | 92 - .../smart_ptr/detail/sp_counted_base.hpp | 96 - .../detail/sp_counted_base_acc_ia64.hpp | 152 -- .../smart_ptr/detail/sp_counted_base_aix.hpp | 144 - .../detail/sp_counted_base_clang.hpp | 150 -- .../detail/sp_counted_base_cw_ppc.hpp | 172 -- .../detail/sp_counted_base_gcc_ia64.hpp | 159 -- .../detail/sp_counted_base_gcc_mips.hpp | 189 -- .../detail/sp_counted_base_gcc_ppc.hpp | 183 -- .../detail/sp_counted_base_gcc_sparc.hpp | 168 -- .../detail/sp_counted_base_gcc_x86.hpp | 175 -- .../smart_ptr/detail/sp_counted_base_nt.hpp | 109 - .../smart_ptr/detail/sp_counted_base_pt.hpp | 138 - .../detail/sp_counted_base_snc_ps3.hpp | 163 -- .../smart_ptr/detail/sp_counted_base_spin.hpp | 133 - .../detail/sp_counted_base_std_atomic.hpp | 138 - .../smart_ptr/detail/sp_counted_base_sync.hpp | 157 -- .../detail/sp_counted_base_vacpp_ppc.hpp | 152 -- .../smart_ptr/detail/sp_counted_base_w32.hpp | 132 - .../smart_ptr/detail/sp_counted_impl.hpp | 292 -- .../detail/sp_disable_deprecated.hpp | 40 - .../boost/smart_ptr/detail/sp_forward.hpp | 52 - .../boost/smart_ptr/detail/sp_has_sync.hpp | 69 - .../boost/smart_ptr/detail/sp_interlocked.hpp | 163 -- .../boost/smart_ptr/detail/sp_noexcept.hpp | 48 - .../boost/smart_ptr/detail/sp_nullptr_t.hpp | 45 - .../boost/smart_ptr/detail/spinlock.hpp | 68 - .../smart_ptr/detail/spinlock_gcc_arm.hpp | 121 - .../boost/smart_ptr/detail/spinlock_nt.hpp | 89 - .../boost/smart_ptr/detail/spinlock_pool.hpp | 91 - .../boost/smart_ptr/detail/spinlock_pt.hpp | 79 - .../smart_ptr/detail/spinlock_std_atomic.hpp | 83 - .../boost/smart_ptr/detail/spinlock_sync.hpp | 87 - .../boost/smart_ptr/detail/spinlock_w32.hpp | 113 - .../boost/smart_ptr/detail/yield_k.hpp | 177 -- .../include/boost/smart_ptr/make_shared.hpp | 21 - .../boost/smart_ptr/make_shared_array.hpp | 66 - .../boost/smart_ptr/make_shared_object.hpp | 801 ------ .../include/boost/smart_ptr/scoped_array.hpp | 132 - .../include/boost/smart_ptr/scoped_ptr.hpp | 167 -- .../include/boost/smart_ptr/shared_ptr.hpp | 1184 --------- libraries/boost/include/boost/swap.hpp | 17 - .../include/boost/test/auto_unit_test.hpp | 18 - .../boost/include/boost/test/data/config.hpp | 45 - .../boost/include/boost/test/data/dataset.hpp | 19 - .../boost/test/data/for_each_sample.hpp | 117 - .../include/boost/test/data/generators.hpp | 19 - .../boost/test/data/index_sequence.hpp | 62 - .../include/boost/test/data/monomorphic.hpp | 27 - .../boost/test/data/monomorphic/array.hpp | 83 - .../test/data/monomorphic/collection.hpp | 91 - .../boost/test/data/monomorphic/fwd.hpp | 180 -- .../boost/test/data/monomorphic/generate.hpp | 111 - .../test/data/monomorphic/generators.hpp | 20 - .../data/monomorphic/generators/keywords.hpp | 39 - .../data/monomorphic/generators/random.hpp | 198 -- .../data/monomorphic/generators/xrange.hpp | 224 -- .../boost/test/data/monomorphic/grid.hpp | 183 -- .../data/monomorphic/initializer_list.hpp | 81 - .../boost/test/data/monomorphic/join.hpp | 148 -- .../test/data/monomorphic/sample_merge.hpp | 103 - .../boost/test/data/monomorphic/singleton.hpp | 119 - .../boost/test/data/monomorphic/zip.hpp | 194 -- .../boost/include/boost/test/data/size.hpp | 145 - .../include/boost/test/data/test_case.hpp | 325 --- libraries/boost/include/boost/test/debug.hpp | 138 - .../boost/include/boost/test/debug_config.hpp | 24 - .../include/boost/test/detail/config.hpp | 127 - .../boost/test/detail/enable_warnings.hpp | 36 - .../include/boost/test/detail/fwd_decl.hpp | 46 - .../boost/test/detail/global_typedef.hpp | 111 - .../include/boost/test/detail/log_level.hpp | 40 - .../include/boost/test/detail/pp_variadic.hpp | 49 - .../boost/test/detail/suppress_warnings.hpp | 38 - .../boost/test/detail/throw_exception.hpp | 71 - .../include/boost/test/detail/workaround.hpp | 56 - .../include/boost/test/execution_monitor.hpp | 579 ---- .../boost/test/floating_point_comparison.hpp | 14 - .../boost/include/boost/test/framework.hpp | 303 --- .../test/impl/compiler_log_formatter.ipp | 298 --- .../include/boost/test/impl/cpp_main.ipp | 136 - .../boost/include/boost/test/impl/debug.ipp | 1009 ------- .../include/boost/test/impl/decorator.ipp | 202 -- .../boost/test/impl/execution_monitor.ipp | 1448 ---------- .../include/boost/test/impl/framework.ipp | 1713 ------------ .../boost/test/impl/junit_log_formatter.ipp | 840 ------ .../test/impl/plain_report_formatter.ipp | 207 -- .../boost/test/impl/progress_monitor.ipp | 185 -- .../boost/test/impl/results_collector.ipp | 285 -- .../boost/test/impl/results_reporter.ipp | 197 -- .../impl/test_framework_init_observer.ipp | 109 - .../include/boost/test/impl/test_main.ipp | 65 - .../include/boost/test/impl/test_tools.ipp | 823 ------ .../include/boost/test/impl/test_tree.ipp | 504 ---- .../include/boost/test/impl/unit_test_log.ipp | 691 ----- .../boost/test/impl/unit_test_main.ipp | 293 -- .../boost/test/impl/unit_test_monitor.ipp | 75 - .../boost/test/impl/unit_test_parameters.ipp | 772 ------ .../boost/test/impl/xml_log_formatter.ipp | 223 -- .../boost/test/impl/xml_report_formatter.ipp | 111 - .../boost/test/included/execution_monitor.hpp | 21 - .../boost/test/included/prg_exec_monitor.hpp | 25 - .../boost/test/included/test_exec_monitor.hpp | 40 - .../include/boost/test/included/unit_test.hpp | 40 - .../test/included/unit_test_framework.hpp | 12 - .../boost/include/boost/test/minimal.hpp | 156 -- .../test/output/compiler_log_formatter.hpp | 70 - .../boost/test/output/junit_log_formatter.hpp | 167 -- .../test/output/plain_report_formatter.hpp | 59 - .../boost/test/output/xml_log_formatter.hpp | 72 - .../test/output/xml_report_formatter.hpp | 52 - .../include/boost/test/output_test_stream.hpp | 14 - .../include/boost/test/parameterized_test.hpp | 176 -- .../include/boost/test/predicate_result.hpp | 14 - .../include/boost/test/prg_exec_monitor.hpp | 81 - .../include/boost/test/progress_monitor.hpp | 66 - .../include/boost/test/results_collector.hpp | 143 - .../include/boost/test/results_reporter.hpp | 122 - .../include/boost/test/test_case_template.hpp | 13 - .../include/boost/test/test_exec_monitor.hpp | 53 - .../test/test_framework_init_observer.hpp | 63 - .../boost/include/boost/test/test_tools.hpp | 68 - .../include/boost/test/tools/assertion.hpp | 410 --- .../boost/test/tools/assertion_result.hpp | 90 - .../test/tools/collection_comparison_op.hpp | 449 ---- .../include/boost/test/tools/context.hpp | 65 - .../test/tools/cstring_comparison_op.hpp | 88 - .../boost/test/tools/detail/bitwise_manip.hpp | 123 - .../test/tools/detail/expression_holder.hpp | 70 - .../include/boost/test/tools/detail/fwd.hpp | 121 - .../boost/test/tools/detail/indirections.hpp | 94 - .../boost/test/tools/detail/it_pair.hpp | 74 - .../test/tools/detail/lexicographic_manip.hpp | 69 - .../test/tools/detail/per_element_manip.hpp | 69 - .../boost/test/tools/detail/print_helper.hpp | 246 -- .../test/tools/detail/tolerance_manip.hpp | 130 - .../test/tools/floating_point_comparison.hpp | 315 --- .../boost/include/boost/test/tools/fpc_op.hpp | 210 -- .../boost/test/tools/fpc_tolerance.hpp | 103 - .../include/boost/test/tools/interface.hpp | 369 --- .../include/boost/test/tools/old/impl.hpp | 358 --- .../boost/test/tools/old/interface.hpp | 282 -- .../boost/test/tools/output_test_stream.hpp | 107 - .../boost/test/tree/auto_registration.hpp | 53 - .../include/boost/test/tree/decorator.hpp | 277 -- .../boost/include/boost/test/tree/fixture.hpp | 191 -- .../boost/test/tree/global_fixture.hpp | 123 - .../include/boost/test/tree/observer.hpp | 116 - .../boost/test/tree/test_case_counter.hpp | 52 - .../boost/test/tree/test_case_template.hpp | 190 -- .../include/boost/test/tree/test_unit.hpp | 275 -- .../include/boost/test/tree/traverse.hpp | 58 - .../boost/include/boost/test/tree/visitor.hpp | 52 - .../boost/include/boost/test/unit_test.hpp | 70 - .../include/boost/test/unit_test_log.hpp | 280 -- .../boost/test/unit_test_log_formatter.hpp | 322 --- .../include/boost/test/unit_test_monitor.hpp | 60 - .../boost/test/unit_test_parameters.hpp | 158 -- .../include/boost/test/unit_test_suite.hpp | 403 --- .../include/boost/test/utils/algorithm.hpp | 326 --- .../include/boost/test/utils/assign_op.hpp | 39 - .../utils/basic_cstring/basic_cstring.hpp | 749 ------ .../utils/basic_cstring/basic_cstring_fwd.hpp | 40 - .../utils/basic_cstring/bcs_char_traits.hpp | 150 -- .../test/utils/basic_cstring/compare.hpp | 151 -- .../boost/test/utils/basic_cstring/io.hpp | 73 - .../boost/test/utils/class_properties.hpp | 195 -- .../include/boost/test/utils/custom_manip.hpp | 61 - .../include/boost/test/utils/foreach.hpp | 316 --- .../include/boost/test/utils/is_cstring.hpp | 116 - .../boost/test/utils/is_forward_iterable.hpp | 267 -- .../utils/iterator/input_iterator_facade.hpp | 105 - .../test/utils/iterator/token_iterator.hpp | 421 --- .../include/boost/test/utils/lazy_ostream.hpp | 128 - .../include/boost/test/utils/named_params.hpp | 388 --- .../include/boost/test/utils/nullstream.hpp | 103 - .../boost/include/boost/test/utils/rtti.hpp | 63 - .../boost/test/utils/runtime/argument.hpp | 131 - .../test/utils/runtime/argument_factory.hpp | 242 -- .../test/utils/runtime/cla/argv_traverser.hpp | 105 - .../boost/test/utils/runtime/cla/parser.hpp | 584 ---- .../boost/test/utils/runtime/env/fetch.hpp | 108 - .../boost/test/utils/runtime/errors.hpp | 195 -- .../boost/test/utils/runtime/finalize.hpp | 56 - .../include/boost/test/utils/runtime/fwd.hpp | 45 - .../boost/test/utils/runtime/modifier.hpp | 106 - .../boost/test/utils/runtime/parameter.hpp | 526 ---- .../include/boost/test/utils/setcolor.hpp | 315 --- .../include/boost/test/utils/string_cast.hpp | 69 - .../boost/test/utils/trivial_singleton.hpp | 79 - .../boost/test/utils/wrap_stringstream.hpp | 162 -- .../include/boost/test/utils/xml_printer.hpp | 143 - .../boost/include/boost/throw_exception.hpp | 102 - libraries/boost/include/boost/timer.hpp | 72 - libraries/boost/include/boost/type.hpp | 18 - libraries/boost/include/boost/type_index.hpp | 265 -- .../boost/type_index/ctti_type_index.hpp | 213 -- .../detail/compile_time_type_info.hpp | 291 -- .../type_index/detail/ctti_register_class.hpp | 40 - .../type_index/detail/stl_register_class.hpp | 40 - .../boost/type_index/stl_type_index.hpp | 276 -- .../boost/type_index/type_index_facade.hpp | 297 --- libraries/boost/include/boost/visit_each.hpp | 27 - 443 files changed, 66295 deletions(-) delete mode 100644 libraries/boost/include/boost/algorithm/cxx11/all_of.hpp delete mode 100644 libraries/boost/include/boost/aligned_storage.hpp delete mode 100644 libraries/boost/include/boost/bind.hpp delete mode 100644 libraries/boost/include/boost/bind/arg.hpp delete mode 100644 libraries/boost/include/boost/bind/bind.hpp delete mode 100644 libraries/boost/include/boost/bind/bind_cc.hpp delete mode 100644 libraries/boost/include/boost/bind/bind_mf2_cc.hpp delete mode 100644 libraries/boost/include/boost/bind/bind_mf_cc.hpp delete mode 100644 libraries/boost/include/boost/bind/bind_template.hpp delete mode 100644 libraries/boost/include/boost/bind/mem_fn.hpp delete mode 100644 libraries/boost/include/boost/bind/mem_fn_cc.hpp delete mode 100644 libraries/boost/include/boost/bind/mem_fn_template.hpp delete mode 100644 libraries/boost/include/boost/bind/mem_fn_vw.hpp delete mode 100644 libraries/boost/include/boost/bind/placeholders.hpp delete mode 100644 libraries/boost/include/boost/bind/storage.hpp delete mode 100644 libraries/boost/include/boost/call_traits.hpp delete mode 100644 libraries/boost/include/boost/checked_delete.hpp delete mode 100644 libraries/boost/include/boost/cstdlib.hpp delete mode 100644 libraries/boost/include/boost/current_function.hpp delete mode 100644 libraries/boost/include/boost/exception/current_exception_cast.hpp delete mode 100644 libraries/boost/include/boost/exception/detail/error_info_impl.hpp delete mode 100644 libraries/boost/include/boost/exception/detail/shared_ptr.hpp delete mode 100644 libraries/boost/include/boost/exception/detail/type_info.hpp delete mode 100644 libraries/boost/include/boost/exception/exception.hpp delete mode 100644 libraries/boost/include/boost/exception/get_error_info.hpp delete mode 100644 libraries/boost/include/boost/function/detail/maybe_include.hpp delete mode 100644 libraries/boost/include/boost/function/detail/prologue.hpp delete mode 100644 libraries/boost/include/boost/function/function0.hpp delete mode 100644 libraries/boost/include/boost/function/function1.hpp delete mode 100644 libraries/boost/include/boost/function/function2.hpp delete mode 100644 libraries/boost/include/boost/function/function_base.hpp delete mode 100644 libraries/boost/include/boost/function/function_fwd.hpp delete mode 100644 libraries/boost/include/boost/function/function_template.hpp delete mode 100644 libraries/boost/include/boost/function_equal.hpp delete mode 100644 libraries/boost/include/boost/get_pointer.hpp delete mode 100644 libraries/boost/include/boost/integer.hpp delete mode 100644 libraries/boost/include/boost/integer/static_log2.hpp delete mode 100644 libraries/boost/include/boost/integer_fwd.hpp delete mode 100644 libraries/boost/include/boost/integer_traits.hpp delete mode 100644 libraries/boost/include/boost/io/ios_state.hpp delete mode 100644 libraries/boost/include/boost/io_fwd.hpp delete mode 100644 libraries/boost/include/boost/is_placeholder.hpp delete mode 100644 libraries/boost/include/boost/iterator/detail/config_def.hpp delete mode 100644 libraries/boost/include/boost/iterator/detail/config_undef.hpp delete mode 100644 libraries/boost/include/boost/iterator/detail/enable_if.hpp delete mode 100644 libraries/boost/include/boost/iterator/detail/facade_iterator_category.hpp delete mode 100644 libraries/boost/include/boost/iterator/interoperable.hpp delete mode 100644 libraries/boost/include/boost/iterator/iterator_categories.hpp delete mode 100644 libraries/boost/include/boost/iterator/iterator_facade.hpp delete mode 100644 libraries/boost/include/boost/iterator/iterator_traits.hpp delete mode 100644 libraries/boost/include/boost/limits.hpp delete mode 100644 libraries/boost/include/boost/make_shared.hpp delete mode 100644 libraries/boost/include/boost/mem_fn.hpp delete mode 100644 libraries/boost/include/boost/noncopyable.hpp delete mode 100644 libraries/boost/include/boost/none.hpp delete mode 100644 libraries/boost/include/boost/none_t.hpp delete mode 100644 libraries/boost/include/boost/numeric/conversion/conversion_traits.hpp delete mode 100644 libraries/boost/include/boost/numeric/conversion/detail/conversion_traits.hpp delete mode 100644 libraries/boost/include/boost/numeric/conversion/detail/int_float_mixture.hpp delete mode 100644 libraries/boost/include/boost/numeric/conversion/detail/is_subranged.hpp delete mode 100644 libraries/boost/include/boost/numeric/conversion/detail/meta.hpp delete mode 100644 libraries/boost/include/boost/numeric/conversion/detail/sign_mixture.hpp delete mode 100644 libraries/boost/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp delete mode 100644 libraries/boost/include/boost/numeric/conversion/int_float_mixture_enum.hpp delete mode 100644 libraries/boost/include/boost/numeric/conversion/sign_mixture_enum.hpp delete mode 100644 libraries/boost/include/boost/numeric/conversion/udt_builtin_mixture_enum.hpp delete mode 100644 libraries/boost/include/boost/optional.hpp delete mode 100644 libraries/boost/include/boost/optional/bad_optional_access.hpp delete mode 100644 libraries/boost/include/boost/optional/detail/old_optional_implementation.hpp delete mode 100644 libraries/boost/include/boost/optional/detail/optional_aligned_storage.hpp delete mode 100644 libraries/boost/include/boost/optional/detail/optional_config.hpp delete mode 100644 libraries/boost/include/boost/optional/detail/optional_factory_support.hpp delete mode 100644 libraries/boost/include/boost/optional/detail/optional_reference_spec.hpp delete mode 100644 libraries/boost/include/boost/optional/detail/optional_relops.hpp delete mode 100644 libraries/boost/include/boost/optional/detail/optional_swap.hpp delete mode 100644 libraries/boost/include/boost/optional/detail/optional_trivially_copyable_base.hpp delete mode 100644 libraries/boost/include/boost/optional/optional.hpp delete mode 100644 libraries/boost/include/boost/optional/optional_fwd.hpp delete mode 100644 libraries/boost/include/boost/predef.h delete mode 100644 libraries/boost/include/boost/predef/architecture.h delete mode 100644 libraries/boost/include/boost/predef/architecture/alpha.h delete mode 100644 libraries/boost/include/boost/predef/architecture/arm.h delete mode 100644 libraries/boost/include/boost/predef/architecture/blackfin.h delete mode 100644 libraries/boost/include/boost/predef/architecture/convex.h delete mode 100644 libraries/boost/include/boost/predef/architecture/ia64.h delete mode 100644 libraries/boost/include/boost/predef/architecture/m68k.h delete mode 100644 libraries/boost/include/boost/predef/architecture/mips.h delete mode 100644 libraries/boost/include/boost/predef/architecture/parisc.h delete mode 100644 libraries/boost/include/boost/predef/architecture/ppc.h delete mode 100644 libraries/boost/include/boost/predef/architecture/pyramid.h delete mode 100644 libraries/boost/include/boost/predef/architecture/rs6k.h delete mode 100644 libraries/boost/include/boost/predef/architecture/sparc.h delete mode 100644 libraries/boost/include/boost/predef/architecture/superh.h delete mode 100644 libraries/boost/include/boost/predef/architecture/sys370.h delete mode 100644 libraries/boost/include/boost/predef/architecture/sys390.h delete mode 100644 libraries/boost/include/boost/predef/architecture/x86.h delete mode 100644 libraries/boost/include/boost/predef/architecture/x86/32.h delete mode 100644 libraries/boost/include/boost/predef/architecture/x86/64.h delete mode 100644 libraries/boost/include/boost/predef/architecture/z.h delete mode 100644 libraries/boost/include/boost/predef/compiler.h delete mode 100644 libraries/boost/include/boost/predef/compiler/borland.h delete mode 100644 libraries/boost/include/boost/predef/compiler/clang.h delete mode 100644 libraries/boost/include/boost/predef/compiler/comeau.h delete mode 100644 libraries/boost/include/boost/predef/compiler/compaq.h delete mode 100644 libraries/boost/include/boost/predef/compiler/diab.h delete mode 100644 libraries/boost/include/boost/predef/compiler/digitalmars.h delete mode 100644 libraries/boost/include/boost/predef/compiler/dignus.h delete mode 100644 libraries/boost/include/boost/predef/compiler/edg.h delete mode 100644 libraries/boost/include/boost/predef/compiler/ekopath.h delete mode 100644 libraries/boost/include/boost/predef/compiler/gcc.h delete mode 100644 libraries/boost/include/boost/predef/compiler/gcc_xml.h delete mode 100644 libraries/boost/include/boost/predef/compiler/greenhills.h delete mode 100644 libraries/boost/include/boost/predef/compiler/hp_acc.h delete mode 100644 libraries/boost/include/boost/predef/compiler/iar.h delete mode 100644 libraries/boost/include/boost/predef/compiler/ibm.h delete mode 100644 libraries/boost/include/boost/predef/compiler/intel.h delete mode 100644 libraries/boost/include/boost/predef/compiler/kai.h delete mode 100644 libraries/boost/include/boost/predef/compiler/llvm.h delete mode 100644 libraries/boost/include/boost/predef/compiler/metaware.h delete mode 100644 libraries/boost/include/boost/predef/compiler/metrowerks.h delete mode 100644 libraries/boost/include/boost/predef/compiler/microtec.h delete mode 100644 libraries/boost/include/boost/predef/compiler/mpw.h delete mode 100644 libraries/boost/include/boost/predef/compiler/palm.h delete mode 100644 libraries/boost/include/boost/predef/compiler/pgi.h delete mode 100644 libraries/boost/include/boost/predef/compiler/sgi_mipspro.h delete mode 100644 libraries/boost/include/boost/predef/compiler/sunpro.h delete mode 100644 libraries/boost/include/boost/predef/compiler/tendra.h delete mode 100644 libraries/boost/include/boost/predef/compiler/visualc.h delete mode 100644 libraries/boost/include/boost/predef/compiler/watcom.h delete mode 100644 libraries/boost/include/boost/predef/detail/_cassert.h delete mode 100644 libraries/boost/include/boost/predef/detail/_exception.h delete mode 100644 libraries/boost/include/boost/predef/detail/comp_detected.h delete mode 100644 libraries/boost/include/boost/predef/detail/os_detected.h delete mode 100644 libraries/boost/include/boost/predef/detail/platform_detected.h delete mode 100644 libraries/boost/include/boost/predef/detail/test.h delete mode 100644 libraries/boost/include/boost/predef/hardware.h delete mode 100644 libraries/boost/include/boost/predef/hardware/simd.h delete mode 100644 libraries/boost/include/boost/predef/hardware/simd/arm.h delete mode 100644 libraries/boost/include/boost/predef/hardware/simd/arm/versions.h delete mode 100644 libraries/boost/include/boost/predef/hardware/simd/ppc.h delete mode 100644 libraries/boost/include/boost/predef/hardware/simd/ppc/versions.h delete mode 100644 libraries/boost/include/boost/predef/hardware/simd/x86.h delete mode 100644 libraries/boost/include/boost/predef/hardware/simd/x86/versions.h delete mode 100644 libraries/boost/include/boost/predef/hardware/simd/x86_amd.h delete mode 100644 libraries/boost/include/boost/predef/hardware/simd/x86_amd/versions.h delete mode 100644 libraries/boost/include/boost/predef/language.h delete mode 100644 libraries/boost/include/boost/predef/language/objc.h delete mode 100644 libraries/boost/include/boost/predef/language/stdc.h delete mode 100644 libraries/boost/include/boost/predef/language/stdcpp.h delete mode 100644 libraries/boost/include/boost/predef/library.h delete mode 100644 libraries/boost/include/boost/predef/library/c.h delete mode 100644 libraries/boost/include/boost/predef/library/c/_prefix.h delete mode 100644 libraries/boost/include/boost/predef/library/c/cloudabi.h delete mode 100644 libraries/boost/include/boost/predef/library/c/gnu.h delete mode 100644 libraries/boost/include/boost/predef/library/c/uc.h delete mode 100644 libraries/boost/include/boost/predef/library/c/vms.h delete mode 100644 libraries/boost/include/boost/predef/library/c/zos.h delete mode 100644 libraries/boost/include/boost/predef/library/std.h delete mode 100644 libraries/boost/include/boost/predef/library/std/_prefix.h delete mode 100644 libraries/boost/include/boost/predef/library/std/cxx.h delete mode 100644 libraries/boost/include/boost/predef/library/std/dinkumware.h delete mode 100644 libraries/boost/include/boost/predef/library/std/libcomo.h delete mode 100644 libraries/boost/include/boost/predef/library/std/modena.h delete mode 100644 libraries/boost/include/boost/predef/library/std/msl.h delete mode 100644 libraries/boost/include/boost/predef/library/std/roguewave.h delete mode 100644 libraries/boost/include/boost/predef/library/std/sgi.h delete mode 100644 libraries/boost/include/boost/predef/library/std/stdcpp3.h delete mode 100644 libraries/boost/include/boost/predef/library/std/stlport.h delete mode 100644 libraries/boost/include/boost/predef/library/std/vacpp.h delete mode 100644 libraries/boost/include/boost/predef/make.h delete mode 100644 libraries/boost/include/boost/predef/os.h delete mode 100644 libraries/boost/include/boost/predef/os/aix.h delete mode 100644 libraries/boost/include/boost/predef/os/amigaos.h delete mode 100644 libraries/boost/include/boost/predef/os/android.h delete mode 100644 libraries/boost/include/boost/predef/os/beos.h delete mode 100644 libraries/boost/include/boost/predef/os/bsd.h delete mode 100644 libraries/boost/include/boost/predef/os/bsd/bsdi.h delete mode 100644 libraries/boost/include/boost/predef/os/bsd/dragonfly.h delete mode 100644 libraries/boost/include/boost/predef/os/bsd/free.h delete mode 100644 libraries/boost/include/boost/predef/os/bsd/net.h delete mode 100644 libraries/boost/include/boost/predef/os/bsd/open.h delete mode 100644 libraries/boost/include/boost/predef/os/cygwin.h delete mode 100644 libraries/boost/include/boost/predef/os/haiku.h delete mode 100644 libraries/boost/include/boost/predef/os/hpux.h delete mode 100644 libraries/boost/include/boost/predef/os/ios.h delete mode 100644 libraries/boost/include/boost/predef/os/irix.h delete mode 100644 libraries/boost/include/boost/predef/os/linux.h delete mode 100644 libraries/boost/include/boost/predef/os/macos.h delete mode 100644 libraries/boost/include/boost/predef/os/os400.h delete mode 100644 libraries/boost/include/boost/predef/os/qnxnto.h delete mode 100644 libraries/boost/include/boost/predef/os/solaris.h delete mode 100644 libraries/boost/include/boost/predef/os/unix.h delete mode 100644 libraries/boost/include/boost/predef/os/vms.h delete mode 100644 libraries/boost/include/boost/predef/os/windows.h delete mode 100644 libraries/boost/include/boost/predef/other.h delete mode 100644 libraries/boost/include/boost/predef/other/endian.h delete mode 100644 libraries/boost/include/boost/predef/platform.h delete mode 100644 libraries/boost/include/boost/predef/platform/cloudabi.h delete mode 100644 libraries/boost/include/boost/predef/platform/ios.h delete mode 100644 libraries/boost/include/boost/predef/platform/mingw.h delete mode 100644 libraries/boost/include/boost/predef/platform/mingw32.h delete mode 100644 libraries/boost/include/boost/predef/platform/mingw64.h delete mode 100644 libraries/boost/include/boost/predef/platform/windows_desktop.h delete mode 100644 libraries/boost/include/boost/predef/platform/windows_phone.h delete mode 100644 libraries/boost/include/boost/predef/platform/windows_runtime.h delete mode 100644 libraries/boost/include/boost/predef/platform/windows_server.h delete mode 100644 libraries/boost/include/boost/predef/platform/windows_store.h delete mode 100644 libraries/boost/include/boost/predef/platform/windows_system.h delete mode 100644 libraries/boost/include/boost/predef/platform/windows_uwp.h delete mode 100644 libraries/boost/include/boost/predef/version.h delete mode 100644 libraries/boost/include/boost/predef/version_number.h delete mode 100644 libraries/boost/include/boost/range/begin.hpp delete mode 100644 libraries/boost/include/boost/range/config.hpp delete mode 100644 libraries/boost/include/boost/range/const_iterator.hpp delete mode 100644 libraries/boost/include/boost/range/detail/begin.hpp delete mode 100644 libraries/boost/include/boost/range/detail/common.hpp delete mode 100644 libraries/boost/include/boost/range/detail/end.hpp delete mode 100644 libraries/boost/include/boost/range/detail/extract_optional_type.hpp delete mode 100644 libraries/boost/include/boost/range/detail/implementation_help.hpp delete mode 100644 libraries/boost/include/boost/range/detail/msvc_has_iterator_workaround.hpp delete mode 100644 libraries/boost/include/boost/range/detail/sfinae.hpp delete mode 100644 libraries/boost/include/boost/range/end.hpp delete mode 100644 libraries/boost/include/boost/range/iterator.hpp delete mode 100644 libraries/boost/include/boost/range/mutable_iterator.hpp delete mode 100644 libraries/boost/include/boost/range/range_fwd.hpp delete mode 100644 libraries/boost/include/boost/scoped_array.hpp delete mode 100644 libraries/boost/include/boost/scoped_ptr.hpp delete mode 100644 libraries/boost/include/boost/shared_ptr.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/allocate_shared_array.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/bad_weak_ptr.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/lightweight_mutex.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/local_counted_base.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/local_sp_deleter.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/lwm_nop.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/lwm_pthreads.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/lwm_win32_cs.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/operator_bool.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/quick_allocator.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/shared_count.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_convertible.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_counted_impl.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_forward.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_has_sync.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_interlocked.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_noexcept.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/sp_nullptr_t.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_nt.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_pool.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_pt.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_sync.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/spinlock_w32.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/detail/yield_k.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/make_shared.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/make_shared_array.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/make_shared_object.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/scoped_array.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/scoped_ptr.hpp delete mode 100644 libraries/boost/include/boost/smart_ptr/shared_ptr.hpp delete mode 100644 libraries/boost/include/boost/swap.hpp delete mode 100644 libraries/boost/include/boost/test/auto_unit_test.hpp delete mode 100644 libraries/boost/include/boost/test/data/config.hpp delete mode 100644 libraries/boost/include/boost/test/data/dataset.hpp delete mode 100644 libraries/boost/include/boost/test/data/for_each_sample.hpp delete mode 100644 libraries/boost/include/boost/test/data/generators.hpp delete mode 100644 libraries/boost/include/boost/test/data/index_sequence.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/array.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/collection.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/fwd.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/generate.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/generators.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/generators/keywords.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/generators/random.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/generators/xrange.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/grid.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/initializer_list.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/join.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/sample_merge.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/singleton.hpp delete mode 100644 libraries/boost/include/boost/test/data/monomorphic/zip.hpp delete mode 100644 libraries/boost/include/boost/test/data/size.hpp delete mode 100644 libraries/boost/include/boost/test/data/test_case.hpp delete mode 100644 libraries/boost/include/boost/test/debug.hpp delete mode 100644 libraries/boost/include/boost/test/debug_config.hpp delete mode 100644 libraries/boost/include/boost/test/detail/config.hpp delete mode 100644 libraries/boost/include/boost/test/detail/enable_warnings.hpp delete mode 100644 libraries/boost/include/boost/test/detail/fwd_decl.hpp delete mode 100644 libraries/boost/include/boost/test/detail/global_typedef.hpp delete mode 100644 libraries/boost/include/boost/test/detail/log_level.hpp delete mode 100644 libraries/boost/include/boost/test/detail/pp_variadic.hpp delete mode 100644 libraries/boost/include/boost/test/detail/suppress_warnings.hpp delete mode 100644 libraries/boost/include/boost/test/detail/throw_exception.hpp delete mode 100644 libraries/boost/include/boost/test/detail/workaround.hpp delete mode 100644 libraries/boost/include/boost/test/execution_monitor.hpp delete mode 100644 libraries/boost/include/boost/test/floating_point_comparison.hpp delete mode 100644 libraries/boost/include/boost/test/framework.hpp delete mode 100644 libraries/boost/include/boost/test/impl/compiler_log_formatter.ipp delete mode 100644 libraries/boost/include/boost/test/impl/cpp_main.ipp delete mode 100644 libraries/boost/include/boost/test/impl/debug.ipp delete mode 100644 libraries/boost/include/boost/test/impl/decorator.ipp delete mode 100644 libraries/boost/include/boost/test/impl/execution_monitor.ipp delete mode 100644 libraries/boost/include/boost/test/impl/framework.ipp delete mode 100644 libraries/boost/include/boost/test/impl/junit_log_formatter.ipp delete mode 100644 libraries/boost/include/boost/test/impl/plain_report_formatter.ipp delete mode 100644 libraries/boost/include/boost/test/impl/progress_monitor.ipp delete mode 100644 libraries/boost/include/boost/test/impl/results_collector.ipp delete mode 100644 libraries/boost/include/boost/test/impl/results_reporter.ipp delete mode 100644 libraries/boost/include/boost/test/impl/test_framework_init_observer.ipp delete mode 100644 libraries/boost/include/boost/test/impl/test_main.ipp delete mode 100644 libraries/boost/include/boost/test/impl/test_tools.ipp delete mode 100644 libraries/boost/include/boost/test/impl/test_tree.ipp delete mode 100644 libraries/boost/include/boost/test/impl/unit_test_log.ipp delete mode 100644 libraries/boost/include/boost/test/impl/unit_test_main.ipp delete mode 100644 libraries/boost/include/boost/test/impl/unit_test_monitor.ipp delete mode 100644 libraries/boost/include/boost/test/impl/unit_test_parameters.ipp delete mode 100644 libraries/boost/include/boost/test/impl/xml_log_formatter.ipp delete mode 100644 libraries/boost/include/boost/test/impl/xml_report_formatter.ipp delete mode 100644 libraries/boost/include/boost/test/included/execution_monitor.hpp delete mode 100644 libraries/boost/include/boost/test/included/prg_exec_monitor.hpp delete mode 100644 libraries/boost/include/boost/test/included/test_exec_monitor.hpp delete mode 100644 libraries/boost/include/boost/test/included/unit_test.hpp delete mode 100644 libraries/boost/include/boost/test/included/unit_test_framework.hpp delete mode 100644 libraries/boost/include/boost/test/minimal.hpp delete mode 100644 libraries/boost/include/boost/test/output/compiler_log_formatter.hpp delete mode 100644 libraries/boost/include/boost/test/output/junit_log_formatter.hpp delete mode 100644 libraries/boost/include/boost/test/output/plain_report_formatter.hpp delete mode 100644 libraries/boost/include/boost/test/output/xml_log_formatter.hpp delete mode 100644 libraries/boost/include/boost/test/output/xml_report_formatter.hpp delete mode 100644 libraries/boost/include/boost/test/output_test_stream.hpp delete mode 100644 libraries/boost/include/boost/test/parameterized_test.hpp delete mode 100644 libraries/boost/include/boost/test/predicate_result.hpp delete mode 100644 libraries/boost/include/boost/test/prg_exec_monitor.hpp delete mode 100644 libraries/boost/include/boost/test/progress_monitor.hpp delete mode 100644 libraries/boost/include/boost/test/results_collector.hpp delete mode 100644 libraries/boost/include/boost/test/results_reporter.hpp delete mode 100644 libraries/boost/include/boost/test/test_case_template.hpp delete mode 100644 libraries/boost/include/boost/test/test_exec_monitor.hpp delete mode 100644 libraries/boost/include/boost/test/test_framework_init_observer.hpp delete mode 100644 libraries/boost/include/boost/test/test_tools.hpp delete mode 100644 libraries/boost/include/boost/test/tools/assertion.hpp delete mode 100644 libraries/boost/include/boost/test/tools/assertion_result.hpp delete mode 100644 libraries/boost/include/boost/test/tools/collection_comparison_op.hpp delete mode 100644 libraries/boost/include/boost/test/tools/context.hpp delete mode 100644 libraries/boost/include/boost/test/tools/cstring_comparison_op.hpp delete mode 100644 libraries/boost/include/boost/test/tools/detail/bitwise_manip.hpp delete mode 100644 libraries/boost/include/boost/test/tools/detail/expression_holder.hpp delete mode 100644 libraries/boost/include/boost/test/tools/detail/fwd.hpp delete mode 100644 libraries/boost/include/boost/test/tools/detail/indirections.hpp delete mode 100644 libraries/boost/include/boost/test/tools/detail/it_pair.hpp delete mode 100644 libraries/boost/include/boost/test/tools/detail/lexicographic_manip.hpp delete mode 100644 libraries/boost/include/boost/test/tools/detail/per_element_manip.hpp delete mode 100644 libraries/boost/include/boost/test/tools/detail/print_helper.hpp delete mode 100644 libraries/boost/include/boost/test/tools/detail/tolerance_manip.hpp delete mode 100644 libraries/boost/include/boost/test/tools/floating_point_comparison.hpp delete mode 100644 libraries/boost/include/boost/test/tools/fpc_op.hpp delete mode 100644 libraries/boost/include/boost/test/tools/fpc_tolerance.hpp delete mode 100644 libraries/boost/include/boost/test/tools/interface.hpp delete mode 100644 libraries/boost/include/boost/test/tools/old/impl.hpp delete mode 100644 libraries/boost/include/boost/test/tools/old/interface.hpp delete mode 100644 libraries/boost/include/boost/test/tools/output_test_stream.hpp delete mode 100644 libraries/boost/include/boost/test/tree/auto_registration.hpp delete mode 100644 libraries/boost/include/boost/test/tree/decorator.hpp delete mode 100644 libraries/boost/include/boost/test/tree/fixture.hpp delete mode 100644 libraries/boost/include/boost/test/tree/global_fixture.hpp delete mode 100644 libraries/boost/include/boost/test/tree/observer.hpp delete mode 100644 libraries/boost/include/boost/test/tree/test_case_counter.hpp delete mode 100644 libraries/boost/include/boost/test/tree/test_case_template.hpp delete mode 100644 libraries/boost/include/boost/test/tree/test_unit.hpp delete mode 100644 libraries/boost/include/boost/test/tree/traverse.hpp delete mode 100644 libraries/boost/include/boost/test/tree/visitor.hpp delete mode 100644 libraries/boost/include/boost/test/unit_test.hpp delete mode 100644 libraries/boost/include/boost/test/unit_test_log.hpp delete mode 100644 libraries/boost/include/boost/test/unit_test_log_formatter.hpp delete mode 100644 libraries/boost/include/boost/test/unit_test_monitor.hpp delete mode 100644 libraries/boost/include/boost/test/unit_test_parameters.hpp delete mode 100644 libraries/boost/include/boost/test/unit_test_suite.hpp delete mode 100644 libraries/boost/include/boost/test/utils/algorithm.hpp delete mode 100644 libraries/boost/include/boost/test/utils/assign_op.hpp delete mode 100644 libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring.hpp delete mode 100644 libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp delete mode 100644 libraries/boost/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp delete mode 100644 libraries/boost/include/boost/test/utils/basic_cstring/compare.hpp delete mode 100644 libraries/boost/include/boost/test/utils/basic_cstring/io.hpp delete mode 100644 libraries/boost/include/boost/test/utils/class_properties.hpp delete mode 100644 libraries/boost/include/boost/test/utils/custom_manip.hpp delete mode 100644 libraries/boost/include/boost/test/utils/foreach.hpp delete mode 100644 libraries/boost/include/boost/test/utils/is_cstring.hpp delete mode 100644 libraries/boost/include/boost/test/utils/is_forward_iterable.hpp delete mode 100644 libraries/boost/include/boost/test/utils/iterator/input_iterator_facade.hpp delete mode 100644 libraries/boost/include/boost/test/utils/iterator/token_iterator.hpp delete mode 100644 libraries/boost/include/boost/test/utils/lazy_ostream.hpp delete mode 100644 libraries/boost/include/boost/test/utils/named_params.hpp delete mode 100644 libraries/boost/include/boost/test/utils/nullstream.hpp delete mode 100644 libraries/boost/include/boost/test/utils/rtti.hpp delete mode 100644 libraries/boost/include/boost/test/utils/runtime/argument.hpp delete mode 100644 libraries/boost/include/boost/test/utils/runtime/argument_factory.hpp delete mode 100644 libraries/boost/include/boost/test/utils/runtime/cla/argv_traverser.hpp delete mode 100644 libraries/boost/include/boost/test/utils/runtime/cla/parser.hpp delete mode 100644 libraries/boost/include/boost/test/utils/runtime/env/fetch.hpp delete mode 100644 libraries/boost/include/boost/test/utils/runtime/errors.hpp delete mode 100644 libraries/boost/include/boost/test/utils/runtime/finalize.hpp delete mode 100644 libraries/boost/include/boost/test/utils/runtime/fwd.hpp delete mode 100644 libraries/boost/include/boost/test/utils/runtime/modifier.hpp delete mode 100644 libraries/boost/include/boost/test/utils/runtime/parameter.hpp delete mode 100644 libraries/boost/include/boost/test/utils/setcolor.hpp delete mode 100644 libraries/boost/include/boost/test/utils/string_cast.hpp delete mode 100644 libraries/boost/include/boost/test/utils/trivial_singleton.hpp delete mode 100644 libraries/boost/include/boost/test/utils/wrap_stringstream.hpp delete mode 100644 libraries/boost/include/boost/test/utils/xml_printer.hpp delete mode 100644 libraries/boost/include/boost/throw_exception.hpp delete mode 100644 libraries/boost/include/boost/timer.hpp delete mode 100644 libraries/boost/include/boost/type.hpp delete mode 100644 libraries/boost/include/boost/type_index.hpp delete mode 100644 libraries/boost/include/boost/type_index/ctti_type_index.hpp delete mode 100644 libraries/boost/include/boost/type_index/detail/compile_time_type_info.hpp delete mode 100644 libraries/boost/include/boost/type_index/detail/ctti_register_class.hpp delete mode 100644 libraries/boost/include/boost/type_index/detail/stl_register_class.hpp delete mode 100644 libraries/boost/include/boost/type_index/stl_type_index.hpp delete mode 100644 libraries/boost/include/boost/type_index/type_index_facade.hpp delete mode 100644 libraries/boost/include/boost/visit_each.hpp diff --git a/libraries/boost/include/boost/algorithm/cxx11/all_of.hpp b/libraries/boost/include/boost/algorithm/cxx11/all_of.hpp deleted file mode 100644 index 8280b18d62..0000000000 --- a/libraries/boost/include/boost/algorithm/cxx11/all_of.hpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright (c) Marshall Clow 2008-2012. - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -*/ - -/// \file all_of.hpp -/// \brief Test ranges to see if all elements match a value or predicate. -/// \author Marshall Clow - -#ifndef BOOST_ALGORITHM_ALL_OF_HPP -#define BOOST_ALGORITHM_ALL_OF_HPP - -#include -#include - -namespace boost { namespace algorithm { - -/// \fn all_of ( InputIterator first, InputIterator last, Predicate p ) -/// \return true if all elements in [first, last) satisfy the predicate 'p' -/// \note returns true on an empty range -/// -/// \param first The start of the input sequence -/// \param last One past the end of the input sequence -/// \param p A predicate for testing the elements of the sequence -/// -/// \note This function is part of the C++2011 standard library. -template -bool all_of ( InputIterator first, InputIterator last, Predicate p ) -{ - for ( ; first != last; ++first ) - if ( !p(*first)) - return false; - return true; -} - -/// \fn all_of ( const Range &r, Predicate p ) -/// \return true if all elements in the range satisfy the predicate 'p' -/// \note returns true on an empty range -/// -/// \param r The input range -/// \param p A predicate for testing the elements of the range -/// -template -bool all_of ( const Range &r, Predicate p ) -{ - return boost::algorithm::all_of ( boost::begin (r), boost::end (r), p ); -} - -/// \fn all_of_equal ( InputIterator first, InputIterator last, const T &val ) -/// \return true if all elements in [first, last) are equal to 'val' -/// \note returns true on an empty range -/// -/// \param first The start of the input sequence -/// \param last One past the end of the input sequence -/// \param val A value to compare against -/// -template -bool all_of_equal ( InputIterator first, InputIterator last, const T &val ) -{ - for ( ; first != last; ++first ) - if ( val != *first ) - return false; - return true; -} - -/// \fn all_of_equal ( const Range &r, const T &val ) -/// \return true if all elements in the range are equal to 'val' -/// \note returns true on an empty range -/// -/// \param r The input range -/// \param val A value to compare against -/// -template -bool all_of_equal ( const Range &r, const T &val ) -{ - return boost::algorithm::all_of_equal ( boost::begin (r), boost::end (r), val ); -} - -}} // namespace boost and algorithm - -#endif // BOOST_ALGORITHM_ALL_OF_HPP diff --git a/libraries/boost/include/boost/aligned_storage.hpp b/libraries/boost/include/boost/aligned_storage.hpp deleted file mode 100644 index f400fa9e75..0000000000 --- a/libraries/boost/include/boost/aligned_storage.hpp +++ /dev/null @@ -1,18 +0,0 @@ -//----------------------------------------------------------------------------- -// boost aligned_storage.hpp header file -// See http://www.boost.org for updates, documentation, and revision history. -//----------------------------------------------------------------------------- -// -// Copyright (c) 2002-2003 -// Eric Friedman, Itay Maman -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_ALIGNED_STORAGE_HPP -#define BOOST_ALIGNED_STORAGE_HPP - -#include - -#endif // BOOST_ALIGNED_STORAGE_HPP diff --git a/libraries/boost/include/boost/bind.hpp b/libraries/boost/include/boost/bind.hpp deleted file mode 100644 index 450120c7a7..0000000000 --- a/libraries/boost/include/boost/bind.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef BOOST_BIND_HPP_INCLUDED -#define BOOST_BIND_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// bind.hpp - binds function objects to arguments -// -// Copyright (c) 2009, 2015 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/bind/bind.html for documentation. -// - -#include - -#ifndef BOOST_BIND_NO_PLACEHOLDERS - -#if defined(BOOST_CLANG) -# pragma clang diagnostic push -# if __has_warning("-Wheader-hygiene") -# pragma clang diagnostic ignored "-Wheader-hygiene" -# endif -#endif - -using namespace boost::placeholders; - -#if defined(BOOST_CLANG) -# pragma clang diagnostic pop -#endif - -#endif // #ifndef BOOST_BIND_NO_PLACEHOLDERS - -#endif // #ifndef BOOST_BIND_HPP_INCLUDED diff --git a/libraries/boost/include/boost/bind/arg.hpp b/libraries/boost/include/boost/bind/arg.hpp deleted file mode 100644 index cb52e6689f..0000000000 --- a/libraries/boost/include/boost/bind/arg.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef BOOST_BIND_ARG_HPP_INCLUDED -#define BOOST_BIND_ARG_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// bind/arg.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/bind.html for documentation. -// - -#include -#include - -namespace boost -{ - -template struct _arg_eq -{ -}; - -template<> struct _arg_eq -{ - typedef void type; -}; - -template< int I > struct arg -{ - BOOST_CONSTEXPR arg() - { - } - - template< class T > BOOST_CONSTEXPR arg( T const & /* t */, typename _arg_eq< I == is_placeholder::value >::type * = 0 ) - { - } -}; - -template< int I > BOOST_CONSTEXPR bool operator==( arg const &, arg const & ) -{ - return true; -} - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< int I > struct is_placeholder< arg > -{ - enum _vt { value = I }; -}; - -template< int I > struct is_placeholder< arg (*) () > -{ - enum _vt { value = I }; -}; - -#endif - -} // namespace boost - -#endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED diff --git a/libraries/boost/include/boost/bind/bind.hpp b/libraries/boost/include/boost/bind/bind.hpp deleted file mode 100644 index 4cedc5e9a4..0000000000 --- a/libraries/boost/include/boost/bind/bind.hpp +++ /dev/null @@ -1,2365 +0,0 @@ -#ifndef BOOST_BIND_BIND_HPP_INCLUDED -#define BOOST_BIND_BIND_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// bind.hpp - binds function objects to arguments -// -// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2001 David Abrahams -// Copyright (c) 2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/bind.html for documentation. -// - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) -#include // std::forward -#endif - -// Borland-specific bug, visit_each() silently fails to produce code - -#if defined(__BORLANDC__) -# define BOOST_BIND_VISIT_EACH boost::visit_each -#else -# define BOOST_BIND_VISIT_EACH visit_each -#endif - -#include - -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable: 4512) // assignment operator could not be generated -#endif - -namespace boost -{ - -template class weak_ptr; - -namespace _bi // implementation details -{ - -// result_traits - -template struct result_traits -{ - typedef R type; -}; - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - -struct unspecified {}; - -template struct result_traits -{ - typedef typename F::result_type type; -}; - -template struct result_traits< unspecified, reference_wrapper > -{ - typedef typename F::result_type type; -}; - -#endif - -// ref_compare - -template bool ref_compare( T const & a, T const & b, long ) -{ - return a == b; -} - -template bool ref_compare( arg const &, arg const &, int ) -{ - return true; -} - -template bool ref_compare( arg (*) (), arg (*) (), int ) -{ - return true; -} - -template bool ref_compare( reference_wrapper const & a, reference_wrapper const & b, int ) -{ - return a.get_pointer() == b.get_pointer(); -} - -// bind_t forward declaration for listN - -template class bind_t; - -template bool ref_compare( bind_t const & a, bind_t const & b, int ) -{ - return a.compare( b ); -} - -// value - -template class value -{ -public: - - value(T const & t): t_(t) {} - - T & get() { return t_; } - T const & get() const { return t_; } - - bool operator==(value const & rhs) const - { - return t_ == rhs.t_; - } - -private: - - T t_; -}; - -// ref_compare for weak_ptr - -template bool ref_compare( value< weak_ptr > const & a, value< weak_ptr > const & b, int ) -{ - return !(a.get() < b.get()) && !(b.get() < a.get()); -} - -// type - -template class type {}; - -// unwrap - -template struct unwrapper -{ - static inline F & unwrap( F & f, long ) - { - return f; - } - - template static inline F2 & unwrap( reference_wrapper rf, int ) - { - return rf.get(); - } - - template static inline _mfi::dm unwrap( R T::* pm, int ) - { - return _mfi::dm( pm ); - } -}; - -// listN - -class list0 -{ -public: - - list0() {} - - template T & operator[] (_bi::value & v) const { return v.get(); } - - template T const & operator[] (_bi::value const & v) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - - template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } - - template R operator()(type, F & f, A &, long) - { - return unwrapper::unwrap(f, 0)(); - } - - template R operator()(type, F const & f, A &, long) const - { - return unwrapper::unwrap(f, 0)(); - } - - template void operator()(type, F & f, A &, int) - { - unwrapper::unwrap(f, 0)(); - } - - template void operator()(type, F const & f, A &, int) const - { - unwrapper::unwrap(f, 0)(); - } - - template void accept(V &) const - { - } - - bool operator==(list0 const &) const - { - return true; - } -}; - -#ifdef BOOST_MSVC -// MSVC is bright enough to realise that the parameter rhs -// in operator==may be unused for some template argument types: -#pragma warning(push) -#pragma warning(disable:4100) -#endif - -template< class A1 > class list1: private storage1< A1 > -{ -private: - - typedef storage1< A1 > base_type; - -public: - - explicit list1( A1 a1 ): base_type( a1 ) {} - - A1 operator[] (boost::arg<1>) const { return base_type::a1_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } - - template T & operator[] ( _bi::value & v ) const { return v.get(); } - - template T const & operator[] ( _bi::value const & v ) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - - template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } - - template R operator()(type, F & f, A & a, long) - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_]); - } - - template R operator()(type, F const & f, A & a, long) const - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_]); - } - - template void operator()(type, F & f, A & a, int) - { - unwrapper::unwrap(f, 0)(a[base_type::a1_]); - } - - template void operator()(type, F const & f, A & a, int) const - { - unwrapper::unwrap(f, 0)(a[base_type::a1_]); - } - - template void accept(V & v) const - { - base_type::accept(v); - } - - bool operator==(list1 const & rhs) const - { - return ref_compare(base_type::a1_, rhs.a1_, 0); - } -}; - -struct logical_and; -struct logical_or; - -template< class A1, class A2 > class list2: private storage2< A1, A2 > -{ -private: - - typedef storage2< A1, A2 > base_type; - -public: - - list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {} - - A1 operator[] (boost::arg<1>) const { return base_type::a1_; } - A2 operator[] (boost::arg<2>) const { return base_type::a2_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } - - template T & operator[] (_bi::value & v) const { return v.get(); } - - template T const & operator[] (_bi::value const & v) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - - template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } - - template R operator()(type, F & f, A & a, long) - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); - } - - template R operator()(type, F const & f, A & a, long) const - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); - } - - template void operator()(type, F & f, A & a, int) - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); - } - - template void operator()(type, F const & f, A & a, int) const - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); - } - - template bool operator()( type, logical_and & /*f*/, A & a, int ) - { - return a[ base_type::a1_ ] && a[ base_type::a2_ ]; - } - - template bool operator()( type, logical_and const & /*f*/, A & a, int ) const - { - return a[ base_type::a1_ ] && a[ base_type::a2_ ]; - } - - template bool operator()( type, logical_or & /*f*/, A & a, int ) - { - return a[ base_type::a1_ ] || a[ base_type::a2_ ]; - } - - template bool operator()( type, logical_or const & /*f*/, A & a, int ) const - { - return a[ base_type::a1_ ] || a[ base_type::a2_ ]; - } - - template void accept(V & v) const - { - base_type::accept(v); - } - - bool operator==(list2 const & rhs) const - { - return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0); - } -}; - -template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 > -{ -private: - - typedef storage3< A1, A2, A3 > base_type; - -public: - - list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {} - - A1 operator[] (boost::arg<1>) const { return base_type::a1_; } - A2 operator[] (boost::arg<2>) const { return base_type::a2_; } - A3 operator[] (boost::arg<3>) const { return base_type::a3_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } - - template T & operator[] (_bi::value & v) const { return v.get(); } - - template T const & operator[] (_bi::value const & v) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - - template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } - - template R operator()(type, F & f, A & a, long) - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); - } - - template R operator()(type, F const & f, A & a, long) const - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); - } - - template void operator()(type, F & f, A & a, int) - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); - } - - template void operator()(type, F const & f, A & a, int) const - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); - } - - template void accept(V & v) const - { - base_type::accept(v); - } - - bool operator==(list3 const & rhs) const - { - return - - ref_compare( base_type::a1_, rhs.a1_, 0 ) && - ref_compare( base_type::a2_, rhs.a2_, 0 ) && - ref_compare( base_type::a3_, rhs.a3_, 0 ); - } -}; - -template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 > -{ -private: - - typedef storage4< A1, A2, A3, A4 > base_type; - -public: - - list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {} - - A1 operator[] (boost::arg<1>) const { return base_type::a1_; } - A2 operator[] (boost::arg<2>) const { return base_type::a2_; } - A3 operator[] (boost::arg<3>) const { return base_type::a3_; } - A4 operator[] (boost::arg<4>) const { return base_type::a4_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } - - template T & operator[] (_bi::value & v) const { return v.get(); } - - template T const & operator[] (_bi::value const & v) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - - template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } - - template R operator()(type, F & f, A & a, long) - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); - } - - template R operator()(type, F const & f, A & a, long) const - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); - } - - template void operator()(type, F & f, A & a, int) - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); - } - - template void operator()(type, F const & f, A & a, int) const - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); - } - - template void accept(V & v) const - { - base_type::accept(v); - } - - bool operator==(list4 const & rhs) const - { - return - - ref_compare( base_type::a1_, rhs.a1_, 0 ) && - ref_compare( base_type::a2_, rhs.a2_, 0 ) && - ref_compare( base_type::a3_, rhs.a3_, 0 ) && - ref_compare( base_type::a4_, rhs.a4_, 0 ); - } -}; - -template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 > -{ -private: - - typedef storage5< A1, A2, A3, A4, A5 > base_type; - -public: - - list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {} - - A1 operator[] (boost::arg<1>) const { return base_type::a1_; } - A2 operator[] (boost::arg<2>) const { return base_type::a2_; } - A3 operator[] (boost::arg<3>) const { return base_type::a3_; } - A4 operator[] (boost::arg<4>) const { return base_type::a4_; } - A5 operator[] (boost::arg<5>) const { return base_type::a5_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } - - template T & operator[] (_bi::value & v) const { return v.get(); } - - template T const & operator[] (_bi::value const & v) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - - template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } - - template R operator()(type, F & f, A & a, long) - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); - } - - template R operator()(type, F const & f, A & a, long) const - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); - } - - template void operator()(type, F & f, A & a, int) - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); - } - - template void operator()(type, F const & f, A & a, int) const - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); - } - - template void accept(V & v) const - { - base_type::accept(v); - } - - bool operator==(list5 const & rhs) const - { - return - - ref_compare( base_type::a1_, rhs.a1_, 0 ) && - ref_compare( base_type::a2_, rhs.a2_, 0 ) && - ref_compare( base_type::a3_, rhs.a3_, 0 ) && - ref_compare( base_type::a4_, rhs.a4_, 0 ) && - ref_compare( base_type::a5_, rhs.a5_, 0 ); - } -}; - -template class list6: private storage6< A1, A2, A3, A4, A5, A6 > -{ -private: - - typedef storage6< A1, A2, A3, A4, A5, A6 > base_type; - -public: - - list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {} - - A1 operator[] (boost::arg<1>) const { return base_type::a1_; } - A2 operator[] (boost::arg<2>) const { return base_type::a2_; } - A3 operator[] (boost::arg<3>) const { return base_type::a3_; } - A4 operator[] (boost::arg<4>) const { return base_type::a4_; } - A5 operator[] (boost::arg<5>) const { return base_type::a5_; } - A6 operator[] (boost::arg<6>) const { return base_type::a6_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } - - template T & operator[] (_bi::value & v) const { return v.get(); } - - template T const & operator[] (_bi::value const & v) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - - template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } - - template R operator()(type, F & f, A & a, long) - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); - } - - template R operator()(type, F const & f, A & a, long) const - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); - } - - template void operator()(type, F & f, A & a, int) - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); - } - - template void operator()(type, F const & f, A & a, int) const - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); - } - - template void accept(V & v) const - { - base_type::accept(v); - } - - bool operator==(list6 const & rhs) const - { - return - - ref_compare( base_type::a1_, rhs.a1_, 0 ) && - ref_compare( base_type::a2_, rhs.a2_, 0 ) && - ref_compare( base_type::a3_, rhs.a3_, 0 ) && - ref_compare( base_type::a4_, rhs.a4_, 0 ) && - ref_compare( base_type::a5_, rhs.a5_, 0 ) && - ref_compare( base_type::a6_, rhs.a6_, 0 ); - } -}; - -template class list7: private storage7< A1, A2, A3, A4, A5, A6, A7 > -{ -private: - - typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type; - -public: - - list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {} - - A1 operator[] (boost::arg<1>) const { return base_type::a1_; } - A2 operator[] (boost::arg<2>) const { return base_type::a2_; } - A3 operator[] (boost::arg<3>) const { return base_type::a3_; } - A4 operator[] (boost::arg<4>) const { return base_type::a4_; } - A5 operator[] (boost::arg<5>) const { return base_type::a5_; } - A6 operator[] (boost::arg<6>) const { return base_type::a6_; } - A7 operator[] (boost::arg<7>) const { return base_type::a7_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } - A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } - - template T & operator[] (_bi::value & v) const { return v.get(); } - - template T const & operator[] (_bi::value const & v) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - - template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } - - template R operator()(type, F & f, A & a, long) - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); - } - - template R operator()(type, F const & f, A & a, long) const - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); - } - - template void operator()(type, F & f, A & a, int) - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); - } - - template void operator()(type, F const & f, A & a, int) const - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); - } - - template void accept(V & v) const - { - base_type::accept(v); - } - - bool operator==(list7 const & rhs) const - { - return - - ref_compare( base_type::a1_, rhs.a1_, 0 ) && - ref_compare( base_type::a2_, rhs.a2_, 0 ) && - ref_compare( base_type::a3_, rhs.a3_, 0 ) && - ref_compare( base_type::a4_, rhs.a4_, 0 ) && - ref_compare( base_type::a5_, rhs.a5_, 0 ) && - ref_compare( base_type::a6_, rhs.a6_, 0 ) && - ref_compare( base_type::a7_, rhs.a7_, 0 ); - } -}; - -template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class list8: private storage8< A1, A2, A3, A4, A5, A6, A7, A8 > -{ -private: - - typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type; - -public: - - list8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8 ) {} - - A1 operator[] (boost::arg<1>) const { return base_type::a1_; } - A2 operator[] (boost::arg<2>) const { return base_type::a2_; } - A3 operator[] (boost::arg<3>) const { return base_type::a3_; } - A4 operator[] (boost::arg<4>) const { return base_type::a4_; } - A5 operator[] (boost::arg<5>) const { return base_type::a5_; } - A6 operator[] (boost::arg<6>) const { return base_type::a6_; } - A7 operator[] (boost::arg<7>) const { return base_type::a7_; } - A8 operator[] (boost::arg<8>) const { return base_type::a8_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } - A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } - A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } - - template T & operator[] (_bi::value & v) const { return v.get(); } - - template T const & operator[] (_bi::value const & v) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - - template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } - - template R operator()(type, F & f, A & a, long) - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); - } - - template R operator()(type, F const & f, A & a, long) const - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); - } - - template void operator()(type, F & f, A & a, int) - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); - } - - template void operator()(type, F const & f, A & a, int) const - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); - } - - template void accept(V & v) const - { - base_type::accept(v); - } - - bool operator==(list8 const & rhs) const - { - return - - ref_compare( base_type::a1_, rhs.a1_, 0 ) && - ref_compare( base_type::a2_, rhs.a2_, 0 ) && - ref_compare( base_type::a3_, rhs.a3_, 0 ) && - ref_compare( base_type::a4_, rhs.a4_, 0 ) && - ref_compare( base_type::a5_, rhs.a5_, 0 ) && - ref_compare( base_type::a6_, rhs.a6_, 0 ) && - ref_compare( base_type::a7_, rhs.a7_, 0 ) && - ref_compare( base_type::a8_, rhs.a8_, 0 ); - } -}; - -template class list9: private storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > -{ -private: - - typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type; - -public: - - list9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) {} - - A1 operator[] (boost::arg<1>) const { return base_type::a1_; } - A2 operator[] (boost::arg<2>) const { return base_type::a2_; } - A3 operator[] (boost::arg<3>) const { return base_type::a3_; } - A4 operator[] (boost::arg<4>) const { return base_type::a4_; } - A5 operator[] (boost::arg<5>) const { return base_type::a5_; } - A6 operator[] (boost::arg<6>) const { return base_type::a6_; } - A7 operator[] (boost::arg<7>) const { return base_type::a7_; } - A8 operator[] (boost::arg<8>) const { return base_type::a8_; } - A9 operator[] (boost::arg<9>) const { return base_type::a9_; } - - A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } - A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } - A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } - A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } - A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } - A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } - A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } - A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } - A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; } - - template T & operator[] (_bi::value & v) const { return v.get(); } - - template T const & operator[] (_bi::value const & v) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } - - template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } - - template R operator()(type, F & f, A & a, long) - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); - } - - template R operator()(type, F const & f, A & a, long) const - { - return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); - } - - template void operator()(type, F & f, A & a, int) - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); - } - - template void operator()(type, F const & f, A & a, int) const - { - unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); - } - - template void accept(V & v) const - { - base_type::accept(v); - } - - bool operator==(list9 const & rhs) const - { - return - - ref_compare( base_type::a1_, rhs.a1_, 0 ) && - ref_compare( base_type::a2_, rhs.a2_, 0 ) && - ref_compare( base_type::a3_, rhs.a3_, 0 ) && - ref_compare( base_type::a4_, rhs.a4_, 0 ) && - ref_compare( base_type::a5_, rhs.a5_, 0 ) && - ref_compare( base_type::a6_, rhs.a6_, 0 ) && - ref_compare( base_type::a7_, rhs.a7_, 0 ) && - ref_compare( base_type::a8_, rhs.a8_, 0 ) && - ref_compare( base_type::a9_, rhs.a9_, 0 ); - } -}; - -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif - -// bind_t - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -template< class A1 > class rrlist1 -{ -private: - - A1 & a1_; // not A1&& because of msvc-10.0 - -public: - - explicit rrlist1( A1 & a1 ): a1_( a1 ) {} - - A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } // not static_cast because of g++ 4.9 - - A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } - - template T & operator[] ( _bi::value & v ) const { return v.get(); } - - template T const & operator[] ( _bi::value const & v ) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const - { - rrlist1 a( a1_ ); - return b.eval( a ); - } - - template typename result_traits::type operator[] (bind_t const & b) const - { - rrlist1 a( a1_ ); - return b.eval( a ); - } -}; - -template< class A1, class A2 > class rrlist2 -{ -private: - - A1 & a1_; - A2 & a2_; - -public: - - rrlist2( A1 & a1, A2 & a2 ): a1_( a1 ), a2_( a2 ) {} - - A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } - - A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } - - template T & operator[] ( _bi::value & v ) const { return v.get(); } - - template T const & operator[] ( _bi::value const & v ) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const - { - rrlist2 a( a1_, a2_ ); - return b.eval( a ); - } - - template typename result_traits::type operator[] (bind_t const & b) const - { - rrlist2 a( a1_, a2_ ); - return b.eval( a ); - } -}; - -template< class A1, class A2, class A3 > class rrlist3 -{ -private: - - A1 & a1_; - A2 & a2_; - A3 & a3_; - -public: - - rrlist3( A1 & a1, A2 & a2, A3 & a3 ): a1_( a1 ), a2_( a2 ), a3_( a3 ) {} - - A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } - - A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } - - template T & operator[] ( _bi::value & v ) const { return v.get(); } - - template T const & operator[] ( _bi::value const & v ) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const - { - rrlist3 a( a1_, a2_, a3_ ); - return b.eval( a ); - } - - template typename result_traits::type operator[] (bind_t const & b) const - { - rrlist3 a( a1_, a2_, a3_ ); - return b.eval( a ); - } -}; - -template< class A1, class A2, class A3, class A4 > class rrlist4 -{ -private: - - A1 & a1_; - A2 & a2_; - A3 & a3_; - A4 & a4_; - -public: - - rrlist4( A1 & a1, A2 & a2, A3 & a3, A4 & a4 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ) {} - - A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } - - A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } - - template T & operator[] ( _bi::value & v ) const { return v.get(); } - - template T const & operator[] ( _bi::value const & v ) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const - { - rrlist4 a( a1_, a2_, a3_, a4_ ); - return b.eval( a ); - } - - template typename result_traits::type operator[] (bind_t const & b) const - { - rrlist4 a( a1_, a2_, a3_, a4_ ); - return b.eval( a ); - } -}; - -template< class A1, class A2, class A3, class A4, class A5 > class rrlist5 -{ -private: - - A1 & a1_; - A2 & a2_; - A3 & a3_; - A4 & a4_; - A5 & a5_; - -public: - - rrlist5( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ) {} - - A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } - A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } - - A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } - A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } - - template T & operator[] ( _bi::value & v ) const { return v.get(); } - - template T const & operator[] ( _bi::value const & v ) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const - { - rrlist5 a( a1_, a2_, a3_, a4_, a5_ ); - return b.eval( a ); - } - - template typename result_traits::type operator[] (bind_t const & b) const - { - rrlist5 a( a1_, a2_, a3_, a4_, a5_ ); - return b.eval( a ); - } -}; - -template< class A1, class A2, class A3, class A4, class A5, class A6 > class rrlist6 -{ -private: - - A1 & a1_; - A2 & a2_; - A3 & a3_; - A4 & a4_; - A5 & a5_; - A6 & a6_; - -public: - - rrlist6( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ) {} - - A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } - A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } - A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } - - A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } - A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } - A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } - - template T & operator[] ( _bi::value & v ) const { return v.get(); } - - template T const & operator[] ( _bi::value const & v ) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const - { - rrlist6 a( a1_, a2_, a3_, a4_, a5_, a6_ ); - return b.eval( a ); - } - - template typename result_traits::type operator[] (bind_t const & b) const - { - rrlist6 a( a1_, a2_, a3_, a4_, a5_, a6_ ); - return b.eval( a ); - } -}; - -template< class A1, class A2, class A3, class A4, class A5, class A6, class A7 > class rrlist7 -{ -private: - - A1 & a1_; - A2 & a2_; - A3 & a3_; - A4 & a4_; - A5 & a5_; - A6 & a6_; - A7 & a7_; - -public: - - rrlist7( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ) {} - - A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } - A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } - A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } - A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } - - A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } - A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } - A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } - A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } - - template T & operator[] ( _bi::value & v ) const { return v.get(); } - - template T const & operator[] ( _bi::value const & v ) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const - { - rrlist7 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ ); - return b.eval( a ); - } - - template typename result_traits::type operator[] (bind_t const & b) const - { - rrlist7 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ ); - return b.eval( a ); - } -}; - -template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class rrlist8 -{ -private: - - A1 & a1_; - A2 & a2_; - A3 & a3_; - A4 & a4_; - A5 & a5_; - A6 & a6_; - A7 & a7_; - A8 & a8_; - -public: - - rrlist8( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ) {} - - A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } - A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } - A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } - A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } - A8 && operator[] (boost::arg<8>) const { return std::forward( a8_ ); } - - A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } - A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } - A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } - A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } - A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward( a8_ ); } - - template T & operator[] ( _bi::value & v ) const { return v.get(); } - - template T const & operator[] ( _bi::value const & v ) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const - { - rrlist8 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ ); - return b.eval( a ); - } - - template typename result_traits::type operator[] (bind_t const & b) const - { - rrlist8 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ ); - return b.eval( a ); - } -}; - -template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > class rrlist9 -{ -private: - - A1 & a1_; - A2 & a2_; - A3 & a3_; - A4 & a4_; - A5 & a5_; - A6 & a6_; - A7 & a7_; - A8 & a8_; - A9 & a9_; - -public: - - rrlist9( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ), a9_( a9 ) {} - - A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } - A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } - A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } - A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } - A8 && operator[] (boost::arg<8>) const { return std::forward( a8_ ); } - A9 && operator[] (boost::arg<9>) const { return std::forward( a9_ ); } - - A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } - A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } - A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } - A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } - A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } - A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } - A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } - A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward( a8_ ); } - A9 && operator[] (boost::arg<9> (*) ()) const { return std::forward( a9_ ); } - - template T & operator[] ( _bi::value & v ) const { return v.get(); } - - template T const & operator[] ( _bi::value const & v ) const { return v.get(); } - - template T & operator[] (reference_wrapper const & v) const { return v.get(); } - - template typename result_traits::type operator[] (bind_t & b) const - { - rrlist9 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ ); - return b.eval( a ); - } - - template typename result_traits::type operator[] (bind_t const & b) const - { - rrlist9 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ ); - return b.eval( a ); - } -}; - -template class bind_t -{ -private: - - F f_; - L l_; - -public: - - typedef typename result_traits::type result_type; - typedef bind_t this_type; - - bind_t( F f, L const & l ): f_( f ), l_( l ) {} - - // - - result_type operator()() - { - list0 a; - return l_( type(), f_, a, 0 ); - } - - result_type operator()() const - { - list0 a; - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1 ) - { - rrlist1< A1 > a( a1 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1 ) const - { - rrlist1< A1 > a( a1 ); - return l_(type(), f_, a, 0); - } - - template result_type operator()( A1 && a1, A2 && a2 ) - { - rrlist2< A1, A2 > a( a1, a2 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2 ) const - { - rrlist2< A1, A2 > a( a1, a2 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) - { - rrlist3< A1, A2, A3 > a( a1, a2, a3 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) const - { - rrlist3< A1, A2, A3 > a( a1, a2, a3 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) - { - rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) const - { - rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) - { - rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) const - { - rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) - { - rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) const - { - rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) - { - rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) const - { - rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) - { - rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) const - { - rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) - { - rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); - return l_( type(), f_, a, 0 ); - } - - template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) const - { - rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); - return l_( type(), f_, a, 0 ); - } - - // - - template result_type eval( A & a ) - { - return l_( type(), f_, a, 0 ); - } - - template result_type eval( A & a ) const - { - return l_( type(), f_, a, 0 ); - } - - template void accept( V & v ) const - { -#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) - using boost::visit_each; -#endif - - BOOST_BIND_VISIT_EACH( v, f_, 0 ); - l_.accept( v ); - } - - bool compare( this_type const & rhs ) const - { - return ref_compare( f_, rhs.f_, 0 ) && l_ == rhs.l_; - } -}; - -#elif !defined( BOOST_NO_VOID_RETURNS ) - -template class bind_t -{ -public: - - typedef bind_t this_type; - - bind_t(F f, L const & l): f_(f), l_(l) {} - -#define BOOST_BIND_RETURN return -#include -#undef BOOST_BIND_RETURN - -}; - -#else // no void returns - -template struct bind_t_generator -{ - -template class implementation -{ -public: - - typedef implementation this_type; - - implementation(F f, L const & l): f_(f), l_(l) {} - -#define BOOST_BIND_RETURN return -#include -#undef BOOST_BIND_RETURN - -}; - -}; - -template<> struct bind_t_generator -{ - -template class implementation -{ -private: - - typedef void R; - -public: - - typedef implementation this_type; - - implementation(F f, L const & l): f_(f), l_(l) {} - -#define BOOST_BIND_RETURN -#include -#undef BOOST_BIND_RETURN - -}; - -}; - -template class bind_t: public bind_t_generator::BOOST_NESTED_TEMPLATE implementation -{ -public: - - bind_t(F f, L const & l): bind_t_generator::BOOST_NESTED_TEMPLATE implementation(f, l) {} - -}; - -#endif - -// function_equal - -#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP - -// put overloads in _bi, rely on ADL - -# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - -template bool function_equal( bind_t const & a, bind_t const & b ) -{ - return a.compare(b); -} - -# else - -template bool function_equal_impl( bind_t const & a, bind_t const & b, int ) -{ - return a.compare(b); -} - -# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - -#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP - -// put overloads in boost - -} // namespace _bi - -# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - -template bool function_equal( _bi::bind_t const & a, _bi::bind_t const & b ) -{ - return a.compare(b); -} - -# else - -template bool function_equal_impl( _bi::bind_t const & a, _bi::bind_t const & b, int ) -{ - return a.compare(b); -} - -# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING - -namespace _bi -{ - -#endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP - -// add_value - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530) - -#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x582) ) - -template struct add_value -{ - typedef _bi::value type; -}; - -#else - -template< class T, int I > struct add_value_2 -{ - typedef boost::arg type; -}; - -template< class T > struct add_value_2< T, 0 > -{ - typedef _bi::value< T > type; -}; - -template struct add_value -{ - typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type; -}; - -#endif - -template struct add_value< value > -{ - typedef _bi::value type; -}; - -template struct add_value< reference_wrapper > -{ - typedef reference_wrapper type; -}; - -template struct add_value< arg > -{ - typedef boost::arg type; -}; - -template struct add_value< arg (*) () > -{ - typedef boost::arg (*type) (); -}; - -template struct add_value< bind_t > -{ - typedef bind_t type; -}; - -#else - -template struct _avt_0; - -template<> struct _avt_0<1> -{ - template struct inner - { - typedef T type; - }; -}; - -template<> struct _avt_0<2> -{ - template struct inner - { - typedef value type; - }; -}; - -typedef char (&_avt_r1) [1]; -typedef char (&_avt_r2) [2]; - -template _avt_r1 _avt_f(value); -template _avt_r1 _avt_f(reference_wrapper); -template _avt_r1 _avt_f(arg); -template _avt_r1 _avt_f(arg (*) ()); -template _avt_r1 _avt_f(bind_t); - -_avt_r2 _avt_f(...); - -template struct add_value -{ - static T t(); - typedef typename _avt_0::template inner::type type; -}; - -#endif - -// list_av_N - -template struct list_av_1 -{ - typedef typename add_value::type B1; - typedef list1 type; -}; - -template struct list_av_2 -{ - typedef typename add_value::type B1; - typedef typename add_value::type B2; - typedef list2 type; -}; - -template struct list_av_3 -{ - typedef typename add_value::type B1; - typedef typename add_value::type B2; - typedef typename add_value::type B3; - typedef list3 type; -}; - -template struct list_av_4 -{ - typedef typename add_value::type B1; - typedef typename add_value::type B2; - typedef typename add_value::type B3; - typedef typename add_value::type B4; - typedef list4 type; -}; - -template struct list_av_5 -{ - typedef typename add_value::type B1; - typedef typename add_value::type B2; - typedef typename add_value::type B3; - typedef typename add_value::type B4; - typedef typename add_value::type B5; - typedef list5 type; -}; - -template struct list_av_6 -{ - typedef typename add_value::type B1; - typedef typename add_value::type B2; - typedef typename add_value::type B3; - typedef typename add_value::type B4; - typedef typename add_value::type B5; - typedef typename add_value::type B6; - typedef list6 type; -}; - -template struct list_av_7 -{ - typedef typename add_value::type B1; - typedef typename add_value::type B2; - typedef typename add_value::type B3; - typedef typename add_value::type B4; - typedef typename add_value::type B5; - typedef typename add_value::type B6; - typedef typename add_value::type B7; - typedef list7 type; -}; - -template struct list_av_8 -{ - typedef typename add_value::type B1; - typedef typename add_value::type B2; - typedef typename add_value::type B3; - typedef typename add_value::type B4; - typedef typename add_value::type B5; - typedef typename add_value::type B6; - typedef typename add_value::type B7; - typedef typename add_value::type B8; - typedef list8 type; -}; - -template struct list_av_9 -{ - typedef typename add_value::type B1; - typedef typename add_value::type B2; - typedef typename add_value::type B3; - typedef typename add_value::type B4; - typedef typename add_value::type B5; - typedef typename add_value::type B6; - typedef typename add_value::type B7; - typedef typename add_value::type B8; - typedef typename add_value::type B9; - typedef list9 type; -}; - -// operator! - -struct logical_not -{ - template bool operator()(V const & v) const { return !v; } -}; - -template - bind_t< bool, logical_not, list1< bind_t > > - operator! (bind_t const & f) -{ - typedef list1< bind_t > list_type; - return bind_t ( logical_not(), list_type(f) ); -} - -// relational operators - -#define BOOST_BIND_OPERATOR( op, name ) \ -\ -struct name \ -{ \ - template bool operator()(V const & v, W const & w) const { return v op w; } \ -}; \ - \ -template \ - bind_t< bool, name, list2< bind_t, typename add_value::type > > \ - operator op (bind_t const & f, A2 a2) \ -{ \ - typedef typename add_value::type B2; \ - typedef list2< bind_t, B2> list_type; \ - return bind_t ( name(), list_type(f, a2) ); \ -} - -BOOST_BIND_OPERATOR( ==, equal ) -BOOST_BIND_OPERATOR( !=, not_equal ) - -BOOST_BIND_OPERATOR( <, less ) -BOOST_BIND_OPERATOR( <=, less_equal ) - -BOOST_BIND_OPERATOR( >, greater ) -BOOST_BIND_OPERATOR( >=, greater_equal ) - -BOOST_BIND_OPERATOR( &&, logical_and ) -BOOST_BIND_OPERATOR( ||, logical_or ) - -#undef BOOST_BIND_OPERATOR - -#if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) - -// resolve ambiguity with rel_ops - -#define BOOST_BIND_OPERATOR( op, name ) \ -\ -template \ - bind_t< bool, name, list2< bind_t, bind_t > > \ - operator op (bind_t const & f, bind_t const & g) \ -{ \ - typedef list2< bind_t, bind_t > list_type; \ - return bind_t ( name(), list_type(f, g) ); \ -} - -BOOST_BIND_OPERATOR( !=, not_equal ) -BOOST_BIND_OPERATOR( <=, less_equal ) -BOOST_BIND_OPERATOR( >, greater ) -BOOST_BIND_OPERATOR( >=, greater_equal ) - -#endif - -// visit_each, ADL - -#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) \ - && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) - -template void visit_each( V & v, value const & t, int ) -{ - using boost::visit_each; - BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); -} - -template void visit_each( V & v, bind_t const & t, int ) -{ - t.accept( v ); -} - -#endif - -} // namespace _bi - -// visit_each, no ADL - -#if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ ) \ - || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) - -template void visit_each( V & v, _bi::value const & t, int ) -{ - BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); -} - -template void visit_each( V & v, _bi::bind_t const & t, int ) -{ - t.accept( v ); -} - -#endif - -// is_bind_expression - -template< class T > struct is_bind_expression -{ - enum _vt { value = 0 }; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > > -{ - enum _vt { value = 1 }; -}; - -#endif - -// bind - -#ifndef BOOST_BIND -#define BOOST_BIND bind -#endif - -// generic function objects - -template - _bi::bind_t - BOOST_BIND(F f) -{ - typedef _bi::list0 list_type; - return _bi::bind_t (f, list_type()); -} - -template - _bi::bind_t::type> - BOOST_BIND(F f, A1 a1) -{ - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t (f, list_type(a1)); -} - -template - _bi::bind_t::type> - BOOST_BIND(F f, A1 a1, A2 a2) -{ - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t (f, list_type(a1, a2)); -} - -template - _bi::bind_t::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) -{ - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3)); -} - -template - _bi::bind_t::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4)); -} - -template - _bi::bind_t::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); -} - -template - _bi::bind_t::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); -} - -template - _bi::bind_t::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template - _bi::bind_t::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template - _bi::bind_t::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -// generic function objects, alternative syntax - -template - _bi::bind_t - BOOST_BIND(boost::type, F f) -{ - typedef _bi::list0 list_type; - return _bi::bind_t (f, list_type()); -} - -template - _bi::bind_t::type> - BOOST_BIND(boost::type, F f, A1 a1) -{ - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t (f, list_type(a1)); -} - -template - _bi::bind_t::type> - BOOST_BIND(boost::type, F f, A1 a1, A2 a2) -{ - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t (f, list_type(a1, a2)); -} - -template - _bi::bind_t::type> - BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3) -{ - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3)); -} - -template - _bi::bind_t::type> - BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4)); -} - -template - _bi::bind_t::type> - BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); -} - -template - _bi::bind_t::type> - BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); -} - -template - _bi::bind_t::type> - BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template - _bi::bind_t::type> - BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template - _bi::bind_t::type> - BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - -// adaptable function objects - -template - _bi::bind_t<_bi::unspecified, F, _bi::list0> - BOOST_BIND(F f) -{ - typedef _bi::list0 list_type; - return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type()); -} - -template - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1::type> - BOOST_BIND(F f, A1 a1) -{ - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1)); -} - -template - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2::type> - BOOST_BIND(F f, A1 a1, A2 a2) -{ - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2)); -} - -template - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) -{ - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3)); -} - -template - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4)); -} - -template - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); -} - -template - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); -} - -template - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template - _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9::type> - BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - -// function pointers - -#define BOOST_BIND_CC -#define BOOST_BIND_ST -#define BOOST_BIND_NOEXCEPT - -#include - -# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) -# undef BOOST_BIND_NOEXCEPT -# define BOOST_BIND_NOEXCEPT noexcept -# include -# endif - -#undef BOOST_BIND_CC -#undef BOOST_BIND_ST -#undef BOOST_BIND_NOEXCEPT - -#ifdef BOOST_BIND_ENABLE_STDCALL - -#define BOOST_BIND_CC __stdcall -#define BOOST_BIND_ST -#define BOOST_BIND_NOEXCEPT - -#include - -#undef BOOST_BIND_CC -#undef BOOST_BIND_ST -#undef BOOST_BIND_NOEXCEPT - -#endif - -#ifdef BOOST_BIND_ENABLE_FASTCALL - -#define BOOST_BIND_CC __fastcall -#define BOOST_BIND_ST -#define BOOST_BIND_NOEXCEPT - -#include - -#undef BOOST_BIND_CC -#undef BOOST_BIND_ST -#undef BOOST_BIND_NOEXCEPT - -#endif - -#ifdef BOOST_BIND_ENABLE_PASCAL - -#define BOOST_BIND_ST pascal -#define BOOST_BIND_CC -#define BOOST_BIND_NOEXCEPT - -#include - -#undef BOOST_BIND_ST -#undef BOOST_BIND_CC -#undef BOOST_BIND_NOEXCEPT - -#endif - -// member function pointers - -#define BOOST_BIND_MF_NAME(X) X -#define BOOST_BIND_MF_CC -#define BOOST_BIND_MF_NOEXCEPT - -#include -#include - -# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) -# undef BOOST_BIND_MF_NOEXCEPT -# define BOOST_BIND_MF_NOEXCEPT noexcept -# include -# endif - -#undef BOOST_BIND_MF_NAME -#undef BOOST_BIND_MF_CC -#undef BOOST_BIND_MF_NOEXCEPT - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_BIND_MF_NAME(X) X##_cdecl -#define BOOST_BIND_MF_CC __cdecl -#define BOOST_BIND_MF_NOEXCEPT - -#include -#include - -#undef BOOST_BIND_MF_NAME -#undef BOOST_BIND_MF_CC -#undef BOOST_BIND_MF_NOEXCEPT - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_BIND_MF_NAME(X) X##_stdcall -#define BOOST_BIND_MF_CC __stdcall -#define BOOST_BIND_MF_NOEXCEPT - -#include -#include - -#undef BOOST_BIND_MF_NAME -#undef BOOST_BIND_MF_CC -#undef BOOST_BIND_MF_NOEXCEPT - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_BIND_MF_NAME(X) X##_fastcall -#define BOOST_BIND_MF_CC __fastcall -#define BOOST_BIND_MF_NOEXCEPT - -#include -#include - -#undef BOOST_BIND_MF_NAME -#undef BOOST_BIND_MF_CC -#undef BOOST_BIND_MF_NOEXCEPT - -#endif - -// data member pointers - -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x620 ) ) ) - -template -_bi::bind_t< R, _mfi::dm, typename _bi::list_av_1::type > - BOOST_BIND(R T::*f, A1 a1) -{ - typedef _mfi::dm F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t( F(f), list_type(a1) ); -} - -#else - -namespace _bi -{ - -template< class Pm, int I > struct add_cref; - -template< class M, class T > struct add_cref< M T::*, 0 > -{ - typedef M type; -}; - -template< class M, class T > struct add_cref< M T::*, 1 > -{ -#ifdef BOOST_MSVC -#pragma warning(push) -#pragma warning(disable:4180) -#endif - typedef M const & type; -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif -}; - -template< class R, class T > struct add_cref< R (T::*) (), 1 > -{ - typedef void type; -}; - -#if !defined(__IBMCPP__) || __IBMCPP_FUNC_CV_TMPL_ARG_DEDUCTION - -template< class R, class T > struct add_cref< R (T::*) () const, 1 > -{ - typedef void type; -}; - -#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) - -template< class R, class T > struct add_cref< R (T::*) () const noexcept, 1 > -{ - typedef void type; -}; - -#endif // __cpp_noexcept_function_type - -#endif // __IBMCPP__ - -template struct isref -{ - enum value_type { value = 0 }; -}; - -template struct isref< R& > -{ - enum value_type { value = 1 }; -}; - -template struct isref< R* > -{ - enum value_type { value = 1 }; -}; - -template struct dm_result -{ - typedef typename add_cref< Pm, 1 >::type type; -}; - -template struct dm_result< Pm, bind_t > -{ - typedef typename bind_t::result_type result_type; - typedef typename add_cref< Pm, isref< result_type >::value >::type type; -}; - -} // namespace _bi - -template< class A1, class M, class T > - -_bi::bind_t< - typename _bi::dm_result< M T::*, A1 >::type, - _mfi::dm, - typename _bi::list_av_1::type -> - -BOOST_BIND( M T::*f, A1 a1 ) -{ - typedef typename _bi::dm_result< M T::*, A1 >::type result_type; - typedef _mfi::dm F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) ); -} - -#endif - -} // namespace boost - -#ifndef BOOST_BIND_NO_PLACEHOLDERS - -# include - -#endif - -#ifdef BOOST_MSVC -# pragma warning(default: 4512) // assignment operator could not be generated -# pragma warning(pop) -#endif - -#endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED diff --git a/libraries/boost/include/boost/bind/bind_cc.hpp b/libraries/boost/include/boost/bind/bind_cc.hpp deleted file mode 100644 index 278aa9a2a8..0000000000 --- a/libraries/boost/include/boost/bind/bind_cc.hpp +++ /dev/null @@ -1,117 +0,0 @@ -// -// bind/bind_cc.hpp - support for different calling conventions -// -// Do not include this header directly. -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/bind.html for documentation. -// - -template - _bi::bind_t - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) () BOOST_BIND_NOEXCEPT) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) () BOOST_BIND_NOEXCEPT; - typedef _bi::list0 list_type; - return _bi::bind_t (f, list_type()); -} - -template - _bi::bind_t::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1) BOOST_BIND_NOEXCEPT, A1 a1) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1) BOOST_BIND_NOEXCEPT; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t (f, list_type(a1)); -} - -template - _bi::bind_t::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2) BOOST_BIND_NOEXCEPT; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t (f, list_type(a1, a2)); -} - -template - _bi::bind_t::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3) BOOST_BIND_NOEXCEPT; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3)); -} - -template - _bi::bind_t::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4) BOOST_BIND_NOEXCEPT; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4)); -} - -template - _bi::bind_t::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5) BOOST_BIND_NOEXCEPT; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); -} - -template - _bi::bind_t::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6) BOOST_BIND_NOEXCEPT; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); -} - -template - _bi::bind_t::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_NOEXCEPT; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template - _bi::bind_t::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_NOEXCEPT; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template - _bi::bind_t::type> - BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8, B9) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8, B9) BOOST_BIND_NOEXCEPT; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} diff --git a/libraries/boost/include/boost/bind/bind_mf2_cc.hpp b/libraries/boost/include/boost/bind/bind_mf2_cc.hpp deleted file mode 100644 index 66476bc19d..0000000000 --- a/libraries/boost/include/boost/bind/bind_mf2_cc.hpp +++ /dev/null @@ -1,228 +0,0 @@ -// -// bind/bind_mf2_cc.hpp - member functions, type<> syntax -// -// Do not include this header directly. -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/bind/bind.html for documentation. -// - -// 0 - -template - _bi::bind_t, typename _bi::list_av_1::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (), A1 a1) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf0) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); -} - -template - _bi::bind_t, typename _bi::list_av_1::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) () const, A1 a1) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf0) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); -} - -// 1 - -template - _bi::bind_t, typename _bi::list_av_2::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1), A1 a1, A2 a2) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf1) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); -} - -template - _bi::bind_t, typename _bi::list_av_2::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1) const, A1 a1, A2 a2) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf1) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); -} - -// 2 - -template - _bi::bind_t, typename _bi::list_av_3::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2), A1 a1, A2 a2, A3 a3) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf2) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); -} - -template - _bi::bind_t, typename _bi::list_av_3::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2) const, A1 a1, A2 a2, A3 a3) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf2) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); -} - -// 3 - -template - _bi::bind_t, typename _bi::list_av_4::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3), A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf3) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); -} - -template - _bi::bind_t, typename _bi::list_av_4::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf3) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); -} - -// 4 - -template - _bi::bind_t, typename _bi::list_av_5::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf4) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); -} - -template - _bi::bind_t, typename _bi::list_av_5::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf4) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); -} - -// 5 - -template - _bi::bind_t, typename _bi::list_av_6::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf5) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); -} - -template - _bi::bind_t, typename _bi::list_av_6::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf5) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); -} - -// 6 - -template - _bi::bind_t, typename _bi::list_av_7::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf6) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template - _bi::bind_t, typename _bi::list_av_7::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf6) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -// 7 - -template - _bi::bind_t, typename _bi::list_av_8::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf7) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template - _bi::bind_t, typename _bi::list_av_8::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf7) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -// 8 - -template - _bi::bind_t, typename _bi::list_av_9::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf8) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -template - _bi::bind_t, typename _bi::list_av_9::type> - BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf8) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} diff --git a/libraries/boost/include/boost/bind/bind_mf_cc.hpp b/libraries/boost/include/boost/bind/bind_mf_cc.hpp deleted file mode 100644 index bbfd3719b6..0000000000 --- a/libraries/boost/include/boost/bind/bind_mf_cc.hpp +++ /dev/null @@ -1,441 +0,0 @@ -// -// bind/bind_mf_cc.hpp - support for different calling conventions -// -// Do not include this header directly. -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/bind.html for documentation. -// - -// 0 - -template - _bi::bind_t, typename _bi::list_av_1::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf0) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); -} - -template - _bi::bind_t, typename _bi::list_av_1::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf0) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_1::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf0) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_1::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf0) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); -} - -// 1 - -template - _bi::bind_t, typename _bi::list_av_2::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf1) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); -} - -template - _bi::bind_t, typename _bi::list_av_2::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf1) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_2::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf1) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_2::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf1) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); -} - -// 2 - -template - _bi::bind_t, typename _bi::list_av_3::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf2) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); -} - -template - _bi::bind_t, typename _bi::list_av_3::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf2) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_3::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf2) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_3::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf2) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); -} - -// 3 - -template - _bi::bind_t, typename _bi::list_av_4::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf3) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); -} - -template - _bi::bind_t, typename _bi::list_av_4::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf3) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_4::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf3) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_4::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf3) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); -} - -// 4 - -template - _bi::bind_t, typename _bi::list_av_5::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf4) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); -} - -template - _bi::bind_t, typename _bi::list_av_5::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf4) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_5::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf4) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_5::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf4) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); -} - -// 5 - -template - _bi::bind_t, typename _bi::list_av_6::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf5) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); -} - -template - _bi::bind_t, typename _bi::list_av_6::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf5) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_6::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf5) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_6::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf5) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); -} - -// 6 - -template - _bi::bind_t, typename _bi::list_av_7::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf6) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template - _bi::bind_t, typename _bi::list_av_7::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf6) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_7::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf6) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_7::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf6) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); -} - -// 7 - -template - _bi::bind_t, typename _bi::list_av_8::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf7) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template - _bi::bind_t, typename _bi::list_av_8::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf7) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_8::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf7) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_8::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf7) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); -} - -// 8 - -template - _bi::bind_t, typename _bi::list_av_9::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf8) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -template - _bi::bind_t, typename _bi::list_av_9::type> - BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf8) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_9::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef _mfi::BOOST_BIND_MF_NAME(mf8) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} - -template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_9::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) -{ - typedef _mfi::BOOST_BIND_MF_NAME(cmf8) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); -} diff --git a/libraries/boost/include/boost/bind/bind_template.hpp b/libraries/boost/include/boost/bind/bind_template.hpp deleted file mode 100644 index 411d20c74e..0000000000 --- a/libraries/boost/include/boost/bind/bind_template.hpp +++ /dev/null @@ -1,345 +0,0 @@ -// -// bind/bind_template.hpp -// -// Do not include this header directly. -// -// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/bind.html for documentation. -// - - typedef typename result_traits::type result_type; - - result_type operator()() - { - list0 a; - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - result_type operator()() const - { - list0 a; - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 & a1) - { - list1 a(a1); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 & a1) const - { - list1 a(a1); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template result_type operator()(A1 const & a1) - { - list1 a(a1); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 const & a1) const - { - list1 a(a1); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#endif - - template result_type operator()(A1 & a1, A2 & a2) - { - list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 & a1, A2 & a2) const - { - list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template result_type operator()(A1 const & a1, A2 & a2) - { - list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 const & a1, A2 & a2) const - { - list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - - template result_type operator()(A1 & a1, A2 const & a2) - { - list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 & a1, A2 const & a2) const - { - list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - - template result_type operator()(A1 const & a1, A2 const & a2) - { - list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 const & a1, A2 const & a2) const - { - list2 a(a1, a2); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#endif - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3) - { - list3 a(a1, a2, a3); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3) const - { - list3 a(a1, a2, a3); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) - { - list3 a(a1, a2, a3); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const - { - list3 a(a1, a2, a3); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#endif - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) - { - list4 a(a1, a2, a3, a4); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const - { - list4 a(a1, a2, a3, a4); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) - { - list4 a(a1, a2, a3, a4); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const - { - list4 a(a1, a2, a3, a4); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#endif - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) - { - list5 a(a1, a2, a3, a4, a5); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const - { - list5 a(a1, a2, a3, a4, a5); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) - { - list5 a(a1, a2, a3, a4, a5); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const - { - list5 a(a1, a2, a3, a4, a5); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#endif - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) - { - list6 a(a1, a2, a3, a4, a5, a6); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const - { - list6 a(a1, a2, a3, a4, a5, a6); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) - { - list6 a(a1, a2, a3, a4, a5, a6); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const - { - list6 a(a1, a2, a3, a4, a5, a6); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#endif - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) - { - list7 a(a1, a2, a3, a4, a5, a6, a7); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const - { - list7 a(a1, a2, a3, a4, a5, a6, a7); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) - { - list7 a(a1, a2, a3, a4, a5, a6, a7); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) const - { - list7 a(a1, a2, a3, a4, a5, a6, a7); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#endif - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) - { - list8 a(a1, a2, a3, a4, a5, a6, a7, a8); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const - { - list8 a(a1, a2, a3, a4, a5, a6, a7, a8); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) - { - list8 a(a1, a2, a3, a4, a5, a6, a7, a8); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) const - { - list8 a(a1, a2, a3, a4, a5, a6, a7, a8); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#endif - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) - { - list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const - { - list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ - && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) - { - list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) const - { - list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - -#endif - - template result_type eval(A & a) - { - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template result_type eval(A & a) const - { - BOOST_BIND_RETURN l_(type(), f_, a, 0); - } - - template void accept(V & v) const - { -#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) - - using boost::visit_each; - -#endif - BOOST_BIND_VISIT_EACH(v, f_, 0); - l_.accept(v); - } - - bool compare(this_type const & rhs) const - { - return ref_compare(f_, rhs.f_, 0) && l_ == rhs.l_; - } - -private: - - F f_; - L l_; diff --git a/libraries/boost/include/boost/bind/mem_fn.hpp b/libraries/boost/include/boost/bind/mem_fn.hpp deleted file mode 100644 index 956e7d8885..0000000000 --- a/libraries/boost/include/boost/bind/mem_fn.hpp +++ /dev/null @@ -1,389 +0,0 @@ -#ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED -#define BOOST_BIND_MEM_FN_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// mem_fn.hpp - a generalization of std::mem_fun[_ref] -// -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2001 David Abrahams -// Copyright (c) 2003-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/mem_fn.html for documentation. -// - -#include -#include -#include - -namespace boost -{ - -#if defined(BOOST_NO_VOID_RETURNS) - -#define BOOST_MEM_FN_CLASS_F , class F -#define BOOST_MEM_FN_TYPEDEF(X) - -namespace _mfi // mem_fun_impl -{ - -template struct mf -{ - -#define BOOST_MEM_FN_RETURN return - -#define BOOST_MEM_FN_NAME(X) inner_##X -#define BOOST_MEM_FN_CC - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#undef BOOST_MEM_FN_RETURN - -}; // struct mf - -template<> struct mf -{ - -#define BOOST_MEM_FN_RETURN - -#define BOOST_MEM_FN_NAME(X) inner_##X -#define BOOST_MEM_FN_CC - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#undef BOOST_MEM_FN_RETURN - -}; // struct mf - -#undef BOOST_MEM_FN_CLASS_F -#undef BOOST_MEM_FN_TYPEDEF_F - -#define BOOST_MEM_FN_NAME(X) X -#define BOOST_MEM_FN_NAME2(X) inner_##X -#define BOOST_MEM_FN_CC - -#include - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_MEM_FN_NAME(X) X##_cdecl -#define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_MEM_FN_NAME(X) X##_stdcall -#define BOOST_MEM_FN_NAME2(X) inner_##X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_MEM_FN_NAME(X) X##_fastcall -#define BOOST_MEM_FN_NAME2(X) inner_##X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_NAME2 -#undef BOOST_MEM_FN_CC - -#endif - -} // namespace _mfi - -#else // #ifdef BOOST_NO_VOID_RETURNS - -#define BOOST_MEM_FN_CLASS_F -#define BOOST_MEM_FN_TYPEDEF(X) typedef X; - -namespace _mfi -{ - -#define BOOST_MEM_FN_RETURN return - -#define BOOST_MEM_FN_NAME(X) X -#define BOOST_MEM_FN_CC - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_MEM_FN_NAME(X) X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_MEM_FN_NAME(X) X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_MEM_FN_NAME(X) X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif - -#undef BOOST_MEM_FN_RETURN - -} // namespace _mfi - -#undef BOOST_MEM_FN_CLASS_F -#undef BOOST_MEM_FN_TYPEDEF - -#endif // #ifdef BOOST_NO_VOID_RETURNS - -#define BOOST_MEM_FN_NAME(X) X -#define BOOST_MEM_FN_CC - -#include - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC - -#ifdef BOOST_MEM_FN_ENABLE_CDECL - -#define BOOST_MEM_FN_NAME(X) X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_STDCALL - -#define BOOST_MEM_FN_NAME(X) X##_stdcall -#define BOOST_MEM_FN_CC __stdcall - -#include - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC - -#endif - -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL - -#define BOOST_MEM_FN_NAME(X) X##_fastcall -#define BOOST_MEM_FN_CC __fastcall - -#include - -#undef BOOST_MEM_FN_NAME -#undef BOOST_MEM_FN_CC - -#endif - -// data member support - -namespace _mfi -{ - -template class dm -{ -public: - - typedef R const & result_type; - typedef T const * argument_type; - -private: - - typedef R (T::*F); - F f_; - - template R const & call(U & u, T const *) const - { - return (u.*f_); - } - - template R const & call(U & u, void const *) const - { - return (get_pointer(u)->*f_); - } - -public: - - explicit dm(F f): f_(f) {} - - R & operator()(T * p) const - { - return (p->*f_); - } - - R const & operator()(T const * p) const - { - return (p->*f_); - } - - template R const & operator()(U const & u) const - { - return call(u, &u); - } - -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200) - - R & operator()(T & t) const - { - return (t.*f_); - } - - R const & operator()(T const & t) const - { - return (t.*f_); - } - -#endif - - bool operator==(dm const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(dm const & rhs) const - { - return f_ != rhs.f_; - } -}; - -} // namespace _mfi - -template _mfi::dm mem_fn(R T::*f) -{ - return _mfi::dm(f); -} - -} // namespace boost - -#endif // #ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED diff --git a/libraries/boost/include/boost/bind/mem_fn_cc.hpp b/libraries/boost/include/boost/bind/mem_fn_cc.hpp deleted file mode 100644 index 8b6ea0ba13..0000000000 --- a/libraries/boost/include/boost/bind/mem_fn_cc.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// -// bind/mem_fn_cc.hpp - support for different calling conventions -// -// Do not include this header directly. -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/mem_fn.html for documentation. -// - -template _mfi::BOOST_MEM_FN_NAME(mf0) mem_fn(R (BOOST_MEM_FN_CC T::*f) ()) -{ - return _mfi::BOOST_MEM_FN_NAME(mf0)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf0) mem_fn(R (BOOST_MEM_FN_CC T::*f) () const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf0)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf1) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf1)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf1) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf1)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf2) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf2)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf2) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf2)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf3) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf3)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf3) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf3)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf4) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf4)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf4) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf4)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf5) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf5)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf5) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf5)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf6) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf6)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf6) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf6)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf7) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf7)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf7) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf7)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(mf8) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8)) -{ - return _mfi::BOOST_MEM_FN_NAME(mf8)(f); -} - -template _mfi::BOOST_MEM_FN_NAME(cmf8) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const) -{ - return _mfi::BOOST_MEM_FN_NAME(cmf8)(f); -} diff --git a/libraries/boost/include/boost/bind/mem_fn_template.hpp b/libraries/boost/include/boost/bind/mem_fn_template.hpp deleted file mode 100644 index b26d585dbc..0000000000 --- a/libraries/boost/include/boost/bind/mem_fn_template.hpp +++ /dev/null @@ -1,1047 +0,0 @@ -// -// bind/mem_fn_template.hpp -// -// Do not include this header directly -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/mem_fn.html for documentation. -// - -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) -# define BOOST_MEM_FN_ENABLE_CONST_OVERLOADS -#endif - -// mf0 - -template class BOOST_MEM_FN_NAME(mf0) -{ -public: - - typedef R result_type; - typedef T * argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) ()) - F f_; - - template R call(U & u, T const *) const - { - BOOST_MEM_FN_RETURN (u.*f_)(); - } - - template R call(U & u, void const *) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf0)(F f): f_(f) {} - - R operator()(T * p) const - { - BOOST_MEM_FN_RETURN (p->*f_)(); - } - - template R operator()(U & u) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p); - } - -#endif - - R operator()(T & t) const - { - BOOST_MEM_FN_RETURN (t.*f_)(); - } - - bool operator==(BOOST_MEM_FN_NAME(mf0) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf0) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf0 - -template class BOOST_MEM_FN_NAME(cmf0) -{ -public: - - typedef R result_type; - typedef T const * argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) () const) - F f_; - - template R call(U & u, T const *) const - { - BOOST_MEM_FN_RETURN (u.*f_)(); - } - - template R call(U & u, void const *) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf0)(F f): f_(f) {} - - template R operator()(U const & u) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p); - } - - R operator()(T const & t) const - { - BOOST_MEM_FN_RETURN (t.*f_)(); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf0) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf0) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf1 - -template class BOOST_MEM_FN_NAME(mf1) -{ -public: - - typedef R result_type; - typedef T * first_argument_type; - typedef A1 second_argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1)) - F f_; - - template R call(U & u, T const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1); - } - - template R call(U & u, void const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf1)(F f): f_(f) {} - - R operator()(T * p, A1 a1) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1); - } - - template R operator()(U & u, A1 a1) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1); - } - -#endif - - R operator()(T & t, A1 a1) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1); - } - - bool operator==(BOOST_MEM_FN_NAME(mf1) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf1) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf1 - -template class BOOST_MEM_FN_NAME(cmf1) -{ -public: - - typedef R result_type; - typedef T const * first_argument_type; - typedef A1 second_argument_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1) const) - F f_; - - template R call(U & u, T const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1); - } - - template R call(U & u, void const *, B1 & b1) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf1)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1); - } - - R operator()(T const & t, A1 a1) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf1) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf1) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf2 - -template class BOOST_MEM_FN_NAME(mf2) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf2)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2); - } - - template R operator()(U & u, A1 a1, A2 a2) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); - } - - bool operator==(BOOST_MEM_FN_NAME(mf2) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf2) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf2 - -template class BOOST_MEM_FN_NAME(cmf2) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf2)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2); - } - - R operator()(T const & t, A1 a1, A2 a2) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf2) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf2) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf3 - -template class BOOST_MEM_FN_NAME(mf3) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf3)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); - } - - bool operator==(BOOST_MEM_FN_NAME(mf3) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf3) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf3 - -template class BOOST_MEM_FN_NAME(cmf3) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf3)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf3) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf3) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf4 - -template class BOOST_MEM_FN_NAME(mf4) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf4)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); - } - - bool operator==(BOOST_MEM_FN_NAME(mf4) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf4) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf4 - -template class BOOST_MEM_FN_NAME(cmf4) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf4)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf4) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf4) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf5 - -template class BOOST_MEM_FN_NAME(mf5) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf5)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); - } - - bool operator==(BOOST_MEM_FN_NAME(mf5) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf5) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf5 - -template class BOOST_MEM_FN_NAME(cmf5) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf5)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf5) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf5) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf6 - -template class BOOST_MEM_FN_NAME(mf6) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf6)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); - } - - bool operator==(BOOST_MEM_FN_NAME(mf6) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf6) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf6 - -template class BOOST_MEM_FN_NAME(cmf6) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf6)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf6) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf6) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf7 - -template class BOOST_MEM_FN_NAME(mf7) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf7)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); - } - - bool operator==(BOOST_MEM_FN_NAME(mf7) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf7) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf7 - -template class BOOST_MEM_FN_NAME(cmf7) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf7)(F f): f_(f) {} - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf7) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf7) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// mf8 - -template class BOOST_MEM_FN_NAME(mf8) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8)) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - -public: - - explicit BOOST_MEM_FN_NAME(mf8)(F f): f_(f) {} - - R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); - } - -#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); - } - -#endif - - R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - bool operator==(BOOST_MEM_FN_NAME(mf8) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(mf8) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -// cmf8 - -template class BOOST_MEM_FN_NAME(cmf8) -{ -public: - - typedef R result_type; - -private: - - BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const) - F f_; - - template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - - template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const - { - BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); - } - -public: - - explicit BOOST_MEM_FN_NAME(cmf8)(F f): f_(f) {} - - R operator()(T const * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - U const * p = 0; - BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); - } - - R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const - { - BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); - } - - bool operator==(BOOST_MEM_FN_NAME(cmf8) const & rhs) const - { - return f_ == rhs.f_; - } - - bool operator!=(BOOST_MEM_FN_NAME(cmf8) const & rhs) const - { - return f_ != rhs.f_; - } -}; - -#undef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS diff --git a/libraries/boost/include/boost/bind/mem_fn_vw.hpp b/libraries/boost/include/boost/bind/mem_fn_vw.hpp deleted file mode 100644 index f3fc58db04..0000000000 --- a/libraries/boost/include/boost/bind/mem_fn_vw.hpp +++ /dev/null @@ -1,130 +0,0 @@ -// -// bind/mem_fn_vw.hpp - void return helper wrappers -// -// Do not include this header directly -// -// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/bind/mem_fn.html for documentation. -// - -template struct BOOST_MEM_FN_NAME(mf0): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (); - explicit BOOST_MEM_FN_NAME(mf0)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf0): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0) -{ - typedef R (BOOST_MEM_FN_CC T::*F) () const; - explicit BOOST_MEM_FN_NAME(cmf0)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf1): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1); - explicit BOOST_MEM_FN_NAME(mf1)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf1): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1) const; - explicit BOOST_MEM_FN_NAME(cmf1)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf2): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2); - explicit BOOST_MEM_FN_NAME(mf2)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf2): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2) const; - explicit BOOST_MEM_FN_NAME(cmf2)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf3): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3); - explicit BOOST_MEM_FN_NAME(mf3)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf3): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const; - explicit BOOST_MEM_FN_NAME(cmf3)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf4): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4); - explicit BOOST_MEM_FN_NAME(mf4)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf4): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const; - explicit BOOST_MEM_FN_NAME(cmf4)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf5): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5); - explicit BOOST_MEM_FN_NAME(mf5)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf5): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const; - explicit BOOST_MEM_FN_NAME(cmf5)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf6): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6); - explicit BOOST_MEM_FN_NAME(mf6)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf6): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const; - explicit BOOST_MEM_FN_NAME(cmf6)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf7): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7); - explicit BOOST_MEM_FN_NAME(mf7)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf7): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const; - explicit BOOST_MEM_FN_NAME(cmf7)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)(f) {} -}; - - -template struct BOOST_MEM_FN_NAME(mf8): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8); - explicit BOOST_MEM_FN_NAME(mf8)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)(f) {} -}; - -template struct BOOST_MEM_FN_NAME(cmf8): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8) -{ - typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const; - explicit BOOST_MEM_FN_NAME(cmf8)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)(f) {} -}; - diff --git a/libraries/boost/include/boost/bind/placeholders.hpp b/libraries/boost/include/boost/bind/placeholders.hpp deleted file mode 100644 index b819ef4c46..0000000000 --- a/libraries/boost/include/boost/bind/placeholders.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED -#define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// bind/placeholders.hpp - _N definitions -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// Copyright 2015 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/bind/bind.html for documentation. -// - -#include -#include - -namespace boost -{ - -namespace placeholders -{ - -#if defined(__BORLANDC__) || defined(__GNUC__) && (__GNUC__ < 4) - -inline boost::arg<1> _1() { return boost::arg<1>(); } -inline boost::arg<2> _2() { return boost::arg<2>(); } -inline boost::arg<3> _3() { return boost::arg<3>(); } -inline boost::arg<4> _4() { return boost::arg<4>(); } -inline boost::arg<5> _5() { return boost::arg<5>(); } -inline boost::arg<6> _6() { return boost::arg<6>(); } -inline boost::arg<7> _7() { return boost::arg<7>(); } -inline boost::arg<8> _8() { return boost::arg<8>(); } -inline boost::arg<9> _9() { return boost::arg<9>(); } - -#else - -BOOST_STATIC_CONSTEXPR boost::arg<1> _1; -BOOST_STATIC_CONSTEXPR boost::arg<2> _2; -BOOST_STATIC_CONSTEXPR boost::arg<3> _3; -BOOST_STATIC_CONSTEXPR boost::arg<4> _4; -BOOST_STATIC_CONSTEXPR boost::arg<5> _5; -BOOST_STATIC_CONSTEXPR boost::arg<6> _6; -BOOST_STATIC_CONSTEXPR boost::arg<7> _7; -BOOST_STATIC_CONSTEXPR boost::arg<8> _8; -BOOST_STATIC_CONSTEXPR boost::arg<9> _9; - -#endif - -} // namespace placeholders - -} // namespace boost - -#endif // #ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED diff --git a/libraries/boost/include/boost/bind/storage.hpp b/libraries/boost/include/boost/bind/storage.hpp deleted file mode 100644 index be490b0f59..0000000000 --- a/libraries/boost/include/boost/bind/storage.hpp +++ /dev/null @@ -1,475 +0,0 @@ -#ifndef BOOST_BIND_STORAGE_HPP_INCLUDED -#define BOOST_BIND_STORAGE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// bind/storage.hpp -// -// boost/bind.hpp support header, optimized storage -// -// Copyright (c) 2006 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/bind/bind.html for documentation. -// - -#include -#include - -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable: 4512) // assignment operator could not be generated -#endif - -namespace boost -{ - -namespace _bi -{ - -// 1 - -template struct storage1 -{ - explicit storage1( A1 a1 ): a1_( a1 ) {} - - template void accept(V & v) const - { - BOOST_BIND_VISIT_EACH(v, a1_, 0); - } - - A1 a1_; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( __BORLANDC__ ) - -template struct storage1< boost::arg > -{ - explicit storage1( boost::arg ) {} - - template void accept(V &) const { } - - static boost::arg a1_() { return boost::arg(); } -}; - -template struct storage1< boost::arg (*) () > -{ - explicit storage1( boost::arg (*) () ) {} - - template void accept(V &) const { } - - static boost::arg a1_() { return boost::arg(); } -}; - -#endif - -// 2 - -template struct storage2: public storage1 -{ - typedef storage1 inherited; - - storage2( A1 a1, A2 a2 ): storage1( a1 ), a2_( a2 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - BOOST_BIND_VISIT_EACH(v, a2_, 0); - } - - A2 a2_; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template struct storage2< A1, boost::arg >: public storage1 -{ - typedef storage1 inherited; - - storage2( A1 a1, boost::arg ): storage1( a1 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a2_() { return boost::arg(); } -}; - -template struct storage2< A1, boost::arg (*) () >: public storage1 -{ - typedef storage1 inherited; - - storage2( A1 a1, boost::arg (*) () ): storage1( a1 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a2_() { return boost::arg(); } -}; - -#endif - -// 3 - -template struct storage3: public storage2< A1, A2 > -{ - typedef storage2 inherited; - - storage3( A1 a1, A2 a2, A3 a3 ): storage2( a1, a2 ), a3_( a3 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - BOOST_BIND_VISIT_EACH(v, a3_, 0); - } - - A3 a3_; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template struct storage3< A1, A2, boost::arg >: public storage2< A1, A2 > -{ - typedef storage2 inherited; - - storage3( A1 a1, A2 a2, boost::arg ): storage2( a1, a2 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a3_() { return boost::arg(); } -}; - -template struct storage3< A1, A2, boost::arg (*) () >: public storage2< A1, A2 > -{ - typedef storage2 inherited; - - storage3( A1 a1, A2 a2, boost::arg (*) () ): storage2( a1, a2 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a3_() { return boost::arg(); } -}; - -#endif - -// 4 - -template struct storage4: public storage3< A1, A2, A3 > -{ - typedef storage3 inherited; - - storage4( A1 a1, A2 a2, A3 a3, A4 a4 ): storage3( a1, a2, a3 ), a4_( a4 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - BOOST_BIND_VISIT_EACH(v, a4_, 0); - } - - A4 a4_; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template struct storage4< A1, A2, A3, boost::arg >: public storage3< A1, A2, A3 > -{ - typedef storage3 inherited; - - storage4( A1 a1, A2 a2, A3 a3, boost::arg ): storage3( a1, a2, a3 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a4_() { return boost::arg(); } -}; - -template struct storage4< A1, A2, A3, boost::arg (*) () >: public storage3< A1, A2, A3 > -{ - typedef storage3 inherited; - - storage4( A1 a1, A2 a2, A3 a3, boost::arg (*) () ): storage3( a1, a2, a3 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a4_() { return boost::arg(); } -}; - -#endif - -// 5 - -template struct storage5: public storage4< A1, A2, A3, A4 > -{ - typedef storage4 inherited; - - storage5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): storage4( a1, a2, a3, a4 ), a5_( a5 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - BOOST_BIND_VISIT_EACH(v, a5_, 0); - } - - A5 a5_; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template struct storage5< A1, A2, A3, A4, boost::arg >: public storage4< A1, A2, A3, A4 > -{ - typedef storage4 inherited; - - storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg ): storage4( a1, a2, a3, a4 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a5_() { return boost::arg(); } -}; - -template struct storage5< A1, A2, A3, A4, boost::arg (*) () >: public storage4< A1, A2, A3, A4 > -{ - typedef storage4 inherited; - - storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg (*) () ): storage4( a1, a2, a3, a4 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a5_() { return boost::arg(); } -}; - -#endif - -// 6 - -template struct storage6: public storage5< A1, A2, A3, A4, A5 > -{ - typedef storage5 inherited; - - storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): storage5( a1, a2, a3, a4, a5 ), a6_( a6 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - BOOST_BIND_VISIT_EACH(v, a6_, 0); - } - - A6 a6_; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template struct storage6< A1, A2, A3, A4, A5, boost::arg >: public storage5< A1, A2, A3, A4, A5 > -{ - typedef storage5 inherited; - - storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg ): storage5( a1, a2, a3, a4, a5 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a6_() { return boost::arg(); } -}; - -template struct storage6< A1, A2, A3, A4, A5, boost::arg (*) () >: public storage5< A1, A2, A3, A4, A5 > -{ - typedef storage5 inherited; - - storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg (*) () ): storage5( a1, a2, a3, a4, a5 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a6_() { return boost::arg(); } -}; - -#endif - -// 7 - -template struct storage7: public storage6< A1, A2, A3, A4, A5, A6 > -{ - typedef storage6 inherited; - - storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): storage6( a1, a2, a3, a4, a5, a6 ), a7_( a7 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - BOOST_BIND_VISIT_EACH(v, a7_, 0); - } - - A7 a7_; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template struct storage7< A1, A2, A3, A4, A5, A6, boost::arg >: public storage6< A1, A2, A3, A4, A5, A6 > -{ - typedef storage6 inherited; - - storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg ): storage6( a1, a2, a3, a4, a5, a6 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a7_() { return boost::arg(); } -}; - -template struct storage7< A1, A2, A3, A4, A5, A6, boost::arg (*) () >: public storage6< A1, A2, A3, A4, A5, A6 > -{ - typedef storage6 inherited; - - storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg (*) () ): storage6( a1, a2, a3, a4, a5, a6 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a7_() { return boost::arg(); } -}; - -#endif - -// 8 - -template struct storage8: public storage7< A1, A2, A3, A4, A5, A6, A7 > -{ - typedef storage7 inherited; - - storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): storage7( a1, a2, a3, a4, a5, a6, a7 ), a8_( a8 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - BOOST_BIND_VISIT_EACH(v, a8_, 0); - } - - A8 a8_; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg >: public storage7< A1, A2, A3, A4, A5, A6, A7 > -{ - typedef storage7 inherited; - - storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg ): storage7( a1, a2, a3, a4, a5, a6, a7 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a8_() { return boost::arg(); } -}; - -template struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg (*) () >: public storage7< A1, A2, A3, A4, A5, A6, A7 > -{ - typedef storage7 inherited; - - storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg (*) () ): storage7( a1, a2, a3, a4, a5, a6, a7 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a8_() { return boost::arg(); } -}; - -#endif - -// 9 - -template struct storage9: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > -{ - typedef storage8 inherited; - - storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ), a9_( a9 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - BOOST_BIND_VISIT_EACH(v, a9_, 0); - } - - A9 a9_; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > -{ - typedef storage8 inherited; - - storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a9_() { return boost::arg(); } -}; - -template struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg (*) () >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > -{ - typedef storage8 inherited; - - storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg (*) () ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ) {} - - template void accept(V & v) const - { - inherited::accept(v); - } - - static boost::arg a9_() { return boost::arg(); } -}; - -#endif - -} // namespace _bi - -} // namespace boost - -#ifdef BOOST_MSVC -# pragma warning(default: 4512) // assignment operator could not be generated -# pragma warning(pop) -#endif - -#endif // #ifndef BOOST_BIND_STORAGE_HPP_INCLUDED diff --git a/libraries/boost/include/boost/call_traits.hpp b/libraries/boost/include/boost/call_traits.hpp deleted file mode 100644 index 2c1328e94d..0000000000 --- a/libraries/boost/include/boost/call_traits.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// Use, modification and distribution are subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt). -// -// See http://www.boost.org/libs/utility for most recent version including documentation. - -// See boost/detail/call_traits.hpp -// for full copyright notices. - -#ifndef BOOST_CALL_TRAITS_HPP -#define BOOST_CALL_TRAITS_HPP - -#ifndef BOOST_CONFIG_HPP -#include -#endif - -#include - -#endif // BOOST_CALL_TRAITS_HPP diff --git a/libraries/boost/include/boost/checked_delete.hpp b/libraries/boost/include/boost/checked_delete.hpp deleted file mode 100644 index fb71c789c8..0000000000 --- a/libraries/boost/include/boost/checked_delete.hpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2014 Glen Fernandes - * - * Distributed under the Boost Software License, Version 1.0. (See - * accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_CHECKED_DELETE_HPP -#define BOOST_CHECKED_DELETE_HPP - -// The header file at this path is deprecated; -// use boost/core/checked_delete.hpp instead. - -#include - -#endif diff --git a/libraries/boost/include/boost/config/user.hpp b/libraries/boost/include/boost/config/user.hpp index a830a548db..28e7476afd 100644 --- a/libraries/boost/include/boost/config/user.hpp +++ b/libraries/boost/include/boost/config/user.hpp @@ -131,6 +131,3 @@ // to ensure the correct libraries are selected at link time. // #define BOOST_LIB_BUILDID amd64 -// Current CDT limitations -#define BOOST_SP_NO_ATOMIC_ACCESS -#define BOOST_NO_FENV_H diff --git a/libraries/boost/include/boost/cstdlib.hpp b/libraries/boost/include/boost/cstdlib.hpp deleted file mode 100644 index 6322146354..0000000000 --- a/libraries/boost/include/boost/cstdlib.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// boost/cstdlib.hpp header ------------------------------------------------// - -// Copyright Beman Dawes 2001. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/utility/cstdlib.html for documentation. - -// Revision History -// 26 Feb 01 Initial version (Beman Dawes) - -#ifndef BOOST_CSTDLIB_HPP -#define BOOST_CSTDLIB_HPP - -#include - -namespace boost -{ - // The intent is to propose the following for addition to namespace std - // in the C++ Standard Library, and to then deprecate EXIT_SUCCESS and - // EXIT_FAILURE. As an implementation detail, this header defines the - // new constants in terms of EXIT_SUCCESS and EXIT_FAILURE. In a new - // standard, the constants would be implementation-defined, although it - // might be worthwhile to "suggest" (which a standard is allowed to do) - // values of 0 and 1 respectively. - - // Rationale for having multiple failure values: some environments may - // wish to distinguish between different classes of errors. - // Rationale for choice of values: programs often use values < 100 for - // their own error reporting. Values > 255 are sometimes reserved for - // system detected errors. 200/201 were suggested to minimize conflict. - - const int exit_success = EXIT_SUCCESS; // implementation-defined value - const int exit_failure = EXIT_FAILURE; // implementation-defined value - const int exit_exception_failure = 200; // otherwise uncaught exception - const int exit_test_failure = 201; // report_error or - // report_critical_error called. -} - -#endif - diff --git a/libraries/boost/include/boost/current_function.hpp b/libraries/boost/include/boost/current_function.hpp deleted file mode 100644 index 86955cb041..0000000000 --- a/libraries/boost/include/boost/current_function.hpp +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED -#define BOOST_CURRENT_FUNCTION_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/current_function.hpp - BOOST_CURRENT_FUNCTION -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// http://www.boost.org/libs/assert/current_function.html -// - -namespace boost -{ - -namespace detail -{ - -inline void current_function_helper() -{ - -#if defined( BOOST_DISABLE_CURRENT_FUNCTION ) - -# define BOOST_CURRENT_FUNCTION "(unknown)" - -#elif defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__) - -# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ - -#elif defined(__DMC__) && (__DMC__ >= 0x810) - -# define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ - -#elif defined(__FUNCSIG__) - -# define BOOST_CURRENT_FUNCTION __FUNCSIG__ - -#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500)) - -# define BOOST_CURRENT_FUNCTION __FUNCTION__ - -#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550) - -# define BOOST_CURRENT_FUNCTION __FUNC__ - -#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) - -# define BOOST_CURRENT_FUNCTION __func__ - -#elif defined(__cplusplus) && (__cplusplus >= 201103) - -# define BOOST_CURRENT_FUNCTION __func__ - -#else - -# define BOOST_CURRENT_FUNCTION "(unknown)" - -#endif - -} - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED diff --git a/libraries/boost/include/boost/exception/current_exception_cast.hpp b/libraries/boost/include/boost/exception/current_exception_cast.hpp deleted file mode 100644 index 5d81f00b00..0000000000 --- a/libraries/boost/include/boost/exception/current_exception_cast.hpp +++ /dev/null @@ -1,43 +0,0 @@ -//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. - -//Distributed under the Boost Software License, Version 1.0. (See accompanying -//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#ifndef UUID_7E83C166200811DE885E826156D89593 -#define UUID_7E83C166200811DE885E826156D89593 -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma GCC system_header -#endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(push,1) -#endif - -namespace -boost - { - template - inline - E * - current_exception_cast() - { - try - { - throw; - } - catch( - E & e ) - { - return &e; - } - catch( - ...) - { - return 0; - } - } - } - -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(pop) -#endif -#endif diff --git a/libraries/boost/include/boost/exception/detail/error_info_impl.hpp b/libraries/boost/include/boost/exception/detail/error_info_impl.hpp deleted file mode 100644 index 6c48d61ab3..0000000000 --- a/libraries/boost/include/boost/exception/detail/error_info_impl.hpp +++ /dev/null @@ -1,102 +0,0 @@ -//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc. - -//Distributed under the Boost Software License, Version 1.0. (See accompanying -//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#ifndef UUID_CE6983AC753411DDA764247956D89593 -#define UUID_CE6983AC753411DDA764247956D89593 - -#include -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#include -#endif -#include -#include - -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma GCC system_header -#endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(push,1) -#endif - -namespace -boost - { - namespace - exception_detail - { - class - error_info_base - { - public: - - virtual std::string name_value_string() const = 0; - virtual error_info_base * clone() const = 0; - - virtual - ~error_info_base() throw() - { - } - }; - } - - template - class - error_info: - public exception_detail::error_info_base - { - error_info_base * - clone() const - { - return new error_info(*this); - } - public: - typedef T value_type; - error_info( value_type const & v ): - v_(v) - { - } -#if (__GNUC__*100+__GNUC_MINOR__!=406) //workaround for g++ bug -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - error_info( error_info const & x ): - v_(x.v_) - { - } - error_info( T && v ) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible::value): - v_(std::move(v)) - { - } - error_info( error_info && x ) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible::value): - v_(std::move(x.v_)) - { - } -#endif -#endif - ~error_info() throw() - { - } - value_type const & - value() const - { - return v_; - } - value_type & - value() - { - return v_; - } - private: - error_info & operator=( error_info const & ); -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - error_info & operator=( error_info && x ); -#endif - std::string name_value_string() const; - value_type v_; - }; - } - -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(pop) -#endif -#endif diff --git a/libraries/boost/include/boost/exception/detail/shared_ptr.hpp b/libraries/boost/include/boost/exception/detail/shared_ptr.hpp deleted file mode 100644 index 51febe8c8f..0000000000 --- a/libraries/boost/include/boost/exception/detail/shared_ptr.hpp +++ /dev/null @@ -1,17 +0,0 @@ -//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. - -//Distributed under the Boost Software License, Version 1.0. (See accompanying -//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#ifndef UUID_837060E885AF11E68DA91D15E31AC075 -#define UUID_837060E885AF11E68DA91D15E31AC075 - -#ifdef BOOST_EXCEPTION_MINI_BOOST -#include -namespace boost { namespace exception_detail { using std::shared_ptr; } } -#else -#include -namespace boost { namespace exception_detail { using boost::shared_ptr; } } -#endif - -#endif diff --git a/libraries/boost/include/boost/exception/detail/type_info.hpp b/libraries/boost/include/boost/exception/detail/type_info.hpp deleted file mode 100644 index 739ac5748e..0000000000 --- a/libraries/boost/include/boost/exception/detail/type_info.hpp +++ /dev/null @@ -1,82 +0,0 @@ -//Copyright (c) 2006-2010 Emil Dotchevski and Reverge Studios, Inc. - -//Distributed under the Boost Software License, Version 1.0. (See accompanying -//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#ifndef UUID_C3E1741C754311DDB2834CCA55D89593 -#define UUID_C3E1741C754311DDB2834CCA55D89593 - -#include -#include -#include -#include -#include - -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma GCC system_header -#endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(push,1) -#endif - -namespace -boost - { - template - inline - std::string - tag_type_name() - { -#ifdef BOOST_NO_TYPEID - return BOOST_CURRENT_FUNCTION; -#else - return core::demangle(typeid(T*).name()); -#endif - } - - template - inline - std::string - type_name() - { -#ifdef BOOST_NO_TYPEID - return BOOST_CURRENT_FUNCTION; -#else - return core::demangle(typeid(T).name()); -#endif - } - - namespace - exception_detail - { - struct - type_info_ - { - core::typeinfo const * type_; - - explicit - type_info_( core::typeinfo const & type ): - type_(&type) - { - } - - friend - bool - operator<( type_info_ const & a, type_info_ const & b ) - { - return 0!=(a.type_->before(*b.type_)); - } - }; - } - } - -#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_CORE_TYPEID(T)) - -#ifndef BOOST_NO_RTTI -#define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x)) -#endif - -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(pop) -#endif -#endif diff --git a/libraries/boost/include/boost/exception/exception.hpp b/libraries/boost/include/boost/exception/exception.hpp deleted file mode 100644 index c0fdaf9e55..0000000000 --- a/libraries/boost/include/boost/exception/exception.hpp +++ /dev/null @@ -1,521 +0,0 @@ -//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. - -//Distributed under the Boost Software License, Version 1.0. (See accompanying -//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593 -#define UUID_274DA366004E11DCB1DDFE2E56D89593 -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma GCC system_header -#endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(push,1) -#endif - -#ifdef BOOST_EXCEPTION_MINI_BOOST -#include -namespace boost { namespace exception_detail { using std::shared_ptr; } } -#else -namespace boost { template class shared_ptr; }; -namespace boost { namespace exception_detail { using boost::shared_ptr; } } -#endif - -namespace -boost - { - namespace - exception_detail - { - template - class - refcount_ptr - { - public: - - refcount_ptr(): - px_(0) - { - } - - ~refcount_ptr() - { - release(); - } - - refcount_ptr( refcount_ptr const & x ): - px_(x.px_) - { - add_ref(); - } - - refcount_ptr & - operator=( refcount_ptr const & x ) - { - adopt(x.px_); - return *this; - } - - void - adopt( T * px ) - { - release(); - px_=px; - add_ref(); - } - - T * - get() const - { - return px_; - } - - private: - - T * px_; - - void - add_ref() - { - if( px_ ) - px_->add_ref(); - } - - void - release() - { - if( px_ && px_->release() ) - px_=0; - } - }; - } - - //////////////////////////////////////////////////////////////////////// - - template - class error_info; - - typedef error_info throw_function; - typedef error_info throw_file; - typedef error_info throw_line; - - template <> - class - error_info - { - public: - typedef char const * value_type; - value_type v_; - explicit - error_info( value_type v ): - v_(v) - { - } - }; - - template <> - class - error_info - { - public: - typedef char const * value_type; - value_type v_; - explicit - error_info( value_type v ): - v_(v) - { - } - }; - - template <> - class - error_info - { - public: - typedef int value_type; - value_type v_; - explicit - error_info( value_type v ): - v_(v) - { - } - }; - -#if defined(__GNUC__) -# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) -# pragma GCC visibility push (default) -# endif -#endif - class exception; -#if defined(__GNUC__) -# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) -# pragma GCC visibility pop -# endif -#endif - - namespace - exception_detail - { - class error_info_base; - struct type_info_; - - struct - error_info_container - { - virtual char const * diagnostic_information( char const * ) const = 0; - virtual shared_ptr get( type_info_ const & ) const = 0; - virtual void set( shared_ptr const &, type_info_ const & ) = 0; - virtual void add_ref() const = 0; - virtual bool release() const = 0; - virtual refcount_ptr clone() const = 0; - - protected: - - ~error_info_container() throw() - { - } - }; - - template - struct get_info; - - template <> - struct get_info; - - template <> - struct get_info; - - template <> - struct get_info; - - template - struct set_info_rv; - - template <> - struct set_info_rv; - - template <> - struct set_info_rv; - - template <> - struct set_info_rv; - - char const * get_diagnostic_information( exception const &, char const * ); - - void copy_boost_exception( exception *, exception const * ); - - template - E const & set_info( E const &, error_info const & ); - - template - E const & set_info( E const &, throw_function const & ); - - template - E const & set_info( E const &, throw_file const & ); - - template - E const & set_info( E const &, throw_line const & ); - } - -#if defined(__GNUC__) -# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) -# pragma GCC visibility push (default) -# endif -#endif - class - exception - { - // - public: - template void set( typename Tag::type const & ); - template typename Tag::type const * get() const; - // - - protected: - - exception(): - throw_function_(0), - throw_file_(0), - throw_line_(-1) - { - } - -#ifdef __HP_aCC - //On HP aCC, this protected copy constructor prevents throwing boost::exception. - //On all other platforms, the same effect is achieved by the pure virtual destructor. - exception( exception const & x ) throw(): - data_(x.data_), - throw_function_(x.throw_function_), - throw_file_(x.throw_file_), - throw_line_(x.throw_line_) - { - } -#endif - - virtual ~exception() throw() -#ifndef __HP_aCC - = 0 //Workaround for HP aCC, =0 incorrectly leads to link errors. -#endif - ; - -#if (defined(__MWERKS__) && __MWERKS__<=0x3207) || (defined(_MSC_VER) && _MSC_VER<=1310) - public: -#else - private: - - template - friend E const & exception_detail::set_info( E const &, throw_function const & ); - - template - friend E const & exception_detail::set_info( E const &, throw_file const & ); - - template - friend E const & exception_detail::set_info( E const &, throw_line const & ); - - template - friend E const & exception_detail::set_info( E const &, error_info const & ); - - friend char const * exception_detail::get_diagnostic_information( exception const &, char const * ); - - template - friend struct exception_detail::get_info; - friend struct exception_detail::get_info; - friend struct exception_detail::get_info; - friend struct exception_detail::get_info; - template - friend struct exception_detail::set_info_rv; - friend struct exception_detail::set_info_rv; - friend struct exception_detail::set_info_rv; - friend struct exception_detail::set_info_rv; - friend void exception_detail::copy_boost_exception( exception *, exception const * ); -#endif - mutable exception_detail::refcount_ptr data_; - mutable char const * throw_function_; - mutable char const * throw_file_; - mutable int throw_line_; - }; -#if defined(__GNUC__) -# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) -# pragma GCC visibility pop -# endif -#endif - - inline - exception:: - ~exception() throw() - { - } - - namespace - exception_detail - { - template - E const & - set_info( E const & x, throw_function const & y ) - { - x.throw_function_=y.v_; - return x; - } - - template - E const & - set_info( E const & x, throw_file const & y ) - { - x.throw_file_=y.v_; - return x; - } - - template - E const & - set_info( E const & x, throw_line const & y ) - { - x.throw_line_=y.v_; - return x; - } - } - - //////////////////////////////////////////////////////////////////////// - - namespace - exception_detail - { -#if defined(__GNUC__) -# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) -# pragma GCC visibility push (default) -# endif -#endif - template - struct - error_info_injector: - public T, - public exception - { - explicit - error_info_injector( T const & x ): - T(x) - { - } - - ~error_info_injector() throw() - { - } - }; -#if defined(__GNUC__) -# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) -# pragma GCC visibility pop -# endif -#endif - - struct large_size { char c[256]; }; - large_size dispatch_boost_exception( exception const * ); - - struct small_size { }; - small_size dispatch_boost_exception( void const * ); - - template - struct enable_error_info_helper; - - template - struct - enable_error_info_helper - { - typedef T type; - }; - - template - struct - enable_error_info_helper - { - typedef error_info_injector type; - }; - - template - struct - enable_error_info_return_type - { - typedef typename enable_error_info_helper(0)))>::type type; - }; - } - - template - inline - typename - exception_detail::enable_error_info_return_type::type - enable_error_info( T const & x ) - { - typedef typename exception_detail::enable_error_info_return_type::type rt; - return rt(x); - } - - //////////////////////////////////////////////////////////////////////// - - namespace - exception_detail - { -#if defined(__GNUC__) -# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) -# pragma GCC visibility push (default) -# endif -#endif - class - clone_base - { - public: - - virtual clone_base const * clone() const = 0; - virtual void rethrow() const = 0; - - virtual - ~clone_base() throw() - { - } - }; -#if defined(__GNUC__) -# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) -# pragma GCC visibility pop -# endif -#endif - - inline - void - copy_boost_exception( exception * a, exception const * b ) - { - refcount_ptr data; - if( error_info_container * d=b->data_.get() ) - data = d->clone(); - a->throw_file_ = b->throw_file_; - a->throw_line_ = b->throw_line_; - a->throw_function_ = b->throw_function_; - a->data_ = data; - } - - inline - void - copy_boost_exception( void *, void const * ) - { - } - -#if defined(__GNUC__) -# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) -# pragma GCC visibility push (default) -# endif -#endif - template - class - clone_impl: - public T, - public virtual clone_base - { - struct clone_tag { }; - clone_impl( clone_impl const & x, clone_tag ): - T(x) - { - copy_boost_exception(this,&x); - } - - public: - - explicit - clone_impl( T const & x ): - T(x) - { - copy_boost_exception(this,&x); - } - - ~clone_impl() throw() - { - } - - private: - - clone_base const * - clone() const - { - return new clone_impl(*this,clone_tag()); - } - - void - rethrow() const - { - throw*this; - } - }; - } -#if defined(__GNUC__) -# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) -# pragma GCC visibility pop -# endif -#endif - - template - inline - exception_detail::clone_impl - enable_current_exception( T const & x ) - { - return exception_detail::clone_impl(x); - } - } - -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(pop) -#endif -#endif diff --git a/libraries/boost/include/boost/exception/get_error_info.hpp b/libraries/boost/include/boost/exception/get_error_info.hpp deleted file mode 100644 index 831717df59..0000000000 --- a/libraries/boost/include/boost/exception/get_error_info.hpp +++ /dev/null @@ -1,133 +0,0 @@ -//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. - -//Distributed under the Boost Software License, Version 1.0. (See accompanying -//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#ifndef UUID_1A590226753311DD9E4CCF6156D89593 -#define UUID_1A590226753311DD9E4CCF6156D89593 - -#include -#include -#include -#include -#include -#include - -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma GCC system_header -#endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(push,1) -#endif - -namespace -boost - { - namespace - exception_detail - { - template - struct - get_info - { - static - typename ErrorInfo::value_type * - get( exception const & x ) - { - if( exception_detail::error_info_container * c=x.data_.get() ) - if( shared_ptr eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) ) - { -#ifndef BOOST_NO_RTTI - BOOST_ASSERT( 0!=dynamic_cast(eib.get()) ); -#endif - ErrorInfo * w = static_cast(eib.get()); - return &w->value(); - } - return 0; - } - }; - - template <> - struct - get_info - { - static - char const * * - get( exception const & x ) - { - return x.throw_function_ ? &x.throw_function_ : 0; - } - }; - - template <> - struct - get_info - { - static - char const * * - get( exception const & x ) - { - return x.throw_file_ ? &x.throw_file_ : 0; - } - }; - - template <> - struct - get_info - { - static - int * - get( exception const & x ) - { - return x.throw_line_!=-1 ? &x.throw_line_ : 0; - } - }; - - template - struct - get_error_info_return_type - { - typedef R * type; - }; - - template - struct - get_error_info_return_type - { - typedef R const * type; - }; - } - -#ifdef BOOST_NO_RTTI - template - inline - typename ErrorInfo::value_type const * - get_error_info( boost::exception const & x ) - { - return exception_detail::get_info::get(x); - } - template - inline - typename ErrorInfo::value_type * - get_error_info( boost::exception & x ) - { - return exception_detail::get_info::get(x); - } -#else - template - inline - typename exception_detail::get_error_info_return_type::type - get_error_info( E & some_exception ) - { - if( exception const * x = dynamic_cast(&some_exception) ) - return exception_detail::get_info::get(*x); - else - return 0; - } -#endif - } - -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(pop) -#endif -#endif diff --git a/libraries/boost/include/boost/function/detail/maybe_include.hpp b/libraries/boost/include/boost/function/detail/maybe_include.hpp deleted file mode 100644 index ec88905dcd..0000000000 --- a/libraries/boost/include/boost/function/detail/maybe_include.hpp +++ /dev/null @@ -1,369 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#if BOOST_FUNCTION_NUM_ARGS == 0 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 0 -# ifndef BOOST_FUNCTION_0 -# define BOOST_FUNCTION_0 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 1 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 1 -# ifndef BOOST_FUNCTION_1 -# define BOOST_FUNCTION_1 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 2 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 2 -# ifndef BOOST_FUNCTION_2 -# define BOOST_FUNCTION_2 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 3 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 3 -# ifndef BOOST_FUNCTION_3 -# define BOOST_FUNCTION_3 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 4 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 4 -# ifndef BOOST_FUNCTION_4 -# define BOOST_FUNCTION_4 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 5 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 5 -# ifndef BOOST_FUNCTION_5 -# define BOOST_FUNCTION_5 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 6 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 6 -# ifndef BOOST_FUNCTION_6 -# define BOOST_FUNCTION_6 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 7 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 7 -# ifndef BOOST_FUNCTION_7 -# define BOOST_FUNCTION_7 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 8 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 8 -# ifndef BOOST_FUNCTION_8 -# define BOOST_FUNCTION_8 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 9 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 9 -# ifndef BOOST_FUNCTION_9 -# define BOOST_FUNCTION_9 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 10 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 10 -# ifndef BOOST_FUNCTION_10 -# define BOOST_FUNCTION_10 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 11 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 11 -# ifndef BOOST_FUNCTION_11 -# define BOOST_FUNCTION_11 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 12 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 12 -# ifndef BOOST_FUNCTION_12 -# define BOOST_FUNCTION_12 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 13 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 13 -# ifndef BOOST_FUNCTION_13 -# define BOOST_FUNCTION_13 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 14 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 14 -# ifndef BOOST_FUNCTION_14 -# define BOOST_FUNCTION_14 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 15 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 15 -# ifndef BOOST_FUNCTION_15 -# define BOOST_FUNCTION_15 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 16 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 16 -# ifndef BOOST_FUNCTION_16 -# define BOOST_FUNCTION_16 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 17 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 17 -# ifndef BOOST_FUNCTION_17 -# define BOOST_FUNCTION_17 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 18 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 18 -# ifndef BOOST_FUNCTION_18 -# define BOOST_FUNCTION_18 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 19 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 19 -# ifndef BOOST_FUNCTION_19 -# define BOOST_FUNCTION_19 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 20 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 20 -# ifndef BOOST_FUNCTION_20 -# define BOOST_FUNCTION_20 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 21 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 21 -# ifndef BOOST_FUNCTION_21 -# define BOOST_FUNCTION_21 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 22 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 22 -# ifndef BOOST_FUNCTION_22 -# define BOOST_FUNCTION_22 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 23 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 23 -# ifndef BOOST_FUNCTION_23 -# define BOOST_FUNCTION_23 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 24 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 24 -# ifndef BOOST_FUNCTION_24 -# define BOOST_FUNCTION_24 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 25 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 25 -# ifndef BOOST_FUNCTION_25 -# define BOOST_FUNCTION_25 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 26 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 26 -# ifndef BOOST_FUNCTION_26 -# define BOOST_FUNCTION_26 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 27 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 27 -# ifndef BOOST_FUNCTION_27 -# define BOOST_FUNCTION_27 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 28 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 28 -# ifndef BOOST_FUNCTION_28 -# define BOOST_FUNCTION_28 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 29 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 29 -# ifndef BOOST_FUNCTION_29 -# define BOOST_FUNCTION_29 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 30 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 30 -# ifndef BOOST_FUNCTION_30 -# define BOOST_FUNCTION_30 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 31 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 31 -# ifndef BOOST_FUNCTION_31 -# define BOOST_FUNCTION_31 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 32 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 32 -# ifndef BOOST_FUNCTION_32 -# define BOOST_FUNCTION_32 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 33 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 33 -# ifndef BOOST_FUNCTION_33 -# define BOOST_FUNCTION_33 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 34 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 34 -# ifndef BOOST_FUNCTION_34 -# define BOOST_FUNCTION_34 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 35 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 35 -# ifndef BOOST_FUNCTION_35 -# define BOOST_FUNCTION_35 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 36 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 36 -# ifndef BOOST_FUNCTION_36 -# define BOOST_FUNCTION_36 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 37 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 37 -# ifndef BOOST_FUNCTION_37 -# define BOOST_FUNCTION_37 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 38 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 38 -# ifndef BOOST_FUNCTION_38 -# define BOOST_FUNCTION_38 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 39 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 39 -# ifndef BOOST_FUNCTION_39 -# define BOOST_FUNCTION_39 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 40 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 40 -# ifndef BOOST_FUNCTION_40 -# define BOOST_FUNCTION_40 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 41 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 41 -# ifndef BOOST_FUNCTION_41 -# define BOOST_FUNCTION_41 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 42 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 42 -# ifndef BOOST_FUNCTION_42 -# define BOOST_FUNCTION_42 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 43 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 43 -# ifndef BOOST_FUNCTION_43 -# define BOOST_FUNCTION_43 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 44 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 44 -# ifndef BOOST_FUNCTION_44 -# define BOOST_FUNCTION_44 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 45 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 45 -# ifndef BOOST_FUNCTION_45 -# define BOOST_FUNCTION_45 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 46 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 46 -# ifndef BOOST_FUNCTION_46 -# define BOOST_FUNCTION_46 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 47 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 47 -# ifndef BOOST_FUNCTION_47 -# define BOOST_FUNCTION_47 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 48 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 48 -# ifndef BOOST_FUNCTION_48 -# define BOOST_FUNCTION_48 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 49 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 49 -# ifndef BOOST_FUNCTION_49 -# define BOOST_FUNCTION_49 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 50 -# undef BOOST_FUNCTION_MAX_ARGS_DEFINED -# define BOOST_FUNCTION_MAX_ARGS_DEFINED 50 -# ifndef BOOST_FUNCTION_50 -# define BOOST_FUNCTION_50 -# include -# endif -#else -# error Cannot handle Boost.Function objects that accept more than 50 arguments! -#endif diff --git a/libraries/boost/include/boost/function/detail/prologue.hpp b/libraries/boost/include/boost/function/detail/prologue.hpp deleted file mode 100644 index 53d0f05cd3..0000000000 --- a/libraries/boost/include/boost/function/detail/prologue.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#ifndef BOOST_FUNCTION_PROLOGUE_HPP -#define BOOST_FUNCTION_PROLOGUE_HPP -# include -# include -# include // unary_function, binary_function -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif // BOOST_FUNCTION_PROLOGUE_HPP diff --git a/libraries/boost/include/boost/function/function0.hpp b/libraries/boost/include/boost/function/function0.hpp deleted file mode 100644 index 65a02e5fac..0000000000 --- a/libraries/boost/include/boost/function/function0.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 0 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/libraries/boost/include/boost/function/function1.hpp b/libraries/boost/include/boost/function/function1.hpp deleted file mode 100644 index 9089715155..0000000000 --- a/libraries/boost/include/boost/function/function1.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 1 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/libraries/boost/include/boost/function/function2.hpp b/libraries/boost/include/boost/function/function2.hpp deleted file mode 100644 index dc8bf97521..0000000000 --- a/libraries/boost/include/boost/function/function2.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2002-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 2 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/libraries/boost/include/boost/function/function_base.hpp b/libraries/boost/include/boost/function/function_base.hpp deleted file mode 100644 index 841affb49a..0000000000 --- a/libraries/boost/include/boost/function/function_base.hpp +++ /dev/null @@ -1,886 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2001-2006 -// Copyright Emil Dotchevski 2007 -// Use, modification and distribution is subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -#ifndef BOOST_FUNCTION_BASE_HEADER -#define BOOST_FUNCTION_BASE_HEADER - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef BOOST_NO_SFINAE -# include "boost/utility/enable_if.hpp" -#else -# include "boost/mpl/bool.hpp" -#endif -#include -#include - -#if defined(BOOST_MSVC) -# pragma warning( push ) -# pragma warning( disable : 4793 ) // complaint about native code generation -# pragma warning( disable : 4127 ) // "conditional expression is constant" -#endif - -#if defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG) -# define BOOST_FUNCTION_TARGET_FIX(x) x -#else -# define BOOST_FUNCTION_TARGET_FIX(x) -#endif // __ICL etc - -# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \ - typename ::boost::enable_if_c< \ - !(::boost::is_integral::value), \ - Type>::type - -namespace boost { - namespace detail { - namespace function { - class X; - - /** - * A buffer used to store small function objects in - * boost::function. It is a union containing function pointers, - * object pointers, and a structure that resembles a bound - * member function pointer. - */ - union function_buffer_members - { - // For pointers to function objects - typedef void* obj_ptr_t; - mutable obj_ptr_t obj_ptr; - - // For pointers to std::type_info objects - struct type_t { - // (get_functor_type_tag, check_functor_type_tag). - const boost::typeindex::type_info* type; - - // Whether the type is const-qualified. - bool const_qualified; - // Whether the type is volatile-qualified. - bool volatile_qualified; - } type; - - // For function pointers of all kinds - typedef void (*func_ptr_t)(); - mutable func_ptr_t func_ptr; - - // For bound member pointers - struct bound_memfunc_ptr_t { - void (X::*memfunc_ptr)(int); - void* obj_ptr; - } bound_memfunc_ptr; - - // For references to function objects. We explicitly keep - // track of the cv-qualifiers on the object referenced. - struct obj_ref_t { - mutable void* obj_ptr; - bool is_const_qualified; - bool is_volatile_qualified; - } obj_ref; - }; - - union function_buffer - { - // Type-specific union members - mutable function_buffer_members members; - - // To relax aliasing constraints - mutable char data[sizeof(function_buffer_members)]; - }; - - /** - * The unusable class is a placeholder for unused function arguments - * It is also completely unusable except that it constructable from - * anything. This helps compilers without partial specialization to - * handle Boost.Function objects returning void. - */ - struct unusable - { - unusable() {} - template unusable(const T&) {} - }; - - /* Determine the return type. This supports compilers that do not support - * void returns or partial specialization by silently changing the return - * type to "unusable". - */ - template struct function_return_type { typedef T type; }; - - template<> - struct function_return_type - { - typedef unusable type; - }; - - // The operation type to perform on the given functor/function pointer - enum functor_manager_operation_type { - clone_functor_tag, - move_functor_tag, - destroy_functor_tag, - check_functor_type_tag, - get_functor_type_tag - }; - - // Tags used to decide between different types of functions - struct function_ptr_tag {}; - struct function_obj_tag {}; - struct member_ptr_tag {}; - struct function_obj_ref_tag {}; - - template - class get_function_tag - { - typedef typename mpl::if_c<(is_pointer::value), - function_ptr_tag, - function_obj_tag>::type ptr_or_obj_tag; - - typedef typename mpl::if_c<(is_member_pointer::value), - member_ptr_tag, - ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag; - - typedef typename mpl::if_c<(is_reference_wrapper::value), - function_obj_ref_tag, - ptr_or_obj_or_mem_tag>::type or_ref_tag; - - public: - typedef or_ref_tag type; - }; - - // The trivial manager does nothing but return the same pointer (if we - // are cloning) or return the null pointer (if we are deleting). - template - struct reference_manager - { - static inline void - manage(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op) - { - switch (op) { - case clone_functor_tag: - out_buffer.members.obj_ref = in_buffer.members.obj_ref; - return; - - case move_functor_tag: - out_buffer.members.obj_ref = in_buffer.members.obj_ref; - in_buffer.members.obj_ref.obj_ptr = 0; - return; - - case destroy_functor_tag: - out_buffer.members.obj_ref.obj_ptr = 0; - return; - - case check_functor_type_tag: - { - // Check whether we have the same type. We can add - // cv-qualifiers, but we can't take them away. - if (*out_buffer.members.type.type == boost::typeindex::type_id() - && (!in_buffer.members.obj_ref.is_const_qualified - || out_buffer.members.type.const_qualified) - && (!in_buffer.members.obj_ref.is_volatile_qualified - || out_buffer.members.type.volatile_qualified)) - out_buffer.members.obj_ptr = in_buffer.members.obj_ref.obj_ptr; - else - out_buffer.members.obj_ptr = 0; - } - return; - - case get_functor_type_tag: - out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); - out_buffer.members.type.const_qualified = in_buffer.members.obj_ref.is_const_qualified; - out_buffer.members.type.volatile_qualified = in_buffer.members.obj_ref.is_volatile_qualified; - return; - } - } - }; - - /** - * Determine if boost::function can use the small-object - * optimization with the function object type F. - */ - template - struct function_allows_small_object_optimization - { - BOOST_STATIC_CONSTANT - (bool, - value = ((sizeof(F) <= sizeof(function_buffer) && - (alignment_of::value - % alignment_of::value == 0)))); - }; - - template - struct functor_wrapper: public F, public A - { - functor_wrapper( F f, A a ): - F(f), - A(a) - { - } - - functor_wrapper(const functor_wrapper& f) : - F(static_cast(f)), - A(static_cast(f)) - { - } - }; - - /** - * The functor_manager class contains a static function "manage" which - * can clone or destroy the given function/function object pointer. - */ - template - struct functor_manager_common - { - typedef Functor functor_type; - - // Function pointers - static inline void - manage_ptr(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op) - { - if (op == clone_functor_tag) - out_buffer.members.func_ptr = in_buffer.members.func_ptr; - else if (op == move_functor_tag) { - out_buffer.members.func_ptr = in_buffer.members.func_ptr; - in_buffer.members.func_ptr = 0; - } else if (op == destroy_functor_tag) - out_buffer.members.func_ptr = 0; - else if (op == check_functor_type_tag) { - if (*out_buffer.members.type.type == boost::typeindex::type_id()) - out_buffer.members.obj_ptr = &in_buffer.members.func_ptr; - else - out_buffer.members.obj_ptr = 0; - } else /* op == get_functor_type_tag */ { - out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); - out_buffer.members.type.const_qualified = false; - out_buffer.members.type.volatile_qualified = false; - } - } - - // Function objects that fit in the small-object buffer. - static inline void - manage_small(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op) - { - if (op == clone_functor_tag || op == move_functor_tag) { - const functor_type* in_functor = - reinterpret_cast(in_buffer.data); - new (reinterpret_cast(out_buffer.data)) functor_type(*in_functor); - - if (op == move_functor_tag) { - functor_type* f = reinterpret_cast(in_buffer.data); - (void)f; // suppress warning about the value of f not being used (MSVC) - f->~Functor(); - } - } else if (op == destroy_functor_tag) { - // Some compilers (Borland, vc6, ...) are unhappy with ~functor_type. - functor_type* f = reinterpret_cast(out_buffer.data); - (void)f; // suppress warning about the value of f not being used (MSVC) - f->~Functor(); - } else if (op == check_functor_type_tag) { - if (*out_buffer.members.type.type == boost::typeindex::type_id()) - out_buffer.members.obj_ptr = in_buffer.data; - else - out_buffer.members.obj_ptr = 0; - } else /* op == get_functor_type_tag */ { - out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); - out_buffer.members.type.const_qualified = false; - out_buffer.members.type.volatile_qualified = false; - } - } - }; - - template - struct functor_manager - { - private: - typedef Functor functor_type; - - // Function pointers - static inline void - manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, function_ptr_tag) - { - functor_manager_common::manage_ptr(in_buffer,out_buffer,op); - } - - // Function objects that fit in the small-object buffer. - static inline void - manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, mpl::true_) - { - functor_manager_common::manage_small(in_buffer,out_buffer,op); - } - - // Function objects that require heap allocation - static inline void - manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, mpl::false_) - { - if (op == clone_functor_tag) { - // Clone the functor - // GCC 2.95.3 gets the CV qualifiers wrong here, so we - // can't do the static_cast that we should do. - // jewillco: Changing this to static_cast because GCC 2.95.3 is - // obsolete. - const functor_type* f = - static_cast(in_buffer.members.obj_ptr); - functor_type* new_f = new functor_type(*f); - out_buffer.members.obj_ptr = new_f; - } else if (op == move_functor_tag) { - out_buffer.members.obj_ptr = in_buffer.members.obj_ptr; - in_buffer.members.obj_ptr = 0; - } else if (op == destroy_functor_tag) { - /* Cast from the void pointer to the functor pointer type */ - functor_type* f = - static_cast(out_buffer.members.obj_ptr); - delete f; - out_buffer.members.obj_ptr = 0; - } else if (op == check_functor_type_tag) { - if (*out_buffer.members.type.type == boost::typeindex::type_id()) - out_buffer.members.obj_ptr = in_buffer.members.obj_ptr; - else - out_buffer.members.obj_ptr = 0; - } else /* op == get_functor_type_tag */ { - out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); - out_buffer.members.type.const_qualified = false; - out_buffer.members.type.volatile_qualified = false; - } - } - - // For function objects, we determine whether the function - // object can use the small-object optimization buffer or - // whether we need to allocate it on the heap. - static inline void - manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, function_obj_tag) - { - manager(in_buffer, out_buffer, op, - mpl::bool_<(function_allows_small_object_optimization::value)>()); - } - - // For member pointers, we use the small-object optimization buffer. - static inline void - manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, member_ptr_tag) - { - manager(in_buffer, out_buffer, op, mpl::true_()); - } - - public: - /* Dispatch to an appropriate manager based on whether we have a - function pointer or a function object pointer. */ - static inline void - manage(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op) - { - typedef typename get_function_tag::type tag_type; - switch (op) { - case get_functor_type_tag: - out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); - out_buffer.members.type.const_qualified = false; - out_buffer.members.type.volatile_qualified = false; - return; - - default: - manager(in_buffer, out_buffer, op, tag_type()); - return; - } - } - }; - - template - struct functor_manager_a - { - private: - typedef Functor functor_type; - - // Function pointers - static inline void - manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, function_ptr_tag) - { - functor_manager_common::manage_ptr(in_buffer,out_buffer,op); - } - - // Function objects that fit in the small-object buffer. - static inline void - manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, mpl::true_) - { - functor_manager_common::manage_small(in_buffer,out_buffer,op); - } - - // Function objects that require heap allocation - static inline void - manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, mpl::false_) - { - typedef functor_wrapper functor_wrapper_type; -#if defined(BOOST_NO_CXX11_ALLOCATOR) - typedef typename Allocator::template rebind::other - wrapper_allocator_type; - typedef typename wrapper_allocator_type::pointer wrapper_allocator_pointer_type; -#else - using wrapper_allocator_type = typename std::allocator_traits::template rebind_alloc; - using wrapper_allocator_pointer_type = typename std::allocator_traits::pointer; -#endif - - if (op == clone_functor_tag) { - // Clone the functor - // GCC 2.95.3 gets the CV qualifiers wrong here, so we - // can't do the static_cast that we should do. - const functor_wrapper_type* f = - static_cast(in_buffer.members.obj_ptr); - wrapper_allocator_type wrapper_allocator(static_cast(*f)); - wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); -#if defined(BOOST_NO_CXX11_ALLOCATOR) - wrapper_allocator.construct(copy, *f); -#else - std::allocator_traits::construct(wrapper_allocator, copy, *f); -#endif - - // Get back to the original pointer type - functor_wrapper_type* new_f = static_cast(copy); - out_buffer.members.obj_ptr = new_f; - } else if (op == move_functor_tag) { - out_buffer.members.obj_ptr = in_buffer.members.obj_ptr; - in_buffer.members.obj_ptr = 0; - } else if (op == destroy_functor_tag) { - /* Cast from the void pointer to the functor_wrapper_type */ - functor_wrapper_type* victim = - static_cast(in_buffer.members.obj_ptr); - wrapper_allocator_type wrapper_allocator(static_cast(*victim)); -#if defined(BOOST_NO_CXX11_ALLOCATOR) - wrapper_allocator.destroy(victim); -#else - std::allocator_traits::destroy(wrapper_allocator, victim); -#endif - wrapper_allocator.deallocate(victim,1); - out_buffer.members.obj_ptr = 0; - } else if (op == check_functor_type_tag) { - if (*out_buffer.members.type.type == boost::typeindex::type_id()) - out_buffer.members.obj_ptr = in_buffer.members.obj_ptr; - else - out_buffer.members.obj_ptr = 0; - } else /* op == get_functor_type_tag */ { - out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); - out_buffer.members.type.const_qualified = false; - out_buffer.members.type.volatile_qualified = false; - } - } - - // For function objects, we determine whether the function - // object can use the small-object optimization buffer or - // whether we need to allocate it on the heap. - static inline void - manager(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op, function_obj_tag) - { - manager(in_buffer, out_buffer, op, - mpl::bool_<(function_allows_small_object_optimization::value)>()); - } - - public: - /* Dispatch to an appropriate manager based on whether we have a - function pointer or a function object pointer. */ - static inline void - manage(const function_buffer& in_buffer, function_buffer& out_buffer, - functor_manager_operation_type op) - { - typedef typename get_function_tag::type tag_type; - switch (op) { - case get_functor_type_tag: - out_buffer.members.type.type = &boost::typeindex::type_id().type_info(); - out_buffer.members.type.const_qualified = false; - out_buffer.members.type.volatile_qualified = false; - return; - - default: - manager(in_buffer, out_buffer, op, tag_type()); - return; - } - } - }; - - // A type that is only used for comparisons against zero - struct useless_clear_type {}; - -#ifdef BOOST_NO_SFINAE - // These routines perform comparisons between a Boost.Function - // object and an arbitrary function object (when the last - // parameter is mpl::bool_) or against zero (when the - // last parameter is mpl::bool_). They are only necessary - // for compilers that don't support SFINAE. - template - bool - compare_equal(const Function& f, const Functor&, int, mpl::bool_) - { return f.empty(); } - - template - bool - compare_not_equal(const Function& f, const Functor&, int, - mpl::bool_) - { return !f.empty(); } - - template - bool - compare_equal(const Function& f, const Functor& g, long, - mpl::bool_) - { - if (const Functor* fp = f.template target()) - return function_equal(*fp, g); - else return false; - } - - template - bool - compare_equal(const Function& f, const reference_wrapper& g, - int, mpl::bool_) - { - if (const Functor* fp = f.template target()) - return fp == g.get_pointer(); - else return false; - } - - template - bool - compare_not_equal(const Function& f, const Functor& g, long, - mpl::bool_) - { - if (const Functor* fp = f.template target()) - return !function_equal(*fp, g); - else return true; - } - - template - bool - compare_not_equal(const Function& f, - const reference_wrapper& g, int, - mpl::bool_) - { - if (const Functor* fp = f.template target()) - return fp != g.get_pointer(); - else return true; - } -#endif // BOOST_NO_SFINAE - - /** - * Stores the "manager" portion of the vtable for a - * boost::function object. - */ - struct vtable_base - { - void (*manager)(const function_buffer& in_buffer, - function_buffer& out_buffer, - functor_manager_operation_type op); - }; - } // end namespace function - } // end namespace detail - -/** - * The function_base class contains the basic elements needed for the - * function1, function2, function3, etc. classes. It is common to all - * functions (and as such can be used to tell if we have one of the - * functionN objects). - */ -class function_base -{ -public: - function_base() : vtable(0) { } - - /** Determine if the function is empty (i.e., has no target). */ - bool empty() const { return !vtable; } - - /** Retrieve the type of the stored function object, or type_id() - if this is empty. */ - const boost::typeindex::type_info& target_type() const - { - if (!vtable) return boost::typeindex::type_id().type_info(); - - detail::function::function_buffer type; - get_vtable()->manager(functor, type, detail::function::get_functor_type_tag); - return *type.members.type.type; - } - - template - Functor* target() - { - if (!vtable) return 0; - - detail::function::function_buffer type_result; - type_result.members.type.type = &boost::typeindex::type_id().type_info(); - type_result.members.type.const_qualified = is_const::value; - type_result.members.type.volatile_qualified = is_volatile::value; - get_vtable()->manager(functor, type_result, - detail::function::check_functor_type_tag); - return static_cast(type_result.members.obj_ptr); - } - - template - const Functor* target() const - { - if (!vtable) return 0; - - detail::function::function_buffer type_result; - type_result.members.type.type = &boost::typeindex::type_id().type_info(); - type_result.members.type.const_qualified = true; - type_result.members.type.volatile_qualified = is_volatile::value; - get_vtable()->manager(functor, type_result, - detail::function::check_functor_type_tag); - // GCC 2.95.3 gets the CV qualifiers wrong here, so we - // can't do the static_cast that we should do. - return static_cast(type_result.members.obj_ptr); - } - - template - bool contains(const F& f) const - { - if (const F* fp = this->template target()) - { - return function_equal(*fp, f); - } else { - return false; - } - } - -#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3 - // GCC 3.3 and newer cannot copy with the global operator==, due to - // problems with instantiation of function return types before it - // has been verified that the argument types match up. - template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(Functor g) const - { - if (const Functor* fp = target()) - return function_equal(*fp, g); - else return false; - } - - template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(Functor g) const - { - if (const Functor* fp = target()) - return !function_equal(*fp, g); - else return true; - } -#endif - -public: // should be protected, but GCC 2.95.3 will fail to allow access - detail::function::vtable_base* get_vtable() const { - return reinterpret_cast( - reinterpret_cast(vtable) & ~static_cast(0x01)); - } - - bool has_trivial_copy_and_destroy() const { - return reinterpret_cast(vtable) & 0x01; - } - - detail::function::vtable_base* vtable; - mutable detail::function::function_buffer functor; -}; - -#if defined(BOOST_CLANG) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wweak-vtables" -#endif -/** - * The bad_function_call exception class is thrown when a boost::function - * object is invoked - */ -class bad_function_call : public std::runtime_error -{ -public: - bad_function_call() : std::runtime_error("call to empty boost::function") {} -}; -#if defined(BOOST_CLANG) -# pragma clang diagnostic pop -#endif - -#ifndef BOOST_NO_SFINAE -inline bool operator==(const function_base& f, - detail::function::useless_clear_type*) -{ - return f.empty(); -} - -inline bool operator!=(const function_base& f, - detail::function::useless_clear_type*) -{ - return !f.empty(); -} - -inline bool operator==(detail::function::useless_clear_type*, - const function_base& f) -{ - return f.empty(); -} - -inline bool operator!=(detail::function::useless_clear_type*, - const function_base& f) -{ - return !f.empty(); -} -#endif - -#ifdef BOOST_NO_SFINAE -// Comparisons between boost::function objects and arbitrary function objects -template - inline bool operator==(const function_base& f, Functor g) - { - typedef mpl::bool_<(is_integral::value)> integral; - return detail::function::compare_equal(f, g, 0, integral()); - } - -template - inline bool operator==(Functor g, const function_base& f) - { - typedef mpl::bool_<(is_integral::value)> integral; - return detail::function::compare_equal(f, g, 0, integral()); - } - -template - inline bool operator!=(const function_base& f, Functor g) - { - typedef mpl::bool_<(is_integral::value)> integral; - return detail::function::compare_not_equal(f, g, 0, integral()); - } - -template - inline bool operator!=(Functor g, const function_base& f) - { - typedef mpl::bool_<(is_integral::value)> integral; - return detail::function::compare_not_equal(f, g, 0, integral()); - } -#else - -# if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) -// Comparisons between boost::function objects and arbitrary function -// objects. GCC 3.3 and before has an obnoxious bug that prevents this -// from working. -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(const function_base& f, Functor g) - { - if (const Functor* fp = f.template target()) - return function_equal(*fp, g); - else return false; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(Functor g, const function_base& f) - { - if (const Functor* fp = f.template target()) - return function_equal(g, *fp); - else return false; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(const function_base& f, Functor g) - { - if (const Functor* fp = f.template target()) - return !function_equal(*fp, g); - else return true; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(Functor g, const function_base& f) - { - if (const Functor* fp = f.template target()) - return !function_equal(g, *fp); - else return true; - } -# endif - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(const function_base& f, reference_wrapper g) - { - if (const Functor* fp = f.template target()) - return fp == g.get_pointer(); - else return false; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(reference_wrapper g, const function_base& f) - { - if (const Functor* fp = f.template target()) - return g.get_pointer() == fp; - else return false; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(const function_base& f, reference_wrapper g) - { - if (const Functor* fp = f.template target()) - return fp != g.get_pointer(); - else return true; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(reference_wrapper g, const function_base& f) - { - if (const Functor* fp = f.template target()) - return g.get_pointer() != fp; - else return true; - } - -#endif // Compiler supporting SFINAE - -namespace detail { - namespace function { - inline bool has_empty_target(const function_base* f) - { - return f->empty(); - } - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) - inline bool has_empty_target(const void*) - { - return false; - } -#else - inline bool has_empty_target(...) - { - return false; - } -#endif - } // end namespace function -} // end namespace detail -} // end namespace boost - -#undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL - -#if defined(BOOST_MSVC) -# pragma warning( pop ) -#endif - -#endif // BOOST_FUNCTION_BASE_HEADER diff --git a/libraries/boost/include/boost/function/function_fwd.hpp b/libraries/boost/include/boost/function/function_fwd.hpp deleted file mode 100644 index e79b504899..0000000000 --- a/libraries/boost/include/boost/function/function_fwd.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// Boost.Function library -// Copyright (C) Douglas Gregor 2008 -// -// Use, modification and distribution is subject to the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org -#ifndef BOOST_FUNCTION_FWD_HPP -#define BOOST_FUNCTION_FWD_HPP -#include - -#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG) -// Work around a compiler bug. -// boost::python::objects::function has to be seen by the compiler before the -// boost::function class template. -namespace boost { namespace python { namespace objects { - class function; -}}} -#endif - -#if defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ - || !(defined(BOOST_STRICT_CONFIG) || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) -# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX -#endif - -namespace boost { - class bad_function_call; - -#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) - // Preferred syntax - template class function; - - template - inline void swap(function& f1, function& f2) - { - f1.swap(f2); - } -#endif // have partial specialization - - // Portable syntax - template class function0; - template class function1; - template class function2; - template class function3; - template - class function4; - template - class function5; - template - class function6; - template - class function7; - template - class function8; - template - class function9; - template - class function10; -} - -#endif diff --git a/libraries/boost/include/boost/function/function_template.hpp b/libraries/boost/include/boost/function/function_template.hpp deleted file mode 100644 index 0b05940b22..0000000000 --- a/libraries/boost/include/boost/function/function_template.hpp +++ /dev/null @@ -1,1187 +0,0 @@ -// Boost.Function library - -// Copyright Douglas Gregor 2001-2006 -// Copyright Emil Dotchevski 2007 -// Use, modification and distribution is subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org - -// Note: this header is a header template and must NOT have multiple-inclusion -// protection. -#include -#include - -#if defined(BOOST_MSVC) -# pragma warning( push ) -# pragma warning( disable : 4127 ) // "conditional expression is constant" -#endif - -#define BOOST_FUNCTION_TEMPLATE_PARMS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, typename T) - -#define BOOST_FUNCTION_TEMPLATE_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, T) - -#define BOOST_FUNCTION_PARM(J,I,D) BOOST_PP_CAT(T,I) BOOST_PP_CAT(a,I) - -#define BOOST_FUNCTION_PARMS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_PARM,BOOST_PP_EMPTY) - -#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES -# define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a) -#else -# include -# define BOOST_FUNCTION_ARG(J,I,D) ::boost::forward< BOOST_PP_CAT(T,I) >(BOOST_PP_CAT(a,I)) -# define BOOST_FUNCTION_ARGS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG,BOOST_PP_EMPTY) -#endif - -#define BOOST_FUNCTION_ARG_TYPE(J,I,D) \ - typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(I)),_type); - -#define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,BOOST_PP_EMPTY) - -// Comma if nonzero number of arguments -#if BOOST_FUNCTION_NUM_ARGS == 0 -# define BOOST_FUNCTION_COMMA -#else -# define BOOST_FUNCTION_COMMA , -#endif // BOOST_FUNCTION_NUM_ARGS > 0 - -// Class names used in this version of the code -#define BOOST_FUNCTION_FUNCTION BOOST_JOIN(function,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_FUNCTION_INVOKER \ - BOOST_JOIN(function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_FUNCTION_INVOKER \ - BOOST_JOIN(void_function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(void_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_FUNCTION_REF_INVOKER \ - BOOST_JOIN(function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER \ - BOOST_JOIN(void_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_MEMBER_INVOKER \ - BOOST_JOIN(function_mem_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_MEMBER_INVOKER \ - BOOST_JOIN(function_void_mem_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_FUNCTION_INVOKER \ - BOOST_JOIN(get_function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(get_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER \ - BOOST_JOIN(get_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_MEMBER_INVOKER \ - BOOST_JOIN(get_member_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_INVOKER \ - BOOST_JOIN(get_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VTABLE BOOST_JOIN(basic_vtable,BOOST_FUNCTION_NUM_ARGS) - -#ifndef BOOST_NO_VOID_RETURNS -# define BOOST_FUNCTION_VOID_RETURN_TYPE void -# define BOOST_FUNCTION_RETURN(X) X -#else -# define BOOST_FUNCTION_VOID_RETURN_TYPE boost::detail::function::unusable -# define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE () -#endif - -namespace boost { - namespace detail { - namespace function { - template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_FUNCTION_INVOKER - { - static R invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - { - FunctionPtr f = reinterpret_cast(function_ptr.members.func_ptr); - return f(BOOST_FUNCTION_ARGS); - } - }; - - template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER - { - static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - FunctionPtr f = reinterpret_cast(function_ptr.members.func_ptr); - BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS)); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_FUNCTION_OBJ_INVOKER - { - static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - FunctionObj* f; - if (function_allows_small_object_optimization::value) - f = reinterpret_cast(function_obj_ptr.data); - else - f = reinterpret_cast(function_obj_ptr.members.obj_ptr); - return (*f)(BOOST_FUNCTION_ARGS); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER - { - static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - FunctionObj* f; - if (function_allows_small_object_optimization::value) - f = reinterpret_cast(function_obj_ptr.data); - else - f = reinterpret_cast(function_obj_ptr.members.obj_ptr); - BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_FUNCTION_REF_INVOKER - { - static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - FunctionObj* f = - reinterpret_cast(function_obj_ptr.members.obj_ptr); - return (*f)(BOOST_FUNCTION_ARGS); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER - { - static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - FunctionObj* f = - reinterpret_cast(function_obj_ptr.members.obj_ptr); - BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); - } - }; - -#if BOOST_FUNCTION_NUM_ARGS > 0 - /* Handle invocation of member pointers. */ - template< - typename MemberPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_MEMBER_INVOKER - { - static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - MemberPtr* f = - reinterpret_cast(function_obj_ptr.data); - return boost::mem_fn(*f)(BOOST_FUNCTION_ARGS); - } - }; - - template< - typename MemberPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_VOID_MEMBER_INVOKER - { - static BOOST_FUNCTION_VOID_RETURN_TYPE - invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - MemberPtr* f = - reinterpret_cast(function_obj_ptr.data); - BOOST_FUNCTION_RETURN(boost::mem_fn(*f)(BOOST_FUNCTION_ARGS)); - } - }; -#endif - - template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_GET_FUNCTION_INVOKER - { - typedef typename mpl::if_c<(is_void::value), - BOOST_FUNCTION_VOID_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER - { - typedef typename mpl::if_c<(is_void::value), - BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER - { - typedef typename mpl::if_c<(is_void::value), - BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_FUNCTION_REF_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; - }; - -#if BOOST_FUNCTION_NUM_ARGS > 0 - /* Retrieve the appropriate invoker for a member pointer. */ - template< - typename MemberPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_GET_MEMBER_INVOKER - { - typedef typename mpl::if_c<(is_void::value), - BOOST_FUNCTION_VOID_MEMBER_INVOKER< - MemberPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_MEMBER_INVOKER< - MemberPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; - }; -#endif - - /* Given the tag returned by get_function_tag, retrieve the - actual invoker that will be used for the given function - object. - - Each specialization contains an "apply" nested class template - that accepts the function object, return type, function - argument types, and allocator. The resulting "apply" class - contains two typedefs, "invoker_type" and "manager_type", - which correspond to the invoker and manager types. */ - template - struct BOOST_FUNCTION_GET_INVOKER { }; - - /* Retrieve the invoker for a function pointer. */ - template<> - struct BOOST_FUNCTION_GET_INVOKER - { - template - struct apply - { - typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; - - typedef functor_manager manager_type; - }; - - template - struct apply_a - { - typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; - - typedef functor_manager manager_type; - }; - }; - -#if BOOST_FUNCTION_NUM_ARGS > 0 - /* Retrieve the invoker for a member pointer. */ - template<> - struct BOOST_FUNCTION_GET_INVOKER - { - template - struct apply - { - typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER< - MemberPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; - - typedef functor_manager manager_type; - }; - - template - struct apply_a - { - typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER< - MemberPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; - - typedef functor_manager manager_type; - }; - }; -#endif - - /* Retrieve the invoker for a function object. */ - template<> - struct BOOST_FUNCTION_GET_INVOKER - { - template - struct apply - { - typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; - - typedef functor_manager manager_type; - }; - - template - struct apply_a - { - typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; - - typedef functor_manager_a manager_type; - }; - }; - - /* Retrieve the invoker for a reference to a function object. */ - template<> - struct BOOST_FUNCTION_GET_INVOKER - { - template - struct apply - { - typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER< - typename RefWrapper::type, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; - - typedef reference_manager manager_type; - }; - - template - struct apply_a - { - typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER< - typename RefWrapper::type, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - invoker_type; - - typedef reference_manager manager_type; - }; - }; - - - /** - * vtable for a specific boost::function instance. This - * structure must be an aggregate so that we can use static - * initialization in boost::function's assign_to and assign_to_a - * members. It therefore cannot have any constructors, - * destructors, base classes, etc. - */ - template - struct BOOST_FUNCTION_VTABLE - { -#ifndef BOOST_NO_VOID_RETURNS - typedef R result_type; -#else - typedef typename function_return_type::type result_type; -#endif // BOOST_NO_VOID_RETURNS - - typedef result_type (*invoker_type)(function_buffer& - BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS); - - template - bool assign_to(F f, function_buffer& functor) const - { - typedef typename get_function_tag::type tag; - return assign_to(f, functor, tag()); - } - template - bool assign_to_a(F f, function_buffer& functor, Allocator a) const - { - typedef typename get_function_tag::type tag; - return assign_to_a(f, functor, a, tag()); - } - - void clear(function_buffer& functor) const - { - if (base.manager) - base.manager(functor, functor, destroy_functor_tag); - } - - private: - // Function pointers - template - bool - assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag) const - { - this->clear(functor); - if (f) { - // should be a reinterpret cast, but some compilers insist - // on giving cv-qualifiers to free functions - functor.members.func_ptr = reinterpret_cast(f); - return true; - } else { - return false; - } - } - template - bool - assign_to_a(FunctionPtr f, function_buffer& functor, Allocator, function_ptr_tag) const - { - return assign_to(f,functor,function_ptr_tag()); - } - - // Member pointers -#if BOOST_FUNCTION_NUM_ARGS > 0 - template - bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) const - { - // DPG TBD: Add explicit support for member function - // objects, so we invoke through mem_fn() but we retain the - // right target_type() values. - if (f) { - this->assign_to(boost::mem_fn(f), functor); - return true; - } else { - return false; - } - } - template - bool assign_to_a(MemberPtr f, function_buffer& functor, Allocator a, member_ptr_tag) const - { - // DPG TBD: Add explicit support for member function - // objects, so we invoke through mem_fn() but we retain the - // right target_type() values. - if (f) { - this->assign_to_a(boost::mem_fn(f), functor, a); - return true; - } else { - return false; - } - } -#endif // BOOST_FUNCTION_NUM_ARGS > 0 - - // Function objects - // Assign to a function object using the small object optimization - template - void - assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) const - { - new (reinterpret_cast(functor.data)) FunctionObj(f); - } - template - void - assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, mpl::true_) const - { - assign_functor(f,functor,mpl::true_()); - } - - // Assign to a function object allocated on the heap. - template - void - assign_functor(FunctionObj f, function_buffer& functor, mpl::false_) const - { - functor.members.obj_ptr = new FunctionObj(f); - } - template - void - assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, mpl::false_) const - { - typedef functor_wrapper functor_wrapper_type; -#if defined(BOOST_NO_CXX11_ALLOCATOR) - typedef typename Allocator::template rebind::other - wrapper_allocator_type; - typedef typename wrapper_allocator_type::pointer wrapper_allocator_pointer_type; -#else - using wrapper_allocator_type = typename std::allocator_traits::template rebind_alloc; - using wrapper_allocator_pointer_type = typename std::allocator_traits::pointer; -#endif - wrapper_allocator_type wrapper_allocator(a); - wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); -#if defined(BOOST_NO_CXX11_ALLOCATOR) - wrapper_allocator.construct(copy, functor_wrapper_type(f,a)); -#else - std::allocator_traits::construct(wrapper_allocator, copy, functor_wrapper_type(f,a)); -#endif - functor_wrapper_type* new_f = static_cast(copy); - functor.members.obj_ptr = new_f; - } - - template - bool - assign_to(FunctionObj f, function_buffer& functor, function_obj_tag) const - { - if (!boost::detail::function::has_empty_target(boost::addressof(f))) { - assign_functor(f, functor, - mpl::bool_<(function_allows_small_object_optimization::value)>()); - return true; - } else { - return false; - } - } - template - bool - assign_to_a(FunctionObj f, function_buffer& functor, Allocator a, function_obj_tag) const - { - if (!boost::detail::function::has_empty_target(boost::addressof(f))) { - assign_functor_a(f, functor, a, - mpl::bool_<(function_allows_small_object_optimization::value)>()); - return true; - } else { - return false; - } - } - - // Reference to a function object - template - bool - assign_to(const reference_wrapper& f, - function_buffer& functor, function_obj_ref_tag) const - { - functor.members.obj_ref.obj_ptr = (void *)(f.get_pointer()); - functor.members.obj_ref.is_const_qualified = is_const::value; - functor.members.obj_ref.is_volatile_qualified = is_volatile::value; - return true; - } - template - bool - assign_to_a(const reference_wrapper& f, - function_buffer& functor, Allocator, function_obj_ref_tag) const - { - return assign_to(f,functor,function_obj_ref_tag()); - } - - public: - vtable_base base; - invoker_type invoker; - }; - } // end namespace function - } // end namespace detail - - template< - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - class BOOST_FUNCTION_FUNCTION : public function_base - { - public: -#ifndef BOOST_NO_VOID_RETURNS - typedef R result_type; -#else - typedef typename boost::detail::function::function_return_type::type - result_type; -#endif // BOOST_NO_VOID_RETURNS - - private: - typedef boost::detail::function::BOOST_FUNCTION_VTABLE< - R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS> - vtable_type; - - vtable_type* get_vtable() const { - return reinterpret_cast( - reinterpret_cast(vtable) & ~static_cast(0x01)); - } - - struct clear_type {}; - - public: - BOOST_STATIC_CONSTANT(int, args = BOOST_FUNCTION_NUM_ARGS); - - // add signature for boost::lambda - template - struct sig - { - typedef result_type type; - }; - -#if BOOST_FUNCTION_NUM_ARGS == 1 - typedef T0 argument_type; -#elif BOOST_FUNCTION_NUM_ARGS == 2 - typedef T0 first_argument_type; - typedef T1 second_argument_type; -#endif - - BOOST_STATIC_CONSTANT(int, arity = BOOST_FUNCTION_NUM_ARGS); - BOOST_FUNCTION_ARG_TYPES - - typedef BOOST_FUNCTION_FUNCTION self_type; - - BOOST_FUNCTION_FUNCTION() : function_base() { } - - // MSVC chokes if the following two constructors are collapsed into - // one with a default parameter. - template - BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f -#ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_c< - !(is_integral::value), - int>::type = 0 -#endif // BOOST_NO_SFINAE - ) : - function_base() - { - this->assign_to(f); - } - template - BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a -#ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_c< - !(is_integral::value), - int>::type = 0 -#endif // BOOST_NO_SFINAE - ) : - function_base() - { - this->assign_to_a(f,a); - } - -#ifndef BOOST_NO_SFINAE - BOOST_FUNCTION_FUNCTION(clear_type*) : function_base() { } -#else - BOOST_FUNCTION_FUNCTION(int zero) : function_base() - { - BOOST_ASSERT(zero == 0); - } -#endif - - BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : function_base() - { - this->assign_to_own(f); - } - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base() - { - this->move_assign(f); - } -#endif - - ~BOOST_FUNCTION_FUNCTION() { clear(); } - - result_type operator()(BOOST_FUNCTION_PARMS) const - { - if (this->empty()) - boost::throw_exception(bad_function_call()); - - return get_vtable()->invoker - (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); - } - - // The distinction between when to use BOOST_FUNCTION_FUNCTION and - // when to use self_type is obnoxious. MSVC cannot handle self_type as - // the return type of these assignment operators, but Borland C++ cannot - // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to - // construct. - template -#ifndef BOOST_NO_SFINAE - typename boost::enable_if_c< - !(is_integral::value), - BOOST_FUNCTION_FUNCTION&>::type -#else - BOOST_FUNCTION_FUNCTION& -#endif - operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) - { - this->clear(); - BOOST_TRY { - this->assign_to(f); - } BOOST_CATCH (...) { - vtable = 0; - BOOST_RETHROW; - } - BOOST_CATCH_END - return *this; - } - template - void assign(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a) - { - this->clear(); - BOOST_TRY{ - this->assign_to_a(f,a); - } BOOST_CATCH (...) { - vtable = 0; - BOOST_RETHROW; - } - BOOST_CATCH_END - } - -#ifndef BOOST_NO_SFINAE - BOOST_FUNCTION_FUNCTION& operator=(clear_type*) - { - this->clear(); - return *this; - } -#else - BOOST_FUNCTION_FUNCTION& operator=(int zero) - { - BOOST_ASSERT(zero == 0); - this->clear(); - return *this; - } -#endif - - // Assignment from another BOOST_FUNCTION_FUNCTION - BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f) - { - if (&f == this) - return *this; - - this->clear(); - BOOST_TRY { - this->assign_to_own(f); - } BOOST_CATCH (...) { - vtable = 0; - BOOST_RETHROW; - } - BOOST_CATCH_END - return *this; - } - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - // Move assignment from another BOOST_FUNCTION_FUNCTION - BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f) - { - if (&f == this) - return *this; - - this->clear(); - BOOST_TRY { - this->move_assign(f); - } BOOST_CATCH (...) { - vtable = 0; - BOOST_RETHROW; - } - BOOST_CATCH_END - return *this; - } -#endif - - void swap(BOOST_FUNCTION_FUNCTION& other) - { - if (&other == this) - return; - - BOOST_FUNCTION_FUNCTION tmp; - tmp.move_assign(*this); - this->move_assign(other); - other.move_assign(tmp); - } - - // Clear out a target, if there is one - void clear() - { - if (vtable) { - if (!this->has_trivial_copy_and_destroy()) - get_vtable()->clear(this->functor); - vtable = 0; - } - } - -#if (defined __SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && !(defined BOOST_NO_COMPILER_CONFIG) - // Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it - operator bool () const { return !this->empty(); } -#else - private: - struct dummy { - void nonnull() {} - }; - - typedef void (dummy::*safe_bool)(); - - public: - operator safe_bool () const - { return (this->empty())? 0 : &dummy::nonnull; } - - bool operator!() const - { return this->empty(); } -#endif - - private: - void assign_to_own(const BOOST_FUNCTION_FUNCTION& f) - { - if (!f.empty()) { - this->vtable = f.vtable; - if (this->has_trivial_copy_and_destroy()) - this->functor = f.functor; - else - get_vtable()->base.manager(f.functor, this->functor, - boost::detail::function::clone_functor_tag); - } - } - - template - void assign_to(Functor f) - { - using boost::detail::function::vtable_base; - - typedef typename boost::detail::function::get_function_tag::type tag; - typedef boost::detail::function::BOOST_FUNCTION_GET_INVOKER get_invoker; - typedef typename get_invoker:: - template apply - handler_type; - - typedef typename handler_type::invoker_type invoker_type; - typedef typename handler_type::manager_type manager_type; - - // Note: it is extremely important that this initialization use - // static initialization. Otherwise, we will have a race - // condition here in multi-threaded code. See - // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. - static const vtable_type stored_vtable = - { { &manager_type::manage }, &invoker_type::invoke }; - - if (stored_vtable.assign_to(f, functor)) { - std::size_t value = reinterpret_cast(&stored_vtable.base); - // coverity[pointless_expression]: suppress coverity warnings on apparant if(const). - if (boost::has_trivial_copy_constructor::value && - boost::has_trivial_destructor::value && - boost::detail::function::function_allows_small_object_optimization::value) - value |= static_cast(0x01); - vtable = reinterpret_cast(value); - } else - vtable = 0; - } - - template - void assign_to_a(Functor f,Allocator a) - { - using boost::detail::function::vtable_base; - - typedef typename boost::detail::function::get_function_tag::type tag; - typedef boost::detail::function::BOOST_FUNCTION_GET_INVOKER get_invoker; - typedef typename get_invoker:: - template apply_a - handler_type; - - typedef typename handler_type::invoker_type invoker_type; - typedef typename handler_type::manager_type manager_type; - - // Note: it is extremely important that this initialization use - // static initialization. Otherwise, we will have a race - // condition here in multi-threaded code. See - // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. - static const vtable_type stored_vtable = - { { &manager_type::manage }, &invoker_type::invoke }; - - if (stored_vtable.assign_to_a(f, functor, a)) { - std::size_t value = reinterpret_cast(&stored_vtable.base); - // coverity[pointless_expression]: suppress coverity warnings on apparant if(const). - if (boost::has_trivial_copy_constructor::value && - boost::has_trivial_destructor::value && - boost::detail::function::function_allows_small_object_optimization::value) - value |= static_cast(0x01); - vtable = reinterpret_cast(value); - } else - vtable = 0; - } - - // Moves the value from the specified argument to *this. If the argument - // has its function object allocated on the heap, move_assign will pass - // its buffer to *this, and set the argument's buffer pointer to NULL. - void move_assign(BOOST_FUNCTION_FUNCTION& f) - { - if (&f == this) - return; - - BOOST_TRY { - if (!f.empty()) { - this->vtable = f.vtable; - if (this->has_trivial_copy_and_destroy()) - this->functor = f.functor; - else - get_vtable()->base.manager(f.functor, this->functor, - boost::detail::function::move_functor_tag); - f.vtable = 0; - } else { - clear(); - } - } BOOST_CATCH (...) { - vtable = 0; - BOOST_RETHROW; - } - BOOST_CATCH_END - } - }; - - template - inline void swap(BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >& f1, - BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >& f2) - { - f1.swap(f2); - } - -// Poison comparisons between boost::function objects of the same type. -template - void operator==(const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS>&, - const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS>&); -template - void operator!=(const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS>&, - const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS>& ); - -#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) - -#if BOOST_FUNCTION_NUM_ARGS == 0 -#define BOOST_FUNCTION_PARTIAL_SPEC R (void) -#else -#define BOOST_FUNCTION_PARTIAL_SPEC R (BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS,T)) -#endif - -template -class function - : public BOOST_FUNCTION_FUNCTION -{ - typedef BOOST_FUNCTION_FUNCTION base_type; - typedef function self_type; - - struct clear_type {}; - -public: - - function() : base_type() {} - - template - function(Functor f -#ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_c< - !(is_integral::value), - int>::type = 0 -#endif - ) : - base_type(f) - { - } - template - function(Functor f, Allocator a -#ifndef BOOST_NO_SFINAE - ,typename boost::enable_if_c< - !(is_integral::value), - int>::type = 0 -#endif - ) : - base_type(f,a) - { - } - -#ifndef BOOST_NO_SFINAE - function(clear_type*) : base_type() {} -#endif - - function(const self_type& f) : base_type(static_cast(f)){} - - function(const base_type& f) : base_type(static_cast(f)){} - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - // Move constructors - function(self_type&& f): base_type(static_cast(f)){} - function(base_type&& f): base_type(static_cast(f)){} -#endif - - self_type& operator=(const self_type& f) - { - self_type(f).swap(*this); - return *this; - } - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - self_type& operator=(self_type&& f) - { - self_type(static_cast(f)).swap(*this); - return *this; - } -#endif - - template -#ifndef BOOST_NO_SFINAE - typename boost::enable_if_c< - !(is_integral::value), - self_type&>::type -#else - self_type& -#endif - operator=(Functor f) - { - self_type(f).swap(*this); - return *this; - } - -#ifndef BOOST_NO_SFINAE - self_type& operator=(clear_type*) - { - this->clear(); - return *this; - } -#endif - - self_type& operator=(const base_type& f) - { - self_type(f).swap(*this); - return *this; - } - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - self_type& operator=(base_type&& f) - { - self_type(static_cast(f)).swap(*this); - return *this; - } -#endif -}; - -#undef BOOST_FUNCTION_PARTIAL_SPEC -#endif // have partial specialization - -} // end namespace boost - -// Cleanup after ourselves... -#undef BOOST_FUNCTION_VTABLE -#undef BOOST_FUNCTION_COMMA -#undef BOOST_FUNCTION_FUNCTION -#undef BOOST_FUNCTION_FUNCTION_INVOKER -#undef BOOST_FUNCTION_VOID_FUNCTION_INVOKER -#undef BOOST_FUNCTION_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_FUNCTION_REF_INVOKER -#undef BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER -#undef BOOST_FUNCTION_MEMBER_INVOKER -#undef BOOST_FUNCTION_VOID_MEMBER_INVOKER -#undef BOOST_FUNCTION_GET_FUNCTION_INVOKER -#undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER -#undef BOOST_FUNCTION_GET_MEM_FUNCTION_INVOKER -#undef BOOST_FUNCTION_GET_INVOKER -#undef BOOST_FUNCTION_TEMPLATE_PARMS -#undef BOOST_FUNCTION_TEMPLATE_ARGS -#undef BOOST_FUNCTION_PARMS -#undef BOOST_FUNCTION_PARM -#ifdef BOOST_FUNCTION_ARG -# undef BOOST_FUNCTION_ARG -#endif -#undef BOOST_FUNCTION_ARGS -#undef BOOST_FUNCTION_ARG_TYPE -#undef BOOST_FUNCTION_ARG_TYPES -#undef BOOST_FUNCTION_VOID_RETURN_TYPE -#undef BOOST_FUNCTION_RETURN - -#if defined(BOOST_MSVC) -# pragma warning( pop ) -#endif diff --git a/libraries/boost/include/boost/function_equal.hpp b/libraries/boost/include/boost/function_equal.hpp deleted file mode 100644 index 2d76c75bc9..0000000000 --- a/libraries/boost/include/boost/function_equal.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright Douglas Gregor 2004. -// Copyright 2005 Peter Dimov - -// Use, modification and distribution is subject to -// the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org -#ifndef BOOST_FUNCTION_EQUAL_HPP -#define BOOST_FUNCTION_EQUAL_HPP - -namespace boost { - -template - bool function_equal_impl(const F& f, const G& g, long) - { return f == g; } - -// function_equal_impl needs to be unqualified to pick -// user overloads on two-phase compilers - -template - bool function_equal(const F& f, const G& g) - { return function_equal_impl(f, g, 0); } - -} // end namespace boost - -#endif // BOOST_FUNCTION_EQUAL_HPP diff --git a/libraries/boost/include/boost/get_pointer.hpp b/libraries/boost/include/boost/get_pointer.hpp deleted file mode 100644 index 36e2cd7d0f..0000000000 --- a/libraries/boost/include/boost/get_pointer.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright Peter Dimov and David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef GET_POINTER_DWA20021219_HPP -#define GET_POINTER_DWA20021219_HPP - -#include - -// In order to avoid circular dependencies with Boost.TR1 -// we make sure that our include of doesn't try to -// pull in the TR1 headers: that's why we use this header -// rather than including directly: -#include // std::auto_ptr - -namespace boost { - -// get_pointer(p) extracts a ->* capable pointer from p - -template T * get_pointer(T * p) -{ - return p; -} - -// get_pointer(shared_ptr const & p) has been moved to shared_ptr.hpp - -#if !defined( BOOST_NO_AUTO_PTR ) - -#if defined( __GNUC__ ) && (defined( __GXX_EXPERIMENTAL_CXX0X__ ) || (__cplusplus >= 201103L)) -#if defined( BOOST_GCC ) -#if BOOST_GCC >= 40600 -#define BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS -#endif // BOOST_GCC >= 40600 -#elif defined( __clang__ ) && defined( __has_warning ) -#if __has_warning("-Wdeprecated-declarations") -#define BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS -#endif // __has_warning("-Wdeprecated-declarations") -#endif -#endif // defined( __GNUC__ ) && (defined( __GXX_EXPERIMENTAL_CXX0X__ ) || (__cplusplus >= 201103L)) - -#if defined( BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS ) -// Disable libstdc++ warnings about std::auto_ptr being deprecated in C++11 mode -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#define BOOST_CORE_DETAIL_DISABLED_DEPRECATED_WARNINGS -#endif - -template T * get_pointer(std::auto_ptr const& p) -{ - return p.get(); -} - -#if defined( BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS ) -#pragma GCC diagnostic pop -#undef BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS -#endif - -#endif // !defined( BOOST_NO_AUTO_PTR ) - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) - -template T * get_pointer( std::unique_ptr const& p ) -{ - return p.get(); -} - -template T * get_pointer( std::shared_ptr const& p ) -{ - return p.get(); -} - -#endif - -} // namespace boost - -#endif // GET_POINTER_DWA20021219_HPP diff --git a/libraries/boost/include/boost/integer.hpp b/libraries/boost/include/boost/integer.hpp deleted file mode 100644 index 9fa0019484..0000000000 --- a/libraries/boost/include/boost/integer.hpp +++ /dev/null @@ -1,262 +0,0 @@ -// boost integer.hpp header file -------------------------------------------// - -// Copyright Beman Dawes and Daryle Walker 1999. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/integer for documentation. - -// Revision History -// 22 Sep 01 Added value-based integer templates. (Daryle Walker) -// 01 Apr 01 Modified to use new header. (John Maddock) -// 30 Jul 00 Add typename syntax fix (Jens Maurer) -// 28 Aug 99 Initial version - -#ifndef BOOST_INTEGER_HPP -#define BOOST_INTEGER_HPP - -#include // self include - -#include // for boost::::boost::integer_traits -#include // for ::std::numeric_limits -#include // for boost::int64_t and BOOST_NO_INTEGRAL_INT64_T -#include - -// -// We simply cannot include this header on gcc without getting copious warnings of the kind: -// -// boost/integer.hpp:77:30: warning: use of C99 long long integer constant -// -// And yet there is no other reasonable implementation, so we declare this a system header -// to suppress these warnings. -// -#if defined(__GNUC__) && (__GNUC__ >= 4) -#pragma GCC system_header -#endif - -namespace boost -{ - - // Helper templates ------------------------------------------------------// - - // fast integers from least integers - // int_fast_t<> works correctly for unsigned too, in spite of the name. - template< typename LeastInt > - struct int_fast_t - { - typedef LeastInt fast; - typedef fast type; - }; // imps may specialize - - namespace detail{ - - // convert category to type - template< int Category > struct int_least_helper {}; // default is empty - template< int Category > struct uint_least_helper {}; // default is empty - - // specializatons: 1=long, 2=int, 3=short, 4=signed char, - // 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char - // no specializations for 0 and 5: requests for a type > long are in error -#ifdef BOOST_HAS_LONG_LONG - template<> struct int_least_helper<1> { typedef boost::long_long_type least; }; -#elif defined(BOOST_HAS_MS_INT64) - template<> struct int_least_helper<1> { typedef __int64 least; }; -#endif - template<> struct int_least_helper<2> { typedef long least; }; - template<> struct int_least_helper<3> { typedef int least; }; - template<> struct int_least_helper<4> { typedef short least; }; - template<> struct int_least_helper<5> { typedef signed char least; }; -#ifdef BOOST_HAS_LONG_LONG - template<> struct uint_least_helper<1> { typedef boost::ulong_long_type least; }; -#elif defined(BOOST_HAS_MS_INT64) - template<> struct uint_least_helper<1> { typedef unsigned __int64 least; }; -#endif - template<> struct uint_least_helper<2> { typedef unsigned long least; }; - template<> struct uint_least_helper<3> { typedef unsigned int least; }; - template<> struct uint_least_helper<4> { typedef unsigned short least; }; - template<> struct uint_least_helper<5> { typedef unsigned char least; }; - - template - struct exact_signed_base_helper{}; - template - struct exact_unsigned_base_helper{}; - - template <> struct exact_signed_base_helper { typedef signed char exact; }; - template <> struct exact_unsigned_base_helper { typedef unsigned char exact; }; -#if USHRT_MAX != UCHAR_MAX - template <> struct exact_signed_base_helper { typedef short exact; }; - template <> struct exact_unsigned_base_helper { typedef unsigned short exact; }; -#endif -#if UINT_MAX != USHRT_MAX - template <> struct exact_signed_base_helper { typedef int exact; }; - template <> struct exact_unsigned_base_helper { typedef unsigned int exact; }; -#endif -#if ULONG_MAX != UINT_MAX && ( !defined __TI_COMPILER_VERSION__ || \ - ( __TI_COMPILER_VERSION__ >= 7000000 && !defined __TI_40BIT_LONG__ ) ) - template <> struct exact_signed_base_helper { typedef long exact; }; - template <> struct exact_unsigned_base_helper { typedef unsigned long exact; }; -#endif -#if defined(BOOST_HAS_LONG_LONG) &&\ - ((defined(ULLONG_MAX) && (ULLONG_MAX != ULONG_MAX)) ||\ - (defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX != ULONG_MAX)) ||\ - (defined(ULONGLONG_MAX) && (ULONGLONG_MAX != ULONG_MAX)) ||\ - (defined(_ULLONG_MAX) && (_ULLONG_MAX != ULONG_MAX))) - template <> struct exact_signed_base_helper { typedef boost::long_long_type exact; }; - template <> struct exact_unsigned_base_helper { typedef boost::ulong_long_type exact; }; -#endif - - - } // namespace detail - - // integer templates specifying number of bits ---------------------------// - - // signed - template< int Bits > // bits (including sign) required - struct int_t : public boost::detail::exact_signed_base_helper - { - BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::intmax_t) * CHAR_BIT), - "No suitable signed integer type with the requested number of bits is available."); - typedef typename boost::detail::int_least_helper - < -#ifdef BOOST_HAS_LONG_LONG - (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + -#else - 1 + -#endif - (Bits-1 <= ::std::numeric_limits::digits) + - (Bits-1 <= ::std::numeric_limits::digits) + - (Bits-1 <= ::std::numeric_limits::digits) + - (Bits-1 <= ::std::numeric_limits::digits) - >::least least; - typedef typename int_fast_t::type fast; - }; - - // unsigned - template< int Bits > // bits required - struct uint_t : public boost::detail::exact_unsigned_base_helper - { - BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::uintmax_t) * CHAR_BIT), - "No suitable unsigned integer type with the requested number of bits is available."); -#if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T) - // It's really not clear why this workaround should be needed... shrug I guess! JM - BOOST_STATIC_CONSTANT(int, s = - 6 + - (Bits <= ::std::numeric_limits::digits) + - (Bits <= ::std::numeric_limits::digits) + - (Bits <= ::std::numeric_limits::digits) + - (Bits <= ::std::numeric_limits::digits)); - typedef typename detail::int_least_helper< ::boost::uint_t::s>::least least; -#else - typedef typename boost::detail::uint_least_helper - < -#ifdef BOOST_HAS_LONG_LONG - (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + -#else - 1 + -#endif - (Bits <= ::std::numeric_limits::digits) + - (Bits <= ::std::numeric_limits::digits) + - (Bits <= ::std::numeric_limits::digits) + - (Bits <= ::std::numeric_limits::digits) - >::least least; -#endif - typedef typename int_fast_t::type fast; - // int_fast_t<> works correctly for unsigned too, in spite of the name. - }; - - // integer templates specifying extreme value ----------------------------// - - // signed -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) - template< boost::long_long_type MaxValue > // maximum value to require support -#else - template< long MaxValue > // maximum value to require support -#endif - struct int_max_value_t - { - typedef typename boost::detail::int_least_helper - < -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) - (MaxValue <= ::boost::integer_traits::const_max) + -#else - 1 + -#endif - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max) - >::least least; - typedef typename int_fast_t::type fast; - }; - -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) - template< boost::long_long_type MinValue > // minimum value to require support -#else - template< long MinValue > // minimum value to require support -#endif - struct int_min_value_t - { - typedef typename boost::detail::int_least_helper - < -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) - (MinValue >= ::boost::integer_traits::const_min) + -#else - 1 + -#endif - (MinValue >= ::boost::integer_traits::const_min) + - (MinValue >= ::boost::integer_traits::const_min) + - (MinValue >= ::boost::integer_traits::const_min) + - (MinValue >= ::boost::integer_traits::const_min) - >::least least; - typedef typename int_fast_t::type fast; - }; - - // unsigned -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) - template< boost::ulong_long_type MaxValue > // minimum value to require support -#else - template< unsigned long MaxValue > // minimum value to require support -#endif - struct uint_value_t - { -#if (defined(__BORLANDC__) || defined(__CODEGEAR__)) - // It's really not clear why this workaround should be needed... shrug I guess! JM -#if defined(BOOST_NO_INTEGRAL_INT64_T) - BOOST_STATIC_CONSTANT(unsigned, which = - 1 + - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max)); - typedef typename detail::int_least_helper< ::boost::uint_value_t::which>::least least; -#else // BOOST_NO_INTEGRAL_INT64_T - BOOST_STATIC_CONSTANT(unsigned, which = - 1 + - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max)); - typedef typename detail::uint_least_helper< ::boost::uint_value_t::which>::least least; -#endif // BOOST_NO_INTEGRAL_INT64_T -#else - typedef typename boost::detail::uint_least_helper - < -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) - (MaxValue <= ::boost::integer_traits::const_max) + -#else - 1 + -#endif - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max) + - (MaxValue <= ::boost::integer_traits::const_max) - >::least least; -#endif - typedef typename int_fast_t::type fast; - }; - - -} // namespace boost - -#endif // BOOST_INTEGER_HPP diff --git a/libraries/boost/include/boost/integer/static_log2.hpp b/libraries/boost/include/boost/integer/static_log2.hpp deleted file mode 100644 index 56c7a00125..0000000000 --- a/libraries/boost/include/boost/integer/static_log2.hpp +++ /dev/null @@ -1,127 +0,0 @@ -// -------------- Boost static_log2.hpp header file ----------------------- // -// -// Copyright (C) 2001 Daryle Walker. -// Copyright (C) 2003 Vesa Karvonen. -// Copyright (C) 2003 Gennaro Prota. -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// --------------------------------------------------- -// See http://www.boost.org/libs/integer for documentation. -// ------------------------------------------------------------------------- // - - -#ifndef BOOST_INTEGER_STATIC_LOG2_HPP -#define BOOST_INTEGER_STATIC_LOG2_HPP - -#include "boost/integer_fwd.hpp" // for boost::intmax_t - -namespace boost { - - namespace detail { - - namespace static_log2_impl { - - // choose_initial_n<> - // - // Recursively doubles its integer argument, until it - // becomes >= of the "width" (C99, 6.2.6.2p4) of - // static_log2_argument_type. - // - // Used to get the maximum power of two less then the width. - // - // Example: if on your platform argument_type has 48 value - // bits it yields n=32. - // - // It's easy to prove that, starting from such a value - // of n, the core algorithm works correctly for any width - // of static_log2_argument_type and that recursion always - // terminates with x = 1 and n = 0 (see the algorithm's - // invariant). - - typedef boost::static_log2_argument_type argument_type; - typedef boost::static_log2_result_type result_type; - - template - struct choose_initial_n { - - BOOST_STATIC_CONSTANT(bool, c = (argument_type(1) << n << n) != 0); - BOOST_STATIC_CONSTANT( - result_type, - value = !c*n + choose_initial_n<2*c*n>::value - ); - - }; - - template <> - struct choose_initial_n<0> { - BOOST_STATIC_CONSTANT(result_type, value = 0); - }; - - - - // start computing from n_zero - must be a power of two - const result_type n_zero = 16; - const result_type initial_n = choose_initial_n::value; - - // static_log2_impl<> - // - // * Invariant: - // 2n - // 1 <= x && x < 2 at the start of each recursion - // (see also choose_initial_n<>) - // - // * Type requirements: - // - // argument_type maybe any unsigned type with at least n_zero + 1 - // value bits. (Note: If larger types will be standardized -e.g. - // unsigned long long- then the argument_type typedef can be - // changed without affecting the rest of the code.) - // - - template - struct static_log2_impl { - - BOOST_STATIC_CONSTANT(bool, c = (x >> n) > 0); // x >= 2**n ? - BOOST_STATIC_CONSTANT( - result_type, - value = c*n + (static_log2_impl< (x>>c*n), n/2 >::value) - ); - - }; - - template <> - struct static_log2_impl<1, 0> { - BOOST_STATIC_CONSTANT(result_type, value = 0); - }; - - } - } // detail - - - - // -------------------------------------- - // static_log2 - // ---------------------------------------- - - template - struct static_log2 { - - BOOST_STATIC_CONSTANT( - static_log2_result_type, - value = detail::static_log2_impl::static_log2_impl::value - ); - - }; - - - template <> - struct static_log2<0> { }; - -} - - - -#endif // include guard diff --git a/libraries/boost/include/boost/integer_fwd.hpp b/libraries/boost/include/boost/integer_fwd.hpp deleted file mode 100644 index 18519dd696..0000000000 --- a/libraries/boost/include/boost/integer_fwd.hpp +++ /dev/null @@ -1,190 +0,0 @@ -// Boost integer_fwd.hpp header file ---------------------------------------// - -// (C) Copyright Dave Abrahams and Daryle Walker 2001. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/integer for documentation. - -#ifndef BOOST_INTEGER_FWD_HPP -#define BOOST_INTEGER_FWD_HPP - -#include // for UCHAR_MAX, etc. -#include // for std::size_t - -#include // for BOOST_NO_INTRINSIC_WCHAR_T -#include // for std::numeric_limits -#include // For intmax_t - - -namespace boost -{ - -#ifdef BOOST_NO_INTEGRAL_INT64_T - typedef unsigned long static_log2_argument_type; - typedef int static_log2_result_type; - typedef long static_min_max_signed_type; - typedef unsigned long static_min_max_unsigned_type; -#else - typedef boost::uintmax_t static_min_max_unsigned_type; - typedef boost::intmax_t static_min_max_signed_type; - typedef boost::uintmax_t static_log2_argument_type; - typedef int static_log2_result_type; -#endif - -// From ------------------------------------------------// - -// Only has typedefs or using statements, with #conditionals - - -// From -----------------------------------------// - -template < class T > - class integer_traits; - -template < > - class integer_traits< bool >; - -template < > - class integer_traits< char >; - -template < > - class integer_traits< signed char >; - -template < > - class integer_traits< unsigned char >; - -#ifndef BOOST_NO_INTRINSIC_WCHAR_T -template < > - class integer_traits< wchar_t >; -#endif - -template < > - class integer_traits< short >; - -template < > - class integer_traits< unsigned short >; - -template < > - class integer_traits< int >; - -template < > - class integer_traits< unsigned int >; - -template < > - class integer_traits< long >; - -template < > - class integer_traits< unsigned long >; - -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG) -template < > -class integer_traits< ::boost::long_long_type>; - -template < > -class integer_traits< ::boost::ulong_long_type >; -#elif !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_MS_INT64) -template < > -class integer_traits<__int64>; - -template < > -class integer_traits; -#endif - - -// From ------------------------------------------------// - -template < typename LeastInt > - struct int_fast_t; - -template< int Bits > - struct int_t; - -template< int Bits > - struct uint_t; - -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) - template< boost::long_long_type MaxValue > // maximum value to require support -#else - template< long MaxValue > // maximum value to require support -#endif - struct int_max_value_t; - -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) - template< boost::long_long_type MinValue > // minimum value to require support -#else - template< long MinValue > // minimum value to require support -#endif - struct int_min_value_t; - -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) - template< boost::ulong_long_type MaxValue > // maximum value to require support -#else - template< unsigned long MaxValue > // maximum value to require support -#endif - struct uint_value_t; - - -// From -----------------------------------// - -template < std::size_t Bit > - struct high_bit_mask_t; - -template < std::size_t Bits > - struct low_bits_mask_t; - -template < > - struct low_bits_mask_t< ::std::numeric_limits::digits >; - -// From ------------------------------------// - -template - struct static_log2; - -template <> struct static_log2<0u>; - - -// From ---------------------------------// - -template - struct static_signed_min; - -template - struct static_signed_max; - -template - struct static_unsigned_min; - -template - struct static_unsigned_max; - - -namespace integer -{ -// From - -#ifdef BOOST_NO_INTEGRAL_INT64_T - typedef unsigned long static_gcd_type; -#else - typedef boost::uintmax_t static_gcd_type; -#endif - -template < static_gcd_type Value1, static_gcd_type Value2 > - struct static_gcd; -template < static_gcd_type Value1, static_gcd_type Value2 > - struct static_lcm; - - -// From - -template < typename IntegerType > - class gcd_evaluator; -template < typename IntegerType > - class lcm_evaluator; - -} // namespace integer - -} // namespace boost - - -#endif // BOOST_INTEGER_FWD_HPP diff --git a/libraries/boost/include/boost/integer_traits.hpp b/libraries/boost/include/boost/integer_traits.hpp deleted file mode 100644 index 94eb00d31e..0000000000 --- a/libraries/boost/include/boost/integer_traits.hpp +++ /dev/null @@ -1,256 +0,0 @@ -/* boost integer_traits.hpp header file - * - * Copyright Jens Maurer 2000 - * Distributed under the Boost Software License, Version 1.0. (See - * accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - * $Id$ - * - * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers - */ - -// See http://www.boost.org/libs/integer for documentation. - - -#ifndef BOOST_INTEGER_TRAITS_HPP -#define BOOST_INTEGER_TRAITS_HPP - -#include -#include - -// These are an implementation detail and not part of the interface -#include -// we need wchar.h for WCHAR_MAX/MIN but not all platforms provide it, -// and some may have but not ... -#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun) || defined(__QNX__)) -#include -#endif - -// -// We simply cannot include this header on gcc without getting copious warnings of the kind: -// -// ../../../boost/integer_traits.hpp:164:66: warning: use of C99 long long integer constant -// -// And yet there is no other reasonable implementation, so we declare this a system header -// to suppress these warnings. -// -#if defined(__GNUC__) && (__GNUC__ >= 4) -#pragma GCC system_header -#endif - -namespace boost { -template -class integer_traits : public std::numeric_limits -{ -public: - BOOST_STATIC_CONSTANT(bool, is_integral = false); -}; - -namespace detail { -template -class integer_traits_base -{ -public: - BOOST_STATIC_CONSTANT(bool, is_integral = true); - BOOST_STATIC_CONSTANT(T, const_min = min_val); - BOOST_STATIC_CONSTANT(T, const_max = max_val); -}; - -#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION -// A definition is required even for integral static constants -template -const bool integer_traits_base::is_integral; - -template -const T integer_traits_base::const_min; - -template -const T integer_traits_base::const_max; -#endif - -} // namespace detail - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -#ifndef BOOST_NO_INTRINSIC_WCHAR_T -template<> -class integer_traits - : public std::numeric_limits, - // Don't trust WCHAR_MIN and WCHAR_MAX with Mac OS X's native - // library: they are wrong! -#if defined(WCHAR_MIN) && defined(WCHAR_MAX) && !defined(__APPLE__) - public detail::integer_traits_base -#elif defined(__BORLANDC__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__BEOS__) && defined(__GNUC__)) - // No WCHAR_MIN and WCHAR_MAX, whar_t is short and unsigned: - public detail::integer_traits_base -#elif (defined(__sgi) && (!defined(__SGI_STL_PORT) || __SGI_STL_PORT < 0x400))\ - || (defined __APPLE__)\ - || (defined(__OpenBSD__) && defined(__GNUC__))\ - || (defined(__NetBSD__) && defined(__GNUC__))\ - || (defined(__FreeBSD__) && defined(__GNUC__))\ - || (defined(__DragonFly__) && defined(__GNUC__))\ - || (defined(__hpux) && defined(__GNUC__) && (__GNUC__ == 3) && !defined(__SGI_STL_PORT)) - // No WCHAR_MIN and WCHAR_MAX, wchar_t has the same range as int. - // - SGI MIPSpro with native library - // - gcc 3.x on HP-UX - // - Mac OS X with native library - // - gcc on FreeBSD, OpenBSD and NetBSD - public detail::integer_traits_base -#else -#error No WCHAR_MIN and WCHAR_MAX present, please adjust integer_traits<> for your compiler. -#endif -{ }; -#endif // BOOST_NO_INTRINSIC_WCHAR_T - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -template<> -class integer_traits - : public std::numeric_limits, - public detail::integer_traits_base -{ }; - -#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) -#if defined(ULLONG_MAX) && defined(BOOST_HAS_LONG_LONG) - -template<> -class integer_traits< ::boost::long_long_type> - : public std::numeric_limits< ::boost::long_long_type>, - public detail::integer_traits_base< ::boost::long_long_type, LLONG_MIN, LLONG_MAX> -{ }; - -template<> -class integer_traits< ::boost::ulong_long_type> - : public std::numeric_limits< ::boost::ulong_long_type>, - public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULLONG_MAX> -{ }; - -#elif defined(ULONG_LONG_MAX) && defined(BOOST_HAS_LONG_LONG) - -template<> -class integer_traits< ::boost::long_long_type> : public std::numeric_limits< ::boost::long_long_type>, public detail::integer_traits_base< ::boost::long_long_type, LONG_LONG_MIN, LONG_LONG_MAX>{ }; -template<> -class integer_traits< ::boost::ulong_long_type> - : public std::numeric_limits< ::boost::ulong_long_type>, - public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONG_LONG_MAX> -{ }; - -#elif defined(ULONGLONG_MAX) && defined(BOOST_HAS_LONG_LONG) - -template<> -class integer_traits< ::boost::long_long_type> - : public std::numeric_limits< ::boost::long_long_type>, - public detail::integer_traits_base< ::boost::long_long_type, LONGLONG_MIN, LONGLONG_MAX> -{ }; - -template<> -class integer_traits< ::boost::ulong_long_type> - : public std::numeric_limits< ::boost::ulong_long_type>, - public detail::integer_traits_base< ::boost::ulong_long_type, 0, ULONGLONG_MAX> -{ }; - -#elif defined(_LLONG_MAX) && defined(_C2) && defined(BOOST_HAS_LONG_LONG) - -template<> -class integer_traits< ::boost::long_long_type> - : public std::numeric_limits< ::boost::long_long_type>, - public detail::integer_traits_base< ::boost::long_long_type, -_LLONG_MAX - _C2, _LLONG_MAX> -{ }; - -template<> -class integer_traits< ::boost::ulong_long_type> - : public std::numeric_limits< ::boost::ulong_long_type>, - public detail::integer_traits_base< ::boost::ulong_long_type, 0, _ULLONG_MAX> -{ }; - -#elif defined(BOOST_HAS_LONG_LONG) -// -// we have long long but no constants, this happens for example with gcc in -ansi mode, -// we'll just have to work out the values for ourselves (assumes 2's compliment representation): -// -template<> -class integer_traits< ::boost::long_long_type> - : public std::numeric_limits< ::boost::long_long_type>, - public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1)), ~(1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1))> -{ }; - -template<> -class integer_traits< ::boost::ulong_long_type> - : public std::numeric_limits< ::boost::ulong_long_type>, - public detail::integer_traits_base< ::boost::ulong_long_type, 0, ~0uLL> -{ }; - -#elif defined(BOOST_HAS_MS_INT64) - -template<> -class integer_traits< __int64> - : public std::numeric_limits< __int64>, - public detail::integer_traits_base< __int64, _I64_MIN, _I64_MAX> -{ }; - -template<> -class integer_traits< unsigned __int64> - : public std::numeric_limits< unsigned __int64>, - public detail::integer_traits_base< unsigned __int64, 0, _UI64_MAX> -{ }; - -#endif -#endif - -} // namespace boost - -#endif /* BOOST_INTEGER_TRAITS_HPP */ - - - diff --git a/libraries/boost/include/boost/io/ios_state.hpp b/libraries/boost/include/boost/io/ios_state.hpp deleted file mode 100644 index 07cfb345ff..0000000000 --- a/libraries/boost/include/boost/io/ios_state.hpp +++ /dev/null @@ -1,439 +0,0 @@ -// Boost io/ios_state.hpp header file --------------------------------------// - -// Copyright 2002, 2005 Daryle Walker. Use, modification, and distribution -// are subject to the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or a copy at .) - -// See for the library's home page. - -#ifndef BOOST_IO_IOS_STATE_HPP -#define BOOST_IO_IOS_STATE_HPP - -#include // self include -#include - -#include // for std::ios_base, std::basic_ios, etc. -#ifndef BOOST_NO_STD_LOCALE -#include // for std::locale -#endif -#include // for std::basic_ostream -#include // for std::basic_streambuf -#include // for std::char_traits - - -namespace boost -{ -namespace io -{ - - -// Basic stream state saver class declarations -----------------------------// - -class ios_flags_saver -{ -public: - typedef ::std::ios_base state_type; - typedef ::std::ios_base::fmtflags aspect_type; - - explicit ios_flags_saver( state_type &s ) - : s_save_( s ), a_save_( s.flags() ) - {} - ios_flags_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.flags(a) ) - {} - ~ios_flags_saver() - { this->restore(); } - - void restore() - { s_save_.flags( a_save_ ); } - -private: - state_type & s_save_; - aspect_type const a_save_; - - ios_flags_saver& operator=(const ios_flags_saver&); -}; - -class ios_precision_saver -{ -public: - typedef ::std::ios_base state_type; - typedef ::std::streamsize aspect_type; - - explicit ios_precision_saver( state_type &s ) - : s_save_( s ), a_save_( s.precision() ) - {} - ios_precision_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.precision(a) ) - {} - ~ios_precision_saver() - { this->restore(); } - - void restore() - { s_save_.precision( a_save_ ); } - -private: - state_type & s_save_; - aspect_type const a_save_; - - ios_precision_saver& operator=(const ios_precision_saver&); -}; - -class ios_width_saver -{ -public: - typedef ::std::ios_base state_type; - typedef ::std::streamsize aspect_type; - - explicit ios_width_saver( state_type &s ) - : s_save_( s ), a_save_( s.width() ) - {} - ios_width_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.width(a) ) - {} - ~ios_width_saver() - { this->restore(); } - - void restore() - { s_save_.width( a_save_ ); } - -private: - state_type & s_save_; - aspect_type const a_save_; - ios_width_saver& operator=(const ios_width_saver&); -}; - - -// Advanced stream state saver class template declarations -----------------// - -template < typename Ch, class Tr > -class basic_ios_iostate_saver -{ -public: - typedef ::std::basic_ios state_type; - typedef ::std::ios_base::iostate aspect_type; - - explicit basic_ios_iostate_saver( state_type &s ) - : s_save_( s ), a_save_( s.rdstate() ) - {} - basic_ios_iostate_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.rdstate() ) - { s.clear(a); } - ~basic_ios_iostate_saver() - { this->restore(); } - - void restore() - { s_save_.clear( a_save_ ); } - -private: - state_type & s_save_; - aspect_type const a_save_; - basic_ios_iostate_saver& operator=(const basic_ios_iostate_saver&); -}; - -template < typename Ch, class Tr > -class basic_ios_exception_saver -{ -public: - typedef ::std::basic_ios state_type; - typedef ::std::ios_base::iostate aspect_type; - - explicit basic_ios_exception_saver( state_type &s ) - : s_save_( s ), a_save_( s.exceptions() ) - {} -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) - basic_ios_exception_saver( state_type &s, aspect_type a ) -#else - basic_ios_exception_saver( state_type &s, aspect_type const &a ) -#endif - : s_save_( s ), a_save_( s.exceptions() ) - { s.exceptions(a); } - ~basic_ios_exception_saver() - { this->restore(); } - - void restore() - { s_save_.exceptions( a_save_ ); } - -private: - state_type & s_save_; - aspect_type const a_save_; - basic_ios_exception_saver& operator=(const basic_ios_exception_saver&); -}; - -template < typename Ch, class Tr > -class basic_ios_tie_saver -{ -public: - typedef ::std::basic_ios state_type; - typedef ::std::basic_ostream * aspect_type; - - explicit basic_ios_tie_saver( state_type &s ) - : s_save_( s ), a_save_( s.tie() ) - {} - basic_ios_tie_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.tie(a) ) - {} - ~basic_ios_tie_saver() - { this->restore(); } - - void restore() - { s_save_.tie( a_save_ ); } - -private: - state_type & s_save_; - aspect_type const a_save_; - basic_ios_tie_saver& operator=(const basic_ios_tie_saver&); -}; - -template < typename Ch, class Tr > -class basic_ios_rdbuf_saver -{ -public: - typedef ::std::basic_ios state_type; - typedef ::std::basic_streambuf * aspect_type; - - explicit basic_ios_rdbuf_saver( state_type &s ) - : s_save_( s ), a_save_( s.rdbuf() ) - {} - basic_ios_rdbuf_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.rdbuf(a) ) - {} - ~basic_ios_rdbuf_saver() - { this->restore(); } - - void restore() - { s_save_.rdbuf( a_save_ ); } - -private: - state_type & s_save_; - aspect_type const a_save_; - basic_ios_rdbuf_saver& operator=(const basic_ios_rdbuf_saver&); -}; - -template < typename Ch, class Tr > -class basic_ios_fill_saver -{ -public: - typedef ::std::basic_ios state_type; - typedef typename state_type::char_type aspect_type; - - explicit basic_ios_fill_saver( state_type &s ) - : s_save_( s ), a_save_( s.fill() ) - {} - basic_ios_fill_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.fill(a) ) - {} - ~basic_ios_fill_saver() - { this->restore(); } - - void restore() - { s_save_.fill( a_save_ ); } - -private: - state_type & s_save_; - aspect_type const a_save_; - basic_ios_fill_saver& operator=(const basic_ios_fill_saver&); -}; - -#ifndef BOOST_NO_STD_LOCALE -template < typename Ch, class Tr > -class basic_ios_locale_saver -{ -public: - typedef ::std::basic_ios state_type; - typedef ::std::locale aspect_type; - - explicit basic_ios_locale_saver( state_type &s ) - : s_save_( s ), a_save_( s.getloc() ) - {} - basic_ios_locale_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.imbue(a) ) - {} - ~basic_ios_locale_saver() - { this->restore(); } - - void restore() - { s_save_.imbue( a_save_ ); } - -private: - state_type & s_save_; - aspect_type const a_save_; - basic_ios_locale_saver& operator=(const basic_ios_locale_saver&); -}; -#endif - - -// User-defined stream state saver class declarations ----------------------// - -class ios_iword_saver -{ -public: - typedef ::std::ios_base state_type; - typedef int index_type; - typedef long aspect_type; - - explicit ios_iword_saver( state_type &s, index_type i ) - : s_save_( s ), a_save_( s.iword(i) ), i_save_( i ) - {} - ios_iword_saver( state_type &s, index_type i, aspect_type const &a ) - : s_save_( s ), a_save_( s.iword(i) ), i_save_( i ) - { s.iword(i) = a; } - ~ios_iword_saver() - { this->restore(); } - - void restore() - { s_save_.iword( i_save_ ) = a_save_; } - -private: - state_type & s_save_; - aspect_type const a_save_; - index_type const i_save_; - - ios_iword_saver& operator=(const ios_iword_saver&); -}; - -class ios_pword_saver -{ -public: - typedef ::std::ios_base state_type; - typedef int index_type; - typedef void * aspect_type; - - explicit ios_pword_saver( state_type &s, index_type i ) - : s_save_( s ), a_save_( s.pword(i) ), i_save_( i ) - {} - ios_pword_saver( state_type &s, index_type i, aspect_type const &a ) - : s_save_( s ), a_save_( s.pword(i) ), i_save_( i ) - { s.pword(i) = a; } - ~ios_pword_saver() - { this->restore(); } - - void restore() - { s_save_.pword( i_save_ ) = a_save_; } - -private: - state_type & s_save_; - aspect_type const a_save_; - index_type const i_save_; - - ios_pword_saver operator=(const ios_pword_saver&); -}; - - -// Combined stream state saver class (template) declarations ---------------// - -class ios_base_all_saver -{ -public: - typedef ::std::ios_base state_type; - - explicit ios_base_all_saver( state_type &s ) - : s_save_( s ), a1_save_( s.flags() ), a2_save_( s.precision() ) - , a3_save_( s.width() ) - {} - - ~ios_base_all_saver() - { this->restore(); } - - void restore() - { - s_save_.width( a3_save_ ); - s_save_.precision( a2_save_ ); - s_save_.flags( a1_save_ ); - } - -private: - state_type & s_save_; - state_type::fmtflags const a1_save_; - ::std::streamsize const a2_save_; - ::std::streamsize const a3_save_; - - ios_base_all_saver& operator=(const ios_base_all_saver&); -}; - -template < typename Ch, class Tr > -class basic_ios_all_saver -{ -public: - typedef ::std::basic_ios state_type; - - explicit basic_ios_all_saver( state_type &s ) - : s_save_( s ), a1_save_( s.flags() ), a2_save_( s.precision() ) - , a3_save_( s.width() ), a4_save_( s.rdstate() ) - , a5_save_( s.exceptions() ), a6_save_( s.tie() ) - , a7_save_( s.rdbuf() ), a8_save_( s.fill() ) - #ifndef BOOST_NO_STD_LOCALE - , a9_save_( s.getloc() ) - #endif - {} - - ~basic_ios_all_saver() - { this->restore(); } - - void restore() - { - #ifndef BOOST_NO_STD_LOCALE - s_save_.imbue( a9_save_ ); - #endif - s_save_.fill( a8_save_ ); - s_save_.rdbuf( a7_save_ ); - s_save_.tie( a6_save_ ); - s_save_.exceptions( a5_save_ ); - s_save_.clear( a4_save_ ); - s_save_.width( a3_save_ ); - s_save_.precision( a2_save_ ); - s_save_.flags( a1_save_ ); - } - -private: - state_type & s_save_; - typename state_type::fmtflags const a1_save_; - ::std::streamsize const a2_save_; - ::std::streamsize const a3_save_; - typename state_type::iostate const a4_save_; - typename state_type::iostate const a5_save_; - ::std::basic_ostream * const a6_save_; - ::std::basic_streambuf * const a7_save_; - typename state_type::char_type const a8_save_; - #ifndef BOOST_NO_STD_LOCALE - ::std::locale const a9_save_; - #endif - - basic_ios_all_saver& operator=(const basic_ios_all_saver&); -}; - -class ios_all_word_saver -{ -public: - typedef ::std::ios_base state_type; - typedef int index_type; - - ios_all_word_saver( state_type &s, index_type i ) - : s_save_( s ), i_save_( i ), a1_save_( s.iword(i) ) - , a2_save_( s.pword(i) ) - {} - - ~ios_all_word_saver() - { this->restore(); } - - void restore() - { - s_save_.pword( i_save_ ) = a2_save_; - s_save_.iword( i_save_ ) = a1_save_; - } - -private: - state_type & s_save_; - index_type const i_save_; - long const a1_save_; - void * const a2_save_; - - ios_all_word_saver& operator=(const ios_all_word_saver&); -}; - - -} // namespace io -} // namespace boost - - -#endif // BOOST_IO_IOS_STATE_HPP diff --git a/libraries/boost/include/boost/io_fwd.hpp b/libraries/boost/include/boost/io_fwd.hpp deleted file mode 100644 index 417b81e3e1..0000000000 --- a/libraries/boost/include/boost/io_fwd.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// Boost io_fwd.hpp header file --------------------------------------------// - -// Copyright 2002 Daryle Walker. Use, modification, and distribution are subject -// to the Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or a copy at .) - -// See for the library's home page. - -#ifndef BOOST_IO_FWD_HPP -#define BOOST_IO_FWD_HPP - -#include // for std::char_traits (declaration) - - -namespace boost -{ -namespace io -{ - - -// From -------------------------------------------// - -class ios_flags_saver; -class ios_precision_saver; -class ios_width_saver; -class ios_base_all_saver; - -template < typename Ch, class Tr = ::std::char_traits > - class basic_ios_iostate_saver; -template < typename Ch, class Tr = ::std::char_traits > - class basic_ios_exception_saver; -template < typename Ch, class Tr = ::std::char_traits > - class basic_ios_tie_saver; -template < typename Ch, class Tr = ::std::char_traits > - class basic_ios_rdbuf_saver; -template < typename Ch, class Tr = ::std::char_traits > - class basic_ios_fill_saver; -template < typename Ch, class Tr = ::std::char_traits > - class basic_ios_locale_saver; -template < typename Ch, class Tr = ::std::char_traits > - class basic_ios_all_saver; - -typedef basic_ios_iostate_saver ios_iostate_saver; -typedef basic_ios_iostate_saver wios_iostate_saver; -typedef basic_ios_exception_saver ios_exception_saver; -typedef basic_ios_exception_saver wios_exception_saver; -typedef basic_ios_tie_saver ios_tie_saver; -typedef basic_ios_tie_saver wios_tie_saver; -typedef basic_ios_rdbuf_saver ios_rdbuf_saver; -typedef basic_ios_rdbuf_saver wios_rdbuf_saver; -typedef basic_ios_fill_saver ios_fill_saver; -typedef basic_ios_fill_saver wios_fill_saver; -typedef basic_ios_locale_saver ios_locale_saver; -typedef basic_ios_locale_saver wios_locale_saver; -typedef basic_ios_all_saver ios_all_saver; -typedef basic_ios_all_saver wios_all_saver; - -class ios_iword_saver; -class ios_pword_saver; -class ios_all_word_saver; - - -} // namespace io -} // namespace boost - - -#endif // BOOST_IO_FWD_HPP diff --git a/libraries/boost/include/boost/is_placeholder.hpp b/libraries/boost/include/boost/is_placeholder.hpp deleted file mode 100644 index 5f1b544f94..0000000000 --- a/libraries/boost/include/boost/is_placeholder.hpp +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED -#define BOOST_IS_PLACEHOLDER_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined( _MSC_VER ) && ( _MSC_VER >= 1020 ) -# pragma once -#endif - - -// is_placeholder.hpp - TR1 is_placeholder metafunction -// -// Copyright (c) 2006 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - - -namespace boost -{ - -template< class T > struct is_placeholder -{ - enum _vt { value = 0 }; -}; - -} // namespace boost - -#endif // #ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED diff --git a/libraries/boost/include/boost/iterator/detail/config_def.hpp b/libraries/boost/include/boost/iterator/detail/config_def.hpp deleted file mode 100644 index 117e75a76d..0000000000 --- a/libraries/boost/include/boost/iterator/detail/config_def.hpp +++ /dev/null @@ -1,128 +0,0 @@ -// (C) Copyright David Abrahams 2002. -// (C) Copyright Jeremy Siek 2002. -// (C) Copyright Thomas Witt 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// no include guard multiple inclusion intended - -// -// This is a temporary workaround until the bulk of this is -// available in boost config. -// 23/02/03 thw -// - -#include // for prior -#include - -#ifdef BOOST_ITERATOR_CONFIG_DEF -# error you have nested config_def #inclusion. -#else -# define BOOST_ITERATOR_CONFIG_DEF -#endif - -// We enable this always now. Otherwise, the simple case in -// libs/iterator/test/constant_iterator_arrow.cpp fails to compile -// because the operator-> return is improperly deduced as a non-const -// pointer. -#if 1 || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) - -// Recall that in general, compilers without partial specialization -// can't strip constness. Consider counting_iterator, which normally -// passes a const Value to iterator_facade. As a result, any code -// which makes a std::vector of the iterator's value_type will fail -// when its allocator declares functions overloaded on reference and -// const_reference (the same type). -// -// Furthermore, Borland 5.5.1 drops constness in enough ways that we -// end up using a proxy for operator[] when we otherwise shouldn't. -// Using reference constness gives it an extra hint that it can -// return the value_type from operator[] directly, but is not -// strictly necessary. Not sure how best to resolve this one. - -# define BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY 1 - -#endif - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x5A0)) \ - || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \ - || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) \ - || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) - -# define BOOST_NO_LVALUE_RETURN_DETECTION - -# if 0 // test code - struct v {}; - - typedef char (&no)[3]; - - template - no foo(T const&, ...); - - template - char foo(T&, int); - - - struct value_iterator - { - v operator*() const; - }; - - template - struct lvalue_deref_helper - { - static T& x; - enum { value = (sizeof(foo(*x,0)) == 1) }; - }; - - int z2[(lvalue_deref_helper::value == 1) ? 1 : -1]; - int z[(lvalue_deref_helper::value) == 1 ? -1 : 1 ]; -# endif - -#endif - -#if BOOST_WORKAROUND(__MWERKS__, <=0x2407) -# define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't work for simple types" -#endif - -#if BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, < 4) && !defined(__EDG_VERSION__) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) -# define BOOST_NO_IS_CONVERTIBLE_TEMPLATE // The following program fails to compile: - -# if 0 // test code - #include - template - struct foo - { - foo(T); - - template - foo(foo const& other) : p(other.p) { } - - T p; - }; - - bool x = boost::is_convertible, foo >::value; -# endif - -#endif - - -#if !defined(BOOST_MSVC) && (defined(BOOST_NO_SFINAE) || defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_IS_CONVERTIBLE_TEMPLATE)) -# define BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY -#endif - -# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - -// GCC-2.95 (obsolete) eagerly instantiates templated constructors and conversion -// operators in convertibility checks, causing premature errors. -// -// Borland's problems are harder to diagnose due to lack of an -// instantiation stack backtrace. They may be due in part to the fact -// that it drops cv-qualification willy-nilly in templates. -# define BOOST_NO_ONE_WAY_ITERATOR_INTEROP -# endif - -// no include guard; multiple inclusion intended diff --git a/libraries/boost/include/boost/iterator/detail/config_undef.hpp b/libraries/boost/include/boost/iterator/detail/config_undef.hpp deleted file mode 100644 index bf1b8d708c..0000000000 --- a/libraries/boost/include/boost/iterator/detail/config_undef.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// (C) Copyright Thomas Witt 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// no include guard multiple inclusion intended - -// -// This is a temporary workaround until the bulk of this is -// available in boost config. -// 23/02/03 thw -// - -#undef BOOST_NO_IS_CONVERTIBLE -#undef BOOST_NO_IS_CONVERTIBLE_TEMPLATE -#undef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY -#undef BOOST_NO_LVALUE_RETURN_DETECTION -#undef BOOST_NO_ONE_WAY_ITERATOR_INTEROP - -#ifdef BOOST_ITERATOR_CONFIG_DEF -# undef BOOST_ITERATOR_CONFIG_DEF -#else -# error missing or nested #include config_def -#endif diff --git a/libraries/boost/include/boost/iterator/detail/enable_if.hpp b/libraries/boost/include/boost/iterator/detail/enable_if.hpp deleted file mode 100644 index 071f5fe81d..0000000000 --- a/libraries/boost/include/boost/iterator/detail/enable_if.hpp +++ /dev/null @@ -1,83 +0,0 @@ -// (C) Copyright David Abrahams 2002. -// (C) Copyright Jeremy Siek 2002. -// (C) Copyright Thomas Witt 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_ENABLE_IF_23022003THW_HPP -#define BOOST_ENABLE_IF_23022003THW_HPP - -#include -#include - -#include - -// -// Boost iterators uses its own enable_if cause we need -// special semantics for deficient compilers. -// 23/02/03 thw -// - -namespace boost -{ - - namespace iterators - { - // - // Base machinery for all kinds of enable if - // - template - struct enabled - { - template - struct base - { - typedef T type; - }; - }; - - // - // For compilers that don't support "Substitution Failure Is Not An Error" - // enable_if falls back to always enabled. See comments - // on operator implementation for consequences. - // - template<> - struct enabled - { - template - struct base - { -#ifdef BOOST_NO_SFINAE - - typedef T type; - - // This way to do it would give a nice error message containing - // invalid overload, but has the big disadvantage that - // there is no reference to user code in the error message. - // - // struct invalid_overload; - // typedef invalid_overload type; - // -#endif - }; - }; - - - template - struct enable_if -# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE) - : enabled<(Cond::value)>::template base -# else - : mpl::identity -# endif - { - }; - - } // namespace iterators - -} // namespace boost - -#include - -#endif // BOOST_ENABLE_IF_23022003THW_HPP diff --git a/libraries/boost/include/boost/iterator/detail/facade_iterator_category.hpp b/libraries/boost/include/boost/iterator/detail/facade_iterator_category.hpp deleted file mode 100644 index 67fdf446b0..0000000000 --- a/libraries/boost/include/boost/iterator/detail/facade_iterator_category.hpp +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright David Abrahams 2003. Use, modification and distribution is -// subject to the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef FACADE_ITERATOR_CATEGORY_DWA20031118_HPP -# define FACADE_ITERATOR_CATEGORY_DWA20031118_HPP - -# include - -# include // used in iterator_tag inheritance logic -# include -# include -# include -# include -# include - -# include -# include -# include -# include - -# include - -# include // try to keep this last - -# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY -# include -# endif - -// -// iterator_category deduction for iterator_facade -// - -namespace boost { -namespace iterators { - -// forward declaration -struct use_default; - -namespace detail { - -struct input_output_iterator_tag - : std::input_iterator_tag -{ - // Using inheritance for only input_iterator_tag helps to avoid - // ambiguities when a stdlib implementation dispatches on a - // function which is overloaded on both input_iterator_tag and - // output_iterator_tag, as STLPort does, in its __valid_range - // function. I claim it's better to avoid the ambiguity in these - // cases. - operator std::output_iterator_tag() const - { - return std::output_iterator_tag(); - } -}; - -// -// True iff the user has explicitly disabled writability of this -// iterator. Pass the iterator_facade's Value parameter and its -// nested ::reference type. -// -template -struct iterator_writability_disabled -# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY // Adding Thomas' logic? - : mpl::or_< - is_const - , boost::detail::indirect_traits::is_reference_to_const - , is_const - > -# else - : is_const -# endif -{}; - - -// -// Convert an iterator_facade's traversal category, Value parameter, -// and ::reference type to an appropriate old-style category. -// -// Due to changeset 21683, this now never results in a category convertible -// to output_iterator_tag. -// -// Change at: https://svn.boost.org/trac/boost/changeset/21683 -template -struct iterator_facade_default_category - : mpl::eval_if< - mpl::and_< - is_reference - , is_convertible - > - , mpl::eval_if< - is_convertible - , mpl::identity - , mpl::if_< - is_convertible - , std::bidirectional_iterator_tag - , std::forward_iterator_tag - > - > - , typename mpl::eval_if< - mpl::and_< - is_convertible - - // check for readability - , is_convertible - > - , mpl::identity - , mpl::identity - > - > -{ -}; - -// True iff T is convertible to an old-style iterator category. -template -struct is_iterator_category - : mpl::or_< - is_convertible - , is_convertible - > -{ -}; - -template -struct is_iterator_traversal - : is_convertible -{}; - -// -// A composite iterator_category tag convertible to Category (a pure -// old-style category) and Traversal (a pure traversal tag). -// Traversal must be a strict increase of the traversal power given by -// Category. -// -template -struct iterator_category_with_traversal - : Category, Traversal -{ - // Make sure this isn't used to build any categories where - // convertibility to Traversal is redundant. Should just use the - // Category element in that case. - BOOST_MPL_ASSERT_NOT(( - is_convertible< - typename iterator_category_to_traversal::type - , Traversal - >)); - - BOOST_MPL_ASSERT((is_iterator_category)); - BOOST_MPL_ASSERT_NOT((is_iterator_category)); - BOOST_MPL_ASSERT_NOT((is_iterator_traversal)); -# if !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) - BOOST_MPL_ASSERT((is_iterator_traversal)); -# endif -}; - -// Computes an iterator_category tag whose traversal is Traversal and -// which is appropriate for an iterator -template -struct facade_iterator_category_impl -{ - BOOST_MPL_ASSERT_NOT((is_iterator_category)); - - typedef typename iterator_facade_default_category< - Traversal,ValueParam,Reference - >::type category; - - typedef typename mpl::if_< - is_same< - Traversal - , typename iterator_category_to_traversal::type - > - , category - , iterator_category_with_traversal - >::type type; -}; - -// -// Compute an iterator_category for iterator_facade -// -template -struct facade_iterator_category - : mpl::eval_if< - is_iterator_category - , mpl::identity // old-style categories are fine as-is - , facade_iterator_category_impl - > -{ -}; - -}}} // namespace boost::iterators::detail - -# include - -#endif // FACADE_ITERATOR_CATEGORY_DWA20031118_HPP diff --git a/libraries/boost/include/boost/iterator/interoperable.hpp b/libraries/boost/include/boost/iterator/interoperable.hpp deleted file mode 100644 index 6f3c872a27..0000000000 --- a/libraries/boost/include/boost/iterator/interoperable.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// (C) Copyright David Abrahams 2002. -// (C) Copyright Jeremy Siek 2002. -// (C) Copyright Thomas Witt 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_INTEROPERABLE_23022003THW_HPP -# define BOOST_INTEROPERABLE_23022003THW_HPP - -# include -# include - -# include - -# include // must appear last - -namespace boost { -namespace iterators { - - // - // Meta function that determines whether two - // iterator types are considered interoperable. - // - // Two iterator types A,B are considered interoperable if either - // A is convertible to B or vice versa. - // This interoperability definition is in sync with the - // standards requirements on constant/mutable container - // iterators (23.1 [lib.container.requirements]). - // - // For compilers that don't support is_convertible - // is_interoperable gives false positives. See comments - // on operator implementation for consequences. - // - template - struct is_interoperable -# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY - : mpl::true_ -# else - : mpl::or_< - is_convertible< A, B > - , is_convertible< B, A > > -# endif - { - }; - -} // namespace iterators - -using iterators::is_interoperable; - -} // namespace boost - -# include - -#endif // BOOST_INTEROPERABLE_23022003THW_HPP diff --git a/libraries/boost/include/boost/iterator/iterator_categories.hpp b/libraries/boost/include/boost/iterator/iterator_categories.hpp deleted file mode 100644 index baf805af6e..0000000000 --- a/libraries/boost/include/boost/iterator/iterator_categories.hpp +++ /dev/null @@ -1,216 +0,0 @@ -// (C) Copyright Jeremy Siek 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_ITERATOR_CATEGORIES_HPP -# define BOOST_ITERATOR_CATEGORIES_HPP - -# include -# include - -# include - -# include -# include -# include -# include - -# include - -# include - -#include - -namespace boost { -namespace iterators { - -// -// Traversal Categories -// - -struct no_traversal_tag {}; - -struct incrementable_traversal_tag - : no_traversal_tag -{ -// incrementable_traversal_tag() {} -// incrementable_traversal_tag(std::output_iterator_tag const&) {}; -}; - -struct single_pass_traversal_tag - : incrementable_traversal_tag -{ -// single_pass_traversal_tag() {} -// single_pass_traversal_tag(std::input_iterator_tag const&) {}; -}; - -struct forward_traversal_tag - : single_pass_traversal_tag -{ -// forward_traversal_tag() {} -// forward_traversal_tag(std::forward_iterator_tag const&) {}; -}; - -struct bidirectional_traversal_tag - : forward_traversal_tag -{ -// bidirectional_traversal_tag() {}; -// bidirectional_traversal_tag(std::bidirectional_iterator_tag const&) {}; -}; - -struct random_access_traversal_tag - : bidirectional_traversal_tag -{ -// random_access_traversal_tag() {}; -// random_access_traversal_tag(std::random_access_iterator_tag const&) {}; -}; - -namespace detail -{ - // - // Convert a "strictly old-style" iterator category to a traversal - // tag. This is broken out into a separate metafunction to reduce - // the cost of instantiating iterator_category_to_traversal, below, - // for new-style types. - // - template - struct old_category_to_traversal - : mpl::eval_if< - is_convertible - , mpl::identity - , mpl::eval_if< - is_convertible - , mpl::identity - , mpl::eval_if< - is_convertible - , mpl::identity - , mpl::eval_if< - is_convertible - , mpl::identity - , mpl::eval_if< - is_convertible - , mpl::identity - , void - > - > - > - > - > - {}; - -} // namespace detail - -// -// Convert an iterator category into a traversal tag -// -template -struct iterator_category_to_traversal - : mpl::eval_if< // if already convertible to a traversal tag, we're done. - is_convertible - , mpl::identity - , boost::iterators::detail::old_category_to_traversal - > -{}; - -// Trait to get an iterator's traversal category -template -struct iterator_traversal - : iterator_category_to_traversal< - typename std::iterator_traits::iterator_category - > -{}; - -# ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT -// Hack because BOOST_MPL_AUX_LAMBDA_SUPPORT doesn't seem to work -// out well. Instantiating the nested apply template also -// requires instantiating iterator_traits on the -// placeholder. Instead we just specialize it as a metafunction -// class. -template <> -struct iterator_traversal -{ - template - struct apply : iterator_traversal - {}; -}; -template <> -struct iterator_traversal - : iterator_traversal -{}; -# endif - -// -// Convert an iterator traversal to one of the traversal tags. -// -template -struct pure_traversal_tag - : mpl::eval_if< - is_convertible - , mpl::identity - , mpl::eval_if< - is_convertible - , mpl::identity - , mpl::eval_if< - is_convertible - , mpl::identity - , mpl::eval_if< - is_convertible - , mpl::identity - , mpl::eval_if< - is_convertible - , mpl::identity - , void - > - > - > - > - > -{ -}; - -// -// Trait to retrieve one of the iterator traversal tags from the iterator category or traversal. -// -template -struct pure_iterator_traversal - : pure_traversal_tag::type> -{}; - -# ifdef BOOST_MPL_CFG_NO_FULL_LAMBDA_SUPPORT -template <> -struct pure_iterator_traversal -{ - template - struct apply : pure_iterator_traversal - {}; -}; -template <> -struct pure_iterator_traversal - : pure_iterator_traversal -{}; -# endif - -} // namespace iterators - -using iterators::no_traversal_tag; -using iterators::incrementable_traversal_tag; -using iterators::single_pass_traversal_tag; -using iterators::forward_traversal_tag; -using iterators::bidirectional_traversal_tag; -using iterators::random_access_traversal_tag; -using iterators::iterator_category_to_traversal; -using iterators::iterator_traversal; - -// This import is needed for backward compatibility with Boost.Range: -// boost/range/detail/demote_iterator_traversal_tag.hpp -// It should be removed when that header is fixed. -namespace detail { -using iterators::pure_traversal_tag; -} // namespace detail - -} // namespace boost - -#include - -#endif // BOOST_ITERATOR_CATEGORIES_HPP diff --git a/libraries/boost/include/boost/iterator/iterator_facade.hpp b/libraries/boost/include/boost/iterator/iterator_facade.hpp deleted file mode 100644 index 225c53a231..0000000000 --- a/libraries/boost/include/boost/iterator/iterator_facade.hpp +++ /dev/null @@ -1,981 +0,0 @@ -// (C) Copyright David Abrahams 2002. -// (C) Copyright Jeremy Siek 2002. -// (C) Copyright Thomas Witt 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_ITERATOR_FACADE_23022003THW_HPP -#define BOOST_ITERATOR_FACADE_23022003THW_HPP - -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include // this goes last - -namespace boost { -namespace iterators { - - // This forward declaration is required for the friend declaration - // in iterator_core_access - template class iterator_facade; - - namespace detail - { - // A binary metafunction class that always returns bool. VC6 - // ICEs on mpl::always, probably because of the default - // parameters. - struct always_bool2 - { - template - struct apply - { - typedef bool type; - }; - }; - - // The type trait checks if the category or traversal is at least as advanced as the specified required traversal - template< typename CategoryOrTraversal, typename Required > - struct is_traversal_at_least : - public boost::is_convertible< typename iterator_category_to_traversal< CategoryOrTraversal >::type, Required > - {}; - - // - // enable if for use in operator implementation. - // - template < - class Facade1 - , class Facade2 - , class Return - > - struct enable_if_interoperable : - public boost::iterators::enable_if< - is_interoperable< Facade1, Facade2 > - , Return - > - {}; - - // - // enable if for use in implementation of operators specific for random access traversal. - // - template < - class Facade1 - , class Facade2 - , class Return - > - struct enable_if_interoperable_and_random_access_traversal : - public boost::iterators::enable_if< - mpl::and_< - is_interoperable< Facade1, Facade2 > - , is_traversal_at_least< typename iterator_category< Facade1 >::type, random_access_traversal_tag > - , is_traversal_at_least< typename iterator_category< Facade2 >::type, random_access_traversal_tag > - > - , Return - > - {}; - - // - // Generates associated types for an iterator_facade with the - // given parameters. - // - template < - class ValueParam - , class CategoryOrTraversal - , class Reference - , class Difference - > - struct iterator_facade_types - { - typedef typename facade_iterator_category< - CategoryOrTraversal, ValueParam, Reference - >::type iterator_category; - - typedef typename remove_const::type value_type; - - // Not the real associated pointer type - typedef typename mpl::eval_if< - boost::iterators::detail::iterator_writability_disabled - , add_pointer - , add_pointer - >::type pointer; - -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && (BOOST_WORKAROUND(_STLPORT_VERSION, BOOST_TESTED_AT(0x452)) \ - || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, BOOST_TESTED_AT(310))) \ - || BOOST_WORKAROUND(BOOST_RWSTD_VER, BOOST_TESTED_AT(0x20101)) \ - || BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 310) - - // To interoperate with some broken library/compiler - // combinations, user-defined iterators must be derived from - // std::iterator. It is possible to implement a standard - // library for broken compilers without this limitation. -# define BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE 1 - - typedef - iterator - base; -# endif - }; - - // iterators whose dereference operators reference the same value - // for all iterators into the same sequence (like many input - // iterators) need help with their postfix ++: the referenced - // value must be read and stored away before the increment occurs - // so that *a++ yields the originally referenced element and not - // the next one. - template - class postfix_increment_proxy - { - typedef typename iterator_value::type value_type; - public: - explicit postfix_increment_proxy(Iterator const& x) - : stored_value(*x) - {} - - // Returning a mutable reference allows nonsense like - // (*r++).mutate(), but it imposes fewer assumptions about the - // behavior of the value_type. In particular, recall that - // (*r).mutate() is legal if operator* returns by value. - value_type& - operator*() const - { - return this->stored_value; - } - private: - mutable value_type stored_value; - }; - - // - // In general, we can't determine that such an iterator isn't - // writable -- we also need to store a copy of the old iterator so - // that it can be written into. - template - class writable_postfix_increment_proxy - { - typedef typename iterator_value::type value_type; - public: - explicit writable_postfix_increment_proxy(Iterator const& x) - : stored_value(*x) - , stored_iterator(x) - {} - - // Dereferencing must return a proxy so that both *r++ = o and - // value_type(*r++) can work. In this case, *r is the same as - // *r++, and the conversion operator below is used to ensure - // readability. - writable_postfix_increment_proxy const& - operator*() const - { - return *this; - } - - // Provides readability of *r++ - operator value_type&() const - { - return stored_value; - } - - // Provides writability of *r++ - template - T const& operator=(T const& x) const - { - *this->stored_iterator = x; - return x; - } - - // This overload just in case only non-const objects are writable - template - T& operator=(T& x) const - { - *this->stored_iterator = x; - return x; - } - - // Provides X(r++) - operator Iterator const&() const - { - return stored_iterator; - } - - private: - mutable value_type stored_value; - Iterator stored_iterator; - }; - -# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - - template - struct is_non_proxy_reference_impl - { - static Reference r; - - template - static typename mpl::if_< - is_convertible< - R const volatile* - , Value const volatile* - > - , char[1] - , char[2] - >::type& helper(R const&); - - BOOST_STATIC_CONSTANT(bool, value = sizeof(helper(r)) == 1); - }; - - template - struct is_non_proxy_reference - : mpl::bool_< - is_non_proxy_reference_impl::value - > - {}; -# else - template - struct is_non_proxy_reference - : is_convertible< - typename remove_reference::type - const volatile* - , Value const volatile* - > - {}; -# endif - - // A metafunction to choose the result type of postfix ++ - // - // Because the C++98 input iterator requirements say that *r++ has - // type T (value_type), implementations of some standard - // algorithms like lexicographical_compare may use constructions - // like: - // - // *r++ < *s++ - // - // If *r++ returns a proxy (as required if r is writable but not - // multipass), this sort of expression will fail unless the proxy - // supports the operator<. Since there are any number of such - // operations, we're not going to try to support them. Therefore, - // even if r++ returns a proxy, *r++ will only return a proxy if - // *r also returns a proxy. - template - struct postfix_increment_result - : mpl::eval_if< - mpl::and_< - // A proxy is only needed for readable iterators - is_convertible< - Reference - // Use add_lvalue_reference to form `reference to Value` due to - // some (strict) C++03 compilers (e.g. `gcc -std=c++03`) reject - // 'reference-to-reference' in the template which described in CWG - // DR106. - // http://www.open-std.org/Jtc1/sc22/wg21/docs/cwg_defects.html#106 - , typename add_lvalue_reference::type - > - - // No multipass iterator can have values that disappear - // before positions can be re-visited - , mpl::not_< - is_convertible< - typename iterator_category_to_traversal::type - , forward_traversal_tag - > - > - > - , mpl::if_< - is_non_proxy_reference - , postfix_increment_proxy - , writable_postfix_increment_proxy - > - , mpl::identity - > - {}; - - // operator->() needs special support for input iterators to strictly meet the - // standard's requirements. If *i is not a reference type, we must still - // produce an lvalue to which a pointer can be formed. We do that by - // returning a proxy object containing an instance of the reference object. - template - struct operator_arrow_dispatch // proxy references - { - struct proxy - { - explicit proxy(Reference const & x) : m_ref(x) {} - Reference* operator->() { return boost::addressof(m_ref); } - // This function is needed for MWCW and BCC, which won't call - // operator-> again automatically per 13.3.1.2 para 8 - operator Reference*() { return boost::addressof(m_ref); } - Reference m_ref; - }; - typedef proxy result_type; - static result_type apply(Reference const & x) - { - return result_type(x); - } - }; - - template - struct operator_arrow_dispatch // "real" references - { - typedef Pointer result_type; - static result_type apply(T& x) - { - return boost::addressof(x); - } - }; - - // A proxy return type for operator[], needed to deal with - // iterators that may invalidate referents upon destruction. - // Consider the temporary iterator in *(a + n) - template - class operator_brackets_proxy - { - // Iterator is actually an iterator_facade, so we do not have to - // go through iterator_traits to access the traits. - typedef typename Iterator::reference reference; - typedef typename Iterator::value_type value_type; - - public: - operator_brackets_proxy(Iterator const& iter) - : m_iter(iter) - {} - - operator reference() const - { - return *m_iter; - } - - operator_brackets_proxy& operator=(value_type const& val) - { - *m_iter = val; - return *this; - } - - private: - Iterator m_iter; - }; - - // A metafunction that determines whether operator[] must return a - // proxy, or whether it can simply return a copy of the value_type. - template - struct use_operator_brackets_proxy - : mpl::not_< - mpl::and_< - // Really we want an is_copy_constructible trait here, - // but is_POD will have to suffice in the meantime. - boost::is_POD - , iterator_writability_disabled - > - > - {}; - - template - struct operator_brackets_result - { - typedef typename mpl::if_< - use_operator_brackets_proxy - , operator_brackets_proxy - , Value - >::type type; - }; - - template - operator_brackets_proxy make_operator_brackets_result(Iterator const& iter, mpl::true_) - { - return operator_brackets_proxy(iter); - } - - template - typename Iterator::value_type make_operator_brackets_result(Iterator const& iter, mpl::false_) - { - return *iter; - } - - struct choose_difference_type - { - template - struct apply - : -# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP - iterator_difference -# else - mpl::eval_if< - is_convertible - , iterator_difference - , iterator_difference - > -# endif - {}; - - }; - - template < - class Derived - , class Value - , class CategoryOrTraversal - , class Reference - , class Difference - , bool IsBidirectionalTraversal - , bool IsRandomAccessTraversal - > - class iterator_facade_base; - - } // namespace detail - - - // Macros which describe the declarations of binary operators -# ifdef BOOST_NO_STRICT_ITERATOR_INTEROPERABILITY -# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \ - template < \ - class Derived1, class V1, class TC1, class Reference1, class Difference1 \ - , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ - > \ - prefix typename mpl::apply2::type \ - operator op( \ - iterator_facade const& lhs \ - , iterator_facade const& rhs) -# else -# define BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, enabler) \ - template < \ - class Derived1, class V1, class TC1, class Reference1, class Difference1 \ - , class Derived2, class V2, class TC2, class Reference2, class Difference2 \ - > \ - prefix typename enabler< \ - Derived1, Derived2 \ - , typename mpl::apply2::type \ - >::type \ - operator op( \ - iterator_facade const& lhs \ - , iterator_facade const& rhs) -# endif - -# define BOOST_ITERATOR_FACADE_INTEROP_HEAD(prefix, op, result_type) \ - BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable) - -# define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(prefix, op, result_type) \ - BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL(prefix, op, result_type, boost::iterators::detail::enable_if_interoperable_and_random_access_traversal) - -# define BOOST_ITERATOR_FACADE_PLUS_HEAD(prefix,args) \ - template \ - prefix typename boost::iterators::enable_if< \ - boost::iterators::detail::is_traversal_at_least< TC, boost::iterators::random_access_traversal_tag >, \ - Derived \ - >::type operator+ args - - // - // Helper class for granting access to the iterator core interface. - // - // The simple core interface is used by iterator_facade. The core - // interface of a user/library defined iterator type should not be made public - // so that it does not clutter the public interface. Instead iterator_core_access - // should be made friend so that iterator_facade can access the core - // interface through iterator_core_access. - // - class iterator_core_access - { -# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) - // Tasteless as this may seem, making all members public allows member templates - // to work in the absence of member template friends. - public: -# else - - template friend class iterator_facade; - template - friend class detail::iterator_facade_base; - -# define BOOST_ITERATOR_FACADE_RELATION(op) \ - BOOST_ITERATOR_FACADE_INTEROP_HEAD(friend,op, boost::iterators::detail::always_bool2); - - BOOST_ITERATOR_FACADE_RELATION(==) - BOOST_ITERATOR_FACADE_RELATION(!=) - -# undef BOOST_ITERATOR_FACADE_RELATION - -# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op) \ - BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(friend,op, boost::iterators::detail::always_bool2); - - BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<) - BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>) - BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<=) - BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>=) - -# undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION - - BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD( - friend, -, boost::iterators::detail::choose_difference_type) - ; - - BOOST_ITERATOR_FACADE_PLUS_HEAD( - friend inline - , (iterator_facade const& - , typename Derived::difference_type) - ) - ; - - BOOST_ITERATOR_FACADE_PLUS_HEAD( - friend inline - , (typename Derived::difference_type - , iterator_facade const&) - ) - ; - -# endif - - template - static typename Facade::reference dereference(Facade const& f) - { - return f.dereference(); - } - - template - static void increment(Facade& f) - { - f.increment(); - } - - template - static void decrement(Facade& f) - { - f.decrement(); - } - - template - static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::true_) - { - return f1.equal(f2); - } - - template - static bool equal(Facade1 const& f1, Facade2 const& f2, mpl::false_) - { - return f2.equal(f1); - } - - template - static void advance(Facade& f, typename Facade::difference_type n) - { - f.advance(n); - } - - template - static typename Facade1::difference_type distance_from( - Facade1 const& f1, Facade2 const& f2, mpl::true_) - { - return -f1.distance_to(f2); - } - - template - static typename Facade2::difference_type distance_from( - Facade1 const& f1, Facade2 const& f2, mpl::false_) - { - return f2.distance_to(f1); - } - - // - // Curiously Recurring Template interface. - // - template - static I& derived(iterator_facade& facade) - { - return *static_cast(&facade); - } - - template - static I const& derived(iterator_facade const& facade) - { - return *static_cast(&facade); - } - - // objects of this class are useless - BOOST_DELETED_FUNCTION(iterator_core_access()) - }; - - namespace detail { - - // Implementation for forward traversal iterators - template < - class Derived - , class Value - , class CategoryOrTraversal - , class Reference - , class Difference - > - class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false > -# ifdef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE - : public boost::iterators::detail::iterator_facade_types< - Value, CategoryOrTraversal, Reference, Difference - >::base -# undef BOOST_ITERATOR_FACADE_NEEDS_ITERATOR_BASE -# endif - { - private: - typedef boost::iterators::detail::iterator_facade_types< - Value, CategoryOrTraversal, Reference, Difference - > associated_types; - - typedef boost::iterators::detail::operator_arrow_dispatch< - Reference - , typename associated_types::pointer - > operator_arrow_dispatch_; - - public: - typedef typename associated_types::value_type value_type; - typedef Reference reference; - typedef Difference difference_type; - - typedef typename operator_arrow_dispatch_::result_type pointer; - - typedef typename associated_types::iterator_category iterator_category; - - public: - reference operator*() const - { - return iterator_core_access::dereference(this->derived()); - } - - pointer operator->() const - { - return operator_arrow_dispatch_::apply(*this->derived()); - } - - Derived& operator++() - { - iterator_core_access::increment(this->derived()); - return this->derived(); - } - - protected: - // - // Curiously Recurring Template interface. - // - Derived& derived() - { - return *static_cast(this); - } - - Derived const& derived() const - { - return *static_cast(this); - } - }; - - // Implementation for bidirectional traversal iterators - template < - class Derived - , class Value - , class CategoryOrTraversal - , class Reference - , class Difference - > - class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > : - public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, false, false > - { - public: - Derived& operator--() - { - iterator_core_access::decrement(this->derived()); - return this->derived(); - } - - Derived operator--(int) - { - Derived tmp(this->derived()); - --*this; - return tmp; - } - }; - - // Implementation for random access traversal iterators - template < - class Derived - , class Value - , class CategoryOrTraversal - , class Reference - , class Difference - > - class iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, true > : - public iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > - { - private: - typedef iterator_facade_base< Derived, Value, CategoryOrTraversal, Reference, Difference, true, false > base_type; - - public: - typedef typename base_type::reference reference; - typedef typename base_type::difference_type difference_type; - - public: - typename boost::iterators::detail::operator_brackets_result::type - operator[](difference_type n) const - { - typedef boost::iterators::detail::use_operator_brackets_proxy use_proxy; - - return boost::iterators::detail::make_operator_brackets_result( - this->derived() + n - , use_proxy() - ); - } - - Derived& operator+=(difference_type n) - { - iterator_core_access::advance(this->derived(), n); - return this->derived(); - } - - Derived& operator-=(difference_type n) - { - iterator_core_access::advance(this->derived(), -n); - return this->derived(); - } - - Derived operator-(difference_type x) const - { - Derived result(this->derived()); - return result -= x; - } - }; - - } // namespace detail - - // - // iterator_facade - use as a public base class for defining new - // standard-conforming iterators. - // - template < - class Derived // The derived iterator type being constructed - , class Value - , class CategoryOrTraversal - , class Reference = Value& - , class Difference = std::ptrdiff_t - > - class iterator_facade : - public detail::iterator_facade_base< - Derived, - Value, - CategoryOrTraversal, - Reference, - Difference, - detail::is_traversal_at_least< CategoryOrTraversal, bidirectional_traversal_tag >::value, - detail::is_traversal_at_least< CategoryOrTraversal, random_access_traversal_tag >::value - > - { - protected: - // For use by derived classes - typedef iterator_facade iterator_facade_; - }; - - template - inline typename boost::iterators::detail::postfix_increment_result::type - operator++( - iterator_facade& i - , int - ) - { - typename boost::iterators::detail::postfix_increment_result::type - tmp(*static_cast(&i)); - - ++i; - - return tmp; - } - - - // - // Comparison operator implementation. The library supplied operators - // enables the user to provide fully interoperable constant/mutable - // iterator types. I.e. the library provides all operators - // for all mutable/constant iterator combinations. - // - // Note though that this kind of interoperability for constant/mutable - // iterators is not required by the standard for container iterators. - // All the standard asks for is a conversion mutable -> constant. - // Most standard library implementations nowadays provide fully interoperable - // iterator implementations, but there are still heavily used implementations - // that do not provide them. (Actually it's even worse, they do not provide - // them for only a few iterators.) - // - // ?? Maybe a BOOST_ITERATOR_NO_FULL_INTEROPERABILITY macro should - // enable the user to turn off mixed type operators - // - // The library takes care to provide only the right operator overloads. - // I.e. - // - // bool operator==(Iterator, Iterator); - // bool operator==(ConstIterator, Iterator); - // bool operator==(Iterator, ConstIterator); - // bool operator==(ConstIterator, ConstIterator); - // - // ... - // - // In order to do so it uses c++ idioms that are not yet widely supported - // by current compiler releases. The library is designed to degrade gracefully - // in the face of compiler deficiencies. In general compiler - // deficiencies result in less strict error checking and more obscure - // error messages, functionality is not affected. - // - // For full operation compiler support for "Substitution Failure Is Not An Error" - // (aka. enable_if) and boost::is_convertible is required. - // - // The following problems occur if support is lacking. - // - // Pseudo code - // - // --------------- - // AdaptorA a1; - // AdaptorA a2; - // - // // This will result in a no such overload error in full operation - // // If enable_if or is_convertible is not supported - // // The instantiation will fail with an error hopefully indicating that - // // there is no operator== for Iterator1, Iterator2 - // // The same will happen if no enable_if is used to remove - // // false overloads from the templated conversion constructor - // // of AdaptorA. - // - // a1 == a2; - // ---------------- - // - // AdaptorA a; - // AdaptorB b; - // - // // This will result in a no such overload error in full operation - // // If enable_if is not supported the static assert used - // // in the operator implementation will fail. - // // This will accidently work if is_convertible is not supported. - // - // a == b; - // ---------------- - // - -# ifdef BOOST_NO_ONE_WAY_ITERATOR_INTEROP -# define BOOST_ITERATOR_CONVERTIBLE(a,b) mpl::true_() -# else -# define BOOST_ITERATOR_CONVERTIBLE(a,b) is_convertible() -# endif - -# define BOOST_ITERATOR_FACADE_INTEROP(op, result_type, return_prefix, base_op) \ - BOOST_ITERATOR_FACADE_INTEROP_HEAD(inline, op, result_type) \ - { \ - /* For those compilers that do not support enable_if */ \ - BOOST_STATIC_ASSERT(( \ - is_interoperable< Derived1, Derived2 >::value \ - )); \ - return_prefix iterator_core_access::base_op( \ - *static_cast(&lhs) \ - , *static_cast(&rhs) \ - , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \ - ); \ - } - -# define BOOST_ITERATOR_FACADE_RELATION(op, return_prefix, base_op) \ - BOOST_ITERATOR_FACADE_INTEROP( \ - op \ - , boost::iterators::detail::always_bool2 \ - , return_prefix \ - , base_op \ - ) - - BOOST_ITERATOR_FACADE_RELATION(==, return, equal) - BOOST_ITERATOR_FACADE_RELATION(!=, return !, equal) - -# undef BOOST_ITERATOR_FACADE_RELATION - - -# define BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS(op, result_type, return_prefix, base_op) \ - BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD(inline, op, result_type) \ - { \ - /* For those compilers that do not support enable_if */ \ - BOOST_STATIC_ASSERT(( \ - is_interoperable< Derived1, Derived2 >::value && \ - boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived1 >::type, random_access_traversal_tag >::value && \ - boost::iterators::detail::is_traversal_at_least< typename iterator_category< Derived2 >::type, random_access_traversal_tag >::value \ - )); \ - return_prefix iterator_core_access::base_op( \ - *static_cast(&lhs) \ - , *static_cast(&rhs) \ - , BOOST_ITERATOR_CONVERTIBLE(Derived2,Derived1) \ - ); \ - } - -# define BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(op, return_prefix, base_op) \ - BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( \ - op \ - , boost::iterators::detail::always_bool2 \ - , return_prefix \ - , base_op \ - ) - - BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<, return 0 >, distance_from) - BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>, return 0 <, distance_from) - BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(<=, return 0 >=, distance_from) - BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION(>=, return 0 <=, distance_from) - -# undef BOOST_ITERATOR_FACADE_RANDOM_ACCESS_RELATION - - // operator- requires an additional part in the static assertion - BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS( - - - , boost::iterators::detail::choose_difference_type - , return - , distance_from - ) - -# undef BOOST_ITERATOR_FACADE_INTEROP -# undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS - -# define BOOST_ITERATOR_FACADE_PLUS(args) \ - BOOST_ITERATOR_FACADE_PLUS_HEAD(inline, args) \ - { \ - Derived tmp(static_cast(i)); \ - return tmp += n; \ - } - - BOOST_ITERATOR_FACADE_PLUS(( - iterator_facade const& i - , typename Derived::difference_type n - )) - - BOOST_ITERATOR_FACADE_PLUS(( - typename Derived::difference_type n - , iterator_facade const& i - )) - -# undef BOOST_ITERATOR_FACADE_PLUS -# undef BOOST_ITERATOR_FACADE_PLUS_HEAD - -# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD -# undef BOOST_ITERATOR_FACADE_INTEROP_RANDOM_ACCESS_HEAD -# undef BOOST_ITERATOR_FACADE_INTEROP_HEAD_IMPL - -} // namespace iterators - -using iterators::iterator_core_access; -using iterators::iterator_facade; - -} // namespace boost - -#include - -#endif // BOOST_ITERATOR_FACADE_23022003THW_HPP diff --git a/libraries/boost/include/boost/iterator/iterator_traits.hpp b/libraries/boost/include/boost/iterator/iterator_traits.hpp deleted file mode 100644 index 6582a68f50..0000000000 --- a/libraries/boost/include/boost/iterator/iterator_traits.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef ITERATOR_TRAITS_DWA200347_HPP -# define ITERATOR_TRAITS_DWA200347_HPP - -# include - -#include - -namespace boost { -namespace iterators { - -// Macro for supporting old compilers, no longer needed but kept -// for backwards compatibility (it was documented). -#define BOOST_ITERATOR_CATEGORY iterator_category - - -template -struct iterator_value -{ - typedef typename std::iterator_traits::value_type type; -}; - -template -struct iterator_reference -{ - typedef typename std::iterator_traits::reference type; -}; - - -template -struct iterator_pointer -{ - typedef typename std::iterator_traits::pointer type; -}; - -template -struct iterator_difference -{ - typedef typename std::iterator_traits::difference_type type; -}; - -template -struct iterator_category -{ - typedef typename std::iterator_traits::iterator_category type; -}; - -} // namespace iterators - -using iterators::iterator_value; -using iterators::iterator_reference; -using iterators::iterator_pointer; -using iterators::iterator_difference; -using iterators::iterator_category; - -} // namespace boost - -#endif // ITERATOR_TRAITS_DWA200347_HPP diff --git a/libraries/boost/include/boost/limits.hpp b/libraries/boost/include/boost/limits.hpp deleted file mode 100644 index 47d8155611..0000000000 --- a/libraries/boost/include/boost/limits.hpp +++ /dev/null @@ -1,146 +0,0 @@ - -// (C) Copyright John maddock 1999. -// (C) David Abrahams 2002. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// use this header as a workaround for missing - -// See http://www.boost.org/libs/compatibility/index.html for documentation. - -#ifndef BOOST_LIMITS -#define BOOST_LIMITS - -#include - -#ifdef BOOST_NO_LIMITS -# error "There is no std::numeric_limits suppport available." -#else -# include -#endif - -#if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \ - || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS)) -// Add missing specializations for numeric_limits: -#ifdef BOOST_HAS_MS_INT64 -# define BOOST_LLT __int64 -# define BOOST_ULLT unsigned __int64 -#else -# define BOOST_LLT ::boost::long_long_type -# define BOOST_ULLT ::boost::ulong_long_type -#endif - -#include // for CHAR_BIT - -namespace std -{ - template<> - class numeric_limits - { - public: - - BOOST_STATIC_CONSTANT(bool, is_specialized = true); -#ifdef BOOST_HAS_MS_INT64 - static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x8000000000000000i64; } - static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0x7FFFFFFFFFFFFFFFi64; } -#elif defined(LLONG_MAX) - static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MIN; } - static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LLONG_MAX; } -#elif defined(LONGLONG_MAX) - static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MIN; } - static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return LONGLONG_MAX; } -#else - static BOOST_LLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); } - static BOOST_LLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~(min)(); } -#endif - BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1); - BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000); - BOOST_STATIC_CONSTANT(bool, is_signed = true); - BOOST_STATIC_CONSTANT(bool, is_integer = true); - BOOST_STATIC_CONSTANT(bool, is_exact = true); - BOOST_STATIC_CONSTANT(int, radix = 2); - static BOOST_LLT epsilon() throw() { return 0; }; - static BOOST_LLT round_error() throw() { return 0; }; - - BOOST_STATIC_CONSTANT(int, min_exponent = 0); - BOOST_STATIC_CONSTANT(int, min_exponent10 = 0); - BOOST_STATIC_CONSTANT(int, max_exponent = 0); - BOOST_STATIC_CONSTANT(int, max_exponent10 = 0); - - BOOST_STATIC_CONSTANT(bool, has_infinity = false); - BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false); - BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false); - BOOST_STATIC_CONSTANT(bool, has_denorm = false); - BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false); - static BOOST_LLT infinity() throw() { return 0; }; - static BOOST_LLT quiet_NaN() throw() { return 0; }; - static BOOST_LLT signaling_NaN() throw() { return 0; }; - static BOOST_LLT denorm_min() throw() { return 0; }; - - BOOST_STATIC_CONSTANT(bool, is_iec559 = false); - BOOST_STATIC_CONSTANT(bool, is_bounded = true); - BOOST_STATIC_CONSTANT(bool, is_modulo = true); - - BOOST_STATIC_CONSTANT(bool, traps = false); - BOOST_STATIC_CONSTANT(bool, tinyness_before = false); - BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); - - }; - - template<> - class numeric_limits - { - public: - - BOOST_STATIC_CONSTANT(bool, is_specialized = true); -#ifdef BOOST_HAS_MS_INT64 - static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0ui64; } - static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0xFFFFFFFFFFFFFFFFui64; } -#elif defined(ULLONG_MAX) && defined(ULLONG_MIN) - static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MIN; } - static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULLONG_MAX; } -#elif defined(ULONGLONG_MAX) && defined(ULONGLONG_MIN) - static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MIN; } - static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ULONGLONG_MAX; } -#else - static BOOST_ULLT min BOOST_PREVENT_MACRO_SUBSTITUTION (){ return 0uLL; } - static BOOST_ULLT max BOOST_PREVENT_MACRO_SUBSTITUTION (){ return ~0uLL; } -#endif - BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT); - BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT)) * 301L / 1000); - BOOST_STATIC_CONSTANT(bool, is_signed = false); - BOOST_STATIC_CONSTANT(bool, is_integer = true); - BOOST_STATIC_CONSTANT(bool, is_exact = true); - BOOST_STATIC_CONSTANT(int, radix = 2); - static BOOST_ULLT epsilon() throw() { return 0; }; - static BOOST_ULLT round_error() throw() { return 0; }; - - BOOST_STATIC_CONSTANT(int, min_exponent = 0); - BOOST_STATIC_CONSTANT(int, min_exponent10 = 0); - BOOST_STATIC_CONSTANT(int, max_exponent = 0); - BOOST_STATIC_CONSTANT(int, max_exponent10 = 0); - - BOOST_STATIC_CONSTANT(bool, has_infinity = false); - BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false); - BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false); - BOOST_STATIC_CONSTANT(bool, has_denorm = false); - BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false); - static BOOST_ULLT infinity() throw() { return 0; }; - static BOOST_ULLT quiet_NaN() throw() { return 0; }; - static BOOST_ULLT signaling_NaN() throw() { return 0; }; - static BOOST_ULLT denorm_min() throw() { return 0; }; - - BOOST_STATIC_CONSTANT(bool, is_iec559 = false); - BOOST_STATIC_CONSTANT(bool, is_bounded = true); - BOOST_STATIC_CONSTANT(bool, is_modulo = true); - - BOOST_STATIC_CONSTANT(bool, traps = false); - BOOST_STATIC_CONSTANT(bool, tinyness_before = false); - BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero); - - }; -} -#endif - -#endif - diff --git a/libraries/boost/include/boost/make_shared.hpp b/libraries/boost/include/boost/make_shared.hpp deleted file mode 100644 index 588fbfde1b..0000000000 --- a/libraries/boost/include/boost/make_shared.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef BOOST_MAKE_SHARED_HPP_INCLUDED -#define BOOST_MAKE_SHARED_HPP_INCLUDED - -// make_shared.hpp -// -// Copyright (c) 2007, 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include - -#endif // #ifndef BOOST_MAKE_SHARED_HPP_INCLUDED diff --git a/libraries/boost/include/boost/mem_fn.hpp b/libraries/boost/include/boost/mem_fn.hpp deleted file mode 100644 index 3bcd2c548b..0000000000 --- a/libraries/boost/include/boost/mem_fn.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef BOOST_MEM_FN_HPP_INCLUDED -#define BOOST_MEM_FN_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// mem_fn.hpp - a generalization of std::mem_fun[_ref] -// -// Copyright (c) 2009 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/bind/mem_fn.html for documentation. -// - -#include - -#endif // #ifndef BOOST_MEM_FN_HPP_INCLUDED diff --git a/libraries/boost/include/boost/noncopyable.hpp b/libraries/boost/include/boost/noncopyable.hpp deleted file mode 100644 index e998ee864a..0000000000 --- a/libraries/boost/include/boost/noncopyable.hpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2014 Glen Fernandes - * - * Distributed under the Boost Software License, Version 1.0. (See - * accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_NONCOPYABLE_HPP -#define BOOST_NONCOPYABLE_HPP - -// The header file at this path is deprecated; -// use boost/core/noncopyable.hpp instead. - -#include - -#endif diff --git a/libraries/boost/include/boost/none.hpp b/libraries/boost/include/boost/none.hpp deleted file mode 100644 index a37c45c514..0000000000 --- a/libraries/boost/include/boost/none.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2003, Fernando Luis Cacciola Carballal. -// Copyright (C) 2014, 2015 Andrzej Krzemienski. -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// fernando_cacciola@hotmail.com -// -#ifndef BOOST_NONE_17SEP2003_HPP -#define BOOST_NONE_17SEP2003_HPP - -#include "boost/none_t.hpp" - -// NOTE: Borland users have to include this header outside any precompiled headers -// (bcc<=5.64 cannot include instance data in a precompiled header) -// -- * To be verified, now that there's no unnamed namespace - -namespace boost { - -#ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE - -none_t const none = (static_cast(0)) ; - -#elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE - -namespace detail { namespace optional_detail { - - // the trick here is to make boost::none defined once as a global but in a header file - template - struct none_instance - { - static const T instance; - }; - - template - const T none_instance::instance = T(); // global, but because 'tis a template, no cpp file required - -} } // namespace detail::optional_detail - - -namespace { - // TU-local - const none_t& none = detail::optional_detail::none_instance::instance; -} - -#else - -const none_t none ((none_t::init_tag())); - -#endif // older definitions - -} // namespace boost - -#endif // header guard - diff --git a/libraries/boost/include/boost/none_t.hpp b/libraries/boost/include/boost/none_t.hpp deleted file mode 100644 index 008f369d1c..0000000000 --- a/libraries/boost/include/boost/none_t.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2003, Fernando Luis Cacciola Carballal. -// Copyright (C) 2014, 2015 Andrzej Krzemienski. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// fernando_cacciola@hotmail.com -// -#ifndef BOOST_NONE_T_17SEP2003_HPP -#define BOOST_NONE_T_17SEP2003_HPP - -namespace boost { - -#ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE - -namespace detail { struct none_helper{}; } -typedef int detail::none_helper::*none_t ; - -#elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE - -class none_t {}; - -#else - -struct none_t -{ - struct init_tag{}; - explicit none_t(init_tag){} // to disable default constructor -}; - -#endif // old implementation workarounds - -} // namespace boost - -#endif // header guard diff --git a/libraries/boost/include/boost/numeric/conversion/conversion_traits.hpp b/libraries/boost/include/boost/numeric/conversion/conversion_traits.hpp deleted file mode 100644 index 23e0eb8c9a..0000000000 --- a/libraries/boost/include/boost/numeric/conversion/conversion_traits.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/numeric/conversion -// -// Contact the author at: fernando_cacciola@hotmail.com -// -#ifndef BOOST_NUMERIC_CONVERSION_CONVERSION_TRAITS_FLC_12NOV2002_HPP -#define BOOST_NUMERIC_CONVERSION_CONVERSION_TRAITS_FLC_12NOV2002_HPP - -#include "boost/numeric/conversion/detail/conversion_traits.hpp" -#include "boost/detail/workaround.hpp" -#include "boost/config.hpp" - -namespace boost { namespace numeric -{ - -template -struct conversion_traits - : convdetail::get_conversion_traits::type -{ -} ; - -} } // namespace boost::numeric - -#endif -// -/////////////////////////////////////////////////////////////////////////////////////////////// - - diff --git a/libraries/boost/include/boost/numeric/conversion/detail/conversion_traits.hpp b/libraries/boost/include/boost/numeric/conversion/detail/conversion_traits.hpp deleted file mode 100644 index ed25349c67..0000000000 --- a/libraries/boost/include/boost/numeric/conversion/detail/conversion_traits.hpp +++ /dev/null @@ -1,97 +0,0 @@ -// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/numeric/conversion -// -// Contact the author at: fernando_cacciola@hotmail.com -// -#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP -#define BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP - -#include "boost/type_traits/is_arithmetic.hpp" -#include "boost/type_traits/is_same.hpp" -#include "boost/type_traits/remove_cv.hpp" - -#include "boost/numeric/conversion/detail/meta.hpp" -#include "boost/numeric/conversion/detail/int_float_mixture.hpp" -#include "boost/numeric/conversion/detail/sign_mixture.hpp" -#include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp" -#include "boost/numeric/conversion/detail/is_subranged.hpp" - -namespace boost { namespace numeric { namespace convdetail -{ - //------------------------------------------------------------------- - // Implementation of the Conversion Traits for T != S - // - // This is a VISIBLE base class of the user-level conversion_traits<> class. - //------------------------------------------------------------------- - template - struct non_trivial_traits_impl - { - typedef typename get_int_float_mixture ::type int_float_mixture ; - typedef typename get_sign_mixture ::type sign_mixture ; - typedef typename get_udt_builtin_mixture ::type udt_builtin_mixture ; - - typedef typename get_is_subranged::type subranged ; - - typedef mpl::false_ trivial ; - - typedef T target_type ; - typedef S source_type ; - typedef T result_type ; - - typedef typename mpl::if_< is_arithmetic, S, S const&>::type argument_type ; - - typedef typename mpl::if_::type supertype ; - typedef typename mpl::if_::type subtype ; - } ; - - //------------------------------------------------------------------- - // Implementation of the Conversion Traits for T == S - // - // This is a VISIBLE base class of the user-level conversion_traits<> class. - //------------------------------------------------------------------- - template - struct trivial_traits_impl - { - typedef typename get_int_float_mixture ::type int_float_mixture ; - typedef typename get_sign_mixture ::type sign_mixture ; - typedef typename get_udt_builtin_mixture::type udt_builtin_mixture ; - - typedef mpl::false_ subranged ; - typedef mpl::true_ trivial ; - - typedef N target_type ; - typedef N source_type ; - typedef N const& result_type ; - typedef N const& argument_type ; - - typedef N supertype ; - typedef N subtype ; - - } ; - - //------------------------------------------------------------------- - // Top level implementation selector. - //------------------------------------------------------------------- - template - struct get_conversion_traits - { - typedef typename remove_cv::type target_type ; - typedef typename remove_cv::type source_type ; - - typedef typename is_same::type is_trivial ; - - typedef trivial_traits_impl trivial_imp ; - typedef non_trivial_traits_impl non_trivial_imp ; - - typedef typename mpl::if_::type type ; - } ; - -} } } // namespace boost::numeric::convdetail - -#endif - - diff --git a/libraries/boost/include/boost/numeric/conversion/detail/int_float_mixture.hpp b/libraries/boost/include/boost/numeric/conversion/detail/int_float_mixture.hpp deleted file mode 100644 index 464e52753f..0000000000 --- a/libraries/boost/include/boost/numeric/conversion/detail/int_float_mixture.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/numeric/conversion -// -// Contact the author at: fernando_cacciola@hotmail.com -// -#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP -#define BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP - -#include "boost/config.hpp" -#include "boost/limits.hpp" - -#include "boost/numeric/conversion/int_float_mixture_enum.hpp" -#include "boost/numeric/conversion/detail/meta.hpp" - -#include "boost/mpl/integral_c.hpp" - -namespace boost { namespace numeric { namespace convdetail -{ - // Integral Constants for 'IntFloatMixture' - typedef mpl::integral_c int2int_c ; - typedef mpl::integral_c int2float_c ; - typedef mpl::integral_c float2int_c ; - typedef mpl::integral_c float2float_c ; - - // Metafunction: - // - // get_int_float_mixture::type - // - // Selects the appropriate Int-Float Mixture Integral Constant for the combination T,S. - // - template - struct get_int_float_mixture - { - typedef mpl::bool_< ::std::numeric_limits::is_integer > S_int ; - typedef mpl::bool_< ::std::numeric_limits::is_integer > T_int ; - - typedef typename - for_both::type - type ; - } ; - - // Metafunction: - // - // for_int_float_mixture::type - // - // {Mixture} is one of the Integral Constants for Mixture, declared above. - // {int_int,int_float,float_int,float_float} are aribtrary types. (not metafunctions) - // - // According to the value of 'IntFloatMixture', selects the corresponding type. - // - template - struct for_int_float_mixture - { - typedef typename - ct_switch4::type - type ; - } ; - -} } } // namespace boost::numeric::convdetail - -#endif -// -/////////////////////////////////////////////////////////////////////////////////////////////// - - diff --git a/libraries/boost/include/boost/numeric/conversion/detail/is_subranged.hpp b/libraries/boost/include/boost/numeric/conversion/detail/is_subranged.hpp deleted file mode 100644 index b5e7fe8f1e..0000000000 --- a/libraries/boost/include/boost/numeric/conversion/detail/is_subranged.hpp +++ /dev/null @@ -1,234 +0,0 @@ -// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/numeric/conversion -// -// Contact the author at: fernando_cacciola@hotmail.com -// -#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_IS_SUBRANGED_FLC_12NOV2002_HPP -#define BOOST_NUMERIC_CONVERSION_DETAIL_IS_SUBRANGED_FLC_12NOV2002_HPP - -#include "boost/config.hpp" -#include "boost/limits.hpp" - -#include "boost/mpl/int.hpp" -#include "boost/mpl/multiplies.hpp" -#include "boost/mpl/less.hpp" -#include "boost/mpl/equal_to.hpp" - -#include "boost/type_traits/is_same.hpp" - -#include "boost/numeric/conversion/detail/meta.hpp" -#include "boost/numeric/conversion/detail/int_float_mixture.hpp" -#include "boost/numeric/conversion/detail/sign_mixture.hpp" -#include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp" - -namespace boost { namespace numeric { namespace convdetail -{ - //--------------------------------------------------------------- - // Implementations of the compile time predicate "T is subranged" - //--------------------------------------------------------------- - - // for integral to integral conversions - template - struct subranged_Sig2Unsig - { - // Signed to unsigned conversions are 'subranged' because of possible loose - // of negative values. - typedef mpl::true_ type ; - } ; - - // for unsigned integral to signed integral conversions - template - struct subranged_Unsig2Sig - { - // IMPORTANT NOTE: - // - // This code assumes that signed/unsigned integral values are represented - // such that: - // - // numeric_limits::digits + 1 == numeric_limits::digits - // - // The '+1' is required since numeric_limits<>::digits gives 1 bit less for signed integral types. - // - // This fact is used by the following logic: - // - // if ( (numeric_limits::digits+1) < (2*numeric_limits::digits) ) - // then the conversion is subranged. - // - - typedef mpl::int_< ::std::numeric_limits::digits > S_digits ; - typedef mpl::int_< ::std::numeric_limits::digits > T_digits ; - - // T is signed, so take digits+1 - typedef typename T_digits::next u_T_digits ; - - typedef mpl::int_<2> Two ; - - typedef typename mpl::multiplies::type S_digits_times_2 ; - - typedef typename mpl::less::type type ; - } ; - - // for integral to integral conversions of the same sign. - template - struct subranged_SameSign - { - // An integral conversion of the same sign is subranged if digits(T) < digits(S). - - typedef mpl::int_< ::std::numeric_limits::digits > S_digits ; - typedef mpl::int_< ::std::numeric_limits::digits > T_digits ; - - typedef typename mpl::less::type type ; - } ; - - // for integral to float conversions - template - struct subranged_Int2Float - { - typedef mpl::false_ type ; - } ; - - // for float to integral conversions - template - struct subranged_Float2Int - { - typedef mpl::true_ type ; - } ; - - // for float to float conversions - template - struct subranged_Float2Float - { - // If both T and S are floats, - // compare exponent bits and if they match, mantisa bits. - - typedef mpl::int_< ::std::numeric_limits::digits > S_mantisa ; - typedef mpl::int_< ::std::numeric_limits::digits > T_mantisa ; - - typedef mpl::int_< ::std::numeric_limits::max_exponent > S_exponent ; - typedef mpl::int_< ::std::numeric_limits::max_exponent > T_exponent ; - - typedef typename mpl::less::type T_smaller_exponent ; - - typedef typename mpl::equal_to::type equal_exponents ; - - typedef mpl::less T_smaller_mantisa ; - - typedef mpl::eval_if not_bigger_exponent_case ; - - typedef typename - mpl::eval_if::type - type ; - } ; - - // for Udt to built-in conversions - template - struct subranged_Udt2BuiltIn - { - typedef mpl::true_ type ; - } ; - - // for built-in to Udt conversions - template - struct subranged_BuiltIn2Udt - { - typedef mpl::false_ type ; - } ; - - // for Udt to Udt conversions - template - struct subranged_Udt2Udt - { - typedef mpl::false_ type ; - } ; - - //------------------------------------------------------------------- - // Selectors for the implementations of the subranged predicate - //------------------------------------------------------------------- - - template - struct get_subranged_Int2Int - { - typedef subranged_SameSign Sig2Sig ; - typedef subranged_Sig2Unsig Sig2Unsig ; - typedef subranged_Unsig2Sig Unsig2Sig ; - typedef Sig2Sig Unsig2Unsig ; - - typedef typename get_sign_mixture::type sign_mixture ; - - typedef typename - for_sign_mixture::type - type ; - } ; - - template - struct get_subranged_BuiltIn2BuiltIn - { - typedef get_subranged_Int2Int Int2IntQ ; - - typedef subranged_Int2Float Int2Float ; - typedef subranged_Float2Int Float2Int ; - typedef subranged_Float2Float Float2Float ; - - typedef mpl::identity Int2FloatQ ; - typedef mpl::identity Float2IntQ ; - typedef mpl::identity Float2FloatQ ; - - typedef typename get_int_float_mixture::type int_float_mixture ; - - typedef for_int_float_mixture for_ ; - - typedef typename for_::type selected ; - - typedef typename selected::type type ; - } ; - - template - struct get_subranged - { - typedef get_subranged_BuiltIn2BuiltIn BuiltIn2BuiltInQ ; - - typedef subranged_BuiltIn2Udt BuiltIn2Udt ; - typedef subranged_Udt2BuiltIn Udt2BuiltIn ; - typedef subranged_Udt2Udt Udt2Udt ; - - typedef mpl::identity BuiltIn2UdtQ ; - typedef mpl::identity Udt2BuiltInQ ; - typedef mpl::identity Udt2UdtQ ; - - typedef typename get_udt_builtin_mixture::type udt_builtin_mixture ; - - typedef typename - for_udt_builtin_mixture::type - selected ; - - typedef typename selected::type selected2 ; - - typedef typename selected2::type type ; - } ; - - - //------------------------------------------------------------------- - // Top level implementation selector. - //------------------------------------------------------------------- - template - struct get_is_subranged - { - typedef get_subranged non_trivial_case ; - typedef mpl::identity trivial_case ; - - typedef is_same is_trivial ; - - typedef typename mpl::if_::type selected ; - - typedef typename selected::type type ; - } ; - -} } } // namespace boost::numeric::convdetail - -#endif - - diff --git a/libraries/boost/include/boost/numeric/conversion/detail/meta.hpp b/libraries/boost/include/boost/numeric/conversion/detail/meta.hpp deleted file mode 100644 index 246a1b4702..0000000000 --- a/libraries/boost/include/boost/numeric/conversion/detail/meta.hpp +++ /dev/null @@ -1,120 +0,0 @@ -// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/numeric/conversion -// -// Contact the author at: fernando_cacciola@hotmail.com -// -#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_META_FLC_12NOV2002_HPP -#define BOOST_NUMERIC_CONVERSION_DETAIL_META_FLC_12NOV2002_HPP - -#include "boost/type_traits/remove_cv.hpp" - -#include "boost/mpl/if.hpp" -#include "boost/mpl/eval_if.hpp" -#include "boost/mpl/equal_to.hpp" -#include "boost/mpl/not.hpp" -#include "boost/mpl/and.hpp" -#include "boost/mpl/bool.hpp" -#include "boost/mpl/identity.hpp" - -namespace boost { namespace numeric { namespace convdetail -{ - template< class T1, class T2> - struct equal_to - { - #if !defined(__BORLANDC__) - - enum { x = ( BOOST_MPL_AUX_VALUE_WKND(T1)::value == BOOST_MPL_AUX_VALUE_WKND(T2)::value ) }; - - BOOST_STATIC_CONSTANT(bool, value = x); - - typedef mpl::bool_ type; - - #else - - BOOST_STATIC_CONSTANT(bool, value = ( - BOOST_MPL_AUX_VALUE_WKND(T1)::value - == BOOST_MPL_AUX_VALUE_WKND(T2)::value - )); - - typedef mpl::bool_<( - BOOST_MPL_AUX_VALUE_WKND(T1)::value - == BOOST_MPL_AUX_VALUE_WKND(T2)::value - )> type; - #endif - }; - -// Metafunction: - // - // ct_switch4::type - // - // {Value,Case(X)Val} are Integral Constants (such as: mpl::int_<>) - // {Case(X)Type,DefaultType} are arbitrary types. (not metafunctions) - // - // Returns Case(X)Type if Val==Case(X)Val; DefaultType otherwise. - // - template - struct ct_switch4 - { - typedef mpl::identity Case0TypeQ ; - typedef mpl::identity Case1TypeQ ; - - typedef equal_to is_case0 ; - typedef equal_to is_case1 ; - typedef equal_to is_case2 ; - - typedef mpl::if_ choose_2_3Q ; - typedef mpl::eval_if choose_1_2_3Q ; - - typedef typename - mpl::eval_if::type - type ; - } ; - - - - - // Metafunction: - // - // for_both::type - // - // {exp0,expr1} are Boolean Integral Constants - // {TT,TF,FT,FF} are aribtrary types. (not metafunctions) - // - // According to the combined boolean value of 'expr0 && expr1', selects the corresponding type. - // - template - struct for_both - { - typedef mpl::identity TF_Q ; - typedef mpl::identity TT_Q ; - - typedef typename mpl::not_::type not_expr0 ; - typedef typename mpl::not_::type not_expr1 ; - - typedef typename mpl::and_::type caseTT ; - typedef typename mpl::and_::type caseTF ; - typedef typename mpl::and_::type caseFT ; - - typedef mpl::if_ choose_FT_FF_Q ; - typedef mpl::eval_if choose_TF_FT_FF_Q ; - - typedef typename mpl::eval_if::type type ; - } ; - -} } } // namespace boost::numeric::convdetail - -#endif - - diff --git a/libraries/boost/include/boost/numeric/conversion/detail/sign_mixture.hpp b/libraries/boost/include/boost/numeric/conversion/detail/sign_mixture.hpp deleted file mode 100644 index c7f9e42afe..0000000000 --- a/libraries/boost/include/boost/numeric/conversion/detail/sign_mixture.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/numeric/conversion -// -// Contact the author at: fernando_cacciola@hotmail.com -// -#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_SIGN_MIXTURE_FLC_12NOV2002_HPP -#define BOOST_NUMERIC_CONVERSION_DETAIL_SIGN_MIXTURE_FLC_12NOV2002_HPP - -#include "boost/config.hpp" -#include "boost/limits.hpp" - -#include "boost/numeric/conversion/sign_mixture_enum.hpp" -#include "boost/numeric/conversion/detail/meta.hpp" - -#include "boost/mpl/integral_c.hpp" - -namespace boost { namespace numeric { namespace convdetail -{ - // Integral Constants for 'SignMixture' - typedef mpl::integral_c unsig2unsig_c ; - typedef mpl::integral_c sig2sig_c ; - typedef mpl::integral_c sig2unsig_c ; - typedef mpl::integral_c unsig2sig_c ; - - // Metafunction: - // - // get_sign_mixture::type - // - // Selects the appropriate SignMixture Integral Constant for the combination T,S. - // - template - struct get_sign_mixture - { - typedef mpl::bool_< ::std::numeric_limits::is_signed > S_signed ; - typedef mpl::bool_< ::std::numeric_limits::is_signed > T_signed ; - - typedef typename - for_both::type - type ; - } ; - - // Metafunction: - // - // for_sign_mixture::type - // - // {SignMixture} is one of the Integral Constants for SignMixture, declared above. - // {Sig2Sig,Sig2Unsig,Unsig2Sig,Unsig2Unsig} are aribtrary types. (not metafunctions) - // - // According to the value of 'SignMixture', selects the corresponding type. - // - template - struct for_sign_mixture - { - typedef typename - ct_switch4::type - type ; - } ; - -} } } // namespace boost::numeric::convdetail - -#endif -// -/////////////////////////////////////////////////////////////////////////////////////////////// - - diff --git a/libraries/boost/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp b/libraries/boost/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp deleted file mode 100644 index 36dbc491b5..0000000000 --- a/libraries/boost/include/boost/numeric/conversion/detail/udt_builtin_mixture.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/numeric/conversion -// -// Contact the author at: fernando_cacciola@hotmail.com -// -#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP -#define BOOST_NUMERIC_CONVERSION_DETAIL_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP - -#include "boost/type_traits/is_arithmetic.hpp" - -#include "boost/numeric/conversion/udt_builtin_mixture_enum.hpp" -#include "boost/numeric/conversion/detail/meta.hpp" - -#include "boost/mpl/integral_c.hpp" - -namespace boost { namespace numeric { namespace convdetail -{ - // Integral Constants for 'UdtMixture' - typedef mpl::integral_c builtin2builtin_c ; - typedef mpl::integral_c builtin2udt_c ; - typedef mpl::integral_c udt2builtin_c ; - typedef mpl::integral_c udt2udt_c ; - - // Metafunction: - // - // for_udt_mixture::type - // - // {UdtMixture} is one of the Integral Constants for UdMixture, declared above. - // {BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt} are aribtrary types. (not metafunctions) - // - // According to the value of 'UdtMixture', selects the corresponding type. - // - template - struct for_udt_builtin_mixture - { - typedef typename - ct_switch4::type - type ; - } ; - - // Metafunction: - // - // get_udt_mixture::type - // - // Selects the appropriate UdtMixture Integral Constant for the combination T,S. - // - template - struct get_udt_builtin_mixture - { - typedef is_arithmetic S_builtin ; - typedef is_arithmetic T_builtin ; - - typedef typename - for_both::type - type ; - } ; - -} } } // namespace boost::numeric::convdetail - -#endif - - diff --git a/libraries/boost/include/boost/numeric/conversion/int_float_mixture_enum.hpp b/libraries/boost/include/boost/numeric/conversion/int_float_mixture_enum.hpp deleted file mode 100644 index d0c2daacfc..0000000000 --- a/libraries/boost/include/boost/numeric/conversion/int_float_mixture_enum.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/numeric/conversion -// -// Contact the author at: fernando_cacciola@hotmail.com -// -#ifndef BOOST_NUMERIC_CONVERSION_INT_FLOAT_MIXTURE_ENUM_FLC_12NOV2002_HPP -#define BOOST_NUMERIC_CONVERSION_INT_FLOAT_MIXTURE_ENUM_FLC_12NOV2002_HPP - -namespace boost { namespace numeric -{ - enum int_float_mixture_enum - { - integral_to_integral - ,integral_to_float - ,float_to_integral - ,float_to_float - } ; - -} } // namespace boost::numeric - -#endif -// -/////////////////////////////////////////////////////////////////////////////////////////////// - - diff --git a/libraries/boost/include/boost/numeric/conversion/sign_mixture_enum.hpp b/libraries/boost/include/boost/numeric/conversion/sign_mixture_enum.hpp deleted file mode 100644 index 1525f8d33c..0000000000 --- a/libraries/boost/include/boost/numeric/conversion/sign_mixture_enum.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/numeric/conversion -// -// Contact the author at: fernando_cacciola@hotmail.com -// -#ifndef BOOST_NUMERIC_CONVERSION_SIGN_MIXTURE_ENUM_FLC_12NOV2002_HPP -#define BOOST_NUMERIC_CONVERSION_SIGN_MIXTURE_ENUM_FLC_12NOV2002_HPP - -namespace boost { namespace numeric -{ - enum sign_mixture_enum - { - unsigned_to_unsigned - ,signed_to_signed - ,signed_to_unsigned - ,unsigned_to_signed - } ; - -} } // namespace boost::numeric - -#endif -// -/////////////////////////////////////////////////////////////////////////////////////////////// - - diff --git a/libraries/boost/include/boost/numeric/conversion/udt_builtin_mixture_enum.hpp b/libraries/boost/include/boost/numeric/conversion/udt_builtin_mixture_enum.hpp deleted file mode 100644 index 2540e80630..0000000000 --- a/libraries/boost/include/boost/numeric/conversion/udt_builtin_mixture_enum.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004 -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/numeric/conversion -// -// Contact the author at: fernando_cacciola@hotmail.com -// -#ifndef BOOST_NUMERIC_CONVERSION_UDT_BUILTIN_MIXTURE_ENUM_FLC_12NOV2002_HPP -#define BOOST_NUMERIC_CONVERSION_UDT_BUILTIN_MIXTURE_ENUM_FLC_12NOV2002_HPP - -namespace boost { namespace numeric -{ - enum udt_builtin_mixture_enum - { - builtin_to_builtin - ,builtin_to_udt - ,udt_to_builtin - ,udt_to_udt - } ; - -} } // namespace boost::numeric - -#endif - diff --git a/libraries/boost/include/boost/optional.hpp b/libraries/boost/include/boost/optional.hpp deleted file mode 100644 index 40cf12e656..0000000000 --- a/libraries/boost/include/boost/optional.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2003, Fernando Luis Cacciola Carballal. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// fernando_cacciola@hotmail.com -// -#ifndef BOOST_OPTIONAL_FLC_19NOV2002_HPP -#define BOOST_OPTIONAL_FLC_19NOV2002_HPP - -#include "boost/optional/optional.hpp" - -#endif - diff --git a/libraries/boost/include/boost/optional/bad_optional_access.hpp b/libraries/boost/include/boost/optional/bad_optional_access.hpp deleted file mode 100644 index cabf43fbac..0000000000 --- a/libraries/boost/include/boost/optional/bad_optional_access.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2014, Andrzej Krzemienski. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// akrzemi1@gmail.com -// -#ifndef BOOST_BAD_OPTIONAL_ACCESS_22MAY2014_HPP -#define BOOST_BAD_OPTIONAL_ACCESS_22MAY2014_HPP - -#include -#if __cplusplus < 201103L -#include // to make converting-ctor std::string(char const*) visible -#endif - -namespace boost { - -class bad_optional_access : public std::logic_error -{ -public: - bad_optional_access() - : std::logic_error("Attempted to access the value of an uninitialized optional object.") - {} -}; - -} // namespace boost - -#endif diff --git a/libraries/boost/include/boost/optional/detail/old_optional_implementation.hpp b/libraries/boost/include/boost/optional/detail/old_optional_implementation.hpp deleted file mode 100644 index 62c31eeceb..0000000000 --- a/libraries/boost/include/boost/optional/detail/old_optional_implementation.hpp +++ /dev/null @@ -1,1059 +0,0 @@ -// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. -// Copyright (C) 2014-2016 Andrzej Krzemienski. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the maintainer at: -// akrzemi1@gmail.com - -#ifndef BOOST_OPTIONAL_DETAIL_OLD_OPTIONAL_IMPLEMENTATION_AJK_28JAN2015_HPP -#define BOOST_OPTIONAL_DETAIL_OLD_OPTIONAL_IMPLEMENTATION_AJK_28JAN2015_HPP - -#include -#include -#include -#include -#include - -namespace boost { - -namespace optional_detail { - - -template -struct types_when_isnt_ref -{ - typedef T const& reference_const_type ; - typedef T & reference_type ; -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - typedef T && rval_reference_type ; - typedef T && reference_type_of_temporary_wrapper; -#ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES - // GCC 4.4 has support for an early draft of rvalue references. The conforming version below - // causes warnings about returning references to a temporary. - static T&& move(T&& r) { return r; } -#else - static rval_reference_type move(reference_type r) { return boost::move(r); } -#endif -#endif - typedef T const* pointer_const_type ; - typedef T * pointer_type ; - typedef T const& argument_type ; -} ; - -template -struct types_when_is_ref -{ - typedef BOOST_DEDUCED_TYPENAME remove_reference::type raw_type ; - - typedef raw_type& reference_const_type ; - typedef raw_type& reference_type ; -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - typedef BOOST_DEDUCED_TYPENAME remove_const::type&& rval_reference_type ; - typedef raw_type& reference_type_of_temporary_wrapper; - static reference_type move(reference_type r) { return r; } -#endif - typedef raw_type* pointer_const_type ; - typedef raw_type* pointer_type ; - typedef raw_type& argument_type ; -} ; - -template -void prevent_binding_rvalue_ref_to_optional_lvalue_ref() -{ -#ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES - BOOST_STATIC_ASSERT_MSG( - !boost::is_lvalue_reference::value || !boost::is_rvalue_reference::value, - "binding rvalue references to optional lvalue references is disallowed"); -#endif -} - -struct optional_tag {} ; - -template -class optional_base : public optional_tag -{ - private : - - typedef -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - BOOST_DEDUCED_TYPENAME -#endif - ::boost::detail::make_reference_content::type internal_type ; - - typedef aligned_storage storage_type ; - - typedef types_when_isnt_ref types_when_not_ref ; - typedef types_when_is_ref types_when_ref ; - - typedef optional_base this_type ; - - protected : - - typedef T value_type ; - - typedef mpl::true_ is_reference_tag ; - typedef mpl::false_ is_not_reference_tag ; - - typedef BOOST_DEDUCED_TYPENAME is_reference::type is_reference_predicate ; - - public: - typedef BOOST_DEDUCED_TYPENAME mpl::if_::type types ; - - protected: - typedef BOOST_DEDUCED_TYPENAME types::reference_type reference_type ; - typedef BOOST_DEDUCED_TYPENAME types::reference_const_type reference_const_type ; -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - typedef BOOST_DEDUCED_TYPENAME types::rval_reference_type rval_reference_type ; - typedef BOOST_DEDUCED_TYPENAME types::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ; -#endif - typedef BOOST_DEDUCED_TYPENAME types::pointer_type pointer_type ; - typedef BOOST_DEDUCED_TYPENAME types::pointer_const_type pointer_const_type ; - typedef BOOST_DEDUCED_TYPENAME types::argument_type argument_type ; - - // Creates an optional uninitialized. - // No-throw - optional_base() - : - m_initialized(false) {} - - // Creates an optional uninitialized. - // No-throw - optional_base ( none_t ) - : - m_initialized(false) {} - - // Creates an optional initialized with 'val'. - // Can throw if T::T(T const&) does - optional_base ( argument_type val ) - : - m_initialized(false) - { - construct(val); - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // move-construct an optional initialized from an rvalue-ref to 'val'. - // Can throw if T::T(T&&) does - optional_base ( rval_reference_type val ) - : - m_initialized(false) - { - construct( boost::move(val) ); - } -#endif - - // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. - // Can throw if T::T(T const&) does - optional_base ( bool cond, argument_type val ) - : - m_initialized(false) - { - if ( cond ) - construct(val); - } - - // Creates a deep copy of another optional - // Can throw if T::T(T const&) does - optional_base ( optional_base const& rhs ) - : - m_initialized(false) - { - if ( rhs.is_initialized() ) - construct(rhs.get_impl()); - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Creates a deep move of another optional - // Can throw if T::T(T&&) does - optional_base ( optional_base&& rhs ) - : - m_initialized(false) - { - if ( rhs.is_initialized() ) - construct( boost::move(rhs.get_impl()) ); - } -#endif - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - - template - explicit optional_base ( Expr&& expr, PtrExpr const* tag ) - : - m_initialized(false) - { - construct(boost::forward(expr),tag); - } - -#else - // This is used for both converting and in-place constructions. - // Derived classes use the 'tag' to select the appropriate - // implementation (the correct 'construct()' overload) - template - explicit optional_base ( Expr const& expr, Expr const* tag ) - : - m_initialized(false) - { - construct(expr,tag); - } - -#endif - - - // No-throw (assuming T::~T() doesn't) - ~optional_base() { destroy() ; } - - // Assigns from another optional (deep-copies the rhs value) - void assign ( optional_base const& rhs ) - { - if (is_initialized()) - { - if ( rhs.is_initialized() ) - assign_value(rhs.get_impl(), is_reference_predicate() ); - else destroy(); - } - else - { - if ( rhs.is_initialized() ) - construct(rhs.get_impl()); - } - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Assigns from another optional (deep-moves the rhs value) - void assign ( optional_base&& rhs ) - { - if (is_initialized()) - { - if ( rhs.is_initialized() ) - assign_value(boost::move(rhs.get_impl()), is_reference_predicate() ); - else destroy(); - } - else - { - if ( rhs.is_initialized() ) - construct(boost::move(rhs.get_impl())); - } - } -#endif - - // Assigns from another _convertible_ optional (deep-copies the rhs value) - template - void assign ( optional const& rhs ) - { - if (is_initialized()) - { - if ( rhs.is_initialized() ) -#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES - assign_value(rhs.get(), is_reference_predicate() ); -#else - assign_value(static_cast(rhs.get()), is_reference_predicate() ); -#endif - - else destroy(); - } - else - { - if ( rhs.is_initialized() ) -#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES - construct(rhs.get()); -#else - construct(static_cast(rhs.get())); -#endif - } - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // move-assigns from another _convertible_ optional (deep-moves from the rhs value) - template - void assign ( optional&& rhs ) - { - typedef BOOST_DEDUCED_TYPENAME optional::rval_reference_type ref_type; - if (is_initialized()) - { - if ( rhs.is_initialized() ) - assign_value(static_cast(rhs.get()), is_reference_predicate() ); - else destroy(); - } - else - { - if ( rhs.is_initialized() ) - construct(static_cast(rhs.get())); - } - } -#endif - - // Assigns from a T (deep-copies the rhs value) - void assign ( argument_type val ) - { - if (is_initialized()) - assign_value(val, is_reference_predicate() ); - else construct(val); - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Assigns from a T (deep-moves the rhs value) - void assign ( rval_reference_type val ) - { - if (is_initialized()) - assign_value( boost::move(val), is_reference_predicate() ); - else construct( boost::move(val) ); - } -#endif - - // Assigns from "none", destroying the current value, if any, leaving this UNINITIALIZED - // No-throw (assuming T::~T() doesn't) - void assign ( none_t ) BOOST_NOEXCEPT { destroy(); } - -#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - template - void assign_expr ( Expr&& expr, ExprPtr const* tag ) - { - if (is_initialized()) - assign_expr_to_initialized(boost::forward(expr),tag); - else construct(boost::forward(expr),tag); - } -#else - template - void assign_expr ( Expr const& expr, Expr const* tag ) - { - if (is_initialized()) - assign_expr_to_initialized(expr,tag); - else construct(expr,tag); - } -#endif - -#endif - - public : - - // **DEPPRECATED** Destroys the current value, if any, leaving this UNINITIALIZED - // No-throw (assuming T::~T() doesn't) - void reset() BOOST_NOEXCEPT { destroy(); } - - // **DEPPRECATED** Replaces the current value -if any- with 'val' - void reset ( argument_type val ) { assign(val); } - - // Returns a pointer to the value if this is initialized, otherwise, - // returns NULL. - // No-throw - pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; } - pointer_type get_ptr() { return m_initialized ? get_ptr_impl() : 0 ; } - - bool is_initialized() const { return m_initialized ; } - - protected : - - void construct ( argument_type val ) - { - ::new (m_storage.address()) internal_type(val) ; - m_initialized = true ; - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - void construct ( rval_reference_type val ) - { - ::new (m_storage.address()) internal_type( types::move(val) ) ; - m_initialized = true ; - } -#endif - - -#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) - // Constructs in-place - // upon exception *this is always uninitialized - template - void emplace_assign ( Args&&... args ) - { - destroy(); - ::new (m_storage.address()) internal_type( boost::forward(args)... ); - m_initialized = true ; - } -#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) - template - void emplace_assign ( Arg&& arg ) - { - destroy(); - ::new (m_storage.address()) internal_type( boost::forward(arg) ); - m_initialized = true ; - } - - void emplace_assign () - { - destroy(); - ::new (m_storage.address()) internal_type(); - m_initialized = true ; - } -#else - template - void emplace_assign ( const Arg& arg ) - { - destroy(); - ::new (m_storage.address()) internal_type( arg ); - m_initialized = true ; - } - - template - void emplace_assign ( Arg& arg ) - { - destroy(); - ::new (m_storage.address()) internal_type( arg ); - m_initialized = true ; - } - - void emplace_assign () - { - destroy(); - ::new (m_storage.address()) internal_type(); - m_initialized = true ; - } -#endif - -#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Constructs in-place using the given factory - template - void construct ( Expr&& factory, in_place_factory_base const* ) - { - BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; - boost_optional_detail::construct(factory, m_storage.address()); - m_initialized = true ; - } - - // Constructs in-place using the given typed factory - template - void construct ( Expr&& factory, typed_in_place_factory_base const* ) - { - BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; - factory.apply(m_storage.address()) ; - m_initialized = true ; - } - - template - void assign_expr_to_initialized ( Expr&& factory, in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } - - // Constructs in-place using the given typed factory - template - void assign_expr_to_initialized ( Expr&& factory, typed_in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } - -#else - // Constructs in-place using the given factory - template - void construct ( Expr const& factory, in_place_factory_base const* ) - { - BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; - boost_optional_detail::construct(factory, m_storage.address()); - m_initialized = true ; - } - - // Constructs in-place using the given typed factory - template - void construct ( Expr const& factory, typed_in_place_factory_base const* ) - { - BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; - factory.apply(m_storage.address()) ; - m_initialized = true ; - } - - template - void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } - - // Constructs in-place using the given typed factory - template - void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } -#endif - -#endif - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Constructs using any expression implicitly convertible to the single argument - // of a one-argument T constructor. - // Converting constructions of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting constructor of T from U. - template - void construct ( Expr&& expr, void const* ) - { - new (m_storage.address()) internal_type(boost::forward(expr)) ; - m_initialized = true ; - } - - // Assigns using a form any expression implicitly convertible to the single argument - // of a T's assignment operator. - // Converting assignments of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting assignment of T from U. - template - void assign_expr_to_initialized ( Expr&& expr, void const* ) - { - assign_value(boost::forward(expr), is_reference_predicate()); - } -#else - // Constructs using any expression implicitly convertible to the single argument - // of a one-argument T constructor. - // Converting constructions of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting constructor of T from U. - template - void construct ( Expr const& expr, void const* ) - { - new (m_storage.address()) internal_type(expr) ; - m_initialized = true ; - } - - // Assigns using a form any expression implicitly convertible to the single argument - // of a T's assignment operator. - // Converting assignments of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting assignment of T from U. - template - void assign_expr_to_initialized ( Expr const& expr, void const* ) - { - assign_value(expr, is_reference_predicate()); - } - -#endif - -#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION - // BCB5.64 (and probably lower versions) workaround. - // The in-place factories are supported by means of catch-all constructors - // and assignment operators (the functions are parameterized in terms of - // an arbitrary 'Expr' type) - // This compiler incorrectly resolves the overload set and sinks optional and optional - // to the 'Expr'-taking functions even though explicit overloads are present for them. - // Thus, the following overload is needed to properly handle the case when the 'lhs' - // is another optional. - // - // For VC<=70 compilers this workaround dosen't work becasue the comnpiler issues and error - // instead of choosing the wrong overload - // -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Notice that 'Expr' will be optional or optional (but not optional_base<..>) - template - void construct ( Expr&& expr, optional_tag const* ) - { - if ( expr.is_initialized() ) - { - // An exception can be thrown here. - // It it happens, THIS will be left uninitialized. - new (m_storage.address()) internal_type(types::move(expr.get())) ; - m_initialized = true ; - } - } -#else - // Notice that 'Expr' will be optional or optional (but not optional_base<..>) - template - void construct ( Expr const& expr, optional_tag const* ) - { - if ( expr.is_initialized() ) - { - // An exception can be thrown here. - // It it happens, THIS will be left uninitialized. - new (m_storage.address()) internal_type(expr.get()) ; - m_initialized = true ; - } - } -#endif -#endif // defined BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION - - void assign_value ( argument_type val, is_not_reference_tag ) { get_impl() = val; } - void assign_value ( argument_type val, is_reference_tag ) { construct(val); } -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - void assign_value ( rval_reference_type val, is_not_reference_tag ) { get_impl() = static_cast(val); } - void assign_value ( rval_reference_type val, is_reference_tag ) { construct( static_cast(val) ); } -#endif - - void destroy() - { - if ( m_initialized ) - destroy_impl(is_reference_predicate()) ; - } - - reference_const_type get_impl() const { return dereference(get_object(), is_reference_predicate() ) ; } - reference_type get_impl() { return dereference(get_object(), is_reference_predicate() ) ; } - - pointer_const_type get_ptr_impl() const { return cast_ptr(get_object(), is_reference_predicate() ) ; } - pointer_type get_ptr_impl() { return cast_ptr(get_object(), is_reference_predicate() ) ; } - - private : - - // internal_type can be either T or reference_content -#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) - // This workaround is supposed to silence GCC warnings about broken strict aliasing rules - internal_type const* get_object() const - { - union { void const* ap_pvoid; internal_type const* as_ptype; } caster = { m_storage.address() }; - return caster.as_ptype; - } - internal_type * get_object() - { - union { void* ap_pvoid; internal_type* as_ptype; } caster = { m_storage.address() }; - return caster.as_ptype; - } -#else - internal_type const* get_object() const { return static_cast(m_storage.address()); } - internal_type * get_object() { return static_cast (m_storage.address()); } -#endif - - // reference_content lacks an implicit conversion to T&, so the following is needed to obtain a proper reference. - reference_const_type dereference( internal_type const* p, is_not_reference_tag ) const { return *p ; } - reference_type dereference( internal_type* p, is_not_reference_tag ) { return *p ; } - reference_const_type dereference( internal_type const* p, is_reference_tag ) const { return p->get() ; } - reference_type dereference( internal_type* p, is_reference_tag ) { return p->get() ; } - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581)) - void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->internal_type::~internal_type() ; m_initialized = false ; } -#else - void destroy_impl ( is_not_reference_tag ) { get_ptr_impl()->~T() ; m_initialized = false ; } -#endif - - void destroy_impl ( is_reference_tag ) { m_initialized = false ; } - - // If T is of reference type, trying to get a pointer to the held value must result in a compile-time error. - // Decent compilers should disallow conversions from reference_content* to T*, but just in case, - // the following olverloads are used to filter out the case and guarantee an error in case of T being a reference. - pointer_const_type cast_ptr( internal_type const* p, is_not_reference_tag ) const { return p ; } - pointer_type cast_ptr( internal_type * p, is_not_reference_tag ) { return p ; } - pointer_const_type cast_ptr( internal_type const* p, is_reference_tag ) const { return &p->get() ; } - pointer_type cast_ptr( internal_type * p, is_reference_tag ) { return &p->get() ; } - - bool m_initialized ; - storage_type m_storage ; -} ; - -} // namespace optional_detail - -template -class optional : public optional_detail::optional_base -{ - typedef optional_detail::optional_base base ; - - public : - - typedef optional this_type ; - - typedef BOOST_DEDUCED_TYPENAME base::value_type value_type ; - typedef BOOST_DEDUCED_TYPENAME base::reference_type reference_type ; - typedef BOOST_DEDUCED_TYPENAME base::reference_const_type reference_const_type ; -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - typedef BOOST_DEDUCED_TYPENAME base::rval_reference_type rval_reference_type ; - typedef BOOST_DEDUCED_TYPENAME base::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ; -#endif - typedef BOOST_DEDUCED_TYPENAME base::pointer_type pointer_type ; - typedef BOOST_DEDUCED_TYPENAME base::pointer_const_type pointer_const_type ; - typedef BOOST_DEDUCED_TYPENAME base::argument_type argument_type ; - - // Creates an optional uninitialized. - // No-throw - optional() BOOST_NOEXCEPT : base() {} - - // Creates an optional uninitialized. - // No-throw - optional( none_t none_ ) BOOST_NOEXCEPT : base(none_) {} - - // Creates an optional initialized with 'val'. - // Can throw if T::T(T const&) does - optional ( argument_type val ) : base(val) {} - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Creates an optional initialized with 'move(val)'. - // Can throw if T::T(T &&) does - optional ( rval_reference_type val ) : base( boost::forward(val) ) - {optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref();} -#endif - - // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. - // Can throw if T::T(T const&) does - optional ( bool cond, argument_type val ) : base(cond,val) {} - - // NOTE: MSVC needs templated versions first - - // Creates a deep copy of another convertible optional - // Requires a valid conversion from U to T. - // Can throw if T::T(U const&) does - template - explicit optional ( optional const& rhs ) - : - base() - { - if ( rhs.is_initialized() ) - this->construct(rhs.get()); - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Creates a deep move of another convertible optional - // Requires a valid conversion from U to T. - // Can throw if T::T(U&&) does - template - explicit optional ( optional && rhs ) - : - base() - { - if ( rhs.is_initialized() ) - this->construct( boost::move(rhs.get()) ); - } -#endif - -#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT - // Creates an optional with an expression which can be either - // (a) An instance of InPlaceFactory (i.e. in_place(a,b,...,n); - // (b) An instance of TypedInPlaceFactory ( i.e. in_place(a,b,...,n); - // (c) Any expression implicitly convertible to the single type - // of a one-argument T's constructor. - // (d*) Weak compilers (BCB) might also resolved Expr as optional and optional - // even though explicit overloads are present for these. - // Depending on the above some T ctor is called. - // Can throw if the resolved T ctor throws. -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - - - template - explicit optional ( Expr&& expr, - BOOST_DEDUCED_TYPENAME boost::disable_if_c< - (boost::is_base_of::type>::value) || - boost::is_same::type, none_t>::value, bool >::type = true - ) - : base(boost::forward(expr),boost::addressof(expr)) - {optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref();} - -#else - template - explicit optional ( Expr const& expr ) : base(expr,boost::addressof(expr)) {} -#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES -#endif // !defined BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT - - // Creates a deep copy of another optional - // Can throw if T::T(T const&) does - optional ( optional const& rhs ) : base( static_cast(rhs) ) {} - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Creates a deep move of another optional - // Can throw if T::T(T&&) does - optional ( optional && rhs ) - BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value) - : base( boost::move(rhs) ) - {} - -#endif - // No-throw (assuming T::~T() doesn't) - ~optional() {} - -#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) - // Assigns from an expression. See corresponding constructor. - // Basic Guarantee: If the resolved T ctor throws, this is left UNINITIALIZED -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - - template - BOOST_DEDUCED_TYPENAME boost::disable_if_c< - boost::is_base_of::type>::value || - boost::is_same::type, none_t>::value, - optional& - >::type - operator= ( Expr&& expr ) - { - optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref(); - this->assign_expr(boost::forward(expr),boost::addressof(expr)); - return *this ; - } - -#else - template - optional& operator= ( Expr const& expr ) - { - this->assign_expr(expr,boost::addressof(expr)); - return *this ; - } -#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES -#endif // !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) - - // Copy-assigns from another convertible optional (converts && deep-copies the rhs value) - // Requires a valid conversion from U to T. - // Basic Guarantee: If T::T( U const& ) throws, this is left UNINITIALIZED - template - optional& operator= ( optional const& rhs ) - { - this->assign(rhs); - return *this ; - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Move-assigns from another convertible optional (converts && deep-moves the rhs value) - // Requires a valid conversion from U to T. - // Basic Guarantee: If T::T( U && ) throws, this is left UNINITIALIZED - template - optional& operator= ( optional && rhs ) - { - this->assign(boost::move(rhs)); - return *this ; - } -#endif - - // Assigns from another optional (deep-copies the rhs value) - // Basic Guarantee: If T::T( T const& ) throws, this is left UNINITIALIZED - // (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw) - optional& operator= ( optional const& rhs ) - { - this->assign( static_cast(rhs) ) ; - return *this ; - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Assigns from another optional (deep-moves the rhs value) - optional& operator= ( optional && rhs ) - BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) - { - this->assign( static_cast(rhs) ) ; - return *this ; - } -#endif - - // Assigns from a T (deep-copies the rhs value) - // Basic Guarantee: If T::( T const& ) throws, this is left UNINITIALIZED - optional& operator= ( argument_type val ) - { - this->assign( val ) ; - return *this ; - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Assigns from a T (deep-moves the rhs value) - optional& operator= ( rval_reference_type val ) - { - optional_detail::prevent_binding_rvalue_ref_to_optional_lvalue_ref(); - this->assign( boost::move(val) ) ; - return *this ; - } -#endif - - // Assigns from a "none" - // Which destroys the current value, if any, leaving this UNINITIALIZED - // No-throw (assuming T::~T() doesn't) - optional& operator= ( none_t none_ ) BOOST_NOEXCEPT - { - this->assign( none_ ) ; - return *this ; - } - -#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) - // Constructs in-place - // upon exception *this is always uninitialized - template - void emplace ( Args&&... args ) - { - this->emplace_assign( boost::forward(args)... ); - } -#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) - template - void emplace ( Arg&& arg ) - { - this->emplace_assign( boost::forward(arg) ); - } - - void emplace () - { - this->emplace_assign(); - } -#else - template - void emplace ( const Arg& arg ) - { - this->emplace_assign( arg ); - } - - template - void emplace ( Arg& arg ) - { - this->emplace_assign( arg ); - } - - void emplace () - { - this->emplace_assign(); - } -#endif - - void swap( optional & arg ) - BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) - { - // allow for Koenig lookup - boost::swap(*this, arg); - } - - - // Returns a reference to the value if this is initialized, otherwise, - // the behaviour is UNDEFINED - // No-throw - reference_const_type get() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } - reference_type get() { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } - - // Returns a copy of the value if this is initialized, 'v' otherwise - reference_const_type get_value_or ( reference_const_type v ) const { return this->is_initialized() ? get() : v ; } - reference_type get_value_or ( reference_type v ) { return this->is_initialized() ? get() : v ; } - - // Returns a pointer to the value if this is initialized, otherwise, - // the behaviour is UNDEFINED - // No-throw - pointer_const_type operator->() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } - pointer_type operator->() { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } - - // Returns a reference to the value if this is initialized, otherwise, - // the behaviour is UNDEFINED - // No-throw -#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) - reference_const_type operator *() const& { return this->get() ; } - reference_type operator *() & { return this->get() ; } - reference_type_of_temporary_wrapper operator *() && { return base::types::move(this->get()) ; } -#else - reference_const_type operator *() const { return this->get() ; } - reference_type operator *() { return this->get() ; } -#endif // !defined BOOST_NO_CXX11_REF_QUALIFIERS - -#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) - reference_const_type value() const& - { - if (this->is_initialized()) - return this->get() ; - else - throw_exception(bad_optional_access()); - } - - reference_type value() & - { - if (this->is_initialized()) - return this->get() ; - else - throw_exception(bad_optional_access()); - } - - reference_type_of_temporary_wrapper value() && - { - if (this->is_initialized()) - return base::types::move(this->get()) ; - else - throw_exception(bad_optional_access()); - } - -#else - reference_const_type value() const - { - if (this->is_initialized()) - return this->get() ; - else - throw_exception(bad_optional_access()); - } - - reference_type value() - { - if (this->is_initialized()) - return this->get() ; - else - throw_exception(bad_optional_access()); - } -#endif - - -#ifndef BOOST_NO_CXX11_REF_QUALIFIERS - template - value_type value_or ( U&& v ) const& - { - if (this->is_initialized()) - return get(); - else - return boost::forward(v); - } - - template - value_type value_or ( U&& v ) && - { - if (this->is_initialized()) - return base::types::move(get()); - else - return boost::forward(v); - } -#elif !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - template - value_type value_or ( U&& v ) const - { - if (this->is_initialized()) - return get(); - else - return boost::forward(v); - } -#else - template - value_type value_or ( U const& v ) const - { - if (this->is_initialized()) - return get(); - else - return v; - } - - template - value_type value_or ( U& v ) const - { - if (this->is_initialized()) - return get(); - else - return v; - } -#endif - - -#ifndef BOOST_NO_CXX11_REF_QUALIFIERS - template - value_type value_or_eval ( F f ) const& - { - if (this->is_initialized()) - return get(); - else - return f(); - } - - template - value_type value_or_eval ( F f ) && - { - if (this->is_initialized()) - return base::types::move(get()); - else - return f(); - } -#else - template - value_type value_or_eval ( F f ) const - { - if (this->is_initialized()) - return get(); - else - return f(); - } -#endif - - bool operator!() const BOOST_NOEXCEPT { return !this->is_initialized() ; } - - BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() -} ; - -} // namespace boost - - -#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_aligned_storage.hpp b/libraries/boost/include/boost/optional/detail/optional_aligned_storage.hpp deleted file mode 100644 index 2937349f52..0000000000 --- a/libraries/boost/include/boost/optional/detail/optional_aligned_storage.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. -// Copyright (C) 2016 Andrzej Krzemienski. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// fernando_cacciola@hotmail.com -// akrzemi1@gmail.com - -#ifndef BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_ALIGNED_STORAGE_AJK_12FEB2016_HPP -#define BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_ALIGNED_STORAGE_AJK_12FEB2016_HPP - -namespace boost { - -namespace optional_detail { -// This local class is used instead of that in "aligned_storage.hpp" -// because I've found the 'official' class to ICE BCB5.5 -// when some types are used with optional<> -// (due to sizeof() passed down as a non-type template parameter) -template -class aligned_storage -{ - // Borland ICEs if unnamed unions are used for this! - // BOOST_MAY_ALIAS works around GCC warnings about breaking strict aliasing rules when casting storage address to T* - union BOOST_MAY_ALIAS dummy_u - { - char data[ sizeof(T) ]; - BOOST_DEDUCED_TYPENAME type_with_alignment< - ::boost::alignment_of::value >::type aligner_; - } dummy_ ; - - public: - -#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) - void const* address() const { return &dummy_; } - void * address() { return &dummy_; } -#else - void const* address() const { return dummy_.data; } - void * address() { return dummy_.data; } -#endif - -#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS) - // This workaround is supposed to silence GCC warnings about broken strict aliasing rules - T const* ptr_ref() const - { - union { void const* ap_pvoid; T const* as_ptype; } caster = { address() }; - return caster.as_ptype; - } - T * ptr_ref() - { - union { void* ap_pvoid; T* as_ptype; } caster = { address() }; - return caster.as_ptype; - } -#else - T const* ptr_ref() const { return static_cast(address()); } - T * ptr_ref() { return static_cast (address()); } -#endif - - T const& ref() const { return *ptr_ref(); } - T & ref() { return *ptr_ref(); } - -} ; - -} // namespace optional_detail -} // namespace boost - -#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_config.hpp b/libraries/boost/include/boost/optional/detail/optional_config.hpp deleted file mode 100644 index bb7e12f9fc..0000000000 --- a/libraries/boost/include/boost/optional/detail/optional_config.hpp +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. -// Copyright (C) 2015 - 2017 Andrzej Krzemienski. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// akrzemi1@gmail.com - -#ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_CONFIG_AJK_28JAN2015_HPP -#define BOOST_OPTIONAL_DETAIL_OPTIONAL_CONFIG_AJK_28JAN2015_HPP - -#include -#include - -#if (defined BOOST_NO_CXX11_RVALUE_REFERENCES) || (defined BOOST_OPTIONAL_CONFIG_NO_RVALUE_REFERENCES) -# define BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES -#endif - -#if BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION,<=700) -// AFAICT only Intel 7 correctly resolves the overload set -// that includes the in-place factory taking functions, -// so for the other icc versions, in-place factory support -// is disabled -# define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT -#endif - -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551) -// BCB (5.5.1) cannot parse the nested template struct in an inplace factory. -# define BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT -#endif - -#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) \ - && defined BOOST_BCB_PARTIAL_SPECIALIZATION_BUG -// BCB (up to 5.64) has the following bug: -// If there is a member function/operator template of the form -// template mfunc( Expr expr ) ; -// some calls are resolved to this even if there are other better matches. -// The effect of this bug is that calls to converting ctors and assignments -// are incorrectly sink to this general catch-all member function template as shown above. -# define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION -#endif - -#if !defined(BOOST_NO_MAY_ALIAS) -// GCC since 3.3 and some other compilers have may_alias attribute that helps to alleviate -// optimizer issues with regard to violation of the strict aliasing rules. The optional< T > -// storage type is marked with this attribute in order to let the compiler know that it will -// alias objects of type T and silence compilation warnings. -# define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS -#endif - -#if (defined(_MSC_VER) && _MSC_VER <= 1800) -// on MSCV 2013 and earlier an unwanted temporary is created when you assign from -// a const lvalue of integral type. Thus we bind not to the original address but -// to a temporary. -# define BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT -#endif - -#if (defined __GNUC__) && (!defined BOOST_INTEL_CXX_VERSION) && (!defined __clang__) -// On some GCC versions an unwanted temporary is created when you copy-initialize -// from a const lvalue of integral type. Thus we bind not to the original address but -// to a temporary. - -# if (__GNUC__ < 4) -# define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT -# endif - -# if (__GNUC__ == 4 && __GNUC_MINOR__ <= 5) -# define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT -# endif - -# if (__GNUC__ == 5 && __GNUC_MINOR__ < 2) -# define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT -# endif - -# if (__GNUC__ == 5 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ == 0) -# define BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT -# endif - -#endif // defined(__GNUC__) - -#if (defined __GNUC__) && (!defined BOOST_NO_CXX11_RVALUE_REFERENCES) -// On some initial rvalue reference implementations GCC does it in a strange way, -// preferring perfect-forwarding constructor to implicit copy constructor. - -# if (__GNUC__ == 4 && __GNUC_MINOR__ == 4) -# define BOOST_OPTIONAL_CONFIG_NO_LEGAL_CONVERT_FROM_REF -# endif - -# if (__GNUC__ == 4 && __GNUC_MINOR__ == 5) -# define BOOST_OPTIONAL_CONFIG_NO_LEGAL_CONVERT_FROM_REF -# endif - -#endif // defined(__GNUC__) - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500) && !defined(__SUNPRO_CC) - // this condition is a copy paste from is_constructible.hpp - // I also disable SUNPRO, as it seems not to support type_traits correctly -#else -# define BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT -#endif - -#if defined __SUNPRO_CC -# define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS -#elif (defined _MSC_FULL_VER) && (_MSC_FULL_VER < 190023026) -# define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS -#elif defined BOOST_GCC && !defined BOOST_GCC_CXX11 -# define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS -#elif defined BOOST_GCC_VERSION && BOOST_GCC_VERSION < 40800 -# define BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS -#endif - - -// Detect suport for defaulting move operations -// (some older compilers implement rvalue references, -// defaulted funcitons but move operations are not special members and cannot be defaulted) - -#ifdef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS -# define BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS -#elif BOOST_WORKAROUND(BOOST_MSVC, < 1900) -# define BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS -#elif BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40600) -# define BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS -#endif - - -#ifdef BOOST_OPTIONAL_CONFIG_NO_DIRECT_STORAGE_SPEC -# define BOOST_OPTIONAL_DETAIL_NO_DIRECT_STORAGE_SPEC -#endif - - -#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_factory_support.hpp b/libraries/boost/include/boost/optional/detail/optional_factory_support.hpp deleted file mode 100644 index efff92a503..0000000000 --- a/libraries/boost/include/boost/optional/detail/optional_factory_support.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. -// Copyright (C) 2016 Andrzej Krzemienski. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// fernando_cacciola@hotmail.com -// akrzemi1@gmail.com - -#ifndef BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_FACTORY_SUPPORT_AJK_12FEB2016_HPP -#define BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_FACTORY_SUPPORT_AJK_12FEB2016_HPP - -// Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply<> -// member template of a factory as used in the optional<> implementation. -// He proposed this simple fix which is to move the call to apply<> outside -// namespace boost. -namespace boost_optional_detail -{ - template - inline void construct(Factory const& factory, void* address) - { - factory.BOOST_NESTED_TEMPLATE apply(address); - } -} - -namespace boost -{ - class in_place_factory_base ; - class typed_in_place_factory_base ; -} - -#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_reference_spec.hpp b/libraries/boost/include/boost/optional/detail/optional_reference_spec.hpp deleted file mode 100644 index 012e91a66c..0000000000 --- a/libraries/boost/include/boost/optional/detail/optional_reference_spec.hpp +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (C) 2015-2016 Andrzej Krzemienski. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// akrzemi1@gmail.com - -#ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_REFERENCE_SPEC_AJK_03OCT2015_HPP -#define BOOST_OPTIONAL_DETAIL_OPTIONAL_REFERENCE_SPEC_AJK_03OCT2015_HPP - -#ifdef BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT -#include -#include -#endif - -# if 1 - -namespace boost { - -namespace detail { - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - -template -void prevent_binding_rvalue() -{ -#ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES - BOOST_STATIC_ASSERT_MSG(boost::is_lvalue_reference::value, - "binding rvalue references to optional lvalue references is disallowed"); -#endif -} - -template -BOOST_DEDUCED_TYPENAME boost::remove_reference::type& forward_reference(T&& r) -{ - BOOST_STATIC_ASSERT_MSG(boost::is_lvalue_reference::value, - "binding rvalue references to optional lvalue references is disallowed"); - return boost::forward(r); -} - -#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - - -template -struct is_const_integral -{ - static const bool value = boost::is_const::value && boost::is_integral::value; -}; - -template -struct is_const_integral_bad_for_conversion -{ -#if (!defined BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES) && (defined BOOST_OPTIONAL_CONFIG_NO_PROPER_CONVERT_FROM_CONST_INT) - static const bool value = boost::is_const::value && boost::is_integral::value; -#else - static const bool value = false; -#endif -}; - -template -void prevent_assignment_from_false_const_integral() -{ -#ifndef BOOST_OPTIONAL_CONFIG_ALLOW_BINDING_TO_RVALUES -#ifdef BOOST_OPTIONAL_CONFIG_NO_PROPER_ASSIGN_FROM_CONST_INT - // MSVC compiler without rvalue refernces: we need to disable the asignment from - // const integral lvalue reference, as it may be an invalid temporary - BOOST_STATIC_ASSERT_MSG(!is_const_integral::value, - "binding const lvalue references to integral types is disabled in this compiler"); -#endif -#endif -} - - -template -struct is_optional_ -{ - static const bool value = false; -}; - -template -struct is_optional_< ::boost::optional > -{ - static const bool value = true; -}; - -template -struct is_no_optional -{ - static const bool value = !is_optional_::type>::value; -}; - - -template - struct is_same_decayed - { - static const bool value = ::boost::is_same::type>::value - || ::boost::is_same::type>::value; - }; - -template -struct no_unboxing_cond -{ - static const bool value = is_no_optional::value && !is_same_decayed::value; -}; - - -} // namespace detail - -template -class optional : public optional_detail::optional_tag -{ - T* ptr_; - -public: - typedef T& value_type; - typedef T& reference_type; - typedef T& reference_const_type; - typedef T& rval_reference_type; - typedef T* pointer_type; - typedef T* pointer_const_type; - - optional() BOOST_NOEXCEPT : ptr_() {} - optional(none_t) BOOST_NOEXCEPT : ptr_() {} - - template - explicit optional(const optional& rhs) BOOST_NOEXCEPT : ptr_(rhs.get_ptr()) {} - optional(const optional& rhs) BOOST_NOEXCEPT : ptr_(rhs.get_ptr()) {} - - // the following two implement a 'conditionally explicit' constructor: condition is a hack for buggy compilers with srewed conversion construction from const int - template - explicit optional(U& rhs, BOOST_DEDUCED_TYPENAME boost::enable_if_c::value && detail::is_const_integral_bad_for_conversion::value, bool>::type = true) BOOST_NOEXCEPT - : ptr_(boost::addressof(rhs)) {} - - template - optional(U& rhs, BOOST_DEDUCED_TYPENAME boost::enable_if_c::value && !detail::is_const_integral_bad_for_conversion::value, bool>::type = true) BOOST_NOEXCEPT - : ptr_(boost::addressof(rhs)) {} - - optional& operator=(const optional& rhs) BOOST_NOEXCEPT { ptr_ = rhs.get_ptr(); return *this; } - template - optional& operator=(const optional& rhs) BOOST_NOEXCEPT { ptr_ = rhs.get_ptr(); return *this; } - optional& operator=(none_t) BOOST_NOEXCEPT { ptr_ = 0; return *this; } - - - void swap(optional& rhs) BOOST_NOEXCEPT { std::swap(ptr_, rhs.ptr_); } - T& get() const { BOOST_ASSERT(ptr_); return *ptr_; } - - T* get_ptr() const BOOST_NOEXCEPT { return ptr_; } - T* operator->() const { BOOST_ASSERT(ptr_); return ptr_; } - T& operator*() const { BOOST_ASSERT(ptr_); return *ptr_; } - T& value() const { return ptr_ ? *ptr_ : (throw_exception(bad_optional_access()), *ptr_); } - - bool operator!() const BOOST_NOEXCEPT { return ptr_ == 0; } - BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() - - void reset() BOOST_NOEXCEPT { ptr_ = 0; } - - bool is_initialized() const BOOST_NOEXCEPT { return ptr_ != 0; } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - - optional(T&& /* rhs */) BOOST_NOEXCEPT { detail::prevent_binding_rvalue(); } - - template - optional(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT - : ptr_(boost::addressof(r)) { detail::prevent_binding_rvalue(); } - - template - optional(bool cond, R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT - : ptr_(cond ? boost::addressof(r) : 0) { detail::prevent_binding_rvalue(); } - - template - BOOST_DEDUCED_TYPENAME boost::enable_if, optional&>::type - operator=(R&& r) BOOST_NOEXCEPT { detail::prevent_binding_rvalue(); ptr_ = boost::addressof(r); return *this; } - - template - void emplace(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT - { detail::prevent_binding_rvalue(); ptr_ = boost::addressof(r); } - - template - T& get_value_or(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) const BOOST_NOEXCEPT - { detail::prevent_binding_rvalue(); return ptr_ ? *ptr_ : r; } - - template - T& value_or(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) const BOOST_NOEXCEPT - { detail::prevent_binding_rvalue(); return ptr_ ? *ptr_ : r; } - - template - void reset(R&& r, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT - { detail::prevent_binding_rvalue(); ptr_ = boost::addressof(r); } - - template - T& value_or_eval(F f) const { return ptr_ ? *ptr_ : detail::forward_reference(f()); } - -#else // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - - - // the following two implement a 'conditionally explicit' constructor - template - explicit optional(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if_c::value && detail::is_const_integral_bad_for_conversion::value, bool>::type = true) BOOST_NOEXCEPT - : ptr_(boost::addressof(v)) { } - - template - optional(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if_c::value && !detail::is_const_integral_bad_for_conversion::value, bool>::type = true) BOOST_NOEXCEPT - : ptr_(boost::addressof(v)) { } - - template - optional(bool cond, U& v, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT : ptr_(cond ? boost::addressof(v) : 0) {} - - template - BOOST_DEDUCED_TYPENAME boost::enable_if, optional&>::type - operator=(U& v) BOOST_NOEXCEPT - { - detail::prevent_assignment_from_false_const_integral(); - ptr_ = boost::addressof(v); return *this; - } - - template - void emplace(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT - { ptr_ = boost::addressof(v); } - - template - T& get_value_or(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) const BOOST_NOEXCEPT - { return ptr_ ? *ptr_ : v; } - - template - T& value_or(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) const BOOST_NOEXCEPT - { return ptr_ ? *ptr_ : v; } - - template - void reset(U& v, BOOST_DEDUCED_TYPENAME boost::enable_if, bool>::type = true) BOOST_NOEXCEPT - { ptr_ = boost::addressof(v); } - - template - T& value_or_eval(F f) const { return ptr_ ? *ptr_ : f(); } - -#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES -}; - -template - void swap ( optional& x, optional& y) BOOST_NOEXCEPT -{ - x.swap(y); -} - -} // namespace boost - -#endif // 1/0 - -#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_relops.hpp b/libraries/boost/include/boost/optional/detail/optional_relops.hpp deleted file mode 100644 index 2c17f2b727..0000000000 --- a/libraries/boost/include/boost/optional/detail/optional_relops.hpp +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. -// Copyright (C) 2015 Andrzej Krzemienski. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// akrzemi1@gmail.com - -#ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_RELOPS_AJK_03OCT2015_HPP -#define BOOST_OPTIONAL_DETAIL_OPTIONAL_RELOPS_AJK_03OCT2015_HPP - -namespace boost { - -// optional's relational operators ( ==, !=, <, >, <=, >= ) have deep-semantics (compare values). -// WARNING: This is UNLIKE pointers. Use equal_pointees()/less_pointess() in generic code instead. - - -// -// optional vs optional cases -// - -template -inline -bool operator == ( optional const& x, optional const& y ) -{ return bool(x) && bool(y) ? *x == *y : bool(x) == bool(y); } - -template -inline -bool operator < ( optional const& x, optional const& y ) -{ return less_pointees(x,y); } - -template -inline -bool operator != ( optional const& x, optional const& y ) -{ return !( x == y ) ; } - -template -inline -bool operator > ( optional const& x, optional const& y ) -{ return y < x ; } - -template -inline -bool operator <= ( optional const& x, optional const& y ) -{ return !( y < x ) ; } - -template -inline -bool operator >= ( optional const& x, optional const& y ) -{ return !( x < y ) ; } - - -// -// optional vs T cases -// -template -inline -bool operator == ( optional const& x, T const& y ) -{ return equal_pointees(x, optional(y)); } - -template -inline -bool operator < ( optional const& x, T const& y ) -{ return less_pointees(x, optional(y)); } - -template -inline -bool operator != ( optional const& x, T const& y ) -{ return !( x == y ) ; } - -template -inline -bool operator > ( optional const& x, T const& y ) -{ return y < x ; } - -template -inline -bool operator <= ( optional const& x, T const& y ) -{ return !( y < x ) ; } - -template -inline -bool operator >= ( optional const& x, T const& y ) -{ return !( x < y ) ; } - -// -// T vs optional cases -// - -template -inline -bool operator == ( T const& x, optional const& y ) -{ return equal_pointees( optional(x), y ); } - -template -inline -bool operator < ( T const& x, optional const& y ) -{ return less_pointees( optional(x), y ); } - -template -inline -bool operator != ( T const& x, optional const& y ) -{ return !( x == y ) ; } - -template -inline -bool operator > ( T const& x, optional const& y ) -{ return y < x ; } - -template -inline -bool operator <= ( T const& x, optional const& y ) -{ return !( y < x ) ; } - -template -inline -bool operator >= ( T const& x, optional const& y ) -{ return !( x < y ) ; } - - -// -// optional vs none cases -// - -template -inline -bool operator == ( optional const& x, none_t ) BOOST_NOEXCEPT -{ return !x; } - -template -inline -bool operator < ( optional const& x, none_t ) -{ return less_pointees(x,optional() ); } - -template -inline -bool operator != ( optional const& x, none_t ) BOOST_NOEXCEPT -{ return bool(x); } - -template -inline -bool operator > ( optional const& x, none_t y ) -{ return y < x ; } - -template -inline -bool operator <= ( optional const& x, none_t y ) -{ return !( y < x ) ; } - -template -inline -bool operator >= ( optional const& x, none_t y ) -{ return !( x < y ) ; } - -// -// none vs optional cases -// - -template -inline -bool operator == ( none_t , optional const& y ) BOOST_NOEXCEPT -{ return !y; } - -template -inline -bool operator < ( none_t , optional const& y ) -{ return less_pointees(optional() ,y); } - -template -inline -bool operator != ( none_t, optional const& y ) BOOST_NOEXCEPT -{ return bool(y); } - -template -inline -bool operator > ( none_t x, optional const& y ) -{ return y < x ; } - -template -inline -bool operator <= ( none_t x, optional const& y ) -{ return !( y < x ) ; } - -template -inline -bool operator >= ( none_t x, optional const& y ) -{ return !( x < y ) ; } - -} // namespace boost - -#endif // header guard - diff --git a/libraries/boost/include/boost/optional/detail/optional_swap.hpp b/libraries/boost/include/boost/optional/detail/optional_swap.hpp deleted file mode 100644 index 2a7059e701..0000000000 --- a/libraries/boost/include/boost/optional/detail/optional_swap.hpp +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. -// Copyright (C) 2015 Andrzej Krzemienski. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// akrzemi1@gmail.com - -#ifndef BOOST_OPTIONAL_DETAIL_OPTIONAL_SWAP_AJK_28JAN2015_HPP -#define BOOST_OPTIONAL_DETAIL_OPTIONAL_SWAP_AJK_28JAN2015_HPP - -#include -#include - -namespace boost { - -namespace optional_detail { - -template struct swap_selector; - -template <> -struct swap_selector -{ - template - static void optional_swap ( optional& x, optional& y ) - { - const bool hasX = !!x; - const bool hasY = !!y; - - if ( !hasX && !hasY ) - return; - - if( !hasX ) - x.emplace(); - else if ( !hasY ) - y.emplace(); - - // Boost.Utility.Swap will take care of ADL and workarounds for broken compilers - boost::swap(x.get(), y.get()); - - if( !hasX ) - y = boost::none ; - else if( !hasY ) - x = boost::none ; - } -}; - -#ifdef BOOST_OPTIONAL_DETAIL_MOVE -# undef BOOST_OPTIONAL_DETAIL_MOVE -#endif - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES -# define BOOST_OPTIONAL_DETAIL_MOVE(EXPR_) boost::move(EXPR_) -#else -# define BOOST_OPTIONAL_DETAIL_MOVE(EXPR_) EXPR_ -#endif - -template <> -struct swap_selector -{ - template - static void optional_swap ( optional& x, optional& y ) - //BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && BOOST_NOEXCEPT_EXPR(boost::swap(*x, *y))) - { - if (x) - { - if (y) - { - boost::swap(*x, *y); - } - else - { - y = BOOST_OPTIONAL_DETAIL_MOVE(*x); - x = boost::none; - } - } - else - { - if (y) - { - x = BOOST_OPTIONAL_DETAIL_MOVE(*y); - y = boost::none; - } - } - } -}; - -} // namespace optional_detail - -#if (!defined BOOST_NO_CXX11_RVALUE_REFERENCES) && (!defined BOOST_CONFIG_RESTORE_OBSOLETE_SWAP_IMPLEMENTATION) - -template -struct optional_swap_should_use_default_constructor : boost::false_type {} ; - -#else - -template -struct optional_swap_should_use_default_constructor : has_nothrow_default_constructor {} ; - -#endif - -template -inline void swap ( optional& x, optional& y ) -//BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && BOOST_NOEXCEPT_EXPR(boost::swap(*x, *y))) -{ - optional_detail::swap_selector::value>::optional_swap(x, y); -} - -} // namespace boost - -#undef BOOST_OPTIONAL_DETAIL_MOVE - -#endif // header guard diff --git a/libraries/boost/include/boost/optional/detail/optional_trivially_copyable_base.hpp b/libraries/boost/include/boost/optional/detail/optional_trivially_copyable_base.hpp deleted file mode 100644 index 91328ac4e7..0000000000 --- a/libraries/boost/include/boost/optional/detail/optional_trivially_copyable_base.hpp +++ /dev/null @@ -1,499 +0,0 @@ -// trivilally-copyable version of the storage - -template -class tc_optional_base : public optional_tag -{ - private : - - typedef tc_optional_base this_type ; - - protected : - - typedef T value_type ; - - protected: - typedef T & reference_type ; - typedef T const& reference_const_type ; -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - typedef T && rval_reference_type ; - typedef T && reference_type_of_temporary_wrapper ; -#endif - typedef T * pointer_type ; - typedef T const* pointer_const_type ; - typedef T const& argument_type ; - - tc_optional_base() - : - m_initialized(false) {} - - tc_optional_base ( none_t ) - : - m_initialized(false) {} - - tc_optional_base ( argument_type val ) - : - m_initialized(true), m_storage(val) {} - - tc_optional_base ( bool cond, argument_type val ) - : - m_initialized(cond), m_storage(val) {} - - // tc_optional_base ( tc_optional_base const& ) = default; - - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - - template - explicit tc_optional_base ( Expr&& expr, PtrExpr const* tag ) - : - m_initialized(false) - { - construct(boost::forward(expr),tag); - } - -#else - // This is used for both converting and in-place constructions. - // Derived classes use the 'tag' to select the appropriate - // implementation (the correct 'construct()' overload) - template - explicit tc_optional_base ( Expr const& expr, Expr const* tag ) - : - m_initialized(false) - { - construct(expr,tag); - } - -#endif - - // tc_optional_base& operator= ( tc_optional_base const& ) = default; - // ~tc_optional_base() = default; - - // Assigns from another optional (deep-copies the rhs value) - void assign ( tc_optional_base const& rhs ) - { - this->operator=(rhs); - } - - // Assigns from another _convertible_ optional (deep-copies the rhs value) - template - void assign ( optional const& rhs ) - { - if ( rhs.is_initialized() ) -#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES - m_storage = rhs.get(); -#else - m_storage = static_cast(rhs.get()); -#endif - - m_initialized = rhs.is_initialized(); - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // move-assigns from another _convertible_ optional (deep-moves from the rhs value) - template - void assign ( optional&& rhs ) - { - typedef BOOST_DEDUCED_TYPENAME optional::rval_reference_type ref_type; - if ( rhs.is_initialized() ) - m_storage = static_cast(rhs.get()); - m_initialized = rhs.is_initialized(); - } -#endif - - void assign ( argument_type val ) - { - construct(val); - } - - void assign ( none_t ) { destroy(); } - -#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - template - void assign_expr ( Expr&& expr, ExprPtr const* tag ) - { - construct(boost::forward(expr),tag); - } -#else - template - void assign_expr ( Expr const& expr, Expr const* tag ) - { - construct(expr,tag); - } -#endif - -#endif - - public : - - // **DEPPRECATED** Destroys the current value, if any, leaving this UNINITIALIZED - // No-throw (assuming T::~T() doesn't) - void reset() BOOST_NOEXCEPT { destroy(); } - - // **DEPPRECATED** Replaces the current value -if any- with 'val' - void reset ( argument_type val ) BOOST_NOEXCEPT { assign(val); } - - // Returns a pointer to the value if this is initialized, otherwise, - // returns NULL. - // No-throw - pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; } - pointer_type get_ptr() { return m_initialized ? get_ptr_impl() : 0 ; } - - bool is_initialized() const { return m_initialized ; } - - protected : - - void construct ( argument_type val ) - { - m_storage = val ; - m_initialized = true ; - } - - -#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) - // Constructs in-place - // upon exception *this is always uninitialized - template - void construct ( in_place_init_t, Args&&... args ) - { - m_storage = value_type( boost::forward(args)... ) ; - m_initialized = true ; - } - - template - void emplace_assign ( Args&&... args ) - { - construct(in_place_init, boost::forward(args)...); - } - - template - explicit tc_optional_base ( in_place_init_t, Args&&... args ) - : - m_initialized(false) - { - construct(in_place_init, boost::forward(args)...); - } - - template - explicit tc_optional_base ( in_place_init_if_t, bool cond, Args&&... args ) - : - m_initialized(false) - { - if ( cond ) - construct(in_place_init, boost::forward(args)...); - } -#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) - template - void construct ( in_place_init_t, Arg&& arg ) - { - m_storage = value_type( boost::forward(arg) ); - m_initialized = true ; - } - - void construct ( in_place_init_t ) - { - m_storage = value_type(); - m_initialized = true ; - } - - template - void emplace_assign ( Arg&& arg ) - { - construct(in_place_init, boost::forward(arg)) ; - } - - void emplace_assign () - { - construct(in_place_init) ; - } - - template - explicit tc_optional_base ( in_place_init_t, Arg&& arg ) - : - m_initialized(false) - { - construct(in_place_init, boost::forward(arg)); - } - - explicit tc_optional_base ( in_place_init_t ) - : - m_initialized(false), m_storage() {} - - template - explicit tc_optional_base ( in_place_init_if_t, bool cond, Arg&& arg ) - : - m_initialized(false) - { - if ( cond ) - construct(in_place_init, boost::forward(arg)); - } - - explicit tc_optional_base ( in_place_init_if_t, bool cond ) - : - m_initialized(false) - { - if ( cond ) - construct(in_place_init); - } - -#else - - template - void construct ( in_place_init_t, const Arg& arg ) - { - m_storage = value_type( arg ); - m_initialized = true ; - } - - template - void construct ( in_place_init_t, Arg& arg ) - { - m_storage = value_type( arg ); - m_initialized = true ; - } - - void construct ( in_place_init_t ) - { - m_storage = value_type(); - m_initialized = true ; - } - - template - void emplace_assign ( const Arg& arg ) - { - construct(in_place_init, arg); - } - - template - void emplace_assign ( Arg& arg ) - { - construct(in_place_init, arg); - } - - void emplace_assign () - { - construct(in_place_init); - } - - template - explicit tc_optional_base ( in_place_init_t, const Arg& arg ) - : m_initialized(false) - { - construct(in_place_init, arg); - } - - template - explicit tc_optional_base ( in_place_init_t, Arg& arg ) - : m_initialized(false) - { - construct(in_place_init, arg); - } - - explicit tc_optional_base ( in_place_init_t ) - : m_initialized(false) - { - construct(in_place_init); - } - - template - explicit tc_optional_base ( in_place_init_if_t, bool cond, const Arg& arg ) - : m_initialized(false) - { - if ( cond ) - construct(in_place_init, arg); - } - - template - explicit tc_optional_base ( in_place_init_if_t, bool cond, Arg& arg ) - : m_initialized(false) - { - if ( cond ) - construct(in_place_init, arg); - } - - explicit tc_optional_base ( in_place_init_if_t, bool cond ) - : m_initialized(false) - { - if ( cond ) - construct(in_place_init); - } -#endif - -#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Constructs in-place using the given factory - template - void construct ( Expr&& factory, in_place_factory_base const* ) - { - boost_optional_detail::construct(factory, boost::addressof(m_storage)); - m_initialized = true ; - } - - // Constructs in-place using the given typed factory - template - void construct ( Expr&& factory, typed_in_place_factory_base const* ) - { - factory.apply(boost::addressof(m_storage)) ; - m_initialized = true ; - } - - template - void assign_expr_to_initialized ( Expr&& factory, in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } - - // Constructs in-place using the given typed factory - template - void assign_expr_to_initialized ( Expr&& factory, typed_in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } - -#else - // Constructs in-place using the given factory - template - void construct ( Expr const& factory, in_place_factory_base const* ) - { - boost_optional_detail::construct(factory, m_storage.address()); - m_initialized = true ; - } - - // Constructs in-place using the given typed factory - template - void construct ( Expr const& factory, typed_in_place_factory_base const* ) - { - factory.apply(boost::addressof(m_storage)) ; - m_initialized = true ; - } - - template - void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } - - // Constructs in-place using the given typed factory - template - void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } -#endif - -#endif - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Constructs using any expression implicitly convertible to the single argument - // of a one-argument T constructor. - // Converting constructions of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting constructor of T from U. - template - void construct ( Expr&& expr, void const* ) - { - m_storage = value_type(boost::forward(expr)) ; - m_initialized = true ; - } - - // Assigns using a form any expression implicitly convertible to the single argument - // of a T's assignment operator. - // Converting assignments of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting assignment of T from U. - template - void assign_expr_to_initialized ( Expr&& expr, void const* ) - { - assign_value( boost::forward(expr) ); - } -#else - // Constructs using any expression implicitly convertible to the single argument - // of a one-argument T constructor. - // Converting constructions of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting constructor of T from U. - template - void construct ( Expr const& expr, void const* ) - { - m_storage = value_type(expr) ; - m_initialized = true ; - } - - // Assigns using a form any expression implicitly convertible to the single argument - // of a T's assignment operator. - // Converting assignments of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting assignment of T from U. - template - void assign_expr_to_initialized ( Expr const& expr, void const* ) - { - assign_value(expr); - } - -#endif - -#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION - // BCB5.64 (and probably lower versions) workaround. - // The in-place factories are supported by means of catch-all constructors - // and assignment operators (the functions are parameterized in terms of - // an arbitrary 'Expr' type) - // This compiler incorrectly resolves the overload set and sinks optional and optional - // to the 'Expr'-taking functions even though explicit overloads are present for them. - // Thus, the following overload is needed to properly handle the case when the 'lhs' - // is another optional. - // - // For VC<=70 compilers this workaround dosen't work becasue the comnpiler issues and error - // instead of choosing the wrong overload - // -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Notice that 'Expr' will be optional or optional (but not tc_optional_base<..>) - template - void construct ( Expr&& expr, optional_tag const* ) - { - if ( expr.is_initialized() ) - { - // An exception can be thrown here. - // It it happens, THIS will be left uninitialized. - m_storage = value_type(boost::move(expr.get())) ; - m_initialized = true ; - } - } -#else - // Notice that 'Expr' will be optional or optional (but not tc_optional_base<..>) - template - void construct ( Expr const& expr, optional_tag const* ) - { - if ( expr.is_initialized() ) - { - // An exception can be thrown here. - // It it happens, THIS will be left uninitialized. - m_storage = value_type(expr.get()) ; - m_initialized = true ; - } - } -#endif -#endif // defined BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION - - void assign_value ( argument_type val ) { m_storage = val; } -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - void assign_value ( rval_reference_type val ) { m_storage = static_cast(val); } -#endif - - void destroy() - { - m_initialized = false; - } - - reference_const_type get_impl() const { return m_storage ; } - reference_type get_impl() { return m_storage ; } - - pointer_const_type get_ptr_impl() const { return boost::addressof(m_storage); } - pointer_type get_ptr_impl() { return boost::addressof(m_storage); } - - private : - - bool m_initialized ; - T m_storage ; -} ; diff --git a/libraries/boost/include/boost/optional/optional.hpp b/libraries/boost/include/boost/optional/optional.hpp deleted file mode 100644 index 74ef49c549..0000000000 --- a/libraries/boost/include/boost/optional/optional.hpp +++ /dev/null @@ -1,1490 +0,0 @@ -// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. -// Copyright (C) 2014 - 2017 Andrzej Krzemienski. -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// fernando_cacciola@hotmail.com -// -// Revisions: -// 27 Apr 2008 (improved swap) Fernando Cacciola, Niels Dekker, Thorsten Ottosen -// 05 May 2014 (Added move semantics) Andrzej Krzemienski -// -#ifndef BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP -#define BOOST_OPTIONAL_OPTIONAL_FLC_19NOV2002_HPP - -#include -#include - -#ifdef BOOST_OPTIONAL_DETAIL_USE_STD_TYPE_TRAITS -# include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifdef BOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL -#include -#else -namespace boost { - -namespace optional_ns { - -// a tag for in-place initialization of contained value -struct in_place_init_t -{ - struct init_tag{}; - explicit in_place_init_t(init_tag){} -}; -const in_place_init_t in_place_init ((in_place_init_t::init_tag())); - -// a tag for conditional in-place initialization of contained value -struct in_place_init_if_t -{ - struct init_tag{}; - explicit in_place_init_if_t(init_tag){} -}; -const in_place_init_if_t in_place_init_if ((in_place_init_if_t::init_tag())); - -} // namespace optional_ns - -using optional_ns::in_place_init_t; -using optional_ns::in_place_init; -using optional_ns::in_place_init_if_t; -using optional_ns::in_place_init_if; - -namespace optional_detail { - -struct optional_tag {} ; - - -template -class optional_base : public optional_tag -{ - private : - - typedef aligned_storage storage_type ; - typedef optional_base this_type ; - - protected : - - typedef T value_type ; - - protected: - typedef T & reference_type ; - typedef T const& reference_const_type ; -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - typedef T && rval_reference_type ; - typedef T && reference_type_of_temporary_wrapper ; -#endif - typedef T * pointer_type ; - typedef T const* pointer_const_type ; - typedef T const& argument_type ; - - // Creates an optional uninitialized. - // No-throw - optional_base() - : - m_initialized(false) {} - - // Creates an optional uninitialized. - // No-throw - optional_base ( none_t ) - : - m_initialized(false) {} - - // Creates an optional initialized with 'val'. - // Can throw if T::T(T const&) does - optional_base ( argument_type val ) - : - m_initialized(false) - { - construct(val); - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // move-construct an optional initialized from an rvalue-ref to 'val'. - // Can throw if T::T(T&&) does - optional_base ( rval_reference_type val ) - : - m_initialized(false) - { - construct( boost::move(val) ); - } -#endif - - // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. - // Can throw if T::T(T const&) does - optional_base ( bool cond, argument_type val ) - : - m_initialized(false) - { - if ( cond ) - construct(val); - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Creates an optional initialized with 'move(val)' IFF cond is true, otherwise creates an uninitialized optional. - // Can throw if T::T(T &&) does - optional_base ( bool cond, rval_reference_type val ) - : - m_initialized(false) - { - if ( cond ) - construct(boost::move(val)); - } -#endif - - // Creates a deep copy of another optional - // Can throw if T::T(T const&) does - optional_base ( optional_base const& rhs ) - : - m_initialized(false) - { - if ( rhs.is_initialized() ) - construct(rhs.get_impl()); - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Creates a deep move of another optional - // Can throw if T::T(T&&) does - optional_base ( optional_base&& rhs ) - BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value) - : - m_initialized(false) - { - if ( rhs.is_initialized() ) - construct( boost::move(rhs.get_impl()) ); - } -#endif - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - - template - explicit optional_base ( Expr&& expr, PtrExpr const* tag ) - : - m_initialized(false) - { - construct(boost::forward(expr),tag); - } - -#else - // This is used for both converting and in-place constructions. - // Derived classes use the 'tag' to select the appropriate - // implementation (the correct 'construct()' overload) - template - explicit optional_base ( Expr const& expr, Expr const* tag ) - : - m_initialized(false) - { - construct(expr,tag); - } - -#endif - - optional_base& operator= ( optional_base const& rhs ) - { - this->assign(rhs); - return *this; - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - optional_base& operator= ( optional_base && rhs ) - BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) - { - this->assign(static_cast(rhs)); - return *this; - } -#endif - - // No-throw (assuming T::~T() doesn't) - ~optional_base() { destroy() ; } - - // Assigns from another optional (deep-copies the rhs value) - void assign ( optional_base const& rhs ) - { - if (is_initialized()) - { - if ( rhs.is_initialized() ) - assign_value(rhs.get_impl()); - else destroy(); - } - else - { - if ( rhs.is_initialized() ) - construct(rhs.get_impl()); - } - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Assigns from another optional (deep-moves the rhs value) - void assign ( optional_base&& rhs ) - { - if (is_initialized()) - { - if ( rhs.is_initialized() ) - assign_value( boost::move(rhs.get_impl()) ); - else destroy(); - } - else - { - if ( rhs.is_initialized() ) - construct(boost::move(rhs.get_impl())); - } - } -#endif - - // Assigns from another _convertible_ optional (deep-copies the rhs value) - template - void assign ( optional const& rhs ) - { - if (is_initialized()) - { - if ( rhs.is_initialized() ) -#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES - assign_value( rhs.get() ); -#else - assign_value( static_cast(rhs.get()) ); -#endif - - else destroy(); - } - else - { - if ( rhs.is_initialized() ) -#ifndef BOOST_OPTIONAL_CONFIG_RESTORE_ASSIGNMENT_OF_NONCONVERTIBLE_TYPES - construct(rhs.get()); -#else - construct(static_cast(rhs.get())); -#endif - } - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // move-assigns from another _convertible_ optional (deep-moves from the rhs value) - template - void assign ( optional&& rhs ) - { - typedef BOOST_DEDUCED_TYPENAME optional::rval_reference_type ref_type; - if (is_initialized()) - { - if ( rhs.is_initialized() ) - assign_value( static_cast(rhs.get()) ); - else destroy(); - } - else - { - if ( rhs.is_initialized() ) - construct(static_cast(rhs.get())); - } - } -#endif - - // Assigns from a T (deep-copies the rhs value) - void assign ( argument_type val ) - { - if (is_initialized()) - assign_value(val); - else construct(val); - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Assigns from a T (deep-moves the rhs value) - void assign ( rval_reference_type val ) - { - if (is_initialized()) - assign_value( boost::move(val) ); - else construct( boost::move(val) ); - } -#endif - - // Assigns from "none", destroying the current value, if any, leaving this UNINITIALIZED - // No-throw (assuming T::~T() doesn't) - void assign ( none_t ) BOOST_NOEXCEPT { destroy(); } - -#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - template - void assign_expr ( Expr&& expr, ExprPtr const* tag ) - { - if (is_initialized()) - assign_expr_to_initialized(boost::forward(expr),tag); - else construct(boost::forward(expr),tag); - } -#else - template - void assign_expr ( Expr const& expr, Expr const* tag ) - { - if (is_initialized()) - assign_expr_to_initialized(expr,tag); - else construct(expr,tag); - } -#endif - -#endif - - public : - - // **DEPPRECATED** Destroys the current value, if any, leaving this UNINITIALIZED - // No-throw (assuming T::~T() doesn't) - void reset() BOOST_NOEXCEPT { destroy(); } - - // **DEPPRECATED** Replaces the current value -if any- with 'val' - void reset ( argument_type val ) { assign(val); } - - // Returns a pointer to the value if this is initialized, otherwise, - // returns NULL. - // No-throw - pointer_const_type get_ptr() const { return m_initialized ? get_ptr_impl() : 0 ; } - pointer_type get_ptr() { return m_initialized ? get_ptr_impl() : 0 ; } - - bool is_initialized() const { return m_initialized ; } - - protected : - - void construct ( argument_type val ) - { - ::new (m_storage.address()) value_type(val) ; - m_initialized = true ; - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - void construct ( rval_reference_type val ) - { - ::new (m_storage.address()) value_type( boost::move(val) ) ; - m_initialized = true ; - } -#endif - - -#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) - // Constructs in-place - // upon exception *this is always uninitialized - template - void construct ( in_place_init_t, Args&&... args ) - { - ::new (m_storage.address()) value_type( boost::forward(args)... ) ; - m_initialized = true ; - } - - template - void emplace_assign ( Args&&... args ) - { - destroy(); - construct(in_place_init, boost::forward(args)...); - } - - template - explicit optional_base ( in_place_init_t, Args&&... args ) - : - m_initialized(false) - { - construct(in_place_init, boost::forward(args)...); - } - - template - explicit optional_base ( in_place_init_if_t, bool cond, Args&&... args ) - : - m_initialized(false) - { - if ( cond ) - construct(in_place_init, boost::forward(args)...); - } -#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) - template - void construct ( in_place_init_t, Arg&& arg ) - { - ::new (m_storage.address()) value_type( boost::forward(arg) ); - m_initialized = true ; - } - - void construct ( in_place_init_t ) - { - ::new (m_storage.address()) value_type(); - m_initialized = true ; - } - - template - void emplace_assign ( Arg&& arg ) - { - destroy(); - construct(in_place_init, boost::forward(arg)) ; - } - - void emplace_assign () - { - destroy(); - construct(in_place_init) ; - } - - template - explicit optional_base ( in_place_init_t, Arg&& arg ) - : - m_initialized(false) - { - construct(in_place_init, boost::forward(arg)); - } - - explicit optional_base ( in_place_init_t ) - : - m_initialized(false) - { - construct(in_place_init); - } - - template - explicit optional_base ( in_place_init_if_t, bool cond, Arg&& arg ) - : - m_initialized(false) - { - if ( cond ) - construct(in_place_init, boost::forward(arg)); - } - - explicit optional_base ( in_place_init_if_t, bool cond ) - : - m_initialized(false) - { - if ( cond ) - construct(in_place_init); - } - -#else - - template - void construct ( in_place_init_t, const Arg& arg ) - { - ::new (m_storage.address()) value_type( arg ); - m_initialized = true ; - } - - template - void construct ( in_place_init_t, Arg& arg ) - { - ::new (m_storage.address()) value_type( arg ); - m_initialized = true ; - } - - void construct ( in_place_init_t ) - { - ::new (m_storage.address()) value_type(); - m_initialized = true ; - } - - template - void emplace_assign ( const Arg& arg ) - { - destroy(); - construct(in_place_init, arg); - } - - template - void emplace_assign ( Arg& arg ) - { - destroy(); - construct(in_place_init, arg); - } - - void emplace_assign () - { - destroy(); - construct(in_place_init); - } - - template - explicit optional_base ( in_place_init_t, const Arg& arg ) - : m_initialized(false) - { - construct(in_place_init, arg); - } - - template - explicit optional_base ( in_place_init_t, Arg& arg ) - : m_initialized(false) - { - construct(in_place_init, arg); - } - - explicit optional_base ( in_place_init_t ) - : m_initialized(false) - { - construct(in_place_init); - } - - template - explicit optional_base ( in_place_init_if_t, bool cond, const Arg& arg ) - : m_initialized(false) - { - if ( cond ) - construct(in_place_init, arg); - } - - template - explicit optional_base ( in_place_init_if_t, bool cond, Arg& arg ) - : m_initialized(false) - { - if ( cond ) - construct(in_place_init, arg); - } - - explicit optional_base ( in_place_init_if_t, bool cond ) - : m_initialized(false) - { - if ( cond ) - construct(in_place_init); - } -#endif - -#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Constructs in-place using the given factory - template - void construct ( Expr&& factory, in_place_factory_base const* ) - { - boost_optional_detail::construct(factory, m_storage.address()); - m_initialized = true ; - } - - // Constructs in-place using the given typed factory - template - void construct ( Expr&& factory, typed_in_place_factory_base const* ) - { - factory.apply(m_storage.address()) ; - m_initialized = true ; - } - - template - void assign_expr_to_initialized ( Expr&& factory, in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } - - // Constructs in-place using the given typed factory - template - void assign_expr_to_initialized ( Expr&& factory, typed_in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } - -#else - // Constructs in-place using the given factory - template - void construct ( Expr const& factory, in_place_factory_base const* ) - { - boost_optional_detail::construct(factory, m_storage.address()); - m_initialized = true ; - } - - // Constructs in-place using the given typed factory - template - void construct ( Expr const& factory, typed_in_place_factory_base const* ) - { - factory.apply(m_storage.address()) ; - m_initialized = true ; - } - - template - void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } - - // Constructs in-place using the given typed factory - template - void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag ) - { - destroy(); - construct(factory,tag); - } -#endif - -#endif - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Constructs using any expression implicitly convertible to the single argument - // of a one-argument T constructor. - // Converting constructions of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting constructor of T from U. - template - void construct ( Expr&& expr, void const* ) - { - new (m_storage.address()) value_type(boost::forward(expr)) ; - m_initialized = true ; - } - - // Assigns using a form any expression implicitly convertible to the single argument - // of a T's assignment operator. - // Converting assignments of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting assignment of T from U. - template - void assign_expr_to_initialized ( Expr&& expr, void const* ) - { - assign_value( boost::forward(expr) ); - } -#else - // Constructs using any expression implicitly convertible to the single argument - // of a one-argument T constructor. - // Converting constructions of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting constructor of T from U. - template - void construct ( Expr const& expr, void const* ) - { - new (m_storage.address()) value_type(expr) ; - m_initialized = true ; - } - - // Assigns using a form any expression implicitly convertible to the single argument - // of a T's assignment operator. - // Converting assignments of optional from optional uses this function with - // 'Expr' being of type 'U' and relying on a converting assignment of T from U. - template - void assign_expr_to_initialized ( Expr const& expr, void const* ) - { - assign_value(expr); - } - -#endif - -#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION - // BCB5.64 (and probably lower versions) workaround. - // The in-place factories are supported by means of catch-all constructors - // and assignment operators (the functions are parameterized in terms of - // an arbitrary 'Expr' type) - // This compiler incorrectly resolves the overload set and sinks optional and optional - // to the 'Expr'-taking functions even though explicit overloads are present for them. - // Thus, the following overload is needed to properly handle the case when the 'lhs' - // is another optional. - // - // For VC<=70 compilers this workaround dosen't work becasue the comnpiler issues and error - // instead of choosing the wrong overload - // -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Notice that 'Expr' will be optional or optional (but not optional_base<..>) - template - void construct ( Expr&& expr, optional_tag const* ) - { - if ( expr.is_initialized() ) - { - // An exception can be thrown here. - // It it happens, THIS will be left uninitialized. - new (m_storage.address()) value_type(boost::move(expr.get())) ; - m_initialized = true ; - } - } -#else - // Notice that 'Expr' will be optional or optional (but not optional_base<..>) - template - void construct ( Expr const& expr, optional_tag const* ) - { - if ( expr.is_initialized() ) - { - // An exception can be thrown here. - // It it happens, THIS will be left uninitialized. - new (m_storage.address()) value_type(expr.get()) ; - m_initialized = true ; - } - } -#endif -#endif // defined BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION - - void assign_value ( argument_type val ) { get_impl() = val; } -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - void assign_value ( rval_reference_type val ) { get_impl() = static_cast(val); } -#endif - - void destroy() - { - if ( m_initialized ) - destroy_impl() ; - } - - reference_const_type get_impl() const { return m_storage.ref() ; } - reference_type get_impl() { return m_storage.ref() ; } - - pointer_const_type get_ptr_impl() const { return m_storage.ptr_ref(); } - pointer_type get_ptr_impl() { return m_storage.ptr_ref(); } - - private : - -#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1900)) - void destroy_impl ( ) { m_storage.ptr_ref()->~T() ; m_initialized = false ; } -#else - void destroy_impl ( ) { m_storage.ref().T::~T() ; m_initialized = false ; } -#endif - - bool m_initialized ; - storage_type m_storage ; -} ; - - - -#include - -// definition of metafunciton is_optional_val_init_candidate -template -struct is_optional_related - : boost::conditional< boost::is_base_of::type>::value - || boost::is_same::type, none_t>::value - || boost::is_same::type, in_place_init_t>::value - || boost::is_same::type, in_place_init_if_t>::value, - boost::true_type, boost::false_type>::type -{}; - -#if !defined(BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT) - -template -struct is_convertible_to_T_or_factory - : boost::conditional< boost::is_base_of::type>::value - || boost::is_base_of::type>::value - || (boost::is_constructible::value && !boost::is_same::type>::value) - , boost::true_type, boost::false_type>::type -{}; - -template -struct is_optional_constructible : boost::is_constructible -{}; - -#else - -template -struct is_convertible_to_T_or_factory : boost::true_type -{}; - -template -struct is_optional_constructible : boost::true_type -{}; - -#endif // is_convertible condition - -template -struct is_optional_val_init_candidate - : boost::conditional< !is_optional_related::value && is_convertible_to_T_or_factory::value - , boost::true_type, boost::false_type>::type -{}; - -} // namespace optional_detail - -namespace optional_config { - -template -struct optional_uses_direct_storage_for - : boost::conditional<(boost::is_scalar::value && !boost::is_const::value && !boost::is_volatile::value) - , boost::true_type, boost::false_type>::type -{}; - -} // namespace optional_config - - -#ifndef BOOST_OPTIONAL_DETAIL_NO_DIRECT_STORAGE_SPEC -# define BOOST_OPTIONAL_BASE_TYPE(T) boost::conditional< optional_config::optional_uses_direct_storage_for::value, \ - optional_detail::tc_optional_base, \ - optional_detail::optional_base \ - >::type -#else -# define BOOST_OPTIONAL_BASE_TYPE(T) optional_detail::optional_base -#endif - -template -class optional - : public BOOST_OPTIONAL_BASE_TYPE(T) -{ - typedef typename BOOST_OPTIONAL_BASE_TYPE(T) base ; - - public : - - typedef optional this_type ; - - typedef BOOST_DEDUCED_TYPENAME base::value_type value_type ; - typedef BOOST_DEDUCED_TYPENAME base::reference_type reference_type ; - typedef BOOST_DEDUCED_TYPENAME base::reference_const_type reference_const_type ; -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - typedef BOOST_DEDUCED_TYPENAME base::rval_reference_type rval_reference_type ; - typedef BOOST_DEDUCED_TYPENAME base::reference_type_of_temporary_wrapper reference_type_of_temporary_wrapper ; -#endif - typedef BOOST_DEDUCED_TYPENAME base::pointer_type pointer_type ; - typedef BOOST_DEDUCED_TYPENAME base::pointer_const_type pointer_const_type ; - typedef BOOST_DEDUCED_TYPENAME base::argument_type argument_type ; - - // Creates an optional uninitialized. - // No-throw - optional() BOOST_NOEXCEPT : base() {} - - // Creates an optional uninitialized. - // No-throw - optional( none_t none_ ) BOOST_NOEXCEPT : base(none_) {} - - // Creates an optional initialized with 'val'. - // Can throw if T::T(T const&) does - optional ( argument_type val ) : base(val) {} - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Creates an optional initialized with 'move(val)'. - // Can throw if T::T(T &&) does - optional ( rval_reference_type val ) : base( boost::forward(val) ) - {} -#endif - - // Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. - // Can throw if T::T(T const&) does - optional ( bool cond, argument_type val ) : base(cond,val) {} - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - /// Creates an optional initialized with 'val' IFF cond is true, otherwise creates an uninitialized optional. - // Can throw if T::T(T &&) does - optional ( bool cond, rval_reference_type val ) : base( cond, boost::forward(val) ) - {} -#endif - - // NOTE: MSVC needs templated versions first - - // Creates a deep copy of another convertible optional - // Requires a valid conversion from U to T. - // Can throw if T::T(U const&) does - template - explicit optional ( optional const& rhs -#ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS - ,BOOST_DEDUCED_TYPENAME boost::enable_if< optional_detail::is_optional_constructible, bool>::type = true -#endif - ) - : - base() - { - if ( rhs.is_initialized() ) - this->construct(rhs.get()); - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Creates a deep move of another convertible optional - // Requires a valid conversion from U to T. - // Can throw if T::T(U&&) does - template - explicit optional ( optional && rhs -#ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS - ,BOOST_DEDUCED_TYPENAME boost::enable_if< optional_detail::is_optional_constructible, bool>::type = true -#endif - ) - : - base() - { - if ( rhs.is_initialized() ) - this->construct( boost::move(rhs.get()) ); - } -#endif - -#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT - // Creates an optional with an expression which can be either - // (a) An instance of InPlaceFactory (i.e. in_place(a,b,...,n); - // (b) An instance of TypedInPlaceFactory ( i.e. in_place(a,b,...,n); - // (c) Any expression implicitly convertible to the single type - // of a one-argument T's constructor. - // (d*) Weak compilers (BCB) might also resolved Expr as optional and optional - // even though explicit overloads are present for these. - // Depending on the above some T ctor is called. - // Can throw if the resolved T ctor throws. -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - - - template - explicit optional ( Expr&& expr, - BOOST_DEDUCED_TYPENAME boost::enable_if< optional_detail::is_optional_val_init_candidate, bool>::type = true - ) - : base(boost::forward(expr),boost::addressof(expr)) - {} - -#else - template - explicit optional ( Expr const& expr ) : base(expr,boost::addressof(expr)) {} -#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES -#endif // !defined BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT - - // Creates a deep copy of another optional - // Can throw if T::T(T const&) does -#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS - optional ( optional const& ) = default; -#else - optional ( optional const& rhs ) : base( static_cast(rhs) ) {} -#endif - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Creates a deep move of another optional - // Can throw if T::T(T&&) does - -#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS - optional ( optional && rhs ) = default; -#else - optional ( optional && rhs ) - BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value) - : base( boost::move(rhs) ) - {} -#endif - -#endif - -#if BOOST_WORKAROUND(_MSC_VER, <= 1600) - // On old MSVC compilers the implicitly declared dtor is not called - ~optional() {} -#endif - - -#if !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) - // Assigns from an expression. See corresponding constructor. - // Basic Guarantee: If the resolved T ctor throws, this is left UNINITIALIZED -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - - template - BOOST_DEDUCED_TYPENAME boost::enable_if, optional&>::type - operator= ( Expr&& expr ) - { - this->assign_expr(boost::forward(expr),boost::addressof(expr)); - return *this ; - } - -#else - template - optional& operator= ( Expr const& expr ) - { - this->assign_expr(expr,boost::addressof(expr)); - return *this ; - } -#endif // !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES -#endif // !defined(BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT) && !defined(BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION) - - // Copy-assigns from another convertible optional (converts && deep-copies the rhs value) - // Requires a valid conversion from U to T. - // Basic Guarantee: If T::T( U const& ) throws, this is left UNINITIALIZED - template - optional& operator= ( optional const& rhs ) - { - this->assign(rhs); - return *this ; - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Move-assigns from another convertible optional (converts && deep-moves the rhs value) - // Requires a valid conversion from U to T. - // Basic Guarantee: If T::T( U && ) throws, this is left UNINITIALIZED - template - optional& operator= ( optional && rhs ) - { - this->assign(boost::move(rhs)); - return *this ; - } -#endif - - // Assigns from another optional (deep-copies the rhs value) - // Basic Guarantee: If T::T( T const& ) throws, this is left UNINITIALIZED - // (NOTE: On BCB, this operator is not actually called and left is left UNMODIFIED in case of a throw) -#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS - optional& operator= ( optional const& rhs ) = default; -#else - optional& operator= ( optional const& rhs ) - { - this->assign( static_cast(rhs) ) ; - return *this ; - } -#endif - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Assigns from another optional (deep-moves the rhs value) -#ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS - optional& operator= ( optional && ) = default; -#else - optional& operator= ( optional && rhs ) - BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) - { - this->assign( static_cast(rhs) ) ; - return *this ; - } -#endif - -#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - -#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX - - // Assigns from a T (deep-moves/copies the rhs value) - template - BOOST_DEDUCED_TYPENAME boost::enable_if::type>, optional&>::type - operator= ( T_&& val ) - { - this->assign( boost::forward(val) ) ; - return *this ; - } - -#else - - // Assigns from a T (deep-copies the rhs value) - // Basic Guarantee: If T::( T const& ) throws, this is left UNINITIALIZED - optional& operator= ( argument_type val ) - { - this->assign( val ) ; - return *this ; - } - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - // Assigns from a T (deep-moves the rhs value) - optional& operator= ( rval_reference_type val ) - { - this->assign( boost::move(val) ) ; - return *this ; - } -#endif - -#endif // BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX - - // Assigns from a "none" - // Which destroys the current value, if any, leaving this UNINITIALIZED - // No-throw (assuming T::~T() doesn't) - optional& operator= ( none_t none_ ) BOOST_NOEXCEPT - { - this->assign( none_ ) ; - return *this ; - } - -#if (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) && (!defined BOOST_NO_CXX11_VARIADIC_TEMPLATES) - // Constructs in-place - // upon exception *this is always uninitialized - template - void emplace ( Args&&... args ) - { - this->emplace_assign( boost::forward(args)... ); - } - - template - explicit optional ( in_place_init_t, Args&&... args ) - : base( in_place_init, boost::forward(args)... ) - {} - - template - explicit optional ( in_place_init_if_t, bool cond, Args&&... args ) - : base( in_place_init_if, cond, boost::forward(args)... ) - {} - -#elif (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) - template - void emplace ( Arg&& arg ) - { - this->emplace_assign( boost::forward(arg) ); - } - - void emplace () - { - this->emplace_assign(); - } - - template - explicit optional ( in_place_init_t, Args&& args ) - : base( in_place_init, boost::forward(args) ) - {} - - explicit optional ( in_place_init_t ) - : base( in_place_init ) - {} - - template - explicit optional ( in_place_init_if_t, bool cond, Args&& args ) - : base( in_place_init_if, cond, boost::forward(args) ) - {} - - explicit optional ( in_place_init_if_t, bool cond ) - : base( in_place_init_if, cond ) - {} -#else - template - void emplace ( const Arg& arg ) - { - this->emplace_assign( arg ); - } - - template - void emplace ( Arg& arg ) - { - this->emplace_assign( arg ); - } - - void emplace () - { - this->emplace_assign(); - } - - template - explicit optional ( in_place_init_t, const Arg& arg ) - : base( in_place_init, arg ) - {} - - template - explicit optional ( in_place_init_t, Arg& arg ) - : base( in_place_init, arg ) - {} - - explicit optional ( in_place_init_t ) - : base( in_place_init ) - {} - - template - explicit optional ( in_place_init_if_t, bool cond, const Arg& arg ) - : base( in_place_init_if, cond, arg ) - {} - - template - explicit optional ( in_place_init_if_t, bool cond, Arg& arg ) - : base( in_place_init_if, cond, arg ) - {} - - explicit optional ( in_place_init_if_t, bool cond ) - : base( in_place_init_if, cond ) - {} -#endif - - void swap( optional & arg ) - BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible::value && ::boost::is_nothrow_move_assignable::value) - { - // allow for Koenig lookup - boost::swap(*this, arg); - } - - - // Returns a reference to the value if this is initialized, otherwise, - // the behaviour is UNDEFINED - // No-throw - reference_const_type get() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } - reference_type get() { BOOST_ASSERT(this->is_initialized()) ; return this->get_impl(); } - - // Returns a copy of the value if this is initialized, 'v' otherwise - reference_const_type get_value_or ( reference_const_type v ) const { return this->is_initialized() ? get() : v ; } - reference_type get_value_or ( reference_type v ) { return this->is_initialized() ? get() : v ; } - - // Returns a pointer to the value if this is initialized, otherwise, - // the behaviour is UNDEFINED - // No-throw - pointer_const_type operator->() const { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } - pointer_type operator->() { BOOST_ASSERT(this->is_initialized()) ; return this->get_ptr_impl() ; } - - // Returns a reference to the value if this is initialized, otherwise, - // the behaviour is UNDEFINED - // No-throw -#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) - reference_const_type operator *() const& { return this->get() ; } - reference_type operator *() & { return this->get() ; } - reference_type_of_temporary_wrapper operator *() && { return boost::move(this->get()) ; } -#else - reference_const_type operator *() const { return this->get() ; } - reference_type operator *() { return this->get() ; } -#endif // !defined BOOST_NO_CXX11_REF_QUALIFIERS - -#if (!defined BOOST_NO_CXX11_REF_QUALIFIERS) && (!defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES) - reference_const_type value() const& - { - if (this->is_initialized()) - return this->get() ; - else - throw_exception(bad_optional_access()); - } - - reference_type value() & - { - if (this->is_initialized()) - return this->get() ; - else - throw_exception(bad_optional_access()); - } - - reference_type_of_temporary_wrapper value() && - { - if (this->is_initialized()) - return boost::move(this->get()) ; - else - throw_exception(bad_optional_access()); - } - -#else - reference_const_type value() const - { - if (this->is_initialized()) - return this->get() ; - else - throw_exception(bad_optional_access()); - } - - reference_type value() - { - if (this->is_initialized()) - return this->get() ; - else - throw_exception(bad_optional_access()); - } -#endif - - -#ifndef BOOST_NO_CXX11_REF_QUALIFIERS - template - value_type value_or ( U&& v ) const& - { - if (this->is_initialized()) - return get(); - else - return boost::forward(v); - } - - template - value_type value_or ( U&& v ) && - { - if (this->is_initialized()) - return boost::move(get()); - else - return boost::forward(v); - } -#elif !defined BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - template - value_type value_or ( U&& v ) const - { - if (this->is_initialized()) - return get(); - else - return boost::forward(v); - } -#else - template - value_type value_or ( U const& v ) const - { - if (this->is_initialized()) - return get(); - else - return v; - } - - template - value_type value_or ( U& v ) const - { - if (this->is_initialized()) - return get(); - else - return v; - } -#endif - - -#ifndef BOOST_NO_CXX11_REF_QUALIFIERS - template - value_type value_or_eval ( F f ) const& - { - if (this->is_initialized()) - return get(); - else - return f(); - } - - template - value_type value_or_eval ( F f ) && - { - if (this->is_initialized()) - return boost::move(get()); - else - return f(); - } -#else - template - value_type value_or_eval ( F f ) const - { - if (this->is_initialized()) - return get(); - else - return f(); - } -#endif - - bool operator!() const BOOST_NOEXCEPT { return !this->is_initialized() ; } - - BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() -} ; - -} // namespace boost - -#endif // BOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL - -namespace boost { - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES -template -class optional -{ - BOOST_STATIC_ASSERT_MSG(sizeof(T) == 0, "Optional rvalue references are illegal."); -} ; -#endif - -} // namespace boost - -#ifndef BOOST_OPTIONAL_CONFIG_DONT_SPECIALIZE_OPTIONAL_REFS -# include -#endif - -namespace boost { - -#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - -template -inline -optional::type> make_optional ( T && v ) -{ - return optional::type>(boost::forward(v)); -} - -// Returns optional(cond,v) -template -inline -optional::type> make_optional ( bool cond, T && v ) -{ - return optional::type>(cond,boost::forward(v)); -} - -#else - -// Returns optional(v) -template -inline -optional make_optional ( T const& v ) -{ - return optional(v); -} - -// Returns optional(cond,v) -template -inline -optional make_optional ( bool cond, T const& v ) -{ - return optional(cond,v); -} - -#endif // BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES - -// Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. -// No-throw -template -inline -BOOST_DEDUCED_TYPENAME optional::reference_const_type -get ( optional const& opt ) -{ - return opt.get() ; -} - -template -inline -BOOST_DEDUCED_TYPENAME optional::reference_type -get ( optional& opt ) -{ - return opt.get() ; -} - -// Returns a pointer to the value if this is initialized, otherwise, returns NULL. -// No-throw -template -inline -BOOST_DEDUCED_TYPENAME optional::pointer_const_type -get ( optional const* opt ) -{ - return opt->get_ptr() ; -} - -template -inline -BOOST_DEDUCED_TYPENAME optional::pointer_type -get ( optional* opt ) -{ - return opt->get_ptr() ; -} - -// Returns a reference to the value if this is initialized, otherwise, the behaviour is UNDEFINED. -// No-throw -template -inline -BOOST_DEDUCED_TYPENAME optional::reference_const_type -get_optional_value_or ( optional const& opt, BOOST_DEDUCED_TYPENAME optional::reference_const_type v ) -{ - return opt.get_value_or(v) ; -} - -template -inline -BOOST_DEDUCED_TYPENAME optional::reference_type -get_optional_value_or ( optional& opt, BOOST_DEDUCED_TYPENAME optional::reference_type v ) -{ - return opt.get_value_or(v) ; -} - -// Returns a pointer to the value if this is initialized, otherwise, returns NULL. -// No-throw -template -inline -BOOST_DEDUCED_TYPENAME optional::pointer_const_type -get_pointer ( optional const& opt ) -{ - return opt.get_ptr() ; -} - -template -inline -BOOST_DEDUCED_TYPENAME optional::pointer_type -get_pointer ( optional& opt ) -{ - return opt.get_ptr() ; -} - -} // namespace boost - -namespace boost { - -// The following declaration prevents a bug where operator safe-bool is used upon streaming optional object if you forget the IO header. -template -std::basic_ostream& -operator<<(std::basic_ostream& os, optional_detail::optional_tag const&) -{ - BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, "If you want to output boost::optional, include header "); - return os; -} - -} // namespace boost - -#include -#include - -#endif // header guard diff --git a/libraries/boost/include/boost/optional/optional_fwd.hpp b/libraries/boost/include/boost/optional/optional_fwd.hpp deleted file mode 100644 index faee253e55..0000000000 --- a/libraries/boost/include/boost/optional/optional_fwd.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal. -// Copyright (C) 2016 Andrzej Krzemienski -// -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// fernando_cacciola@hotmail.com -// -// Revisions: -// 10 May 2008 (added swap related forward declaration) Niels Dekker -// -#ifndef BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP -#define BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP - -#include - -namespace boost { - -template class optional ; - -// This forward is needed to refer to namespace scope swap from the member swap -template void swap ( optional& , optional& ) ; - -template struct optional_swap_should_use_default_constructor ; - -#ifndef BOOST_OPTIONAL_CONFIG_DONT_SPECIALIZE_OPTIONAL_REFS - -template class optional ; - -template void swap ( optional& , optional& ) BOOST_NOEXCEPT; - -#endif - -} // namespace boost - -#endif - diff --git a/libraries/boost/include/boost/predef.h b/libraries/boost/include/boost/predef.h deleted file mode 100644 index 4965337875..0000000000 --- a/libraries/boost/include/boost/predef.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#if !defined(BOOST_PREDEF_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) -#ifndef BOOST_PREDEF_H -#define BOOST_PREDEF_H -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#endif diff --git a/libraries/boost/include/boost/predef/architecture.h b/libraries/boost/include/boost/predef/architecture.h deleted file mode 100644 index c433d437bd..0000000000 --- a/libraries/boost/include/boost/predef/architecture.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#if !defined(BOOST_PREDEF_ARCHITECTURE_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) -#ifndef BOOST_PREDEF_ARCHITECTURE_H -#define BOOST_PREDEF_ARCHITECTURE_H -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/*#include */ - -#endif diff --git a/libraries/boost/include/boost/predef/architecture/alpha.h b/libraries/boost/include/boost/predef/architecture/alpha.h deleted file mode 100644 index 5bcade18b1..0000000000 --- a/libraries/boost/include/boost/predef/architecture/alpha.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_ALPHA_H -#define BOOST_PREDEF_ARCHITECTURE_ALPHA_H - -#include -#include - -/*` -[heading `BOOST_ARCH_ALPHA`] - -[@http://en.wikipedia.org/wiki/DEC_Alpha DEC Alpha] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - [[`__alpha__`] [__predef_detection__]] - [[`__alpha`] [__predef_detection__]] - [[`_M_ALPHA`] [__predef_detection__]] - - [[`__alpha_ev4__`] [4.0.0]] - [[`__alpha_ev5__`] [5.0.0]] - [[`__alpha_ev6__`] [6.0.0]] - ] - */ - -#define BOOST_ARCH_ALPHA BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__alpha__) || defined(__alpha) || \ - defined(_M_ALPHA) -# undef BOOST_ARCH_ALPHA -# if !defined(BOOST_ARCH_ALPHA) && defined(__alpha_ev4__) -# define BOOST_ARCH_ALPHA BOOST_VERSION_NUMBER(4,0,0) -# endif -# if !defined(BOOST_ARCH_ALPHA) && defined(__alpha_ev5__) -# define BOOST_ARCH_ALPHA BOOST_VERSION_NUMBER(5,0,0) -# endif -# if !defined(BOOST_ARCH_ALPHA) && defined(__alpha_ev6__) -# define BOOST_ARCH_ALPHA BOOST_VERSION_NUMBER(6,0,0) -# endif -# if !defined(BOOST_ARCH_ALPHA) -# define BOOST_ARCH_ALPHA BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_ARCH_ALPHA -# define BOOST_ARCH_ALPHA_AVAILABLE -#endif - -#define BOOST_ARCH_ALPHA_NAME "DEC Alpha" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_ALPHA,BOOST_ARCH_ALPHA_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/arm.h b/libraries/boost/include/boost/predef/architecture/arm.h deleted file mode 100644 index 76f9f947bd..0000000000 --- a/libraries/boost/include/boost/predef/architecture/arm.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Copyright Franz Detro 2014 -Copyright (c) Microsoft Corporation 2014 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_ARM_H -#define BOOST_PREDEF_ARCHITECTURE_ARM_H - -#include -#include - -/*` -[heading `BOOST_ARCH_ARM`] - -[@http://en.wikipedia.org/wiki/ARM_architecture ARM] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__arm__`] [__predef_detection__]] - [[`__arm64`] [__predef_detection__]] - [[`__thumb__`] [__predef_detection__]] - [[`__TARGET_ARCH_ARM`] [__predef_detection__]] - [[`__TARGET_ARCH_THUMB`] [__predef_detection__]] - [[`_M_ARM`] [__predef_detection__]] - [[`_M_ARM64`] [__predef_detection__]] - - [[`__arm64`] [8.0.0]] - [[`__TARGET_ARCH_ARM`] [V.0.0]] - [[`__TARGET_ARCH_THUMB`] [V.0.0]] - [[`_M_ARM`] [V.0.0]] - [[`_M_ARM64`] [8.0.0]] - ] - */ - -#define BOOST_ARCH_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__arm__) || defined(__arm64) || defined(__thumb__) || \ - defined(__TARGET_ARCH_ARM) || defined(__TARGET_ARCH_THUMB) || \ - defined(_M_ARM) || defined(_M_ARM64) -# undef BOOST_ARCH_ARM -# if !defined(BOOST_ARCH_ARM) && defined(__arm64) -# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(8,0,0) -# endif -# if !defined(BOOST_ARCH_ARM) && defined(__TARGET_ARCH_ARM) -# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(__TARGET_ARCH_ARM,0,0) -# endif -# if !defined(BOOST_ARCH_ARM) && defined(__TARGET_ARCH_THUMB) -# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(__TARGET_ARCH_THUMB,0,0) -# endif -# if !defined(BOOST_ARCH_ARM) && defined(_M_ARM64) -# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(8,0,0) -# endif -# if !defined(BOOST_ARCH_ARM) && defined(_M_ARM) -# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER(_M_ARM,0,0) -# endif -# if !defined(BOOST_ARCH_ARM) -# define BOOST_ARCH_ARM BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_ARCH_ARM -# define BOOST_ARCH_ARM_AVAILABLE -#endif - -#define BOOST_ARCH_ARM_NAME "ARM" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_ARM,BOOST_ARCH_ARM_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/blackfin.h b/libraries/boost/include/boost/predef/architecture/blackfin.h deleted file mode 100644 index 84c58a25e9..0000000000 --- a/libraries/boost/include/boost/predef/architecture/blackfin.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright Rene Rivera 2013-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_BLACKFIN_H -#define BOOST_PREDEF_ARCHITECTURE_BLACKFIN_H - -#include -#include - -/*` -[heading `BOOST_ARCH_BLACKFIN`] - -Blackfin Processors from Analog Devices. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__bfin__`] [__predef_detection__]] - [[`__BFIN__`] [__predef_detection__]] - [[`bfin`] [__predef_detection__]] - [[`BFIN`] [__predef_detection__]] - ] - */ - -#define BOOST_ARCH_BLACKFIN BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__bfin__) || defined(__BFIN__) || \ - defined(bfin) || defined(BFIN) -# undef BOOST_ARCH_BLACKFIN -# define BOOST_ARCH_BLACKFIN BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_ARCH_BLACKFIN -# define BOOST_ARCH_BLACKFIN_AVAILABLE -#endif - -#define BOOST_ARCH_BLACKFIN_NAME "Blackfin" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_BLACKFIN,BOOST_ARCH_BLACKFIN_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/convex.h b/libraries/boost/include/boost/predef/architecture/convex.h deleted file mode 100644 index ac783a9cc1..0000000000 --- a/libraries/boost/include/boost/predef/architecture/convex.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright Rene Rivera 2011-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_CONVEX_H -#define BOOST_PREDEF_ARCHITECTURE_CONVEX_H - -#include -#include - -/*` -[heading `BOOST_ARCH_CONVEX`] - -[@http://en.wikipedia.org/wiki/Convex_Computer Convex Computer] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__convex__`] [__predef_detection__]] - - [[`__convex_c1__`] [1.0.0]] - [[`__convex_c2__`] [2.0.0]] - [[`__convex_c32__`] [3.2.0]] - [[`__convex_c34__`] [3.4.0]] - [[`__convex_c38__`] [3.8.0]] - ] - */ - -#define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__convex__) -# undef BOOST_ARCH_CONVEX -# if !defined(BOOST_ARCH_CONVEX) && defined(__convex_c1__) -# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER(1,0,0) -# endif -# if !defined(BOOST_ARCH_CONVEX) && defined(__convex_c2__) -# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER(2,0,0) -# endif -# if !defined(BOOST_ARCH_CONVEX) && defined(__convex_c32__) -# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER(3,2,0) -# endif -# if !defined(BOOST_ARCH_CONVEX) && defined(__convex_c34__) -# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER(3,4,0) -# endif -# if !defined(BOOST_ARCH_CONVEX) && defined(__convex_c38__) -# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER(3,8,0) -# endif -# if !defined(BOOST_ARCH_CONVEX) -# define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_ARCH_CONVEX -# define BOOST_ARCH_CONVEX_AVAILABLE -#endif - -#define BOOST_ARCH_CONVEX_NAME "Convex Computer" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_CONVEX,BOOST_ARCH_CONVEX_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/ia64.h b/libraries/boost/include/boost/predef/architecture/ia64.h deleted file mode 100644 index 9b1972bd39..0000000000 --- a/libraries/boost/include/boost/predef/architecture/ia64.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_IA64_H -#define BOOST_PREDEF_ARCHITECTURE_IA64_H - -#include -#include - -/*` -[heading `BOOST_ARCH_IA64`] - -[@http://en.wikipedia.org/wiki/Ia64 Intel Itanium 64] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__ia64__`] [__predef_detection__]] - [[`_IA64`] [__predef_detection__]] - [[`__IA64__`] [__predef_detection__]] - [[`__ia64`] [__predef_detection__]] - [[`_M_IA64`] [__predef_detection__]] - [[`__itanium__`] [__predef_detection__]] - ] - */ - -#define BOOST_ARCH_IA64 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__ia64__) || defined(_IA64) || \ - defined(__IA64__) || defined(__ia64) || \ - defined(_M_IA64) || defined(__itanium__) -# undef BOOST_ARCH_IA64 -# define BOOST_ARCH_IA64 BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_ARCH_IA64 -# define BOOST_ARCH_IA64_AVAILABLE -#endif - -#define BOOST_ARCH_IA64_NAME "Intel Itanium 64" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_IA64,BOOST_ARCH_IA64_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/m68k.h b/libraries/boost/include/boost/predef/architecture/m68k.h deleted file mode 100644 index 63ed5f8479..0000000000 --- a/libraries/boost/include/boost/predef/architecture/m68k.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_M68K_H -#define BOOST_PREDEF_ARCHITECTURE_M68K_H - -#include -#include - -/*` -[heading `BOOST_ARCH_M68K`] - -[@http://en.wikipedia.org/wiki/M68k Motorola 68k] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__m68k__`] [__predef_detection__]] - [[`M68000`] [__predef_detection__]] - - [[`__mc68060__`] [6.0.0]] - [[`mc68060`] [6.0.0]] - [[`__mc68060`] [6.0.0]] - [[`__mc68040__`] [4.0.0]] - [[`mc68040`] [4.0.0]] - [[`__mc68040`] [4.0.0]] - [[`__mc68030__`] [3.0.0]] - [[`mc68030`] [3.0.0]] - [[`__mc68030`] [3.0.0]] - [[`__mc68020__`] [2.0.0]] - [[`mc68020`] [2.0.0]] - [[`__mc68020`] [2.0.0]] - [[`__mc68010__`] [1.0.0]] - [[`mc68010`] [1.0.0]] - [[`__mc68010`] [1.0.0]] - [[`__mc68000__`] [0.0.1]] - [[`mc68000`] [0.0.1]] - [[`__mc68000`] [0.0.1]] - ] - */ - -#define BOOST_ARCH_M68K BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__m68k__) || defined(M68000) -# undef BOOST_ARCH_M68K -# if !defined(BOOST_ARCH_M68K) && (defined(__mc68060__) || defined(mc68060) || defined(__mc68060)) -# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER(6,0,0) -# endif -# if !defined(BOOST_ARCH_M68K) && (defined(__mc68040__) || defined(mc68040) || defined(__mc68040)) -# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER(4,0,0) -# endif -# if !defined(BOOST_ARCH_M68K) && (defined(__mc68030__) || defined(mc68030) || defined(__mc68030)) -# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER(3,0,0) -# endif -# if !defined(BOOST_ARCH_M68K) && (defined(__mc68020__) || defined(mc68020) || defined(__mc68020)) -# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER(2,0,0) -# endif -# if !defined(BOOST_ARCH_M68K) && (defined(__mc68010__) || defined(mc68010) || defined(__mc68010)) -# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER(1,0,0) -# endif -# if !defined(BOOST_ARCH_M68K) && (defined(__mc68000__) || defined(mc68000) || defined(__mc68000)) -# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER_AVAILABLE -# endif -# if !defined(BOOST_ARCH_M68K) -# define BOOST_ARCH_M68K BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_ARCH_M68K -# define BOOST_ARCH_M68K_AVAILABLE -#endif - -#define BOOST_ARCH_M68K_NAME "Motorola 68k" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_M68K,BOOST_ARCH_M68K_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/mips.h b/libraries/boost/include/boost/predef/architecture/mips.h deleted file mode 100644 index 0189d7dbd6..0000000000 --- a/libraries/boost/include/boost/predef/architecture/mips.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_MIPS_H -#define BOOST_PREDEF_ARCHITECTURE_MIPS_H - -#include -#include - -/*` -[heading `BOOST_ARCH_MIPS`] - -[@http://en.wikipedia.org/wiki/MIPS_architecture MIPS] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__mips__`] [__predef_detection__]] - [[`__mips`] [__predef_detection__]] - [[`__MIPS__`] [__predef_detection__]] - - [[`__mips`] [V.0.0]] - [[`_MIPS_ISA_MIPS1`] [1.0.0]] - [[`_R3000`] [1.0.0]] - [[`_MIPS_ISA_MIPS2`] [2.0.0]] - [[`__MIPS_ISA2__`] [2.0.0]] - [[`_R4000`] [2.0.0]] - [[`_MIPS_ISA_MIPS3`] [3.0.0]] - [[`__MIPS_ISA3__`] [3.0.0]] - [[`_MIPS_ISA_MIPS4`] [4.0.0]] - [[`__MIPS_ISA4__`] [4.0.0]] - ] - */ - -#define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__mips__) || defined(__mips) || \ - defined(__MIPS__) -# undef BOOST_ARCH_MIPS -# if !defined(BOOST_ARCH_MIPS) && (defined(__mips)) -# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER(__mips,0,0) -# endif -# if !defined(BOOST_ARCH_MIPS) && (defined(_MIPS_ISA_MIPS1) || defined(_R3000)) -# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER(1,0,0) -# endif -# if !defined(BOOST_ARCH_MIPS) && (defined(_MIPS_ISA_MIPS2) || defined(__MIPS_ISA2__) || defined(_R4000)) -# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER(2,0,0) -# endif -# if !defined(BOOST_ARCH_MIPS) && (defined(_MIPS_ISA_MIPS3) || defined(__MIPS_ISA3__)) -# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER(3,0,0) -# endif -# if !defined(BOOST_ARCH_MIPS) && (defined(_MIPS_ISA_MIPS4) || defined(__MIPS_ISA4__)) -# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER(4,0,0) -# endif -# if !defined(BOOST_ARCH_MIPS) -# define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_ARCH_MIPS -# define BOOST_ARCH_MIPS_AVAILABLE -#endif - -#define BOOST_ARCH_MIPS_NAME "MIPS" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_MIPS,BOOST_ARCH_MIPS_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/parisc.h b/libraries/boost/include/boost/predef/architecture/parisc.h deleted file mode 100644 index c75a1f3889..0000000000 --- a/libraries/boost/include/boost/predef/architecture/parisc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_PARISC_H -#define BOOST_PREDEF_ARCHITECTURE_PARISC_H - -#include -#include - -/*` -[heading `BOOST_ARCH_PARISC`] - -[@http://en.wikipedia.org/wiki/PA-RISC_family HP/PA RISC] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__hppa__`] [__predef_detection__]] - [[`__hppa`] [__predef_detection__]] - [[`__HPPA__`] [__predef_detection__]] - - [[`_PA_RISC1_0`] [1.0.0]] - [[`_PA_RISC1_1`] [1.1.0]] - [[`__HPPA11__`] [1.1.0]] - [[`__PA7100__`] [1.1.0]] - [[`_PA_RISC2_0`] [2.0.0]] - [[`__RISC2_0__`] [2.0.0]] - [[`__HPPA20__`] [2.0.0]] - [[`__PA8000__`] [2.0.0]] - ] - */ - -#define BOOST_ARCH_PARISC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__hppa__) || defined(__hppa) || defined(__HPPA__) -# undef BOOST_ARCH_PARISC -# if !defined(BOOST_ARCH_PARISC) && (defined(_PA_RISC1_0)) -# define BOOST_ARCH_PARISC BOOST_VERSION_NUMBER(1,0,0) -# endif -# if !defined(BOOST_ARCH_PARISC) && (defined(_PA_RISC1_1) || defined(__HPPA11__) || defined(__PA7100__)) -# define BOOST_ARCH_PARISC BOOST_VERSION_NUMBER(1,1,0) -# endif -# if !defined(BOOST_ARCH_PARISC) && (defined(_PA_RISC2_0) || defined(__RISC2_0__) || defined(__HPPA20__) || defined(__PA8000__)) -# define BOOST_ARCH_PARISC BOOST_VERSION_NUMBER(2,0,0) -# endif -# if !defined(BOOST_ARCH_PARISC) -# define BOOST_ARCH_PARISC BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_ARCH_PARISC -# define BOOST_ARCH_PARISC_AVAILABLE -#endif - -#define BOOST_ARCH_PARISC_NAME "HP/PA RISC" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_PARISC,BOOST_ARCH_PARISC_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/ppc.h b/libraries/boost/include/boost/predef/architecture/ppc.h deleted file mode 100644 index e8c57c91f2..0000000000 --- a/libraries/boost/include/boost/predef/architecture/ppc.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_PPC_H -#define BOOST_PREDEF_ARCHITECTURE_PPC_H - -#include -#include - -/*` -[heading `BOOST_ARCH_PPC`] - -[@http://en.wikipedia.org/wiki/PowerPC PowerPC] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__powerpc`] [__predef_detection__]] - [[`__powerpc__`] [__predef_detection__]] - [[`__POWERPC__`] [__predef_detection__]] - [[`__ppc__`] [__predef_detection__]] - [[`_M_PPC`] [__predef_detection__]] - [[`_ARCH_PPC`] [__predef_detection__]] - [[`__PPCGECKO__`] [__predef_detection__]] - [[`__PPCBROADWAY__`] [__predef_detection__]] - [[`_XENON`] [__predef_detection__]] - - [[`__ppc601__`] [6.1.0]] - [[`_ARCH_601`] [6.1.0]] - [[`__ppc603__`] [6.3.0]] - [[`_ARCH_603`] [6.3.0]] - [[`__ppc604__`] [6.4.0]] - [[`__ppc604__`] [6.4.0]] - ] - */ - -#define BOOST_ARCH_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__powerpc) || defined(__powerpc__) || \ - defined(__POWERPC__) || defined(__ppc__) || \ - defined(_M_PPC) || defined(_ARCH_PPC) || \ - defined(__PPCGECKO__) || defined(__PPCBROADWAY__) || \ - defined(_XENON) -# undef BOOST_ARCH_PPC -# if !defined (BOOST_ARCH_PPC) && (defined(__ppc601__) || defined(_ARCH_601)) -# define BOOST_ARCH_PPC BOOST_VERSION_NUMBER(6,1,0) -# endif -# if !defined (BOOST_ARCH_PPC) && (defined(__ppc603__) || defined(_ARCH_603)) -# define BOOST_ARCH_PPC BOOST_VERSION_NUMBER(6,3,0) -# endif -# if !defined (BOOST_ARCH_PPC) && (defined(__ppc604__) || defined(__ppc604__)) -# define BOOST_ARCH_PPC BOOST_VERSION_NUMBER(6,4,0) -# endif -# if !defined (BOOST_ARCH_PPC) -# define BOOST_ARCH_PPC BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_ARCH_PPC -# define BOOST_ARCH_PPC_AVAILABLE -#endif - -#define BOOST_ARCH_PPC_NAME "PowerPC" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_PPC,BOOST_ARCH_PPC_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/pyramid.h b/libraries/boost/include/boost/predef/architecture/pyramid.h deleted file mode 100644 index 4f13253807..0000000000 --- a/libraries/boost/include/boost/predef/architecture/pyramid.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright Rene Rivera 2011-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_PYRAMID_H -#define BOOST_PREDEF_ARCHITECTURE_PYRAMID_H - -#include -#include - -/*` -[heading `BOOST_ARCH_PYRAMID`] - -Pyramid 9810 architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`pyr`] [__predef_detection__]] - ] - */ - -#define BOOST_ARCH_PYRAMID BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(pyr) -# undef BOOST_ARCH_PYRAMID -# define BOOST_ARCH_PYRAMID BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_ARCH_PYRAMID -# define BOOST_ARCH_PYRAMID_AVAILABLE -#endif - -#define BOOST_ARCH_PYRAMID_NAME "Pyramid 9810" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_PYRAMID,BOOST_ARCH_PYRAMID_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/rs6k.h b/libraries/boost/include/boost/predef/architecture/rs6k.h deleted file mode 100644 index 8a6e9b6b53..0000000000 --- a/libraries/boost/include/boost/predef/architecture/rs6k.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_RS6K_H -#define BOOST_PREDEF_ARCHITECTURE_RS6K_H - -#include -#include - -/*` -[heading `BOOST_ARCH_RS6000`] - -[@http://en.wikipedia.org/wiki/RS/6000 RS/6000] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__THW_RS6000`] [__predef_detection__]] - [[`_IBMR2`] [__predef_detection__]] - [[`_POWER`] [__predef_detection__]] - [[`_ARCH_PWR`] [__predef_detection__]] - [[`_ARCH_PWR2`] [__predef_detection__]] - ] - */ - -#define BOOST_ARCH_RS6000 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__THW_RS6000) || defined(_IBMR2) || \ - defined(_POWER) || defined(_ARCH_PWR) || \ - defined(_ARCH_PWR2) -# undef BOOST_ARCH_RS6000 -# define BOOST_ARCH_RS6000 BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_ARCH_RS6000 -# define BOOST_ARCH_RS6000_AVAILABLE -#endif - -#define BOOST_ARCH_RS6000_NAME "RS/6000" - -#define BOOST_ARCH_PWR BOOST_ARCH_RS6000 - -#if BOOST_ARCH_PWR -# define BOOST_ARCH_PWR_AVAILABLE -#endif - -#define BOOST_ARCH_PWR_NAME BOOST_ARCH_RS6000_NAME - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_RS6000,BOOST_ARCH_RS6000_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/sparc.h b/libraries/boost/include/boost/predef/architecture/sparc.h deleted file mode 100644 index a89a5100b8..0000000000 --- a/libraries/boost/include/boost/predef/architecture/sparc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_SPARC_H -#define BOOST_PREDEF_ARCHITECTURE_SPARC_H - -#include -#include - -/*` -[heading `BOOST_ARCH_SPARC`] - -[@http://en.wikipedia.org/wiki/SPARC SPARC] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__sparc__`] [__predef_detection__]] - [[`__sparc`] [__predef_detection__]] - - [[`__sparcv9`] [9.0.0]] - [[`__sparcv8`] [8.0.0]] - ] - */ - -#define BOOST_ARCH_SPARC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__sparc__) || defined(__sparc) -# undef BOOST_ARCH_SPARC -# if !defined(BOOST_ARCH_SPARC) && defined(__sparcv9) -# define BOOST_ARCH_SPARC BOOST_VERSION_NUMBER(9,0,0) -# endif -# if !defined(BOOST_ARCH_SPARC) && defined(__sparcv8) -# define BOOST_ARCH_SPARC BOOST_VERSION_NUMBER(8,0,0) -# endif -# if !defined(BOOST_ARCH_SPARC) -# define BOOST_ARCH_SPARC BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_ARCH_SPARC -# define BOOST_ARCH_SPARC_AVAILABLE -#endif - -#define BOOST_ARCH_SPARC_NAME "SPARC" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_SPARC,BOOST_ARCH_SPARC_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/superh.h b/libraries/boost/include/boost/predef/architecture/superh.h deleted file mode 100644 index da0529e5e0..0000000000 --- a/libraries/boost/include/boost/predef/architecture/superh.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_SUPERH_H -#define BOOST_PREDEF_ARCHITECTURE_SUPERH_H - -#include -#include - -/*` -[heading `BOOST_ARCH_SH`] - -[@http://en.wikipedia.org/wiki/SuperH SuperH] architecture: -If available versions \[1-5\] are specifically detected. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__sh__`] [__predef_detection__]] - - [[`__SH5__`] [5.0.0]] - [[`__SH4__`] [4.0.0]] - [[`__sh3__`] [3.0.0]] - [[`__SH3__`] [3.0.0]] - [[`__sh2__`] [2.0.0]] - [[`__sh1__`] [1.0.0]] - ] - */ - -#define BOOST_ARCH_SH BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__sh__) -# undef BOOST_ARCH_SH -# if !defined(BOOST_ARCH_SH) && (defined(__SH5__)) -# define BOOST_ARCH_SH BOOST_VERSION_NUMBER(5,0,0) -# endif -# if !defined(BOOST_ARCH_SH) && (defined(__SH4__)) -# define BOOST_ARCH_SH BOOST_VERSION_NUMBER(4,0,0) -# endif -# if !defined(BOOST_ARCH_SH) && (defined(__sh3__) || defined(__SH3__)) -# define BOOST_ARCH_SH BOOST_VERSION_NUMBER(3,0,0) -# endif -# if !defined(BOOST_ARCH_SH) && (defined(__sh2__)) -# define BOOST_ARCH_SH BOOST_VERSION_NUMBER(2,0,0) -# endif -# if !defined(BOOST_ARCH_SH) && (defined(__sh1__)) -# define BOOST_ARCH_SH BOOST_VERSION_NUMBER(1,0,0) -# endif -# if !defined(BOOST_ARCH_SH) -# define BOOST_ARCH_SH BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_ARCH_SH -# define BOOST_ARCH_SH_AVAILABLE -#endif - -#define BOOST_ARCH_SH_NAME "SuperH" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_SH,BOOST_ARCH_SH_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/sys370.h b/libraries/boost/include/boost/predef/architecture/sys370.h deleted file mode 100644 index cfd85dc803..0000000000 --- a/libraries/boost/include/boost/predef/architecture/sys370.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_SYS370_H -#define BOOST_PREDEF_ARCHITECTURE_SYS370_H - -#include -#include - -/*` -[heading `BOOST_ARCH_SYS370`] - -[@http://en.wikipedia.org/wiki/System/370 System/370] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__370__`] [__predef_detection__]] - [[`__THW_370__`] [__predef_detection__]] - ] - */ - -#define BOOST_ARCH_SYS370 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__370__) || defined(__THW_370__) -# undef BOOST_ARCH_SYS370 -# define BOOST_ARCH_SYS370 BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_ARCH_SYS370 -# define BOOST_ARCH_SYS370_AVAILABLE -#endif - -#define BOOST_ARCH_SYS370_NAME "System/370" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_SYS370,BOOST_ARCH_SYS370_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/sys390.h b/libraries/boost/include/boost/predef/architecture/sys390.h deleted file mode 100644 index 47aff6acd6..0000000000 --- a/libraries/boost/include/boost/predef/architecture/sys390.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_SYS390_H -#define BOOST_PREDEF_ARCHITECTURE_SYS390_H - -#include -#include - -/*` -[heading `BOOST_ARCH_SYS390`] - -[@http://en.wikipedia.org/wiki/System/390 System/390] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__s390__`] [__predef_detection__]] - [[`__s390x__`] [__predef_detection__]] - ] - */ - -#define BOOST_ARCH_SYS390 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__s390__) || defined(__s390x__) -# undef BOOST_ARCH_SYS390 -# define BOOST_ARCH_SYS390 BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_ARCH_SYS390 -# define BOOST_ARCH_SYS390_AVAILABLE -#endif - -#define BOOST_ARCH_SYS390_NAME "System/390" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_SYS390,BOOST_ARCH_SYS390_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/x86.h b/libraries/boost/include/boost/predef/architecture/x86.h deleted file mode 100644 index 0ef3ef45ef..0000000000 --- a/libraries/boost/include/boost/predef/architecture/x86.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#include -#include - -#ifndef BOOST_PREDEF_ARCHITECTURE_X86_H -#define BOOST_PREDEF_ARCHITECTURE_X86_H - -/*` -[heading `BOOST_ARCH_X86`] - -[@http://en.wikipedia.org/wiki/X86 Intel x86] architecture. This is -a category to indicate that either `BOOST_ARCH_X86_32` or -`BOOST_ARCH_X86_64` is detected. - */ - -#define BOOST_ARCH_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if BOOST_ARCH_X86_32 || BOOST_ARCH_X86_64 -# undef BOOST_ARCH_X86 -# define BOOST_ARCH_X86 BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_ARCH_X86 -# define BOOST_ARCH_X86_AVAILABLE -#endif - -#define BOOST_ARCH_X86_NAME "Intel x86" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_X86,BOOST_ARCH_X86_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/x86/32.h b/libraries/boost/include/boost/predef/architecture/x86/32.h deleted file mode 100644 index 17fbff554a..0000000000 --- a/libraries/boost/include/boost/predef/architecture/x86/32.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_X86_32_H -#define BOOST_PREDEF_ARCHITECTURE_X86_32_H - -#include -#include - -/*` -[heading `BOOST_ARCH_X86_32`] - -[@http://en.wikipedia.org/wiki/X86 Intel x86] architecture: -If available versions \[3-6\] are specifically detected. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`i386`] [__predef_detection__]] - [[`__i386__`] [__predef_detection__]] - [[`__i486__`] [__predef_detection__]] - [[`__i586__`] [__predef_detection__]] - [[`__i686__`] [__predef_detection__]] - [[`__i386`] [__predef_detection__]] - [[`_M_IX86`] [__predef_detection__]] - [[`_X86_`] [__predef_detection__]] - [[`__THW_INTEL__`] [__predef_detection__]] - [[`__I86__`] [__predef_detection__]] - [[`__INTEL__`] [__predef_detection__]] - - [[`__I86__`] [V.0.0]] - [[`_M_IX86`] [V.0.0]] - [[`__i686__`] [6.0.0]] - [[`__i586__`] [5.0.0]] - [[`__i486__`] [4.0.0]] - [[`__i386__`] [3.0.0]] - ] - */ - -#define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(i386) || defined(__i386__) || \ - defined(__i486__) || defined(__i586__) || \ - defined(__i686__) || defined(__i386) || \ - defined(_M_IX86) || defined(_X86_) || \ - defined(__THW_INTEL__) || defined(__I86__) || \ - defined(__INTEL__) -# undef BOOST_ARCH_X86_32 -# if !defined(BOOST_ARCH_X86_32) && defined(__I86__) -# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER(__I86__,0,0) -# endif -# if !defined(BOOST_ARCH_X86_32) && defined(_M_IX86) -# define BOOST_ARCH_X86_32 BOOST_PREDEF_MAKE_10_VV00(_M_IX86) -# endif -# if !defined(BOOST_ARCH_X86_32) && defined(__i686__) -# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER(6,0,0) -# endif -# if !defined(BOOST_ARCH_X86_32) && defined(__i586__) -# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER(5,0,0) -# endif -# if !defined(BOOST_ARCH_X86_32) && defined(__i486__) -# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER(4,0,0) -# endif -# if !defined(BOOST_ARCH_X86_32) && defined(__i386__) -# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER(3,0,0) -# endif -# if !defined(BOOST_ARCH_X86_32) -# define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_ARCH_X86_32 -# define BOOST_ARCH_X86_32_AVAILABLE -#endif - -#define BOOST_ARCH_X86_32_NAME "Intel x86-32" - -#include - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_X86_32,BOOST_ARCH_X86_32_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/x86/64.h b/libraries/boost/include/boost/predef/architecture/x86/64.h deleted file mode 100644 index f761c92596..0000000000 --- a/libraries/boost/include/boost/predef/architecture/x86/64.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_X86_64_H -#define BOOST_PREDEF_ARCHITECTURE_X86_64_H - -#include -#include - -/*` -[heading `BOOST_ARCH_X86_64`] - -[@http://en.wikipedia.org/wiki/Ia64 Intel IA-64] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__x86_64`] [__predef_detection__]] - [[`__x86_64__`] [__predef_detection__]] - [[`__amd64__`] [__predef_detection__]] - [[`__amd64`] [__predef_detection__]] - [[`_M_X64`] [__predef_detection__]] - ] - */ - -#define BOOST_ARCH_X86_64 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__x86_64) || defined(__x86_64__) || \ - defined(__amd64__) || defined(__amd64) || \ - defined(_M_X64) -# undef BOOST_ARCH_X86_64 -# define BOOST_ARCH_X86_64 BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_ARCH_X86_64 -# define BOOST_ARCH_X86_64_AVAILABLE -#endif - -#define BOOST_ARCH_X86_64_NAME "Intel x86-64" - -#include - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_X86_64,BOOST_ARCH_X86_64_NAME) diff --git a/libraries/boost/include/boost/predef/architecture/z.h b/libraries/boost/include/boost/predef/architecture/z.h deleted file mode 100644 index 3d218aa264..0000000000 --- a/libraries/boost/include/boost/predef/architecture/z.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ARCHITECTURE_Z_H -#define BOOST_PREDEF_ARCHITECTURE_Z_H - -#include -#include - -/*` -[heading `BOOST_ARCH_Z`] - -[@http://en.wikipedia.org/wiki/Z/Architecture z/Architecture] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__SYSC_ZARCH__`] [__predef_detection__]] - ] - */ - -#define BOOST_ARCH_Z BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__SYSC_ZARCH__) -# undef BOOST_ARCH_Z -# define BOOST_ARCH_Z BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_ARCH_Z -# define BOOST_ARCH_Z_AVAILABLE -#endif - -#define BOOST_ARCH_Z_NAME "z/Architecture" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_Z,BOOST_ARCH_Z_NAME) diff --git a/libraries/boost/include/boost/predef/compiler.h b/libraries/boost/include/boost/predef/compiler.h deleted file mode 100644 index 61a4c527ab..0000000000 --- a/libraries/boost/include/boost/predef/compiler.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#if !defined(BOOST_PREDEF_COMPILER_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) -#ifndef BOOST_PREDEF_COMPILER_H -#define BOOST_PREDEF_COMPILER_H -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/libraries/boost/include/boost/predef/compiler/borland.h b/libraries/boost/include/boost/predef/compiler/borland.h deleted file mode 100644 index 3677cca7fd..0000000000 --- a/libraries/boost/include/boost/predef/compiler/borland.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_BORLAND_H -#define BOOST_PREDEF_COMPILER_BORLAND_H - -#include -#include - -/*` -[heading `BOOST_COMP_BORLAND`] - -[@http://en.wikipedia.org/wiki/C_plus_plus_builder Borland C++] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__BORLANDC__`] [__predef_detection__]] - [[`__CODEGEARC__`] [__predef_detection__]] - - [[`__BORLANDC__`] [V.R.P]] - [[`__CODEGEARC__`] [V.R.P]] - ] - */ - -#define BOOST_COMP_BORLAND BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__BORLANDC__) || defined(__CODEGEARC__) -# if !defined(BOOST_COMP_BORLAND_DETECTION) && (defined(__CODEGEARC__)) -# define BOOST_COMP_BORLAND_DETECTION BOOST_PREDEF_MAKE_0X_VVRP(__CODEGEARC__) -# endif -# if !defined(BOOST_COMP_BORLAND_DETECTION) -# define BOOST_COMP_BORLAND_DETECTION BOOST_PREDEF_MAKE_0X_VVRP(__BORLANDC__) -# endif -#endif - -#ifdef BOOST_COMP_BORLAND_DETECTION -# define BOOST_COMP_BORLAND_AVAILABLE -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_BORLAND_EMULATED BOOST_COMP_BORLAND_DETECTION -# else -# undef BOOST_COMP_BORLAND -# define BOOST_COMP_BORLAND BOOST_COMP_BORLAND_DETECTION -# endif -# include -#endif - -#define BOOST_COMP_BORLAND_NAME "Borland C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_BORLAND,BOOST_COMP_BORLAND_NAME) - -#ifdef BOOST_COMP_BORLAND_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_BORLAND_EMULATED,BOOST_COMP_BORLAND_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/clang.h b/libraries/boost/include/boost/predef/compiler/clang.h deleted file mode 100644 index 56678fe6a5..0000000000 --- a/libraries/boost/include/boost/predef/compiler/clang.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_CLANG_H -#define BOOST_PREDEF_COMPILER_CLANG_H - -#include -#include - -/*` -[heading `BOOST_COMP_CLANG`] - -[@http://en.wikipedia.org/wiki/Clang Clang] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__clang__`] [__predef_detection__]] - - [[`__clang_major__`, `__clang_minor__`, `__clang_patchlevel__`] [V.R.P]] - ] - */ - -#define BOOST_COMP_CLANG BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__clang__) -# define BOOST_COMP_CLANG_DETECTION BOOST_VERSION_NUMBER(__clang_major__,__clang_minor__,__clang_patchlevel__) -#endif - -#ifdef BOOST_COMP_CLANG_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_CLANG_EMULATED BOOST_COMP_CLANG_DETECTION -# else -# undef BOOST_COMP_CLANG -# define BOOST_COMP_CLANG BOOST_COMP_CLANG_DETECTION -# endif -# define BOOST_COMP_CLANG_AVAILABLE -# include -#endif - -#define BOOST_COMP_CLANG_NAME "Clang" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_CLANG,BOOST_COMP_CLANG_NAME) - -#ifdef BOOST_COMP_CLANG_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_CLANG_EMULATED,BOOST_COMP_CLANG_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/comeau.h b/libraries/boost/include/boost/predef/compiler/comeau.h deleted file mode 100644 index 15a4564896..0000000000 --- a/libraries/boost/include/boost/predef/compiler/comeau.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_COMEAU_H -#define BOOST_PREDEF_COMPILER_COMEAU_H - -#include -#include - -#define BOOST_COMP_COMO BOOST_VERSION_NUMBER_NOT_AVAILABLE - -/*` -[heading `BOOST_COMP_COMO`] - -[@http://en.wikipedia.org/wiki/Comeau_C/C%2B%2B Comeau C++] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__COMO__`] [__predef_detection__]] - - [[`__COMO_VERSION__`] [V.R.P]] - ] - */ - -#if defined(__COMO__) -# if !defined(BOOST_COMP_COMO_DETECTION) && defined(__COMO_VERSION__) -# define BOOST_COMP_COMO_DETECTION BOOST_PREDEF_MAKE_0X_VRP(__COMO_VERSION__) -# endif -# if !defined(BOOST_COMP_COMO_DETECTION) -# define BOOST_COMP_COMO_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_COMP_COMO_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_COMO_EMULATED BOOST_COMP_COMO_DETECTION -# else -# undef BOOST_COMP_COMO -# define BOOST_COMP_COMO BOOST_COMP_COMO_DETECTION -# endif -# define BOOST_COMP_COMO_AVAILABLE -# include -#endif - -#define BOOST_COMP_COMO_NAME "Comeau C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_COMO,BOOST_COMP_COMO_NAME) - -#ifdef BOOST_COMP_COMO_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_COMO_EMULATED,BOOST_COMP_COMO_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/compaq.h b/libraries/boost/include/boost/predef/compiler/compaq.h deleted file mode 100644 index 96a79e6756..0000000000 --- a/libraries/boost/include/boost/predef/compiler/compaq.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_COMPAQ_H -#define BOOST_PREDEF_COMPILER_COMPAQ_H - -#include -#include - -/*` -[heading `BOOST_COMP_DEC`] - -[@http://www.openvms.compaq.com/openvms/brochures/deccplus/ Compaq C/C++] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__DECCXX`] [__predef_detection__]] - [[`__DECC`] [__predef_detection__]] - - [[`__DECCXX_VER`] [V.R.P]] - [[`__DECC_VER`] [V.R.P]] - ] - */ - -#define BOOST_COMP_DEC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__DECC) || defined(__DECCXX) -# if !defined(BOOST_COMP_DEC_DETECTION) && defined(__DECCXX_VER) -# define BOOST_COMP_DEC_DETECTION BOOST_PREDEF_MAKE_10_VVRR0PP00(__DECCXX_VER) -# endif -# if !defined(BOOST_COMP_DEC_DETECTION) && defined(__DECC_VER) -# define BOOST_COMP_DEC_DETECTION BOOST_PREDEF_MAKE_10_VVRR0PP00(__DECC_VER) -# endif -# if !defined(BOOST_COMP_DEC_DETECTION) -# define BOOST_COM_DEC_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_COMP_DEC_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_DEC_EMULATED BOOST_COMP_DEC_DETECTION -# else -# undef BOOST_COMP_DEC -# define BOOST_COMP_DEC BOOST_COMP_DEC_DETECTION -# endif -# define BOOST_COMP_DEC_AVAILABLE -# include -#endif - -#define BOOST_COMP_DEC_NAME "Compaq C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DEC,BOOST_COMP_DEC_NAME) - -#ifdef BOOST_COMP_DEC_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DEC_EMULATED,BOOST_COMP_DEC_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/diab.h b/libraries/boost/include/boost/predef/compiler/diab.h deleted file mode 100644 index f5a37de7d3..0000000000 --- a/libraries/boost/include/boost/predef/compiler/diab.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_DIAB_H -#define BOOST_PREDEF_COMPILER_DIAB_H - -#include -#include - -/*` -[heading `BOOST_COMP_DIAB`] - -[@http://www.windriver.com/products/development_suite/wind_river_compiler/ Diab C/C++] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__DCC__`] [__predef_detection__]] - - [[`__VERSION_NUMBER__`] [V.R.P]] - ] - */ - -#define BOOST_COMP_DIAB BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__DCC__) -# define BOOST_COMP_DIAB_DETECTION BOOST_PREDEF_MAKE_10_VRPP(__VERSION_NUMBER__) -#endif - -#ifdef BOOST_COMP_DIAB_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_DIAB_EMULATED BOOST_COMP_DIAB_DETECTION -# else -# undef BOOST_COMP_DIAB -# define BOOST_COMP_DIAB BOOST_COMP_DIAB_DETECTION -# endif -# define BOOST_COMP_DIAB_AVAILABLE -# include -#endif - -#define BOOST_COMP_DIAB_NAME "Diab C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DIAB,BOOST_COMP_DIAB_NAME) - -#ifdef BOOST_COMP_DIAB_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DIAB_EMULATED,BOOST_COMP_DIAB_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/digitalmars.h b/libraries/boost/include/boost/predef/compiler/digitalmars.h deleted file mode 100644 index 9bd58502e0..0000000000 --- a/libraries/boost/include/boost/predef/compiler/digitalmars.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_DIGITALMARS_H -#define BOOST_PREDEF_COMPILER_DIGITALMARS_H - -#include -#include - -/*` -[heading `BOOST_COMP_DMC`] - -[@http://en.wikipedia.org/wiki/Digital_Mars Digital Mars] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__DMC__`] [__predef_detection__]] - - [[`__DMC__`] [V.R.P]] - ] - */ - -#define BOOST_COMP_DMC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__DMC__) -# define BOOST_COMP_DMC_DETECTION BOOST_PREDEF_MAKE_0X_VRP(__DMC__) -#endif - -#ifdef BOOST_COMP_DMC_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_DMC_EMULATED BOOST_COMP_DMC_DETECTION -# else -# undef BOOST_COMP_DMC -# define BOOST_COMP_DMC BOOST_COMP_DMC_DETECTION -# endif -# define BOOST_COMP_DMC_AVAILABLE -# include -#endif - -#define BOOST_COMP_DMC_NAME "Digital Mars" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DMC,BOOST_COMP_DMC_NAME) - -#ifdef BOOST_COMP_DMC_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_DMC_EMULATED,BOOST_COMP_DMC_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/dignus.h b/libraries/boost/include/boost/predef/compiler/dignus.h deleted file mode 100644 index c65d3dc764..0000000000 --- a/libraries/boost/include/boost/predef/compiler/dignus.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_DIGNUS_H -#define BOOST_PREDEF_COMPILER_DIGNUS_H - -#include -#include - -/*` -[heading `BOOST_COMP_SYSC`] - -[@http://www.dignus.com/dcxx/ Dignus Systems/C++] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__SYSC__`] [__predef_detection__]] - - [[`__SYSC_VER__`] [V.R.P]] - ] - */ - -#define BOOST_COMP_SYSC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__SYSC__) -# define BOOST_COMP_SYSC_DETECTION BOOST_PREDEF_MAKE_10_VRRPP(__SYSC_VER__) -#endif - -#ifdef BOOST_COMP_SYSC_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_SYSC_EMULATED BOOST_COMP_SYSC_DETECTION -# else -# undef BOOST_COMP_SYSC -# define BOOST_COMP_SYSC BOOST_COMP_SYSC_DETECTION -# endif -# define BOOST_COMP_SYSC_AVAILABLE -# include -#endif - -#define BOOST_COMP_SYSC_NAME "Dignus Systems/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SYSC,BOOST_COMP_SYSC_NAME) - -#ifdef BOOST_COMP_SYSC_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SYSC_EMULATED,BOOST_COMP_SYSC_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/edg.h b/libraries/boost/include/boost/predef/compiler/edg.h deleted file mode 100644 index 2ffb9b0a6d..0000000000 --- a/libraries/boost/include/boost/predef/compiler/edg.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_EDG_H -#define BOOST_PREDEF_COMPILER_EDG_H - -#include -#include - -/*` -[heading `BOOST_COMP_EDG`] - -[@http://en.wikipedia.org/wiki/Edison_Design_Group EDG C++ Frontend] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__EDG__`] [__predef_detection__]] - - [[`__EDG_VERSION__`] [V.R.0]] - ] - */ - -#define BOOST_COMP_EDG BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__EDG__) -# define BOOST_COMP_EDG_DETECTION BOOST_PREDEF_MAKE_10_VRR(__EDG_VERSION__) -#endif - -#ifdef BOOST_COMP_EDG_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_EDG_EMULATED BOOST_COMP_EDG_DETECTION -# else -# undef BOOST_COMP_EDG -# define BOOST_COMP_EDG BOOST_COMP_EDG_DETECTION -# endif -# define BOOST_COMP_EDG_AVAILABLE -# include -#endif - -#define BOOST_COMP_EDG_NAME "EDG C++ Frontend" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_EDG,BOOST_COMP_EDG_NAME) - -#ifdef BOOST_COMP_EDG_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_EDG_EMULATED,BOOST_COMP_EDG_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/ekopath.h b/libraries/boost/include/boost/predef/compiler/ekopath.h deleted file mode 100644 index e5cde36752..0000000000 --- a/libraries/boost/include/boost/predef/compiler/ekopath.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_EKOPATH_H -#define BOOST_PREDEF_COMPILER_EKOPATH_H - -#include -#include - -/*` -[heading `BOOST_COMP_PATH`] - -[@http://en.wikipedia.org/wiki/PathScale EKOpath] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__PATHCC__`] [__predef_detection__]] - - [[`__PATHCC__`, `__PATHCC_MINOR__`, `__PATHCC_PATCHLEVEL__`] [V.R.P]] - ] - */ - -#define BOOST_COMP_PATH BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__PATHCC__) -# define BOOST_COMP_PATH_DETECTION \ - BOOST_VERSION_NUMBER(__PATHCC__,__PATHCC_MINOR__,__PATHCC_PATCHLEVEL__) -#endif - -#ifdef BOOST_COMP_PATH_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_PATH_EMULATED BOOST_COMP_PATH_DETECTION -# else -# undef BOOST_COMP_PATH -# define BOOST_COMP_PATH BOOST_COMP_PATH_DETECTION -# endif -# define BOOST_COMP_PATH_AVAILABLE -# include -#endif - -#define BOOST_COMP_PATH_NAME "EKOpath" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PATH,BOOST_COMP_PATH_NAME) - -#ifdef BOOST_COMP_PATH_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PATH_EMULATED,BOOST_COMP_PATH_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/gcc.h b/libraries/boost/include/boost/predef/compiler/gcc.h deleted file mode 100644 index c2d7fff178..0000000000 --- a/libraries/boost/include/boost/predef/compiler/gcc.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_GCC_H -#define BOOST_PREDEF_COMPILER_GCC_H - -/* Other compilers that emulate this one need to be detected first. */ - -#include - -#include -#include - -/*` -[heading `BOOST_COMP_GNUC`] - -[@http://en.wikipedia.org/wiki/GNU_Compiler_Collection Gnu GCC C/C++] compiler. -Version number available as major, minor, and patch (if available). - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__GNUC__`] [__predef_detection__]] - - [[`__GNUC__`, `__GNUC_MINOR__`, `__GNUC_PATCHLEVEL__`] [V.R.P]] - [[`__GNUC__`, `__GNUC_MINOR__`] [V.R.0]] - ] - */ - -#define BOOST_COMP_GNUC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__GNUC__) -# if !defined(BOOST_COMP_GNUC_DETECTION) && defined(__GNUC_PATCHLEVEL__) -# define BOOST_COMP_GNUC_DETECTION \ - BOOST_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) -# endif -# if !defined(BOOST_COMP_GNUC_DETECTION) -# define BOOST_COMP_GNUC_DETECTION \ - BOOST_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,0) -# endif -#endif - -#ifdef BOOST_COMP_GNUC_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_GNUC_EMULATED BOOST_COMP_GNUC_DETECTION -# else -# undef BOOST_COMP_GNUC -# define BOOST_COMP_GNUC BOOST_COMP_GNUC_DETECTION -# endif -# define BOOST_COMP_GNUC_AVAILABLE -# include -#endif - -#define BOOST_COMP_GNUC_NAME "Gnu GCC C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GNUC,BOOST_COMP_GNUC_NAME) - -#ifdef BOOST_COMP_GNUC_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GNUC_EMULATED,BOOST_COMP_GNUC_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/gcc_xml.h b/libraries/boost/include/boost/predef/compiler/gcc_xml.h deleted file mode 100644 index acae600c81..0000000000 --- a/libraries/boost/include/boost/predef/compiler/gcc_xml.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_GCC_XML_H -#define BOOST_PREDEF_COMPILER_GCC_XML_H - -#include -#include - -/*` -[heading `BOOST_COMP_GCCXML`] - -[@http://www.gccxml.org/ GCC XML] compiler. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__GCCXML__`] [__predef_detection__]] - ] - */ - -#define BOOST_COMP_GCCXML BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__GCCXML__) -# define BOOST_COMP_GCCXML_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#ifdef BOOST_COMP_GCCXML_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_GCCXML_EMULATED BOOST_COMP_GCCXML_DETECTION -# else -# undef BOOST_COMP_GCCXML -# define BOOST_COMP_GCCXML BOOST_COMP_GCCXML_DETECTION -# endif -# define BOOST_COMP_GCCXML_AVAILABLE -# include -#endif - -#define BOOST_COMP_GCCXML_NAME "GCC XML" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GCCXML,BOOST_COMP_GCCXML_NAME) - -#ifdef BOOST_COMP_GCCXML_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GCCXML_EMULATED,BOOST_COMP_GCCXML_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/greenhills.h b/libraries/boost/include/boost/predef/compiler/greenhills.h deleted file mode 100644 index 23b8f017d8..0000000000 --- a/libraries/boost/include/boost/predef/compiler/greenhills.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_GREENHILLS_H -#define BOOST_PREDEF_COMPILER_GREENHILLS_H - -#include -#include - -/*` -[heading `BOOST_COMP_GHS`] - -[@http://en.wikipedia.org/wiki/Green_Hills_Software Green Hills C/C++] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__ghs`] [__predef_detection__]] - [[`__ghs__`] [__predef_detection__]] - - [[`__GHS_VERSION_NUMBER__`] [V.R.P]] - [[`__ghs`] [V.R.P]] - ] - */ - -#define BOOST_COMP_GHS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__ghs) || defined(__ghs__) -# if !defined(BOOST_COMP_GHS_DETECTION) && defined(__GHS_VERSION_NUMBER__) -# define BOOST_COMP_GHS_DETECTION BOOST_PREDEF_MAKE_10_VRP(__GHS_VERSION_NUMBER__) -# endif -# if !defined(BOOST_COMP_GHS_DETECTION) && defined(__ghs) -# define BOOST_COMP_GHS_DETECTION BOOST_PREDEF_MAKE_10_VRP(__ghs) -# endif -# if !defined(BOOST_COMP_GHS_DETECTION) -# define BOOST_COMP_GHS_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_COMP_GHS_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_GHS_EMULATED BOOST_COMP_GHS_DETECTION -# else -# undef BOOST_COMP_GHS -# define BOOST_COMP_GHS BOOST_COMP_GHS_DETECTION -# endif -# define BOOST_COMP_GHS_AVAILABLE -# include -#endif - -#define BOOST_COMP_GHS_NAME "Green Hills C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GHS,BOOST_COMP_GHS_NAME) - -#ifdef BOOST_COMP_GHS_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GHS_EMULATED,BOOST_COMP_GHS_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/hp_acc.h b/libraries/boost/include/boost/predef/compiler/hp_acc.h deleted file mode 100644 index 7b3ffe9068..0000000000 --- a/libraries/boost/include/boost/predef/compiler/hp_acc.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_HP_ACC_H -#define BOOST_PREDEF_COMPILER_HP_ACC_H - -#include -#include - -/*` -[heading `BOOST_COMP_HPACC`] - -HP aC++ compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__HP_aCC`] [__predef_detection__]] - - [[`__HP_aCC`] [V.R.P]] - ] - */ - -#define BOOST_COMP_HPACC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__HP_aCC) -# if !defined(BOOST_COMP_HPACC_DETECTION) && (__HP_aCC > 1) -# define BOOST_COMP_HPACC_DETECTION BOOST_PREDEF_MAKE_10_VVRRPP(__HP_aCC) -# endif -# if !defined(BOOST_COMP_HPACC_DETECTION) -# define BOOST_COMP_HPACC_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_COMP_HPACC_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_HPACC_EMULATED BOOST_COMP_HPACC_DETECTION -# else -# undef BOOST_COMP_HPACC -# define BOOST_COMP_HPACC BOOST_COMP_HPACC_DETECTION -# endif -# define BOOST_COMP_HPACC_AVAILABLE -# include -#endif - -#define BOOST_COMP_HPACC_NAME "HP aC++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_HPACC,BOOST_COMP_HPACC_NAME) - -#ifdef BOOST_COMP_HPACC_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_HPACC_EMULATED,BOOST_COMP_HPACC_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/iar.h b/libraries/boost/include/boost/predef/compiler/iar.h deleted file mode 100644 index 237f492e29..0000000000 --- a/libraries/boost/include/boost/predef/compiler/iar.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_IAR_H -#define BOOST_PREDEF_COMPILER_IAR_H - -#include -#include - -/*` -[heading `BOOST_COMP_IAR`] - -IAR C/C++ compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__IAR_SYSTEMS_ICC__`] [__predef_detection__]] - - [[`__VER__`] [V.R.P]] - ] - */ - -#define BOOST_COMP_IAR BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__IAR_SYSTEMS_ICC__) -# define BOOST_COMP_IAR_DETECTION BOOST_PREDEF_MAKE_10_VVRR(__VER__) -#endif - -#ifdef BOOST_COMP_IAR_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_IAR_EMULATED BOOST_COMP_IAR_DETECTION -# else -# undef BOOST_COMP_IAR -# define BOOST_COMP_IAR BOOST_COMP_IAR_DETECTION -# endif -# define BOOST_COMP_IAR_AVAILABLE -# include -#endif - -#define BOOST_COMP_IAR_NAME "IAR C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_IAR,BOOST_COMP_IAR_NAME) - -#ifdef BOOST_COMP_IAR_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_IAR_EMULATED,BOOST_COMP_IAR_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/ibm.h b/libraries/boost/include/boost/predef/compiler/ibm.h deleted file mode 100644 index 6931ebd884..0000000000 --- a/libraries/boost/include/boost/predef/compiler/ibm.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_IBM_H -#define BOOST_PREDEF_COMPILER_IBM_H - -#include -#include - -/*` -[heading `BOOST_COMP_IBM`] - -[@http://en.wikipedia.org/wiki/VisualAge IBM XL C/C++] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__IBMCPP__`] [__predef_detection__]] - [[`__xlC__`] [__predef_detection__]] - [[`__xlc__`] [__predef_detection__]] - - [[`__COMPILER_VER__`] [V.R.P]] - [[`__xlC__`] [V.R.P]] - [[`__xlc__`] [V.R.P]] - [[`__IBMCPP__`] [V.R.P]] - ] - */ - -#define BOOST_COMP_IBM BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__IBMCPP__) || defined(__xlC__) || defined(__xlc__) -# if !defined(BOOST_COMP_IBM_DETECTION) && defined(__COMPILER_VER__) -# define BOOST_COMP_IBM_DETECTION BOOST_PREDEF_MAKE_0X_VRRPPPP(__COMPILER_VER__) -# endif -# if !defined(BOOST_COMP_IBM_DETECTION) && defined(__xlC__) -# define BOOST_COMP_IBM_DETECTION BOOST_PREDEF_MAKE_0X_VVRR(__xlC__) -# endif -# if !defined(BOOST_COMP_IBM_DETECTION) && defined(__xlc__) -# define BOOST_COMP_IBM_DETECTION BOOST_PREDEF_MAKE_0X_VVRR(__xlc__) -# endif -# if !defined(BOOST_COMP_IBM_DETECTION) -# define BOOST_COMP_IBM_DETECTION BOOST_PREDEF_MAKE_10_VRP(__IBMCPP__) -# endif -#endif - -#ifdef BOOST_COMP_IBM_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_IBM_EMULATED BOOST_COMP_IBM_DETECTION -# else -# undef BOOST_COMP_IBM -# define BOOST_COMP_IBM BOOST_COMP_IBM_DETECTION -# endif -# define BOOST_COMP_IBM_AVAILABLE -# include -#endif - -#define BOOST_COMP_IBM_NAME "IBM XL C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_IBM,BOOST_COMP_IBM_NAME) - -#ifdef BOOST_COMP_IBM_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_IBM_EMULATED,BOOST_COMP_IBM_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/intel.h b/libraries/boost/include/boost/predef/compiler/intel.h deleted file mode 100644 index f8a17ef437..0000000000 --- a/libraries/boost/include/boost/predef/compiler/intel.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -Copyright Rene Rivera 2008-2017 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_INTEL_H -#define BOOST_PREDEF_COMPILER_INTEL_H - -#include -#include - -/*` -[heading `BOOST_COMP_INTEL`] - -[@http://en.wikipedia.org/wiki/Intel_C%2B%2B Intel C/C++] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__INTEL_COMPILER`] [__predef_detection__]] - [[`__ICL`] [__predef_detection__]] - [[`__ICC`] [__predef_detection__]] - [[`__ECC`] [__predef_detection__]] - - [[`__INTEL_COMPILER`] [V.R]] - [[`__INTEL_COMPILER` and `__INTEL_COMPILER_UPDATE`] [V.R.P]] - ] - */ - -#define BOOST_COMP_INTEL BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || \ - defined(__ECC) -/*` -[note Because of an Intel mistake in the release version numbering when -`__INTEL_COMPILER` is `9999` it is detected as version 12.1.0.] - */ -# if !defined(BOOST_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 9999) -# define BOOST_COMP_INTEL_DETECTION BOOST_VERSION_NUMBER(12,1,0) -# endif -# if !defined(BOOST_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) -# define BOOST_COMP_INTEL_DETECTION BOOST_VERSION_NUMBER( \ - BOOST_VERSION_NUMBER_MAJOR(BOOST_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)), \ - BOOST_VERSION_NUMBER_MINOR(BOOST_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)), \ - __INTEL_COMPILER_UPDATE) -# endif -# if !defined(BOOST_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) -# define BOOST_COMP_INTEL_DETECTION BOOST_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER) -# endif -# if !defined(BOOST_COMP_INTEL_DETECTION) -# define BOOST_COMP_INTEL_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_COMP_INTEL_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_INTEL_EMULATED BOOST_COMP_INTEL_DETECTION -# else -# undef BOOST_COMP_INTEL -# define BOOST_COMP_INTEL BOOST_COMP_INTEL_DETECTION -# endif -# define BOOST_COMP_INTEL_AVAILABLE -# include -#endif - -#define BOOST_COMP_INTEL_NAME "Intel C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_INTEL,BOOST_COMP_INTEL_NAME) - -#ifdef BOOST_COMP_INTEL_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_INTEL_EMULATED,BOOST_COMP_INTEL_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/kai.h b/libraries/boost/include/boost/predef/compiler/kai.h deleted file mode 100644 index 68ce84e146..0000000000 --- a/libraries/boost/include/boost/predef/compiler/kai.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_KAI_H -#define BOOST_PREDEF_COMPILER_KAI_H - -#include -#include - -/*` -[heading `BOOST_COMP_KCC`] - -Kai C++ compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__KCC`] [__predef_detection__]] - - [[`__KCC_VERSION`] [V.R.P]] - ] - */ - -#define BOOST_COMP_KCC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__KCC) -# define BOOST_COMP_KCC_DETECTION BOOST_PREDEF_MAKE_0X_VRPP(__KCC_VERSION) -#endif - -#ifdef BOOST_COMP_KCC_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_KCC_EMULATED BOOST_COMP_KCC_DETECTION -# else -# undef BOOST_COMP_KCC -# define BOOST_COMP_KCC BOOST_COMP_KCC_DETECTION -# endif -# define BOOST_COMP_KCC_AVAILABLE -# include -#endif - -#define BOOST_COMP_KCC_NAME "Kai C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_KCC,BOOST_COMP_KCC_NAME) - -#ifdef BOOST_COMP_KCC_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_KCC_EMULATED,BOOST_COMP_KCC_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/llvm.h b/libraries/boost/include/boost/predef/compiler/llvm.h deleted file mode 100644 index de654eb8ce..0000000000 --- a/libraries/boost/include/boost/predef/compiler/llvm.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_LLVM_H -#define BOOST_PREDEF_COMPILER_LLVM_H - -/* Other compilers that emulate this one need to be detected first. */ - -#include - -#include -#include - -/*` -[heading `BOOST_COMP_LLVM`] - -[@http://en.wikipedia.org/wiki/LLVM LLVM] compiler. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__llvm__`] [__predef_detection__]] - ] - */ - -#define BOOST_COMP_LLVM BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__llvm__) -# define BOOST_COMP_LLVM_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#ifdef BOOST_COMP_LLVM_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_LLVM_EMULATED BOOST_COMP_LLVM_DETECTION -# else -# undef BOOST_COMP_LLVM -# define BOOST_COMP_LLVM BOOST_COMP_LLVM_DETECTION -# endif -# define BOOST_COMP_LLVM_AVAILABLE -# include -#endif - -#define BOOST_COMP_LLVM_NAME "LLVM" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_LLVM,BOOST_COMP_LLVM_NAME) - -#ifdef BOOST_COMP_LLVM_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_LLVM_EMULATED,BOOST_COMP_LLVM_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/metaware.h b/libraries/boost/include/boost/predef/compiler/metaware.h deleted file mode 100644 index 1a32039cef..0000000000 --- a/libraries/boost/include/boost/predef/compiler/metaware.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_METAWARE_H -#define BOOST_PREDEF_COMPILER_METAWARE_H - -#include -#include - -/*` -[heading `BOOST_COMP_HIGHC`] - -MetaWare High C/C++ compiler. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__HIGHC__`] [__predef_detection__]] - ] - */ - -#define BOOST_COMP_HIGHC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__HIGHC__) -# define BOOST_COMP_HIGHC_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#ifdef BOOST_COMP_HIGHC_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_HIGHC_EMULATED BOOST_COMP_HIGHC_DETECTION -# else -# undef BOOST_COMP_HIGHC -# define BOOST_COMP_HIGHC BOOST_COMP_HIGHC_DETECTION -# endif -# define BOOST_COMP_HIGHC_AVAILABLE -# include -#endif - -#define BOOST_COMP_HIGHC_NAME "MetaWare High C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_HIGHC,BOOST_COMP_HIGHC_NAME) - -#ifdef BOOST_COMP_HIGHC_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_HIGHC_EMULATED,BOOST_COMP_HIGHC_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/metrowerks.h b/libraries/boost/include/boost/predef/compiler/metrowerks.h deleted file mode 100644 index f2d739b958..0000000000 --- a/libraries/boost/include/boost/predef/compiler/metrowerks.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_METROWERKS_H -#define BOOST_PREDEF_COMPILER_METROWERKS_H - -#include -#include - -/*` -[heading `BOOST_COMP_MWERKS`] - -[@http://en.wikipedia.org/wiki/CodeWarrior Metrowerks CodeWarrior] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__MWERKS__`] [__predef_detection__]] - [[`__CWCC__`] [__predef_detection__]] - - [[`__CWCC__`] [V.R.P]] - [[`__MWERKS__`] [V.R.P >= 4.2.0]] - [[`__MWERKS__`] [9.R.0]] - [[`__MWERKS__`] [8.R.0]] - ] - */ - -#define BOOST_COMP_MWERKS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__MWERKS__) || defined(__CWCC__) -# if !defined(BOOST_COMP_MWERKS_DETECTION) && defined(__CWCC__) -# define BOOST_COMP_MWERKS_DETECTION BOOST_PREDEF_MAKE_0X_VRPP(__CWCC__) -# endif -# if !defined(BOOST_COMP_MWERKS_DETECTION) && (__MWERKS__ >= 0x4200) -# define BOOST_COMP_MWERKS_DETECTION BOOST_PREDEF_MAKE_0X_VRPP(__MWERKS__) -# endif -# if !defined(BOOST_COMP_MWERKS_DETECTION) && (__MWERKS__ >= 0x3204) // note the "skip": 04->9.3 -# define BOOST_COMP_MWERKS_DETECTION BOOST_VERSION_NUMBER(9,(__MWERKS__)%100-1,0) -# endif -# if !defined(BOOST_COMP_MWERKS_DETECTION) && (__MWERKS__ >= 0x3200) -# define BOOST_COMP_MWERKS_DETECTION BOOST_VERSION_NUMBER(9,(__MWERKS__)%100,0) -# endif -# if !defined(BOOST_COMP_MWERKS_DETECTION) && (__MWERKS__ >= 0x3000) -# define BOOST_COMP_MWERKS_DETECTION BOOST_VERSION_NUMBER(8,(__MWERKS__)%100,0) -# endif -# if !defined(BOOST_COMP_MWERKS_DETECTION) -# define BOOST_COMP_MWERKS_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_COMP_MWERKS_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_MWERKS_EMULATED BOOST_COMP_MWERKS_DETECTION -# else -# undef BOOST_COMP_MWERKS -# define BOOST_COMP_MWERKS BOOST_COMP_MWERKS_DETECTION -# endif -# define BOOST_COMP_MWERKS_AVAILABLE -# include -#endif - -#define BOOST_COMP_MWERKS_NAME "Metrowerks CodeWarrior" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MWERKS,BOOST_COMP_MWERKS_NAME) - -#ifdef BOOST_COMP_MWERKS_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MWERKS_EMULATED,BOOST_COMP_MWERKS_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/microtec.h b/libraries/boost/include/boost/predef/compiler/microtec.h deleted file mode 100644 index 066a6d2ad9..0000000000 --- a/libraries/boost/include/boost/predef/compiler/microtec.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_MICROTEC_H -#define BOOST_PREDEF_COMPILER_MICROTEC_H - -#include -#include - -/*` -[heading `BOOST_COMP_MRI`] - -[@http://www.mentor.com/microtec/ Microtec C/C++] compiler. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`_MRI`] [__predef_detection__]] - ] - */ - -#define BOOST_COMP_MRI BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(_MRI) -# define BOOST_COMP_MRI_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#ifdef BOOST_COMP_MRI_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_MRI_EMULATED BOOST_COMP_MRI_DETECTION -# else -# undef BOOST_COMP_MRI -# define BOOST_COMP_MRI BOOST_COMP_MRI_DETECTION -# endif -# define BOOST_COMP_MRI_AVAILABLE -# include -#endif - -#define BOOST_COMP_MRI_NAME "Microtec C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MRI,BOOST_COMP_MRI_NAME) - -#ifdef BOOST_COMP_MRI_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MRI_EMULATED,BOOST_COMP_MRI_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/mpw.h b/libraries/boost/include/boost/predef/compiler/mpw.h deleted file mode 100644 index 118330646e..0000000000 --- a/libraries/boost/include/boost/predef/compiler/mpw.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_MPW_H -#define BOOST_PREDEF_COMPILER_MPW_H - -#include -#include - -/*` -[heading `BOOST_COMP_MPW`] - -[@http://en.wikipedia.org/wiki/Macintosh_Programmer%27s_Workshop MPW C++] compiler. -Version number available as major, and minor. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__MRC__`] [__predef_detection__]] - [[`MPW_C`] [__predef_detection__]] - [[`MPW_CPLUS`] [__predef_detection__]] - - [[`__MRC__`] [V.R.0]] - ] - */ - -#define BOOST_COMP_MPW BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__MRC__) || defined(MPW_C) || defined(MPW_CPLUS) -# if !defined(BOOST_COMP_MPW_DETECTION) && defined(__MRC__) -# define BOOST_COMP_MPW_DETECTION BOOST_PREDEF_MAKE_0X_VVRR(__MRC__) -# endif -# if !defined(BOOST_COMP_MPW_DETECTION) -# define BOOST_COMP_MPW_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_COMP_MPW_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_MPW_EMULATED BOOST_COMP_MPW_DETECTION -# else -# undef BOOST_COMP_MPW -# define BOOST_COMP_MPW BOOST_COMP_MPW_DETECTION -# endif -# define BOOST_COMP_MPW_AVAILABLE -# include -#endif - -#define BOOST_COMP_MPW_NAME "MPW C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MPW,BOOST_COMP_MPW_NAME) - -#ifdef BOOST_COMP_MPW_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MPW_EMULATED,BOOST_COMP_MPW_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/palm.h b/libraries/boost/include/boost/predef/compiler/palm.h deleted file mode 100644 index 707925a651..0000000000 --- a/libraries/boost/include/boost/predef/compiler/palm.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_PALM_H -#define BOOST_PREDEF_COMPILER_PALM_H - -#include -#include - -/*` -[heading `BOOST_COMP_PALM`] - -Palm C/C++ compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`_PACC_VER`] [__predef_detection__]] - - [[`_PACC_VER`] [V.R.P]] - ] - */ - -#define BOOST_COMP_PALM BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(_PACC_VER) -# define BOOST_COMP_PALM_DETECTION BOOST_PREDEF_MAKE_0X_VRRPP000(_PACC_VER) -#endif - -#ifdef BOOST_COMP_PALM_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_PALM_EMULATED BOOST_COMP_PALM_DETECTION -# else -# undef BOOST_COMP_PALM -# define BOOST_COMP_PALM BOOST_COMP_PALM_DETECTION -# endif -# define BOOST_COMP_PALM_AVAILABLE -# include -#endif - -#define BOOST_COMP_PALM_NAME "Palm C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PALM,BOOST_COMP_PALM_NAME) - -#ifdef BOOST_COMP_PALM_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PALM_EMULATED,BOOST_COMP_PALM_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/pgi.h b/libraries/boost/include/boost/predef/compiler/pgi.h deleted file mode 100644 index e016aeb080..0000000000 --- a/libraries/boost/include/boost/predef/compiler/pgi.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_PGI_H -#define BOOST_PREDEF_COMPILER_PGI_H - -#include -#include - -/*` -[heading `BOOST_COMP_PGI`] - -[@http://en.wikipedia.org/wiki/The_Portland_Group Portland Group C/C++] compiler. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__PGI`] [__predef_detection__]] - - [[`__PGIC__`, `__PGIC_MINOR__`, `__PGIC_PATCHLEVEL__`] [V.R.P]] - ] - */ - -#define BOOST_COMP_PGI BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__PGI) -# if !defined(BOOST_COMP_PGI_DETECTION) && (defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)) -# define BOOST_COMP_PGI_DETECTION BOOST_VERSION_NUMBER(__PGIC__,__PGIC_MINOR__,__PGIC_PATCHLEVEL__) -# endif -# if !defined(BOOST_COMP_PGI_DETECTION) -# define BOOST_COMP_PGI_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_COMP_PGI_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_PGI_EMULATED BOOST_COMP_PGI_DETECTION -# else -# undef BOOST_COMP_PGI -# define BOOST_COMP_PGI BOOST_COMP_PGI_DETECTION -# endif -# define BOOST_COMP_PGI_AVAILABLE -# include -#endif - -#define BOOST_COMP_PGI_NAME "Portland Group C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PGI,BOOST_COMP_PGI_NAME) - -#ifdef BOOST_COMP_PGI_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_PGI_EMULATED,BOOST_COMP_PGI_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/sgi_mipspro.h b/libraries/boost/include/boost/predef/compiler/sgi_mipspro.h deleted file mode 100644 index 00739f0c3c..0000000000 --- a/libraries/boost/include/boost/predef/compiler/sgi_mipspro.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_SGI_MIPSPRO_H -#define BOOST_PREDEF_COMPILER_SGI_MIPSPRO_H - -#include -#include - -/*` -[heading `BOOST_COMP_SGI`] - -[@http://en.wikipedia.org/wiki/MIPSpro SGI MIPSpro] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__sgi`] [__predef_detection__]] - [[`sgi`] [__predef_detection__]] - - [[`_SGI_COMPILER_VERSION`] [V.R.P]] - [[`_COMPILER_VERSION`] [V.R.P]] - ] - */ - -#define BOOST_COMP_SGI BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__sgi) || defined(sgi) -# if !defined(BOOST_COMP_SGI_DETECTION) && defined(_SGI_COMPILER_VERSION) -# define BOOST_COMP_SGI_DETECTION BOOST_PREDEF_MAKE_10_VRP(_SGI_COMPILER_VERSION) -# endif -# if !defined(BOOST_COMP_SGI_DETECTION) && defined(_COMPILER_VERSION) -# define BOOST_COMP_SGI_DETECTION BOOST_PREDEF_MAKE_10_VRP(_COMPILER_VERSION) -# endif -# if !defined(BOOST_COMP_SGI_DETECTION) -# define BOOST_COMP_SGI_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_COMP_SGI_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_SGI_EMULATED BOOST_COMP_SGI_DETECTION -# else -# undef BOOST_COMP_SGI -# define BOOST_COMP_SGI BOOST_COMP_SGI_DETECTION -# endif -# define BOOST_COMP_SGI_AVAILABLE -# include -#endif - -#define BOOST_COMP_SGI_NAME "SGI MIPSpro" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SGI,BOOST_COMP_SGI_NAME) - -#ifdef BOOST_COMP_SGI_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SGI_EMULATED,BOOST_COMP_SGI_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/sunpro.h b/libraries/boost/include/boost/predef/compiler/sunpro.h deleted file mode 100644 index 92c3926013..0000000000 --- a/libraries/boost/include/boost/predef/compiler/sunpro.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_SUNPRO_H -#define BOOST_PREDEF_COMPILER_SUNPRO_H - -#include -#include - -/*` -[heading `BOOST_COMP_SUNPRO`] - -[@http://en.wikipedia.org/wiki/Oracle_Solaris_Studio Oracle Solaris Studio] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__SUNPRO_CC`] [__predef_detection__]] - [[`__SUNPRO_C`] [__predef_detection__]] - - [[`__SUNPRO_CC`] [V.R.P]] - [[`__SUNPRO_C`] [V.R.P]] - [[`__SUNPRO_CC`] [VV.RR.P]] - [[`__SUNPRO_C`] [VV.RR.P]] - ] - */ - -#define BOOST_COMP_SUNPRO BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) -# if !defined(BOOST_COMP_SUNPRO_DETECTION) && defined(__SUNPRO_CC) -# if (__SUNPRO_CC < 0x5100) -# define BOOST_COMP_SUNPRO_DETECTION BOOST_PREDEF_MAKE_0X_VRP(__SUNPRO_CC) -# else -# define BOOST_COMP_SUNPRO_DETECTION BOOST_PREDEF_MAKE_0X_VVRRP(__SUNPRO_CC) -# endif -# endif -# if !defined(BOOST_COMP_SUNPRO_DETECTION) && defined(__SUNPRO_C) -# if (__SUNPRO_C < 0x5100) -# define BOOST_COMP_SUNPRO_DETECTION BOOST_PREDEF_MAKE_0X_VRP(__SUNPRO_C) -# else -# define BOOST_COMP_SUNPRO_DETECTION BOOST_PREDEF_MAKE_0X_VVRRP(__SUNPRO_C) -# endif -# endif -# if !defined(BOOST_COMP_SUNPRO_DETECTION) -# define BOOST_COMP_SUNPRO_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_COMP_SUNPRO_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_SUNPRO_EMULATED BOOST_COMP_SUNPRO_DETECTION -# else -# undef BOOST_COMP_SUNPRO -# define BOOST_COMP_SUNPRO BOOST_COMP_SUNPRO_DETECTION -# endif -# define BOOST_COMP_SUNPRO_AVAILABLE -# include -#endif - -#define BOOST_COMP_SUNPRO_NAME "Oracle Solaris Studio" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SUNPRO,BOOST_COMP_SUNPRO_NAME) - -#ifdef BOOST_COMP_SUNPRO_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_SUNPRO_EMULATED,BOOST_COMP_SUNPRO_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/tendra.h b/libraries/boost/include/boost/predef/compiler/tendra.h deleted file mode 100644 index c2bc5e4ef5..0000000000 --- a/libraries/boost/include/boost/predef/compiler/tendra.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_TENDRA_H -#define BOOST_PREDEF_COMPILER_TENDRA_H - -#include -#include - -/*` -[heading `BOOST_COMP_TENDRA`] - -[@http://en.wikipedia.org/wiki/TenDRA_Compiler TenDRA C/C++] compiler. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__TenDRA__`] [__predef_detection__]] - ] - */ - -#define BOOST_COMP_TENDRA BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__TenDRA__) -# define BOOST_COMP_TENDRA_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#ifdef BOOST_COMP_TENDRA_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_TENDRA_EMULATED BOOST_COMP_TENDRA_DETECTION -# else -# undef BOOST_COMP_TENDRA -# define BOOST_COMP_TENDRA BOOST_COMP_TENDRA_DETECTION -# endif -# define BOOST_COMP_TENDRA_AVAILABLE -# include -#endif - -#define BOOST_COMP_TENDRA_NAME "TenDRA C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_TENDRA,BOOST_COMP_TENDRA_NAME) - -#ifdef BOOST_COMP_TENDRA_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_TENDRA_EMULATED,BOOST_COMP_TENDRA_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/visualc.h b/libraries/boost/include/boost/predef/compiler/visualc.h deleted file mode 100644 index f81e61ed52..0000000000 --- a/libraries/boost/include/boost/predef/compiler/visualc.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_VISUALC_H -#define BOOST_PREDEF_COMPILER_VISUALC_H - -/* Other compilers that emulate this one need to be detected first. */ - -#include - -#include -#include - -/*` -[heading `BOOST_COMP_MSVC`] - -[@http://en.wikipedia.org/wiki/Visual_studio Microsoft Visual C/C++] compiler. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`_MSC_VER`] [__predef_detection__]] - - [[`_MSC_FULL_VER`] [V.R.P]] - [[`_MSC_VER`] [V.R.0]] - ] - -[note Release of Visual Studio after 2015 will no longer be identified -by Boost Predef as the marketing version number. Instead we use the -compiler version number directly, i.e. the _MSC_VER number.] - */ - -#define BOOST_COMP_MSVC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(_MSC_VER) -# if !defined (_MSC_FULL_VER) -# define BOOST_COMP_MSVC_BUILD 0 -# else - /* how many digits does the build number have? */ -# if _MSC_FULL_VER / 10000 == _MSC_VER - /* four digits */ -# define BOOST_COMP_MSVC_BUILD (_MSC_FULL_VER % 10000) -# elif _MSC_FULL_VER / 100000 == _MSC_VER - /* five digits */ -# define BOOST_COMP_MSVC_BUILD (_MSC_FULL_VER % 100000) -# else -# error "Cannot determine build number from _MSC_FULL_VER" -# endif -# endif - /* - VS2014 was skipped in the release sequence for MS. Which - means that the compiler and VS product versions are no longer - in sync. Hence we need to use different formulas for - mapping from MSC version to VS product version. - - VS2017 is a total nightmare when it comes to version numbers. - Hence to avoid arguments relating to that both present and - future.. Any version after VS2015 will use solely the compiler - version, i.e. cl.exe, as the version number here. - */ -# if (_MSC_VER > 1900) -# define BOOST_COMP_MSVC_DETECTION BOOST_VERSION_NUMBER(\ - _MSC_VER/100,\ - _MSC_VER%100,\ - BOOST_COMP_MSVC_BUILD) -# elif (_MSC_VER >= 1900) -# define BOOST_COMP_MSVC_DETECTION BOOST_VERSION_NUMBER(\ - _MSC_VER/100-5,\ - _MSC_VER%100,\ - BOOST_COMP_MSVC_BUILD) -# else -# define BOOST_COMP_MSVC_DETECTION BOOST_VERSION_NUMBER(\ - _MSC_VER/100-6,\ - _MSC_VER%100,\ - BOOST_COMP_MSVC_BUILD) -# endif -#endif - -#ifdef BOOST_COMP_MSVC_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_MSVC_EMULATED BOOST_COMP_MSVC_DETECTION -# else -# undef BOOST_COMP_MSVC -# define BOOST_COMP_MSVC BOOST_COMP_MSVC_DETECTION -# endif -# define BOOST_COMP_MSVC_AVAILABLE -# include -#endif - -#define BOOST_COMP_MSVC_NAME "Microsoft Visual C/C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MSVC,BOOST_COMP_MSVC_NAME) - -#ifdef BOOST_COMP_MSVC_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MSVC_EMULATED,BOOST_COMP_MSVC_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/compiler/watcom.h b/libraries/boost/include/boost/predef/compiler/watcom.h deleted file mode 100644 index b0e7776d06..0000000000 --- a/libraries/boost/include/boost/predef/compiler/watcom.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_COMPILER_WATCOM_H -#define BOOST_PREDEF_COMPILER_WATCOM_H - -#include -#include - -/*` -[heading `BOOST_COMP_WATCOM`] - -[@http://en.wikipedia.org/wiki/Watcom Watcom C++] compiler. -Version number available as major, and minor. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__WATCOMC__`] [__predef_detection__]] - - [[`__WATCOMC__`] [V.R.P]] - ] - */ - -#define BOOST_COMP_WATCOM BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__WATCOMC__) -# define BOOST_COMP_WATCOM_DETECTION BOOST_PREDEF_MAKE_10_VVRR(__WATCOMC__) -#endif - -#ifdef BOOST_COMP_WATCOM_DETECTION -# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) -# define BOOST_COMP_WATCOM_EMULATED BOOST_COMP_WATCOM_DETECTION -# else -# undef BOOST_COMP_WATCOM -# define BOOST_COMP_WATCOM BOOST_COMP_WATCOM_DETECTION -# endif -# define BOOST_COMP_WATCOM_AVAILABLE -# include -#endif - -#define BOOST_COMP_WATCOM_NAME "Watcom C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_WATCOM,BOOST_COMP_WATCOM_NAME) - -#ifdef BOOST_COMP_WATCOM_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_WATCOM_EMULATED,BOOST_COMP_WATCOM_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/detail/_cassert.h b/libraries/boost/include/boost/predef/detail/_cassert.h deleted file mode 100644 index 940e944e2b..0000000000 --- a/libraries/boost/include/boost/predef/detail/_cassert.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright Rene Rivera 2011-2012 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_DETAIL__CASSERT_H -#define BOOST_PREDEF_DETAIL__CASSERT_H - -#if defined(__cplusplus) -#include -#else -#include -#endif - -#endif diff --git a/libraries/boost/include/boost/predef/detail/_exception.h b/libraries/boost/include/boost/predef/detail/_exception.h deleted file mode 100644 index f5a6687a9f..0000000000 --- a/libraries/boost/include/boost/predef/detail/_exception.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright Rene Rivera 2011-2012 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_DETAIL__EXCEPTION_H -#define BOOST_PREDEF_DETAIL__EXCEPTION_H - -#if defined(__cplusplus) -#include -#endif - -#endif diff --git a/libraries/boost/include/boost/predef/detail/comp_detected.h b/libraries/boost/include/boost/predef/detail/comp_detected.h deleted file mode 100644 index fda1801b65..0000000000 --- a/libraries/boost/include/boost/predef/detail/comp_detected.h +++ /dev/null @@ -1,10 +0,0 @@ -/* -Copyright Rene Rivera 2014 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_DETAIL_COMP_DETECTED -#define BOOST_PREDEF_DETAIL_COMP_DETECTED 1 -#endif diff --git a/libraries/boost/include/boost/predef/detail/os_detected.h b/libraries/boost/include/boost/predef/detail/os_detected.h deleted file mode 100644 index 08e10f993a..0000000000 --- a/libraries/boost/include/boost/predef/detail/os_detected.h +++ /dev/null @@ -1,10 +0,0 @@ -/* -Copyright Rene Rivera 2013 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_DETAIL_OS_DETECTED -#define BOOST_PREDEF_DETAIL_OS_DETECTED 1 -#endif diff --git a/libraries/boost/include/boost/predef/detail/platform_detected.h b/libraries/boost/include/boost/predef/detail/platform_detected.h deleted file mode 100644 index 4faf6938d8..0000000000 --- a/libraries/boost/include/boost/predef/detail/platform_detected.h +++ /dev/null @@ -1,10 +0,0 @@ -/* -Copyright Rene Rivera 2014 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_DETAIL_PLAT_DETECTED -#define BOOST_PREDEF_DETAIL_PLAT_DETECTED 1 -#endif diff --git a/libraries/boost/include/boost/predef/detail/test.h b/libraries/boost/include/boost/predef/detail/test.h deleted file mode 100644 index 546a9e407d..0000000000 --- a/libraries/boost/include/boost/predef/detail/test.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright Rene Rivera 2011-2012 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_DETAIL_TEST_H -#define BOOST_PREDEF_DETAIL_TEST_H - -#if !defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) - -#define BOOST_PREDEF_DECLARE_TEST(x,s) - -#endif - -#endif diff --git a/libraries/boost/include/boost/predef/hardware.h b/libraries/boost/include/boost/predef/hardware.h deleted file mode 100644 index 972b73af68..0000000000 --- a/libraries/boost/include/boost/predef/hardware.h +++ /dev/null @@ -1,16 +0,0 @@ -/* -Copyright Charly Chevalier 2015 -Copyright Joel Falcou 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#if !defined(BOOST_PREDEF_HARDWARE_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) -#ifndef BOOST_PREDEF_HARDWARE_H -#define BOOST_PREDEF_HARDWARE_H -#endif - -#include - -#endif diff --git a/libraries/boost/include/boost/predef/hardware/simd.h b/libraries/boost/include/boost/predef/hardware/simd.h deleted file mode 100644 index ac5c9da2ca..0000000000 --- a/libraries/boost/include/boost/predef/hardware/simd.h +++ /dev/null @@ -1,119 +0,0 @@ -/* -Copyright Charly Chevalier 2015 -Copyright Joel Falcou 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#include -#include -#include -#include - -#ifndef BOOST_PREDEF_HARDWARE_SIMD_H -#define BOOST_PREDEF_HARDWARE_SIMD_H - -#include - -/*` - [section Using the `BOOST_HW_SIMD_*` predefs] - [include ../doc/hardware_simd.qbk] - [endsect] - - [/ --------------------------- ] - - [section `BOOST_HW_SIMD_*`] - - [heading `BOOST_HW_SIMD`] - - The SIMD extension detected for a specific architectures. - Version number depends on the detected extension. - - [table - [[__predef_symbol__] [__predef_version__]] - - [[`BOOST_HW_SIMD_X86_AVAILABLE`] [__predef_detection__]] - [[`BOOST_HW_SIMD_X86_AMD_AVAILABLE`] [__predef_detection__]] - [[`BOOST_HW_SIMD_ARM_AVAILABLE`] [__predef_detection__]] - [[`BOOST_HW_SIMD_PPC_AVAILABLE`] [__predef_detection__]] - ] - - [include ../include/boost/predef/hardware/simd/x86.h] - [include ../include/boost/predef/hardware/simd/x86_amd.h] - [include ../include/boost/predef/hardware/simd/arm.h] - [include ../include/boost/predef/hardware/simd/ppc.h] - - [endsect] - - [/ --------------------------- ] - - [section `BOOST_HW_SIMD_X86_*_VERSION`] - [include ../include/boost/predef/hardware/simd/x86/versions.h] - [endsect] - - [section `BOOST_HW_SIMD_X86_AMD_*_VERSION`] - [include ../include/boost/predef/hardware/simd/x86_amd/versions.h] - [endsect] - - [section `BOOST_HW_SIMD_ARM_*_VERSION`] - [include ../include/boost/predef/hardware/simd/arm/versions.h] - [endsect] - - [section `BOOST_HW_SIMD_PPC_*_VERSION`] - [include ../include/boost/predef/hardware/simd/ppc/versions.h] - [endsect] - - */ - -// We check if SIMD extension of multiples architectures have been detected, -// if yes, then this is an error! -// -// NOTE: _X86_AMD implies _X86, so there is no need to check for it here! -// -#if defined(BOOST_HW_SIMD_ARM_AVAILABLE) && defined(BOOST_HW_SIMD_PPC_AVAILABLE) ||\ - defined(BOOST_HW_SIMD_ARM_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AVAILABLE) ||\ - defined(BOOST_HW_SIMD_PPC_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AVAILABLE) -# error "Multiple SIMD architectures detected, this cannot happen!" -#endif - -#if defined(BOOST_HW_SIMD_X86_AVAILABLE) && defined(BOOST_HW_SIMD_X86_AMD_AVAILABLE) - // If both standard _X86 and _X86_AMD are available, - // then take the biggest version of the two! -# if BOOST_HW_SIMD_X86 >= BOOST_HW_SIMD_X86_AMD -# define BOOST_HW_SIMD BOOST_HW_SIMD_X86 -# else -# define BOOST_HW_SIMD BOOST_HW_SIMD_X86_AMD -# endif -#endif - -#if !defined(BOOST_HW_SIMD) - // At this point, only one of these two is defined -# if defined(BOOST_HW_SIMD_X86_AVAILABLE) -# define BOOST_HW_SIMD BOOST_HW_SIMD_X86 -# endif -# if defined(BOOST_HW_SIMD_X86_AMD_AVAILABLE) -# define BOOST_HW_SIMD BOOST_HW_SIMD_X86_AMD -# endif -#endif - -#if defined(BOOST_HW_SIMD_ARM_AVAILABLE) -# define BOOST_HW_SIMD BOOST_HW_SIMD_ARM -#endif - -#if defined(BOOST_HW_SIMD_PPC_AVAILABLE) -# define BOOST_HW_SIMD BOOST_HW_SIMD_PPC -#endif - -#if defined(BOOST_HW_SIMD) -# define BOOST_HW_SIMD_AVAILABLE -#else -# define BOOST_HW_SIMD BOOST_VERSION_NUMBER_NOT_AVAILABLE -#endif - -#define BOOST_HW_SIMD_NAME "Hardware SIMD" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD, BOOST_HW_SIMD_NAME) diff --git a/libraries/boost/include/boost/predef/hardware/simd/arm.h b/libraries/boost/include/boost/predef/hardware/simd/arm.h deleted file mode 100644 index 3b3fc3fa36..0000000000 --- a/libraries/boost/include/boost/predef/hardware/simd/arm.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright Charly Chevalier 2015 -Copyright Joel Falcou 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_HARDWARE_SIMD_ARM_H -#define BOOST_PREDEF_HARDWARE_SIMD_ARM_H - -#include -#include - -/*` - [heading `BOOST_HW_SIMD_ARM`] - - The SIMD extension for ARM (*if detected*). - Version number depends on the most recent detected extension. - - [table - [[__predef_symbol__] [__predef_version__]] - - [[`__ARM_NEON__`] [__predef_detection__]] - [[`__aarch64__`] [__predef_detection__]] - [[`_M_ARM`] [__predef_detection__]] - [[`_M_ARM64`] [__predef_detection__]] - ] - - [table - [[__predef_symbol__] [__predef_version__]] - - [[`__ARM_NEON__`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] - [[`__aarch64__`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] - [[`_M_ARM`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] - [[`_M_ARM64`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] - ] - - */ - -#define BOOST_HW_SIMD_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#undef BOOST_HW_SIMD_ARM -#if !defined(BOOST_HW_SIMD_ARM) && (defined(__ARM_NEON__) || defined(__aarch64__) || defined (_M_ARM) || defined (_M_ARM64)) -# define BOOST_HW_SIMD_ARM BOOST_HW_SIMD_ARM_NEON_VERSION -#endif - -#if !defined(BOOST_HW_SIMD_ARM) -# define BOOST_HW_SIMD_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE -#else -# define BOOST_HW_SIMD_ARM_AVAILABLE -#endif - -#define BOOST_HW_SIMD_ARM_NAME "ARM SIMD" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_ARM, BOOST_HW_SIMD_ARM_NAME) diff --git a/libraries/boost/include/boost/predef/hardware/simd/arm/versions.h b/libraries/boost/include/boost/predef/hardware/simd/arm/versions.h deleted file mode 100644 index 8425b31862..0000000000 --- a/libraries/boost/include/boost/predef/hardware/simd/arm/versions.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -Copyright Charly Chevalier 2015 -Copyright Joel Falcou 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_HARDWARE_SIMD_ARM_VERSIONS_H -#define BOOST_PREDEF_HARDWARE_SIMD_ARM_VERSIONS_H - -#include - -/*` - Those defines represent ARM SIMD extensions versions. - - [note You *MUST* compare them with the predef `BOOST_HW_SIMD_ARM`.] - */ - -// --------------------------------- - -/*` - [heading `BOOST_HW_SIMD_ARM_NEON_VERSION`] - - The [@https://en.wikipedia.org/wiki/ARM_architecture#Advanced_SIMD_.28NEON.29 NEON] - ARM extension version number. - - Version number is: *1.0.0*. - */ -#define BOOST_HW_SIMD_ARM_NEON_VERSION BOOST_VERSION_NUMBER(1, 0, 0) - -#endif diff --git a/libraries/boost/include/boost/predef/hardware/simd/ppc.h b/libraries/boost/include/boost/predef/hardware/simd/ppc.h deleted file mode 100644 index eef25c2d26..0000000000 --- a/libraries/boost/include/boost/predef/hardware/simd/ppc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright Charly Chevalier 2015 -Copyright Joel Falcou 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_HARDWARE_SIMD_PPC_H -#define BOOST_PREDEF_HARDWARE_SIMD_PPC_H - -#include -#include - -/*` - [heading `BOOST_HW_SIMD_PPC`] - - The SIMD extension for PowerPC (*if detected*). - Version number depends on the most recent detected extension. - - [table - [[__predef_symbol__] [__predef_version__]] - - [[`__VECTOR4DOUBLE__`] [__predef_detection__]] - - [[`__ALTIVEC__`] [__predef_detection__]] - [[`__VEC__`] [__predef_detection__]] - - [[`__VSX__`] [__predef_detection__]] - ] - - [table - [[__predef_symbol__] [__predef_version__]] - - [[`__VECTOR4DOUBLE__`] [BOOST_HW_SIMD_PPC_QPX_VERSION]] - - [[`__ALTIVEC__`] [BOOST_HW_SIMD_PPC_VMX_VERSION]] - [[`__VEC__`] [BOOST_HW_SIMD_PPC_VMX_VERSION]] - - [[`__VSX__`] [BOOST_HW_SIMD_PPC_VSX_VERSION]] - ] - - */ - -#define BOOST_HW_SIMD_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#undef BOOST_HW_SIMD_PPC -#if !defined(BOOST_HW_SIMD_PPC) && defined(__VECTOR4DOUBLE__) -# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_QPX_VERSION -#endif -#if !defined(BOOST_HW_SIMD_PPC) && defined(__VSX__) -# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_VSX_VERSION -#endif -#if !defined(BOOST_HW_SIMD_PPC) && (defined(__ALTIVEC__) || defined(__VEC__)) -# define BOOST_HW_SIMD_PPC BOOST_HW_SIMD_PPC_VMX_VERSION -#endif - -#if !defined(BOOST_HW_SIMD_PPC) -# define BOOST_HW_SIMD_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE -#else -# define BOOST_HW_SIMD_PPC_AVAILABLE -#endif - -#define BOOST_HW_SIMD_PPC_NAME "PPC SIMD" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_PPC, BOOST_HW_SIMD_PPC_NAME) diff --git a/libraries/boost/include/boost/predef/hardware/simd/ppc/versions.h b/libraries/boost/include/boost/predef/hardware/simd/ppc/versions.h deleted file mode 100644 index ffe3f0b1e5..0000000000 --- a/libraries/boost/include/boost/predef/hardware/simd/ppc/versions.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright Charly Chevalier 2015 -Copyright Joel Falcou 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_HARDWARE_SIMD_PPC_VERSIONS_H -#define BOOST_PREDEF_HARDWARE_SIMD_PPC_VERSIONS_H - -#include - -/*` - Those defines represent Power PC SIMD extensions versions. - - [note You *MUST* compare them with the predef `BOOST_HW_SIMD_PPC`.] - */ - -// --------------------------------- - -/*` - [heading `BOOST_HW_SIMD_PPC_VMX_VERSION`] - - The [@https://en.wikipedia.org/wiki/AltiVec#VMX128 VMX] powerpc extension - version number. - - Version number is: *1.0.0*. - */ -#define BOOST_HW_SIMD_PPC_VMX_VERSION BOOST_VERSION_NUMBER(1, 0, 0) - -/*` - [heading `BOOST_HW_SIMD_PPC_VSX_VERSION`] - - The [@https://en.wikipedia.org/wiki/AltiVec#VSX VSX] powerpc extension version - number. - - Version number is: *1.1.0*. - */ -#define BOOST_HW_SIMD_PPC_VSX_VERSION BOOST_VERSION_NUMBER(1, 1, 0) - -/*` - [heading `BOOST_HW_SIMD_PPC_QPX_VERSION`] - - The QPX powerpc extension version number. - - Version number is: *2.0.0*. - */ -#define BOOST_HW_SIMD_PPC_QPX_VERSION BOOST_VERSION_NUMBER(2, 0, 0) - -#endif diff --git a/libraries/boost/include/boost/predef/hardware/simd/x86.h b/libraries/boost/include/boost/predef/hardware/simd/x86.h deleted file mode 100644 index 88bd81e362..0000000000 --- a/libraries/boost/include/boost/predef/hardware/simd/x86.h +++ /dev/null @@ -1,123 +0,0 @@ -/* -Copyright Charly Chevalier 2015 -Copyright Joel Falcou 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_H -#define BOOST_PREDEF_HARDWARE_SIMD_X86_H - -#include -#include - -/*` - [heading `BOOST_HW_SIMD_X86`] - - The SIMD extension for x86 (*if detected*). - Version number depends on the most recent detected extension. - - [table - [[__predef_symbol__] [__predef_version__]] - - [[`__SSE__`] [__predef_detection__]] - [[`_M_X64`] [__predef_detection__]] - [[`_M_IX86_FP >= 1`] [__predef_detection__]] - - [[`__SSE2__`] [__predef_detection__]] - [[`_M_X64`] [__predef_detection__]] - [[`_M_IX86_FP >= 2`] [__predef_detection__]] - - [[`__SSE3__`] [__predef_detection__]] - - [[`__SSSE3__`] [__predef_detection__]] - - [[`__SSE4_1__`] [__predef_detection__]] - - [[`__SSE4_2__`] [__predef_detection__]] - - [[`__AVX__`] [__predef_detection__]] - - [[`__FMA__`] [__predef_detection__]] - - [[`__AVX2__`] [__predef_detection__]] - ] - - [table - [[__predef_symbol__] [__predef_version__]] - - [[`__SSE__`] [BOOST_HW_SIMD_X86_SSE_VERSION]] - [[`_M_X64`] [BOOST_HW_SIMD_X86_SSE_VERSION]] - [[`_M_IX86_FP >= 1`] [BOOST_HW_SIMD_X86_SSE_VERSION]] - - [[`__SSE2__`] [BOOST_HW_SIMD_X86_SSE2_VERSION]] - [[`_M_X64`] [BOOST_HW_SIMD_X86_SSE2_VERSION]] - [[`_M_IX86_FP >= 2`] [BOOST_HW_SIMD_X86_SSE2_VERSION]] - - [[`__SSE3__`] [BOOST_HW_SIMD_X86_SSE3_VERSION]] - - [[`__SSSE3__`] [BOOST_HW_SIMD_X86_SSSE3_VERSION]] - - [[`__SSE4_1__`] [BOOST_HW_SIMD_X86_SSE4_1_VERSION]] - - [[`__SSE4_2__`] [BOOST_HW_SIMD_X86_SSE4_2_VERSION]] - - [[`__AVX__`] [BOOST_HW_SIMD_X86_AVX_VERSION]] - - [[`__FMA__`] [BOOST_HW_SIMD_X86_FMA3_VERSION]] - - [[`__AVX2__`] [BOOST_HW_SIMD_X86_AVX2_VERSION]] - ] - - */ - -#define BOOST_HW_SIMD_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#undef BOOST_HW_SIMD_X86 -#if !defined(BOOST_HW_SIMD_X86) && defined(__MIC__) -# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_MIC_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86) && defined(__AVX2__) -# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_AVX2_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86) && defined(__AVX__) -# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_AVX_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86) && defined(__FMA__) -# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_FMA_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86) && defined(__SSE4_2__) -# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE4_2_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86) && defined(__SSE4_1__) -# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE4_1_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86) && defined(__SSSE3__) -# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSSE3_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86) && defined(__SSE3__) -# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE3_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86) && (defined(__SSE2__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2)) -# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE2_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86) && (defined(__SSE__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1)) -# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_SSE_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86) && defined(__MMX__) -# define BOOST_HW_SIMD_X86 BOOST_HW_SIMD_X86_MMX_VERSION -#endif - -#if !defined(BOOST_HW_SIMD_X86) -# define BOOST_HW_SIMD_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE -#else -# define BOOST_HW_SIMD_X86_AVAILABLE -#endif - -#define BOOST_HW_SIMD_X86_NAME "x86 SIMD" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_X86, BOOST_HW_SIMD_X86_NAME) diff --git a/libraries/boost/include/boost/predef/hardware/simd/x86/versions.h b/libraries/boost/include/boost/predef/hardware/simd/x86/versions.h deleted file mode 100644 index 0c7a4d3813..0000000000 --- a/libraries/boost/include/boost/predef/hardware/simd/x86/versions.h +++ /dev/null @@ -1,129 +0,0 @@ -/* -Copyright Charly Chevalier 2015 -Copyright Joel Falcou 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_VERSIONS_H -#define BOOST_PREDEF_HARDWARE_SIMD_X86_VERSIONS_H - -#include - -/*` - Those defines represent x86 SIMD extensions versions. - - [note You *MUST* compare them with the predef `BOOST_HW_SIMD_X86`.] - */ - -// --------------------------------- - -/*` - [heading `BOOST_HW_SIMD_X86_MMX_VERSION`] - - The [@https://en.wikipedia.org/wiki/MMX_(instruction_set) MMX] x86 extension - version number. - - Version number is: *0.99.0*. - */ -#define BOOST_HW_SIMD_X86_MMX_VERSION BOOST_VERSION_NUMBER(0, 99, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_SSE_VERSION`] - - The [@https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions SSE] x86 extension - version number. - - Version number is: *1.0.0*. - */ -#define BOOST_HW_SIMD_X86_SSE_VERSION BOOST_VERSION_NUMBER(1, 0, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_SSE2_VERSION`] - - The [@https://en.wikipedia.org/wiki/SSE2 SSE2] x86 extension version number. - - Version number is: *2.0.0*. - */ -#define BOOST_HW_SIMD_X86_SSE2_VERSION BOOST_VERSION_NUMBER(2, 0, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_SSE3_VERSION`] - - The [@https://en.wikipedia.org/wiki/SSE3 SSE3] x86 extension version number. - - Version number is: *3.0.0*. - */ -#define BOOST_HW_SIMD_X86_SSE3_VERSION BOOST_VERSION_NUMBER(3, 0, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_SSSE3_VERSION`] - - The [@https://en.wikipedia.org/wiki/SSSE3 SSSE3] x86 extension version number. - - Version number is: *3.1.0*. - */ -#define BOOST_HW_SIMD_X86_SSSE3_VERSION BOOST_VERSION_NUMBER(3, 1, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_SSE4_1_VERSION`] - - The [@https://en.wikipedia.org/wiki/SSE4#SSE4.1 SSE4_1] x86 extension version - number. - - Version number is: *4.1.0*. - */ -#define BOOST_HW_SIMD_X86_SSE4_1_VERSION BOOST_VERSION_NUMBER(4, 1, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_SSE4_2_VERSION`] - - The [@https://en.wikipedia.org/wiki/SSE4##SSE4.2 SSE4_2] x86 extension version - number. - - Version number is: *4.2.0*. - */ -#define BOOST_HW_SIMD_X86_SSE4_2_VERSION BOOST_VERSION_NUMBER(4, 2, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_AVX_VERSION`] - - The [@https://en.wikipedia.org/wiki/Advanced_Vector_Extensions AVX] x86 - extension version number. - - Version number is: *5.0.0*. - */ -#define BOOST_HW_SIMD_X86_AVX_VERSION BOOST_VERSION_NUMBER(5, 0, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_FMA3_VERSION`] - - The [@https://en.wikipedia.org/wiki/FMA_instruction_set FMA3] x86 extension - version number. - - Version number is: *5.2.0*. - */ -#define BOOST_HW_SIMD_X86_FMA3_VERSION BOOST_VERSION_NUMBER(5, 2, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_AVX2_VERSION`] - - The [@https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#Advanced_Vector_Extensions_2 AVX2] - x86 extension version number. - - Version number is: *5.3.0*. - */ -#define BOOST_HW_SIMD_X86_AVX2_VERSION BOOST_VERSION_NUMBER(5, 3, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_MIC_VERSION`] - - The [@https://en.wikipedia.org/wiki/Xeon_Phi MIC] (Xeon Phi) x86 extension - version number. - - Version number is: *9.0.0*. - */ -#define BOOST_HW_SIMD_X86_MIC_VERSION BOOST_VERSION_NUMBER(9, 0, 0) - -#endif diff --git a/libraries/boost/include/boost/predef/hardware/simd/x86_amd.h b/libraries/boost/include/boost/predef/hardware/simd/x86_amd.h deleted file mode 100644 index c80d1ce2b7..0000000000 --- a/libraries/boost/include/boost/predef/hardware/simd/x86_amd.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright Charly Chevalier 2015 -Copyright Joel Falcou 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_H -#define BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_H - -#include -#include - -/*` - [heading `BOOST_HW_SIMD_X86_AMD`] - - The SIMD extension for x86 (AMD) (*if detected*). - Version number depends on the most recent detected extension. - - [table - [[__predef_symbol__] [__predef_version__]] - - [[`__SSE4A__`] [__predef_detection__]] - - [[`__FMA4__`] [__predef_detection__]] - - [[`__XOP__`] [__predef_detection__]] - - [[`BOOST_HW_SIMD_X86`] [__predef_detection__]] - ] - - [table - [[__predef_symbol__] [__predef_version__]] - - [[`__SSE4A__`] [BOOST_HW_SIMD_X86_SSE4A_VERSION]] - - [[`__FMA4__`] [BOOST_HW_SIMD_X86_FMA4_VERSION]] - - [[`__XOP__`] [BOOST_HW_SIMD_X86_XOP_VERSION]] - - [[`BOOST_HW_SIMD_X86`] [BOOST_HW_SIMD_X86]] - ] - - [note This predef includes every other x86 SIMD extensions and also has other - more specific extensions (FMA4, XOP, SSE4a). You should use this predef - instead of `BOOST_HW_SIMD_X86` to test if those specific extensions have - been detected.] - - */ - -#define BOOST_HW_SIMD_X86_AMD BOOST_VERSION_NUMBER_NOT_AVAILABLE - -// AMD CPUs also use x86 architecture. We first try to detect if any AMD -// specific extension are detected, if yes, then try to detect more recent x86 -// common extensions. - -#undef BOOST_HW_SIMD_X86_AMD -#if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__XOP__) -# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_XOP_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__FMA4__) -# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_FMA4_VERSION -#endif -#if !defined(BOOST_HW_SIMD_X86_AMD) && defined(__SSE4A__) -# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION -#endif - -#if !defined(BOOST_HW_SIMD_X86_AMD) -# define BOOST_HW_SIMD_X86_AMD BOOST_VERSION_NUMBER_NOT_AVAILABLE -#else - // At this point, we know that we have an AMD CPU, we do need to check for - // other x86 extensions to determine the final version number. -# include -# if BOOST_HW_SIMD_X86 > BOOST_HW_SIMD_X86_AMD -# undef BOOST_HW_SIMD_X86_AMD -# define BOOST_HW_SIMD_X86_AMD BOOST_HW_SIMD_X86 -# endif -# define BOOST_HW_SIMD_X86_AMD_AVAILABLE -#endif - -#define BOOST_HW_SIMD_X86_AMD_NAME "x86 (AMD) SIMD" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_HW_SIMD_X86_AMD, BOOST_HW_SIMD_X86_AMD_NAME) diff --git a/libraries/boost/include/boost/predef/hardware/simd/x86_amd/versions.h b/libraries/boost/include/boost/predef/hardware/simd/x86_amd/versions.h deleted file mode 100644 index 1f9e96c500..0000000000 --- a/libraries/boost/include/boost/predef/hardware/simd/x86_amd/versions.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright Charly Chevalier 2015 -Copyright Joel Falcou 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_VERSIONS_H -#define BOOST_PREDEF_HARDWARE_SIMD_X86_AMD_VERSIONS_H - -#include - -/*` - Those defines represent x86 (AMD specific) SIMD extensions versions. - - [note You *MUST* compare them with the predef `BOOST_HW_SIMD_X86_AMD`.] - */ - - -// --------------------------------- - -/*` - [heading `BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION`] - - [@https://en.wikipedia.org/wiki/SSE4##SSE4A SSE4A] x86 extension (AMD specific). - - Version number is: *4.0.0*. - */ -#define BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION BOOST_VERSION_NUMBER(4, 0, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_AMD_FMA4_VERSION`] - - [@https://en.wikipedia.org/wiki/FMA_instruction_set#FMA4_instruction_set FMA4] x86 extension (AMD specific). - - Version number is: *5.1.0*. - */ -#define BOOST_HW_SIMD_X86_AMD_FMA4_VERSION BOOST_VERSION_NUMBER(5, 1, 0) - -/*` - [heading `BOOST_HW_SIMD_X86_AMD_XOP_VERSION`] - - [@https://en.wikipedia.org/wiki/XOP_instruction_set XOP] x86 extension (AMD specific). - - Version number is: *5.1.1*. - */ -#define BOOST_HW_SIMD_X86_AMD_XOP_VERSION BOOST_VERSION_NUMBER(5, 1, 1) - - -#endif diff --git a/libraries/boost/include/boost/predef/language.h b/libraries/boost/include/boost/predef/language.h deleted file mode 100644 index 0a317d5ece..0000000000 --- a/libraries/boost/include/boost/predef/language.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright Rene Rivera 2011-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#if !defined(BOOST_PREDEF_LANGUAGE_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) -#ifndef BOOST_PREDEF_LANGUAGE_H -#define BOOST_PREDEF_LANGUAGE_H -#endif - -#include -#include -#include - -#endif diff --git a/libraries/boost/include/boost/predef/language/objc.h b/libraries/boost/include/boost/predef/language/objc.h deleted file mode 100644 index 24e3ad3c5c..0000000000 --- a/libraries/boost/include/boost/predef/language/objc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright Rene Rivera 2011-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LANGUAGE_OBJC_H -#define BOOST_PREDEF_LANGUAGE_OBJC_H - -#include -#include - -/*` -[heading `BOOST_LANG_OBJC`] - -[@http://en.wikipedia.org/wiki/Objective-C Objective-C] language. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__OBJC__`] [__predef_detection__]] - ] - */ - -#define BOOST_LANG_OBJC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__OBJC__) -# undef BOOST_LANG_OBJC -# define BOOST_LANG_OBJC BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_LANG_OBJC -# define BOOST_LANG_OBJC_AVAILABLE -#endif - -#define BOOST_LANG_OBJC_NAME "Objective-C" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_OBJC,BOOST_LANG_OBJC_NAME) diff --git a/libraries/boost/include/boost/predef/language/stdc.h b/libraries/boost/include/boost/predef/language/stdc.h deleted file mode 100644 index db25c12dc0..0000000000 --- a/libraries/boost/include/boost/predef/language/stdc.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright Rene Rivera 2011-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LANGUAGE_STDC_H -#define BOOST_PREDEF_LANGUAGE_STDC_H - -#include -#include - -/*` -[heading `BOOST_LANG_STDC`] - -[@http://en.wikipedia.org/wiki/C_(programming_language) Standard C] language. -If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__STDC__`] [__predef_detection__]] - - [[`__STDC_VERSION__`] [V.R.P]] - ] - */ - -#define BOOST_LANG_STDC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__STDC__) -# undef BOOST_LANG_STDC -# if defined(__STDC_VERSION__) -# if (__STDC_VERSION__ > 100) -# define BOOST_LANG_STDC BOOST_PREDEF_MAKE_YYYYMM(__STDC_VERSION__) -# else -# define BOOST_LANG_STDC BOOST_VERSION_NUMBER_AVAILABLE -# endif -# else -# define BOOST_LANG_STDC BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_LANG_STDC -# define BOOST_LANG_STDC_AVAILABLE -#endif - -#define BOOST_LANG_STDC_NAME "Standard C" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDC,BOOST_LANG_STDC_NAME) diff --git a/libraries/boost/include/boost/predef/language/stdcpp.h b/libraries/boost/include/boost/predef/language/stdcpp.h deleted file mode 100644 index 34dc8c7deb..0000000000 --- a/libraries/boost/include/boost/predef/language/stdcpp.h +++ /dev/null @@ -1,121 +0,0 @@ -/* -Copyright Rene Rivera 2011-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LANGUAGE_STDCPP_H -#define BOOST_PREDEF_LANGUAGE_STDCPP_H - -#include -#include - -/*` -[heading `BOOST_LANG_STDCPP`] - -[@http://en.wikipedia.org/wiki/C%2B%2B Standard C++] language. -If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date. -Because of the way the C++ standardization process works the -defined version year will not be the commonly known year of the standard. -Specifically the defined versions are: - -[table Detected Version Number vs. C++ Standard Year - [[Detected Version Number] [Standard Year] [C++ Standard]] - [[27.11.1] [1998] [ISO/IEC 14882:1998]] - [[41.12.1] [2011] [ISO/IEC 14882:2011]] -] - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__cplusplus`] [__predef_detection__]] - - [[`__cplusplus`] [YYYY.MM.1]] - ] - */ - -#define BOOST_LANG_STDCPP BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__cplusplus) -# undef BOOST_LANG_STDCPP -# if (__cplusplus > 100) -# define BOOST_LANG_STDCPP BOOST_PREDEF_MAKE_YYYYMM(__cplusplus) -# else -# define BOOST_LANG_STDCPP BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_LANG_STDCPP -# define BOOST_LANG_STDCPP_AVAILABLE -#endif - -#define BOOST_LANG_STDCPP_NAME "Standard C++" - -/*` -[heading `BOOST_LANG_STDCPPCLI`] - -[@http://en.wikipedia.org/wiki/C%2B%2B/CLI Standard C++/CLI] language. -If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__cplusplus_cli`] [__predef_detection__]] - - [[`__cplusplus_cli`] [YYYY.MM.1]] - ] - */ - -#define BOOST_LANG_STDCPPCLI BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__cplusplus_cli) -# undef BOOST_LANG_STDCPPCLI -# if (__cplusplus_cli > 100) -# define BOOST_LANG_STDCPPCLI BOOST_PREDEF_MAKE_YYYYMM(__cplusplus_cli) -# else -# define BOOST_LANG_STDCPPCLI BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_LANG_STDCPPCLI -# define BOOST_LANG_STDCPPCLI_AVAILABLE -#endif - -#define BOOST_LANG_STDCPPCLI_NAME "Standard C++/CLI" - -/*` -[heading `BOOST_LANG_STDECPP`] - -[@http://en.wikipedia.org/wiki/Embedded_C%2B%2B Standard Embedded C++] language. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__embedded_cplusplus`] [__predef_detection__]] - ] - */ - -#define BOOST_LANG_STDECPP BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__embedded_cplusplus) -# undef BOOST_LANG_STDECPP -# define BOOST_LANG_STDECPP BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_LANG_STDECPP -# define BOOST_LANG_STDECPP_AVAILABLE -#endif - -#define BOOST_LANG_STDECPP_NAME "Standard Embedded C++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDCPP,BOOST_LANG_STDCPP_NAME) - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDCPPCLI,BOOST_LANG_STDCPPCLI_NAME) - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LANG_STDECPP,BOOST_LANG_STDECPP_NAME) diff --git a/libraries/boost/include/boost/predef/library.h b/libraries/boost/include/boost/predef/library.h deleted file mode 100644 index 40518a90d8..0000000000 --- a/libraries/boost/include/boost/predef/library.h +++ /dev/null @@ -1,16 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#if !defined(BOOST_PREDEF_LIBRARY_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) -#ifndef BOOST_PREDEF_LIBRARY_H -#define BOOST_PREDEF_LIBRARY_H -#endif - -#include -#include - -#endif diff --git a/libraries/boost/include/boost/predef/library/c.h b/libraries/boost/include/boost/predef/library/c.h deleted file mode 100644 index 7ca84cc079..0000000000 --- a/libraries/boost/include/boost/predef/library/c.h +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#if !defined(BOOST_PREDEF_LIBRARY_C_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) -#ifndef BOOST_PREDEF_LIBRARY_C_H -#define BOOST_PREDEF_LIBRARY_C_H -#endif - -#include - -#include -#include -#include -#include -#include - -#endif diff --git a/libraries/boost/include/boost/predef/library/c/_prefix.h b/libraries/boost/include/boost/predef/library/c/_prefix.h deleted file mode 100644 index 12bcb0fb3f..0000000000 --- a/libraries/boost/include/boost/predef/library/c/_prefix.h +++ /dev/null @@ -1,13 +0,0 @@ -/* -Copyright Rene Rivera 2008-2013 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_C__PREFIX_H -#define BOOST_PREDEF_LIBRARY_C__PREFIX_H - -#include - -#endif diff --git a/libraries/boost/include/boost/predef/library/c/cloudabi.h b/libraries/boost/include/boost/predef/library/c/cloudabi.h deleted file mode 100644 index e6acaee65d..0000000000 --- a/libraries/boost/include/boost/predef/library/c/cloudabi.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2017 James E. King III - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_PREDEF_LIBRARY_C_CLOUDABI_H -#define BOOST_PREDEF_LIBRARY_C_CLOUDABI_H - -#include -#include - -#include - -#if defined(__CloudABI__) -#include -#endif - -/*` -[heading `BOOST_LIB_C_CLOUDABI`] - -[@https://github.com/NuxiNL/cloudlibc cloudlibc] - CloudABI's standard C library. -Version number available as major, and minor. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__cloudlibc__`] [__predef_detection__]] - - [[`__cloudlibc_major__`, `__cloudlibc_minor__`] [V.R.0]] - ] - */ - -#define BOOST_LIB_C_CLOUDABI BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__cloudlibc__) -# undef BOOST_LIB_C_CLOUDABI -# define BOOST_LIB_C_CLOUDABI \ - BOOST_VERSION_NUMBER(__cloudlibc_major__,__cloudlibc_minor__,0) -#endif - -#if BOOST_LIB_C_CLOUDABI -# define BOOST_LIB_C_CLOUDABI_AVAILABLE -#endif - -#define BOOST_LIB_C_CLOUDABI_NAME "cloudlibc" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_CLOUDABI,BOOST_LIB_C_CLOUDABI_NAME) diff --git a/libraries/boost/include/boost/predef/library/c/gnu.h b/libraries/boost/include/boost/predef/library/c/gnu.h deleted file mode 100644 index 9e4ca89d64..0000000000 --- a/libraries/boost/include/boost/predef/library/c/gnu.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_C_GNU_H -#define BOOST_PREDEF_LIBRARY_C_GNU_H - -#include -#include - -#include - -#if defined(__STDC__) -#include -#elif defined(__cplusplus) -#include -#endif - -/*` -[heading `BOOST_LIB_C_GNU`] - -[@http://en.wikipedia.org/wiki/Glibc GNU glibc] Standard C library. -Version number available as major, and minor. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__GLIBC__`] [__predef_detection__]] - [[`__GNU_LIBRARY__`] [__predef_detection__]] - - [[`__GLIBC__`, `__GLIBC_MINOR__`] [V.R.0]] - [[`__GNU_LIBRARY__`, `__GNU_LIBRARY_MINOR__`] [V.R.0]] - ] - */ - -#define BOOST_LIB_C_GNU BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__GLIBC__) || defined(__GNU_LIBRARY__) -# undef BOOST_LIB_C_GNU -# if defined(__GLIBC__) -# define BOOST_LIB_C_GNU \ - BOOST_VERSION_NUMBER(__GLIBC__,__GLIBC_MINOR__,0) -# else -# define BOOST_LIB_C_GNU \ - BOOST_VERSION_NUMBER(__GNU_LIBRARY__,__GNU_LIBRARY_MINOR__,0) -# endif -#endif - -#if BOOST_LIB_C_GNU -# define BOOST_LIB_C_GNU_AVAILABLE -#endif - -#define BOOST_LIB_C_GNU_NAME "GNU" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_GNU,BOOST_LIB_C_GNU_NAME) diff --git a/libraries/boost/include/boost/predef/library/c/uc.h b/libraries/boost/include/boost/predef/library/c/uc.h deleted file mode 100644 index 03081e94c6..0000000000 --- a/libraries/boost/include/boost/predef/library/c/uc.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_C_UC_H -#define BOOST_PREDEF_LIBRARY_C_UC_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_C_UC`] - -[@http://en.wikipedia.org/wiki/Uclibc uClibc] Standard C library. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__UCLIBC__`] [__predef_detection__]] - - [[`__UCLIBC_MAJOR__`, `__UCLIBC_MINOR__`, `__UCLIBC_SUBLEVEL__`] [V.R.P]] - ] - */ - -#define BOOST_LIB_C_UC BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__UCLIBC__) -# undef BOOST_LIB_C_UC -# define BOOST_LIB_C_UC BOOST_VERSION_NUMBER(\ - __UCLIBC_MAJOR__,__UCLIBC_MINOR__,__UCLIBC_SUBLEVEL__) -#endif - -#if BOOST_LIB_C_UC -# define BOOST_LIB_C_UC_AVAILABLE -#endif - -#define BOOST_LIB_C_UC_NAME "uClibc" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_UC,BOOST_LIB_C_UC_NAME) diff --git a/libraries/boost/include/boost/predef/library/c/vms.h b/libraries/boost/include/boost/predef/library/c/vms.h deleted file mode 100644 index 685f1a77d6..0000000000 --- a/libraries/boost/include/boost/predef/library/c/vms.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_C_VMS_H -#define BOOST_PREDEF_LIBRARY_C_VMS_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_C_VMS`] - -VMS libc Standard C library. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__CRTL_VER`] [__predef_detection__]] - - [[`__CRTL_VER`] [V.R.P]] - ] - */ - -#define BOOST_LIB_C_VMS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__CRTL_VER) -# undef BOOST_LIB_C_VMS -# define BOOST_LIB_C_VMS BOOST_PREDEF_MAKE_10_VVRR0PP00(__CRTL_VER) -#endif - -#if BOOST_LIB_C_VMS -# define BOOST_LIB_C_VMS_AVAILABLE -#endif - -#define BOOST_LIB_C_VMS_NAME "VMS" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_VMS,BOOST_LIB_C_VMS_NAME) diff --git a/libraries/boost/include/boost/predef/library/c/zos.h b/libraries/boost/include/boost/predef/library/c/zos.h deleted file mode 100644 index 222d35539f..0000000000 --- a/libraries/boost/include/boost/predef/library/c/zos.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_C_ZOS_H -#define BOOST_PREDEF_LIBRARY_C_ZOS_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_C_ZOS`] - -z/OS libc Standard C library. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__LIBREL__`] [__predef_detection__]] - - [[`__LIBREL__`] [V.R.P]] - [[`__TARGET_LIB__`] [V.R.P]] - ] - */ - -#define BOOST_LIB_C_ZOS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__LIBREL__) -# undef BOOST_LIB_C_ZOS -# if !defined(BOOST_LIB_C_ZOS) && defined(__LIBREL__) -# define BOOST_LIB_C_ZOS BOOST_PREDEF_MAKE_0X_VRRPPPP(__LIBREL__) -# endif -# if !defined(BOOST_LIB_C_ZOS) && defined(__TARGET_LIB__) -# define BOOST_LIB_C_ZOS BOOST_PREDEF_MAKE_0X_VRRPPPP(__TARGET_LIB__) -# endif -# if !defined(BOOST_LIB_C_ZOS) -# define BOOST_LIB_C_ZOS BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_LIB_C_ZOS -# define BOOST_LIB_C_ZOS_AVAILABLE -#endif - -#define BOOST_LIB_C_ZOS_NAME "z/OS" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_ZOS,BOOST_LIB_C_ZOS_NAME) diff --git a/libraries/boost/include/boost/predef/library/std.h b/libraries/boost/include/boost/predef/library/std.h deleted file mode 100644 index 403b6ff37a..0000000000 --- a/libraries/boost/include/boost/predef/library/std.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ -#if !defined(BOOST_PREDEF_LIBRARY_STD_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) -#ifndef BOOST_PREDEF_LIBRARY_STD_H -#define BOOST_PREDEF_LIBRARY_STD_H -#endif - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/libraries/boost/include/boost/predef/library/std/_prefix.h b/libraries/boost/include/boost/predef/library/std/_prefix.h deleted file mode 100644 index 932b8557b1..0000000000 --- a/libraries/boost/include/boost/predef/library/std/_prefix.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright Rene Rivera 2008-2013 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_PREDEF_LIBRARY_STD__PREFIX_H -#define BOOST_PREDEF_LIBRARY_STD__PREFIX_H - -/* -We need to include an STD header to gives us the context -of which library we are using. The "smallest" code-wise header -seems to be . Boost uses but as far -as I can tell (RR) it's not a stand-alone header in most -implementations. Using also has the benefit of -being available in EC++, so we get a chance to make this work -for embedded users. And since it's not a header impacted by TR1 -there's no magic needed for inclusion in the face of the -Boost.TR1 library. -*/ -#include - -#endif diff --git a/libraries/boost/include/boost/predef/library/std/cxx.h b/libraries/boost/include/boost/predef/library/std/cxx.h deleted file mode 100644 index 07b52cd6af..0000000000 --- a/libraries/boost/include/boost/predef/library/std/cxx.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright Rene Rivera 2011-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_STD_CXX_H -#define BOOST_PREDEF_LIBRARY_STD_CXX_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_STD_CXX`] - -[@http://libcxx.llvm.org/ libc++] C++ Standard Library. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`_LIBCPP_VERSION`] [__predef_detection__]] - - [[`_LIBCPP_VERSION`] [V.0.P]] - ] - */ - -#define BOOST_LIB_STD_CXX BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(_LIBCPP_VERSION) -# undef BOOST_LIB_STD_CXX -# define BOOST_LIB_STD_CXX BOOST_PREDEF_MAKE_10_VPPP(_LIBCPP_VERSION) -#endif - -#if BOOST_LIB_STD_CXX -# define BOOST_LIB_STD_CXX_AVAILABLE -#endif - -#define BOOST_LIB_STD_CXX_NAME "libc++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_CXX,BOOST_LIB_STD_CXX_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/dinkumware.h b/libraries/boost/include/boost/predef/library/std/dinkumware.h deleted file mode 100644 index 0fc077605d..0000000000 --- a/libraries/boost/include/boost/predef/library/std/dinkumware.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_STD_DINKUMWARE_H -#define BOOST_PREDEF_LIBRARY_STD_DINKUMWARE_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_STD_DINKUMWARE`] - -[@http://en.wikipedia.org/wiki/Dinkumware Dinkumware] Standard C++ Library. -If available version number as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`_YVALS`, `__IBMCPP__`] [__predef_detection__]] - [[`_CPPLIB_VER`] [__predef_detection__]] - - [[`_CPPLIB_VER`] [V.R.0]] - ] - */ - -#define BOOST_LIB_STD_DINKUMWARE BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) -# undef BOOST_LIB_STD_DINKUMWARE -# if defined(_CPPLIB_VER) -# define BOOST_LIB_STD_DINKUMWARE BOOST_PREDEF_MAKE_10_VVRR(_CPPLIB_VER) -# else -# define BOOST_LIB_STD_DINKUMWARE BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_LIB_STD_DINKUMWARE -# define BOOST_LIB_STD_DINKUMWARE_AVAILABLE -#endif - -#define BOOST_LIB_STD_DINKUMWARE_NAME "Dinkumware" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_DINKUMWARE,BOOST_LIB_STD_DINKUMWARE_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/libcomo.h b/libraries/boost/include/boost/predef/library/std/libcomo.h deleted file mode 100644 index 97d4a53d6f..0000000000 --- a/libraries/boost/include/boost/predef/library/std/libcomo.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_STD_LIBCOMO_H -#define BOOST_PREDEF_LIBRARY_STD_LIBCOMO_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_STD_COMO`] - -[@http://www.comeaucomputing.com/libcomo/ Comeau Computing] Standard C++ Library. -Version number available as major. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__LIBCOMO__`] [__predef_detection__]] - - [[`__LIBCOMO_VERSION__`] [V.0.0]] - ] - */ - -#define BOOST_LIB_STD_COMO BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__LIBCOMO__) -# undef BOOST_LIB_STD_COMO -# define BOOST_LIB_STD_COMO BOOST_VERSION_NUMBER(__LIBCOMO_VERSION__,0,0) -#endif - -#if BOOST_LIB_STD_COMO -# define BOOST_LIB_STD_COMO_AVAILABLE -#endif - -#define BOOST_LIB_STD_COMO_NAME "Comeau Computing" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_COMO,BOOST_LIB_STD_COMO_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/modena.h b/libraries/boost/include/boost/predef/library/std/modena.h deleted file mode 100644 index b67ac62f17..0000000000 --- a/libraries/boost/include/boost/predef/library/std/modena.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_STD_MODENA_H -#define BOOST_PREDEF_LIBRARY_STD_MODENA_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_STD_MSIPL`] - -[@http://modena.us/ Modena Software Lib++] Standard C++ Library. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`MSIPL_COMPILE_H`] [__predef_detection__]] - [[`__MSIPL_COMPILE_H`] [__predef_detection__]] - ] - */ - -#define BOOST_LIB_STD_MSIPL BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(MSIPL_COMPILE_H) || defined(__MSIPL_COMPILE_H) -# undef BOOST_LIB_STD_MSIPL -# define BOOST_LIB_STD_MSIPL BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_LIB_STD_MSIPL -# define BOOST_LIB_STD_MSIPL_AVAILABLE -#endif - -#define BOOST_LIB_STD_MSIPL_NAME "Modena Software Lib++" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_MSIPL,BOOST_LIB_STD_MSIPL_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/msl.h b/libraries/boost/include/boost/predef/library/std/msl.h deleted file mode 100644 index d73c74c6d8..0000000000 --- a/libraries/boost/include/boost/predef/library/std/msl.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_STD_MSL_H -#define BOOST_PREDEF_LIBRARY_STD_MSL_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_STD_MSL`] - -[@http://www.freescale.com/ Metrowerks] Standard C++ Library. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__MSL_CPP__`] [__predef_detection__]] - [[`__MSL__`] [__predef_detection__]] - - [[`__MSL_CPP__`] [V.R.P]] - [[`__MSL__`] [V.R.P]] - ] - */ - -#define BOOST_LIB_STD_MSL BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__MSL_CPP__) || defined(__MSL__) -# undef BOOST_LIB_STD_MSL -# if defined(__MSL_CPP__) -# define BOOST_LIB_STD_MSL BOOST_PREDEF_MAKE_0X_VRPP(__MSL_CPP__) -# else -# define BOOST_LIB_STD_MSL BOOST_PREDEF_MAKE_0X_VRPP(__MSL__) -# endif -#endif - -#if BOOST_LIB_STD_MSL -# define BOOST_LIB_STD_MSL_AVAILABLE -#endif - -#define BOOST_LIB_STD_MSL_NAME "Metrowerks" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_MSL,BOOST_LIB_STD_MSL_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/roguewave.h b/libraries/boost/include/boost/predef/library/std/roguewave.h deleted file mode 100644 index 9c3f288b6f..0000000000 --- a/libraries/boost/include/boost/predef/library/std/roguewave.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_STD_ROGUEWAVE_H -#define BOOST_PREDEF_LIBRARY_STD_ROGUEWAVE_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_STD_RW`] - -[@http://stdcxx.apache.org/ Roguewave] Standard C++ library. -If available version number as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__STD_RWCOMPILER_H__`] [__predef_detection__]] - [[`_RWSTD_VER`] [__predef_detection__]] - - [[`_RWSTD_VER`] [V.R.P]] - ] - */ - -#define BOOST_LIB_STD_RW BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) -# undef BOOST_LIB_STD_RW -# if defined(_RWSTD_VER) -# if _RWSTD_VER < 0x010000 -# define BOOST_LIB_STD_RW BOOST_PREDEF_MAKE_0X_VVRRP(_RWSTD_VER) -# else -# define BOOST_LIB_STD_RW BOOST_PREDEF_MAKE_0X_VVRRPP(_RWSTD_VER) -# endif -# else -# define BOOST_LIB_STD_RW BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_LIB_STD_RW -# define BOOST_LIB_STD_RW_AVAILABLE -#endif - -#define BOOST_LIB_STD_RW_NAME "Roguewave" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_RW,BOOST_LIB_STD_RW_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/sgi.h b/libraries/boost/include/boost/predef/library/std/sgi.h deleted file mode 100644 index 5d19bbac4d..0000000000 --- a/libraries/boost/include/boost/predef/library/std/sgi.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_STD_SGI_H -#define BOOST_PREDEF_LIBRARY_STD_SGI_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_STD_SGI`] - -[@http://www.sgi.com/tech/stl/ SGI] Standard C++ library. -If available version number as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__STL_CONFIG_H`] [__predef_detection__]] - - [[`__SGI_STL`] [V.R.P]] - ] - */ - -#define BOOST_LIB_STD_SGI BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__STL_CONFIG_H) -# undef BOOST_LIB_STD_SGI -# if defined(__SGI_STL) -# define BOOST_LIB_STD_SGI BOOST_PREDEF_MAKE_0X_VRP(__SGI_STL) -# else -# define BOOST_LIB_STD_SGI BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_LIB_STD_SGI -# define BOOST_LIB_STD_SGI_AVAILABLE -#endif - -#define BOOST_LIB_STD_SGI_NAME "SGI" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_SGI,BOOST_LIB_STD_SGI_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/stdcpp3.h b/libraries/boost/include/boost/predef/library/std/stdcpp3.h deleted file mode 100644 index c9802924a7..0000000000 --- a/libraries/boost/include/boost/predef/library/std/stdcpp3.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_STD_STDCPP3_H -#define BOOST_PREDEF_LIBRARY_STD_STDCPP3_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_STD_GNU`] - -[@http://gcc.gnu.org/libstdc++/ GNU libstdc++] Standard C++ library. -Version number available as year (from 1970), month, and day. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__GLIBCXX__`] [__predef_detection__]] - [[`__GLIBCPP__`] [__predef_detection__]] - - [[`__GLIBCXX__`] [V.R.P]] - [[`__GLIBCPP__`] [V.R.P]] - ] - */ - -#define BOOST_LIB_STD_GNU BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__GLIBCPP__) || defined(__GLIBCXX__) -# undef BOOST_LIB_STD_GNU -# if defined(__GLIBCXX__) -# define BOOST_LIB_STD_GNU BOOST_PREDEF_MAKE_YYYYMMDD(__GLIBCXX__) -# else -# define BOOST_LIB_STD_GNU BOOST_PREDEF_MAKE_YYYYMMDD(__GLIBCPP__) -# endif -#endif - -#if BOOST_LIB_STD_GNU -# define BOOST_LIB_STD_GNU_AVAILABLE -#endif - -#define BOOST_LIB_STD_GNU_NAME "GNU" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_GNU,BOOST_LIB_STD_GNU_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/stlport.h b/libraries/boost/include/boost/predef/library/std/stlport.h deleted file mode 100644 index c09483bd9f..0000000000 --- a/libraries/boost/include/boost/predef/library/std/stlport.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_STD_STLPORT_H -#define BOOST_PREDEF_LIBRARY_STD_STLPORT_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_STD_STLPORT`] - -[@http://sourceforge.net/projects/stlport/ STLport Standard C++] library. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__SGI_STL_PORT`] [__predef_detection__]] - [[`_STLPORT_VERSION`] [__predef_detection__]] - - [[`_STLPORT_MAJOR`, `_STLPORT_MINOR`, `_STLPORT_PATCHLEVEL`] [V.R.P]] - [[`_STLPORT_VERSION`] [V.R.P]] - [[`__SGI_STL_PORT`] [V.R.P]] - ] - */ - -#define BOOST_LIB_STD_STLPORT BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) -# undef BOOST_LIB_STD_STLPORT -# if !defined(BOOST_LIB_STD_STLPORT) && defined(_STLPORT_MAJOR) -# define BOOST_LIB_STD_STLPORT \ - BOOST_VERSION_NUMBER(_STLPORT_MAJOR,_STLPORT_MINOR,_STLPORT_PATCHLEVEL) -# endif -# if !defined(BOOST_LIB_STD_STLPORT) && defined(_STLPORT_VERSION) -# define BOOST_LIB_STD_STLPORT BOOST_PREDEF_MAKE_0X_VRP(_STLPORT_VERSION) -# endif -# if !defined(BOOST_LIB_STD_STLPORT) -# define BOOST_LIB_STD_STLPORT BOOST_PREDEF_MAKE_0X_VRP(__SGI_STL_PORT) -# endif -#endif - -#if BOOST_LIB_STD_STLPORT -# define BOOST_LIB_STD_STLPORT_AVAILABLE -#endif - -#define BOOST_LIB_STD_STLPORT_NAME "STLport" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_STLPORT,BOOST_LIB_STD_STLPORT_NAME) diff --git a/libraries/boost/include/boost/predef/library/std/vacpp.h b/libraries/boost/include/boost/predef/library/std/vacpp.h deleted file mode 100644 index 632f846c20..0000000000 --- a/libraries/boost/include/boost/predef/library/std/vacpp.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_LIBRARY_STD_VACPP_H -#define BOOST_PREDEF_LIBRARY_STD_VACPP_H - -#include - -#include -#include - -/*` -[heading `BOOST_LIB_STD_IBM`] - -[@http://www.ibm.com/software/awdtools/xlcpp/ IBM VACPP Standard C++] library. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__IBMCPP__`] [__predef_detection__]] - ] - */ - -#define BOOST_LIB_STD_IBM BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__IBMCPP__) -# undef BOOST_LIB_STD_IBM -# define BOOST_LIB_STD_IBM BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_LIB_STD_IBM -# define BOOST_LIB_STD_IBM_AVAILABLE -#endif - -#define BOOST_LIB_STD_IBM_NAME "IBM VACPP" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_STD_IBM,BOOST_LIB_STD_IBM_NAME) diff --git a/libraries/boost/include/boost/predef/make.h b/libraries/boost/include/boost/predef/make.h deleted file mode 100644 index 36b891aa33..0000000000 --- a/libraries/boost/include/boost/predef/make.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ -#include - -#ifndef BOOST_PREDEF_MAKE_H -#define BOOST_PREDEF_MAKE_H - -/* -Shorthands for the common version number formats used by vendors... -*/ - -/*` -[heading `BOOST_PREDEF_MAKE_..` macros] - -These set of macros decompose common vendor version number -macros which are composed version, revision, and patch digits. -The naming convention indicates: - -* The base of the specified version number. "`BOOST_PREDEF_MAKE_0X`" for - hexadecimal digits, and "`BOOST_PREDEF_MAKE_10`" for decimal digits. -* The format of the vendor version number. Where "`V`" indicates the version digits, - "`R`" indicates the revision digits, "`P`" indicates the patch digits, and "`0`" - indicates an ignored digit. - -Macros are: -*/ -/*` `BOOST_PREDEF_MAKE_0X_VRP(V)` */ -#define BOOST_PREDEF_MAKE_0X_VRP(V) BOOST_VERSION_NUMBER((V&0xF00)>>8,(V&0xF0)>>4,(V&0xF)) -/*` `BOOST_PREDEF_MAKE_0X_VVRP(V)` */ -#define BOOST_PREDEF_MAKE_0X_VVRP(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xF0)>>4,(V&0xF)) -/*` `BOOST_PREDEF_MAKE_0X_VRPP(V)` */ -#define BOOST_PREDEF_MAKE_0X_VRPP(V) BOOST_VERSION_NUMBER((V&0xF000)>>12,(V&0xF00)>>8,(V&0xFF)) -/*` `BOOST_PREDEF_MAKE_0X_VVRR(V)` */ -#define BOOST_PREDEF_MAKE_0X_VVRR(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xFF),0) -/*` `BOOST_PREDEF_MAKE_0X_VRRPPPP(V)` */ -#define BOOST_PREDEF_MAKE_0X_VRRPPPP(V) BOOST_VERSION_NUMBER((V&0xF000000)>>24,(V&0xFF0000)>>16,(V&0xFFFF)) -/*` `BOOST_PREDEF_MAKE_0X_VVRRP(V)` */ -#define BOOST_PREDEF_MAKE_0X_VVRRP(V) BOOST_VERSION_NUMBER((V&0xFF000)>>12,(V&0xFF0)>>4,(V&0xF)) -/*` `BOOST_PREDEF_MAKE_0X_VRRPP000(V)` */ -#define BOOST_PREDEF_MAKE_0X_VRRPP000(V) BOOST_VERSION_NUMBER((V&0xF0000000)>>28,(V&0xFF00000)>>20,(V&0xFF000)>>12) -/*` `BOOST_PREDEF_MAKE_0X_VVRRPP(V)` */ -#define BOOST_PREDEF_MAKE_0X_VVRRPP(V) BOOST_VERSION_NUMBER((V&0xFF0000)>>16,(V&0xFF00)>>8,(V&0xFF)) -/*` `BOOST_PREDEF_MAKE_10_VPPP(V)` */ -#define BOOST_PREDEF_MAKE_10_VPPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,0,(V)%1000) -/*` `BOOST_PREDEF_MAKE_10_VRP(V)` */ -#define BOOST_PREDEF_MAKE_10_VRP(V) BOOST_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,(V)%10) -/*` `BOOST_PREDEF_MAKE_10_VRP000(V)` */ -#define BOOST_PREDEF_MAKE_10_VRP000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,((V)/1000)%10) -/*` `BOOST_PREDEF_MAKE_10_VRPPPP(V)` */ -#define BOOST_PREDEF_MAKE_10_VRPPPP(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,(V)%10000) -/*` `BOOST_PREDEF_MAKE_10_VRPP(V)` */ -#define BOOST_PREDEF_MAKE_10_VRPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,((V)/100)%10,(V)%100) -/*` `BOOST_PREDEF_MAKE_10_VRR(V)` */ -#define BOOST_PREDEF_MAKE_10_VRR(V) BOOST_VERSION_NUMBER(((V)/100)%10,(V)%100,0) -/*` `BOOST_PREDEF_MAKE_10_VRRPP(V)` */ -#define BOOST_PREDEF_MAKE_10_VRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%10,((V)/100)%100,(V)%100) -/*` `BOOST_PREDEF_MAKE_10_VRR000(V)` */ -#define BOOST_PREDEF_MAKE_10_VRR000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/1000)%100,0) -/*` `BOOST_PREDEF_MAKE_10_VV00(V)` */ -#define BOOST_PREDEF_MAKE_10_VV00(V) BOOST_VERSION_NUMBER(((V)/100)%100,0,0) -/*` `BOOST_PREDEF_MAKE_10_VVRR(V)` */ -#define BOOST_PREDEF_MAKE_10_VVRR(V) BOOST_VERSION_NUMBER(((V)/100)%100,(V)%100,0) -/*` `BOOST_PREDEF_MAKE_10_VVRRPP(V)` */ -#define BOOST_PREDEF_MAKE_10_VVRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%100,((V)/100)%100,(V)%100) -/*` `BOOST_PREDEF_MAKE_10_VVRRPPP(V)` */ -#define BOOST_PREDEF_MAKE_10_VVRRPPP(V) BOOST_VERSION_NUMBER(((V)/100000)%100,((V)/1000)%100,(V)%1000) -/*` `BOOST_PREDEF_MAKE_10_VVRR0PP00(V)` */ -#define BOOST_PREDEF_MAKE_10_VVRR0PP00(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,((V)/100)%100) -/*` `BOOST_PREDEF_MAKE_10_VVRR0PPPP(V)` */ -#define BOOST_PREDEF_MAKE_10_VVRR0PPPP(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,(V)%10000) -/*` `BOOST_PREDEF_MAKE_10_VVRR00PP00(V)` */ -#define BOOST_PREDEF_MAKE_10_VVRR00PP00(V) BOOST_VERSION_NUMBER(((V)/100000000)%100,((V)/1000000)%100,((V)/100)%100) -/*` -[heading `BOOST_PREDEF_MAKE_*..` date macros] - -Date decomposition macros return a date in the relative to the 1970 -Epoch date. If the month is not available, January 1st is used as the month and day. -If the day is not available, but the month is, the 1st of the month is used as the day. -*/ -/*` `BOOST_PREDEF_MAKE_DATE(Y,M,D)` */ -#define BOOST_PREDEF_MAKE_DATE(Y,M,D) BOOST_VERSION_NUMBER((Y)%10000-1970,(M)%100,(D)%100) -/*` `BOOST_PREDEF_MAKE_YYYYMMDD(V)` */ -#define BOOST_PREDEF_MAKE_YYYYMMDD(V) BOOST_PREDEF_MAKE_DATE(((V)/10000)%10000,((V)/100)%100,(V)%100) -/*` `BOOST_PREDEF_MAKE_YYYY(V)` */ -#define BOOST_PREDEF_MAKE_YYYY(V) BOOST_PREDEF_MAKE_DATE(V,1,1) -/*` `BOOST_PREDEF_MAKE_YYYYMM(V)` */ -#define BOOST_PREDEF_MAKE_YYYYMM(V) BOOST_PREDEF_MAKE_DATE((V)/100,(V)%100,1) - -#endif diff --git a/libraries/boost/include/boost/predef/os.h b/libraries/boost/include/boost/predef/os.h deleted file mode 100644 index bedf99ec54..0000000000 --- a/libraries/boost/include/boost/predef/os.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Copyright Franz Detro 2014 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#if !defined(BOOST_PREDEF_OS_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) -#ifndef BOOST_PREDEF_OS_H -#define BOOST_PREDEF_OS_H -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/libraries/boost/include/boost/predef/os/aix.h b/libraries/boost/include/boost/predef/os/aix.h deleted file mode 100644 index 3e5a953f1b..0000000000 --- a/libraries/boost/include/boost/predef/os/aix.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_AIX_H -#define BOOST_PREDEF_OS_AIX_H - -#include -#include - -/*` -[heading `BOOST_OS_AIX`] - -[@http://en.wikipedia.org/wiki/AIX_operating_system IBM AIX] operating system. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`_AIX`] [__predef_detection__]] - [[`__TOS_AIX__`] [__predef_detection__]] - - [[`_AIX43`] [4.3.0]] - [[`_AIX41`] [4.1.0]] - [[`_AIX32`] [3.2.0]] - [[`_AIX3`] [3.0.0]] - ] - */ - -#define BOOST_OS_AIX BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(_AIX) || defined(__TOS_AIX__) \ - ) -# undef BOOST_OS_AIX -# if !defined(BOOST_OS_AIX) && defined(_AIX43) -# define BOOST_OS_AIX BOOST_VERSION_NUMBER(4,3,0) -# endif -# if !defined(BOOST_OS_AIX) && defined(_AIX41) -# define BOOST_OS_AIX BOOST_VERSION_NUMBER(4,1,0) -# endif -# if !defined(BOOST_OS_AIX) && defined(_AIX32) -# define BOOST_OS_AIX BOOST_VERSION_NUMBER(3,2,0) -# endif -# if !defined(BOOST_OS_AIX) && defined(_AIX3) -# define BOOST_OS_AIX BOOST_VERSION_NUMBER(3,0,0) -# endif -# if !defined(BOOST_OS_AIX) -# define BOOST_OS_AIX BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_OS_AIX -# define BOOST_OS_AIX_AVAILABLE -# include -#endif - -#define BOOST_OS_AIX_NAME "IBM AIX" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_AIX,BOOST_OS_AIX_NAME) diff --git a/libraries/boost/include/boost/predef/os/amigaos.h b/libraries/boost/include/boost/predef/os/amigaos.h deleted file mode 100644 index 7b32ddf59c..0000000000 --- a/libraries/boost/include/boost/predef/os/amigaos.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_AMIGAOS_H -#define BOOST_PREDEF_OS_AMIGAOS_H - -#include -#include - -/*` -[heading `BOOST_OS_AMIGAOS`] - -[@http://en.wikipedia.org/wiki/AmigaOS AmigaOS] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`AMIGA`] [__predef_detection__]] - [[`__amigaos__`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_AMIGAOS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(AMIGA) || defined(__amigaos__) \ - ) -# undef BOOST_OS_AMIGAOS -# define BOOST_OS_AMIGAOS BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_AMIGAOS -# define BOOST_OS_AMIGAOS_AVAILABLE -# include -#endif - -#define BOOST_OS_AMIGAOS_NAME "AmigaOS" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_AMIGAOS,BOOST_OS_AMIGAOS_NAME) diff --git a/libraries/boost/include/boost/predef/os/android.h b/libraries/boost/include/boost/predef/os/android.h deleted file mode 100644 index 125dbded9e..0000000000 --- a/libraries/boost/include/boost/predef/os/android.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright Rene Rivera 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_ANDROID_H -#define BOOST_PREDEF_OS_ANDROID_H - -#include -#include - -/*` -[heading `BOOST_OS_ANDROID`] - -[@http://en.wikipedia.org/wiki/Android_%28operating_system%29 Android] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__ANDROID__`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_ANDROID BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__ANDROID__) \ - ) -# undef BOOST_OS_ANDROID -# define BOOST_OS_ANDROID BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_ANDROID -# define BOOST_OS_ANDROID_AVAILABLE -# include -#endif - -#define BOOST_OS_ANDROID_NAME "Android" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_ANDROID,BOOST_OS_ANDROID_NAME) diff --git a/libraries/boost/include/boost/predef/os/beos.h b/libraries/boost/include/boost/predef/os/beos.h deleted file mode 100644 index 19f4cb71e3..0000000000 --- a/libraries/boost/include/boost/predef/os/beos.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_BEOS_H -#define BOOST_PREDEF_OS_BEOS_H - -#include -#include - -/*` -[heading `BOOST_OS_BEOS`] - -[@http://en.wikipedia.org/wiki/BeOS BeOS] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__BEOS__`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_BEOS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__BEOS__) \ - ) -# undef BOOST_OS_BEOS -# define BOOST_OS_BEOS BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_BEOS -# define BOOST_OS_BEOS_AVAILABLE -# include -#endif - -#define BOOST_OS_BEOS_NAME "BeOS" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BEOS,BOOST_OS_BEOS_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd.h b/libraries/boost/include/boost/predef/os/bsd.h deleted file mode 100644 index fad9aed787..0000000000 --- a/libraries/boost/include/boost/predef/os/bsd.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_BSD_H -#define BOOST_PREDEF_OS_BSD_H - -/* Special case: OSX will define BSD predefs if the sys/param.h - * header is included. We can guard against that, but only if we - * detect OSX first. Hence we will force include OSX detection - * before doing any BSD detection. - */ -#include - -#include -#include - -/*` -[heading `BOOST_OS_BSD`] - -[@http://en.wikipedia.org/wiki/Berkeley_Software_Distribution BSD] operating system. - -BSD has various branch operating systems possible and each detected -individually. This detects the following variations and sets a specific -version number macro to match: - -* `BOOST_OS_BSD_DRAGONFLY` [@http://en.wikipedia.org/wiki/DragonFly_BSD DragonFly BSD] -* `BOOST_OS_BSD_FREE` [@http://en.wikipedia.org/wiki/Freebsd FreeBSD] -* `BOOST_OS_BSD_BSDI` [@http://en.wikipedia.org/wiki/BSD/OS BSDi BSD/OS] -* `BOOST_OS_BSD_NET` [@http://en.wikipedia.org/wiki/Netbsd NetBSD] -* `BOOST_OS_BSD_OPEN` [@http://en.wikipedia.org/wiki/Openbsd OpenBSD] - -[note The general `BOOST_OS_BSD` is set in all cases to indicate some form -of BSD. If the above variants is detected the corresponding macro is also set.] - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`BSD`] [__predef_detection__]] - [[`_SYSTYPE_BSD`] [__predef_detection__]] - - [[`BSD4_2`] [4.2.0]] - [[`BSD4_3`] [4.3.0]] - [[`BSD4_4`] [4.4.0]] - [[`BSD`] [V.R.0]] - ] - */ - -#include -#include -#include -#include -#include - -#ifndef BOOST_OS_BSD -#define BOOST_OS_BSD BOOST_VERSION_NUMBER_NOT_AVAILABLE -#endif - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(BSD) || \ - defined(_SYSTYPE_BSD) \ - ) -# undef BOOST_OS_BSD -# include -# if !defined(BOOST_OS_BSD) && defined(BSD4_4) -# define BOOST_OS_BSD BOOST_VERSION_NUMBER(4,4,0) -# endif -# if !defined(BOOST_OS_BSD) && defined(BSD4_3) -# define BOOST_OS_BSD BOOST_VERSION_NUMBER(4,3,0) -# endif -# if !defined(BOOST_OS_BSD) && defined(BSD4_2) -# define BOOST_OS_BSD BOOST_VERSION_NUMBER(4,2,0) -# endif -# if !defined(BOOST_OS_BSD) && defined(BSD) -# define BOOST_OS_BSD BOOST_PREDEF_MAKE_10_VVRR(BSD) -# endif -# if !defined(BOOST_OS_BSD) -# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_OS_BSD -# define BOOST_OS_BSD_AVAILABLE -# include -#endif - -#define BOOST_OS_BSD_NAME "BSD" - -#else - -#include -#include -#include -#include -#include - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD,BOOST_OS_BSD_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd/bsdi.h b/libraries/boost/include/boost/predef/os/bsd/bsdi.h deleted file mode 100644 index afdcd3eb7c..0000000000 --- a/libraries/boost/include/boost/predef/os/bsd/bsdi.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright Rene Rivera 2012-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_BSD_BSDI_H -#define BOOST_PREDEF_OS_BSD_BSDI_H - -#include - -/*` -[heading `BOOST_OS_BSD_BSDI`] - -[@http://en.wikipedia.org/wiki/BSD/OS BSDi BSD/OS] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__bsdi__`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_BSD_BSDI BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__bsdi__) \ - ) -# ifndef BOOST_OS_BSD_AVAILABLE -# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE -# define BOOST_OS_BSD_AVAILABLE -# endif -# undef BOOST_OS_BSD_BSDI -# define BOOST_OS_BSD_BSDI BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_BSD_BSDI -# define BOOST_OS_BSD_BSDI_AVAILABLE -# include -#endif - -#define BOOST_OS_BSD_BSDI_NAME "BSDi BSD/OS" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_BSDI,BOOST_OS_BSD_BSDI_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd/dragonfly.h b/libraries/boost/include/boost/predef/os/bsd/dragonfly.h deleted file mode 100644 index 1d075798a1..0000000000 --- a/libraries/boost/include/boost/predef/os/bsd/dragonfly.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -Copyright Rene Rivera 2012-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_BSD_DRAGONFLY_H -#define BOOST_PREDEF_OS_BSD_DRAGONFLY_H - -#include - -/*` -[heading `BOOST_OS_BSD_DRAGONFLY`] - -[@http://en.wikipedia.org/wiki/DragonFly_BSD DragonFly BSD] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__DragonFly__`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_BSD_DRAGONFLY BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__DragonFly__) \ - ) -# ifndef BOOST_OS_BSD_AVAILABLE -# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE -# define BOOST_OS_BSD_AVAILABLE -# endif -# undef BOOST_OS_BSD_DRAGONFLY -# if defined(__DragonFly__) -# define BOOST_OS_DRAGONFLY_BSD BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_OS_BSD_DRAGONFLY -# define BOOST_OS_BSD_DRAGONFLY_AVAILABLE -# include -#endif - -#define BOOST_OS_BSD_DRAGONFLY_NAME "DragonFly BSD" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_DRAGONFLY,BOOST_OS_BSD_DRAGONFLY_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd/free.h b/libraries/boost/include/boost/predef/os/bsd/free.h deleted file mode 100644 index 81c002109d..0000000000 --- a/libraries/boost/include/boost/predef/os/bsd/free.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright Rene Rivera 2012-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_BSD_FREE_H -#define BOOST_PREDEF_OS_BSD_FREE_H - -#include - -/*` -[heading `BOOST_OS_BSD_FREE`] - -[@http://en.wikipedia.org/wiki/Freebsd FreeBSD] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__FreeBSD__`] [__predef_detection__]] - - [[`__FreeBSD_version`] [V.R.P]] - ] - */ - -#define BOOST_OS_BSD_FREE BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__FreeBSD__) \ - ) -# ifndef BOOST_OS_BSD_AVAILABLE -# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE -# define BOOST_OS_BSD_AVAILABLE -# endif -# undef BOOST_OS_BSD_FREE -# include -# if defined(__FreeBSD_version) -# if __FreeBSD_version == 491000 -# define BOOST_OS_BSD_FREE \ - BOOST_VERSION_NUMBER(4, 10, 0) -# elif __FreeBSD_version == 492000 -# define BOOST_OS_BSD_FREE \ - BOOST_VERSION_NUMBER(4, 11, 0) -# elif __FreeBSD_version < 500000 -# define BOOST_OS_BSD_FREE \ - BOOST_PREDEF_MAKE_10_VRPPPP(__FreeBSD_version) -# else -# define BOOST_OS_BSD_FREE \ - BOOST_PREDEF_MAKE_10_VVRRPPP(__FreeBSD_version) -# endif -# else -# define BOOST_OS_BSD_FREE BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_OS_BSD_FREE -# define BOOST_OS_BSD_FREE_AVAILABLE -# include -#endif - -#define BOOST_OS_BSD_FREE_NAME "Free BSD" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_FREE,BOOST_OS_BSD_FREE_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd/net.h b/libraries/boost/include/boost/predef/os/bsd/net.h deleted file mode 100644 index 387cbde54f..0000000000 --- a/libraries/boost/include/boost/predef/os/bsd/net.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright Rene Rivera 2012-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_BSD_NET_H -#define BOOST_PREDEF_OS_BSD_NET_H - -#include - -/*` -[heading `BOOST_OS_BSD_NET`] - -[@http://en.wikipedia.org/wiki/Netbsd NetBSD] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__NETBSD__`] [__predef_detection__]] - [[`__NetBSD__`] [__predef_detection__]] - - [[`__NETBSD_version`] [V.R.P]] - [[`NetBSD0_8`] [0.8.0]] - [[`NetBSD0_9`] [0.9.0]] - [[`NetBSD1_0`] [1.0.0]] - [[`__NetBSD_Version`] [V.R.P]] - ] - */ - -#define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__NETBSD__) || defined(__NetBSD__) \ - ) -# ifndef BOOST_OS_BSD_AVAILABLE -# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE -# define BOOST_OS_BSD_AVAILABLE -# endif -# undef BOOST_OS_BSD_NET -# if defined(__NETBSD__) -# if defined(__NETBSD_version) -# if __NETBSD_version < 500000 -# define BOOST_OS_BSD_NET \ - BOOST_PREDEF_MAKE_10_VRP000(__NETBSD_version) -# else -# define BOOST_OS_BSD_NET \ - BOOST_PREDEF_MAKE_10_VRR000(__NETBSD_version) -# endif -# else -# define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER_AVAILABLE -# endif -# elif defined(__NetBSD__) -# if !defined(BOOST_OS_BSD_NET) && defined(NetBSD0_8) -# define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER(0,8,0) -# endif -# if !defined(BOOST_OS_BSD_NET) && defined(NetBSD0_9) -# define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER(0,9,0) -# endif -# if !defined(BOOST_OS_BSD_NET) && defined(NetBSD1_0) -# define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER(1,0,0) -# endif -# if !defined(BOOST_OS_BSD_NET) && defined(__NetBSD_Version) -# define BOOST_OS_BSD_NET \ - BOOST_PREDEF_MAKE_10_VVRR00PP00(__NetBSD_Version) -# endif -# if !defined(BOOST_OS_BSD_NET) -# define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER_AVAILABLE -# endif -# endif -#endif - -#if BOOST_OS_BSD_NET -# define BOOST_OS_BSD_NET_AVAILABLE -# include -#endif - -#define BOOST_OS_BSD_NET_NAME "DragonFly BSD" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_NET,BOOST_OS_BSD_NET_NAME) diff --git a/libraries/boost/include/boost/predef/os/bsd/open.h b/libraries/boost/include/boost/predef/os/bsd/open.h deleted file mode 100644 index f6ccd24a9b..0000000000 --- a/libraries/boost/include/boost/predef/os/bsd/open.h +++ /dev/null @@ -1,251 +0,0 @@ -/* -Copyright Rene Rivera 2012-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_BSD_OPEN_H -#define BOOST_PREDEF_OS_BSD_OPEN_H - -#include - -/*` -[heading `BOOST_OS_BSD_OPEN`] - -[@http://en.wikipedia.org/wiki/Openbsd OpenBSD] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__OpenBSD__`] [__predef_detection__]] - - [[`OpenBSD2_0`] [2.0.0]] - [[`OpenBSD2_1`] [2.1.0]] - [[`OpenBSD2_2`] [2.2.0]] - [[`OpenBSD2_3`] [2.3.0]] - [[`OpenBSD2_4`] [2.4.0]] - [[`OpenBSD2_5`] [2.5.0]] - [[`OpenBSD2_6`] [2.6.0]] - [[`OpenBSD2_7`] [2.7.0]] - [[`OpenBSD2_8`] [2.8.0]] - [[`OpenBSD2_9`] [2.9.0]] - [[`OpenBSD3_0`] [3.0.0]] - [[`OpenBSD3_1`] [3.1.0]] - [[`OpenBSD3_2`] [3.2.0]] - [[`OpenBSD3_3`] [3.3.0]] - [[`OpenBSD3_4`] [3.4.0]] - [[`OpenBSD3_5`] [3.5.0]] - [[`OpenBSD3_6`] [3.6.0]] - [[`OpenBSD3_7`] [3.7.0]] - [[`OpenBSD3_8`] [3.8.0]] - [[`OpenBSD3_9`] [3.9.0]] - [[`OpenBSD4_0`] [4.0.0]] - [[`OpenBSD4_1`] [4.1.0]] - [[`OpenBSD4_2`] [4.2.0]] - [[`OpenBSD4_3`] [4.3.0]] - [[`OpenBSD4_4`] [4.4.0]] - [[`OpenBSD4_5`] [4.5.0]] - [[`OpenBSD4_6`] [4.6.0]] - [[`OpenBSD4_7`] [4.7.0]] - [[`OpenBSD4_8`] [4.8.0]] - [[`OpenBSD4_9`] [4.9.0]] - [[`OpenBSD5_0`] [5.0.0]] - [[`OpenBSD5_1`] [5.1.0]] - [[`OpenBSD5_2`] [5.2.0]] - [[`OpenBSD5_3`] [5.3.0]] - [[`OpenBSD5_4`] [5.4.0]] - [[`OpenBSD5_5`] [5.5.0]] - [[`OpenBSD5_6`] [5.6.0]] - [[`OpenBSD5_7`] [5.7.0]] - [[`OpenBSD5_8`] [5.8.0]] - [[`OpenBSD5_9`] [5.9.0]] - [[`OpenBSD6_0`] [6.0.0]] - [[`OpenBSD6_1`] [6.1.0]] - [[`OpenBSD6_2`] [6.2.0]] - [[`OpenBSD6_3`] [6.3.0]] - [[`OpenBSD6_4`] [6.4.0]] - [[`OpenBSD6_5`] [6.5.0]] - [[`OpenBSD6_6`] [6.6.0]] - [[`OpenBSD6_7`] [6.7.0]] - [[`OpenBSD6_8`] [6.8.0]] - [[`OpenBSD6_9`] [6.9.0]] - ] - */ - -#define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__OpenBSD__) \ - ) -# ifndef BOOST_OS_BSD_AVAILABLE -# define BOOST_OS_BSD BOOST_VERSION_NUMBER_AVAILABLE -# define BOOST_OS_BSD_AVAILABLE -# endif -# undef BOOST_OS_BSD_OPEN -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_0) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,0,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_1) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,1,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_2) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,2,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_3) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,3,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_4) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,4,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_5) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,5,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_6) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,6,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_7) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,7,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_8) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,8,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD2_9) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(2,9,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_0) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,0,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_1) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,1,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_2) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,2,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_3) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,3,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_4) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,4,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_5) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,5,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_6) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,6,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_7) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,7,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_8) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,8,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD3_9) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(3,9,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_0) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,0,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_1) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,1,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_2) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,2,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_3) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,3,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_4) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,4,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_5) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,5,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_6) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,6,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_7) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,7,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_8) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,8,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD4_9) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(4,9,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_0) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,0,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_1) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,1,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_2) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,2,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_3) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,3,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_4) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,4,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_5) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,5,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_6) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,6,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_7) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,7,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_8) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,8,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD5_9) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(5,9,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_0) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,0,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_1) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,1,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_2) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,2,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_3) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,3,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_4) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,4,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_5) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,5,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_6) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,6,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_7) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,7,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_8) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,8,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) && defined(OpenBSD6_9) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER(6,9,0) -# endif -# if !defined(BOOST_OS_BSD_OPEN) -# define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_OS_BSD_OPEN -# define BOOST_OS_BSD_OPEN_AVAILABLE -# include -#endif - -#define BOOST_OS_BSD_OPEN_NAME "OpenBSD" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_BSD_OPEN,BOOST_OS_BSD_OPEN_NAME) diff --git a/libraries/boost/include/boost/predef/os/cygwin.h b/libraries/boost/include/boost/predef/os/cygwin.h deleted file mode 100644 index 9d36f0f317..0000000000 --- a/libraries/boost/include/boost/predef/os/cygwin.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_CYGWIN_H -#define BOOST_PREDEF_OS_CYGWIN_H - -#include -#include - -/*` -[heading `BOOST_OS_CYGWIN`] - -[@http://en.wikipedia.org/wiki/Cygwin Cygwin] evironment. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__CYGWIN__`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_CYGWIN BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__CYGWIN__) \ - ) -# undef BOOST_OS_CYGWIN -# define BOOST_OS_CYGWIN BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_CYGWIN -# define BOOST_OS_CYGWIN_AVAILABLE -# include -#endif - -#define BOOST_OS_CYGWIN_NAME "Cygwin" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_CYGWIN,BOOST_OS_CYGWIN_NAME) diff --git a/libraries/boost/include/boost/predef/os/haiku.h b/libraries/boost/include/boost/predef/os/haiku.h deleted file mode 100644 index d79dbeac88..0000000000 --- a/libraries/boost/include/boost/predef/os/haiku.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright Jessica Hamilton 2014 -Copyright Rene Rivera 2014-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_HAIKU_H -#define BOOST_PREDEF_OS_HAIKU_H - -#include -#include - -/*` -[heading `BOOST_OS_HAIKU`] - -[@http://en.wikipedia.org/wiki/Haiku_(operating_system) Haiku] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__HAIKU__`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_HAIKU BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__HAIKU__) \ - ) -# undef BOOST_OS_HAIKU -# define BOOST_OS_HAIKU BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_HAIKU -# define BOOST_OS_HAIKU_AVAILABLE -# include -#endif - -#define BOOST_OS_HAIKU_NAME "Haiku" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_HAIKU,BOOST_OS_HAIKU_NAME) diff --git a/libraries/boost/include/boost/predef/os/hpux.h b/libraries/boost/include/boost/predef/os/hpux.h deleted file mode 100644 index 29243f4879..0000000000 --- a/libraries/boost/include/boost/predef/os/hpux.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_HPUX_H -#define BOOST_PREDEF_OS_HPUX_H - -#include -#include - -/*` -[heading `BOOST_OS_HPUX`] - -[@http://en.wikipedia.org/wiki/HP-UX HP-UX] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`hpux`] [__predef_detection__]] - [[`_hpux`] [__predef_detection__]] - [[`__hpux`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_HPUX BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(hpux) || defined(_hpux) || defined(__hpux) \ - ) -# undef BOOST_OS_HPUX -# define BOOST_OS_HPUX BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_HPUX -# define BOOST_OS_HPUX_AVAILABLE -# include -#endif - -#define BOOST_OS_HPUX_NAME "HP-UX" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_HPUX,BOOST_OS_HPUX_NAME) diff --git a/libraries/boost/include/boost/predef/os/ios.h b/libraries/boost/include/boost/predef/os/ios.h deleted file mode 100644 index f853815a6d..0000000000 --- a/libraries/boost/include/boost/predef/os/ios.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright Franz Detro 2014 -Copyright Rene Rivera 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_IOS_H -#define BOOST_PREDEF_OS_IOS_H - -#include -#include - -/*` -[heading `BOOST_OS_IOS`] - -[@http://en.wikipedia.org/wiki/iOS iOS] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__APPLE__`] [__predef_detection__]] - [[`__MACH__`] [__predef_detection__]] - [[`__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__`] [__predef_detection__]] - - [[`__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__`] [__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000]] - ] - */ - -#define BOOST_OS_IOS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__APPLE__) && defined(__MACH__) && \ - defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) \ - ) -# undef BOOST_OS_IOS -# define BOOST_OS_IOS (__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000) -#endif - -#if BOOST_OS_IOS -# define BOOST_OS_IOS_AVAILABLE -# include -#endif - -#define BOOST_OS_IOS_NAME "iOS" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_IOS,BOOST_OS_IOS_NAME) diff --git a/libraries/boost/include/boost/predef/os/irix.h b/libraries/boost/include/boost/predef/os/irix.h deleted file mode 100644 index fa6ac41dcd..0000000000 --- a/libraries/boost/include/boost/predef/os/irix.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_IRIX_H -#define BOOST_PREDEF_OS_IRIX_H - -#include -#include - -/*` -[heading `BOOST_OS_IRIX`] - -[@http://en.wikipedia.org/wiki/Irix IRIX] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`sgi`] [__predef_detection__]] - [[`__sgi`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_IRIX BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(sgi) || defined(__sgi) \ - ) -# undef BOOST_OS_IRIX -# define BOOST_OS_IRIX BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_IRIX -# define BOOST_OS_IRIX_AVAILABLE -# include -#endif - -#define BOOST_OS_IRIX_NAME "IRIX" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_IRIX,BOOST_OS_IRIX_NAME) diff --git a/libraries/boost/include/boost/predef/os/linux.h b/libraries/boost/include/boost/predef/os/linux.h deleted file mode 100644 index a297d08954..0000000000 --- a/libraries/boost/include/boost/predef/os/linux.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_LINUX_H -#define BOOST_PREDEF_OS_LINUX_H - -#include -#include - -/*` -[heading `BOOST_OS_LINUX`] - -[@http://en.wikipedia.org/wiki/Linux Linux] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`linux`] [__predef_detection__]] - [[`__linux`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_LINUX BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(linux) || defined(__linux) \ - ) -# undef BOOST_OS_LINUX -# define BOOST_OS_LINUX BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_LINUX -# define BOOST_OS_LINUX_AVAILABLE -# include -#endif - -#define BOOST_OS_LINUX_NAME "Linux" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_LINUX,BOOST_OS_LINUX_NAME) diff --git a/libraries/boost/include/boost/predef/os/macos.h b/libraries/boost/include/boost/predef/os/macos.h deleted file mode 100644 index 4afb30d087..0000000000 --- a/libraries/boost/include/boost/predef/os/macos.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Copyright Franz Detro 2014 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_MACOS_H -#define BOOST_PREDEF_OS_MACOS_H - -/* Special case: iOS will define the same predefs as MacOS, and additionally - '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__'. We can guard against that, - but only if we detect iOS first. Hence we will force include iOS detection - * before doing any MacOS detection. - */ -#include - -#include -#include - -/*` -[heading `BOOST_OS_MACOS`] - -[@http://en.wikipedia.org/wiki/Mac_OS Mac OS] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`macintosh`] [__predef_detection__]] - [[`Macintosh`] [__predef_detection__]] - [[`__APPLE__`] [__predef_detection__]] - [[`__MACH__`] [__predef_detection__]] - - [[`__APPLE__`, `__MACH__`] [10.0.0]] - [[ /otherwise/ ] [9.0.0]] - ] - */ - -#define BOOST_OS_MACOS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(macintosh) || defined(Macintosh) || \ - (defined(__APPLE__) && defined(__MACH__)) \ - ) -# undef BOOST_OS_MACOS -# if !defined(BOOST_OS_MACOS) && defined(__APPLE__) && defined(__MACH__) -# define BOOST_OS_MACOS BOOST_VERSION_NUMBER(10,0,0) -# endif -# if !defined(BOOST_OS_MACOS) -# define BOOST_OS_MACOS BOOST_VERSION_NUMBER(9,0,0) -# endif -#endif - -#if BOOST_OS_MACOS -# define BOOST_OS_MACOS_AVAILABLE -# include -#endif - -#define BOOST_OS_MACOS_NAME "Mac OS" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_MACOS,BOOST_OS_MACOS_NAME) diff --git a/libraries/boost/include/boost/predef/os/os400.h b/libraries/boost/include/boost/predef/os/os400.h deleted file mode 100644 index b3446c26c9..0000000000 --- a/libraries/boost/include/boost/predef/os/os400.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright Rene Rivera 2011-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_OS400_H -#define BOOST_PREDEF_OS_OS400_H - -#include -#include - -/*` -[heading `BOOST_OS_OS400`] - -[@http://en.wikipedia.org/wiki/IBM_i IBM OS/400] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__OS400__`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_OS400 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__OS400__) \ - ) -# undef BOOST_OS_OS400 -# define BOOST_OS_OS400 BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_OS400 -# define BOOST_OS_OS400_AVAILABLE -# include -#endif - -#define BOOST_OS_OS400_NAME "IBM OS/400" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_OS400,BOOST_OS_OS400_NAME) diff --git a/libraries/boost/include/boost/predef/os/qnxnto.h b/libraries/boost/include/boost/predef/os/qnxnto.h deleted file mode 100644 index e76fbf2781..0000000000 --- a/libraries/boost/include/boost/predef/os/qnxnto.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_QNXNTO_H -#define BOOST_PREDEF_OS_QNXNTO_H - -#include -#include - -/*` -[heading `BOOST_OS_QNX`] - -[@http://en.wikipedia.org/wiki/QNX QNX] operating system. -Version number available as major, and minor if possible. And -version 4 is specifically detected. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__QNX__`] [__predef_detection__]] - [[`__QNXNTO__`] [__predef_detection__]] - - [[`_NTO_VERSION`] [V.R.0]] - [[`__QNX__`] [4.0.0]] - ] - */ - -#define BOOST_OS_QNX BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__QNX__) || defined(__QNXNTO__) \ - ) -# undef BOOST_OS_QNX -# if !defined(BOOST_OS_QNX) && defined(_NTO_VERSION) -# define BOOST_OS_QNX BOOST_PREDEF_MAKE_10_VVRR(_NTO_VERSION) -# endif -# if !defined(BOOST_OS_QNX) && defined(__QNX__) -# define BOOST_OS_QNX BOOST_VERSION_NUMBER(4,0,0) -# endif -# if !defined(BOOST_OS_QNX) -# define BOOST_OS_QNX BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_OS_QNX -# define BOOST_OS_QNX_AVAILABLE -# include -#endif - -#define BOOST_OS_QNX_NAME "QNX" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_QNX,BOOST_OS_QNX_NAME) diff --git a/libraries/boost/include/boost/predef/os/solaris.h b/libraries/boost/include/boost/predef/os/solaris.h deleted file mode 100644 index 75ddc91dae..0000000000 --- a/libraries/boost/include/boost/predef/os/solaris.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_SOLARIS_H -#define BOOST_PREDEF_OS_SOLARIS_H - -#include -#include - -/*` -[heading `BOOST_OS_SOLARIS`] - -[@http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`sun`] [__predef_detection__]] - [[`__sun`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_SOLARIS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(sun) || defined(__sun) \ - ) -# undef BOOST_OS_SOLARIS -# define BOOST_OS_SOLARIS BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_SOLARIS -# define BOOST_OS_SOLARIS_AVAILABLE -# include -#endif - -#define BOOST_OS_SOLARIS_NAME "Solaris" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_SOLARIS,BOOST_OS_SOLARIS_NAME) diff --git a/libraries/boost/include/boost/predef/os/unix.h b/libraries/boost/include/boost/predef/os/unix.h deleted file mode 100644 index a60710427a..0000000000 --- a/libraries/boost/include/boost/predef/os/unix.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_UNIX_H -#define BOOST_PREDEF_OS_UNIX_H - -#include -#include - -/*` -[heading `BOOST_OS_UNIX`] - -[@http://en.wikipedia.org/wiki/Unix Unix Environment] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`unix`] [__predef_detection__]] - [[`__unix`] [__predef_detection__]] - [[`_XOPEN_SOURCE`] [__predef_detection__]] - [[`_POSIX_SOURCE`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_UNIX BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(unix) || defined(__unix) || \ - defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) -# undef BOOST_OS_UNIX -# define BOOST_OS_UNIX BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_UNIX -# define BOOST_OS_UNIX_AVAILABLE -#endif - -#define BOOST_OS_UNIX_NAME "Unix Environment" - -/*` -[heading `BOOST_OS_SVR4`] - -[@http://en.wikipedia.org/wiki/UNIX_System_V SVR4 Environment] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__sysv__`] [__predef_detection__]] - [[`__SVR4`] [__predef_detection__]] - [[`__svr4__`] [__predef_detection__]] - [[`_SYSTYPE_SVR4`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_SVR4 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__sysv__) || defined(__SVR4) || \ - defined(__svr4__) || defined(_SYSTYPE_SVR4) -# undef BOOST_OS_SVR4 -# define BOOST_OS_SVR4 BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_SVR4 -# define BOOST_OS_SVR4_AVAILABLE -#endif - -#define BOOST_OS_SVR4_NAME "SVR4 Environment" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_UNIX,BOOST_OS_UNIX_NAME) -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_SVR4,BOOST_OS_SVR4_NAME) diff --git a/libraries/boost/include/boost/predef/os/vms.h b/libraries/boost/include/boost/predef/os/vms.h deleted file mode 100644 index 2f8f786d4e..0000000000 --- a/libraries/boost/include/boost/predef/os/vms.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright Rene Rivera 2011-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_VMS_H -#define BOOST_PREDEF_OS_VMS_H - -#include -#include - -/*` -[heading `BOOST_OS_VMS`] - -[@http://en.wikipedia.org/wiki/Vms VMS] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`VMS`] [__predef_detection__]] - [[`__VMS`] [__predef_detection__]] - - [[`__VMS_VER`] [V.R.P]] - ] - */ - -#define BOOST_OS_VMS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(VMS) || defined(__VMS) \ - ) -# undef BOOST_OS_VMS -# if defined(__VMS_VER) -# define BOOST_OS_VMS BOOST_PREDEF_MAKE_10_VVRR00PP00(__VMS_VER) -# else -# define BOOST_OS_VMS BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_OS_VMS -# define BOOST_OS_VMS_AVAILABLE -# include -#endif - -#define BOOST_OS_VMS_NAME "VMS" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_VMS,BOOST_OS_VMS_NAME) diff --git a/libraries/boost/include/boost/predef/os/windows.h b/libraries/boost/include/boost/predef/os/windows.h deleted file mode 100644 index 9db4390950..0000000000 --- a/libraries/boost/include/boost/predef/os/windows.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_OS_WINDOWS_H -#define BOOST_PREDEF_OS_WINDOWS_H - -#include -#include - -/*` -[heading `BOOST_OS_WINDOWS`] - -[@http://en.wikipedia.org/wiki/Category:Microsoft_Windows Microsoft Windows] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`_WIN32`] [__predef_detection__]] - [[`_WIN64`] [__predef_detection__]] - [[`__WIN32__`] [__predef_detection__]] - [[`__TOS_WIN__`] [__predef_detection__]] - [[`__WINDOWS__`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_WINDOWS BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(_WIN32) || defined(_WIN64) || \ - defined(__WIN32__) || defined(__TOS_WIN__) || \ - defined(__WINDOWS__) \ - ) -# undef BOOST_OS_WINDOWS -# define BOOST_OS_WINDOWS BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_WINDOWS -# define BOOST_OS_WINDOWS_AVAILABLE -# include -#endif - -#define BOOST_OS_WINDOWS_NAME "Microsoft Windows" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_WINDOWS,BOOST_OS_WINDOWS_NAME) diff --git a/libraries/boost/include/boost/predef/other.h b/libraries/boost/include/boost/predef/other.h deleted file mode 100644 index c09ad4945f..0000000000 --- a/libraries/boost/include/boost/predef/other.h +++ /dev/null @@ -1,16 +0,0 @@ -/* -Copyright Rene Rivera 2013-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#if !defined(BOOST_PREDEF_OTHER_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) -#ifndef BOOST_PREDEF_OTHER_H -#define BOOST_PREDEF_OTHER_H -#endif - -#include -/*#include */ - -#endif diff --git a/libraries/boost/include/boost/predef/other/endian.h b/libraries/boost/include/boost/predef/other/endian.h deleted file mode 100644 index 6d1f43ff4d..0000000000 --- a/libraries/boost/include/boost/predef/other/endian.h +++ /dev/null @@ -1,204 +0,0 @@ -/* -Copyright Rene Rivera 2013-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_ENDIAN_H -#define BOOST_PREDEF_ENDIAN_H - -#include -#include -#include -#include -#include -#include - -/*` -[heading `BOOST_ENDIAN_*`] - -Detection of endian memory ordering. There are four defined macros -in this header that define the various generally possible endian -memory orderings: - -* `BOOST_ENDIAN_BIG_BYTE`, byte-swapped big-endian. -* `BOOST_ENDIAN_BIG_WORD`, word-swapped big-endian. -* `BOOST_ENDIAN_LITTLE_BYTE`, byte-swapped little-endian. -* `BOOST_ENDIAN_LITTLE_WORD`, word-swapped little-endian. - -The detection is conservative in that it only identifies endianness -that it knows for certain. In particular bi-endianness is not -indicated as is it not practically possible to determine the -endianness from anything but an operating system provided -header. And the currently known headers do not define that -programatic bi-endianness is available. - -This implementation is a compilation of various publicly available -information and acquired knowledge: - -# The indispensable documentation of "Pre-defined Compiler Macros" - [@http://sourceforge.net/p/predef/wiki/Endianness Endianness]. -# The various endian specifications available in the - [@http://wikipedia.org/ Wikipedia] computer architecture pages. -# Generally available searches for headers that define endianness. - */ - -#define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE -#define BOOST_ENDIAN_BIG_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE -#define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE -#define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE - -/* GNU libc provides a header defining __BYTE_ORDER, or _BYTE_ORDER. - * And some OSs provide some for of endian header also. - */ -#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ - !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD -# if BOOST_LIB_C_GNU || BOOST_OS_ANDROID -# include -# else -# if BOOST_OS_MACOS -# include -# else -# if BOOST_OS_BSD -# if BOOST_OS_BSD_OPEN -# include -# else -# include -# endif -# endif -# endif -# endif -# if defined(__BYTE_ORDER) -# if defined(__BIG_ENDIAN) && (__BYTE_ORDER == __BIG_ENDIAN) -# undef BOOST_ENDIAN_BIG_BYTE -# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE -# endif -# if defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == __LITTLE_ENDIAN) -# undef BOOST_ENDIAN_LITTLE_BYTE -# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE -# endif -# if defined(__PDP_ENDIAN) && (__BYTE_ORDER == __PDP_ENDIAN) -# undef BOOST_ENDIAN_LITTLE_WORD -# define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE -# endif -# endif -# if !defined(__BYTE_ORDER) && defined(_BYTE_ORDER) -# if defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN) -# undef BOOST_ENDIAN_BIG_BYTE -# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE -# endif -# if defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN) -# undef BOOST_ENDIAN_LITTLE_BYTE -# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE -# endif -# if defined(_PDP_ENDIAN) && (_BYTE_ORDER == _PDP_ENDIAN) -# undef BOOST_ENDIAN_LITTLE_WORD -# define BOOST_ENDIAN_LITTLE_WORD BOOST_VERSION_NUMBER_AVAILABLE -# endif -# endif -#endif - -/* Built-in byte-swpped big-endian macros. - */ -#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ - !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD -# if (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)) || \ - (defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)) || \ - defined(__ARMEB__) || \ - defined(__THUMBEB__) || \ - defined(__AARCH64EB__) || \ - defined(_MIPSEB) || \ - defined(__MIPSEB) || \ - defined(__MIPSEB__) -# undef BOOST_ENDIAN_BIG_BYTE -# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -/* Built-in byte-swpped little-endian macros. - */ -#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ - !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD -# if (defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)) || \ - (defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) || \ - defined(__ARMEL__) || \ - defined(__THUMBEL__) || \ - defined(__AARCH64EL__) || \ - defined(_MIPSEL) || \ - defined(__MIPSEL) || \ - defined(__MIPSEL__) -# undef BOOST_ENDIAN_LITTLE_BYTE -# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -/* Some architectures are strictly one endianess (as opposed - * the current common bi-endianess). - */ -#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ - !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD -# include -# if BOOST_ARCH_M68K || \ - BOOST_ARCH_PARISC || \ - BOOST_ARCH_SPARC || \ - BOOST_ARCH_SYS370 || \ - BOOST_ARCH_SYS390 || \ - BOOST_ARCH_Z -# undef BOOST_ENDIAN_BIG_BYTE -# define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_AVAILABLE -# endif -# if BOOST_ARCH_AMD64 || \ - BOOST_ARCH_IA64 || \ - BOOST_ARCH_X86 || \ - BOOST_ARCH_BLACKFIN -# undef BOOST_ENDIAN_LITTLE_BYTE -# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -/* Windows on ARM, if not otherwise detected/specified, is always - * byte-swaped little-endian. - */ -#if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ - !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD -# if BOOST_ARCH_ARM -# include -# if BOOST_OS_WINDOWS -# undef BOOST_ENDIAN_LITTLE_BYTE -# define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE -# endif -# endif -#endif - -#if BOOST_ENDIAN_BIG_BYTE -# define BOOST_ENDIAN_BIG_BYTE_AVAILABLE -#endif -#if BOOST_ENDIAN_BIG_WORD -# define BOOST_ENDIAN_BIG_WORD_BYTE_AVAILABLE -#endif -#if BOOST_ENDIAN_LITTLE_BYTE -# define BOOST_ENDIAN_LITTLE_BYTE_AVAILABLE -#endif -#if BOOST_ENDIAN_LITTLE_WORD -# define BOOST_ENDIAN_LITTLE_WORD_BYTE_AVAILABLE -#endif - -#define BOOST_ENDIAN_BIG_BYTE_NAME "Byte-Swapped Big-Endian" -#define BOOST_ENDIAN_BIG_WORD_NAME "Word-Swapped Big-Endian" -#define BOOST_ENDIAN_LITTLE_BYTE_NAME "Byte-Swapped Little-Endian" -#define BOOST_ENDIAN_LITTLE_WORD_NAME "Word-Swapped Little-Endian" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_BYTE,BOOST_ENDIAN_BIG_BYTE_NAME) - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_BIG_WORD,BOOST_ENDIAN_BIG_WORD_NAME) - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_BYTE,BOOST_ENDIAN_LITTLE_BYTE_NAME) - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_ENDIAN_LITTLE_WORD,BOOST_ENDIAN_LITTLE_WORD_NAME) diff --git a/libraries/boost/include/boost/predef/platform.h b/libraries/boost/include/boost/predef/platform.h deleted file mode 100644 index 6c366d595c..0000000000 --- a/libraries/boost/include/boost/predef/platform.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright Rene Rivera 2013-2015 -Copyright (c) Microsoft Corporation 2014 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#if !defined(BOOST_PREDEF_PLATFORM_H) || defined(BOOST_PREDEF_INTERNAL_GENERATE_TESTS) -#ifndef BOOST_PREDEF_PLATFORM_H -#define BOOST_PREDEF_PLATFORM_H -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // deprecated -#include -/*#include */ - -#endif diff --git a/libraries/boost/include/boost/predef/platform/cloudabi.h b/libraries/boost/include/boost/predef/platform/cloudabi.h deleted file mode 100644 index c44f689454..0000000000 --- a/libraries/boost/include/boost/predef/platform/cloudabi.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright 2017 James E. King, III - Distributed under the Boost Software License, Version 1.0. - (See accompanying file LICENSE_1_0.txt or copy at - http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_CLOUDABI_H -#define BOOST_PREDEF_PLAT_CLOUDABI_H - -#include -#include - -/*` -[heading `BOOST_PLAT_CLOUDABI`] - -[@https://github.com/NuxiNL/cloudabi CloudABI] platform. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__CloudABI__`] [__predef_detection__]] - ] - */ - -#define BOOST_PLAT_CLOUDABI BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__CloudABI__) -# undef BOOST_PLAT_CLOUDABI -# define BOOST_PLAT_CLOUDABI BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_PLAT_CLOUDABI -# define BOOST_PLAT_CLOUDABI_AVAILABLE -# include -#endif - -#define BOOST_PLAT_CLOUDABI_NAME "CloudABI" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_CLOUDABI,BOOST_PLAT_CLOUDABI_NAME) diff --git a/libraries/boost/include/boost/predef/platform/ios.h b/libraries/boost/include/boost/predef/platform/ios.h deleted file mode 100644 index af1c364cf0..0000000000 --- a/libraries/boost/include/boost/predef/platform/ios.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright Ruslan Baratov 2017 -Copyright Rene Rivera 2017 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_IOS_H -#define BOOST_PREDEF_PLAT_IOS_H - -#include // BOOST_OS_IOS -#include // BOOST_VERSION_NUMBER_NOT_AVAILABLE - -/*` -[heading `BOOST_PLAT_IOS_DEVICE`] -[heading `BOOST_PLAT_IOS_SIMULATOR`] - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`TARGET_IPHONE_SIMULATOR`] [__predef_detection__]] - ] - */ - -#define BOOST_PLAT_IOS_DEVICE BOOST_VERSION_NUMBER_NOT_AVAILABLE -#define BOOST_PLAT_IOS_SIMULATOR BOOST_VERSION_NUMBER_NOT_AVAILABLE - -// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h -#if BOOST_OS_IOS -# include -# if TARGET_IPHONE_SIMULATOR == 1 -# undef BOOST_PLAT_IOS_SIMULATOR -# define BOOST_PLAT_IOS_SIMULATOR BOOST_VERSION_NUMBER_AVAILABLE -# else -# undef BOOST_PLAT_IOS_DEVICE -# define BOOST_PLAT_IOS_DEVICE BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#if BOOST_PLAT_IOS_SIMULATOR -# define BOOST_PLAT_IOS_SIMULATOR_AVAILABLE -# include -#endif - -#if BOOST_PLAT_IOS_DEVICE -# define BOOST_PLAT_IOS_DEVICE_AVAILABLE -# include -#endif - -#define BOOST_PLAT_IOS_SIMULATOR_NAME "iOS Simulator" -#define BOOST_PLAT_IOS_DEVICE_NAME "iOS Device" - -#endif // BOOST_PREDEF_PLAT_IOS_H - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_IOS_SIMULATOR,BOOST_PLAT_IOS_SIMULATOR_NAME) -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_IOS_DEVICE,BOOST_PLAT_IOS_DEVICE_NAME) diff --git a/libraries/boost/include/boost/predef/platform/mingw.h b/libraries/boost/include/boost/predef/platform/mingw.h deleted file mode 100644 index c52827d7d8..0000000000 --- a/libraries/boost/include/boost/predef/platform/mingw.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_MINGW_H -#define BOOST_PREDEF_PLAT_MINGW_H - -#include -#include - -/*` -[heading `BOOST_PLAT_MINGW`] - -[@http://en.wikipedia.org/wiki/MinGW MinGW] platform, either variety. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__MINGW32__`] [__predef_detection__]] - [[`__MINGW64__`] [__predef_detection__]] - - [[`__MINGW64_VERSION_MAJOR`, `__MINGW64_VERSION_MINOR`] [V.R.0]] - [[`__MINGW32_VERSION_MAJOR`, `__MINGW32_VERSION_MINOR`] [V.R.0]] - ] - */ - -#define BOOST_PLAT_MINGW BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__MINGW32__) || defined(__MINGW64__) -# include <_mingw.h> -# if !defined(BOOST_PLAT_MINGW_DETECTION) && (defined(__MINGW64_VERSION_MAJOR) && defined(__MINGW64_VERSION_MINOR)) -# define BOOST_PLAT_MINGW_DETECTION \ - BOOST_VERSION_NUMBER(__MINGW64_VERSION_MAJOR,__MINGW64_VERSION_MINOR,0) -# endif -# if !defined(BOOST_PLAT_MINGW_DETECTION) && (defined(__MINGW32_VERSION_MAJOR) && defined(__MINGW32_VERSION_MINOR)) -# define BOOST_PLAT_MINGW_DETECTION \ - BOOST_VERSION_NUMBER(__MINGW32_MAJOR_VERSION,__MINGW32_MINOR_VERSION,0) -# endif -# if !defined(BOOST_PLAT_MINGW_DETECTION) -# define BOOST_PLAT_MINGW_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_PLAT_MINGW_DETECTION -# define BOOST_PLAT_MINGW_AVAILABLE -# if defined(BOOST_PREDEF_DETAIL_PLAT_DETECTED) -# define BOOST_PLAT_MINGW_EMULATED BOOST_PLAT_MINGW_DETECTION -# else -# undef BOOST_PLAT_MINGW -# define BOOST_PLAT_MINGW BOOST_PLAT_MINGW_DETECTION -# endif -# include -#endif - -#define BOOST_PLAT_MINGW_NAME "MinGW (any variety)" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW,BOOST_PLAT_MINGW_NAME) - -#ifdef BOOST_PLAT_MINGW_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW_EMULATED,BOOST_PLAT_MINGW_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/platform/mingw32.h b/libraries/boost/include/boost/predef/platform/mingw32.h deleted file mode 100644 index ff90038b4c..0000000000 --- a/libraries/boost/include/boost/predef/platform/mingw32.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_MINGW32_H -#define BOOST_PREDEF_PLAT_MINGW32_H - -#include -#include - -/*` -[heading `BOOST_PLAT_MINGW32`] - -[@http://www.mingw.org/ MinGW] platform. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__MINGW32__`] [__predef_detection__]] - - [[`__MINGW32_VERSION_MAJOR`, `__MINGW32_VERSION_MINOR`] [V.R.0]] - ] - */ - -#define BOOST_PLAT_MINGW32 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__MINGW32__) -# include <_mingw.h> -# if !defined(BOOST_PLAT_MINGW32_DETECTION) && (defined(__MINGW32_VERSION_MAJOR) && defined(__MINGW32_VERSION_MINOR)) -# define BOOST_PLAT_MINGW32_DETECTION \ - BOOST_VERSION_NUMBER(__MINGW32_VERSION_MAJOR,__MINGW32_VERSION_MINOR,0) -# endif -# if !defined(BOOST_PLAT_MINGW32_DETECTION) -# define BOOST_PLAT_MINGW32_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_PLAT_MINGW32_DETECTION -# define BOOST_PLAT_MINGW32_AVAILABLE -# if defined(BOOST_PREDEF_DETAIL_PLAT_DETECTED) -# define BOOST_PLAT_MINGW32_EMULATED BOOST_PLAT_MINGW32_DETECTION -# else -# undef BOOST_PLAT_MINGW32 -# define BOOST_PLAT_MINGW32 BOOST_PLAT_MINGW32_DETECTION -# endif -# include -#endif - -#define BOOST_PLAT_MINGW32_NAME "MinGW" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW32,BOOST_PLAT_MINGW32_NAME) - -#ifdef BOOST_PLAT_MINGW32_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW32_EMULATED,BOOST_PLAT_MINGW32_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/platform/mingw64.h b/libraries/boost/include/boost/predef/platform/mingw64.h deleted file mode 100644 index a35dd3e016..0000000000 --- a/libraries/boost/include/boost/predef/platform/mingw64.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright Rene Rivera 2008-2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_MINGW64_H -#define BOOST_PREDEF_PLAT_MINGW64_H - -#include -#include - -/*` -[heading `BOOST_PLAT_MINGW64`] - -[@https://mingw-w64.org/ MinGW-w64] platform. -Version number available as major, minor, and patch. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__MINGW64__`] [__predef_detection__]] - - [[`__MINGW64_VERSION_MAJOR`, `__MINGW64_VERSION_MINOR`] [V.R.0]] - ] - */ - -#define BOOST_PLAT_MINGW64 BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if defined(__MINGW64__) -# include <_mingw.h> -# if !defined(BOOST_PLAT_MINGW64_DETECTION) && (defined(__MINGW64_VERSION_MAJOR) && defined(__MINGW64_VERSION_MINOR)) -# define BOOST_PLAT_MINGW64_DETECTION \ - BOOST_VERSION_NUMBER(__MINGW64_VERSION_MAJOR,__MINGW64_VERSION_MINOR,0) -# endif -# if !defined(BOOST_PLAT_MINGW64_DETECTION) -# define BOOST_PLAT_MINGW64_DETECTION BOOST_VERSION_NUMBER_AVAILABLE -# endif -#endif - -#ifdef BOOST_PLAT_MINGW64_DETECTION -# define BOOST_PLAT_MINGW64_AVAILABLE -# if defined(BOOST_PREDEF_DETAIL_PLAT_DETECTED) -# define BOOST_PLAT_MINGW64_EMULATED BOOST_PLAT_MINGW64_DETECTION -# else -# undef BOOST_PLAT_MINGW64 -# define BOOST_PLAT_MINGW64 BOOST_PLAT_MINGW64_DETECTION -# endif -# include -#endif - -#define BOOST_PLAT_MINGW64_NAME "MinGW-w64" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW64,BOOST_PLAT_MINGW64_NAME) - -#ifdef BOOST_PLAT_MINGW64_EMULATED -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_MINGW64_EMULATED,BOOST_PLAT_MINGW64_NAME) -#endif diff --git a/libraries/boost/include/boost/predef/platform/windows_desktop.h b/libraries/boost/include/boost/predef/platform/windows_desktop.h deleted file mode 100644 index afb39079a6..0000000000 --- a/libraries/boost/include/boost/predef/platform/windows_desktop.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright (c) Microsoft Corporation 2014 -Copyright Rene Rivera 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_WINDOWS_DESKTOP_H -#define BOOST_PREDEF_PLAT_WINDOWS_DESKTOP_H - -#include -#include -#include -#include - -/*` -[heading `BOOST_PLAT_WINDOWS_DESKTOP`] - -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] -for Windows Desktop development. Also available if the Platform SDK is too -old to support UWP. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP`] [__predef_detection__]] - [[`!BOOST_PLAT_WINDOWS_UWP`] [__predef_detection__]] - ] - */ - -#define BOOST_PLAT_WINDOWS_DESKTOP BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if BOOST_OS_WINDOWS && \ - ((defined(WINAPI_FAMILY_DESKTOP_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) || \ - !BOOST_PLAT_WINDOWS_UWP) -# undef BOOST_PLAT_WINDOWS_DESKTOP -# define BOOST_PLAT_WINDOWS_DESKTOP BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_PLAT_WINDOWS_DESKTOP -# define BOOST_PLAT_WINDOWS_DESKTOP_AVAILABLE -# include -#endif - -#define BOOST_PLAT_WINDOWS_DESKTOP_NAME "Windows Desktop" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_DESKTOP,BOOST_PLAT_WINDOWS_DESKTOP_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_phone.h b/libraries/boost/include/boost/predef/platform/windows_phone.h deleted file mode 100644 index 0ebc76d276..0000000000 --- a/libraries/boost/include/boost/predef/platform/windows_phone.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright (c) Microsoft Corporation 2014 -Copyright Rene Rivera 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_WINDOWS_PHONE_H -#define BOOST_PREDEF_PLAT_WINDOWS_PHONE_H - -#include -#include -#include -#include - -/*` -[heading `BOOST_PLAT_WINDOWS_PHONE`] - -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] -for Windows Phone development. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP`] [__predef_detection__]] - ] - */ - -#define BOOST_PLAT_WINDOWS_PHONE BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if BOOST_OS_WINDOWS && \ - defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP -# undef BOOST_PLAT_WINDOWS_PHONE -# define BOOST_PLAT_WINDOWS_PHONE BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_PLAT_WINDOWS_PHONE -# define BOOST_PLAT_WINDOWS_PHONE_AVAILABLE -# include -#endif - -#define BOOST_PLAT_WINDOWS_PHONE_NAME "Windows Phone" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_PHONE,BOOST_PLAT_WINDOWS_PHONE_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_runtime.h b/libraries/boost/include/boost/predef/platform/windows_runtime.h deleted file mode 100644 index e7978d7525..0000000000 --- a/libraries/boost/include/boost/predef/platform/windows_runtime.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright (c) Microsoft Corporation 2014 -Copyright Rene Rivera 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_WINDOWS_RUNTIME_H -#define BOOST_PREDEF_PLAT_WINDOWS_RUNTIME_H - -#include -#include -#include -#include -#include - -/*` -[heading `BOOST_PLAT_WINDOWS_RUNTIME`] - -Deprecated. - -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] -for Windows Phone or Store development. This does not align to the existing development model for -UWP and is deprecated. Use one of the other `BOOST_PLAT_WINDOWS_*`definitions instead. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`BOOST_PLAT_WINDOWS_PHONE`] [__predef_detection__]] - [[`BOOST_PLAT_WINDOWS_STORE`] [__predef_detection__]] - ] - */ - -#define BOOST_PLAT_WINDOWS_RUNTIME BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if BOOST_OS_WINDOWS && \ - (BOOST_PLAT_WINDOWS_STORE || BOOST_PLAT_WINDOWS_PHONE) -# undef BOOST_PLAT_WINDOWS_RUNTIME -# define BOOST_PLAT_WINDOWS_RUNTIME BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_PLAT_WINDOWS_RUNTIME -# define BOOST_PLAT_WINDOWS_RUNTIME_AVAILABLE -# include -#endif - -#define BOOST_PLAT_WINDOWS_RUNTIME_NAME "Windows Runtime" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_RUNTIME,BOOST_PLAT_WINDOWS_RUNTIME_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_server.h b/libraries/boost/include/boost/predef/platform/windows_server.h deleted file mode 100644 index 7bd629da34..0000000000 --- a/libraries/boost/include/boost/predef/platform/windows_server.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright James E. King III, 2017 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_WINDOWS_SERVER_H -#define BOOST_PREDEF_PLAT_WINDOWS_SERVER_H - -#include -#include -#include -#include - -/*` -[heading `BOOST_PLAT_WINDOWS_SERVER`] - -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] -for Windows Server development. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`WINAPI_FAMILY == WINAPI_FAMILY_SERVER`] [__predef_detection__]] - ] - */ - -#define BOOST_PLAT_WINDOWS_SERVER BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if BOOST_OS_WINDOWS && \ - defined(WINAPI_FAMILY_SERVER) && WINAPI_FAMILY == WINAPI_FAMILY_SERVER -# undef BOOST_PLAT_WINDOWS_SERVER -# define BOOST_PLAT_WINDOWS_SERVER BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_PLAT_WINDOWS_SERVER -# define BOOST_PLAT_WINDOWS_SERVER_AVAILABLE -# include -#endif - -#define BOOST_PLAT_WINDOWS_SERVER_NAME "Windows Server" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_SERVER,BOOST_PLAT_WINDOWS_SERVER_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_store.h b/libraries/boost/include/boost/predef/platform/windows_store.h deleted file mode 100644 index 3a3fd8e982..0000000000 --- a/libraries/boost/include/boost/predef/platform/windows_store.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -Copyright (c) Microsoft Corporation 2014 -Copyright Rene Rivera 2015 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_WINDOWS_STORE_H -#define BOOST_PREDEF_PLAT_WINDOWS_STORE_H - -#include -#include -#include -#include - -/*` -[heading `BOOST_PLAT_WINDOWS_STORE`] - -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] -for Windows Store development. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`WINAPI_FAMILY == WINAPI_FAMILY_PC_APP`] [__predef_detection__]] - [[`WINAPI_FAMILY == WINAPI_FAMILY_APP` (deprecated)] [__predef_detection__]] -] - */ - -#define BOOST_PLAT_WINDOWS_STORE BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if BOOST_OS_WINDOWS && \ - ((defined(WINAPI_FAMILY_PC_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) || \ - (defined(WINAPI_FAMILY_APP) && WINAPI_FAMILY == WINAPI_FAMILY_APP)) -# undef BOOST_PLAT_WINDOWS_STORE -# define BOOST_PLAT_WINDOWS_STORE BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_PLAT_WINDOWS_STORE -# define BOOST_PLAT_WINDOWS_STORE_AVAILABLE -# include -#endif - -#define BOOST_PLAT_WINDOWS_STORE_NAME "Windows Store" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_STORE,BOOST_PLAT_WINDOWS_STORE_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_system.h b/libraries/boost/include/boost/predef/platform/windows_system.h deleted file mode 100644 index 92f424fe7f..0000000000 --- a/libraries/boost/include/boost/predef/platform/windows_system.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -Copyright James E. King III, 2017 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_WINDOWS_SYSTEM_H -#define BOOST_PREDEF_PLAT_WINDOWS_SYSTEM_H - -#include -#include -#include -#include - -/*` -[heading `BOOST_PLAT_WINDOWS_SYSTEM`] - -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] -for Windows System development. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM`] [__predef_detection__]] - ] - */ - -#define BOOST_PLAT_WINDOWS_SYSTEM BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if BOOST_OS_WINDOWS && \ - defined(WINAPI_FAMILY_SYSTEM) && WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM -# undef BOOST_PLAT_WINDOWS_SYSTEM -# define BOOST_PLAT_WINDOWS_SYSTEM BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_PLAT_WINDOWS_SYSTEM -# define BOOST_PLAT_WINDOWS_SYSTEM_AVAILABLE -# include -#endif - -#define BOOST_PLAT_WINDOWS_SYSTEM_NAME "Windows Drivers and Tools" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_SYSTEM,BOOST_PLAT_WINDOWS_SYSTEM_NAME) diff --git a/libraries/boost/include/boost/predef/platform/windows_uwp.h b/libraries/boost/include/boost/predef/platform/windows_uwp.h deleted file mode 100644 index e4c6647f41..0000000000 --- a/libraries/boost/include/boost/predef/platform/windows_uwp.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright James E. King III, 2017 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_PLAT_WINDOWS_UWP_H -#define BOOST_PREDEF_PLAT_WINDOWS_UWP_H - -#include -#include -#include - -/*` -[heading `BOOST_PLAT_WINDOWS_UWP`] - -[@http://docs.microsoft.com/windows/uwp/ Universal Windows Platform] -is available if the current development environment is capable of targeting -UWP development. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__MINGW64_VERSION_MAJOR` from `_mingw.h`] [`>= 3`]] - [[`VER_PRODUCTBUILD` from `ntverp.h`] [`>= 9200`]] -] -*/ - -#define BOOST_PLAT_WINDOWS_UWP BOOST_VERSION_NUMBER_NOT_AVAILABLE -#define BOOST_PLAT_WINDOWS_SDK_VERSION BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if BOOST_OS_WINDOWS -// MinGW (32-bit) has no ntverp.h header -#if !defined(__MINGW32__) -# include -# undef BOOST_PLAT_WINDOWS_SDK_VERSION -# define BOOST_PLAT_WINDOWS_SDK_VERSION BOOST_VERSION_NUMBER(0, 0, VER_PRODUCTBUILD) -#endif - -// 9200 is Windows SDK 8.0 from ntverp.h which introduced family support -#if ((BOOST_PLAT_WINDOWS_SDK_VERSION >= BOOST_VERSION_NUMBER(0, 0, 9200)) || \ - (defined(__MINGW64__) && __MINGW64_VERSION_MAJOR >= 3)) -# undef BOOST_PLAT_WINDOWS_UWP -# define BOOST_PLAT_WINDOWS_UWP BOOST_VERSION_NUMBER_AVAILABLE -#endif -#endif - -#if BOOST_PLAT_WINDOWS_UWP -# define BOOST_PLAT_WINDOWS_UWP_AVAILABLE -# include -# include // Windows SDK -#endif - -#define BOOST_PLAT_WINDOWS_UWP_NAME "Universal Windows Platform" - -#endif - -#include -BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_UWP, BOOST_PLAT_WINDOWS_UWP_NAME) diff --git a/libraries/boost/include/boost/predef/version.h b/libraries/boost/include/boost/predef/version.h deleted file mode 100644 index bcf97adfc2..0000000000 --- a/libraries/boost/include/boost/predef/version.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -Copyright Rene Rivera 2015-2016 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_VERSION_H -#define BOOST_PREDEF_VERSION_H - -#include - -#define BOOST_PREDEF_VERSION BOOST_VERSION_NUMBER(1,7,0) - -#endif diff --git a/libraries/boost/include/boost/predef/version_number.h b/libraries/boost/include/boost/predef/version_number.h deleted file mode 100644 index 44942709c7..0000000000 --- a/libraries/boost/include/boost/predef/version_number.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright Rene Rivera 2005-2016 -Distributed under the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) -*/ - -#ifndef BOOST_PREDEF_VERSION_NUMBER_H -#define BOOST_PREDEF_VERSION_NUMBER_H - -/*` -[heading `BOOST_VERSION_NUMBER`] - -`` -BOOST_VERSION_NUMBER(major,minor,patch) -`` - -Defines standard version numbers, with these properties: - -* Decimal base whole numbers in the range \[0,1000000000). - The number range is designed to allow for a (2,2,5) triplet. - Which fits within a 32 bit value. -* The `major` number can be in the \[0,99\] range. -* The `minor` number can be in the \[0,99\] range. -* The `patch` number can be in the \[0,99999\] range. -* Values can be specified in any base. As the defined value - is an constant expression. -* Value can be directly used in both preprocessor and compiler - expressions for comparison to other similarly defined values. -* The implementation enforces the individual ranges for the - major, minor, and patch numbers. And values over the ranges - are truncated (modulo). - -*/ -#define BOOST_VERSION_NUMBER(major,minor,patch) \ - ( (((major)%100)*10000000) + (((minor)%100)*100000) + ((patch)%100000) ) - -#define BOOST_VERSION_NUMBER_MAX \ - BOOST_VERSION_NUMBER(99,99,99999) - -#define BOOST_VERSION_NUMBER_ZERO \ - BOOST_VERSION_NUMBER(0,0,0) - -#define BOOST_VERSION_NUMBER_MIN \ - BOOST_VERSION_NUMBER(0,0,1) - -#define BOOST_VERSION_NUMBER_AVAILABLE \ - BOOST_VERSION_NUMBER_MIN - -#define BOOST_VERSION_NUMBER_NOT_AVAILABLE \ - BOOST_VERSION_NUMBER_ZERO - -/*` -`` -BOOST_VERSION_NUMBER_MAJOR(N), BOOST_VERSION_NUMBER_MINOR(N), BOOST_VERSION_NUMBER_PATCH(N) -`` - -The macros extract the major, minor, and patch portion from a well formed -version number resulting in a preprocessor expression in the range of -\[0,99\] or \[0,99999\] for the major and minor, or patch numbers -respectively. -*/ -#define BOOST_VERSION_NUMBER_MAJOR(N) \ - ( ((N)/10000000)%100 ) - -#define BOOST_VERSION_NUMBER_MINOR(N) \ - ( ((N)/100000)%100 ) - -#define BOOST_VERSION_NUMBER_PATCH(N) \ - ( (N)%100000 ) - -#endif diff --git a/libraries/boost/include/boost/range/begin.hpp b/libraries/boost/include/boost/range/begin.hpp deleted file mode 100644 index ba5a73b92d..0000000000 --- a/libraries/boost/include/boost/range/begin.hpp +++ /dev/null @@ -1,135 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_BEGIN_HPP -#define BOOST_RANGE_BEGIN_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include - -#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING -#include -#else - -#include - -namespace boost -{ - -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -namespace range_detail -{ -#endif - - ////////////////////////////////////////////////////////////////////// - // primary template - ////////////////////////////////////////////////////////////////////// - - template< typename C > - inline BOOST_DEDUCED_TYPENAME range_iterator::type - range_begin( C& c ) - { - // - // If you get a compile-error here, it is most likely because - // you have not implemented range_begin() properly in - // the namespace of C - // - return c.begin(); - } - - ////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////// - - template< typename Iterator > - inline Iterator range_begin( const std::pair& p ) - { - return p.first; - } - - template< typename Iterator > - inline Iterator range_begin( std::pair& p ) - { - return p.first; - } - - ////////////////////////////////////////////////////////////////////// - // array - ////////////////////////////////////////////////////////////////////// - - // - // May this be discarded? Or is it needed for bad compilers? - // - template< typename T, std::size_t sz > - inline const T* range_begin( const T (&a)[sz] ) - { - return a; - } - - template< typename T, std::size_t sz > - inline T* range_begin( T (&a)[sz] ) - { - return a; - } - - -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -} // namespace 'range_detail' -#endif - -// Use a ADL namespace barrier to avoid ambiguity with other unqualified -// calls. This is particularly important with C++0x encouraging -// unqualified calls to begin/end. -namespace range_adl_barrier -{ - -template< class T > -inline BOOST_DEDUCED_TYPENAME range_iterator::type begin( T& r ) -{ -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - using namespace range_detail; -#endif - return range_begin( r ); -} - -template< class T > -inline BOOST_DEDUCED_TYPENAME range_iterator::type begin( const T& r ) -{ -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - using namespace range_detail; -#endif - return range_begin( r ); -} - - } // namespace range_adl_barrier -} // namespace boost - -#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING - -namespace boost -{ - namespace range_adl_barrier - { - template< class T > - inline BOOST_DEDUCED_TYPENAME range_iterator::type - const_begin( const T& r ) - { - return boost::range_adl_barrier::begin( r ); - } - } // namespace range_adl_barrier - - using namespace range_adl_barrier; -} // namespace boost - -#endif - diff --git a/libraries/boost/include/boost/range/config.hpp b/libraries/boost/include/boost/range/config.hpp deleted file mode 100644 index 7600a5ff82..0000000000 --- a/libraries/boost/include/boost/range/config.hpp +++ /dev/null @@ -1,56 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_CONFIG_HPP -#define BOOST_RANGE_CONFIG_HPP - -#include - -#if defined(_MSC_VER) -# pragma once -#endif - -#include - -#ifdef BOOST_RANGE_DEDUCED_TYPENAME -#error "macro already defined!" -#endif - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -# define BOOST_RANGE_DEDUCED_TYPENAME typename -#else -#define BOOST_RANGE_DEDUCED_TYPENAME BOOST_DEDUCED_TYPENAME -#endif - -#ifdef BOOST_RANGE_NO_ARRAY_SUPPORT -#error "macro already defined!" -#endif - -#if BOOST_WORKAROUND( __MWERKS__, <= 0x3003 ) -#define BOOST_RANGE_NO_ARRAY_SUPPORT 1 -#endif - -#ifdef BOOST_RANGE_NO_ARRAY_SUPPORT -#define BOOST_RANGE_ARRAY_REF() (boost_range_array) -#define BOOST_RANGE_NO_STATIC_ASSERT -#else -#define BOOST_RANGE_ARRAY_REF() (&boost_range_array) -#endif - -#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7))) -# define BOOST_RANGE_UNUSED __attribute__((unused)) -#else -# define BOOST_RANGE_UNUSED -#endif - - - -#endif - diff --git a/libraries/boost/include/boost/range/const_iterator.hpp b/libraries/boost/include/boost/range/const_iterator.hpp deleted file mode 100644 index 727fdad058..0000000000 --- a/libraries/boost/include/boost/range/const_iterator.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_CONST_ITERATOR_HPP -#define BOOST_RANGE_CONST_ITERATOR_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include - -#include -#include -#include -#include -#include -#include - -namespace boost -{ - ////////////////////////////////////////////////////////////////////////// - // default - ////////////////////////////////////////////////////////////////////////// - - namespace range_detail - { - -BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( const_iterator ) - -template< typename C > -struct range_const_iterator_helper - : extract_const_iterator -{}; - -////////////////////////////////////////////////////////////////////////// -// pair -////////////////////////////////////////////////////////////////////////// - -template< typename Iterator > -struct range_const_iterator_helper > -{ - typedef Iterator type; -}; - -////////////////////////////////////////////////////////////////////////// -// array -////////////////////////////////////////////////////////////////////////// - -template< typename T, std::size_t sz > -struct range_const_iterator_helper< T[sz] > -{ - typedef const T* type; -}; - - } // namespace range_detail - -template -struct range_const_iterator - : range_detail::range_const_iterator_helper< - BOOST_DEDUCED_TYPENAME remove_reference::type - > -{ -}; - -} // namespace boost - - -#endif diff --git a/libraries/boost/include/boost/range/detail/begin.hpp b/libraries/boost/include/boost/range/detail/begin.hpp deleted file mode 100644 index 1d9390ff85..0000000000 --- a/libraries/boost/include/boost/range/detail/begin.hpp +++ /dev/null @@ -1,83 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_DETAIL_BEGIN_HPP -#define BOOST_RANGE_DETAIL_BEGIN_HPP - -#include // BOOST_MSVC -#include -#include -#include - -namespace boost -{ - - namespace range_detail - { - template< typename T > - struct range_begin; - - ////////////////////////////////////////////////////////////////////// - // default - ////////////////////////////////////////////////////////////////////// - - template<> - struct range_begin - { - template< typename C > - static BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type fun( C& c ) - { - return c.begin(); - }; - }; - - ////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////// - - template<> - struct range_begin - { - template< typename P > - static BOOST_RANGE_DEDUCED_TYPENAME range_iterator

::type fun( const P& p ) - { - return p.first; - } - }; - - ////////////////////////////////////////////////////////////////////// - // array - ////////////////////////////////////////////////////////////////////// - - template<> - struct range_begin - { - template - static BOOST_RANGE_DEDUCED_TYPENAME range_value::type* fun(T& t) - { - return t; - } - }; - - } // namespace 'range_detail' - - namespace range_adl_barrier - { - template< typename C > - inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type - begin( C& c ) - { - return range_detail::range_begin< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range::type >::fun( c ); - } - } -} // namespace 'boost' - - -#endif diff --git a/libraries/boost/include/boost/range/detail/common.hpp b/libraries/boost/include/boost/range/detail/common.hpp deleted file mode 100644 index 00b665bef8..0000000000 --- a/libraries/boost/include/boost/range/detail/common.hpp +++ /dev/null @@ -1,118 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_DETAIL_COMMON_HPP -#define BOOST_RANGE_DETAIL_COMMON_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// missing partial specialization workaround. -////////////////////////////////////////////////////////////////////////////// - -namespace boost -{ - namespace range_detail - { - // 1 = std containers - // 2 = std::pair - // 3 = const std::pair - // 4 = array - // 5 = const array - // 6 = char array - // 7 = wchar_t array - // 8 = char* - // 9 = const char* - // 10 = whar_t* - // 11 = const wchar_t* - // 12 = string - - typedef mpl::int_<1>::type std_container_; - typedef mpl::int_<2>::type std_pair_; - typedef mpl::int_<3>::type const_std_pair_; - typedef mpl::int_<4>::type array_; - typedef mpl::int_<5>::type const_array_; - typedef mpl::int_<6>::type char_array_; - typedef mpl::int_<7>::type wchar_t_array_; - typedef mpl::int_<8>::type char_ptr_; - typedef mpl::int_<9>::type const_char_ptr_; - typedef mpl::int_<10>::type wchar_t_ptr_; - typedef mpl::int_<11>::type const_wchar_t_ptr_; - typedef mpl::int_<12>::type string_; - - template< typename C > - struct range_helper - { - static C* c; - static C ptr; - - BOOST_STATIC_CONSTANT( bool, is_pair_ = sizeof( boost::range_detail::is_pair_impl( c ) ) == sizeof( yes_type ) ); - BOOST_STATIC_CONSTANT( bool, is_char_ptr_ = sizeof( boost::range_detail::is_char_ptr_impl( ptr ) ) == sizeof( yes_type ) ); - BOOST_STATIC_CONSTANT( bool, is_const_char_ptr_ = sizeof( boost::range_detail::is_const_char_ptr_impl( ptr ) ) == sizeof( yes_type ) ); - BOOST_STATIC_CONSTANT( bool, is_wchar_t_ptr_ = sizeof( boost::range_detail::is_wchar_t_ptr_impl( ptr ) ) == sizeof( yes_type ) ); - BOOST_STATIC_CONSTANT( bool, is_const_wchar_t_ptr_ = sizeof( boost::range_detail::is_const_wchar_t_ptr_impl( ptr ) ) == sizeof( yes_type ) ); - BOOST_STATIC_CONSTANT( bool, is_char_array_ = sizeof( boost::range_detail::is_char_array_impl( ptr ) ) == sizeof( yes_type ) ); - BOOST_STATIC_CONSTANT( bool, is_wchar_t_array_ = sizeof( boost::range_detail::is_wchar_t_array_impl( ptr ) ) == sizeof( yes_type ) ); - BOOST_STATIC_CONSTANT( bool, is_string_ = (boost::mpl::or_, boost::mpl::bool_ >::value )); - BOOST_STATIC_CONSTANT( bool, is_array_ = boost::is_array::value ); - - }; - - template< typename C > - class range - { - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_pair_, - boost::range_detail::std_pair_, - void >::type pair_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_array_, - boost::range_detail::array_, - pair_t >::type array_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_string_, - boost::range_detail::string_, - array_t >::type string_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_const_char_ptr_, - boost::range_detail::const_char_ptr_, - string_t >::type const_char_ptr_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_char_ptr_, - boost::range_detail::char_ptr_, - const_char_ptr_t >::type char_ptr_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_const_wchar_t_ptr_, - boost::range_detail::const_wchar_t_ptr_, - char_ptr_t >::type const_wchar_ptr_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_wchar_t_ptr_, - boost::range_detail::wchar_t_ptr_, - const_wchar_ptr_t >::type wchar_ptr_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_wchar_t_array_, - boost::range_detail::wchar_t_array_, - wchar_ptr_t >::type wchar_array_t; - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::range_detail::range_helper::is_char_array_, - boost::range_detail::char_array_, - wchar_array_t >::type char_array_t; - public: - typedef BOOST_RANGE_DEDUCED_TYPENAME boost::mpl::if_c< ::boost::is_void::value, - boost::range_detail::std_container_, - char_array_t >::type type; - }; // class 'range' - } -} - -#endif - diff --git a/libraries/boost/include/boost/range/detail/end.hpp b/libraries/boost/include/boost/range/detail/end.hpp deleted file mode 100644 index f2f71780a7..0000000000 --- a/libraries/boost/include/boost/range/detail/end.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_DETAIL_END_HPP -#define BOOST_RANGE_DETAIL_END_HPP - -#include // BOOST_MSVC -#include - -#include -#include -#include - -namespace boost -{ - namespace range_detail - { - template< typename T > - struct range_end; - - ////////////////////////////////////////////////////////////////////// - // default - ////////////////////////////////////////////////////////////////////// - - template<> - struct range_end - { - template< typename C > - static BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type - fun( C& c ) - { - return c.end(); - }; - }; - - ////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////// - - template<> - struct range_end - { - template< typename P > - static BOOST_RANGE_DEDUCED_TYPENAME range_iterator

::type - fun( const P& p ) - { - return p.second; - } - }; - - ////////////////////////////////////////////////////////////////////// - // array - ////////////////////////////////////////////////////////////////////// - - template<> - struct range_end - { - template - static BOOST_RANGE_DEDUCED_TYPENAME remove_extent::type* fun(T& t) - { - return t + remove_extent::size; - } - }; - - } // namespace 'range_detail' - - namespace range_adl_barrier - { - template< typename C > - inline BOOST_RANGE_DEDUCED_TYPENAME range_iterator::type - end( C& c ) - { - return range_detail::range_end< BOOST_RANGE_DEDUCED_TYPENAME range_detail::range::type >::fun( c ); - } - } // namespace range_adl_barrier - -} // namespace 'boost' - -#endif diff --git a/libraries/boost/include/boost/range/detail/extract_optional_type.hpp b/libraries/boost/include/boost/range/detail/extract_optional_type.hpp deleted file mode 100644 index 0381434a85..0000000000 --- a/libraries/boost/include/boost/range/detail/extract_optional_type.hpp +++ /dev/null @@ -1,48 +0,0 @@ -// Boost.Range library -// -// Copyright Arno Schoedl & Neil Groves 2009. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// -#ifndef BOOST_RANGE_DETAIL_EXTRACT_OPTIONAL_TYPE_HPP_INCLUDED -#define BOOST_RANGE_DETAIL_EXTRACT_OPTIONAL_TYPE_HPP_INCLUDED - -#if defined(_MSC_VER) -# pragma once -#endif - -#include -#include -#include - -#if !defined(BOOST_MPL_CFG_NO_HAS_XXX) - -// Defines extract_some_typedef which exposes T::some_typedef as -// extract_some_typedef::type if T::some_typedef exists. Otherwise -// extract_some_typedef is empty. -#define BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( a_typedef ) \ - BOOST_MPL_HAS_XXX_TRAIT_DEF(a_typedef) \ - template< typename C, bool B = BOOST_PP_CAT(has_, a_typedef)::value > \ - struct BOOST_PP_CAT(extract_, a_typedef) \ - {}; \ - template< typename C > \ - struct BOOST_PP_CAT(extract_, a_typedef)< C, true > \ - { \ - typedef BOOST_DEDUCED_TYPENAME C::a_typedef type; \ - }; - -#else - -#define BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( a_typedef ) \ - template< typename C > \ - struct BOOST_PP_CAT(extract_, a_typedef) \ - { \ - typedef BOOST_DEDUCED_TYPENAME C::a_typedef type; \ - }; - -#endif - -#endif // include guard diff --git a/libraries/boost/include/boost/range/detail/implementation_help.hpp b/libraries/boost/include/boost/range/detail/implementation_help.hpp deleted file mode 100644 index f35953f349..0000000000 --- a/libraries/boost/include/boost/range/detail/implementation_help.hpp +++ /dev/null @@ -1,114 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP -#define BOOST_RANGE_DETAIL_IMPLEMENTATION_HELP_HPP - -#include -#include -#include -#include -#include - -#ifndef BOOST_NO_CWCHAR -#include -#endif - -namespace boost -{ - namespace range_detail - { - template - inline void boost_range_silence_warning( const T& ) { } - - ///////////////////////////////////////////////////////////////////// - // end() help - ///////////////////////////////////////////////////////////////////// - - inline const char* str_end( const char* s, const char* ) - { - return s + strlen( s ); - } - -#ifndef BOOST_NO_CWCHAR - inline const wchar_t* str_end( const wchar_t* s, const wchar_t* ) - { - return s + wcslen( s ); - } -#else - inline const wchar_t* str_end( const wchar_t* s, const wchar_t* ) - { - if( s == 0 || s[0] == 0 ) - return s; - while( *++s != 0 ) - ; - return s; - } -#endif - - template< class Char > - inline Char* str_end( Char* s ) - { - return const_cast( str_end( s, s ) ); - } - - template< class T, std::size_t sz > - inline T* array_end( T BOOST_RANGE_ARRAY_REF()[sz] ) - { - return boost_range_array + sz; - } - - template< class T, std::size_t sz > - inline const T* array_end( const T BOOST_RANGE_ARRAY_REF()[sz] ) - { - return boost_range_array + sz; - } - - ///////////////////////////////////////////////////////////////////// - // size() help - ///////////////////////////////////////////////////////////////////// - - template< class Char > - inline std::size_t str_size( const Char* const& s ) - { - return str_end( s ) - s; - } - - template< class T, std::size_t sz > - inline std::size_t array_size( T BOOST_RANGE_ARRAY_REF()[sz] ) - { - boost_range_silence_warning( boost_range_array ); - return sz; - } - - template< class T, std::size_t sz > - inline std::size_t array_size( const T BOOST_RANGE_ARRAY_REF()[sz] ) - { - boost_range_silence_warning( boost_range_array ); - return sz; - } - - inline bool is_same_address(const void* l, const void* r) - { - return l == r; - } - - template - inline bool is_same_object(const T1& l, const T2& r) - { - return range_detail::is_same_address(&l, &r); - } - - } // namespace 'range_detail' - -} // namespace 'boost' - - -#endif diff --git a/libraries/boost/include/boost/range/detail/msvc_has_iterator_workaround.hpp b/libraries/boost/include/boost/range/detail/msvc_has_iterator_workaround.hpp deleted file mode 100644 index 62b67fd529..0000000000 --- a/libraries/boost/include/boost/range/detail/msvc_has_iterator_workaround.hpp +++ /dev/null @@ -1,132 +0,0 @@ -// Boost.Range library -// -// Copyright Eric Niebler 2014. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_DETAIL_MSVC_HAS_ITERATOR_WORKAROUND_HPP -#define BOOST_RANGE_DETAIL_MSVC_HAS_ITERATOR_WORKAROUND_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#ifndef BOOST_RANGE_MUTABLE_ITERATOR_HPP -# error This file should only be included from -#endif - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1600) -namespace boost -{ -namespace cb_details -{ - template - struct iterator; -} - -namespace python -{ - template - struct iterator; -} - -namespace type_erasure -{ - template< - class Traversal, - class T /*= _self*/, - class Reference /*= ::boost::use_default*/, - class DifferenceType /*= ::std::ptrdiff_t*/, - class ValueType /*= typename deduced >::type*/ - > - struct iterator; -} - -namespace unordered { namespace iterator_detail -{ - template - struct iterator; -}} - -namespace container { namespace container_detail -{ - template - class iterator; -}} - -namespace spirit { namespace lex { namespace lexertl -{ - template - class iterator; -}}} - -namespace range_detail -{ - template - struct has_iterator< ::boost::cb_details::iterator > - : mpl::false_ - {}; - - template - struct has_iterator< ::boost::cb_details::iterator const> - : mpl::false_ - {}; - - template - struct has_iterator< ::boost::python::iterator > - : mpl::false_ - {}; - - template - struct has_iterator< ::boost::python::iterator const> - : mpl::false_ - {}; - - template - struct has_iterator< ::boost::type_erasure::iterator > - : mpl::false_ - {}; - - template - struct has_iterator< ::boost::type_erasure::iterator const> - : mpl::false_ - {}; - - template - struct has_iterator< ::boost::unordered::iterator_detail::iterator > - : mpl::false_ - {}; - - template - struct has_iterator< ::boost::unordered::iterator_detail::iterator const> - : mpl::false_ - {}; - - template - struct has_iterator< ::boost::container::container_detail::iterator > - : mpl::false_ - {}; - - template - struct has_iterator< ::boost::container::container_detail::iterator const> - : mpl::false_ - {}; - - template - struct has_iterator< ::boost::spirit::lex::lexertl::iterator > - : mpl::false_ - {}; - - template - struct has_iterator< ::boost::spirit::lex::lexertl::iterator const> - : mpl::false_ - {}; -} -} -#endif -#endif diff --git a/libraries/boost/include/boost/range/detail/sfinae.hpp b/libraries/boost/include/boost/range/detail/sfinae.hpp deleted file mode 100644 index 5b2c61e71e..0000000000 --- a/libraries/boost/include/boost/range/detail/sfinae.hpp +++ /dev/null @@ -1,77 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_DETAIL_SFINAE_HPP -#define BOOST_RANGE_DETAIL_SFINAE_HPP - -#include -#include -#include -#include - - -namespace boost -{ - namespace range_detail - { - using type_traits::yes_type; - using type_traits::no_type; - - ////////////////////////////////////////////////////////////////////// - // string - ////////////////////////////////////////////////////////////////////// - - yes_type is_string_impl( const char* const ); - yes_type is_string_impl( const wchar_t* const ); - no_type is_string_impl( ... ); - - template< std::size_t sz > - yes_type is_char_array_impl( char BOOST_RANGE_ARRAY_REF()[sz] ); - template< std::size_t sz > - yes_type is_char_array_impl( const char BOOST_RANGE_ARRAY_REF()[sz] ); - no_type is_char_array_impl( ... ); - - template< std::size_t sz > - yes_type is_wchar_t_array_impl( wchar_t BOOST_RANGE_ARRAY_REF()[sz] ); - template< std::size_t sz > - yes_type is_wchar_t_array_impl( const wchar_t BOOST_RANGE_ARRAY_REF()[sz] ); - no_type is_wchar_t_array_impl( ... ); - - yes_type is_char_ptr_impl( char* const ); - no_type is_char_ptr_impl( ... ); - - yes_type is_const_char_ptr_impl( const char* const ); - no_type is_const_char_ptr_impl( ... ); - - yes_type is_wchar_t_ptr_impl( wchar_t* const ); - no_type is_wchar_t_ptr_impl( ... ); - - yes_type is_const_wchar_t_ptr_impl( const wchar_t* const ); - no_type is_const_wchar_t_ptr_impl( ... ); - - ////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////// - - template< typename Iterator > - yes_type is_pair_impl( const std::pair* ); - no_type is_pair_impl( ... ); - - ////////////////////////////////////////////////////////////////////// - // tags - ////////////////////////////////////////////////////////////////////// - - struct char_or_wchar_t_array_tag {}; - - } // namespace 'range_detail' - -} // namespace 'boost' - -#endif diff --git a/libraries/boost/include/boost/range/end.hpp b/libraries/boost/include/boost/range/end.hpp deleted file mode 100644 index f2a3337e34..0000000000 --- a/libraries/boost/include/boost/range/end.hpp +++ /dev/null @@ -1,128 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_END_HPP -#define BOOST_RANGE_END_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include - -#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING -#include -#else - -#include -#include -#include - -namespace boost -{ - -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -namespace range_detail -{ -#endif - - ////////////////////////////////////////////////////////////////////// - // primary template - ////////////////////////////////////////////////////////////////////// - template< typename C > - inline BOOST_DEDUCED_TYPENAME range_iterator::type - range_end( C& c ) - { - // - // If you get a compile-error here, it is most likely because - // you have not implemented range_begin() properly in - // the namespace of C - // - return c.end(); - } - - ////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////// - - template< typename Iterator > - inline Iterator range_end( const std::pair& p ) - { - return p.second; - } - - template< typename Iterator > - inline Iterator range_end( std::pair& p ) - { - return p.second; - } - - ////////////////////////////////////////////////////////////////////// - // array - ////////////////////////////////////////////////////////////////////// - - template< typename T, std::size_t sz > - inline const T* range_end( const T (&a)[sz] ) - { - return range_detail::array_end( a ); - } - - template< typename T, std::size_t sz > - inline T* range_end( T (&a)[sz] ) - { - return range_detail::array_end( a ); - } - -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -} // namespace 'range_detail' -#endif - -namespace range_adl_barrier -{ - -template< class T > -inline BOOST_DEDUCED_TYPENAME range_iterator::type end( T& r ) -{ -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - using namespace range_detail; -#endif - return range_end( r ); -} - -template< class T > -inline BOOST_DEDUCED_TYPENAME range_iterator::type end( const T& r ) -{ -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - using namespace range_detail; -#endif - return range_end( r ); -} - - } // namespace range_adl_barrier -} // namespace 'boost' - -#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING - -namespace boost -{ - namespace range_adl_barrier - { - template< class T > - inline BOOST_DEDUCED_TYPENAME range_iterator::type - const_end( const T& r ) - { - return boost::range_adl_barrier::end( r ); - } - } // namespace range_adl_barrier - using namespace range_adl_barrier; -} // namespace boost - -#endif - diff --git a/libraries/boost/include/boost/range/iterator.hpp b/libraries/boost/include/boost/range/iterator.hpp deleted file mode 100644 index 2956353ab5..0000000000 --- a/libraries/boost/include/boost/range/iterator.hpp +++ /dev/null @@ -1,74 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_ITERATOR_HPP -#define BOOST_RANGE_ITERATOR_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include -#include -#include -#include -#include -#include -#include - -namespace boost -{ - -#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) - - namespace range_detail_vc7_1 - { - template< typename C, typename Sig = void(C) > - struct range_iterator - { - typedef BOOST_RANGE_DEDUCED_TYPENAME - mpl::eval_if_c< is_const::value, - range_const_iterator< typename remove_const::type >, - range_mutable_iterator >::type type; - }; - - template< typename C, typename T > - struct range_iterator< C, void(T[]) > - { - typedef T* type; - }; - } - - template< typename C, typename Enabler=void > - struct range_iterator - { - - typedef BOOST_RANGE_DEDUCED_TYPENAME - range_detail_vc7_1::range_iterator::type type; - - }; - -#else - - template< typename C, typename Enabler=void > - struct range_iterator - : mpl::if_c< - is_const::type>::value, - range_const_iterator::type>::type>, - range_mutable_iterator::type> - >::type - { - }; - -#endif - -} // namespace boost - -#endif diff --git a/libraries/boost/include/boost/range/mutable_iterator.hpp b/libraries/boost/include/boost/range/mutable_iterator.hpp deleted file mode 100644 index b924666679..0000000000 --- a/libraries/boost/include/boost/range/mutable_iterator.hpp +++ /dev/null @@ -1,79 +0,0 @@ -// Boost.Range library -// -// Copyright Thorsten Ottosen 2003-2004. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// - -#ifndef BOOST_RANGE_MUTABLE_ITERATOR_HPP -#define BOOST_RANGE_MUTABLE_ITERATOR_HPP - -#if defined(_MSC_VER) -# pragma once -#endif - -#include - -#include -#include -#include -#include -#include -#include - -namespace boost -{ - - ////////////////////////////////////////////////////////////////////////// - // default - ////////////////////////////////////////////////////////////////////////// - - namespace range_detail - { - -BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( iterator ) - -template< typename C > -struct range_mutable_iterator - : range_detail::extract_iterator< - BOOST_DEDUCED_TYPENAME remove_reference::type> -{}; - -////////////////////////////////////////////////////////////////////////// -// pair -////////////////////////////////////////////////////////////////////////// - -template< typename Iterator > -struct range_mutable_iterator< std::pair > -{ - typedef Iterator type; -}; - -////////////////////////////////////////////////////////////////////////// -// array -////////////////////////////////////////////////////////////////////////// - -template< typename T, std::size_t sz > -struct range_mutable_iterator< T[sz] > -{ - typedef T* type; -}; - - } // namespace range_detail - -template -struct range_mutable_iterator - : range_detail::range_mutable_iterator< - BOOST_DEDUCED_TYPENAME remove_reference::type - > -{ -}; - -} // namespace boost - -#include - -#endif diff --git a/libraries/boost/include/boost/range/range_fwd.hpp b/libraries/boost/include/boost/range/range_fwd.hpp deleted file mode 100644 index 0e6e00f553..0000000000 --- a/libraries/boost/include/boost/range/range_fwd.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// Boost.Range library -// -// Copyright Neil Groves 2003-2004. -// Use, modification and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// For more information, see http://www.boost.org/libs/range/ -// -#ifndef BOOST_RANGE_RANGE_FWD_HPP_INCLUDED -#define BOOST_RANGE_RANGE_FWD_HPP_INCLUDED - -namespace boost -{ - -// Extension points - template - struct range_iterator; - - template - struct range_mutable_iterator; - - template - struct range_const_iterator; - -// Core classes - template - class iterator_range; - - template - class sub_range; - -// Meta-functions - template - struct range_category; - - template - struct range_difference; - - template - struct range_pointer; - - template - struct range_reference; - - template - struct range_reverse_iterator; - - template - struct range_size; - - template - struct range_value; - - template - struct has_range_iterator; - - template - struct has_range_const_iterator; - -} // namespace boost - -#endif // include guard diff --git a/libraries/boost/include/boost/scoped_array.hpp b/libraries/boost/include/boost/scoped_array.hpp deleted file mode 100644 index d91889b7cf..0000000000 --- a/libraries/boost/include/boost/scoped_array.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED -#define BOOST_SCOPED_ARRAY_HPP_INCLUDED - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include - -#endif // #ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED diff --git a/libraries/boost/include/boost/scoped_ptr.hpp b/libraries/boost/include/boost/scoped_ptr.hpp deleted file mode 100644 index 334a22e2fe..0000000000 --- a/libraries/boost/include/boost/scoped_ptr.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef BOOST_SCOPED_PTR_HPP_INCLUDED -#define BOOST_SCOPED_PTR_HPP_INCLUDED - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include - -#endif // #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/shared_ptr.hpp b/libraries/boost/include/boost/shared_ptr.hpp deleted file mode 100644 index cb01b26588..0000000000 --- a/libraries/boost/include/boost/shared_ptr.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED -#define BOOST_SHARED_PTR_HPP_INCLUDED - -// -// shared_ptr.hpp -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001-2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include - -#endif // #ifndef BOOST_SHARED_PTR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/allocate_shared_array.hpp b/libraries/boost/include/boost/smart_ptr/allocate_shared_array.hpp deleted file mode 100644 index 340688146c..0000000000 --- a/libraries/boost/include/boost/smart_ptr/allocate_shared_array.hpp +++ /dev/null @@ -1,703 +0,0 @@ -/* -Copyright 2012-2017 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP -#define BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP - -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace detail { - -template -struct sp_if_array { }; - -template -struct sp_if_array { - typedef boost::shared_ptr type; -}; - -template -struct sp_if_size_array { }; - -template -struct sp_if_size_array { - typedef boost::shared_ptr type; -}; - -template -struct sp_array_element { }; - -template -struct sp_array_element { - typedef T type; -}; - -template -struct sp_array_element { - typedef T type; -}; - -template -struct sp_array_scalar { - typedef T type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_count { - enum { - value = 1 - }; -}; - -template -struct sp_array_count { - enum { - value = N * sp_array_count::value - }; -}; - -template -struct sp_max_size { - enum { - value = N < M ? M : N - }; -}; - -template -struct sp_align_up { - enum { - value = (N + M - 1) & ~(M - 1) - }; -}; - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template -struct sp_bind_allocator { - typedef typename std::allocator_traits::template rebind_alloc type; -}; -#else -template -struct sp_bind_allocator { - typedef typename A::template rebind::other type; -}; -#endif - -template -BOOST_CONSTEXPR inline std::size_t -sp_objects(std::size_t size) BOOST_SP_NOEXCEPT -{ - return (size + sizeof(T) - 1) / sizeof(T); -} - -template -struct sp_enable { }; - -template -struct sp_enable { - typedef T type; -}; - -template -inline typename sp_enable::value>::type -sp_array_destroy(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } - -template -inline typename sp_enable::value>::type -sp_array_destroy(A&, T* start, std::size_t size) -{ - while (size > 0) { - start[--size].~T(); - } -} - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template -inline typename sp_enable::type -sp_array_destroy(A& allocator, T* start, std::size_t size) -{ - while (size > 0) { - std::allocator_traits::destroy(allocator, start + --size); - } -} -#endif - -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value>::type -sp_array_construct(A&, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - start[i] = T(); - } -} - -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value>::type -sp_array_construct(A&, T* start, std::size_t size, const T* list, - std::size_t count) -{ - for (std::size_t i = 0; i < size; ++i) { - start[i] = list[i % count]; - } -} - -#if !defined(BOOST_NO_EXCEPTIONS) -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value)>::type -sp_array_construct(A& none, T* start, std::size_t size) -{ - std::size_t i = 0; - try { - for (; i < size; ++i) { - ::new(static_cast(start + i)) T(); - } - } catch (...) { - sp_array_destroy(none, start, i); - throw; - } -} - -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value)>::type -sp_array_construct(A& none, T* start, std::size_t size, const T* list, - std::size_t count) -{ - std::size_t i = 0; - try { - for (; i < size; ++i) { - ::new(static_cast(start + i)) T(list[i % count]); - } - } catch (...) { - sp_array_destroy(none, start, i); - throw; - } -} -#else -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value)>::type -sp_array_construct(A&, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - ::new(static_cast(start + i)) T(); - } -} - -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value)>::type -sp_array_construct(A&, T* start, std::size_t size, const T* list, - std::size_t count) -{ - for (std::size_t i = 0; i < size; ++i) { - ::new(static_cast(start + i)) T(list[i % count]); - } -} -#endif - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -#if !defined(BOOST_NO_EXCEPTIONS) -template -inline typename sp_enable::type -sp_array_construct(A& allocator, T* start, std::size_t size) -{ - std::size_t i = 0; - try { - for (i = 0; i < size; ++i) { - std::allocator_traits::construct(allocator, start + i); - } - } catch (...) { - sp_array_destroy(allocator, start, i); - throw; - } -} - -template -inline typename sp_enable::type -sp_array_construct(A& allocator, T* start, std::size_t size, const T* list, - std::size_t count) -{ - std::size_t i = 0; - try { - for (i = 0; i < size; ++i) { - std::allocator_traits::construct(allocator, start + i, - list[i % count]); - } - } catch (...) { - sp_array_destroy(allocator, start, i); - throw; - } -} -#else -template -inline typename sp_enable::type -sp_array_construct(A& allocator, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - std::allocator_traits::construct(allocator, start + i); - } -} - -template -inline typename sp_enable::type -sp_array_construct(A& allocator, T* start, std::size_t size, const T* list, - std::size_t count) -{ - for (std::size_t i = 0; i < size; ++i) { - std::allocator_traits::construct(allocator, start + i, - list[i % count]); - } -} -#endif -#endif - -template -inline typename sp_enable::value>::type -sp_array_default(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } - -#if !defined(BOOST_NO_EXCEPTIONS) -template -inline typename sp_enable::value>::type -sp_array_default(A& none, T* start, std::size_t size) -{ - std::size_t i = 0; - try { - for (; i < size; ++i) { - ::new(static_cast(start + i)) T; - } - } catch (...) { - sp_array_destroy(none, start, i); - throw; - } -} -#else -template -inline typename sp_enable::value>::type -sp_array_default(A&, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - ::new(static_cast(start + i)) T; - } -} -#endif - -template -class sp_array_state { -public: - typedef A type; - - template - sp_array_state(const U& _allocator, std::size_t _size) BOOST_SP_NOEXCEPT - : allocator_(_allocator), - size_(_size) { } - - A& allocator() BOOST_SP_NOEXCEPT { - return allocator_; - } - - std::size_t size() const BOOST_SP_NOEXCEPT { - return size_; - } - -private: - A allocator_; - std::size_t size_; -}; - -template -class sp_size_array_state { -public: - typedef A type; - - template - sp_size_array_state(const U& _allocator, std::size_t) BOOST_SP_NOEXCEPT - : allocator_(_allocator) { } - - A& allocator() BOOST_SP_NOEXCEPT { - return allocator_; - } - - BOOST_CONSTEXPR std::size_t size() const BOOST_SP_NOEXCEPT { - return N; - } - -private: - A allocator_; -}; - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template -struct sp_use_construct { - enum { - value = true - }; -}; - -template -struct sp_use_construct > { - enum { - value = false - }; -}; -#else -template -struct sp_use_construct { - enum { - value = false - }; -}; -#endif - -template -struct sp_array_alignment { - enum { - value = sp_max_size::value, - boost::alignment_of::value>::value - }; -}; - -template -struct sp_array_offset { - enum { - value = sp_align_up::value>::value - }; -}; - -template -struct sp_array_storage { - enum { - value = sp_array_alignment::value - }; - typedef typename boost::type_with_alignment::type type; -}; - -template -inline U* -sp_array_start(void* base) BOOST_SP_NOEXCEPT -{ - enum { - size = sp_array_offset::value - }; - return reinterpret_cast(static_cast(base) + size); -} - -template -class sp_array_creator { - typedef typename A::value_type scalar; - - enum { - offset = sp_array_offset::value - }; - - typedef typename sp_array_storage::type type; - -public: - template - sp_array_creator(const U& other, std::size_t size) BOOST_SP_NOEXCEPT - : other_(other), - size_(sp_objects(offset + sizeof(scalar) * size)) { } - - T* create() { - return reinterpret_cast(other_.allocate(size_)); - } - - void destroy(T* base) { - other_.deallocate(reinterpret_cast(base), size_); - } - -private: - typename sp_bind_allocator::type other_; - std::size_t size_; -}; - -struct sp_default { }; - -template::value> -class sp_array_base - : public sp_counted_base { - typedef typename T::type allocator; - -public: - typedef typename allocator::value_type type; - - template - sp_array_base(const A& other, std::size_t size, type* start) - : state_(other, size) { - sp_array_construct(state_.allocator(), start, state_.size()); - } - - template - sp_array_base(const A& other, std::size_t size, const type* list, - std::size_t count, type* start) - : state_(other, size) { - sp_array_construct(state_.allocator(), start, state_.size(), list, - count); - } - - template - sp_array_base(sp_default, const A& other, std::size_t size, type* start) - : state_(other, size) { - sp_array_default(state_.allocator(), start, state_.size()); - } - - T& state() BOOST_SP_NOEXCEPT { - return state_; - } - - virtual void dispose() { - sp_array_destroy(state_.allocator(), - sp_array_start(this), state_.size()); - } - - virtual void destroy() { - sp_array_creator other(state_.allocator(), - state_.size()); - this->~sp_array_base(); - other.destroy(this); - } - - virtual void* get_deleter(const sp_typeinfo&) { - return 0; - } - - virtual void* get_local_deleter(const sp_typeinfo&) { - return 0; - } - - virtual void* get_untyped_deleter() { - return 0; - } - -private: - T state_; -}; - -template -struct sp_array_result { -public: - template - sp_array_result(const U& other, std::size_t size) - : creator_(other, size), - result_(creator_.create()) { } - - ~sp_array_result() { - if (result_) { - creator_.destroy(result_); - } - } - - T* get() const { - return result_; - } - - void release() { - result_ = 0; - } - -private: - sp_array_result(const sp_array_result&); - sp_array_result& operator=(const sp_array_result&); - - sp_array_creator creator_; - T* result_; -}; - -} /* detail */ - -template -inline typename detail::sp_if_array::type -allocate_shared(const A& allocator, std::size_t count) -{ - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_array_state state; - typedef detail::sp_array_base base; - std::size_t size = count * detail::sp_array_count::value; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -template -inline typename detail::sp_if_size_array::type -allocate_shared(const A& allocator) -{ - enum { - size = detail::sp_array_count::value - }; - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_size_array_state state; - typedef detail::sp_array_base base; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -template -inline typename detail::sp_if_array::type -allocate_shared(const A& allocator, std::size_t count, - const typename detail::sp_array_element::type& value) -{ - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_array_state state; - typedef detail::sp_array_base base; - std::size_t size = count * detail::sp_array_count::value; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, - reinterpret_cast(&value), - detail::sp_array_count::value, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -template -inline typename detail::sp_if_size_array::type -allocate_shared(const A& allocator, - const typename detail::sp_array_element::type& value) -{ - enum { - size = detail::sp_array_count::value - }; - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_size_array_state state; - typedef detail::sp_array_base base; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, - reinterpret_cast(&value), - detail::sp_array_count::value, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -template -inline typename detail::sp_if_array::type -allocate_shared_noinit(const A& allocator, std::size_t count) -{ - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_array_state state; - typedef detail::sp_array_base base; - std::size_t size = count * detail::sp_array_count::value; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(detail::sp_default(), allocator, - size, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -template -inline typename detail::sp_if_size_array::type -allocate_shared_noinit(const A& allocator) -{ - enum { - size = detail::sp_array_count::value - }; - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_size_array_state state; - typedef detail::sp_array_base base; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(detail::sp_default(), allocator, - size, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -} /* boost */ - -#endif diff --git a/libraries/boost/include/boost/smart_ptr/bad_weak_ptr.hpp b/libraries/boost/include/boost/smart_ptr/bad_weak_ptr.hpp deleted file mode 100644 index b086be595f..0000000000 --- a/libraries/boost/include/boost/smart_ptr/bad_weak_ptr.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/smart_ptr/bad_weak_ptr.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -#ifdef __BORLANDC__ -# pragma warn -8026 // Functions with excep. spec. are not expanded inline -#endif - -namespace boost -{ - -// The standard library that comes with Borland C++ 5.5.1, 5.6.4 -// defines std::exception and its members as having C calling -// convention (-pc). When the definition of bad_weak_ptr -// is compiled with -ps, the compiler issues an error. -// Hence, the temporary #pragma option -pc below. - -#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 -# pragma option push -pc -#endif - -#if defined(BOOST_CLANG) -// Intel C++ on Mac defines __clang__ but doesn't support the pragma -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wweak-vtables" -#endif - -class bad_weak_ptr: public std::exception -{ -public: - - virtual char const * what() const throw() - { - return "tr1::bad_weak_ptr"; - } -}; - -#if defined(BOOST_CLANG) -# pragma clang diagnostic pop -#endif - -#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 -# pragma option pop -#endif - -} // namespace boost - -#ifdef __BORLANDC__ -# pragma warn .8026 // Functions with excep. spec. are not expanded inline -#endif - -#endif // #ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/lightweight_mutex.hpp b/libraries/boost/include/boost/smart_ptr/detail/lightweight_mutex.hpp deleted file mode 100644 index d46b1932c2..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/lightweight_mutex.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lightweight_mutex.hpp - lightweight mutex -// -// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// typedef boost::detail::lightweight_mutex; -// -// boost::detail::lightweight_mutex is a header-only implementation of -// a subset of the Mutex concept requirements: -// -// http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.Mutex -// -// It maps to a CRITICAL_SECTION on Windows or a pthread_mutex on POSIX. -// - -#include - -#if !defined(BOOST_HAS_THREADS) -# include -#elif defined(BOOST_HAS_PTHREADS) -# include -#elif defined(BOOST_HAS_WINTHREADS) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# include -#else -// Use #define BOOST_DISABLE_THREADS to avoid the error -# error Unrecognized threading platform -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/local_counted_base.hpp b/libraries/boost/include/boost/smart_ptr/detail/local_counted_base.hpp deleted file mode 100644 index fdfe2c65cd..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/local_counted_base.hpp +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/local_counted_base.hpp -// -// Copyright 2017 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -class local_counted_base -{ -private: - - local_counted_base & operator= ( local_counted_base const & ); - -private: - - // not 'int' or 'unsigned' to avoid aliasing and enable optimizations - enum count_type { min_ = 0, initial_ = 1, max_ = 2147483647 }; - - count_type local_use_count_; - -public: - - BOOST_CONSTEXPR local_counted_base() BOOST_SP_NOEXCEPT: local_use_count_( initial_ ) - { - } - - BOOST_CONSTEXPR local_counted_base( local_counted_base const & ) BOOST_SP_NOEXCEPT: local_use_count_( initial_ ) - { - } - - virtual ~local_counted_base() /*BOOST_SP_NOEXCEPT*/ - { - } - - virtual void local_cb_destroy() BOOST_SP_NOEXCEPT = 0; - - virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT = 0; - - void add_ref() BOOST_SP_NOEXCEPT - { -#if !defined(__NVCC__) -#if defined( __has_builtin ) -# if __has_builtin( __builtin_assume ) - - __builtin_assume( local_use_count_ >= 1 ); - -# endif -#endif -#endif - - local_use_count_ = static_cast( local_use_count_ + 1 ); - } - - void release() BOOST_SP_NOEXCEPT - { - local_use_count_ = static_cast( local_use_count_ - 1 ); - - if( local_use_count_ == 0 ) - { - local_cb_destroy(); - } - } - - long local_use_count() const BOOST_SP_NOEXCEPT - { - return local_use_count_; - } -}; - -class local_counted_impl: public local_counted_base -{ -private: - - local_counted_impl( local_counted_impl const & ); - -private: - - shared_count pn_; - -public: - - explicit local_counted_impl( shared_count const& pn ): pn_( pn ) - { - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - explicit local_counted_impl( shared_count && pn ): pn_( std::move(pn) ) - { - } - -#endif - - virtual void local_cb_destroy() BOOST_SP_NOEXCEPT - { - delete this; - } - - virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT - { - return pn_; - } -}; - -class local_counted_impl_em: public local_counted_base -{ -public: - - shared_count pn_; - - virtual void local_cb_destroy() BOOST_SP_NOEXCEPT - { - shared_count().swap( pn_ ); - } - - virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT - { - return pn_; - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/local_sp_deleter.hpp b/libraries/boost/include/boost/smart_ptr/detail/local_sp_deleter.hpp deleted file mode 100644 index 7d04f1dc52..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/local_sp_deleter.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/local_sp_deleter.hpp -// -// Copyright 2017 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include - -namespace boost -{ - -namespace detail -{ - -template class local_sp_deleter: public local_counted_impl_em -{ -private: - - D d_; - -public: - - local_sp_deleter(): d_() - { - } - - explicit local_sp_deleter( D const& d ) BOOST_SP_NOEXCEPT: d_( d ) - { - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - explicit local_sp_deleter( D&& d ) BOOST_SP_NOEXCEPT: d_( std::move(d) ) - { - } - -#endif - - D& deleter() - { - return d_; - } - - template void operator()( Y* p ) BOOST_SP_NOEXCEPT - { - d_( p ); - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - void operator()( boost::detail::sp_nullptr_t p ) BOOST_SP_NOEXCEPT - { - d_( p ); - } - -#endif -}; - -template<> class local_sp_deleter -{ -}; - -template D * get_local_deleter( local_sp_deleter * p ) -{ - return &p->deleter(); -} - -inline void * get_local_deleter( local_sp_deleter * /*p*/ ) -{ - return 0; -} - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/lwm_nop.hpp b/libraries/boost/include/boost/smart_ptr/detail/lwm_nop.hpp deleted file mode 100644 index 521a88ec1c..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/lwm_nop.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lwm_nop.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -namespace boost -{ - -namespace detail -{ - -class lightweight_mutex -{ -public: - - typedef lightweight_mutex scoped_lock; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/lwm_pthreads.hpp b/libraries/boost/include/boost/smart_ptr/detail/lwm_pthreads.hpp deleted file mode 100644 index 8eda518233..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/lwm_pthreads.hpp +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lwm_pthreads.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -namespace boost -{ - -namespace detail -{ - -class lightweight_mutex -{ -private: - - pthread_mutex_t m_; - - lightweight_mutex(lightweight_mutex const &); - lightweight_mutex & operator=(lightweight_mutex const &); - -public: - - lightweight_mutex() - { - -// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init - -#if defined(__hpux) && defined(_DECTHREADS_) - BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 ); -#else - BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 ); -#endif - } - - ~lightweight_mutex() - { - BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 ); - } - - class scoped_lock; - friend class scoped_lock; - - class scoped_lock - { - private: - - pthread_mutex_t & m_; - - scoped_lock(scoped_lock const &); - scoped_lock & operator=(scoped_lock const &); - - public: - - scoped_lock(lightweight_mutex & m): m_(m.m_) - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - } - - ~scoped_lock() - { - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - } - }; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/lwm_win32_cs.hpp b/libraries/boost/include/boost/smart_ptr/detail/lwm_win32_cs.hpp deleted file mode 100644 index 25b1f195b7..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/lwm_win32_cs.hpp +++ /dev/null @@ -1,134 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lwm_win32_cs.hpp -// -// Copyright (c) 2002, 2003 Peter Dimov -// Copyright (c) Microsoft Corporation 2014 -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#ifdef BOOST_USE_WINDOWS_H - -#include - -#else - -struct _RTL_CRITICAL_SECTION; - -#endif - -namespace boost -{ - -namespace detail -{ - -#ifndef BOOST_USE_WINDOWS_H - -struct critical_section -{ - struct critical_section_debug * DebugInfo; - long LockCount; - long RecursionCount; - void * OwningThread; - void * LockSemaphore; -#if defined(_WIN64) - unsigned __int64 SpinCount; -#else - unsigned long SpinCount; -#endif -}; - -#if BOOST_PLAT_WINDOWS_RUNTIME -extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSectionEx(::_RTL_CRITICAL_SECTION *, unsigned long, unsigned long); -#else -extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(::_RTL_CRITICAL_SECTION *); -#endif -extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRITICAL_SECTION *); -extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *); -extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *); - -#else - -typedef ::CRITICAL_SECTION critical_section; - -#if BOOST_PLAT_WINDOWS_RUNTIME -using ::InitializeCriticalSectionEx; -#else -using ::InitializeCriticalSection; -#endif -using ::EnterCriticalSection; -using ::LeaveCriticalSection; -using ::DeleteCriticalSection; - -#endif // #ifndef BOOST_USE_WINDOWS_H - -class lightweight_mutex -{ -private: - - critical_section cs_; - - lightweight_mutex(lightweight_mutex const &); - lightweight_mutex & operator=(lightweight_mutex const &); - -public: - - lightweight_mutex() - { -#if BOOST_PLAT_WINDOWS_RUNTIME - boost::detail::InitializeCriticalSectionEx(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_), 4000, 0); -#else - boost::detail::InitializeCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_)); -#endif - } - - ~lightweight_mutex() - { - boost::detail::DeleteCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_)); - } - - class scoped_lock; - friend class scoped_lock; - - class scoped_lock - { - private: - - lightweight_mutex & m_; - - scoped_lock(scoped_lock const &); - scoped_lock & operator=(scoped_lock const &); - - public: - - explicit scoped_lock(lightweight_mutex & m): m_(m) - { - boost::detail::EnterCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_)); - } - - ~scoped_lock() - { - boost::detail::LeaveCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_)); - } - }; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/operator_bool.hpp b/libraries/boost/include/boost/smart_ptr/detail/operator_bool.hpp deleted file mode 100644 index f9c5ef6803..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/operator_bool.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// This header intentionally has no include guards. -// -// Copyright (c) 2001-2009, 2012 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !defined( BOOST_NO_CXX11_NULLPTR )\ - && !(defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5130)) - - explicit operator bool () const BOOST_SP_NOEXCEPT - { - return px != 0; - } - -#elif ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) - - operator bool () const BOOST_SP_NOEXCEPT - { - return px != 0; - } - -#elif defined( _MANAGED ) - - static void unspecified_bool( this_type*** ) - { - } - - typedef void (*unspecified_bool_type)( this_type*** ); - - operator unspecified_bool_type() const BOOST_SP_NOEXCEPT - { - return px == 0? 0: unspecified_bool; - } - -#elif \ - ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ - ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ - ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) - - typedef element_type * (this_type::*unspecified_bool_type)() const; - - operator unspecified_bool_type() const BOOST_SP_NOEXCEPT - { - return px == 0? 0: &this_type::get; - } - -#else - - typedef element_type * this_type::*unspecified_bool_type; - - operator unspecified_bool_type() const BOOST_SP_NOEXCEPT - { - return px == 0? 0: &this_type::px; - } - -#endif - - // operator! is redundant, but some compilers need it - bool operator! () const BOOST_SP_NOEXCEPT - { - return px == 0; - } diff --git a/libraries/boost/include/boost/smart_ptr/detail/quick_allocator.hpp b/libraries/boost/include/boost/smart_ptr/detail/quick_allocator.hpp deleted file mode 100644 index 159bd5e7aa..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/quick_allocator.hpp +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/quick_allocator.hpp -// -// Copyright (c) 2003 David Abrahams -// Copyright (c) 2003 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#include -#include -#include - -#include // ::operator new, ::operator delete -#include // std::size_t - -namespace boost -{ - -namespace detail -{ - -template union freeblock -{ - typedef typename boost::type_with_alignment::type aligner_type; - aligner_type aligner; - char bytes[size]; - freeblock * next; -}; - -template struct allocator_impl -{ - typedef freeblock block; - - // It may seem odd to use such small pages. - // - // However, on a typical Windows implementation that uses - // the OS allocator, "normal size" pages interact with the - // "ordinary" operator new, slowing it down dramatically. - // - // 512 byte pages are handled by the small object allocator, - // and don't interfere with ::new. - // - // The other alternative is to use much bigger pages (1M.) - // - // It is surprisingly easy to hit pathological behavior by - // varying the page size. g++ 2.96 on Red Hat Linux 7.2, - // for example, passionately dislikes 496. 512 seems OK. - -#if defined(BOOST_QA_PAGE_SIZE) - - enum { items_per_page = BOOST_QA_PAGE_SIZE / size }; - -#else - - enum { items_per_page = 512 / size }; // 1048560 / size - -#endif - -#ifdef BOOST_HAS_THREADS - - static lightweight_mutex & mutex() - { - static freeblock< sizeof( lightweight_mutex ), boost::alignment_of< lightweight_mutex >::value > fbm; - static lightweight_mutex * pm = new( &fbm ) lightweight_mutex; - return *pm; - } - - static lightweight_mutex * mutex_init; - -#endif - - static block * free; - static block * page; - static unsigned last; - - static inline void * alloc() - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - if(block * x = free) - { - free = x->next; - return x; - } - else - { - if(last == items_per_page) - { - // "Listen to me carefully: there is no memory leak" - // -- Scott Meyers, Eff C++ 2nd Ed Item 10 - page = ::new block[items_per_page]; - last = 0; - } - - return &page[last++]; - } - } - - static inline void * alloc(std::size_t n) - { - if(n != size) // class-specific new called for a derived object - { - return ::operator new(n); - } - else - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - if(block * x = free) - { - free = x->next; - return x; - } - else - { - if(last == items_per_page) - { - page = ::new block[items_per_page]; - last = 0; - } - - return &page[last++]; - } - } - } - - static inline void dealloc(void * pv) - { - if(pv != 0) // 18.4.1.1/13 - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - block * pb = static_cast(pv); - pb->next = free; - free = pb; - } - } - - static inline void dealloc(void * pv, std::size_t n) - { - if(n != size) // class-specific delete called for a derived object - { - ::operator delete(pv); - } - else if(pv != 0) // 18.4.1.1/13 - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - block * pb = static_cast(pv); - pb->next = free; - free = pb; - } - } -}; - -#ifdef BOOST_HAS_THREADS - -template - lightweight_mutex * allocator_impl::mutex_init = &allocator_impl::mutex(); - -#endif - -template - freeblock * allocator_impl::free = 0; - -template - freeblock * allocator_impl::page = 0; - -template - unsigned allocator_impl::last = allocator_impl::items_per_page; - -template -struct quick_allocator: public allocator_impl< sizeof(T), boost::alignment_of::value > -{ -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/shared_count.hpp b/libraries/boost/include/boost/smart_ptr/detail/shared_count.hpp deleted file mode 100644 index ae7d0fb46f..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/shared_count.hpp +++ /dev/null @@ -1,667 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/shared_count.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#ifdef __BORLANDC__ -# pragma warn -8027 // Functions containing try are not expanded inline -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -// In order to avoid circular dependencies with Boost.TR1 -// we make sure that our include of doesn't try to -// pull in the TR1 headers: that's why we use this header -// rather than including directly: -#include // std::auto_ptr -#include // std::less - -#ifdef BOOST_NO_EXCEPTIONS -# include // std::bad_alloc -#endif - -#include - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - -namespace boost -{ - -namespace movelib -{ - -template< class T, class D > class unique_ptr; - -} // namespace movelib - -namespace detail -{ - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -int const shared_count_id = 0x2C35F101; -int const weak_count_id = 0x298C38A4; - -#endif - -struct sp_nothrow_tag {}; - -template< class D > struct sp_inplace_tag -{ -}; - -template< class T > class sp_reference_wrapper -{ -public: - - explicit sp_reference_wrapper( T & t): t_( boost::addressof( t ) ) - { - } - - template< class Y > void operator()( Y * p ) const - { - (*t_)( p ); - } - -private: - - T * t_; -}; - -template< class D > struct sp_convert_reference -{ - typedef D type; -}; - -template< class D > struct sp_convert_reference< D& > -{ - typedef sp_reference_wrapper< D > type; -}; - -class weak_count; - -class shared_count -{ -private: - - sp_counted_base * pi_; - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - int id_; -#endif - - friend class weak_count; - -public: - - BOOST_CONSTEXPR shared_count(): pi_(0) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - } - - BOOST_CONSTEXPR explicit shared_count( sp_counted_base * pi ): pi_( pi ) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - } - - template explicit shared_count( Y * p ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = new sp_counted_impl_p( p ); - } - catch(...) - { - boost::checked_delete( p ); - throw; - } - -#else - - pi_ = new sp_counted_impl_p( p ); - - if( pi_ == 0 ) - { - boost::checked_delete( p ); - boost::throw_exception( std::bad_alloc() ); - } - -#endif - } - -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) - template shared_count( Y * p, D d ): pi_(0) -#else - template shared_count( P p, D d ): pi_(0) -#endif -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) - typedef Y* P; -#endif -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = new sp_counted_impl_pd(p, d); - } - catch(...) - { - d(p); // delete p - throw; - } - -#else - - pi_ = new sp_counted_impl_pd(p, d); - - if(pi_ == 0) - { - d(p); // delete p - boost::throw_exception(std::bad_alloc()); - } - -#endif - } - -#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - - template< class P, class D > shared_count( P p, sp_inplace_tag ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = new sp_counted_impl_pd< P, D >( p ); - } - catch( ... ) - { - D::operator_fn( p ); // delete p - throw; - } - -#else - - pi_ = new sp_counted_impl_pd< P, D >( p ); - - if( pi_ == 0 ) - { - D::operator_fn( p ); // delete p - boost::throw_exception( std::bad_alloc() ); - } - -#endif // #ifndef BOOST_NO_EXCEPTIONS - } - -#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - - template shared_count( P p, D d, A a ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - typedef sp_counted_impl_pda impl_type; - -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - typedef typename std::allocator_traits::template rebind_alloc< impl_type > A2; - -#else - - typedef typename A::template rebind< impl_type >::other A2; - -#endif - - A2 a2( a ); - -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = a2.allocate( 1 ); - ::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); - } - catch(...) - { - d( p ); - - if( pi_ != 0 ) - { - a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); - } - - throw; - } - -#else - - pi_ = a2.allocate( 1 ); - - if( pi_ != 0 ) - { - ::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); - } - else - { - d( p ); - boost::throw_exception( std::bad_alloc() ); - } - -#endif - } - -#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - - template< class P, class D, class A > shared_count( P p, sp_inplace_tag< D >, A a ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - typedef sp_counted_impl_pda< P, D, A > impl_type; - -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - typedef typename std::allocator_traits::template rebind_alloc< impl_type > A2; - -#else - - typedef typename A::template rebind< impl_type >::other A2; - -#endif - - A2 a2( a ); - -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = a2.allocate( 1 ); - ::new( static_cast< void* >( pi_ ) ) impl_type( p, a ); - } - catch(...) - { - D::operator_fn( p ); - - if( pi_ != 0 ) - { - a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); - } - - throw; - } - -#else - - pi_ = a2.allocate( 1 ); - - if( pi_ != 0 ) - { - ::new( static_cast< void* >( pi_ ) ) impl_type( p, a ); - } - else - { - D::operator_fn( p ); - boost::throw_exception( std::bad_alloc() ); - } - -#endif // #ifndef BOOST_NO_EXCEPTIONS - } - -#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - -#ifndef BOOST_NO_AUTO_PTR - - // auto_ptr is special cased to provide the strong guarantee - - template - explicit shared_count( std::auto_ptr & r ): pi_( new sp_counted_impl_p( r.get() ) ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#ifdef BOOST_NO_EXCEPTIONS - - if( pi_ == 0 ) - { - boost::throw_exception(std::bad_alloc()); - } - -#endif - - r.release(); - } - -#endif - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) - - template - explicit shared_count( std::unique_ptr & r ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - typedef typename sp_convert_reference::type D2; - - D2 d2( r.get_deleter() ); - pi_ = new sp_counted_impl_pd< typename std::unique_ptr::pointer, D2 >( r.get(), d2 ); - -#ifdef BOOST_NO_EXCEPTIONS - - if( pi_ == 0 ) - { - boost::throw_exception( std::bad_alloc() ); - } - -#endif - - r.release(); - } - -#endif - - template - explicit shared_count( boost::movelib::unique_ptr & r ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - typedef typename sp_convert_reference::type D2; - - D2 d2( r.get_deleter() ); - pi_ = new sp_counted_impl_pd< typename boost::movelib::unique_ptr::pointer, D2 >( r.get(), d2 ); - -#ifdef BOOST_NO_EXCEPTIONS - - if( pi_ == 0 ) - { - boost::throw_exception( std::bad_alloc() ); - } - -#endif - - r.release(); - } - - ~shared_count() // nothrow - { - if( pi_ != 0 ) pi_->release(); -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - id_ = 0; -#endif - } - - shared_count(shared_count const & r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - if( pi_ != 0 ) pi_->add_ref_copy(); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - shared_count(shared_count && r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - r.pi_ = 0; - } - -#endif - - explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 - shared_count( weak_count const & r, sp_nothrow_tag ); // constructs an empty *this when r.use_count() == 0 - - shared_count & operator= (shared_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - - if( tmp != pi_ ) - { - if( tmp != 0 ) tmp->add_ref_copy(); - if( pi_ != 0 ) pi_->release(); - pi_ = tmp; - } - - return *this; - } - - void swap(shared_count & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - r.pi_ = pi_; - pi_ = tmp; - } - - long use_count() const // nothrow - { - return pi_ != 0? pi_->use_count(): 0; - } - - bool unique() const // nothrow - { - return use_count() == 1; - } - - bool empty() const // nothrow - { - return pi_ == 0; - } - - friend inline bool operator==(shared_count const & a, shared_count const & b) - { - return a.pi_ == b.pi_; - } - - friend inline bool operator<(shared_count const & a, shared_count const & b) - { - return std::less()( a.pi_, b.pi_ ); - } - - void * get_deleter( sp_typeinfo const & ti ) const - { - return pi_? pi_->get_deleter( ti ): 0; - } - - void * get_local_deleter( sp_typeinfo const & ti ) const - { - return pi_? pi_->get_local_deleter( ti ): 0; - } - - void * get_untyped_deleter() const - { - return pi_? pi_->get_untyped_deleter(): 0; - } -}; - - -class weak_count -{ -private: - - sp_counted_base * pi_; - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - int id_; -#endif - - friend class shared_count; - -public: - - BOOST_CONSTEXPR weak_count(): pi_(0) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - } - - weak_count(shared_count const & r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - if(pi_ != 0) pi_->weak_add_ref(); - } - - weak_count(weak_count const & r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - if(pi_ != 0) pi_->weak_add_ref(); - } - -// Move support - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - weak_count(weak_count && r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - r.pi_ = 0; - } - -#endif - - ~weak_count() // nothrow - { - if(pi_ != 0) pi_->weak_release(); -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - id_ = 0; -#endif - } - - weak_count & operator= (shared_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - - if( tmp != pi_ ) - { - if(tmp != 0) tmp->weak_add_ref(); - if(pi_ != 0) pi_->weak_release(); - pi_ = tmp; - } - - return *this; - } - - weak_count & operator= (weak_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - - if( tmp != pi_ ) - { - if(tmp != 0) tmp->weak_add_ref(); - if(pi_ != 0) pi_->weak_release(); - pi_ = tmp; - } - - return *this; - } - - void swap(weak_count & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - r.pi_ = pi_; - pi_ = tmp; - } - - long use_count() const // nothrow - { - return pi_ != 0? pi_->use_count(): 0; - } - - bool empty() const // nothrow - { - return pi_ == 0; - } - - friend inline bool operator==(weak_count const & a, weak_count const & b) - { - return a.pi_ == b.pi_; - } - - friend inline bool operator<(weak_count const & a, weak_count const & b) - { - return std::less()(a.pi_, b.pi_); - } -}; - -inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif -{ - if( pi_ == 0 || !pi_->add_ref_lock() ) - { - boost::throw_exception( boost::bad_weak_ptr() ); - } -} - -inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( r.pi_ ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif -{ - if( pi_ != 0 && !pi_->add_ref_lock() ) - { - pi_ = 0; - } -} - -} // namespace detail - -} // namespace boost - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic pop -#endif - -#ifdef __BORLANDC__ -# pragma warn .8027 // Functions containing try are not expanded inline -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_convertible.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_convertible.hpp deleted file mode 100644 index 4bba9ed444..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_convertible.hpp +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_convertible.hpp -// -// Copyright 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE ) -# define BOOST_SP_NO_SP_CONVERTIBLE -#endif - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ < 303 ) -# define BOOST_SP_NO_SP_CONVERTIBLE -#endif - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x630 ) -# define BOOST_SP_NO_SP_CONVERTIBLE -#endif - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - -namespace boost -{ - -namespace detail -{ - -template< class Y, class T > struct sp_convertible -{ - typedef char (&yes) [1]; - typedef char (&no) [2]; - - static yes f( T* ); - static no f( ... ); - - enum _vt { value = sizeof( (f)( static_cast(0) ) ) == sizeof(yes) }; -}; - -template< class Y, class T > struct sp_convertible< Y, T[] > -{ - enum _vt { value = false }; -}; - -template< class Y, class T > struct sp_convertible< Y[], T[] > -{ - enum _vt { value = sp_convertible< Y[1], T[1] >::value }; -}; - -template< class Y, std::size_t N, class T > struct sp_convertible< Y[N], T[] > -{ - enum _vt { value = sp_convertible< Y[1], T[1] >::value }; -}; - -struct sp_empty -{ -}; - -template< bool > struct sp_enable_if_convertible_impl; - -template<> struct sp_enable_if_convertible_impl -{ - typedef sp_empty type; -}; - -template<> struct sp_enable_if_convertible_impl -{ -}; - -template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value > -{ -}; - -} // namespace detail - -} // namespace boost - -#endif // !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base.hpp deleted file mode 100644 index 438613765b..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base.hpp +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base.hpp -// -// Copyright 2005-2013 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -#if !defined( __c2__ ) && defined( __clang__ ) && defined( __has_extension ) -# if __has_extension( __c_atomic__ ) -# define BOOST_SP_HAS_CLANG_C11_ATOMICS -# endif -#endif - -#if defined( BOOST_SP_DISABLE_THREADS ) -# include - -#elif defined( BOOST_SP_USE_STD_ATOMIC ) -# include - -#elif defined( BOOST_SP_USE_SPINLOCK ) -# include - -#elif defined( BOOST_SP_USE_PTHREADS ) -# include - -#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) -# include - -#elif defined( BOOST_SP_HAS_CLANG_C11_ATOMICS ) -# include - -#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) -# include - -#elif defined( __SNC__ ) -# include - -#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined(__PATHSCALE__) -# include - -#elif defined(__HP_aCC) && defined(__ia64) -# include - -#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER ) && !defined(__PATHSCALE__) -# include - -#elif defined( __IBMCPP__ ) && defined( __powerpc ) -# include - -#elif defined( __MWERKS__ ) && defined( __POWERPC__ ) -# include - -#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) ) && !defined(__PATHSCALE__) && !defined( _AIX ) -# include - -#elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) && !defined(__PATHSCALE__) && !defined( __mips16 ) -# include - -#elif defined( BOOST_SP_HAS_SYNC ) -# include - -#elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) ) -# include - -#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__) -# include - -#elif defined( _AIX ) -# include - -#elif !defined( BOOST_HAS_THREADS ) -# include - -#else -# include - -#endif - -#undef BOOST_SP_HAS_CLANG_C11_ATOMICS - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp deleted file mode 100644 index ec6f6ee184..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +++ /dev/null @@ -1,152 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED - -// -// detail/sp_counted_base_acc_ia64.hpp - aC++ on HP-UX IA64 -// -// Copyright 2007 Baruch Zilber -// Copyright 2007 Boris Gubenko -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// - -#include -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - _Asm_fetchadd(_FASZ_W, _SEM_REL, pw, +1, _LDHINT_NONE); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int r = static_cast(_Asm_fetchadd(_FASZ_W, _SEM_REL, pw, -1, _LDHINT_NONE)); - if (1 == r) - { - _Asm_mf(); - } - - return r - 1; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int v = *pw; - - for (;;) - { - if (0 == v) - { - return 0; - } - - _Asm_mov_to_ar(_AREG_CCV, - v, - (_UP_CALL_FENCE | _UP_SYS_FENCE | _DOWN_CALL_FENCE | _DOWN_SYS_FENCE)); - int r = static_cast(_Asm_cmpxchg(_SZ_W, _SEM_ACQ, pw, v + 1, _LDHINT_NONE)); - if (r == v) - { - return r + 1; - } - - v = r; - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); // TODO use ld.acq here - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp deleted file mode 100644 index ce8ee686ba..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED - -// -// detail/sp_counted_base_aix.hpp -// based on: detail/sp_counted_base_w32.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// Copyright 2006 Michael van der Westhuizen -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int32_t* pw ) -{ - // ++*pw; - - fetch_and_add( pw, 1 ); -} - -inline int32_t atomic_decrement( int32_t * pw ) -{ - // return --*pw; - - int32_t originalValue; - - __lwsync(); - originalValue = fetch_and_add( pw, -1 ); - __isync(); - - return (originalValue - 1); -} - -inline int32_t atomic_conditional_increment( int32_t * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int32_t tmp = fetch_and_add( pw, 0 ); - for( ;; ) - { - if( tmp == 0 ) return 0; - if( compare_and_swap( pw, &tmp, tmp + 1 ) ) return (tmp + 1); - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int32_t use_count_; // #shared - int32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return fetch_and_add( const_cast(&use_count_), 0 ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp deleted file mode 100644 index 5d6e073d95..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_clang.hpp - __c11 clang intrinsics -// -// Copyright (c) 2007, 2013, 2015 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include - -namespace boost -{ - -namespace detail -{ - -typedef _Atomic( boost::int_least32_t ) atomic_int_least32_t; - -inline void atomic_increment( atomic_int_least32_t * pw ) -{ - __c11_atomic_fetch_add( pw, 1, __ATOMIC_RELAXED ); -} - -inline boost::int_least32_t atomic_decrement( atomic_int_least32_t * pw ) -{ - return __c11_atomic_fetch_sub( pw, 1, __ATOMIC_ACQ_REL ); -} - -inline boost::int_least32_t atomic_conditional_increment( atomic_int_least32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - boost::int_least32_t r = __c11_atomic_load( pw, __ATOMIC_RELAXED ); - - for( ;; ) - { - if( r == 0 ) - { - return r; - } - - if( __c11_atomic_compare_exchange_weak( pw, &r, r + 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED ) ) - { - return r; - } - } -} - -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wweak-vtables" -#endif - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - atomic_int_least32_t use_count_; // #shared - atomic_int_least32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base() - { - __c11_atomic_init( &use_count_, 1 ); - __c11_atomic_init( &weak_count_, 1 ); - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return __c11_atomic_load( const_cast< atomic_int_least32_t* >( &use_count_ ), __ATOMIC_ACQUIRE ); - } -}; - -#if defined(__clang__) -# pragma clang diagnostic pop -#endif - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp deleted file mode 100644 index 065f7c3d14..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_cw_ppc.hpp - CodeWarrior on PowerPC -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( register long * pw ) -{ - register int a; - - asm - { -loop: - - lwarx a, 0, pw - addi a, a, 1 - stwcx. a, 0, pw - bne- loop - } -} - -inline long atomic_decrement( register long * pw ) -{ - register int a; - - asm - { - sync - -loop: - - lwarx a, 0, pw - addi a, a, -1 - stwcx. a, 0, pw - bne- loop - - isync - } - - return a; -} - -inline long atomic_conditional_increment( register long * pw ) -{ - register int a; - - asm - { -loop: - - lwarx a, 0, pw - cmpwi a, 0 - beq store - - addi a, a, 1 - -store: - - stwcx. a, 0, pw - bne- loop - } - - return a; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp deleted file mode 100644 index 6c3cce8d44..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED - -// -// detail/sp_counted_base_gcc_ia64.hpp - g++ on IA64 -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2006 Peter Dimov -// Copyright 2005 Ben Hutchings -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// - -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - int tmp; - - // No barrier is required here but fetchadd always has an acquire or - // release barrier associated with it. We choose release as it should be - // cheaper. - __asm__ ("fetchadd4.rel %0=%1,1" : - "=r"(tmp), "=m"(*pw) : - "m"( *pw )); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int rv; - - __asm__ (" fetchadd4.rel %0=%1,-1 ;; \n" - " cmp.eq p7,p0=1,%0 ;; \n" - "(p7) ld4.acq %0=%1 " : - "=&r"(rv), "=m"(*pw) : - "m"( *pw ) : - "p7"); - - return rv; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int rv, tmp, tmp2; - - __asm__ ("0: ld4 %0=%3 ;; \n" - " cmp.eq p7,p0=0,%0 ;; \n" - "(p7) br.cond.spnt 1f \n" - " mov ar.ccv=%0 \n" - " add %1=1,%0 ;; \n" - " cmpxchg4.acq %2=%3,%1,ar.ccv ;; \n" - " cmp.ne p7,p0=%0,%2 ;; \n" - "(p7) br.cond.spnt 0b \n" - " mov %0=%1 ;; \n" - "1:" : - "=&r"(rv), "=&r"(tmp), "=&r"(tmp2), "=m"(*pw) : - "m"( *pw ) : - "ar.ccv", "p7"); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); // TODO use ld.acq here - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp deleted file mode 100644 index c3175cf8ed..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +++ /dev/null @@ -1,189 +0,0 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_gcc_mips.hpp - g++ on MIPS -// -// Copyright (c) 2009, Spirent Communications, Inc. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// - -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - int tmp; - - __asm__ __volatile__ - ( - "0:\n\t" - ".set push\n\t" -#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) - ".set mips2\n\t" -#endif - "ll %0, %1\n\t" - "addiu %0, 1\n\t" - "sc %0, %1\n\t" - ".set pop\n\t" - "beqz %0, 0b": - "=&r"( tmp ), "=m"( *pw ): - "m"( *pw ) - ); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int rv, tmp; - - __asm__ __volatile__ - ( - "0:\n\t" - ".set push\n\t" -#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) - ".set mips2\n\t" -#endif - "ll %1, %2\n\t" - "addiu %0, %1, -1\n\t" - "sc %0, %2\n\t" - ".set pop\n\t" - "beqz %0, 0b\n\t" - "addiu %0, %1, -1": - "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): - "m"( *pw ): - "memory" - ); - - return rv; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int rv, tmp; - - __asm__ __volatile__ - ( - "0:\n\t" - ".set push\n\t" -#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) - ".set mips2\n\t" -#endif - "ll %0, %2\n\t" - "beqz %0, 1f\n\t" - "addiu %1, %0, 1\n\t" - "sc %1, %2\n\t" - ".set pop\n\t" - "beqz %1, 0b\n\t" - "addiu %0, %0, 1\n\t" - "1:": - "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): - "m"( *pw ): - "memory" - ); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp deleted file mode 100644 index 0fb807488a..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_gcc_ppc.hpp - g++ on PowerPC -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - int tmp; - - __asm__ - ( - "0:\n\t" - "lwarx %1, 0, %2\n\t" - "addi %1, %1, 1\n\t" - "stwcx. %1, 0, %2\n\t" - "bne- 0b": - - "=m"( *pw ), "=&b"( tmp ): - "r"( pw ), "m"( *pw ): - "cc" - ); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int rv; - - __asm__ __volatile__ - ( - "sync\n\t" - "0:\n\t" - "lwarx %1, 0, %2\n\t" - "addi %1, %1, -1\n\t" - "stwcx. %1, 0, %2\n\t" - "bne- 0b\n\t" - "isync": - - "=m"( *pw ), "=&b"( rv ): - "r"( pw ), "m"( *pw ): - "memory", "cc" - ); - - return rv; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int rv; - - __asm__ - ( - "0:\n\t" - "lwarx %1, 0, %2\n\t" - "cmpwi %1, 0\n\t" - "beq 1f\n\t" - "addi %1, %1, 1\n\t" - "1:\n\t" - "stwcx. %1, 0, %2\n\t" - "bne- 0b": - - "=m"( *pw ), "=&b"( rv ): - "r"( pw ), "m"( *pw ): - "cc" - ); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp deleted file mode 100644 index b8bb707f1b..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ -// -// Copyright (c) 2006 Piotr Wyderski -// Copyright (c) 2006 Tomas Puverle -// Copyright (c) 2006 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// Thanks to Michael van der Westhuizen - -#include -#include // int32_t - -namespace boost -{ - -namespace detail -{ - -inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ ) -{ - __asm__ __volatile__( "cas [%1], %2, %0" - : "+r" (swap_) - : "r" (dest_), "r" (compare_) - : "memory" ); - - return swap_; -} - -inline int32_t atomic_fetch_and_add( int32_t * pw, int32_t dv ) -{ - // long r = *pw; - // *pw += dv; - // return r; - - for( ;; ) - { - int32_t r = *pw; - - if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) - { - return r; - } - } -} - -inline void atomic_increment( int32_t * pw ) -{ - atomic_fetch_and_add( pw, 1 ); -} - -inline int32_t atomic_decrement( int32_t * pw ) -{ - return atomic_fetch_and_add( pw, -1 ); -} - -inline int32_t atomic_conditional_increment( int32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - for( ;; ) - { - int32_t r = *pw; - - if( r == 0 ) - { - return r; - } - - if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) - { - return r; - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int32_t use_count_; // #shared - int32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return const_cast< int32_t const volatile & >( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp deleted file mode 100644 index 3d2dd61ed6..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +++ /dev/null @@ -1,175 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_gcc_x86.hpp - g++ on 486+ or AMD64 -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -namespace boost -{ - -namespace detail -{ - -inline int atomic_exchange_and_add( int * pw, int dv ) -{ - // int r = *pw; - // *pw += dv; - // return r; - - int r; - - __asm__ __volatile__ - ( - "lock\n\t" - "xadd %1, %0": - "=m"( *pw ), "=r"( r ): // outputs (%0, %1) - "m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1) - "memory", "cc" // clobbers - ); - - return r; -} - -inline void atomic_increment( int * pw ) -{ - //atomic_exchange_and_add( pw, 1 ); - - __asm__ - ( - "lock\n\t" - "incl %0": - "=m"( *pw ): // output (%0) - "m"( *pw ): // input (%1) - "cc" // clobbers - ); -} - -inline int atomic_conditional_increment( int * pw ) -{ - // int rv = *pw; - // if( rv != 0 ) ++*pw; - // return rv; - - int rv, tmp; - - __asm__ - ( - "movl %0, %%eax\n\t" - "0:\n\t" - "test %%eax, %%eax\n\t" - "je 1f\n\t" - "movl %%eax, %2\n\t" - "incl %2\n\t" - "lock\n\t" - "cmpxchgl %2, %0\n\t" - "jne 0b\n\t" - "1:": - "=m"( *pw ), "=&a"( rv ), "=&r"( tmp ): // outputs (%0, %1, %2) - "m"( *pw ): // input (%3) - "cc" // clobbers - ); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp deleted file mode 100644 index dea905c905..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_nt.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -namespace boost -{ - -namespace detail -{ - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - ++use_count_; - } - - bool add_ref_lock() // true on success - { - if( use_count_ == 0 ) return false; - ++use_count_; - return true; - } - - void release() // nothrow - { - if( --use_count_ == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - ++weak_count_; - } - - void weak_release() // nothrow - { - if( --weak_count_ == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return use_count_; - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp deleted file mode 100644 index 85f2563d5d..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_pt.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - - mutable pthread_mutex_t m_; - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { -// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init - -#if defined(__hpux) && defined(_DECTHREADS_) - BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 ); -#else - BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 ); -#endif - } - - virtual ~sp_counted_base() // nothrow - { - BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 ); - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - ++use_count_; - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - } - - bool add_ref_lock() // true on success - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - bool r = use_count_ == 0? false: ( ++use_count_, true ); - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - return r; - } - - void release() // nothrow - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - long new_use_count = --use_count_; - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - - if( new_use_count == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - ++weak_count_; - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - } - - void weak_release() // nothrow - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - long new_weak_count = --weak_count_; - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - - if( new_weak_count == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - long r = use_count_; - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - - return r; - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp deleted file mode 100644 index 7b5f9178a6..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED - -// MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ -// -// Copyright (c) 2006 Piotr Wyderski -// Copyright (c) 2006 Tomas Puverle -// Copyright (c) 2006 Peter Dimov -// Copyright (c) 2011 Emil Dotchevski -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// Thanks to Michael van der Westhuizen - -#include -#include // uint32_t - -namespace boost -{ - -namespace detail -{ - -inline uint32_t compare_and_swap( uint32_t * dest_, uint32_t compare_, uint32_t swap_ ) -{ - return __builtin_cellAtomicCompareAndSwap32(dest_,compare_,swap_); -} - -inline uint32_t atomic_fetch_and_add( uint32_t * pw, uint32_t dv ) -{ - // long r = *pw; - // *pw += dv; - // return r; - - for( ;; ) - { - uint32_t r = *pw; - - if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) - { - return r; - } - } -} - -inline void atomic_increment( uint32_t * pw ) -{ - (void) __builtin_cellAtomicIncr32( pw ); -} - -inline uint32_t atomic_decrement( uint32_t * pw ) -{ - return __builtin_cellAtomicDecr32( pw ); -} - -inline uint32_t atomic_conditional_increment( uint32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - for( ;; ) - { - uint32_t r = *pw; - - if( r == 0 ) - { - return r; - } - - if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) - { - return r; - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - uint32_t use_count_; // #shared - uint32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return const_cast< uint32_t const volatile & >( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp deleted file mode 100644 index faf503ad57..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_spin.hpp - spinlock pool atomic emulation -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -namespace boost -{ - -namespace detail -{ - -inline int atomic_exchange_and_add( int * pw, int dv ) -{ - spinlock_pool<1>::scoped_lock lock( pw ); - - int r = *pw; - *pw += dv; - return r; -} - -inline void atomic_increment( int * pw ) -{ - spinlock_pool<1>::scoped_lock lock( pw ); - ++*pw; -} - -inline int atomic_conditional_increment( int * pw ) -{ - spinlock_pool<1>::scoped_lock lock( pw ); - - int rv = *pw; - if( rv != 0 ) ++*pw; - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - spinlock_pool<1>::scoped_lock lock( &use_count_ ); - return use_count_; - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp deleted file mode 100644 index 9f562b9b4a..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_std_atomic.hpp - C++11 std::atomic -// -// Copyright (c) 2007, 2013 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( std::atomic_int_least32_t * pw ) -{ - pw->fetch_add( 1, std::memory_order_relaxed ); -} - -inline std::int_least32_t atomic_decrement( std::atomic_int_least32_t * pw ) -{ - return pw->fetch_sub( 1, std::memory_order_acq_rel ); -} - -inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - std::int_least32_t r = pw->load( std::memory_order_relaxed ); - - for( ;; ) - { - if( r == 0 ) - { - return r; - } - - if( pw->compare_exchange_weak( r, r + 1, std::memory_order_relaxed, std::memory_order_relaxed ) ) - { - return r; - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - std::atomic_int_least32_t use_count_; // #shared - std::atomic_int_least32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return use_count_.load( std::memory_order_acquire ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp deleted file mode 100644 index d2138e7c26..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_sync.hpp - g++ 4.1+ __sync intrinsics -// -// Copyright (c) 2007 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include - -#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) -# include -#endif - -namespace boost -{ - -namespace detail -{ - -#if INT_MAX >= 2147483647 - -typedef int sp_int32_t; - -#else - -typedef long sp_int32_t; - -#endif - -inline void atomic_increment( sp_int32_t * pw ) -{ - __sync_fetch_and_add( pw, 1 ); -} - -inline sp_int32_t atomic_decrement( sp_int32_t * pw ) -{ - return __sync_fetch_and_add( pw, -1 ); -} - -inline sp_int32_t atomic_conditional_increment( sp_int32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - sp_int32_t r = *pw; - - for( ;; ) - { - if( r == 0 ) - { - return r; - } - - sp_int32_t r2 = __sync_val_compare_and_swap( pw, r, r + 1 ); - - if( r2 == r ) - { - return r; - } - else - { - r = r2; - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - sp_int32_t use_count_; // #shared - sp_int32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return const_cast< sp_int32_t const volatile & >( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp deleted file mode 100644 index f2de3b02d8..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +++ /dev/null @@ -1,152 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED - -// -// detail/sp_counted_base_vacpp_ppc.hpp - xlC(vacpp) on POWER -// based on: detail/sp_counted_base_w32.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// Copyright 2006 Michael van der Westhuizen -// Copyright 2012 IBM Corp. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -extern "builtin" void __lwsync(void); -extern "builtin" void __isync(void); -extern "builtin" int __fetch_and_add(volatile int* addr, int val); -extern "builtin" int __compare_and_swap(volatile int*, int*, int); - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int *pw ) -{ - // ++*pw; - __lwsync(); - __fetch_and_add(pw, 1); - __isync(); -} - -inline int atomic_decrement( int *pw ) -{ - // return --*pw; - __lwsync(); - int originalValue = __fetch_and_add(pw, -1); - __isync(); - - return (originalValue - 1); -} - -inline int atomic_conditional_increment( int *pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - __lwsync(); - int v = *const_cast(pw); - for (;;) - // loop until state is known - { - if (v == 0) return 0; - if (__compare_and_swap(pw, &v, v + 1)) - { - __isync(); return (v + 1); - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - char pad[64] __attribute__((__aligned__(64))); - // pad to prevent false sharing -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return *const_cast(&use_count_); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp deleted file mode 100644 index 960e42e128..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_w32.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - BOOST_SP_INTERLOCKED_INCREMENT( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - for( ;; ) - { - long tmp = static_cast< long const volatile& >( use_count_ ); - if( tmp == 0 ) return false; - -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 ) - - // work around a code generation bug - - long tmp2 = tmp + 1; - if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true; - -#else - - if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true; - -#endif - } - } - - void release() // nothrow - { - if( BOOST_SP_INTERLOCKED_DECREMENT( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - BOOST_SP_INTERLOCKED_INCREMENT( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( BOOST_SP_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_impl.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_counted_impl.hpp deleted file mode 100644 index fa2f75eb1a..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_counted_impl.hpp +++ /dev/null @@ -1,292 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_impl.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR) -# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible. -#endif - -#include -#include -#include - -#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) -#include -#endif - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) -#include // std::allocator -#endif - -#include // std::size_t - -namespace boost -{ - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn ); -void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn ); - -#endif - -namespace detail -{ - -// get_local_deleter - -template class local_sp_deleter; - -template D * get_local_deleter( D * /*p*/ ) -{ - return 0; -} - -template D * get_local_deleter( local_sp_deleter * p ); - -// - -template class sp_counted_impl_p: public sp_counted_base -{ -private: - - X * px_; - - sp_counted_impl_p( sp_counted_impl_p const & ); - sp_counted_impl_p & operator= ( sp_counted_impl_p const & ); - - typedef sp_counted_impl_p this_type; - -public: - - explicit sp_counted_impl_p( X * px ): px_( px ) - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_constructor_hook( px, sizeof(X), this ); -#endif - } - - virtual void dispose() // nothrow - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_destructor_hook( px_, sizeof(X), this ); -#endif - boost::checked_delete( px_ ); - } - - virtual void * get_deleter( sp_typeinfo const & ) - { - return 0; - } - - virtual void * get_local_deleter( sp_typeinfo const & ) - { - return 0; - } - - virtual void * get_untyped_deleter() - { - return 0; - } - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) - - void * operator new( std::size_t ) - { - return std::allocator().allocate( 1, static_cast(0) ); - } - - void operator delete( void * p ) - { - std::allocator().deallocate( static_cast(p), 1 ); - } - -#endif - -#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) - - void * operator new( std::size_t ) - { - return quick_allocator::alloc(); - } - - void operator delete( void * p ) - { - quick_allocator::dealloc( p ); - } - -#endif -}; - -// -// Borland's Codeguard trips up over the -Vx- option here: -// -#ifdef __CODEGUARD__ -# pragma option push -Vx- -#endif - -template class sp_counted_impl_pd: public sp_counted_base -{ -private: - - P ptr; // copy constructor must not throw - D del; // copy constructor must not throw - - sp_counted_impl_pd( sp_counted_impl_pd const & ); - sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & ); - - typedef sp_counted_impl_pd this_type; - -public: - - // pre: d(p) must not throw - - sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d ) - { - } - - sp_counted_impl_pd( P p ): ptr( p ), del() - { - } - - virtual void dispose() // nothrow - { - del( ptr ); - } - - virtual void * get_deleter( sp_typeinfo const & ti ) - { - return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast( del ): 0; - } - - virtual void * get_local_deleter( sp_typeinfo const & ti ) - { - return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0; - } - - virtual void * get_untyped_deleter() - { - return &reinterpret_cast( del ); - } - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) - - void * operator new( std::size_t ) - { - return std::allocator().allocate( 1, static_cast(0) ); - } - - void operator delete( void * p ) - { - std::allocator().deallocate( static_cast(p), 1 ); - } - -#endif - -#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) - - void * operator new( std::size_t ) - { - return quick_allocator::alloc(); - } - - void operator delete( void * p ) - { - quick_allocator::dealloc( p ); - } - -#endif -}; - -template class sp_counted_impl_pda: public sp_counted_base -{ -private: - - P p_; // copy constructor must not throw - D d_; // copy constructor must not throw - A a_; // copy constructor must not throw - - sp_counted_impl_pda( sp_counted_impl_pda const & ); - sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & ); - - typedef sp_counted_impl_pda this_type; - -public: - - // pre: d( p ) must not throw - - sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a ) - { - } - - sp_counted_impl_pda( P p, A a ): p_( p ), d_( a ), a_( a ) - { - } - - virtual void dispose() // nothrow - { - d_( p_ ); - } - - virtual void destroy() // nothrow - { -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - typedef typename std::allocator_traits::template rebind_alloc< this_type > A2; - -#else - - typedef typename A::template rebind< this_type >::other A2; - -#endif - - A2 a2( a_ ); - - this->~this_type(); - - a2.deallocate( this, 1 ); - } - - virtual void * get_deleter( sp_typeinfo const & ti ) - { - return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast( d_ ): 0; - } - - virtual void * get_local_deleter( sp_typeinfo const & ti ) - { - return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0; - } - - virtual void * get_untyped_deleter() - { - return &reinterpret_cast( d_ ); - } -}; - -#ifdef __CODEGUARD__ -# pragma option pop -#endif - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp deleted file mode 100644 index f79bdf38a8..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/smart_ptr/detail/sp_disable_deprecated.hpp -// -// Copyright 2015 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#if defined( __GNUC__ ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || ( __cplusplus >= 201103L ) ) - -# if defined( BOOST_GCC ) - -# if BOOST_GCC >= 40600 -# define BOOST_SP_DISABLE_DEPRECATED -# endif - -# elif defined( __clang__ ) && defined( __has_warning ) - -# if __has_warning( "-Wdeprecated-declarations" ) -# define BOOST_SP_DISABLE_DEPRECATED -# endif - -# endif - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_forward.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_forward.hpp deleted file mode 100644 index 8fdec65b7f..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_forward.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_forward.hpp -// -// Copyright 2008,2012 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include - -namespace boost -{ - -namespace detail -{ - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -#if defined( BOOST_GCC ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404 - -// GCC 4.4 supports an outdated version of rvalue references and creates a copy of the forwarded object. -// This results in warnings 'returning reference to temporary'. Therefore we use a special version similar to std::forward. -template< class T > T&& sp_forward( T && t ) BOOST_NOEXCEPT -{ - return t; -} - -#else - -template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT -{ - return static_cast< T&& >( t ); -} - -#endif - -#endif - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_has_sync.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_has_sync.hpp deleted file mode 100644 index e1debf0cc9..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_has_sync.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/smart_ptr/detail/sp_has_sync.hpp -// -// Copyright (c) 2008, 2009 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// Defines the BOOST_SP_HAS_SYNC macro if the __sync_* intrinsics -// are available. -// - -#ifndef BOOST_SP_NO_SYNC - -#if !defined( __c2__ ) && defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 ) - -# define BOOST_SP_HAS_SYNC - -#elif defined( __IBMCPP__ ) && ( __IBMCPP__ >= 1210 ) && !defined( __COMPILER_VER__ ) - -# define BOOST_SP_HAS_SYNC - -#elif !defined( __c2__ ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) - -#define BOOST_SP_HAS_SYNC - -#if defined( __arm__ ) || defined( __armel__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __hppa ) || defined( __hppa__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __m68k__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __sh__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __sparc__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1110 ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined(__PATHSCALE__) && ((__PATHCC__ == 4) && (__PATHCC_MINOR__ < 9)) -#undef BOOST_SP_HAS_SYNC -#endif - -#endif - -#endif // #ifndef BOOST_SP_NO_SYNC - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_interlocked.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_interlocked.hpp deleted file mode 100644 index 79cae14a37..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_interlocked.hpp +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/sp_interlocked.hpp -// -// Copyright 2005, 2014 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -#include - -// BOOST_SP_HAS_INTRIN_H - -// VC9 has intrin.h, but it collides with -#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1600 - -# define BOOST_SP_HAS_INTRIN_H - -// Unlike __MINGW64__, __MINGW64_VERSION_MAJOR is defined by MinGW-w64 for both 32 and 64-bit targets. -#elif defined( __MINGW64_VERSION_MAJOR ) - -// MinGW-w64 provides intrin.h for both 32 and 64-bit targets. -# define BOOST_SP_HAS_INTRIN_H - -// Intel C++ on Windows on VC10+ stdlib -#elif defined( BOOST_INTEL_WIN ) && defined( _CPPLIB_VER ) && _CPPLIB_VER >= 520 - -# define BOOST_SP_HAS_INTRIN_H - -#endif - -#if defined( BOOST_USE_WINDOWS_H ) - -# include - -# define BOOST_SP_INTERLOCKED_INCREMENT InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd - -#elif defined( BOOST_USE_INTRIN_H ) || defined( BOOST_SP_HAS_INTRIN_H ) - -#include - -# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd - -#elif defined( _WIN32_WCE ) - -#if _WIN32_WCE >= 0x600 - -extern "C" long __cdecl _InterlockedIncrement( long volatile * ); -extern "C" long __cdecl _InterlockedDecrement( long volatile * ); -extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); -extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); -extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); - -# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd - -#else - -// under Windows CE we still have old-style Interlocked* functions - -extern "C" long __cdecl InterlockedIncrement( long* ); -extern "C" long __cdecl InterlockedDecrement( long* ); -extern "C" long __cdecl InterlockedCompareExchange( long*, long, long ); -extern "C" long __cdecl InterlockedExchange( long*, long ); -extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); - -# define BOOST_SP_INTERLOCKED_INCREMENT InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd - -#endif - -#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN ) - -#if defined( __CLRCALL_PURE_OR_CDECL ) - -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long ); - -#else - -extern "C" long __cdecl _InterlockedIncrement( long volatile * ); -extern "C" long __cdecl _InterlockedDecrement( long volatile * ); -extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); -extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); -extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); - -# if defined( BOOST_MSVC ) && BOOST_MSVC == 1310 -//From MSDN, Visual Studio .NET 2003 spedific: To declare one of the interlocked functions -//for use as an intrinsic, the function must be declared with the leading underscore and -//the new function must appear in a #pragma intrinsic statement. -# pragma intrinsic( _InterlockedIncrement ) -# pragma intrinsic( _InterlockedDecrement ) -# pragma intrinsic( _InterlockedCompareExchange ) -# pragma intrinsic( _InterlockedExchange ) -# pragma intrinsic( _InterlockedExchangeAdd ) -# endif - -#endif - -# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd - -#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) - -namespace boost -{ - -namespace detail -{ - -extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * ); -extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * ); -extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long ); -extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long ); -extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long ); - -} // namespace detail - -} // namespace boost - -# define BOOST_SP_INTERLOCKED_INCREMENT ::boost::detail::InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT ::boost::detail::InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd - -#else - -# error "Interlocked intrinsics not available" - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_noexcept.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_noexcept.hpp deleted file mode 100644 index 1287ba4952..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_noexcept.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_noexcept.hpp -// -// Copyright 2016, 2017 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include - -// BOOST_SP_NOEXCEPT - -#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1700 && BOOST_MSVC < 1900 - -# define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT_OR_NOTHROW - -#else - -# define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT - -#endif - -// BOOST_SP_NOEXCEPT_WITH_ASSERT - -#if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) ) - -# define BOOST_SP_NOEXCEPT_WITH_ASSERT BOOST_SP_NOEXCEPT - -#elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) ) - -# define BOOST_SP_NOEXCEPT_WITH_ASSERT - -#else - -# define BOOST_SP_NOEXCEPT_WITH_ASSERT BOOST_SP_NOEXCEPT - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/sp_nullptr_t.hpp b/libraries/boost/include/boost/smart_ptr/detail/sp_nullptr_t.hpp deleted file mode 100644 index 219ae8070a..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/sp_nullptr_t.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_nullptr_t.hpp -// -// Copyright 2013 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -namespace boost -{ - -namespace detail -{ - -#if !defined( BOOST_NO_CXX11_DECLTYPE ) && ( ( defined( __clang__ ) && !defined( _LIBCPP_VERSION ) ) || defined( __INTEL_COMPILER ) ) - - typedef decltype(nullptr) sp_nullptr_t; - -#else - - typedef std::nullptr_t sp_nullptr_t; - -#endif - -} // namespace detail - -} // namespace boost - -#endif // !defined( BOOST_NO_CXX11_NULLPTR ) - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock.hpp deleted file mode 100644 index 0b618dfc15..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/spinlock.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/spinlock.hpp -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// struct spinlock -// { -// void lock(); -// bool try_lock(); -// void unlock(); -// -// class scoped_lock; -// }; -// -// #define BOOST_DETAIL_SPINLOCK_INIT -// - -#include -#include - -#if defined( BOOST_SP_USE_STD_ATOMIC ) -# if !defined( __clang__ ) -# include -# else -// Clang (at least up to 3.4) can't compile spinlock_pool when -// using std::atomic, so substitute the __sync implementation instead. -# include -# endif - -#elif defined( BOOST_SP_USE_PTHREADS ) -# include - -#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) -# include - -#elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) -# include - -#elif defined( BOOST_SP_HAS_SYNC ) -# include - -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# include - -#elif defined(BOOST_HAS_PTHREADS) -# include - -#elif !defined(BOOST_HAS_THREADS) -# include - -#else -# error Unrecognized threading platform -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp deleted file mode 100644 index 24d08a8815..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED - -// -// Copyright (c) 2008, 2011 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7S__) - -# define BOOST_SP_ARM_BARRIER "dmb" -# define BOOST_SP_ARM_HAS_LDREX - -#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) - -# define BOOST_SP_ARM_BARRIER "mcr p15, 0, r0, c7, c10, 5" -# define BOOST_SP_ARM_HAS_LDREX - -#else - -# define BOOST_SP_ARM_BARRIER "" - -#endif - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - int v_; - -public: - - bool try_lock() - { - int r; - -#ifdef BOOST_SP_ARM_HAS_LDREX - - __asm__ __volatile__( - "ldrex %0, [%2]; \n" - "cmp %0, %1; \n" - "strexne %0, %1, [%2]; \n" - BOOST_SP_ARM_BARRIER : - "=&r"( r ): // outputs - "r"( 1 ), "r"( &v_ ): // inputs - "memory", "cc" ); - -#else - - __asm__ __volatile__( - "swp %0, %1, [%2];\n" - BOOST_SP_ARM_BARRIER : - "=&r"( r ): // outputs - "r"( 1 ), "r"( &v_ ): // inputs - "memory", "cc" ); - -#endif - - return r == 0; - } - - void lock() - { - for( unsigned k = 0; !try_lock(); ++k ) - { - boost::detail::yield( k ); - } - } - - void unlock() - { - __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" ); - *const_cast< int volatile* >( &v_ ) = 0; - __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" ); - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT {0} - -#undef BOOST_SP_ARM_BARRIER -#undef BOOST_SP_ARM_HAS_LDREX - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_nt.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_nt.hpp deleted file mode 100644 index 1f399d0dd4..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/spinlock_nt.hpp +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - bool locked_; - -public: - - inline bool try_lock() - { - if( locked_ ) - { - return false; - } - else - { - locked_ = true; - return true; - } - } - - inline void lock() - { - BOOST_ASSERT( !locked_ ); - locked_ = true; - } - - inline void unlock() - { - BOOST_ASSERT( locked_ ); - locked_ = false; - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT { false } - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_pool.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_pool.hpp deleted file mode 100644 index 39cf180b24..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/spinlock_pool.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/spinlock_pool.hpp -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// spinlock_pool<0> is reserved for atomic<>, when/if it arrives -// spinlock_pool<1> is reserved for shared_ptr reference counts -// spinlock_pool<2> is reserved for shared_ptr atomic access -// - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -template< int M > class spinlock_pool -{ -private: - - static spinlock pool_[ 41 ]; - -public: - - static spinlock & spinlock_for( void const * pv ) - { -#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 - std::size_t i = reinterpret_cast< unsigned long long >( pv ) % 41; -#else - std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41; -#endif - return pool_[ i ]; - } - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( void const * pv ): sp_( spinlock_for( pv ) ) - { - sp_.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -template< int M > spinlock spinlock_pool< M >::pool_[ 41 ] = -{ - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT -}; - -} // namespace detail -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_pt.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_pt.hpp deleted file mode 100644 index f9cabfc3a7..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/spinlock_pt.hpp +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - pthread_mutex_t v_; - -public: - - bool try_lock() - { - return pthread_mutex_trylock( &v_ ) == 0; - } - - void lock() - { - pthread_mutex_lock( &v_ ); - } - - void unlock() - { - pthread_mutex_unlock( &v_ ); - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT { PTHREAD_MUTEX_INITIALIZER } - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp deleted file mode 100644 index a61c1cd96d..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// Copyright (c) 2014 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - std::atomic_flag v_; - -public: - - bool try_lock() - { - return !v_.test_and_set( std::memory_order_acquire ); - } - - void lock() - { - for( unsigned k = 0; !try_lock(); ++k ) - { - boost::detail::yield( k ); - } - } - - void unlock() - { - v_ .clear( std::memory_order_release ); - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT { ATOMIC_FLAG_INIT } - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_sync.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_sync.hpp deleted file mode 100644 index a7145c5ac2..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/spinlock_sync.hpp +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) -# include -#endif - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - int v_; - -public: - - bool try_lock() - { - int r = __sync_lock_test_and_set( &v_, 1 ); - return r == 0; - } - - void lock() - { - for( unsigned k = 0; !try_lock(); ++k ) - { - boost::detail::yield( k ); - } - } - - void unlock() - { - __sync_lock_release( &v_ ); - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT {0} - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/spinlock_w32.hpp b/libraries/boost/include/boost/smart_ptr/detail/spinlock_w32.hpp deleted file mode 100644 index d34e4fc2b5..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/spinlock_w32.hpp +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -// BOOST_COMPILER_FENCE - -#if defined(__INTEL_COMPILER) - -#define BOOST_COMPILER_FENCE __memory_barrier(); - -#elif defined( _MSC_VER ) && _MSC_VER >= 1310 - -extern "C" void _ReadWriteBarrier(); -#pragma intrinsic( _ReadWriteBarrier ) - -#define BOOST_COMPILER_FENCE _ReadWriteBarrier(); - -#elif defined(__GNUC__) - -#define BOOST_COMPILER_FENCE __asm__ __volatile__( "" : : : "memory" ); - -#else - -#define BOOST_COMPILER_FENCE - -#endif - -// - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - long v_; - -public: - - bool try_lock() - { - long r = BOOST_SP_INTERLOCKED_EXCHANGE( &v_, 1 ); - - BOOST_COMPILER_FENCE - - return r == 0; - } - - void lock() - { - for( unsigned k = 0; !try_lock(); ++k ) - { - boost::detail::yield( k ); - } - } - - void unlock() - { - BOOST_COMPILER_FENCE - *const_cast< long volatile* >( &v_ ) = 0; - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT {0} - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/detail/yield_k.hpp b/libraries/boost/include/boost/smart_ptr/detail/yield_k.hpp deleted file mode 100644 index f8ca6b6467..0000000000 --- a/libraries/boost/include/boost/smart_ptr/detail/yield_k.hpp +++ /dev/null @@ -1,177 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// yield_k.hpp -// -// Copyright (c) 2008 Peter Dimov -// Copyright (c) Microsoft Corporation 2014 -// -// void yield( unsigned k ); -// -// Typical use: -// -// for( unsigned k = 0; !try_lock(); ++k ) yield( k ); -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -#include -#include - -#if BOOST_PLAT_WINDOWS_RUNTIME -#include -#endif - -// BOOST_SMT_PAUSE - -#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) ) && !defined(__c2__) - -extern "C" void _mm_pause(); - -#define BOOST_SMT_PAUSE _mm_pause(); - -#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) - -#define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" ); - -#endif - -// - -#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) - -#if defined( BOOST_USE_WINDOWS_H ) -# include -#endif - -namespace boost -{ - -namespace detail -{ - -#if !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME -#if !BOOST_COMP_CLANG || !defined __MINGW32__ - extern "C" void __stdcall Sleep( unsigned long ms ); -#else -#include <_mingw.h> -#if !defined __MINGW64_VERSION_MAJOR - extern "C" void __stdcall Sleep( unsigned long ms ); -#else - extern "C" __declspec(dllimport) void __stdcall Sleep( unsigned long ms ); -#endif -#endif -#endif - -inline void yield( unsigned k ) -{ - if( k < 4 ) - { - } -#if defined( BOOST_SMT_PAUSE ) - else if( k < 16 ) - { - BOOST_SMT_PAUSE - } -#endif -#if !BOOST_PLAT_WINDOWS_RUNTIME - else if( k < 32 ) - { - Sleep( 0 ); - } - else - { - Sleep( 1 ); - } -#else - else - { - // Sleep isn't supported on the Windows Runtime. - std::this_thread::yield(); - } -#endif -} - -} // namespace detail - -} // namespace boost - -#elif defined( BOOST_HAS_PTHREADS ) - -#ifndef _AIX -#include -#else - // AIX's sched.h defines ::var which sometimes conflicts with Lambda's var - extern "C" int sched_yield(void); -#endif - -#include - -namespace boost -{ - -namespace detail -{ - -inline void yield( unsigned k ) -{ - if( k < 4 ) - { - } -#if defined( BOOST_SMT_PAUSE ) - else if( k < 16 ) - { - BOOST_SMT_PAUSE - } -#endif - else if( k < 32 || k & 1 ) - { - sched_yield(); - } - else - { - // g++ -Wextra warns on {} or {0} - struct timespec rqtp = { 0, 0 }; - - // POSIX says that timespec has tv_sec and tv_nsec - // But it doesn't guarantee order or placement - - rqtp.tv_sec = 0; - rqtp.tv_nsec = 1000; - - nanosleep( &rqtp, 0 ); - } -} - -} // namespace detail - -} // namespace boost - -#else - -namespace boost -{ - -namespace detail -{ - -inline void yield( unsigned ) -{ -} - -} // namespace detail - -} // namespace boost - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/make_shared.hpp b/libraries/boost/include/boost/smart_ptr/make_shared.hpp deleted file mode 100644 index dd9191c61d..0000000000 --- a/libraries/boost/include/boost/smart_ptr/make_shared.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED -#define BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED - -// make_shared.hpp -// -// Copyright (c) 2007, 2008, 2012 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_SFINAE ) -# include -# include -#endif - -#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/make_shared_array.hpp b/libraries/boost/include/boost/smart_ptr/make_shared_array.hpp deleted file mode 100644 index 2eaf4db71b..0000000000 --- a/libraries/boost/include/boost/smart_ptr/make_shared_array.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2012-2017 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP -#define BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP - -#include - -namespace boost { - -template -inline typename detail::sp_if_size_array::type -make_shared() -{ - return boost::allocate_shared(std::allocator::type>()); -} - -template -inline typename detail::sp_if_size_array::type -make_shared(const typename detail::sp_array_element::type& value) -{ - return boost::allocate_shared(std::allocator::type>(), value); -} - -template -inline typename detail::sp_if_array::type -make_shared(std::size_t size) -{ - return boost::allocate_shared(std::allocator::type>(), size); -} - -template -inline typename detail::sp_if_array::type -make_shared(std::size_t size, - const typename detail::sp_array_element::type& value) -{ - return boost::allocate_shared(std::allocator::type>(), size, value); -} - -template -inline typename detail::sp_if_size_array::type -make_shared_noinit() -{ - return allocate_shared_noinit(std::allocator::type>()); -} - -template -inline typename detail::sp_if_array::type -make_shared_noinit(std::size_t size) -{ - return allocate_shared_noinit(std::allocator::type>(), size); -} - -} /* boost */ - -#endif diff --git a/libraries/boost/include/boost/smart_ptr/make_shared_object.hpp b/libraries/boost/include/boost/smart_ptr/make_shared_object.hpp deleted file mode 100644 index c681602dca..0000000000 --- a/libraries/boost/include/boost/smart_ptr/make_shared_object.hpp +++ /dev/null @@ -1,801 +0,0 @@ -#ifndef BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED -#define BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED - -// make_shared_object.hpp -// -// Copyright (c) 2007, 2008, 2012 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -template< std::size_t N, std::size_t A > struct sp_aligned_storage -{ - union type - { - char data_[ N ]; - typename boost::type_with_alignment< A >::type align_; - }; -}; - -template< class T > class sp_ms_deleter -{ -private: - - typedef typename sp_aligned_storage< sizeof( T ), ::boost::alignment_of< T >::value >::type storage_type; - - bool initialized_; - storage_type storage_; - -private: - - void destroy() BOOST_SP_NOEXCEPT - { - if( initialized_ ) - { -#if defined( __GNUC__ ) - - // fixes incorrect aliasing warning - T * p = reinterpret_cast< T* >( storage_.data_ ); - p->~T(); - -#else - - reinterpret_cast< T* >( storage_.data_ )->~T(); - -#endif - - initialized_ = false; - } - } - -public: - - sp_ms_deleter() BOOST_SP_NOEXCEPT : initialized_( false ) - { - } - - template explicit sp_ms_deleter( A const & ) BOOST_SP_NOEXCEPT : initialized_( false ) - { - } - - // optimization: do not copy storage_ - sp_ms_deleter( sp_ms_deleter const & ) BOOST_SP_NOEXCEPT : initialized_( false ) - { - } - - ~sp_ms_deleter() BOOST_SP_NOEXCEPT - { - destroy(); - } - - void operator()( T * ) BOOST_SP_NOEXCEPT - { - destroy(); - } - - static void operator_fn( T* ) BOOST_SP_NOEXCEPT // operator() can't be static - { - } - - void * address() BOOST_SP_NOEXCEPT - { - return storage_.data_; - } - - void set_initialized() BOOST_SP_NOEXCEPT - { - initialized_ = true; - } -}; - -template< class T, class A > class sp_as_deleter -{ -private: - - typedef typename sp_aligned_storage< sizeof( T ), ::boost::alignment_of< T >::value >::type storage_type; - - storage_type storage_; - A a_; - bool initialized_; - -private: - - void destroy() BOOST_SP_NOEXCEPT - { - if( initialized_ ) - { - T * p = reinterpret_cast< T* >( storage_.data_ ); - -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - std::allocator_traits::destroy( a_, p ); - -#else - - p->~T(); - -#endif - - initialized_ = false; - } - } - -public: - - sp_as_deleter( A const & a ) BOOST_SP_NOEXCEPT : a_( a ), initialized_( false ) - { - } - - // optimization: do not copy storage_ - sp_as_deleter( sp_as_deleter const & r ) BOOST_SP_NOEXCEPT : a_( r.a_), initialized_( false ) - { - } - - ~sp_as_deleter() BOOST_SP_NOEXCEPT - { - destroy(); - } - - void operator()( T * ) BOOST_SP_NOEXCEPT - { - destroy(); - } - - static void operator_fn( T* ) BOOST_SP_NOEXCEPT // operator() can't be static - { - } - - void * address() BOOST_SP_NOEXCEPT - { - return storage_.data_; - } - - void set_initialized() BOOST_SP_NOEXCEPT - { - initialized_ = true; - } -}; - -template< class T > struct sp_if_not_array -{ - typedef boost::shared_ptr< T > type; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_if_not_array< T[] > -{ -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_if_not_array< T[N] > -{ -}; - -#endif - -#endif - -} // namespace detail - -#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) -# define BOOST_SP_MSD( T ) boost::detail::sp_inplace_tag< boost::detail::sp_ms_deleter< T > >() -#else -# define BOOST_SP_MSD( T ) boost::detail::sp_ms_deleter< T >() -#endif - -// _noinit versions - -template< class T > typename boost::detail::sp_if_not_array< T >::type make_shared_noinit() -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T; - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A > typename boost::detail::sp_if_not_array< T >::type allocate_shared_noinit( A const & a ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T; - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -#if !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// Variadic templates, rvalue reference - -template< class T, class... Args > typename boost::detail::sp_if_not_array< T >::type make_shared( Args && ... args ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( boost::detail::sp_forward( args )... ); - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class... Args > typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, Args && ... args ) -{ -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - typedef typename std::allocator_traits::template rebind_alloc A2; - A2 a2( a ); - - typedef boost::detail::sp_as_deleter< T, A2 > D; - - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a2 ); - -#else - - typedef boost::detail::sp_ms_deleter< T > D; - - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a ); - -#endif - - D * pd = static_cast< D* >( pt._internal_get_untyped_deleter() ); - void * pv = pd->address(); - -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - std::allocator_traits::construct( a2, static_cast< T* >( pv ), boost::detail::sp_forward( args )... ); - -#else - - ::new( pv ) T( boost::detail::sp_forward( args )... ); - -#endif - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -#else // !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// Common zero-argument versions - -template< class T > typename boost::detail::sp_if_not_array< T >::type make_shared() -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T(); - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A > typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T(); - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -// C++03 version - -template< class T, class A1 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4, class A5 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4, class A5 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ), - boost::forward( a8 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ), - boost::forward( a8 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8, BOOST_FWD_REF(A9) a9 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ), - boost::forward( a8 ), - boost::forward( a9 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8, BOOST_FWD_REF(A9) a9 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ), - boost::forward( a8 ), - boost::forward( a9 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -#endif // !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -#undef BOOST_SP_MSD - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/scoped_array.hpp b/libraries/boost/include/boost/smart_ptr/scoped_array.hpp deleted file mode 100644 index 05dd05aea8..0000000000 --- a/libraries/boost/include/boost/smart_ptr/scoped_array.hpp +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED -#define BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include -#include -#include -#include - -#include - -#include // for std::ptrdiff_t - -namespace boost -{ - -// Debug hooks - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -void sp_array_constructor_hook(void * p); -void sp_array_destructor_hook(void * p); - -#endif - -// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to -// is guaranteed, either on destruction of the scoped_array or via an explicit -// reset(). Use shared_array or std::vector if your needs are more complex. - -template class scoped_array // noncopyable -{ -private: - - T * px; - - scoped_array(scoped_array const &); - scoped_array & operator=(scoped_array const &); - - typedef scoped_array this_type; - - void operator==( scoped_array const& ) const; - void operator!=( scoped_array const& ) const; - -public: - - typedef T element_type; - - explicit scoped_array( T * p = 0 ) BOOST_SP_NOEXCEPT : px( p ) - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_array_constructor_hook( px ); -#endif - } - - ~scoped_array() BOOST_SP_NOEXCEPT - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_array_destructor_hook( px ); -#endif - boost::checked_array_delete( px ); - } - - void reset(T * p = 0) BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors - this_type(p).swap(*this); - } - - T & operator[](std::ptrdiff_t i) const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - BOOST_ASSERT( i >= 0 ); - return px[i]; - } - - T * get() const BOOST_SP_NOEXCEPT - { - return px; - } - -// implicit conversion to "bool" -#include - - void swap(scoped_array & b) BOOST_SP_NOEXCEPT - { - T * tmp = b.px; - b.px = px; - px = tmp; - } -}; - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( scoped_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( scoped_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline void swap(scoped_array & a, scoped_array & b) BOOST_SP_NOEXCEPT -{ - a.swap(b); -} - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/scoped_ptr.hpp b/libraries/boost/include/boost/smart_ptr/scoped_ptr.hpp deleted file mode 100644 index 5325eba5ff..0000000000 --- a/libraries/boost/include/boost/smart_ptr/scoped_ptr.hpp +++ /dev/null @@ -1,167 +0,0 @@ -#ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include -#include -#include -#include -#include -#include - -#ifndef BOOST_NO_AUTO_PTR -# include // for std::auto_ptr -#endif - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - -namespace boost -{ - -// Debug hooks - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -void sp_scalar_constructor_hook(void * p); -void sp_scalar_destructor_hook(void * p); - -#endif - -// scoped_ptr mimics a built-in pointer except that it guarantees deletion -// of the object pointed to, either on destruction of the scoped_ptr or via -// an explicit reset(). scoped_ptr is a simple solution for simple needs; -// use shared_ptr or std::auto_ptr if your needs are more complex. - -template class scoped_ptr // noncopyable -{ -private: - - T * px; - - scoped_ptr(scoped_ptr const &); - scoped_ptr & operator=(scoped_ptr const &); - - typedef scoped_ptr this_type; - - void operator==( scoped_ptr const& ) const; - void operator!=( scoped_ptr const& ) const; - -public: - - typedef T element_type; - - explicit scoped_ptr( T * p = 0 ) BOOST_SP_NOEXCEPT : px( p ) - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_constructor_hook( px ); -#endif - } - -#ifndef BOOST_NO_AUTO_PTR - - explicit scoped_ptr( std::auto_ptr p ) BOOST_SP_NOEXCEPT : px( p.release() ) - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_constructor_hook( px ); -#endif - } - -#endif - - ~scoped_ptr() BOOST_SP_NOEXCEPT - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_destructor_hook( px ); -#endif - boost::checked_delete( px ); - } - - void reset(T * p = 0) BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors - this_type(p).swap(*this); - } - - T & operator*() const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - return *px; - } - - T * operator->() const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - return px; - } - - T * get() const BOOST_SP_NOEXCEPT - { - return px; - } - -// implicit conversion to "bool" -#include - - void swap(scoped_ptr & b) BOOST_SP_NOEXCEPT - { - T * tmp = b.px; - b.px = px; - px = tmp; - } -}; - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( scoped_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( scoped_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline void swap(scoped_ptr & a, scoped_ptr & b) BOOST_SP_NOEXCEPT -{ - a.swap(b); -} - -// get_pointer(p) is a generic way to say p.get() - -template inline T * get_pointer(scoped_ptr const & p) BOOST_SP_NOEXCEPT -{ - return p.get(); -} - -} // namespace boost - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic pop -#endif - -#endif // #ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/smart_ptr/shared_ptr.hpp b/libraries/boost/include/boost/smart_ptr/shared_ptr.hpp deleted file mode 100644 index 4ac0699ef6..0000000000 --- a/libraries/boost/include/boost/smart_ptr/shared_ptr.hpp +++ /dev/null @@ -1,1184 +0,0 @@ -#ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED - -// -// shared_ptr.hpp -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001-2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include // for broken compiler workarounds - -// In order to avoid circular dependencies with Boost.TR1 -// we make sure that our include of doesn't try to -// pull in the TR1 headers: that's why we use this header -// rather than including directly: -#include // std::auto_ptr - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) -#include -#endif - -#include // for std::swap -#include // for std::less -#include // for std::bad_cast -#include // for std::size_t - -#if !defined(BOOST_NO_IOSTREAM) -#if !defined(BOOST_NO_IOSFWD) -#include // for std::basic_ostream -#else -#include -#endif -#endif - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - -namespace boost -{ - -template class shared_ptr; -template class weak_ptr; -template class enable_shared_from_this; -class enable_shared_from_raw; - -namespace movelib -{ - - template< class T, class D > class unique_ptr; - -} // namespace movelib - -namespace detail -{ - -// sp_element, element_type - -template< class T > struct sp_element -{ - typedef T type; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_element< T[] > -{ - typedef T type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_element< T[N] > -{ - typedef T type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_dereference, return type of operator* - -template< class T > struct sp_dereference -{ - typedef T & type; -}; - -template<> struct sp_dereference< void > -{ - typedef void type; -}; - -#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) - -template<> struct sp_dereference< void const > -{ - typedef void type; -}; - -template<> struct sp_dereference< void volatile > -{ - typedef void type; -}; - -template<> struct sp_dereference< void const volatile > -{ - typedef void type; -}; - -#endif // !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_dereference< T[] > -{ - typedef void type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_dereference< T[N] > -{ - typedef void type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_member_access, return type of operator-> - -template< class T > struct sp_member_access -{ - typedef T * type; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_member_access< T[] > -{ - typedef void type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_member_access< T[N] > -{ - typedef void type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_array_access, return type of operator[] - -template< class T > struct sp_array_access -{ - typedef void type; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_array_access< T[] > -{ - typedef T & type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_array_access< T[N] > -{ - typedef T & type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_extent, for operator[] index check - -template< class T > struct sp_extent -{ - enum _vt { value = 0 }; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T, std::size_t N > struct sp_extent< T[N] > -{ - enum _vt { value = N }; -}; - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// enable_shared_from_this support - -template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr const * ppx, Y const * py, boost::enable_shared_from_this< T > const * pe ) -{ - if( pe != 0 ) - { - pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) ); - } -} - -template< class X, class Y > inline void sp_enable_shared_from_this( boost::shared_ptr * ppx, Y const * py, boost::enable_shared_from_raw const * pe ); - -#ifdef _MANAGED - -// Avoid C4793, ... causes native code generation - -struct sp_any_pointer -{ - template sp_any_pointer( T* ) {} -}; - -inline void sp_enable_shared_from_this( sp_any_pointer, sp_any_pointer, sp_any_pointer ) -{ -} - -#else // _MANAGED - -inline void sp_enable_shared_from_this( ... ) -{ -} - -#endif // _MANAGED - -#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_AUTO_PTR ) - -// rvalue auto_ptr support based on a technique by Dave Abrahams - -template< class T, class R > struct sp_enable_if_auto_ptr -{ -}; - -template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R > -{ - typedef R type; -}; - -#endif - -// sp_assert_convertible - -template< class Y, class T > inline void sp_assert_convertible() BOOST_SP_NOEXCEPT -{ -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - // static_assert( sp_convertible< Y, T >::value ); - typedef char tmp[ sp_convertible< Y, T >::value? 1: -1 ]; - (void)sizeof( tmp ); - -#else - - T* p = static_cast< Y* >( 0 ); - (void)p; - -#endif -} - -// pointer constructor helper - -template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T > * ppx, Y * p, boost::detail::shared_count & pn ) -{ - boost::detail::shared_count( p ).swap( pn ); - boost::detail::sp_enable_shared_from_this( ppx, p, p ); -} - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * p, boost::detail::shared_count & pn ) -{ - sp_assert_convertible< Y[], T[] >(); - boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn ); -} - -template< class T, std::size_t N, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * p, boost::detail::shared_count & pn ) -{ - sp_assert_convertible< Y[N], T[N] >(); - boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn ); -} - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// deleter constructor helper - -template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T > * ppx, Y * p ) -{ - boost::detail::sp_enable_shared_from_this( ppx, p, p ); -} - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * /*p*/ ) -{ - sp_assert_convertible< Y[], T[] >(); -} - -template< class T, std::size_t N, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * /*p*/ ) -{ - sp_assert_convertible< Y[N], T[N] >(); -} - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -struct sp_internal_constructor_tag -{ -}; - -} // namespace detail - - -// -// shared_ptr -// -// An enhanced relative of scoped_ptr with reference counted copy semantics. -// The object pointed to is deleted when the last shared_ptr pointing to it -// is destroyed or reset. -// - -template class shared_ptr -{ -private: - - // Borland 5.5.1 specific workaround - typedef shared_ptr this_type; - -public: - - typedef typename boost::detail::sp_element< T >::type element_type; - - BOOST_CONSTEXPR shared_ptr() BOOST_SP_NOEXCEPT : px( 0 ), pn() - { - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - BOOST_CONSTEXPR shared_ptr( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn() - { - } - -#endif - - BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count const & pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( pn_ ) - { - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count && pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( std::move( pn_ ) ) - { - } - -#endif - - template - explicit shared_ptr( Y * p ): px( p ), pn() // Y must be complete - { - boost::detail::sp_pointer_construct( this, p, pn ); - } - - // - // Requirements: D's copy constructor must not throw - // - // shared_ptr will release p by calling d(p) - // - - template shared_ptr( Y * p, D d ): px( p ), pn( p, d ) - { - boost::detail::sp_deleter_construct( this, p ); - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - template shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d ) - { - } - -#endif - - // As above, but with allocator. A's copy constructor shall not throw. - - template shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a ) - { - boost::detail::sp_deleter_construct( this, p ); - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - template shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a ) - { - } - -#endif - -// generated copy constructor, destructor are fine... - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// ... except in C++0x, move disables the implicit copy - - shared_ptr( shared_ptr const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) - { - } - -#endif - - template - explicit shared_ptr( weak_ptr const & r ): pn( r.pn ) // may throw - { - boost::detail::sp_assert_convertible< Y, T >(); - - // it is now safe to copy r.px, as pn(r.pn) did not throw - px = r.px; - } - - template - shared_ptr( weak_ptr const & r, boost::detail::sp_nothrow_tag ) - BOOST_SP_NOEXCEPT : px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) - { - if( !pn.empty() ) - { - px = r.px; - } - } - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - shared_ptr( shared_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - shared_ptr( shared_ptr const & r ) - -#endif - BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) - { - boost::detail::sp_assert_convertible< Y, T >(); - } - - // aliasing - template< class Y > - shared_ptr( shared_ptr const & r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn( r.pn ) - { - } - -#ifndef BOOST_NO_AUTO_PTR - - template - explicit shared_ptr( std::auto_ptr & r ): px(r.get()), pn() - { - boost::detail::sp_assert_convertible< Y, T >(); - - Y * tmp = r.get(); - pn = boost::detail::shared_count( r ); - - boost::detail::sp_deleter_construct( this, tmp ); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - shared_ptr( std::auto_ptr && r ): px(r.get()), pn() - { - boost::detail::sp_assert_convertible< Y, T >(); - - Y * tmp = r.get(); - pn = boost::detail::shared_count( r ); - - boost::detail::sp_deleter_construct( this, tmp ); - } - -#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - - template - explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr::type = 0 ): px( r.get() ), pn() - { - typedef typename Ap::element_type Y; - - boost::detail::sp_assert_convertible< Y, T >(); - - Y * tmp = r.get(); - pn = boost::detail::shared_count( r ); - - boost::detail::sp_deleter_construct( this, tmp ); - } - -#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#endif // BOOST_NO_AUTO_PTR - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template< class Y, class D > - shared_ptr( std::unique_ptr< Y, D > && r ): px( r.get() ), pn() - { - boost::detail::sp_assert_convertible< Y, T >(); - - typename std::unique_ptr< Y, D >::pointer tmp = r.get(); - - if( tmp != 0 ) - { - pn = boost::detail::shared_count( r ); - boost::detail::sp_deleter_construct( this, tmp ); - } - } - -#endif - - template< class Y, class D > - shared_ptr( boost::movelib::unique_ptr< Y, D > r ): px( r.get() ), pn() - { - boost::detail::sp_assert_convertible< Y, T >(); - - typename boost::movelib::unique_ptr< Y, D >::pointer tmp = r.get(); - - if( tmp != 0 ) - { - pn = boost::detail::shared_count( r ); - boost::detail::sp_deleter_construct( this, tmp ); - } - } - - // assignment - - shared_ptr & operator=( shared_ptr const & r ) BOOST_SP_NOEXCEPT - { - this_type(r).swap(*this); - return *this; - } - -#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400) - - template - shared_ptr & operator=(shared_ptr const & r) BOOST_SP_NOEXCEPT - { - this_type(r).swap(*this); - return *this; - } - -#endif - -#ifndef BOOST_NO_AUTO_PTR - - template - shared_ptr & operator=( std::auto_ptr & r ) - { - this_type( r ).swap( *this ); - return *this; - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - shared_ptr & operator=( std::auto_ptr && r ) - { - this_type( static_cast< std::auto_ptr && >( r ) ).swap( *this ); - return *this; - } - -#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - - template - typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r ) - { - this_type( r ).swap( *this ); - return *this; - } - -#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#endif // BOOST_NO_AUTO_PTR - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - shared_ptr & operator=( std::unique_ptr && r ) - { - this_type( static_cast< std::unique_ptr && >( r ) ).swap(*this); - return *this; - } - -#endif - - template - shared_ptr & operator=( boost::movelib::unique_ptr r ) - { - // this_type( static_cast< unique_ptr && >( r ) ).swap( *this ); - - boost::detail::sp_assert_convertible< Y, T >(); - - typename boost::movelib::unique_ptr< Y, D >::pointer p = r.get(); - - shared_ptr tmp; - - if( p != 0 ) - { - tmp.px = p; - tmp.pn = boost::detail::shared_count( r ); - - boost::detail::sp_deleter_construct( &tmp, p ); - } - - tmp.swap( *this ); - - return *this; - } - -// Move support - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - shared_ptr( shared_ptr && r ) BOOST_SP_NOEXCEPT : px( r.px ), pn() - { - pn.swap( r.pn ); - r.px = 0; - } - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - shared_ptr( shared_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - shared_ptr( shared_ptr && r ) - -#endif - BOOST_SP_NOEXCEPT : px( r.px ), pn() - { - boost::detail::sp_assert_convertible< Y, T >(); - - pn.swap( r.pn ); - r.px = 0; - } - - shared_ptr & operator=( shared_ptr && r ) BOOST_SP_NOEXCEPT - { - this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); - return *this; - } - - template - shared_ptr & operator=( shared_ptr && r ) BOOST_SP_NOEXCEPT - { - this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); - return *this; - } - - // aliasing move - template - shared_ptr( shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn() - { - pn.swap( r.pn ); - r.px = 0; - } - -#endif - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT - { - this_type().swap(*this); - return *this; - } - -#endif - - void reset() BOOST_SP_NOEXCEPT - { - this_type().swap(*this); - } - - template void reset( Y * p ) // Y must be complete - { - BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors - this_type( p ).swap( *this ); - } - - template void reset( Y * p, D d ) - { - this_type( p, d ).swap( *this ); - } - - template void reset( Y * p, D d, A a ) - { - this_type( p, d, a ).swap( *this ); - } - - template void reset( shared_ptr const & r, element_type * p ) BOOST_SP_NOEXCEPT - { - this_type( r, p ).swap( *this ); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template void reset( shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT - { - this_type( static_cast< shared_ptr && >( r ), p ).swap( *this ); - } - -#endif - - typename boost::detail::sp_dereference< T >::type operator* () const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - return *px; - } - - typename boost::detail::sp_member_access< T >::type operator-> () const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - return px; - } - - typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) ); - - return static_cast< typename boost::detail::sp_array_access< T >::type >( px[ i ] ); - } - - element_type * get() const BOOST_SP_NOEXCEPT - { - return px; - } - -// implicit conversion to "bool" -#include - - bool unique() const BOOST_SP_NOEXCEPT - { - return pn.unique(); - } - - long use_count() const BOOST_SP_NOEXCEPT - { - return pn.use_count(); - } - - void swap( shared_ptr & other ) BOOST_SP_NOEXCEPT - { - std::swap(px, other.px); - pn.swap(other.pn); - } - - template bool owner_before( shared_ptr const & rhs ) const BOOST_SP_NOEXCEPT - { - return pn < rhs.pn; - } - - template bool owner_before( weak_ptr const & rhs ) const BOOST_SP_NOEXCEPT - { - return pn < rhs.pn; - } - - void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT - { - return pn.get_deleter( ti ); - } - - void * _internal_get_local_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT - { - return pn.get_local_deleter( ti ); - } - - void * _internal_get_untyped_deleter() const BOOST_SP_NOEXCEPT - { - return pn.get_untyped_deleter(); - } - - bool _internal_equiv( shared_ptr const & r ) const BOOST_SP_NOEXCEPT - { - return px == r.px && pn == r.pn; - } - - boost::detail::shared_count _internal_count() const BOOST_NOEXCEPT - { - return pn; - } - -// Tasteless as this may seem, making all members public allows member templates -// to work in the absence of member template friends. (Matthew Langston) - -#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS - -private: - - template friend class shared_ptr; - template friend class weak_ptr; - - -#endif - - element_type * px; // contained pointer - boost::detail::shared_count pn; // reference counter - -}; // shared_ptr - -template inline bool operator==(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.get() == b.get(); -} - -template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.get() != b.get(); -} - -#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 - -// Resolve the ambiguity between our op!= and the one in rel_ops - -template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.get() != b.get(); -} - -#endif - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline bool operator<(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.owner_before( b ); -} - -template inline void swap(shared_ptr & a, shared_ptr & b) BOOST_SP_NOEXCEPT -{ - a.swap(b); -} - -template shared_ptr static_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) static_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = static_cast< E* >( r.get() ); - return shared_ptr( r, p ); -} - -template shared_ptr const_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) const_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = const_cast< E* >( r.get() ); - return shared_ptr( r, p ); -} - -template shared_ptr dynamic_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = dynamic_cast< E* >( r.get() ); - return p? shared_ptr( r, p ): shared_ptr(); -} - -template shared_ptr reinterpret_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = reinterpret_cast< E* >( r.get() ); - return shared_ptr( r, p ); -} - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -template shared_ptr static_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) static_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = static_cast< E* >( r.get() ); - return shared_ptr( std::move(r), p ); -} - -template shared_ptr const_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) const_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = const_cast< E* >( r.get() ); - return shared_ptr( std::move(r), p ); -} - -template shared_ptr dynamic_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = dynamic_cast< E* >( r.get() ); - return p? shared_ptr( std::move(r), p ): shared_ptr(); -} - -template shared_ptr reinterpret_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = reinterpret_cast< E* >( r.get() ); - return shared_ptr( std::move(r), p ); -} - -#endif // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// get_pointer() enables boost::mem_fn to recognize shared_ptr - -template inline typename shared_ptr::element_type * get_pointer(shared_ptr const & p) BOOST_SP_NOEXCEPT -{ - return p.get(); -} - -// operator<< - -#if !defined(BOOST_NO_IOSTREAM) - -#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) ) - -template std::ostream & operator<< (std::ostream & os, shared_ptr const & p) -{ - os << p.get(); - return os; -} - -#else - -// in STLport's no-iostreams mode no iostream symbols can be used -#ifndef _STLP_NO_IOSTREAMS - -# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) -// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL -using std::basic_ostream; -template basic_ostream & operator<< (basic_ostream & os, shared_ptr const & p) -# else -template std::basic_ostream & operator<< (std::basic_ostream & os, shared_ptr const & p) -# endif -{ - os << p.get(); - return os; -} - -#endif // _STLP_NO_IOSTREAMS - -#endif // __GNUC__ < 3 - -#endif // !defined(BOOST_NO_IOSTREAM) - -// get_deleter - -namespace detail -{ - -template D * basic_get_deleter( shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return static_cast( p._internal_get_deleter(BOOST_SP_TYPEID(D)) ); -} - -template D * basic_get_local_deleter( D *, shared_ptr const & p ) BOOST_SP_NOEXCEPT; -template D const * basic_get_local_deleter( D const *, shared_ptr const & p ) BOOST_SP_NOEXCEPT; - -class esft2_deleter_wrapper -{ -private: - - shared_ptr deleter_; - -public: - - esft2_deleter_wrapper() - { - } - - template< class T > void set_deleter( shared_ptr const & deleter ) BOOST_SP_NOEXCEPT - { - deleter_ = deleter; - } - - template D* get_deleter() const BOOST_SP_NOEXCEPT - { - return boost::detail::basic_get_deleter( deleter_ ); - } - - template< class T> void operator()( T* ) BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( deleter_.use_count() <= 1 ); - deleter_.reset(); - } -}; - -} // namespace detail - -template D * get_deleter( shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - D * d = boost::detail::basic_get_deleter( p ); - - if( d == 0 ) - { - d = boost::detail::basic_get_local_deleter( d, p ); - } - - if( d == 0 ) - { - boost::detail::esft2_deleter_wrapper *del_wrapper = boost::detail::basic_get_deleter(p); -// The following get_deleter method call is fully qualified because -// older versions of gcc (2.95, 3.2.3) fail to compile it when written del_wrapper->get_deleter() - if(del_wrapper) d = del_wrapper->::boost::detail::esft2_deleter_wrapper::get_deleter(); - } - - return d; -} - -// atomic access - -#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) - -template inline bool atomic_is_lock_free( shared_ptr const * /*p*/ ) BOOST_SP_NOEXCEPT -{ - return false; -} - -template shared_ptr atomic_load( shared_ptr const * p ) BOOST_SP_NOEXCEPT -{ - boost::detail::spinlock_pool<2>::scoped_lock lock( p ); - return *p; -} - -template inline shared_ptr atomic_load_explicit( shared_ptr const * p, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT -{ - return atomic_load( p ); -} - -template void atomic_store( shared_ptr * p, shared_ptr r ) BOOST_SP_NOEXCEPT -{ - boost::detail::spinlock_pool<2>::scoped_lock lock( p ); - p->swap( r ); -} - -template inline void atomic_store_explicit( shared_ptr * p, shared_ptr r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT -{ - atomic_store( p, r ); // std::move( r ) -} - -template shared_ptr atomic_exchange( shared_ptr * p, shared_ptr r ) BOOST_SP_NOEXCEPT -{ - boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); - - sp.lock(); - p->swap( r ); - sp.unlock(); - - return r; // return std::move( r ) -} - -template shared_ptr inline atomic_exchange_explicit( shared_ptr * p, shared_ptr r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT -{ - return atomic_exchange( p, r ); // std::move( r ) -} - -template bool atomic_compare_exchange( shared_ptr * p, shared_ptr * v, shared_ptr w ) BOOST_SP_NOEXCEPT -{ - boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); - - sp.lock(); - - if( p->_internal_equiv( *v ) ) - { - p->swap( w ); - - sp.unlock(); - - return true; - } - else - { - shared_ptr tmp( *p ); - - sp.unlock(); - - tmp.swap( *v ); - return false; - } -} - -template inline bool atomic_compare_exchange_explicit( shared_ptr * p, shared_ptr * v, shared_ptr w, /*memory_order success*/ M, /*memory_order failure*/ M ) BOOST_SP_NOEXCEPT -{ - return atomic_compare_exchange( p, v, w ); // std::move( w ) -} - -#endif // !defined(BOOST_SP_NO_ATOMIC_ACCESS) - -// hash_value - -template< class T > struct hash; - -template< class T > std::size_t hash_value( boost::shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return boost::hash< typename boost::shared_ptr::element_type* >()( p.get() ); -} - -} // namespace boost - -#include - -namespace boost -{ - -namespace detail -{ - -template D * basic_get_local_deleter( D *, shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return static_cast( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter) ) ); -} - -template D const * basic_get_local_deleter( D const *, shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return static_cast( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter) ) ); -} - -} // namespace detail - -} // namespace boost - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic pop -#endif - -#endif // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED diff --git a/libraries/boost/include/boost/swap.hpp b/libraries/boost/include/boost/swap.hpp deleted file mode 100644 index 55cafa4fdd..0000000000 --- a/libraries/boost/include/boost/swap.hpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2014 Glen Fernandes - * - * Distributed under the Boost Software License, Version 1.0. (See - * accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ - -#ifndef BOOST_SWAP_HPP -#define BOOST_SWAP_HPP - -// The header file at this path is deprecated; -// use boost/core/swap.hpp instead. - -#include - -#endif diff --git a/libraries/boost/include/boost/test/auto_unit_test.hpp b/libraries/boost/include/boost/test/auto_unit_test.hpp deleted file mode 100644 index 99acd162ab..0000000000 --- a/libraries/boost/include/boost/test/auto_unit_test.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! @brief Deprecated header. -//! @deprecated Use @c boost/test/unit_test.hpp instead. -// *************************************************************************** - -#ifndef BOOST_TEST_AUTO_UNIT_TEST_HPP_071894GER -#define BOOST_TEST_AUTO_UNIT_TEST_HPP_071894GER - -#include - -#endif // BOOST_TEST_AUTO_UNIT_TEST_HPP_071894GER diff --git a/libraries/boost/include/boost/test/data/config.hpp b/libraries/boost/include/boost/test/data/config.hpp deleted file mode 100644 index 7a9d03be98..0000000000 --- a/libraries/boost/include/boost/test/data/config.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief common dataset macros -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_CONFIG_HPP_112611GER -#define BOOST_TEST_DATA_CONFIG_HPP_112611GER - -// Boost.Test -#include -#include - -// STL -#include // for std::logic_error - -// availability on features: preprocessed by doxygen - -#if defined(BOOST_NO_CXX11_HDR_RANDOM) || defined(BOOST_TEST_DOXYGEN_DOC__) -//! Defined when the random dataset feature is not available -#define BOOST_TEST_NO_RANDOM_DATASET_AVAILABLE - -#endif - -#if defined(BOOST_NO_CXX11_HDR_TUPLE) || defined(BOOST_TEST_DOXYGEN_DOC__) - -//! Defined when grid composition of datasets is not available -#define BOOST_TEST_NO_GRID_COMPOSITION_AVAILABLE - -//! Defined when zip composition of datasets is not available -#define BOOST_TEST_NO_ZIP_COMPOSITION_AVAILABLE - -#endif - -//____________________________________________________________________________// - -#define BOOST_TEST_DS_ERROR( msg ) BOOST_TEST_I_THROW( std::logic_error( msg ) ) -#define BOOST_TEST_DS_ASSERT( cond, msg ) BOOST_TEST_I_ASSRT( cond, std::logic_error( msg ) ) - -#endif // BOOST_TEST_DATA_CONFIG_HPP_112611GER diff --git a/libraries/boost/include/boost/test/data/dataset.hpp b/libraries/boost/include/boost/test/data/dataset.hpp deleted file mode 100644 index 3f576ab357..0000000000 --- a/libraries/boost/include/boost/test/data/dataset.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief dataset interfaces -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_DATASET_HPP_102211GER -#define BOOST_TEST_DATA_DATASET_HPP_102211GER - -// Boost.Test -#include - -#endif // BOOST_TEST_DATA_DATASET_HPP_102211GER - diff --git a/libraries/boost/include/boost/test/data/for_each_sample.hpp b/libraries/boost/include/boost/test/data/for_each_sample.hpp deleted file mode 100644 index 4785b038cc..0000000000 --- a/libraries/boost/include/boost/test/data/for_each_sample.hpp +++ /dev/null @@ -1,117 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines for_each_sample algorithm -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_FOR_EACH_SAMPLE_HPP_102211GER -#define BOOST_TEST_DATA_FOR_EACH_SAMPLE_HPP_102211GER - -// Boost.Test -#include -#include -#include -#include -#include - -// STL -#include - -#include - -// needed for std::min -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { - -// ************************************************************************** // -// ************** data::invoke_action ************** // -// ************************************************************************** // - -template -inline void -invoke_action( Action const& action, T && arg, std::false_type /* is_tuple */ ) -{ - action( std::forward(arg) ); -} - -//____________________________________________________________________________// - -template -inline void -invoke_action_impl( Action const& action, - T && args, - index_sequence const& ) -{ - action( std::get(std::forward(args))... ); -} - -//____________________________________________________________________________// - -template -inline void -invoke_action( Action const& action, T&& args, std::true_type /* is_tuple */ ) -{ - invoke_action_impl( action, - std::forward(args), - typename make_index_sequence< 0, - std::tuple_size::type>::value - >::type{} ); - -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** for_each_sample ************** // -// ************************************************************************** // - -template -inline typename std::enable_if::value,void>::type -for_each_sample( DataSet && samples, - Action const& act, - data::size_t number_of_samples = BOOST_TEST_DS_INFINITE_SIZE ) -{ - data::size_t size = (std::min)( samples.size(), number_of_samples ); - BOOST_TEST_DS_ASSERT( !size.is_inf(), "Dataset has infinite size. Please specify the number of samples" ); - - auto it = samples.begin(); - - while( size-- > 0 ) { - invoke_action( act, - *it, - typename monomorphic::ds_detail::is_tuple::type()); - ++it; - } -} - -//____________________________________________________________________________// - -template -inline typename std::enable_if::value,void>::type -for_each_sample( DataSet && samples, - Action const& act, - data::size_t number_of_samples = BOOST_TEST_DS_INFINITE_SIZE ) -{ - data::for_each_sample( data::make( std::forward(samples) ), - act, - number_of_samples ); -} - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_FOR_EACH_SAMPLE_HPP_102211GER - diff --git a/libraries/boost/include/boost/test/data/generators.hpp b/libraries/boost/include/boost/test/data/generators.hpp deleted file mode 100644 index e9bd4c17b5..0000000000 --- a/libraries/boost/include/boost/test/data/generators.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief specific generators -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER -#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER - -// Boost.Test -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER - diff --git a/libraries/boost/include/boost/test/data/index_sequence.hpp b/libraries/boost/include/boost/test/data/index_sequence.hpp deleted file mode 100644 index 21af7e504c..0000000000 --- a/libraries/boost/include/boost/test/data/index_sequence.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines c++14 index_sequence implementation -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_INDEX_SEQUENCE_HPP -#define BOOST_TEST_DATA_INDEX_SEQUENCE_HPP - -// Boost.Test -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { - -// ************************************************************************** // -// ************** data::index_sequence ************** // -// ************************************************************************** // - -template -struct index_sequence {}; - -template -struct merge_index_sequence; - -template -struct merge_index_sequence, index_sequence> { - typedef index_sequence type; -}; - -template -struct make_index_sequence { - typedef typename merge_index_sequence::type, - typename make_index_sequence<(B+E)/2,E>::type>::type type; -}; - -template -struct make_index_sequence::type> { - typedef index_sequence type; -}; - -template -using index_sequence_for = typename make_index_sequence<0, sizeof...(T)>::type; - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_INDEX_SEQUENCE_HPP - diff --git a/libraries/boost/include/boost/test/data/monomorphic.hpp b/libraries/boost/include/boost/test/data/monomorphic.hpp deleted file mode 100644 index 31d7b01b32..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Monomorphic dataset interfaces -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_HPP_102211GER -#define BOOST_TEST_DATA_MONOMORPHIC_HPP_102211GER - -// Boost.Test -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_HPP_102211GER - diff --git a/libraries/boost/include/boost/test/data/monomorphic/array.hpp b/libraries/boost/include/boost/test/data/monomorphic/array.hpp deleted file mode 100644 index 6f7ed8eb3b..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/array.hpp +++ /dev/null @@ -1,83 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@file -///Defines monomorphic dataset based on C type arrays -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER -#define BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER - -// Boost.Test -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { -namespace monomorphic { - -// ************************************************************************** // -// ************** array ************** // -// ************************************************************************** // - -/// Dataset view of a C array -template -class array { -public: - typedef T sample; - - enum { arity = 1 }; - - typedef T const* iterator; - - // Constructor - array( T const* arr_, std::size_t size_ ) - : m_arr( arr_ ) - , m_size( size_ ) - {} - - // dataset interface - data::size_t size() const { return m_size; } - iterator begin() const { return m_arr; } - -private: - // Data members - T const* m_arr; - std::size_t m_size; -}; - -//____________________________________________________________________________// - -//! An array dataset is a dataset -template -struct is_dataset> : mpl::true_ {}; - -} // namespace monomorphic - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::make() -template -inline monomorphic::array::type> -make( T (&a)[size] ) -{ - return monomorphic::array::type>( a, size ); -} - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER - diff --git a/libraries/boost/include/boost/test/data/monomorphic/collection.hpp b/libraries/boost/include/boost/test/data/monomorphic/collection.hpp deleted file mode 100644 index 71a4863f41..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/collection.hpp +++ /dev/null @@ -1,91 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@file -///Defines monomorphic dataset based on forward iterable sequence -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_COLLECTION_HPP_102211GER -#define BOOST_TEST_DATA_MONOMORPHIC_COLLECTION_HPP_102211GER - -// Boost.Test -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { -namespace monomorphic { - -// ************************************************************************** // -// ************** collection ************** // -// ************************************************************************** // - - -//!@brief Dataset from a forward iterable container (collection) -//! -//! This dataset is applicable to any container implementing a forward iterator. Note that -//! container with one element will be considered as singletons. -//! This dataset is constructible with the @ref boost::unit_test::data::make function. -template -class collection { - typedef typename boost::decay::type col_type; -public: - typedef typename col_type::value_type sample; - - enum { arity = 1 }; - - typedef typename col_type::const_iterator iterator; - - //! Constructor consumed a temporary collection or stores a reference - explicit collection( C&& col ) : m_col( std::forward(col) ) {} - - //! Move constructor - collection( collection&& c ) : m_col( std::forward( c.m_col ) ) {} - - //! Returns the underlying collection - C const& col() const { return m_col; } - - //! dataset interface - data::size_t size() const { return m_col.size(); } - iterator begin() const { return m_col.begin(); } - -private: - // Data members - C m_col; -}; - -//____________________________________________________________________________// - -//! A collection from a forward iterable container is a dataset. -template -struct is_dataset> : mpl::true_ {}; - -} // namespace monomorphic - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::make() -template -inline typename std::enable_if::value,monomorphic::collection>::type -make( C&& c ) -{ - return monomorphic::collection( std::forward(c) ); -} - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_COLLECTION_HPP_102211GER - diff --git a/libraries/boost/include/boost/test/data/monomorphic/fwd.hpp b/libraries/boost/include/boost/test/data/monomorphic/fwd.hpp deleted file mode 100644 index dcd1b84165..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/fwd.hpp +++ /dev/null @@ -1,180 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Forward declares monomorphic datasets interfaces -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER -#define BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER - -// Boost.Test -#include -#include - -#include - -// Boost -#include -#include -#include -#include - -// STL -#include - -#include - -// STL -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { - -namespace monomorphic { - - -#if !defined(BOOST_TEST_DOXYGEN_DOC__) - -template -class dataset; - -template -class singleton; - -template -class collection; - -template -class array; - -template -class init_list; - -#endif - -// ************************************************************************** // -// ************** monomorphic::is_dataset ************** // -// ************************************************************************** // - -//! Helper metafunction indicating if the specified type is a dataset. -template -struct is_dataset : mpl::false_ {}; - -//____________________________________________________________________________// - -//! A reference to a dataset is a dataset -template -struct is_dataset : is_dataset {}; - -//____________________________________________________________________________// - -//! A const dataset is a dataset -template -struct is_dataset : is_dataset {}; - -} // namespace monomorphic - -// ************************************************************************** // -// ************** data::make ************** // -// ************************************************************************** // - -//! @brief Creates a dataset from a value, a collection or an array -//! -//! This function has several overloads: -//! @code -//! // returns ds if ds is already a dataset -//! template DataSet make(DataSet&& ds); -//! -//! // creates a singleton dataset, for non forward iterable and non dataset type T -//! // (a C string is not considered as a sequence). -//! template monomorphic::singleton make(T&& v); -//! monomorphic::singleton make( char* str ); -//! monomorphic::singleton make( char const* str ); -//! -//! // creates a collection dataset, for forward iterable and non dataset type C -//! template monomorphic::collection make(C && c); -//! -//! // creates an array dataset -//! template monomorphic::array make( T (&a)[size] ); -//! @endcode -template -inline typename std::enable_if::value,DataSet>::type -make(DataSet&& ds) -{ - return std::forward( ds ); -} - -//____________________________________________________________________________// - -// warning: doxygen is apparently unable to handle @overload from different files, so if the overloads -// below are not declared with @overload in THIS file, they do not appear in the documentation. - -//! @overload boost::unit_test::data::make() -template -inline typename std::enable_if::value && - !monomorphic::is_dataset::value && - !is_array::type>::value, - monomorphic::singleton>::type -make( T&& v ); - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::make() -template -inline typename std::enable_if::value,monomorphic::collection>::type -make( C&& c ); - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::make() -template -inline monomorphic::array< typename boost::remove_const::type > -make( T (&a)[size] ); - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::make() -inline monomorphic::singleton -make( char* str ); - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::make() -inline monomorphic::singleton -make( char const* str ); - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::make() -template -inline monomorphic::init_list -make( std::initializer_list&& ); - -//____________________________________________________________________________// - -namespace result_of { - -//! Result of the make call. -template -struct make { - typedef decltype( data::make( declval() ) ) type; -}; - -} // namespace result_of - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER - diff --git a/libraries/boost/include/boost/test/data/monomorphic/generate.hpp b/libraries/boost/include/boost/test/data/monomorphic/generate.hpp deleted file mode 100644 index 614ef3aad5..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/generate.hpp +++ /dev/null @@ -1,111 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines generic interface for monomorphic dataset based on generator -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATE_HPP_112011GER -#define BOOST_TEST_DATA_MONOMORPHIC_GENERATE_HPP_112011GER - -// Boost.Test -#include -#include - -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { -namespace monomorphic { - -// ************************************************************************** // -// ************** generated_by ************** // -// ************************************************************************** // - -/*!@brief Generators interface - * - * This class implements the dataset concept over a generator. Examples of generators are: - * - xrange_t - * - random_t - * - * The generator concept is the following: - * - the type of the generated samples is given by field @c sample - * - the member function @c capacity should return the size of the collection being generated (potentially infinite) - * - the member function @c next should change the state of the generator to the next generated value - * - the member function @c reset should put the state of the object in the same state as right after its instanciation - */ -template -class generated_by { -public: - typedef typename Generator::sample sample; - - enum { arity = 1 }; - - struct iterator { - // Constructor - explicit iterator( Generator& gen ) - : m_gen( &gen ) - { - if(m_gen->capacity() > 0) { - m_gen->reset(); - ++*this; - } - } - - // forward iterator interface - sample const& operator*() const { return m_curr_sample; } - void operator++() { m_curr_sample = m_gen->next(); } - - private: - // Data members - Generator* m_gen; - sample m_curr_sample; - }; - - typedef Generator generator_type; - - // Constructor - explicit generated_by( Generator&& G ) - : m_generator( std::forward(G) ) - {} - - // Move constructor - generated_by( generated_by&& rhs ) - : m_generator( std::forward(rhs.m_generator) ) - {} - - //! Size of the underlying dataset - data::size_t size() const { return m_generator.capacity(); } - - //! Iterator on the beginning of the dataset - iterator begin() const { return iterator( boost::ref(const_cast(m_generator)) ); } - -private: - // Data members - Generator m_generator; -}; - -//____________________________________________________________________________// - -//! A generated dataset is a dataset. -template -struct is_dataset> : mpl::true_ {}; - -} // namespace monomorphic -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATE_HPP_112011GER - diff --git a/libraries/boost/include/boost/test/data/monomorphic/generators.hpp b/libraries/boost/include/boost/test/data/monomorphic/generators.hpp deleted file mode 100644 index 108d4ba58d..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/generators.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@file -///Defines specific generators -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER -#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER - -// Boost.Test -#include -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_HPP_112011GER - diff --git a/libraries/boost/include/boost/test/data/monomorphic/generators/keywords.hpp b/libraries/boost/include/boost/test/data/monomorphic/generators/keywords.hpp deleted file mode 100644 index de6a4e89e5..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/generators/keywords.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@file -/// Keywords used in generator interfaces -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_KEYWORDS_HPP_101512GER -#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_KEYWORDS_HPP_101512GER - -// Boost.Test -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { - -namespace { -nfp::keyword begin; -nfp::keyword end; -nfp::keyword step; -} // local namespace - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_KEYWORDS_HPP_101512GER diff --git a/libraries/boost/include/boost/test/data/monomorphic/generators/random.hpp b/libraries/boost/include/boost/test/data/monomorphic/generators/random.hpp deleted file mode 100644 index 24a1df3c64..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/generators/random.hpp +++ /dev/null @@ -1,198 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Random generator -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_RANDOM_HPP_101512GER -#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_RANDOM_HPP_101512GER - -// Boost.Test -#include - - - - -#if !defined(BOOST_TEST_NO_RANDOM_DATASET_AVAILABLE) || defined(BOOST_TEST_DOXYGEN_DOC__) - -#include -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { - -namespace { -nfp::keyword seed; -nfp::keyword distribution; -nfp::keyword engine; -} // local namespace - -namespace monomorphic { - -namespace ds_detail { -template -struct default_distribution { - typedef typename mpl::if_, - std::uniform_int_distribution, - std::uniform_real_distribution>::type type; -}; - -} // namespace ds_detail - -// ************************************************************************** // -// ************** random_t ************** // -// ************************************************************************** // - -/*!@brief Generator for the random sequences - * - * This class implements the generator concept (see @ref boost::unit_test::data::monomorphic::generated_by) for implementing - * a random number generator. - */ -template::type, - typename EngineType = std::default_random_engine> -class random_t { -public: - typedef SampleType sample; - typedef DistributionType distr_type; - typedef EngineType engine_type; - - random_t() - : m_distribution() - , m_engine( std::random_device()() ) - {} - explicit random_t( distr_type&& d ) - : m_distribution( std::forward(d) ) - , m_engine( std::random_device()() ){} - random_t( engine_type&& e, distr_type&& d ) - : m_distribution( std::forward(d) ) - , m_engine( std::forward(e) ){} - - // Generator interface - data::size_t capacity() const { return BOOST_TEST_DS_INFINITE_SIZE; } - SampleType next() - { - return m_distribution( m_engine ); - } - void reset() {} - - //! Sets the seed of the pseudo-random number engine. - template - void seed( SeedType&& seed ) { m_engine.seed( std::forward( seed ) ); } - -private: - // Data members - DistributionType m_distribution; - EngineType m_engine; -}; - -//____________________________________________________________________________// - -} // namespace monomorphic - - -//! @brief Returns an infinite sequence of random numbers. -//! -//! The following overloads are available: -//! @code -//! auto d = random(); -//! auto d = random(begin, end); -//! auto d = random(params); -//! @endcode -//! -//! -//! - The first overload uses the default distribution, which is uniform and which elements -//! are @c double type (the values are in [0, 1) ). -//! - The second overload generates numbers in the given interval. The distribution is uniform (in [begin, end) -//! for real numbers, and in [begin, end] for integers). The type of the distribution is deduced from the type -//! of the @c begin and @c end parameters. -//! - The third overload generates numbers using the named parameter inside @c params , which are: -//! - @c distribution: the distribution used. In this overload, since the type of the samples cannot be deduced, -//! the samples are of type @c double and the distribution is uniform real in [0, 1). -//! - @c seed: the seed for generating the values -//! - @c engine: the random number generator engine -//! -//! The function returns an object that implements the dataset API. -//! @note This function is available only for C++11 capable compilers. -inline monomorphic::generated_by< monomorphic::random_t<>> random() -{ - return monomorphic::generated_by>( monomorphic::random_t<>() ); -} - -//____________________________________________________________________________// - -/// @overload boost::unit_test::data::random() -template -inline monomorphic::generated_by< monomorphic::random_t> -random( SampleType begin, SampleType end ) -{ - typedef monomorphic::random_t Gen; - typedef typename Gen::distr_type distr_type; - return monomorphic::generated_by( Gen( distr_type(begin,end) ) ); -} - -//____________________________________________________________________________// - -namespace ds_detail { -template -struct random_gen_type { - typedef typename nfp::param_type>::type distr_type; - typedef typename nfp::param_type::type engine_type; - typedef typename distr_type::result_type sample_type; - - typedef monomorphic::random_t type; -}; - -} - - -/// @overload boost::unit_test::data::random() -template -inline monomorphic::generated_by::type> -random( Params const& params ) -{ - typedef typename ds_detail::random_gen_type::type Gen; - typedef typename Gen::distr_type distr_type; - typedef typename Gen::engine_type engine_type; - - std::random_device rd; - engine_type E; -// engine_type E( rd ); - if( params.has(engine) ) - E = params[engine]; - - distr_type D; - if( params.has(distribution) ) - D = params[distribution]; - - Gen G( std::move(E), std::move(D) ); - - if( params.has(seed) ) - G.seed( params[seed] ); - - return monomorphic::generated_by( std::move(G) ); -} - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_NO_RANDOM_DATASET_AVAILABLE - - -#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_RANDOM_HPP_101512GER diff --git a/libraries/boost/include/boost/test/data/monomorphic/generators/xrange.hpp b/libraries/boost/include/boost/test/data/monomorphic/generators/xrange.hpp deleted file mode 100644 index 02da352adf..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/generators/xrange.hpp +++ /dev/null @@ -1,224 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@file -///Defines range generator -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_XRANGE_HPP_112011GER -#define BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_XRANGE_HPP_112011GER - -// Boost.Test -#include - -#include -#include - -// Boost -#include -#include -#include - -// STL -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { -namespace monomorphic { - -// ************************************************************************** // -// ************** monomorphic::xrange_t ************** // -// ************************************************************************** // - - -/*!@brief Generator for the range sequences - * - * This class implements the generator concept (see @ref boost::unit_test::data::monomorphic::generated_by) for implementing - * a range like sequence of numbers. - */ -template -class xrange_t { -public: - typedef SampleType sample; - - xrange_t( SampleType const& begin_, StepType const& step_, data::size_t size_ ) - : m_begin( begin_ ) - , m_curr( begin_ ) - , m_step( step_ ) - , m_index( 0 ) - , m_size( size_ ) - {} - - // Generator interface - data::size_t capacity() const { return m_size; } - SampleType next() - { - if( m_index == m_size ) - return m_curr; - - SampleType res = m_curr; - - m_curr += m_step; - ++m_index; - - return res; - } - void reset() - { - m_curr = m_begin; - m_index = 0; - } - -private: - // Data members - SampleType m_begin; - SampleType m_curr; - StepType m_step; - data::size_t m_index; - data::size_t m_size; -}; - -//____________________________________________________________________________// - -namespace ds_detail { - -template -struct make_xrange { - static StepType abs( StepType s, boost::true_type* ) { return s; } - static StepType abs( StepType s, boost::false_type* ) { return std::abs(s); } - - typedef xrange_t range_gen; - - template - static generated_by - _( Params const& params ) - { - SampleType begin_val = params.has( data::begin ) ? params[data::begin] : SampleType(); - optional end_val = params.has( data::end ) ? params[data::end] : optional(); - StepType step_val = params.has( data::step ) ? params[data::step] : 1; - - BOOST_TEST_DS_ASSERT( step_val != 0, "Range step can't be zero" ); - - data::size_t size; - if( !end_val.is_initialized() ) - size = BOOST_TEST_DS_INFINITE_SIZE; - else { - BOOST_TEST_DS_ASSERT( (step_val < 0) ^ (begin_val < *end_val), "Invalid step direction" ); - - SampleType abs_distance = step_val < 0 ? begin_val - *end_val : *end_val-begin_val; - StepType abs_step = make_xrange::abs(step_val, (typename boost::is_unsigned::type*)0 ); - std::size_t s = static_cast(abs_distance/abs_step); - - if( static_cast(s*abs_step) < abs_distance ) - s++; - - size = s; - } - - return generated_by( range_gen( begin_val, step_val, size ) ); - } -}; - -} // namespace ds_detail -} // namespace monomorphic - -//____________________________________________________________________________// - -//! Creates a range (sequence) dataset. -//! -//! The following overloads are available: -//! @code -//! auto d = xrange(); -//! auto d = xrange(end_val); -//! auto d = xrange(end_val, param); -//! auto d = xrange(begin_val, end_val); -//! auto d = xrange(begin_val, end_val, step_val); -//! auto d = xrange(param); -//! @endcode -//! -//! - @c begin_val indicates the start of the sequence (default to 0). -//! - @c end_val is the end of the sequence. If ommited, the dataset has infinite size.\n -//! - @c step_val is the step between two consecutive elements of the sequence, and defaults to 1.\n -//! - @c param is the named parameters that describe the sequence. The following parameters are accepted: -//! - @c begin: same meaning @c begin_val -//! - @c end: same meaning as @c end_val -//! - @c step: same meaning as @c step_val -//! -//! -//! The returned value is an object that implements the dataset API. -//! -//! @note the step size cannot be null, and it should be positive if @c begin_val < @c end_val, negative otherwise. -template -inline monomorphic::generated_by> -xrange( Params const& params ) -{ - return monomorphic::ds_detail::make_xrange::_( params ); -} - -//____________________________________________________________________________// - -/// @overload boost::unit_test::data::xrange() -template -inline monomorphic::generated_by> -xrange( SampleType const& end_val ) -{ - return monomorphic::ds_detail::make_xrange::_( data::end=end_val ); -} - -//____________________________________________________________________________// - -/// @overload boost::unit_test::data::xrange() -template -inline typename enable_if_c::value, - monomorphic::generated_by>>::type -xrange( SampleType const& end_val, Params const& params ) -{ - return monomorphic::ds_detail::make_xrange::_(( params, data::end=end_val )); -} - -//____________________________________________________________________________// - -/// @overload boost::unit_test::data::xrange() -template -inline monomorphic::generated_by> -xrange( SampleType const& begin_val, SampleType const& end_val ) -{ - return monomorphic::ds_detail::make_xrange::_(( - data::begin=begin_val, - data::end=end_val )); -} - -//____________________________________________________________________________// - - - -/// @overload boost::unit_test::data::xrange() -template -inline monomorphic::generated_by> -xrange( SampleType const& begin_val, SampleType const& end_val, StepType const& step_val ) -{ - return monomorphic::ds_detail::make_xrange::_(( - data::begin=begin_val, - data::end=end_val, - data::step=step_val )); -} - -//____________________________________________________________________________// - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_GENERATORS_XRANGE_HPP_112011GER diff --git a/libraries/boost/include/boost/test/data/monomorphic/grid.hpp b/libraries/boost/include/boost/test/data/monomorphic/grid.hpp deleted file mode 100644 index 2cf66189a0..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/grid.hpp +++ /dev/null @@ -1,183 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@file -/// Defines monomorphic dataset n+m dimentional *. Samples in this -/// dataset is grid of elements in DataSet1 and DataSet2. There will be total -/// |DataSet1| * |DataSet2| samples -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_GRID_HPP_101512GER -#define BOOST_TEST_DATA_MONOMORPHIC_GRID_HPP_101512GER - -// Boost.Test -#include - -#if !defined(BOOST_TEST_NO_GRID_COMPOSITION_AVAILABLE) || defined(BOOST_TEST_DOXYGEN_DOC__) - -#include -#include - -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { -namespace monomorphic { - -// ************************************************************************** // -// ************** grid ************** // -// ************************************************************************** // - - -//! Implements the dataset resulting from a cartesian product/grid operation on datasets. -//! -//! The arity of the resulting dataset is the sum of the arity of its operands. -template -class grid { - typedef typename boost::decay::type dataset1_decay; - typedef typename boost::decay::type dataset2_decay; - - typedef typename dataset1_decay::iterator dataset1_iter; - typedef typename dataset2_decay::iterator dataset2_iter; - -public: - - struct iterator { - // Constructor - explicit iterator( dataset1_iter iter1, DataSet2 const& ds2 ) - : m_iter1( std::move( iter1 ) ) - , m_iter2( std::move( ds2.begin() ) ) - , m_ds2( &ds2 ) - , m_ds2_pos( 0 ) - {} - - using iterator_sample = decltype( - sample_merge( *std::declval(), - *std::declval()) ); - - // forward iterator interface - auto operator*() const -> iterator_sample { - return sample_merge( *m_iter1, *m_iter2 ); - } - void operator++() - { - ++m_ds2_pos; - if( m_ds2_pos != m_ds2->size() ) - ++m_iter2; - else { - m_ds2_pos = 0; - ++m_iter1; - m_iter2 = std::move( m_ds2->begin() ); - } - } - - private: - // Data members - dataset1_iter m_iter1; - dataset2_iter m_iter2; - dataset2_decay const* m_ds2; - data::size_t m_ds2_pos; - }; - -public: - enum { arity = boost::decay::type::arity + boost::decay::type::arity }; - - //! Constructor - grid( DataSet1&& ds1, DataSet2&& ds2 ) - : m_ds1( std::forward( ds1 ) ) - , m_ds2( std::forward( ds2 ) ) - {} - - //! Move constructor - grid( grid&& j ) - : m_ds1( std::forward( j.m_ds1 ) ) - , m_ds2( std::forward( j.m_ds2 ) ) - {} - - // dataset interface - data::size_t size() const { return m_ds1.size() * m_ds2.size(); } - iterator begin() const { return iterator( m_ds1.begin(), m_ds2 ); } - -private: - // Data members - DataSet1 m_ds1; - DataSet2 m_ds2; -}; - -//____________________________________________________________________________// - -// A grid dataset is a dataset -template -struct is_dataset> : mpl::true_ {}; - -//____________________________________________________________________________// - -namespace result_of { - -/// Result type of the grid operation on dataset. -template -struct grid { - typedef monomorphic::grid type; -}; - -} // namespace result_of - -//____________________________________________________________________________// - -//! Grid operation -template -inline typename boost::lazy_enable_if_c::value && is_dataset::value, - result_of::grid,mpl::identity> ->::type -operator*( DataSet1&& ds1, DataSet2&& ds2 ) -{ - BOOST_TEST_DS_ASSERT( !ds1.size().is_inf() && !ds2.size().is_inf(), "Grid axes can't have infinite size" ); - - return grid( std::forward( ds1 ), std::forward( ds2 ) ); -} - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::operator* -template -inline typename boost::lazy_enable_if_c::value && !is_dataset::value, - result_of::grid,data::result_of::make> ->::type -operator*( DataSet1&& ds1, DataSet2&& ds2 ) -{ - return std::forward(ds1) * data::make(std::forward(ds2)); -} - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::operator* -template -inline typename boost::lazy_enable_if_c::value && is_dataset::value, - result_of::grid,mpl::identity> ->::type -operator*( DataSet1&& ds1, DataSet2&& ds2 ) -{ - return data::make(std::forward(ds1)) * std::forward(ds2); -} - -} // namespace monomorphic - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_NO_GRID_COMPOSITION_AVAILABLE - -#endif // BOOST_TEST_DATA_MONOMORPHIC_GRID_HPP_101512GER - diff --git a/libraries/boost/include/boost/test/data/monomorphic/initializer_list.hpp b/libraries/boost/include/boost/test/data/monomorphic/initializer_list.hpp deleted file mode 100644 index 3221597396..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/initializer_list.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@file -///Defines monomorphic dataset based on C++11 initializer_list template -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_INITIALIZATION_LIST_HPP_091515GER -#define BOOST_TEST_DATA_MONOMORPHIC_INITIALIZATION_LIST_HPP_091515GER - -// Boost.Test -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { -namespace monomorphic { - -// ************************************************************************** // -// ************** array ************** // -// ************************************************************************** // - -/// Dataset view of a C array -template -class init_list { -public: - typedef T sample; - - enum { arity = 1 }; - - typedef T const* iterator; - - //! Constructor swallows initializer_list - init_list( std::initializer_list&& il ) - : m_data( std::forward>( il ) ) - {} - - //! dataset interface - data::size_t size() const { return m_data.size(); } - iterator begin() const { return m_data.begin(); } - -private: - // Data members - std::initializer_list m_data; -}; - -//____________________________________________________________________________// - -//! An array dataset is a dataset -template -struct is_dataset> : mpl::true_ {}; - -} // namespace monomorphic - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::make() -template -inline monomorphic::init_list -make( std::initializer_list&& il ) -{ - return monomorphic::init_list( std::forward>( il ) ); -} - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_INITIALIZATION_LIST_HPP_091515GER - diff --git a/libraries/boost/include/boost/test/data/monomorphic/join.hpp b/libraries/boost/include/boost/test/data/monomorphic/join.hpp deleted file mode 100644 index f817994dd3..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/join.hpp +++ /dev/null @@ -1,148 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! Defines dataset join operation -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_JOIN_HPP_112711GER -#define BOOST_TEST_DATA_MONOMORPHIC_JOIN_HPP_112711GER - -// Boost.Test -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { -namespace monomorphic { - -// ************************************************************************** // -// ************** join ************** // -// ************************************************************************** // - -//! Defines a new dataset from the concatenation of two datasets -//! -//! The size of the resulting dataset is the sum of the two underlying datasets. The arity of the datasets -//! should match. -template -class join { - typedef typename boost::decay::type dataset1_decay; - typedef typename boost::decay::type dataset2_decay; - - typedef typename dataset1_decay::iterator dataset1_iter; - typedef typename dataset2_decay::iterator dataset2_iter; -public: - typedef typename dataset1_decay::sample sample; - - enum { arity = dataset1_decay::arity }; - - struct iterator { - // Constructor - explicit iterator( dataset1_iter it1, dataset2_iter it2, data::size_t first_size ) - : m_it1( std::move( it1 ) ) - , m_it2( std::move( it2 ) ) - , m_first_size( first_size ) - {} - - // forward iterator interface - sample const& operator*() const { return m_first_size > 0 ? *m_it1 : *m_it2; } - void operator++() { if( m_first_size > 0 ) { --m_first_size; ++m_it1; } else ++m_it2; } - - private: - // Data members - dataset1_iter m_it1; - dataset2_iter m_it2; - data::size_t m_first_size; - }; - - //! Constructor - join( DataSet1&& ds1, DataSet2&& ds2 ) - : m_ds1( std::forward( ds1 ) ) - , m_ds2( std::forward( ds2 ) ) - {} - - //! Move constructor - join( join&& j ) - : m_ds1( std::forward( j.m_ds1 ) ) - , m_ds2( std::forward( j.m_ds2 ) ) - {} - - //! dataset interface - data::size_t size() const { return m_ds1.size() + m_ds2.size(); } - iterator begin() const { return iterator( m_ds1.begin(), m_ds2.begin(), m_ds1.size() ); } - -private: - // Data members - DataSet1 m_ds1; - DataSet2 m_ds2; -}; - -//____________________________________________________________________________// - -// A joined dataset is a dataset. -template -struct is_dataset> : mpl::true_ {}; - -//____________________________________________________________________________// - -namespace result_of { - -//! Result type of the join operation on datasets. -template -struct join { - typedef monomorphic::join type; -}; - -} // namespace result_of - -//____________________________________________________________________________// - -template -inline typename boost::lazy_enable_if_c::value && is_dataset::value, - result_of::join,mpl::identity> ->::type -operator+( DataSet1&& ds1, DataSet2&& ds2 ) -{ - return join( std::forward( ds1 ), std::forward( ds2 ) ); -} - -//____________________________________________________________________________// - -template -inline typename boost::lazy_enable_if_c::value && !is_dataset::value, - result_of::join,data::result_of::make> ->::type -operator+( DataSet1&& ds1, DataSet2&& ds2 ) -{ - return std::forward( ds1 ) + data::make( std::forward( ds2 ) ); -} - -//____________________________________________________________________________// - -template -inline typename boost::lazy_enable_if_c::value && is_dataset::value, - result_of::join,mpl::identity> ->::type -operator+( DataSet1&& ds1, DataSet2&& ds2 ) -{ - return data::make( std::forward(ds1) ) + std::forward( ds2 ); -} - -} // namespace monomorphic -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_JOIN_HPP_112711GER - diff --git a/libraries/boost/include/boost/test/data/monomorphic/sample_merge.hpp b/libraries/boost/include/boost/test/data/monomorphic/sample_merge.hpp deleted file mode 100644 index d7535beff7..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/sample_merge.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines helper routines and types for merging monomorphic samples -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_SAMPLE_MERGE_HPP -#define BOOST_TEST_DATA_MONOMORPHIC_SAMPLE_MERGE_HPP - -// Boost.Test -#include -#include - -#include - -#include - -namespace boost { -namespace unit_test { -namespace data { -namespace monomorphic { - -//____________________________________________________________________________// - -namespace ds_detail { - -template -struct is_tuple : std::false_type {}; - -template -struct is_tuple> : std::true_type {}; - -template -struct is_tuple : is_tuple::type> {}; - -template -struct is_tuple : is_tuple::type> {}; - -template -inline auto as_tuple_impl_xvalues( T const & arg, std::false_type /* is_rvalue_ref */ ) - -> decltype(std::tuple(arg)) { - //return std::tuple(arg); - return std::forward_as_tuple(arg); -} - -template -inline auto as_tuple_impl_xvalues( T && arg, std::true_type /* is_rvalue_ref */ ) - -> decltype(std::make_tuple(std::forward(arg))) { - return std::make_tuple(std::forward(arg)); -} - - -template -inline auto as_tuple_impl( T && arg, std::false_type /* is_tuple = nullptr */ ) - -> decltype(as_tuple_impl_xvalues(std::forward(arg), - typename std::is_rvalue_reference::type())) { - return as_tuple_impl_xvalues(std::forward(arg), - typename std::is_rvalue_reference::type()); -} - -//____________________________________________________________________________// - -template -inline T && -as_tuple_impl(T && arg, std::true_type /* is_tuple */ ) { - return std::forward(arg); -} - -template -inline auto as_tuple( T && arg ) - -> decltype( as_tuple_impl(std::forward(arg), - typename ds_detail::is_tuple::type()) ) { - return as_tuple_impl(std::forward(arg), - typename ds_detail::is_tuple::type()); -} - -//____________________________________________________________________________// - -} // namespace ds_detail - -template -inline auto -sample_merge( T1 && a1, T2 && a2 ) - -> decltype( std::tuple_cat(ds_detail::as_tuple(std::forward(a1)), - ds_detail::as_tuple(std::forward(a2)) ) ) { - return std::tuple_cat(ds_detail::as_tuple(std::forward(a1)), - ds_detail::as_tuple(std::forward(a2))); -} - -} // namespace monomorphic -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_SAMPLE_MERGE_HPP - diff --git a/libraries/boost/include/boost/test/data/monomorphic/singleton.hpp b/libraries/boost/include/boost/test/data/monomorphic/singleton.hpp deleted file mode 100644 index b0abd0eabb..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/singleton.hpp +++ /dev/null @@ -1,119 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines single element monomorphic dataset -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_SINGLETON_HPP_102211GER -#define BOOST_TEST_DATA_MONOMORPHIC_SINGLETON_HPP_102211GER - -// Boost.Test -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { -namespace monomorphic { - -// ************************************************************************** // -// ************** singleton ************** // -// ************************************************************************** // - -/// Models a single element data set -template -class singleton { -public: - typedef typename boost::decay::type sample; - - enum { arity = 1 }; - - struct iterator { - // Constructor - explicit iterator( singleton const* owner ) - : m_owner( owner ) - {} - - // forward iterator interface - sample const& operator*() const { return m_owner->value(); } - void operator++() {} - - private: - singleton const* m_owner; - }; - - //! Constructor - explicit singleton( T&& value ) : m_value( std::forward( value ) ) {} - - //! Move constructor - singleton( singleton&& s ) : m_value( std::forward( s.m_value ) ) {} - - //! Value access method - T const& value() const { return m_value; } - - //! dataset interface - data::size_t size() const { return 1; } - iterator begin() const { return iterator( this ); } - -private: - // Data members - T m_value; -}; - -//____________________________________________________________________________// - -// a singleton is a dataset -template -struct is_dataset> : mpl::true_ {}; - -//____________________________________________________________________________// - -} // namespace monomorphic - -/// @overload boost::unit_test::data::make() -template -inline typename std::enable_if::value && - !monomorphic::is_dataset::value && - !boost::is_array::type>::value, - monomorphic::singleton ->::type -make( T&& v ) -{ - return monomorphic::singleton( std::forward( v ) ); -} - -//____________________________________________________________________________// - -/// @overload boost::unit_test::data::make -inline monomorphic::singleton -make( char* str ) -{ - return monomorphic::singleton( std::move(str) ); -} - -//____________________________________________________________________________// - -/// @overload boost::unit_test::data::make -inline monomorphic::singleton -make( char const* str ) -{ - return monomorphic::singleton( std::move(str) ); -} - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_MONOMORPHIC_SINGLETON_HPP_102211GER - diff --git a/libraries/boost/include/boost/test/data/monomorphic/zip.hpp b/libraries/boost/include/boost/test/data/monomorphic/zip.hpp deleted file mode 100644 index 5fc65d0e20..0000000000 --- a/libraries/boost/include/boost/test/data/monomorphic/zip.hpp +++ /dev/null @@ -1,194 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines monomorphic dataset based on zipping of 2 other monomorphic datasets -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_MONOMORPHIC_ZIP_HPP_102211GER -#define BOOST_TEST_DATA_MONOMORPHIC_ZIP_HPP_102211GER - -// Boost.Test -#include - -#if !defined(BOOST_TEST_NO_ZIP_COMPOSITION_AVAILABLE) || defined(BOOST_TEST_DOXYGEN_DOC__) - -#include -#include - -#include - - -namespace boost { -namespace unit_test { -namespace data { -namespace monomorphic { - -// ************************************************************************** // -// ************** zip ************** // -// ************************************************************************** // - -//! Zip datasets -//! -//! A zip of two datasets is a dataset whose arity is the sum of the operand datasets arity. The size is given by -//! the function creating the instance (see @c operator^ on datasets). -template -class zip { - typedef typename boost::decay::type dataset1_decay; - typedef typename boost::decay::type dataset2_decay; - - typedef typename dataset1_decay::iterator dataset1_iter; - typedef typename dataset2_decay::iterator dataset2_iter; - -public: - enum { arity = dataset1_decay::arity + dataset2_decay::arity }; - - struct iterator { - // Constructor - explicit iterator( dataset1_iter iter1, dataset2_iter iter2 ) - : m_iter1( std::move( iter1 ) ) - , m_iter2( std::move( iter2 ) ) - {} - - using iterator_sample = decltype( - sample_merge( *std::declval(), - *std::declval()) ); - - // forward iterator interface - auto operator*() const -> iterator_sample { - return sample_merge( *m_iter1, *m_iter2 ); - } - void operator++() { ++m_iter1; ++m_iter2; } - - private: - // Data members - dataset1_iter m_iter1; - dataset2_iter m_iter2; - }; - - typedef typename iterator::iterator_sample sample; - - //! Constructor - //! - //! The datasets are moved and not copied. - zip( DataSet1&& ds1, DataSet2&& ds2, data::size_t size ) - : m_ds1( std::forward( ds1 ) ) - , m_ds2( std::forward( ds2 ) ) - , m_size( size ) - {} - - //! Move constructor - zip( zip&& j ) - : m_ds1( std::forward( j.m_ds1 ) ) - , m_ds2( std::forward( j.m_ds2 ) ) - , m_size( j.m_size ) - {} - - // dataset interface - data::size_t size() const { return m_size; } - iterator begin() const { return iterator( m_ds1.begin(), m_ds2.begin() ); } - -private: - // Data members - DataSet1 m_ds1; - DataSet2 m_ds2; - data::size_t m_size; -}; - -//____________________________________________________________________________// - -//! Zipped datasets results in a dataset. -template -struct is_dataset> : mpl::true_ {}; - -//____________________________________________________________________________// - -namespace ds_detail { - -//! Handles the sise of the resulting zipped dataset. -template -inline data::size_t -zip_size( DataSet1&& ds1, DataSet2&& ds2 ) -{ - data::size_t ds1_size = ds1.size(); - data::size_t ds2_size = ds2.size(); - - if( ds1_size == ds2_size ) - return ds1_size; - - if( ds1_size == 1 || ds1_size.is_inf() ) - return ds2_size; - - if( ds2_size == 1 || ds2_size.is_inf() ) - return ds1_size; - - BOOST_TEST_DS_ERROR( "Can't zip datasets of different sizes" ); -} - -} // namespace ds_detail - -//____________________________________________________________________________// - -namespace result_of { - -//! Result type of the zip operator. -template -struct zip { - typedef monomorphic::zip type; -}; - -} // namespace result_of - -//____________________________________________________________________________// - -//! Overload operator for zip support -template -inline typename boost::lazy_enable_if_c::value && is_dataset::value, - result_of::zip,mpl::identity> ->::type -operator^( DataSet1&& ds1, DataSet2&& ds2 ) -{ - return zip( std::forward( ds1 ), - std::forward( ds2 ), - ds_detail::zip_size( ds1, ds2 ) ); -} - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::monomorphic::operator^() -template -inline typename boost::lazy_enable_if_c::value && !is_dataset::value, - result_of::zip,data::result_of::make> ->::type -operator^( DataSet1&& ds1, DataSet2&& ds2 ) -{ - return std::forward( ds1 ) ^ data::make( std::forward( ds2 ) ); -} - -//____________________________________________________________________________// - -//! @overload boost::unit_test::data::monomorphic::operator^() -template -inline typename boost::lazy_enable_if_c::value && is_dataset::value, - result_of::zip,mpl::identity> ->::type -operator^( DataSet1&& ds1, DataSet2&& ds2 ) -{ - return data::make( std::forward( ds1 ) ) ^ std::forward( ds2 ); -} - -} // namespace monomorphic -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_NO_ZIP_COMPOSITION_AVAILABLE - -#endif // BOOST_TEST_DATA_MONOMORPHIC_ZIP_HPP_102211GER - diff --git a/libraries/boost/include/boost/test/data/size.hpp b/libraries/boost/include/boost/test/data/size.hpp deleted file mode 100644 index 3e9ba96795..0000000000 --- a/libraries/boost/include/boost/test/data/size.hpp +++ /dev/null @@ -1,145 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief simple dataset size abstraction (can be infinite) -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_SIZE_HPP_102211GER -#define BOOST_TEST_DATA_SIZE_HPP_102211GER - -// Boost.Test -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { - -// ************************************************************************** // -// ************** size_t ************** // -// ************************************************************************** // - -//! Utility for handling the size of a datasets -class size_t { - struct dummy { void nonnull() {} }; - typedef void (dummy::*safe_bool)(); -public: - // Constructors - size_t( std::size_t s = 0 ) : m_value( s ), m_infinity( false ) {} - explicit size_t( bool ) : m_value( 0 ), m_infinity( true ) {} - template - size_t( T v ) : m_value( static_cast(v) ), m_infinity( false ) {} - - // Access methods - std::size_t value() const { return m_value; } - bool is_inf() const { return m_infinity; } - operator safe_bool() const { return is_inf() || m_value != 0 ? &dummy::nonnull : 0; } - - // Unary operators - data::size_t operator--() { if( !is_inf() ) m_value--; return *this; } - data::size_t operator--(int) { data::size_t res(*this); if( !is_inf() ) m_value--; return res; } - data::size_t operator++() { if( !is_inf() ) m_value++; return *this; } - data::size_t operator++(int) { data::size_t res(*this); if( !is_inf() ) m_value++; return res; } - - // Binary operators - data::size_t& operator+=( std::size_t rhs ) { if( !is_inf() ) m_value += rhs; return *this; } - data::size_t& operator+=( data::size_t rhs ) - { - if( !is_inf() ) { - if( rhs.is_inf() ) - *this = rhs; - else - m_value += rhs.value(); - } - return *this; - } - data::size_t& operator-=( std::size_t rhs ) { if( !is_inf() ) m_value -= rhs; return *this; } - data::size_t& operator-=( data::size_t rhs ) - { - if( !is_inf() ) { - if( value() < rhs.value() ) - m_value = 0; - else - m_value -= rhs.value(); - } - return *this; - } - -private: - // Data members - std::size_t m_value; - bool m_infinity; -}; - -namespace { const data::size_t BOOST_TEST_DS_INFINITE_SIZE( true ); } - -//____________________________________________________________________________// - -// Binary operators -inline bool operator>(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() || (lhs.value() > rhs); } -inline bool operator>(std::size_t lhs, data::size_t rhs) { return !rhs.is_inf() && (lhs > rhs.value()); } -inline bool operator>(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? lhs.is_inf() : lhs.value() > rhs.value(); } - -inline bool operator>=(data::size_t lhs, std::size_t rhs ) { return lhs.is_inf() || (lhs.value() >= rhs); } -inline bool operator>=(std::size_t lhs, data::size_t rhs) { return !rhs.is_inf() && (lhs >= rhs.value()); } -inline bool operator>=(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? lhs.is_inf() : lhs.value() >= rhs.value(); } - -inline bool operator<(data::size_t lhs, std::size_t rhs) { return !lhs.is_inf() && (lhs.value() < rhs); } -inline bool operator<(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() || (lhs < rhs.value()); } -inline bool operator<(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? rhs.is_inf() : lhs.value() < rhs.value(); } - -inline bool operator<=(data::size_t lhs, std::size_t rhs) { return !lhs.is_inf() && (lhs.value() <= rhs); } -inline bool operator<=(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() || (lhs <= rhs.value()); } -inline bool operator<=(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() ? rhs.is_inf() : lhs.value() <= rhs.value(); } - -inline bool operator==(data::size_t lhs, std::size_t rhs) { return !lhs.is_inf() && (lhs.value() == rhs); } -inline bool operator==(std::size_t lhs, data::size_t rhs) { return !rhs.is_inf() && (lhs == rhs.value()); } -inline bool operator==(data::size_t lhs, data::size_t rhs) { return !(lhs.is_inf() ^ rhs.is_inf()) && lhs.value() == rhs.value(); } - -inline bool operator!=(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() || (lhs.value() != rhs); } -inline bool operator!=(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() || (lhs != rhs.value()); } -inline bool operator!=(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() ^ rhs.is_inf() || lhs.value() != rhs.value(); } - -inline data::size_t operator+(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() ? lhs : data::size_t( lhs.value()+rhs ); } -inline data::size_t operator+(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() ? rhs : data::size_t( lhs+rhs.value() ); } -inline data::size_t operator+(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() || rhs.is_inf() ? data::size_t(true) : data::size_t( lhs.value()+rhs.value() ); } - -inline data::size_t operator*(data::size_t lhs, std::size_t rhs) { return lhs.is_inf() ? lhs : data::size_t( lhs.value()*rhs ); } -inline data::size_t operator*(std::size_t lhs, data::size_t rhs) { return rhs.is_inf() ? rhs : data::size_t( lhs*rhs.value() ); } -inline data::size_t operator*(data::size_t lhs, data::size_t rhs) { return lhs.is_inf() || rhs.is_inf() ? data::size_t(true) : data::size_t( lhs.value()*rhs.value() ); } - -//____________________________________________________________________________// - -template -inline std::basic_ostream& -operator<<( std::basic_ostream& os, data::size_t const& s ) -{ - if( s.is_inf() ) - os << "infinity"; - else - os << s.value(); - - return os; -} - -//____________________________________________________________________________// - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_SIZE_HPP_102211GER - diff --git a/libraries/boost/include/boost/test/data/test_case.hpp b/libraries/boost/include/boost/test/data/test_case.hpp deleted file mode 100644 index 01dc91b06a..0000000000 --- a/libraries/boost/include/boost/test/data/test_case.hpp +++ /dev/null @@ -1,325 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief test case family based on data generator -// *************************************************************************** - -#ifndef BOOST_TEST_DATA_TEST_CASE_HPP_102211GER -#define BOOST_TEST_DATA_TEST_CASE_HPP_102211GER - -// Boost.Test -#include -#include -#include -#include - -// Boost -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -#include - -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) \ - && !defined(BOOST_TEST_DATASET_MAX_ARITY) -# define BOOST_TEST_DATASET_MAX_ARITY 10 -#endif - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace data { - -namespace ds_detail { - -// ************************************************************************** // -// ************** seed ************** // -// ************************************************************************** // - -struct seed { - template - typename data::result_of::make::type - operator->*( DataSet&& ds ) const - { - return data::make( std::forward( ds ) ); - } -}; - - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ - !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ - !defined(BOOST_NO_CXX11_DECLTYPE) && \ - !defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) && \ - !defined(BOOST_NO_CXX11_SMART_PTR) - -#define BOOST_TEST_DATASET_VARIADIC -template -struct parameter_holder { - std::shared_ptr value; - - parameter_holder(T && value_) - : value(std::make_shared(std::move(value_))) - {} - - operator T const&() const { - return *value; - } -}; - -template -parameter_holder::type> -boost_bind_rvalue_holder_helper_impl(T&& value, boost::false_type /* is copy constructible */) { - return parameter_holder::type>(std::forward(value)); -} - -template -T&& boost_bind_rvalue_holder_helper_impl(T&& value, boost::true_type /* is copy constructible */) { - return std::forward(value); -} - -template -auto boost_bind_rvalue_holder_helper(T&& value) - -> decltype(boost_bind_rvalue_holder_helper_impl( - std::forward(value), - typename boost::is_copy_constructible::type>::type())) -{ - // need to use boost::is_copy_constructible because std::is_copy_constructible is broken on MSVC12 - return boost_bind_rvalue_holder_helper_impl( - std::forward(value), - typename boost::is_copy_constructible::type>::type()); -} - -#endif - - -// ************************************************************************** // -// ************** test_case_gen ************** // -// ************************************************************************** // - -template -class test_case_gen : public test_unit_generator { -public: - // Constructor -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet&& ds ) - : m_tc_name( ut_detail::normalize_test_case_name( tc_name ) ) - , m_tc_file( tc_file ) - , m_tc_line( tc_line ) - , m_tc_index( 0 ) - { - data::for_each_sample( std::forward( ds ), *this ); - } - test_case_gen( test_case_gen&& gen ) - : m_tc_name( gen.m_tc_name ) - , m_tc_file( gen.m_tc_file ) - , m_tc_line( gen.m_tc_line ) - , m_tc_index( gen.m_tc_index ) - , m_test_cases( std::move(gen.m_test_cases) ) - {} -#else - test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet const& ds ) - : m_tc_name( ut_detail::normalize_test_case_name( tc_name ) ) - , m_tc_file( tc_file ) - , m_tc_line( tc_line ) - , m_tc_index( 0 ) - { - data::for_each_sample( ds, *this ); - } -#endif - - virtual test_unit* next() const - { - if( m_test_cases.empty() ) - return 0; - - test_unit* res = m_test_cases.front(); - m_test_cases.pop_front(); - - return res; - } - -#if !defined(BOOST_TEST_DATASET_VARIADIC) - // see BOOST_TEST_DATASET_MAX_ARITY to increase the default supported arity - // there is also a limit on boost::bind -#define TC_MAKE(z,arity,_) \ - template \ - void operator()( BOOST_PP_ENUM_BINARY_PARAMS(arity, Arg, const& arg) ) const \ - { \ - m_test_cases.push_back( new test_case( genTestCaseName(), m_tc_file, m_tc_line, \ - boost::bind( &TestCase::template test_method,\ - BOOST_PP_ENUM_PARAMS(arity, arg) ) ) ); \ - } \ - - BOOST_PP_REPEAT_FROM_TO(1, BOOST_TEST_DATASET_MAX_ARITY, TC_MAKE, _) -#else - template - void operator()(Arg&& ... arg) const - { - m_test_cases.push_back( - new test_case( genTestCaseName(), - m_tc_file, - m_tc_line, - std::bind( &TestCase::template test_method, - boost_bind_rvalue_holder_helper(std::forward(arg))...))); - } -#endif - -private: - std::string genTestCaseName() const - { - return "_" + utils::string_cast(m_tc_index++); - } - - // Data members - std::string m_tc_name; - const_string m_tc_file; - std::size_t m_tc_line; - mutable std::size_t m_tc_index; - mutable std::list m_test_cases; -}; - -//____________________________________________________________________________// - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -template -test_case_gen -make_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet&& ds ) -{ - return test_case_gen( tc_name, tc_file, tc_line, std::forward(ds) ); -} -#else -template -test_case_gen -make_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line, DataSet const& ds ) -{ - return test_case_gen( tc_name, tc_file, tc_line, ds ); -} -#endif - -//____________________________________________________________________________// - -} // namespace ds_detail - -// ************************************************************************** // -// ************** BOOST_DATA_TEST_CASE ************** // -// ************************************************************************** // - -#define BOOST_DATA_TEST_CASE_PARAM(r, _, i, param) (BOOST_PP_CAT(Arg, i) const& param) -#define BOOST_DATA_TEST_CONTEXT(r, _, param) << BOOST_STRINGIZE(param) << " = " << boost::test_tools::tt_detail::print_helper(param) << "; " - -#define BOOST_DATA_TEST_CASE_PARAMS( params ) \ - BOOST_PP_SEQ_ENUM( \ - BOOST_PP_SEQ_FOR_EACH_I(BOOST_DATA_TEST_CASE_PARAM, _, params)) \ -/**/ - -#define BOOST_DATA_TEST_CASE_IMPL(arity, F, test_name, dataset, params) \ -struct BOOST_PP_CAT(test_name, case) : public F { \ - template \ - static void test_method( BOOST_DATA_TEST_CASE_PARAMS( params ) ) \ - { \ - BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture entry.");\ - BOOST_PP_CAT(test_name, case) t; \ - BOOST_TEST_CHECKPOINT('"' << #test_name << "\" entry."); \ - BOOST_TEST_CONTEXT( "" \ - BOOST_PP_SEQ_FOR_EACH(BOOST_DATA_TEST_CONTEXT, _, params)) \ - t._impl(BOOST_PP_SEQ_ENUM(params)); \ - BOOST_TEST_CHECKPOINT('"' << #test_name << "\" exit."); \ - } \ -private: \ - template \ - void _impl(BOOST_DATA_TEST_CASE_PARAMS( params )); \ -}; \ - \ -BOOST_AUTO_TEST_SUITE( test_name ) \ - \ -BOOST_AUTO_TU_REGISTRAR( BOOST_PP_CAT(test_name, case) )( \ - boost::unit_test::data::ds_detail::make_test_case_gen< \ - BOOST_PP_CAT(test_name, case)>( \ - BOOST_STRINGIZE( test_name ), \ - __FILE__, __LINE__, \ - boost::unit_test::data::ds_detail::seed{} ->* dataset ), \ - boost::unit_test::decorator::collector::instance() ); \ - \ -BOOST_AUTO_TEST_SUITE_END() \ - \ - template \ - void BOOST_PP_CAT(test_name, case)::_impl( \ - BOOST_DATA_TEST_CASE_PARAMS( params ) ) \ -/**/ - -#define BOOST_DATA_TEST_CASE_WITH_PARAMS( F, test_name, dataset, ... ) \ - BOOST_DATA_TEST_CASE_IMPL( BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), \ - F, test_name, dataset, \ - BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) ) \ -/**/ -#define BOOST_DATA_TEST_CASE_NO_PARAMS( F, test_name, dataset ) \ - BOOST_DATA_TEST_CASE_WITH_PARAMS( F, test_name, dataset, sample ) \ -/**/ - -#if BOOST_PP_VARIADICS_MSVC - -#define BOOST_DATA_TEST_CASE( ... ) \ - BOOST_PP_CAT( \ - BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2), \ - BOOST_DATA_TEST_CASE_NO_PARAMS, \ - BOOST_DATA_TEST_CASE_WITH_PARAMS) ( \ - BOOST_AUTO_TEST_CASE_FIXTURE, __VA_ARGS__), ) \ -/**/ - -#define BOOST_DATA_TEST_CASE_F( F, ... ) \ - BOOST_PP_CAT( \ - BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2), \ - BOOST_DATA_TEST_CASE_NO_PARAMS, \ - BOOST_DATA_TEST_CASE_WITH_PARAMS) ( \ - F, __VA_ARGS__), ) \ -/**/ - -#else - -#define BOOST_DATA_TEST_CASE( ... ) \ - BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2), \ - BOOST_DATA_TEST_CASE_NO_PARAMS, \ - BOOST_DATA_TEST_CASE_WITH_PARAMS) ( \ - BOOST_AUTO_TEST_CASE_FIXTURE, __VA_ARGS__) \ -/**/ - -#define BOOST_DATA_TEST_CASE_F( F, ... ) \ - BOOST_PP_IIF(BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),2), \ - BOOST_DATA_TEST_CASE_NO_PARAMS, \ - BOOST_DATA_TEST_CASE_WITH_PARAMS) ( \ - F, __VA_ARGS__) \ -/**/ -#endif - -} // namespace data -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_DATA_TEST_CASE_HPP_102211GER - diff --git a/libraries/boost/include/boost/test/debug.hpp b/libraries/boost/include/boost/test/debug.hpp deleted file mode 100644 index a8ccae0b97..0000000000 --- a/libraries/boost/include/boost/test/debug.hpp +++ /dev/null @@ -1,138 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! @brief defines portable debug interfaces -//! -//! Intended to standardize interface of programs with debuggers -// *************************************************************************** - -#ifndef BOOST_TEST_DEBUG_API_HPP_112006GER -#define BOOST_TEST_DEBUG_API_HPP_112006GER - -// Boost.Test -#include -#include - -// Boost -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -/// Contains debugger and debug C Runtime interfaces -namespace debug { - -/// @defgroup DebuggerInterface Debugger and debug C Runtime portable interfaces -/// @{ -/// These interfaces are intended to be used by application to: -/// - check if we are running under debugger -/// - attach the debugger to itself -/// -/// Unfortunately these actions differ widely between different debuggers available in a field. These interface present generalized standard form of -/// performing these actions. Implementation depends a lot on the environment application is running in and thus there are several custom implementations -/// supported by the Boost.Test -/// -/// In addition here you find interfaces for memory leaks detection and reporting. -/// -/// All these interfaces are defined in namespace boost::debug - -// ************************************************************************** // -/// Checks if programs runs under debugger - -/// @returns true if current process is under debugger. False otherwise -// ************************************************************************** // -bool BOOST_TEST_DECL under_debugger(); - -// ************************************************************************** // -/// Cause program to break execution in debugger at call point -// ************************************************************************** // - -void BOOST_TEST_DECL debugger_break(); - -// ************************************************************************** // -/// Collection of data, which is used by debugger starter routine -// ************************************************************************** // - -struct dbg_startup_info { - long pid; ///< pid of a program to attach to - bool break_or_continue; ///< what to do after debugger is attached - unit_test::const_string binary_path; ///< path to executable for current process - unit_test::const_string display; ///< if debugger has a GUI, which display to use (on UNIX) - unit_test::const_string init_done_lock; ///< path to a uniquely named lock file, which is used to pause current application while debugger is being initialized -}; - -/// Signature of debugger starter routine. Takes an instance of dbg_startup_into as only argument -typedef boost::function dbg_starter; - -// ************************************************************************** // -/// Specifies which debugger to use when attaching and optionally what routine to use to start that debugger - -/// There are many different debuggers available for different platforms. Some of them also can be used in a different setups/configuratins. -/// For example, gdb can be used in plain text mode, inside ddd, inside (x)emacs or in a separate xterm window. -/// Boost.Test identifies each configuration with unique string. -/// Also different debuggers configurations require different routines which is specifically tailored to start that debugger configuration. -/// Boost.Test comes with set of predefined configuration names and corresponding routines for these configurations: -/// - TODO -/// -/// You can use this routine to select which one of the predefined debugger configurations to use in which case you do not need to provide starter -/// routine (the one provided by Boost.Test will be used). You can also use this routine to select your own debugger by providing unique configuration -/// id and starter routine for this configuration. -/// -/// @param[in] dbg_id Unique id for debugger configuration (for example, gdb) -/// @param[in] s Optional starter routine for selected configuration (use only you want to define your own configuration) -/// @returns Id of previously selected debugger configuration -std::string BOOST_TEST_DECL set_debugger( unit_test::const_string dbg_id, dbg_starter s = dbg_starter() ); - -// ************************************************************************** // -/// Attaches debugger to the current process - -/// Using currently selected debugger, this routine attempts to attach the debugger to this process. -/// @param[in] break_or_continue tells what we wan to do after the debugger is attached. If true - process execution breaks -/// in the point in invocation of this function. Otherwise execution continues, but now it is -/// under the debugger -/// @returns true if debugger successfully attached. False otherwise -// ************************************************************************** // - -bool BOOST_TEST_DECL attach_debugger( bool break_or_continue = true ); - -// ************************************************************************** // -/// Switches on/off memory leaks detection - -/// On platforms where memory leak detection is possible inside of running application (at the moment this is only Windows family) you can -/// switch this feature on and off using this interface. In addition you can specify the name of the file to write a report into. Otherwise -/// the report is going to be generated in standard error stream. -/// @param[in] on_off boolean switch -/// @param[in] report_file file, where the report should be directed to -// ************************************************************************** // - -void BOOST_TEST_DECL detect_memory_leaks( bool on_off, unit_test::const_string report_file = unit_test::const_string() ); - -// ************************************************************************** // -/// Causes program to break execution in debugger at specific allocation point - -/// On some platforms/memory managers (at the moment only on Windows/Visual Studio) one can tell a C Runtime to break -/// on specific memory allocation. This can be used in combination with memory leak detection (which reports leaked memory -/// allocation number) to locate the place where leak initiated. -/// @param[in] mem_alloc_order_num Specific memory allocation number -// ************************************************************************** // - -void BOOST_TEST_DECL break_memory_alloc( long mem_alloc_order_num ); - -} // namespace debug -/// @} - -} // namespace boost - -#include - -#endif diff --git a/libraries/boost/include/boost/test/debug_config.hpp b/libraries/boost/include/boost/test/debug_config.hpp deleted file mode 100644 index 894d78e65a..0000000000 --- a/libraries/boost/include/boost/test/debug_config.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! @brief user's config for Boost.Test debugging support -//! -//! This file is intended to be edited by end user to specify varios macros, which configure debugger interface -//! Alterntively you can set these parameters in your own sources/makefiles -// *************************************************************************** - -#ifndef BOOST_TEST_DEBUG_CONFIG_HPP_112006GER -#define BOOST_TEST_DEBUG_CONFIG_HPP_112006GER - -// ';' separated list of supported debuggers -// #define BOOST_TEST_DBG_LIST gdb;dbx - -// maximum size of /proc/pid/stat file -// #define BOOST_TEST_STAT_LINE_MAX - -#endif diff --git a/libraries/boost/include/boost/test/detail/config.hpp b/libraries/boost/include/boost/test/detail/config.hpp deleted file mode 100644 index db9b5d2b92..0000000000 --- a/libraries/boost/include/boost/test/detail/config.hpp +++ /dev/null @@ -1,127 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief a central place for global configuration switches -// *************************************************************************** - -#ifndef BOOST_TEST_CONFIG_HPP_071894GER -#define BOOST_TEST_CONFIG_HPP_071894GER - -// Boost -#include // compilers workarounds -#include - -#if defined(_WIN32) && !defined(BOOST_DISABLE_WIN32) && \ - (!defined(__COMO__) && !defined(__MWERKS__) && !defined(__GNUC__) || \ - BOOST_WORKAROUND(__MWERKS__, >= 0x3000)) -# define BOOST_SEH_BASED_SIGNAL_HANDLING -#endif - -#if defined(__COMO__) && defined(_MSC_VER) -// eh.h uses type_info without declaring it. -class type_info; -# define BOOST_SEH_BASED_SIGNAL_HANDLING -#endif - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)) || \ - BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) || \ - (defined __sgi && BOOST_WORKAROUND(_COMPILER_VERSION, BOOST_TESTED_AT(730))) -# define BOOST_TEST_SHIFTED_LINE -#endif - -//____________________________________________________________________________// - -#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)) -# define BOOST_TEST_CALL_DECL __cdecl -#else -# define BOOST_TEST_CALL_DECL /**/ -#endif - -//____________________________________________________________________________// - -#if !defined(BOOST_NO_STD_LOCALE) && !defined(__MWERKS__) -# define BOOST_TEST_USE_STD_LOCALE 1 -#endif - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x570) || \ - BOOST_WORKAROUND( __COMO__, <= 0x433 ) || \ - BOOST_WORKAROUND( __INTEL_COMPILER, <= 800 ) || \ - defined(__sgi) && _COMPILER_VERSION <= 730 || \ - BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) || \ - defined(__DECCXX) || \ - defined(__DMC__) -# define BOOST_TEST_NO_PROTECTED_USING -#endif - -//____________________________________________________________________________// - -#if defined(__GNUC__) || BOOST_WORKAROUND(BOOST_MSVC, == 1400) -#define BOOST_TEST_PROTECTED_VIRTUAL virtual -#else -#define BOOST_TEST_PROTECTED_VIRTUAL -#endif - -//____________________________________________________________________________// - -#if !defined(__BORLANDC__) && !BOOST_WORKAROUND( __SUNPRO_CC, < 0x5100 ) -#define BOOST_TEST_SUPPORT_TOKEN_ITERATOR 1 -#endif - -//____________________________________________________________________________// - -#if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_TEST_DYN_LINK) -# define BOOST_TEST_DYN_LINK -#endif - -#if defined(BOOST_TEST_INCLUDED) -# undef BOOST_TEST_DYN_LINK -#endif - -#if defined(BOOST_TEST_DYN_LINK) -# define BOOST_TEST_ALTERNATIVE_INIT_API - -# ifdef BOOST_TEST_SOURCE -# define BOOST_TEST_DECL BOOST_SYMBOL_EXPORT -# else -# define BOOST_TEST_DECL BOOST_SYMBOL_IMPORT -# endif // BOOST_TEST_SOURCE -#else -# define BOOST_TEST_DECL -#endif - -#if !defined(BOOST_TEST_MAIN) && defined(BOOST_AUTO_TEST_MAIN) -#define BOOST_TEST_MAIN BOOST_AUTO_TEST_MAIN -#endif - -#if !defined(BOOST_TEST_MAIN) && defined(BOOST_TEST_MODULE) -#define BOOST_TEST_MAIN BOOST_TEST_MODULE -#endif - - - -#ifndef BOOST_PP_VARIADICS /* we can change this only if not already defined) */ - -#ifdef __PGI -#define BOOST_PP_VARIADICS 1 -#endif - -#if BOOST_CLANG -#define BOOST_PP_VARIADICS 1 -#endif - -#if defined(BOOST_GCC) && (BOOST_GCC >= 4 * 10000 + 8 * 100) -#define BOOST_PP_VARIADICS 1 -#endif - -#endif /* ifndef BOOST_PP_VARIADICS */ - -#endif // BOOST_TEST_CONFIG_HPP_071894GER diff --git a/libraries/boost/include/boost/test/detail/enable_warnings.hpp b/libraries/boost/include/boost/test/detail/enable_warnings.hpp deleted file mode 100644 index 45afb31944..0000000000 --- a/libraries/boost/include/boost/test/detail/enable_warnings.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief enable previously suppressed warnings -// *************************************************************************** - -#ifdef BOOST_MSVC -# pragma warning(default: 4511) // copy constructor can't not be generated -# pragma warning(default: 4512) // assignment operator can't not be generated -# pragma warning(default: 4100) // unreferenced formal parameter -# pragma warning(default: 4996) // was declared deprecated -# pragma warning(default: 4355) // 'this' : used in base member initializer list -# pragma warning(default: 4706) // assignment within conditional expression -# pragma warning(default: 4251) // class 'A' needs to have dll-interface to be used by clients of class 'B' -# pragma warning(default: 4127) // conditional expression is constant -# pragma warning(default: 4290) // C++ exception specification ignored except to ... -# pragma warning(default: 4180) // qualifier applied to function type has no meaning; ignored -# pragma warning(default: 4275) // non dll-interface class ... used as base for dll-interface class ... -# pragma warning(default: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data -# pragma warning(default: 4511) // 'class' : copy constructor could not be generated -# pragma warning(pop) -#endif - -#if BOOST_CLANG -#pragma clang diagnostic pop -#endif - -#if defined(BOOST_GCC) && (BOOST_GCC >= 4 * 10000 + 6 * 100) -# pragma GCC diagnostic pop -#endif - diff --git a/libraries/boost/include/boost/test/detail/fwd_decl.hpp b/libraries/boost/include/boost/test/detail/fwd_decl.hpp deleted file mode 100644 index d5c97fb706..0000000000 --- a/libraries/boost/include/boost/test/detail/fwd_decl.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief contains forward eclarations for Boost.Test data types -// *************************************************************************** - -#ifndef BOOST_TEST_FWD_DECL_HPP_011605GER -#define BOOST_TEST_FWD_DECL_HPP_011605GER - -namespace boost { - -class execution_monitor; -class execution_exception; - -namespace unit_test { - -class test_unit; -class test_case; -class test_suite; -class master_test_suite_t; - -class test_tree_visitor; -class test_observer; -class test_unit_fixture; - -// singletons -class unit_test_monitor_t; -class unit_test_log_t; - -class unit_test_log_formatter; -struct log_entry_data; -struct log_checkpoint_data; - -class lazy_ostream; - -} // namespace unit_test - -} // namespace boost - -#endif // BOOST_TEST_FWD_DECL_HPP_011605GER - diff --git a/libraries/boost/include/boost/test/detail/global_typedef.hpp b/libraries/boost/include/boost/test/detail/global_typedef.hpp deleted file mode 100644 index aeede00e9c..0000000000 --- a/libraries/boost/include/boost/test/detail/global_typedef.hpp +++ /dev/null @@ -1,111 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief some trivial global typedefs -// *************************************************************************** - -#ifndef BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER -#define BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER - -#include -#include - -#define BOOST_TEST_L( s ) ::boost::unit_test::const_string( s, sizeof( s ) - 1 ) -#define BOOST_TEST_STRINGIZE( s ) BOOST_TEST_L( BOOST_STRINGIZE( s ) ) -#define BOOST_TEST_EMPTY_STRING BOOST_TEST_L( "" ) - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -typedef unsigned long counter_t; - -//____________________________________________________________________________// - -enum report_level { INV_REPORT_LEVEL, CONFIRMATION_REPORT, SHORT_REPORT, DETAILED_REPORT, NO_REPORT }; - -//____________________________________________________________________________// - -//! Indicates the output format for the loggers or the test tree printing -enum output_format { OF_INVALID, - OF_CLF, ///< compiler log format - OF_XML, ///< XML format for report and log, - OF_JUNIT, ///< JUNIT format for report and log, - OF_CUSTOM_LOGGER, ///< User specified logger. - OF_DOT ///< dot format for output content -}; - -//____________________________________________________________________________// - -enum test_unit_type { TUT_CASE = 0x01, TUT_SUITE = 0x10, TUT_ANY = 0x11 }; - -//____________________________________________________________________________// - -enum assertion_result { AR_FAILED, AR_PASSED, AR_TRIGGERED }; - -//____________________________________________________________________________// - -typedef unsigned long test_unit_id; - -const test_unit_id INV_TEST_UNIT_ID = 0xFFFFFFFF; -const test_unit_id MAX_TEST_CASE_ID = 0xFFFFFFFE; -const test_unit_id MIN_TEST_CASE_ID = 0x00010000; -const test_unit_id MAX_TEST_SUITE_ID = 0x0000FF00; -const test_unit_id MIN_TEST_SUITE_ID = 0x00000001; - -//____________________________________________________________________________// - -namespace ut_detail { - -inline test_unit_type -test_id_2_unit_type( test_unit_id id ) -{ - return (id & 0xFFFF0000) != 0 ? TUT_CASE : TUT_SUITE; -} - -//! Helper class for restoring the current test unit ID in a RAII manner -struct test_unit_id_restore { - test_unit_id_restore(test_unit_id& to_restore_, test_unit_id new_value) - : to_restore(to_restore_) - , bkup(to_restore_) { - to_restore = new_value; - } - ~test_unit_id_restore() { - to_restore = bkup; - } -private: - test_unit_id& to_restore; - test_unit_id bkup; -}; - -//____________________________________________________________________________// - -} // namespace ut_detail - -// helper templates to prevent ODR violations -template -struct static_constant { - static T value; -}; - -template -T static_constant::value; - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER diff --git a/libraries/boost/include/boost/test/detail/log_level.hpp b/libraries/boost/include/boost/test/detail/log_level.hpp deleted file mode 100644 index abdecea7ec..0000000000 --- a/libraries/boost/include/boost/test/detail/log_level.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief shared definition for unit test log levels -// *************************************************************************** - -#ifndef BOOST_TEST_LOG_LEVEL_HPP_011605GER -#define BOOST_TEST_LOG_LEVEL_HPP_011605GER - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** log levels ************** // -// ************************************************************************** // - -// each log level includes all subsequent higher loging levels -enum log_level { - invalid_log_level = -1, - log_successful_tests = 0, - log_test_units = 1, - log_messages = 2, - log_warnings = 3, - log_all_errors = 4, // reported by unit test macros - log_cpp_exception_errors = 5, // uncaught C++ exceptions - log_system_errors = 6, // including timeouts, signals, traps - log_fatal_errors = 7, // including unit test macros or - // fatal system errors - log_nothing = 8 -}; - -} // namespace unit_test -} // namespace boost - -#endif // BOOST_TEST_LOG_LEVEL_HPP_011605GER diff --git a/libraries/boost/include/boost/test/detail/pp_variadic.hpp b/libraries/boost/include/boost/test/detail/pp_variadic.hpp deleted file mode 100644 index a443744daa..0000000000 --- a/libraries/boost/include/boost/test/detail/pp_variadic.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief few helpers for working with variadic macros -// *************************************************************************** - -#ifndef BOOST_TEST_PP_VARIADIC_HPP_021515GER -#define BOOST_TEST_PP_VARIADIC_HPP_021515GER - -// Boost -#include -#include -#include - -//____________________________________________________________________________// - -#if BOOST_PP_VARIADICS - -#if BOOST_PP_VARIADICS_MSVC -# define BOOST_TEST_INVOKE_VARIADIC( tool, ... ) BOOST_PP_CAT( tool (__VA_ARGS__), ) -#else -# define BOOST_TEST_INVOKE_VARIADIC( tool, ... ) tool (__VA_ARGS__) -#endif - -//____________________________________________________________________________// - -/// if sizeof(__VA_ARGS__) == N: F1(__VA_ARGS__) -/// else: F2(__VA_ARGS__) -#define BOOST_TEST_INVOKE_IF_N_ARGS( N, F1, F2, ... ) \ - BOOST_TEST_INVOKE_VARIADIC( \ - BOOST_PP_IIF( \ - BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), N), \ - F1, \ - F2), \ - __VA_ARGS__ ) \ -/**/ - -//____________________________________________________________________________// - -#endif /* BOOST_PP_VARIADICS */ - -#endif // BOOST_TEST_PP_VARIADIC_HPP_021515GER - -// EOF diff --git a/libraries/boost/include/boost/test/detail/suppress_warnings.hpp b/libraries/boost/include/boost/test/detail/suppress_warnings.hpp deleted file mode 100644 index 4badf20758..0000000000 --- a/libraries/boost/include/boost/test/detail/suppress_warnings.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief suppress some warnings -// *************************************************************************** - -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable: 4511) // copy constructor can't not be generated -# pragma warning(disable: 4512) // assignment operator can't not be generated -# pragma warning(disable: 4100) // unreferenced formal parameter -# pragma warning(disable: 4996) // was declared deprecated -# pragma warning(disable: 4355) // 'this' : used in base member initializer list -# pragma warning(disable: 4706) // assignment within conditional expression -# pragma warning(disable: 4251) // class 'A' needs to have dll-interface to be used by clients of class 'B' -# pragma warning(disable: 4127) // conditional expression is constant -# pragma warning(disable: 4290) // C++ exception specification ignored except to ... -# pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored -# pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ... -# pragma warning(disable: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data -# pragma warning(disable: 4511) // 'class' : copy constructor could not be generated -#endif - -#if BOOST_CLANG -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wvariadic-macros" -#endif - -#if defined(BOOST_GCC) && (BOOST_GCC >= 4 * 10000 + 6 * 100) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wvariadic-macros" -#endif - diff --git a/libraries/boost/include/boost/test/detail/throw_exception.hpp b/libraries/boost/include/boost/test/detail/throw_exception.hpp deleted file mode 100644 index 3f2f4687d3..0000000000 --- a/libraries/boost/include/boost/test/detail/throw_exception.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief contains wrappers, which allows to build Boost.Test with no exception -// *************************************************************************** - -#ifndef BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP -#define BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP - -// Boost -#include // BOOST_NO_EXCEPTIONS - -#ifdef BOOST_NO_EXCEPTIONS -// C RUNTIME -#include - -#endif - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace ut_detail { - -#ifdef BOOST_NO_EXCEPTIONS - -template -BOOST_NORETURN inline void -throw_exception(E const& e) { abort(); } - -#define BOOST_TEST_I_TRY -#define BOOST_TEST_I_CATCH( T, var ) for(T const& var = *(T*)0; false;) -#define BOOST_TEST_I_CATCH0( T ) if(0) -#define BOOST_TEST_I_CATCHALL() if(0) -#define BOOST_TEST_I_RETHROW - -#else - -template -BOOST_NORETURN inline void -throw_exception(E const& e) { throw e; } - -#define BOOST_TEST_I_TRY try -#define BOOST_TEST_I_CATCH( T, var ) catch( T const& var ) -#define BOOST_TEST_I_CATCH0( T ) catch( T const& ) -#define BOOST_TEST_I_CATCHALL() catch(...) -#define BOOST_TEST_I_RETHROW throw -#endif - -//____________________________________________________________________________// - -#define BOOST_TEST_I_THROW( E ) unit_test::ut_detail::throw_exception( E ) -#define BOOST_TEST_I_ASSRT( cond, ex ) if( cond ) {} else BOOST_TEST_I_THROW( ex ) - - -} // namespace ut_detail -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP diff --git a/libraries/boost/include/boost/test/detail/workaround.hpp b/libraries/boost/include/boost/test/detail/workaround.hpp deleted file mode 100644 index 4ba3a7e934..0000000000 --- a/libraries/boost/include/boost/test/detail/workaround.hpp +++ /dev/null @@ -1,56 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief contains mics. workarounds -// *************************************************************************** - -#ifndef BOOST_TEST_WORKAROUND_HPP_021005GER -#define BOOST_TEST_WORKAROUND_HPP_021005GER - -// Boost -#include // compilers workarounds and std::ptrdiff_t - -// STL -#include // for std::distance - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace ut_detail { - -#ifdef BOOST_NO_STD_DISTANCE -template -std::ptrdiff_t distance( T const& x_, T const& y_ ) -{ - std::ptrdiff_t res = 0; - - std::distance( x_, y_, res ); - - return res; -} - -//____________________________________________________________________________// - -#else -using std::distance; -#endif - -template inline void ignore_unused_variable_warning(const T&) {} - -} // namespace ut_detail -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_WORKAROUND_HPP_021005GER diff --git a/libraries/boost/include/boost/test/execution_monitor.hpp b/libraries/boost/include/boost/test/execution_monitor.hpp deleted file mode 100644 index ed06ef254e..0000000000 --- a/libraries/boost/include/boost/test/execution_monitor.hpp +++ /dev/null @@ -1,579 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// (C) Copyright Beman Dawes 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Defines public interface of the Execution Monitor and related classes -// *************************************************************************** - -#ifndef BOOST_TEST_EXECUTION_MONITOR_HPP_071894GER -#define BOOST_TEST_EXECUTION_MONITOR_HPP_071894GER - -// Boost.Test -#include -#include -#include - -#include - -// Boost -#include -#include -#include -#include -#include - -#include - -#ifdef BOOST_SEH_BASED_SIGNAL_HANDLING - -// for the FP constants and control routines -#include - -#ifndef EM_INVALID -#define EM_INVALID _EM_INVALID -#endif - -#ifndef EM_DENORMAL -#define EM_DENORMAL _EM_DENORMAL -#endif - -#ifndef EM_ZERODIVIDE -#define EM_ZERODIVIDE _EM_ZERODIVIDE -#endif - -#ifndef EM_OVERFLOW -#define EM_OVERFLOW _EM_OVERFLOW -#endif - -#ifndef EM_UNDERFLOW -#define EM_UNDERFLOW _EM_UNDERFLOW -#endif - -#ifndef MCW_EM -#define MCW_EM _MCW_EM -#endif - -#else // based on ISO C standard - -#if !defined(BOOST_NO_FENV_H) - #include -#endif - -#endif - -#if defined(BOOST_SEH_BASED_SIGNAL_HANDLING) && !defined(UNDER_CE) - //! Indicates tha the floating point exception handling is supported - //! through SEH - #define BOOST_TEST_FPE_SUPPORT_WITH_SEH__ -#elif !defined(BOOST_SEH_BASED_SIGNAL_HANDLING) && !defined(UNDER_CE) - #if !defined(BOOST_NO_FENV_H) && !defined(BOOST_CLANG) && \ - defined(__GLIBC__) && defined(__USE_GNU) && \ - !(defined(__UCLIBC__) || defined(__nios2__) || defined(__microblaze__)) - //! Indicates that floating point exception handling is supported for the - //! non SEH version of it, for the GLIBC extensions only - // see dicussions on the related topic: https://svn.boost.org/trac/boost/ticket/11756 - #define BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__ - #endif -#endif - - -// Additional macro documentations not being generated without this hack -#ifdef BOOST_TEST_DOXYGEN_DOC__ - -//! Disables the support of the alternative stack -//! during the compilation of the Boost.test framework. This is especially useful -//! in case it is not possible to detect the lack of alternative stack support for -//! your compiler (for instance, ESXi). -#define BOOST_TEST_DISABLE_ALT_STACK - -#endif - -//____________________________________________________________________________// - -namespace boost { - -/// @defgroup ExecutionMonitor Function Execution Monitor -/// @{ -/// @section Intro Introduction -/// Sometimes we need to call a function and make sure that no user or system originated exceptions are being thrown by it. Uniform exception reporting -/// is also may be convenient. That's the purpose of the Boost.Test's Execution Monitor. -/// -/// The Execution Monitor is a lower-level component of the Boost Test Library. It is the base for implementing all other Boost.Test components, but also -/// can be used standalone to get controlled execution of error-prone functions with a uniform error notification. The Execution Monitor calls a user-supplied -/// function in a controlled environment, relieving users from messy error detection. -/// -/// The Execution Monitor usage is demonstrated in the example exec_mon_example. -/// -/// @section DesignRationale Design Rationale -/// -/// The Execution Monitor design assumes that it can be used when no (or almost no) memory available. Also the Execution Monitor is intended to be portable to as many platforms as possible. -/// -/// @section UserGuide User's guide -/// The Execution Monitor is designed to solve the problem of executing potentially dangerous function that may result in any number of error conditions, -/// in monitored environment that should prevent any undesirable exceptions to propagate out of function call and produce consistent result report for all outcomes. -/// The Execution Monitor is able to produce informative report for all standard C++ exceptions and intrinsic types. All other exceptions are reported as unknown. -/// If you prefer different message for your exception type or need to perform any action, the Execution Monitor supports custom exception translators. -/// There are several other parameters of the monitored environment can be configured by setting appropriate properties of the Execution Monitor. -/// -/// All symbols in the Execution Monitor implementation are located in the namespace boost. To use the Execution Monitor you need to: -/// -# include @c boost/test/execution_monitor.hpp -/// -# Make an instance of execution_monitor. -/// -# Optionally register custom exception translators for exception classes which require special processing. -/// -/// @subsection FuncExec Monitored function execution -/// -/// The class execution_monitor can monitor functions with the following signatures: -/// - int () -/// - void () -/// -/// This function is expected to be self sufficient part of your application. You can't pass any arguments to this function directly. Instead you -/// should bind them into executable nullary function using bind function (either standard or boost variant). Neither you can return any other value, -/// but an integer result code. If necessary you can bind output parameters by reference or use some other more complicated nullary functor, which -/// maintains state. This includes class methods, static class methods etc. -/// -/// To start the monitored function, invoke the method execution_monitor::execute and pass the monitored function as an argument. If the call succeeds, -/// the method returns the result code produced by the monitored function. If any of the following conditions occur: -/// - Uncaught C++ exception -/// - Hardware or software signal, trap, or other exception -/// - Timeout reached -/// - Debug assert event occurred (under Microsoft Visual C++ or compatible compiler) -/// -/// then the method throws the execution_exception. The exception contains unique error_code value identifying the error condition and the detailed message -/// that can be used to report the error. -/// -/// @subsection Reporting Errors reporting and translation -/// -/// If you need to report an error inside monitored function execution you have to throw an exception. Do not use the execution_exception - it's not intended -/// to be used for this purpose. The simplest choice is to use one of the following C++ types as an exception: -/// - C string -/// - std:string -/// - any exception class in std::exception hierarchy -/// - boost::exception -/// -/// execution_monitor will catch and report these types of exceptions. If exception is thrown which is unknown to execution_monitor, it can only -/// report the fact of the exception. So in case if you prefer to use your own exception types or can't govern what exceptions are generated by monitored -/// function and would like to see proper error message in a report, execution_monitor can be configured with custom "translator" routine, which will have -/// a chance to either record the fact of the exception itself or translate it into one of standard exceptions and rethrow (or both). The translator routine -/// is registered per exception type and is invoked when exception of this class (or one inherited from it) is thrown inside monitored routine. You can -/// register as many independent translators as you like. See execution_monitor::register_exception_translator specification for requirements on translator -/// function. -/// -/// Finally, if you need to abort the monitored function execution without reporting any errors, you can throw an exception execution_aborted. As a result -/// the execution is aborted and zero result code is produced by the method execution_monitor::execute. -/// -/// @subsection Parameters Supported parameters -/// -/// The Execution Monitor behavior is configurable through the set of parameters (properties) associated with the instance of the monitor. See execution_monitor -/// specification for a list of supported parameters and their semantic. - -// ************************************************************************** // -// ************** detail::translator_holder_base ************** // -// ************************************************************************** // - -namespace detail { - -class translator_holder_base; -typedef boost::shared_ptr translator_holder_base_ptr; - -class BOOST_TEST_DECL translator_holder_base { -protected: - typedef boost::unit_test::const_string const_string; -public: - // Constructor - translator_holder_base( translator_holder_base_ptr next, const_string tag ) - : m_next( next ) - , m_tag( std::string() + tag ) - { - } - - // Destructor - virtual ~translator_holder_base() {} - - // translator holder interface - // invokes the function F inside the try/catch guarding against specific exception - virtual int operator()( boost::function const& F ) = 0; - - // erases specific translator holder from the chain - translator_holder_base_ptr erase( translator_holder_base_ptr this_, const_string tag ) - { - if( m_next ) - m_next = m_next->erase( m_next, tag ); - - return m_tag == tag ? m_next : this_; - } -#ifndef BOOST_NO_RTTI - virtual translator_holder_base_ptr erase( translator_holder_base_ptr this_, std::type_info const& ) = 0; - template - translator_holder_base_ptr erase( translator_holder_base_ptr this_, boost::type* = 0 ) - { - if( m_next ) - m_next = m_next->erase( m_next ); - - return erase( this_, typeid(ExceptionType) ); - } -#endif - -protected: - // Data members - translator_holder_base_ptr m_next; - std::string m_tag; -}; - -} // namespace detail - -// ************************************************************************** // -/// @class execution_exception -/// @brief This class is used to report any kind of an failure during execution of a monitored function inside of execution_monitor -/// -/// The instance of this class is thrown out of execution_monitor::execute invocation when failure is detected. Regardless of a kind of failure occurred -/// the instance will provide a uniform way to catch and report it. -/// -/// One important design rationale for this class is that we should be ready to work after fatal memory corruptions or out of memory conditions. To facilitate -/// this class never allocates any memory and assumes that strings it refers to are either some constants or live in a some kind of persistent (preallocated) memory. -// ************************************************************************** // - -class BOOST_TEST_DECL execution_exception { - typedef boost::unit_test::const_string const_string; -public: - /// These values are sometimes used as program return codes. - /// The particular values have been chosen to avoid conflicts with - /// commonly used program return codes: values < 100 are often user - /// assigned, values > 255 are sometimes used to report system errors. - /// Gaps in values allow for orderly expansion. - /// - /// @note(1) Only uncaught C++ exceptions are treated as errors. - /// If a function catches a C++ exception, it never reaches - /// the execution_monitor. - /// - /// The implementation decides what is a system_fatal_error and what is - /// just a system_exception. Fatal errors are so likely to have corrupted - /// machine state (like a stack overflow or addressing exception) that it - /// is unreasonable to continue execution. - /// - /// @note(2) These errors include Unix signals and Windows structured - /// exceptions. They are often initiated by hardware traps. - enum error_code { - no_error = 0, ///< for completeness only; never returned - user_error = 200, ///< user reported non-fatal error - cpp_exception_error = 205, ///< see note (1) above - system_error = 210, ///< see note (2) above - timeout_error = 215, ///< only detectable on certain platforms - user_fatal_error = 220, ///< user reported fatal error - system_fatal_error = 225 ///< see note (2) above - }; - - /// Simple model for the location of failure in a source code - struct BOOST_TEST_DECL location { - explicit location( char const* file_name = 0, size_t line_num = 0, char const* func = 0 ); - explicit location( const_string file_name, size_t line_num = 0, char const* func = 0 ); - - const_string m_file_name; ///< File name - size_t m_line_num; ///< Line number - const_string m_function; ///< Function name - }; - - /// @name Constructors - - /// Constructs instance based on message, location and error code - - /// @param[in] ec error code - /// @param[in] what_msg error message - /// @param[in] location error location - execution_exception( error_code ec, const_string what_msg, location const& location ); - - /// @name Access methods - - /// Exception error code - error_code code() const { return m_error_code; } - /// Exception message - const_string what() const { return m_what; } - /// Exception location - location const& where() const { return m_location; } - ///@} - -private: - // Data members - error_code m_error_code; - const_string m_what; - location m_location; -}; // execution_exception - -// ************************************************************************** // -/// @brief Function execution monitor - -/// This class is used to uniformly detect and report an occurrence of several types of signals and exceptions, reducing various -/// errors to a uniform execution_exception that is returned to a caller. -/// -/// The executiom_monitor behavior can be customized through a set of public parameters (properties) associated with the execution_monitor instance. -/// All parameters are implemented as public unit_test::readwrite_property data members of the class execution_monitor. -// ************************************************************************** // - -class BOOST_TEST_DECL execution_monitor { - typedef boost::unit_test::const_string const_string; -public: - - /// Default constructor initializes all execution monitor properties - execution_monitor(); - - /// Should monitor catch system errors. - /// - /// The @em p_catch_system_errors property is a boolean flag (default value is true) specifying whether or not execution_monitor should trap system - /// errors/system level exceptions/signals, which would cause program to crash in a regular case (without execution_monitor). - /// Set this property to false, for example, if you wish to force coredump file creation. The Unit Test Framework provides a - /// runtime parameter @c \-\-catch_system_errors=yes to alter the behavior in monitored test cases. - unit_test::readwrite_property p_catch_system_errors; - - /// Should monitor try to attach debugger in case of caught system error. - /// - /// The @em p_auto_start_dbg property is a boolean flag (default value is false) specifying whether or not execution_monitor should try to attach debugger - /// in case system error is caught. - unit_test::readwrite_property p_auto_start_dbg; - - - /// Specifies the seconds that elapse before a timer_error occurs. - /// - /// The @em p_timeout property is an integer timeout (in seconds) for monitored function execution. Use this parameter to monitor code with possible deadlocks - /// or indefinite loops. This feature is only available for some operating systems (not yet Microsoft Windows). - unit_test::readwrite_property p_timeout; - - /// Should monitor use alternative stack for the signal catching. - /// - /// The @em p_use_alt_stack property is a boolean flag (default value is false) specifying whether or not execution_monitor should use an alternative stack - /// for the sigaction based signal catching. When enabled the signals are delivered to the execution_monitor on a stack different from current execution - /// stack, which is safer in case if it is corrupted by monitored function. For more details on alternative stack handling see appropriate manuals. - unit_test::readwrite_property p_use_alt_stack; - - /// Should monitor try to detect hardware floating point exceptions (!= 0), and which specific exception to catch. - /// - /// The @em p_detect_fp_exceptions property is a boolean flag (default value is false) specifying whether or not execution_monitor should install hardware - /// traps for the floating point exception on platforms where it's supported. - unit_test::readwrite_property p_detect_fp_exceptions; - - - // @name Monitoring entry points - - /// @brief Execution monitor entry point for functions returning integer value - /// - /// This method executes supplied function F inside a try/catch block and also may include other unspecified platform dependent error detection code. - /// - /// This method throws an execution_exception on an uncaught C++ exception, a hardware or software signal, trap, or other user exception. - /// - /// @note execute() doesn't consider it an error for F to return a non-zero value. - /// @param[in] F Function to monitor - /// @returns value returned by function call F(). - /// @see vexecute - int execute( boost::function const& F ); - - /// @brief Execution monitor entry point for functions returning void - /// - /// This method is semantically identical to execution_monitor::execute, but des't produce any result code. - /// @param[in] F Function to monitor - /// @see execute - void vexecute( boost::function const& F ); - // @} - - // @name Exception translator registration - - /// @brief Registers custom (user supplied) exception translator - - /// This method template registers a translator for an exception type specified as a first template argument. For example - /// @code - /// void myExceptTr( MyException const& ex ) { /*do something with the exception here*/} - /// em.register_exception_translator( myExceptTr ); - /// @endcode - /// The translator should be any unary function/functor object which accepts MyException const&. This can be free standing function - /// or bound class method. The second argument is an optional string tag you can associate with this translator routine. The only reason - /// to specify the tag is if you plan to erase the translator eventually. This can be useful in scenario when you reuse the same - /// execution_monitor instance to monitor different routines and need to register a translator specific to the routine being monitored. - /// While it is possible to erase the translator based on an exception type it was registered for, tag string provides simpler way of doing this. - /// @tparam ExceptionType type of the exception we register a translator for - /// @tparam ExceptionTranslator type of the translator we register for this exception - /// @param[in] tr translator function object with the signature void (ExceptionType const&) - /// @param[in] tag tag associated with this translator - template - void register_exception_translator( ExceptionTranslator const& tr, const_string tag = const_string(), boost::type* = 0 ); - - /// @brief Erases custom exception translator based on a tag - - /// Use the same tag as the one used during translator registration - /// @param[in] tag tag associated with translator you wants to erase - void erase_exception_translator( const_string tag ) - { - m_custom_translators = m_custom_translators->erase( m_custom_translators, tag ); - } -#ifndef BOOST_NO_RTTI - /// @brief Erases custom exception translator based on an exception type - /// - /// tparam ExceptionType Exception type for which you want to erase the translator - template - void erase_exception_translator( boost::type* = 0 ) - { - m_custom_translators = m_custom_translators->erase( m_custom_translators ); - } - //@} -#endif - -private: - // implementation helpers - int catch_signals( boost::function const& F ); - - // Data members - detail::translator_holder_base_ptr m_custom_translators; - boost::scoped_array m_alt_stack; -}; // execution_monitor - -// ************************************************************************** // -// ************** detail::translator_holder ************** // -// ************************************************************************** // - -namespace detail { - -template -class translator_holder : public translator_holder_base -{ -public: - explicit translator_holder( ExceptionTranslator const& tr, translator_holder_base_ptr& next, const_string tag = const_string() ) - : translator_holder_base( next, tag ), m_translator( tr ) {} - - // translator holder interface - virtual int operator()( boost::function const& F ) - { - BOOST_TEST_I_TRY { - return m_next ? (*m_next)( F ) : F(); - } - BOOST_TEST_I_CATCH( ExceptionType, e ) { - m_translator( e ); - return boost::exit_exception_failure; - } - } -#ifndef BOOST_NO_RTTI - virtual translator_holder_base_ptr erase( translator_holder_base_ptr this_, std::type_info const& ti ) - { - return ti == typeid(ExceptionType) ? m_next : this_; - } -#endif - -private: - // Data members - ExceptionTranslator m_translator; -}; - -} // namespace detail - -template -void -execution_monitor::register_exception_translator( ExceptionTranslator const& tr, const_string tag, boost::type* ) -{ - m_custom_translators.reset( - new detail::translator_holder( tr, m_custom_translators, tag ) ); -} - -// ************************************************************************** // -/// @class execution_aborted -/// @brief This is a trivial default constructible class. Use it to report graceful abortion of a monitored function execution. -// ************************************************************************** // - -struct execution_aborted {}; - -// ************************************************************************** // -// ************** system_error ************** // -// ************************************************************************** // - -class system_error { -public: - // Constructor - explicit system_error( char const* exp ); - - long const p_errno; - char const* const p_failed_exp; -}; - -//!@internal -#define BOOST_TEST_SYS_ASSERT( cond ) BOOST_TEST_I_ASSRT( cond, ::boost::system_error( BOOST_STRINGIZE( exp ) ) ) - -// ************************************************************************** // -// **************Floating point exception management interface ************** // -// ************************************************************************** // - -namespace fpe { - -enum masks { - BOOST_FPE_OFF = 0, - -#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__) /* *** */ - BOOST_FPE_DIVBYZERO = EM_ZERODIVIDE, - BOOST_FPE_INEXACT = EM_INEXACT, - BOOST_FPE_INVALID = EM_INVALID, - BOOST_FPE_OVERFLOW = EM_OVERFLOW, - BOOST_FPE_UNDERFLOW = EM_UNDERFLOW|EM_DENORMAL, - - BOOST_FPE_ALL = MCW_EM, - -#elif !defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__)/* *** */ - BOOST_FPE_ALL = BOOST_FPE_OFF, - -#else /* *** */ - -#if defined(FE_DIVBYZERO) - BOOST_FPE_DIVBYZERO = FE_DIVBYZERO, -#else - BOOST_FPE_DIVBYZERO = BOOST_FPE_OFF, -#endif - -#if defined(FE_INEXACT) - BOOST_FPE_INEXACT = FE_INEXACT, -#else - BOOST_FPE_INEXACT = BOOST_FPE_OFF, -#endif - -#if defined(FE_INVALID) - BOOST_FPE_INVALID = FE_INVALID, -#else - BOOST_FPE_INVALID = BOOST_FPE_OFF, -#endif - -#if defined(FE_OVERFLOW) - BOOST_FPE_OVERFLOW = FE_OVERFLOW, -#else - BOOST_FPE_OVERFLOW = BOOST_FPE_OFF, -#endif - -#if defined(FE_UNDERFLOW) - BOOST_FPE_UNDERFLOW = FE_UNDERFLOW, -#else - BOOST_FPE_UNDERFLOW = BOOST_FPE_OFF, -#endif - -#if defined(FE_ALL_EXCEPT) - BOOST_FPE_ALL = FE_ALL_EXCEPT, -#else - BOOST_FPE_ALL = BOOST_FPE_OFF, -#endif - -#endif /* *** */ - BOOST_FPE_INV = BOOST_FPE_ALL+1 -}; - -//____________________________________________________________________________// - -// return the previous set of enabled exceptions when successful, and BOOST_FPE_INV otherwise -unsigned BOOST_TEST_DECL enable( unsigned mask ); -unsigned BOOST_TEST_DECL disable( unsigned mask ); - -//____________________________________________________________________________// - -} // namespace fpe - -///@} - -} // namespace boost - - -#include - -#endif diff --git a/libraries/boost/include/boost/test/floating_point_comparison.hpp b/libraries/boost/include/boost/test/floating_point_comparison.hpp deleted file mode 100644 index e889274477..0000000000 --- a/libraries/boost/include/boost/test/floating_point_comparison.hpp +++ /dev/null @@ -1,14 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! @brief Deprecated header -//! @deprecated Use boost/test/tools/floating_point_comparison.hpp instead -// *************************************************************************** - -// Boost.Test -#include diff --git a/libraries/boost/include/boost/test/framework.hpp b/libraries/boost/include/boost/test/framework.hpp deleted file mode 100644 index 099c02969b..0000000000 --- a/libraries/boost/include/boost/test/framework.hpp +++ /dev/null @@ -1,303 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Defines Unit Test Framework mono-state interfaces. -//! The framework interfaces are based on Monostate design pattern. -// *************************************************************************** - -#ifndef BOOST_TEST_FRAMEWORK_HPP_020805GER -#define BOOST_TEST_FRAMEWORK_HPP_020805GER - -// Boost.Test -#include -#include -#include - -#include - -#include - -// STL -#include - -//____________________________________________________________________________// - -namespace boost { - -/// Main namespace for the Unit Test Framework interfaces and implementation -namespace unit_test { - -// ************************************************************************** // -// ************** init_unit_test_func ************** // -// ************************************************************************** // - -/// Test module initialization routine signature - -/// Different depending on whether BOOST_TEST_ALTERNATIVE_INIT_API is defined or not -#ifdef BOOST_TEST_ALTERNATIVE_INIT_API -typedef bool (*init_unit_test_func)(); -#else -typedef test_suite* (*init_unit_test_func)( int, char* [] ); -#endif - -// ************************************************************************** // -// ************** framework ************** // -// ************************************************************************** // - -/// Namespace of the Unit Test Framework mono-state -namespace framework { - -/// @name Unit Test Framework initialization and shutdown -/// @{ - -/// @brief This function performs initialization of the framework mono-state. -/// -/// It needs to be called every time before the test is started. -/// @param[in] init_func test module initialization routine -/// @param[in] argc command line arguments collection -/// @param[in] argv command line arguments collection -BOOST_TEST_DECL void init( init_unit_test_func init_func, int argc, char* argv[] ); - -/// This function applies all the decorators and figures out default run status. This argument facilitates an -/// ability of the test cases to prepare some other test units (primarily used internally for self testing). -/// @param[in] tu Optional id of the test unit representing root of test tree. If absent, master test suite is used -BOOST_TEST_DECL void finalize_setup_phase( test_unit_id tu = INV_TEST_UNIT_ID); - -/// This function returns true when testing is in progress (setup is finished). -BOOST_TEST_DECL bool test_in_progress(); - -/// This function shuts down the framework and clears up its mono-state. -/// -/// It needs to be at the very end of test module execution -BOOST_TEST_DECL void shutdown(); -/// @} - -/// @name Test unit registration -/// @{ - -/// Provides both read and write access to current "leaf" auto test suite during the test unit registration phase. -/// -/// During auto-registration phase the framework maintain a FIFO queue of test units being registered. New test units become children -/// of the current "leaf" test suite and if this is test suite it is pushed back into queue and becomes a new leaf. -/// When test suite registration is completed, a test suite is popped from the back of the queue. Only automatically registered test suites -/// should be added to this queue. Master test suite is always a zero element in this queue, so if no other test suites are registered -/// all test cases are added to master test suite. - -/// This function facilitates all three possible actions: -/// - if no argument are provided it returns the current queue leaf test suite -/// - if test suite is provided and no second argument are set, test suite is added to the queue -/// - if no test suite are provided and last argument is false, the semantic of this function is similar to queue pop: last element is popped from the queue -/// @param[in] ts test suite to push back to the queue -/// @param[in] push_or_pop should we push ts to the queue or pop leaf test suite instead -/// @returns a reference to the currently active/"leaf" test suite -BOOST_TEST_DECL test_suite& current_auto_test_suite( test_suite* ts = 0, bool push_or_pop = true ); - -/// This function add new test case into the global collection of test units the framework aware of. - -/// This function also assignes unique test unit id for every test case. Later on one can use this id to locate -/// the test case if necessary. This is the way for the framework to maintain weak references between test units. -/// @param[in] tc test case to register -BOOST_TEST_DECL void register_test_unit( test_case* tc ); - -/// This function add new test suite into the global collection of test units the framework aware of. - -/// This function also assignes unique test unit id for every test suite. Later on one can use this id to locate -/// the test case if necessary. This is the way for the framework to maintain weak references between test units. -/// @param[in] ts test suite to register -BOOST_TEST_DECL void register_test_unit( test_suite* ts ); - -/// This function removes the test unit from the collection of known test units and destroys the test unit object. - -/// This function also assigns unique test unit id for every test case. Later on one can use this id to located -/// the test case if necessary. This is the way for the framework to maintain weak references between test units. -/// @param[in] tu test unit to deregister -BOOST_TEST_DECL void deregister_test_unit( test_unit* tu ); - -// This function clears up the framework mono-state. - -/// After this call the framework can be reinitialized to perform a second test run during the same program lifetime. -BOOST_TEST_DECL void clear(); -/// @} - -/// @name Test observer registration -/// @{ -/// Adds new test execution observer object into the framework's list of test observers. - -/// Observer lifetime should exceed the the testing execution timeframe -/// @param[in] to test observer object to add -BOOST_TEST_DECL void register_observer( test_observer& to ); - -/// Excludes the observer object form the framework's list of test observers -/// @param[in] to test observer object to exclude -BOOST_TEST_DECL void deregister_observer( test_observer& to ); - -/// @} - -/// @name Global fixtures registration -/// @{ - -/// Adds a new global fixture to be setup before any other tests starts and tore down after -/// any other tests finished. -/// Test unit fixture lifetime should exceed the testing execution timeframe -/// @param[in] tuf fixture to add -BOOST_TEST_DECL void register_global_fixture( test_unit_fixture& tuf ); - -/// Removes a test global fixture from the framework -/// -/// Test unit fixture lifetime should exceed the testing execution timeframe -/// @param[in] tuf fixture to remove -BOOST_TEST_DECL void deregister_global_fixture( test_unit_fixture& tuf ); -/// @} - -/// @name Assertion/uncaught exception context support -/// @{ -/// Context accessor -struct BOOST_TEST_DECL context_generator { - context_generator() : m_curr_frame( 0 ) {} - - /// Is there any context? - bool is_empty() const; - - /// Give me next frame; empty - last frame - const_string next() const; - -private: - // Data members - mutable unsigned m_curr_frame; -}; - -/// Records context frame message. - -/// Some context frames are sticky - they can only explicitly cleared by specifying context id. Other (non sticky) context frames cleared after every assertion. -/// @param[in] context_descr context frame message -/// @param[in] sticky is this sticky frame or not -/// @returns id of the newly created frame -BOOST_TEST_DECL int add_context( lazy_ostream const& context_descr, bool sticky ); -/// Erases context frame (when test exits context scope) - -/// If context_id is passed clears that specific context frame identified by this id, otherwise clears all non sticky contexts. -BOOST_TEST_DECL void clear_context( int context_id = -1 ); -/// Produces an instance of small "delegate" object, which facilitates access to collected context. -BOOST_TEST_DECL context_generator get_context(); -/// @} - -/// @name Access to registered test units. -/// @{ -/// This function provides access to the master test suite. - -/// There is only only master test suite per test module. -/// @returns a reference the master test suite instance -BOOST_TEST_DECL master_test_suite_t& master_test_suite(); - -/// This function provides an access to the test unit currently being executed. - -/// The difference with current_test_case is about the time between a test-suite -/// is being set up or torn down (fixtures) and when the test-cases of that suite start. - -/// This function is only valid during test execution phase. -/// @see current_test_case_id, current_test_case -BOOST_TEST_DECL test_unit const& current_test_unit(); - -/// This function provides an access to the test case currently being executed. - -/// This function is only valid during test execution phase. -/// @see current_test_case_id -BOOST_TEST_DECL test_case const& current_test_case(); - -/// This function provides an access to an id of the test case currently being executed. - -/// This function safer than current_test_case, cause if wont throw if no test case is being executed. -/// @see current_test_case -BOOST_TEST_DECL test_unit_id current_test_case_id(); /* safe version of above */ - -/// This function provides access to a test unit by id and type combination. It will throw if no test unit located. -/// @param[in] tu_id id of a test unit to locate -/// @param[in] tu_type type of a test unit to locate -/// @returns located test unit -BOOST_TEST_DECL test_unit& get( test_unit_id tu_id, test_unit_type tu_type ); - -/// This function template provides access to a typed test unit by id - -/// It will throw if you specify incorrect test unit type -/// @tparam UnitType compile time type of test unit to get (test_suite or test_case) -/// @param id id of test unit to get -template -inline UnitType& get( test_unit_id id ) -{ - return static_cast( get( id, static_cast(UnitType::type) ) ); -} -///@} - -/// @name Test initiation interface -/// @{ - -/// Initiates test execution - -/// This function is used to start the test execution from a specific "root" test unit. -/// If no root provided, test is started from master test suite. This second argument facilitates an ability of the test cases to -/// start some other test units (primarily used internally for self testing). -/// @param[in] tu Optional id of the test unit or test unit itself from which the test is started. If absent, master test suite is used -/// @param[in] continue_test true == continue test if it was already started, false == restart the test from scratch regardless -BOOST_TEST_DECL void run( test_unit_id tu = INV_TEST_UNIT_ID, bool continue_test = true ); -/// Initiates test execution. Same as other overload -BOOST_TEST_DECL void run( test_unit const* tu, bool continue_test = true ); -/// @} - -/// @name Test events dispatchers -/// @{ -/// Reports results of assertion to all test observers -BOOST_TEST_DECL void assertion_result( unit_test::assertion_result ar ); -/// Reports uncaught exception to all test observers -BOOST_TEST_DECL void exception_caught( execution_exception const& ); -/// Reports aborted test unit to all test observers -BOOST_TEST_DECL void test_unit_aborted( test_unit const& ); -/// Reports aborted test module to all test observers -BOOST_TEST_DECL void test_aborted( ); -/// @} - -namespace impl { -// exclusively for self test -BOOST_TEST_DECL void setup_for_execution( test_unit const& ); -BOOST_TEST_DECL void setup_loggers( ); -} // namespace impl - -// ************************************************************************** // -// ************** framework errors ************** // -// ************************************************************************** // - -/// This exception type is used to report internal Boost.Test framework errors. -struct BOOST_TEST_DECL internal_error : public std::runtime_error { - internal_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {} -}; - -//____________________________________________________________________________// - -/// This exception type is used to report test module setup errors. -struct BOOST_TEST_DECL setup_error : public std::runtime_error { - setup_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {} -}; - -#define BOOST_TEST_SETUP_ASSERT( cond, msg ) BOOST_TEST_I_ASSRT( cond, unit_test::framework::setup_error( msg ) ) - -//____________________________________________________________________________// - -struct nothing_to_test { - explicit nothing_to_test( int rc ) : m_result_code( rc ) {} - - int m_result_code; -}; - -//____________________________________________________________________________// - -} // namespace framework -} // unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_FRAMEWORK_HPP_020805GER diff --git a/libraries/boost/include/boost/test/impl/compiler_log_formatter.ipp b/libraries/boost/include/boost/test/impl/compiler_log_formatter.ipp deleted file mode 100644 index aa0a0e229f..0000000000 --- a/libraries/boost/include/boost/test/impl/compiler_log_formatter.ipp +++ /dev/null @@ -1,298 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements compiler like Log formatter -// *************************************************************************** - -#ifndef BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER -#define BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER - -// Boost.Test -#include - -#include -#include -#include - -#include - -#include -#include -#include - - -// Boost -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -// ************************************************************************** // -// ************** compiler_log_formatter ************** // -// ************************************************************************** // - -namespace { - -std::string -test_phase_identifier() -{ - return framework::test_in_progress() ? framework::current_test_unit().full_name() : std::string( "Test setup" ); -} - -} // local namespace - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_start( std::ostream& output, counter_t test_cases_amount ) -{ - m_color_output = runtime_config::get( runtime_config::btrt_color_output ); - - if( test_cases_amount > 0 ) - output << "Running " << test_cases_amount << " test " - << (test_cases_amount > 1 ? "cases" : "case") << "...\n"; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_finish( std::ostream& ostr ) -{ - ostr.flush(); -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_build_info( std::ostream& output ) -{ - output << "Platform: " << BOOST_PLATFORM << '\n' - << "Compiler: " << BOOST_COMPILER << '\n' - << "STL : " << BOOST_STDLIB << '\n' - << "Boost : " << BOOST_VERSION/100000 << "." - << BOOST_VERSION/100 % 1000 << "." - << BOOST_VERSION % 100 << std::endl; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::test_unit_start( std::ostream& output, test_unit const& tu ) -{ - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::BLUE ); - - print_prefix( output, tu.p_file_name, tu.p_line_num ); - - output << "Entering test " << tu.p_type_name << " \"" << tu.p_name << "\"" << std::endl; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::test_unit_finish( std::ostream& output, test_unit const& tu, unsigned long elapsed ) -{ - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::BLUE ); - - print_prefix( output, tu.p_file_name, tu.p_line_num ); - - output << "Leaving test " << tu.p_type_name << " \"" << tu.p_name << "\""; - - if( elapsed > 0 ) { - output << "; testing time: "; - if( elapsed % 1000 == 0 ) - output << elapsed/1000 << "ms"; - else - output << elapsed << "us"; - } - - output << std::endl; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::test_unit_skipped( std::ostream& output, test_unit const& tu, const_string reason ) -{ - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::YELLOW ); - - print_prefix( output, tu.p_file_name, tu.p_line_num ); - - output << "Test " << tu.p_type_name << " \"" << tu.full_name() << "\"" << " is skipped because " << reason << std::endl; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_exception_start( std::ostream& output, log_checkpoint_data const& checkpoint_data, execution_exception const& ex ) -{ - execution_exception::location const& loc = ex.where(); - - print_prefix( output, loc.m_file_name, loc.m_line_num ); - - { - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::UNDERLINE, term_color::RED ); - - output << "fatal error: in \"" << (loc.m_function.is_empty() ? test_phase_identifier() : loc.m_function ) << "\": " - << ex.what(); - } - - if( !checkpoint_data.m_file_name.is_empty() ) { - output << '\n'; - print_prefix( output, checkpoint_data.m_file_name, checkpoint_data.m_line_num ); - - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, output, term_attr::BRIGHT, term_color::CYAN ); - - output << "last checkpoint"; - if( !checkpoint_data.m_message.empty() ) - output << ": " << checkpoint_data.m_message; - } -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_exception_finish( std::ostream& output ) -{ - output << std::endl; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_entry_start( std::ostream& output, log_entry_data const& entry_data, log_entry_types let ) -{ - using namespace utils; - - switch( let ) { - case BOOST_UTL_ET_INFO: - print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - if( m_color_output ) - output << setcolor( term_attr::BRIGHT, term_color::GREEN ); - output << "info: "; - break; - case BOOST_UTL_ET_MESSAGE: - if( m_color_output ) - output << setcolor( term_attr::BRIGHT, term_color::CYAN ); - break; - case BOOST_UTL_ET_WARNING: - print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - if( m_color_output ) - output << setcolor( term_attr::BRIGHT, term_color::YELLOW ); - output << "warning: in \"" << test_phase_identifier() << "\": "; - break; - case BOOST_UTL_ET_ERROR: - print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - if( m_color_output ) - output << setcolor( term_attr::BRIGHT, term_color::RED ); - output << "error: in \"" << test_phase_identifier() << "\": "; - break; - case BOOST_UTL_ET_FATAL_ERROR: - print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - if( m_color_output ) - output << setcolor( term_attr::UNDERLINE, term_color::RED ); - output << "fatal error: in \"" << test_phase_identifier() << "\": "; - break; - } -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_entry_value( std::ostream& output, const_string value ) -{ - output << value; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_entry_value( std::ostream& output, lazy_ostream const& value ) -{ - output << value; -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_entry_finish( std::ostream& output ) -{ - if( m_color_output ) - output << utils::setcolor(); - - output << std::endl; -} - - -//____________________________________________________________________________// - -void -compiler_log_formatter::print_prefix( std::ostream& output, const_string file_name, std::size_t line_num ) -{ - if( !file_name.empty() ) { -#ifdef __APPLE_CC__ - // Xcode-compatible logging format, idea by Richard Dingwall at - // . - output << file_name << ':' << line_num << ": "; -#else - output << file_name << '(' << line_num << "): "; -#endif - } -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::entry_context_start( std::ostream& output, log_level l ) -{ - if( l == log_messages ) { - output << "\n[context:"; - } - else { - output << (l == log_successful_tests ? "\nAssertion" : "\nFailure" ) << " occurred in a following context:"; - } -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::entry_context_finish( std::ostream& output, log_level l ) -{ - if( l == log_messages ) { - output << "]"; - } - output.flush(); -} - -//____________________________________________________________________________// - -void -compiler_log_formatter::log_entry_context( std::ostream& output, log_level /*l*/, const_string context_descr ) -{ - output << "\n " << context_descr; -} - -//____________________________________________________________________________// - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/cpp_main.ipp b/libraries/boost/include/boost/test/impl/cpp_main.ipp deleted file mode 100644 index aaa5cabfc5..0000000000 --- a/libraries/boost/include/boost/test/impl/cpp_main.ipp +++ /dev/null @@ -1,136 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// (C) Copyright Beman Dawes 1995-2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : main function implementation for Program Executon Monitor -// *************************************************************************** - -#ifndef BOOST_TEST_CPP_MAIN_IPP_012205GER -#define BOOST_TEST_CPP_MAIN_IPP_012205GER - -// Boost.Test -#include -#include -#include - -// Boost -#include // for exit codes -#include // for workarounds - -// STL -#include -#include // std::getenv -#include // std::strerror - -#include - -//____________________________________________________________________________// - -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::getenv; using ::strerror; } -#endif - -namespace { - -struct cpp_main_caller { - cpp_main_caller( int (*cpp_main_func)( int argc, char* argv[] ), int argc, char** argv ) - : m_cpp_main_func( cpp_main_func ) - , m_argc( argc ) - , m_argv( argv ) {} - - int operator()() { return (*m_cpp_main_func)( m_argc, m_argv ); } - -private: - // Data members - int (*m_cpp_main_func)( int argc, char* argv[] ); - int m_argc; - char** m_argv; -}; - -} // local namespace - -// ************************************************************************** // -// ************** prg_exec_monitor_main ************** // -// ************************************************************************** // - -namespace boost { - -int BOOST_TEST_DECL -prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char* argv[] ) -{ - int result = 0; - - BOOST_TEST_I_TRY { - boost::unit_test::const_string p( std::getenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS" ) ); - ::boost::execution_monitor ex_mon; - - ex_mon.p_catch_system_errors.value = p != "no"; - - result = ex_mon.execute( cpp_main_caller( cpp_main, argc, argv ) ); - - if( result == 0 ) - result = ::boost::exit_success; - else if( result != ::boost::exit_success ) { - std::cout << "\n**** error return code: " << result << std::endl; - result = ::boost::exit_failure; - } - } - BOOST_TEST_I_CATCH( ::boost::execution_exception, exex ) { - std::cout << "\n**** exception(" << exex.code() << "): " << exex.what() << std::endl; - result = ::boost::exit_exception_failure; - } - BOOST_TEST_I_CATCH( ::boost::system_error, ex ) { - std::cout << "\n**** failed to initialize execution monitor." - << "\n**** expression at fault: " << ex.p_failed_exp - << "\n**** error(" << ex.p_errno << "): " << std::strerror( ex.p_errno ) << std::endl; - result = ::boost::exit_exception_failure; - } - - if( result != ::boost::exit_success ) { - std::cerr << "******** errors detected; see standard output for details ********" << std::endl; - } - else { - // Some prefer a confirming message when all is well, while others don't - // like the clutter. Use an environment variable to avoid command - // line argument modifications; for use in production programs - // that's a no-no in some organizations. - ::boost::unit_test::const_string p( std::getenv( "BOOST_PRG_MON_CONFIRM" ) ); - if( p != "no" ) { - std::cerr << std::flush << "no errors detected" << std::endl; - } - } - - return result; -} - -} // namespace boost - -#if !defined(BOOST_TEST_DYN_LINK) && !defined(BOOST_TEST_NO_MAIN) - -// ************************************************************************** // -// ************** main function for tests using lib ************** // -// ************************************************************************** // - -int cpp_main( int argc, char* argv[] ); // prototype for user's cpp_main() - -int BOOST_TEST_CALL_DECL -main( int argc, char* argv[] ) -{ - return ::boost::prg_exec_monitor_main( &cpp_main, argc, argv ); -} - -//____________________________________________________________________________// - -#endif // !BOOST_TEST_DYN_LINK && !BOOST_TEST_NO_MAIN - -#include - -#endif // BOOST_TEST_CPP_MAIN_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/debug.ipp b/libraries/boost/include/boost/test/impl/debug.ipp deleted file mode 100644 index a5e5f6da06..0000000000 --- a/libraries/boost/include/boost/test/impl/debug.ipp +++ /dev/null @@ -1,1009 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : debug interfaces implementation -// *************************************************************************** - -#ifndef BOOST_TEST_DEBUG_API_IPP_112006GER -#define BOOST_TEST_DEBUG_API_IPP_112006GER - -// Boost.Test -#include -#include -#include - -#include -#include - -// Implementation on Windows -#if defined(_WIN32) && !defined(UNDER_CE) && !defined(BOOST_DISABLE_WIN32) // ******* WIN32 - -# define BOOST_WIN32_BASED_DEBUG - -// SYSTEM API -# include -# include -# include -# include - -# if !defined(NDEBUG) && defined(_MSC_VER) -# define BOOST_MS_CRT_BASED_DEBUG -# include -# endif - - -# ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::memset; using ::sprintf; } -# endif - -#elif defined(unix) || defined(__unix) // ********************* UNIX - -# define BOOST_UNIX_BASED_DEBUG - -// Boost.Test -#include -#include - -// STL -#include // std::memcpy -#include -#include -#include // !! ?? cstdarg - -// SYSTEM API -# include -# include -# include - -# include -# include -# include -# include -# include -# include - -# if defined(sun) || defined(__sun) - -# define BOOST_SUN_BASED_DEBUG - -# ifndef BOOST_TEST_DBG_LIST -# define BOOST_TEST_DBG_LIST dbx;gdb -# endif - -# define BOOST_TEST_CNL_DBG dbx -# define BOOST_TEST_GUI_DBG dbx-ddd - -# include - -# elif defined(linux) || defined(__linux) - -# define BOOST_LINUX_BASED_DEBUG - -# include - -# ifndef BOOST_TEST_STAT_LINE_MAX -# define BOOST_TEST_STAT_LINE_MAX 500 -# endif - -# ifndef BOOST_TEST_DBG_LIST -# define BOOST_TEST_DBG_LIST gdb -# endif - -# define BOOST_TEST_CNL_DBG gdb -# define BOOST_TEST_GUI_DBG gdb-xterm - -# endif - -#endif - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace debug { - -using unit_test::const_string; - -// ************************************************************************** // -// ************** debug::info_t ************** // -// ************************************************************************** // - -namespace { - -#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 - -template -inline void -dyn_symbol( T& res, char const* module_name, char const* symbol_name ) -{ - HMODULE m = ::GetModuleHandleA( module_name ); - - if( !m ) - m = ::LoadLibraryA( module_name ); - - res = reinterpret_cast( ::GetProcAddress( m, symbol_name ) ); -} - -//____________________________________________________________________________// - -static struct info_t { - typedef BOOL (WINAPI* IsDebuggerPresentT)(); - typedef LONG (WINAPI* RegQueryValueExT)( HKEY, char const* /*LPTSTR*/, LPDWORD, LPDWORD, LPBYTE, LPDWORD ); - typedef LONG (WINAPI* RegOpenKeyT)( HKEY, char const* /*LPCTSTR*/, PHKEY ); - typedef LONG (WINAPI* RegCloseKeyT)( HKEY ); - - info_t(); - - IsDebuggerPresentT m_is_debugger_present; - RegOpenKeyT m_reg_open_key; - RegQueryValueExT m_reg_query_value; - RegCloseKeyT m_reg_close_key; - -} s_info; - -//____________________________________________________________________________// - -info_t::info_t() -{ - dyn_symbol( m_is_debugger_present, "kernel32", "IsDebuggerPresent" ); - dyn_symbol( m_reg_open_key, "advapi32", "RegOpenKeyA" ); - dyn_symbol( m_reg_query_value, "advapi32", "RegQueryValueExA" ); - dyn_symbol( m_reg_close_key, "advapi32", "RegCloseKey" ); -} - -//____________________________________________________________________________// - -#elif defined(BOOST_UNIX_BASED_DEBUG) - -// ************************************************************************** // -// ************** fd_holder ************** // -// ************************************************************************** // - -struct fd_holder { - explicit fd_holder( int fd ) : m_fd( fd ) {} - ~fd_holder() - { - if( m_fd != -1 ) - ::close( m_fd ); - } - - operator int() { return m_fd; } - -private: - // Data members - int m_fd; -}; - - -// ************************************************************************** // -// ************** process_info ************** // -// ************************************************************************** // - -struct process_info { - // Constructor - explicit process_info( int pid ); - - // access methods - int parent_pid() const { return m_parent_pid; } - const_string binary_name() const { return m_binary_name; } - const_string binary_path() const { return m_binary_path; } - -private: - // Data members - int m_parent_pid; - const_string m_binary_name; - const_string m_binary_path; - -#if defined(BOOST_SUN_BASED_DEBUG) - struct psinfo m_psi; - char m_binary_path_buff[500+1]; // !! ?? -#elif defined(BOOST_LINUX_BASED_DEBUG) - char m_stat_line[BOOST_TEST_STAT_LINE_MAX+1]; - char m_binary_path_buff[500+1]; // !! ?? -#endif -}; - -//____________________________________________________________________________// - -process_info::process_info( int pid ) -: m_parent_pid( 0 ) -{ -#if defined(BOOST_SUN_BASED_DEBUG) - char fname_buff[30]; - - ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/psinfo", pid ); - - fd_holder psinfo_fd( ::open( fname_buff, O_RDONLY ) ); - - if( psinfo_fd == -1 ) - return; - - if( ::read( psinfo_fd, &m_psi, sizeof(m_psi) ) == -1 ) - return; - - m_parent_pid = m_psi.pr_ppid; - - m_binary_name.assign( m_psi.pr_fname ); - - //-------------------------- // - - ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/as", pid ); - - fd_holder as_fd( ::open( fname_buff, O_RDONLY ) ); - uintptr_t binary_name_pos; - - // !! ?? could we avoid reading whole m_binary_path_buff? - if( as_fd == -1 || - ::lseek( as_fd, m_psi.pr_argv, SEEK_SET ) == -1 || - ::read ( as_fd, &binary_name_pos, sizeof(binary_name_pos) ) == -1 || - ::lseek( as_fd, binary_name_pos, SEEK_SET ) == -1 || - ::read ( as_fd, m_binary_path_buff, sizeof(m_binary_path_buff) ) == -1 ) - return; - - m_binary_path.assign( m_binary_path_buff ); - -#elif defined(BOOST_LINUX_BASED_DEBUG) - char fname_buff[30]; - - ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/stat", pid ); - - fd_holder psinfo_fd( ::open( fname_buff, O_RDONLY ) ); - - if( psinfo_fd == -1 ) - return; - - ssize_t num_read = ::read( psinfo_fd, m_stat_line, sizeof(m_stat_line)-1 ); - if( num_read == -1 ) - return; - - m_stat_line[num_read] = 0; - - char const* name_beg = m_stat_line; - while( *name_beg && *name_beg != '(' ) - ++name_beg; - - char const* name_end = name_beg+1; - while( *name_end && *name_end != ')' ) - ++name_end; - - std::sscanf( name_end+1, "%*s%d", &m_parent_pid ); - - m_binary_name.assign( name_beg+1, name_end ); - - ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/exe", pid ); - num_read = ::readlink( fname_buff, m_binary_path_buff, sizeof(m_binary_path_buff)-1 ); - - if( num_read == -1 ) - return; - - m_binary_path_buff[num_read] = 0; - m_binary_path.assign( m_binary_path_buff, num_read ); -#endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** prepare_window_title ************** // -// ************************************************************************** // - -static char* -prepare_window_title( dbg_startup_info const& dsi ) -{ - typedef unit_test::const_string str_t; - - static char title_str[50]; - - str_t path_sep( "\\/" ); - - str_t::iterator it = unit_test::utils::find_last_of( dsi.binary_path.begin(), dsi.binary_path.end(), - path_sep.begin(), path_sep.end() ); - - if( it == dsi.binary_path.end() ) - it = dsi.binary_path.begin(); - else - ++it; - - ::snprintf( title_str, sizeof(title_str), "%*s %ld", (int)(dsi.binary_path.end()-it), it, dsi.pid ); - - return title_str; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** save_execlp ************** // -// ************************************************************************** // - -typedef unit_test::basic_cstring mbuffer; - -inline char* -copy_arg( mbuffer& dest, const_string arg ) -{ - if( dest.size() < arg.size()+1 ) - return 0; - - char* res = dest.begin(); - - std::memcpy( res, arg.begin(), arg.size()+1 ); - - dest.trim_left( arg.size()+1 ); - - return res; -} - -//____________________________________________________________________________// - -bool -safe_execlp( char const* file, ... ) -{ - static char* argv_buff[200]; - - va_list args; - char const* arg; - - // first calculate actual number of arguments - int num_args = 2; // file name and 0 at least - - va_start( args, file ); - while( !!(arg = va_arg( args, char const* )) ) - num_args++; - va_end( args ); - - // reserve space for the argument pointers array - char** argv_it = argv_buff; - mbuffer work_buff( reinterpret_cast(argv_buff), sizeof(argv_buff) ); - work_buff.trim_left( num_args * sizeof(char*) ); - - // copy all the argument values into local storage - if( !(*argv_it++ = copy_arg( work_buff, file )) ) - return false; - - printf( "!! %s\n", file ); - - va_start( args, file ); - while( !!(arg = va_arg( args, char const* )) ) { - printf( "!! %s\n", arg ); - if( !(*argv_it++ = copy_arg( work_buff, arg )) ) { - va_end( args ); - return false; - } - } - va_end( args ); - - *argv_it = 0; - - return ::execvp( file, argv_buff ) != -1; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** start_debugger_in_emacs ************** // -// ************************************************************************** // - -static void -start_debugger_in_emacs( dbg_startup_info const& dsi, char const* emacs_name, char const* dbg_command ) -{ - char const* title = prepare_window_title( dsi ); - - if( !title ) - return; - - dsi.display.is_empty() - ? safe_execlp( emacs_name, "-title", title, "--eval", dbg_command, 0 ) - : safe_execlp( emacs_name, "-title", title, "-display", dsi.display.begin(), "--eval", dbg_command, 0 ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** gdb starters ************** // -// ************************************************************************** // - -static char const* -prepare_gdb_cmnd_file( dbg_startup_info const& dsi ) -{ - // prepare pid value - char pid_buff[16]; - ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); - unit_test::const_string pid_str( pid_buff ); - - static char cmd_file_name[] = "/tmp/btl_gdb_cmd_XXXXXX"; // !! ?? - - // prepare commands - fd_holder cmd_fd( ::mkstemp( cmd_file_name ) ); - - if( cmd_fd == -1 ) - return 0; - -#define WRITE_STR( str ) if( ::write( cmd_fd, str.begin(), str.size() ) == -1 ) return 0; -#define WRITE_CSTR( str ) if( ::write( cmd_fd, str, sizeof( str )-1 ) == -1 ) return 0; - - WRITE_CSTR( "file " ); - WRITE_STR( dsi.binary_path ); - WRITE_CSTR( "\nattach " ); - WRITE_STR( pid_str ); - WRITE_CSTR( "\nshell unlink " ); - WRITE_STR( dsi.init_done_lock ); - WRITE_CSTR( "\ncont" ); - if( dsi.break_or_continue ) - WRITE_CSTR( "\nup 4" ); - - WRITE_CSTR( "\necho \\n" ); // !! ?? - WRITE_CSTR( "\nlist -" ); - WRITE_CSTR( "\nlist" ); - WRITE_CSTR( "\nshell unlink " ); - WRITE_CSTR( cmd_file_name ); - - return cmd_file_name; -} - -//____________________________________________________________________________// - -static void -start_gdb_in_console( dbg_startup_info const& dsi ) -{ - char const* cmnd_file_name = prepare_gdb_cmnd_file( dsi ); - - if( !cmnd_file_name ) - return; - - safe_execlp( "gdb", "-q", "-x", cmnd_file_name, 0 ); -} - -//____________________________________________________________________________// - -static void -start_gdb_in_xterm( dbg_startup_info const& dsi ) -{ - char const* title = prepare_window_title( dsi ); - char const* cmnd_file_name = prepare_gdb_cmnd_file( dsi ); - - if( !title || !cmnd_file_name ) - return; - - safe_execlp( "xterm", "-T", title, "-display", dsi.display.begin(), - "-bg", "black", "-fg", "white", "-geometry", "88x30+10+10", "-fn", "9x15", "-e", - "gdb", "-q", "-x", cmnd_file_name, 0 ); -} - -//____________________________________________________________________________// - -static void -start_gdb_in_emacs( dbg_startup_info const& dsi ) -{ - char const* cmnd_file_name = prepare_gdb_cmnd_file( dsi ); - if( !cmnd_file_name ) - return; - - char dbg_cmd_buff[500]; // !! ?? - ::snprintf( dbg_cmd_buff, sizeof(dbg_cmd_buff), "(progn (gdb \"gdb -q -x %s\"))", cmnd_file_name ); - - start_debugger_in_emacs( dsi, "emacs", dbg_cmd_buff ); -} - -//____________________________________________________________________________// - -static void -start_gdb_in_xemacs( dbg_startup_info const& ) -{ - // !! ?? -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** dbx starters ************** // -// ************************************************************************** // - -static char const* -prepare_dbx_cmd_line( dbg_startup_info const& dsi, bool list_source = true ) -{ - static char cmd_line_buff[500]; // !! ?? - - ::snprintf( cmd_line_buff, sizeof(cmd_line_buff), "unlink %s;cont;%s%s", - dsi.init_done_lock.begin(), - dsi.break_or_continue ? "up 2;": "", - list_source ? "echo \" \";list -w3;" : "" ); - - return cmd_line_buff; -} - -//____________________________________________________________________________// - -static void -start_dbx_in_console( dbg_startup_info const& dsi ) -{ - char pid_buff[16]; - ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); - - safe_execlp( "dbx", "-q", "-c", prepare_dbx_cmd_line( dsi ), dsi.binary_path.begin(), pid_buff, 0 ); -} - -//____________________________________________________________________________// - -static void -start_dbx_in_xterm( dbg_startup_info const& dsi ) -{ - char const* title = prepare_window_title( dsi ); - if( !title ) - return; - - char pid_buff[16]; // !! ?? - ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); - - safe_execlp( "xterm", "-T", title, "-display", dsi.display.begin(), - "-bg", "black", "-fg", "white", "-geometry", "88x30+10+10", "-fn", "9x15", "-e", - "dbx", "-q", "-c", prepare_dbx_cmd_line( dsi ), dsi.binary_path.begin(), pid_buff, 0 ); -} - -//____________________________________________________________________________// - -static void -start_dbx_in_emacs( dbg_startup_info const& /*dsi*/ ) -{ -// char dbg_cmd_buff[500]; // !! ?? -// -// ::snprintf( dbg_cmd_buff, sizeof(dbg_cmd_buff), "(progn (dbx \"dbx -q -c cont %s %ld\"))", dsi.binary_path.begin(), dsi.pid ); - -// start_debugger_in_emacs( dsi, "emacs", dbg_cmd_buff ); -} - -//____________________________________________________________________________// - -static void -start_dbx_in_xemacs( dbg_startup_info const& ) -{ - // !! ?? -} - -//____________________________________________________________________________// - -static void -start_dbx_in_ddd( dbg_startup_info const& dsi ) -{ - char const* title = prepare_window_title( dsi ); - if( !title ) - return; - - char pid_buff[16]; // !! ?? - ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid ); - - safe_execlp( "ddd", "-display", dsi.display.begin(), - "--dbx", "-q", "-c", prepare_dbx_cmd_line( dsi, false ), dsi.binary_path.begin(), pid_buff, 0 ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** debug::info_t ************** // -// ************************************************************************** // - -static struct info_t { - // Constructor - info_t(); - - // Public properties - unit_test::readwrite_property p_dbg; - - // Data members - std::map m_dbg_starter_reg; -} s_info; - -//____________________________________________________________________________// - -info_t::info_t() -{ - p_dbg.value = ::getenv( "DISPLAY" ) - ? std::string( BOOST_STRINGIZE( BOOST_TEST_GUI_DBG ) ) - : std::string( BOOST_STRINGIZE( BOOST_TEST_CNL_DBG ) ); - - m_dbg_starter_reg[std::string("gdb")] = &start_gdb_in_console; - m_dbg_starter_reg[std::string("gdb-emacs")] = &start_gdb_in_emacs; - m_dbg_starter_reg[std::string("gdb-xterm")] = &start_gdb_in_xterm; - m_dbg_starter_reg[std::string("gdb-xemacs")] = &start_gdb_in_xemacs; - - m_dbg_starter_reg[std::string("dbx")] = &start_dbx_in_console; - m_dbg_starter_reg[std::string("dbx-emacs")] = &start_dbx_in_emacs; - m_dbg_starter_reg[std::string("dbx-xterm")] = &start_dbx_in_xterm; - m_dbg_starter_reg[std::string("dbx-xemacs")] = &start_dbx_in_xemacs; - m_dbg_starter_reg[std::string("dbx-ddd")] = &start_dbx_in_ddd; -} - -//____________________________________________________________________________// - -#endif - -} // local namespace - -// ************************************************************************** // -// ************** check if program is running under debugger ************** // -// ************************************************************************** // - -bool -under_debugger() -{ -#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 - - return !!s_info.m_is_debugger_present && s_info.m_is_debugger_present(); - -#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX - - // !! ?? could/should we cache the result somehow? - const_string dbg_list = BOOST_TEST_STRINGIZE( BOOST_TEST_DBG_LIST ); - - pid_t pid = ::getpid(); - - while( pid != 0 ) { - process_info pi( pid ); - - // !! ?? should we use tokenizer here instead? - if( dbg_list.find( pi.binary_name() ) != const_string::npos ) - return true; - - pid = (pi.parent_pid() == pid ? 0 : pi.parent_pid()); - } - - return false; - -#else // ****************************************************** default - - return false; - -#endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** cause program to break execution ************** // -// ************** in debugger at call point ************** // -// ************************************************************************** // - -void -debugger_break() -{ - // !! ?? auto-start debugger? - -#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 - -#if defined(__GNUC__) && !defined(__MINGW32__) || \ - defined(__INTEL_COMPILER) -# define BOOST_DEBUG_BREAK __debugbreak -#else -# define BOOST_DEBUG_BREAK DebugBreak -#endif - -#ifndef __MINGW32__ - if( !under_debugger() ) { - __try { - __try { - BOOST_DEBUG_BREAK(); - } - __except( UnhandledExceptionFilter(GetExceptionInformation()) ) - { - // User opted to ignore the breakpoint - return; - } - } - __except (EXCEPTION_EXECUTE_HANDLER) - { - // If we got here, the user has pushed Debug. Debugger is already attached to our process and we - // continue to let the another BOOST_DEBUG_BREAK to be called. - } - } -#endif - - BOOST_DEBUG_BREAK(); - -#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX - - ::kill( ::getpid(), SIGTRAP ); - -#else // ****************************************************** default - -#endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** console debugger setup ************** // -// ************************************************************************** // - -#if defined(BOOST_UNIX_BASED_DEBUG) // ************************ UNIX - -std::string -set_debugger( unit_test::const_string dbg_id, dbg_starter s ) -{ - std::string old = s_info.p_dbg; - - assign_op( s_info.p_dbg.value, dbg_id, 0 ); - - if( !!s ) - s_info.m_dbg_starter_reg[s_info.p_dbg.get()] = s; - - return old; -} - -#else // ***************************************************** default - -std::string -set_debugger( unit_test::const_string, dbg_starter ) -{ - return std::string(); -} - -#endif - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** attach debugger to the current process ************** // -// ************************************************************************** // - -#if defined(BOOST_WIN32_BASED_DEBUG) - -struct safe_handle_helper -{ - HANDLE& handle; - safe_handle_helper(HANDLE &handle_) : handle(handle_) {} - - void close_handle() - { - if( handle != INVALID_HANDLE_VALUE ) - { - ::CloseHandle( handle ); - handle = INVALID_HANDLE_VALUE; - } - } - - ~safe_handle_helper() - { - close_handle(); - } -}; -#endif - -bool -attach_debugger( bool break_or_continue ) -{ - if( under_debugger() ) - return false; - -#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32 - - const int MAX_CMD_LINE = 200; - - // *************************************************** // - // Debugger "ready" event - - SECURITY_ATTRIBUTES attr; - attr.nLength = sizeof(attr); - attr.lpSecurityDescriptor = NULL; - attr.bInheritHandle = true; - - // manual resettable, initially non signaled, unnamed event, - // that will signal me that debugger initialization is done - HANDLE dbg_init_done_ev = ::CreateEvent( - &attr, // pointer to security attributes - true, // flag for manual-reset event - false, // flag for initial state - NULL // pointer to event-object name - ); - - if( !dbg_init_done_ev ) - return false; - - safe_handle_helper safe_handle_obj( dbg_init_done_ev ); - - // *************************************************** // - // Debugger command line format - - HKEY reg_key; - - if( !s_info.m_reg_open_key || (*s_info.m_reg_open_key)( - HKEY_LOCAL_MACHINE, // handle of open key - "Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", // name of subkey to open - ®_key ) != ERROR_SUCCESS ) // address of handle of open key - return false; - - char format[MAX_CMD_LINE]; - DWORD format_size = MAX_CMD_LINE; - DWORD type = REG_SZ; - - bool b_read_key = s_info.m_reg_query_value && - ((*s_info.m_reg_query_value)( - reg_key, // handle of open key - "Debugger", // name of subkey to query - 0, // reserved - &type, // value type - (LPBYTE)format, // buffer for returned string - &format_size ) == ERROR_SUCCESS ); // in: buffer size; out: actual size of returned string - - if( !s_info.m_reg_close_key || (*s_info.m_reg_close_key)( reg_key ) != ERROR_SUCCESS ) - return false; - - if( !b_read_key ) - return false; - - // *************************************************** // - // Debugger command line - - char cmd_line[MAX_CMD_LINE]; - std::sprintf( cmd_line, format, ::GetCurrentProcessId(), dbg_init_done_ev ); - - // *************************************************** // - // Debugger window parameters - - STARTUPINFOA startup_info; - std::memset( &startup_info, 0, sizeof(startup_info) ); - - startup_info.cb = sizeof(startup_info); - startup_info.dwFlags = STARTF_USESHOWWINDOW; - startup_info.wShowWindow = SW_SHOWNORMAL; - - // debugger process s_info - PROCESS_INFORMATION debugger_info; - - bool created = !!::CreateProcessA( - NULL, // pointer to name of executable module; NULL - use the one in command line - cmd_line, // pointer to command line string - NULL, // pointer to process security attributes; NULL - debugger's handle can't be inherited - NULL, // pointer to thread security attributes; NULL - debugger's handle can't be inherited - true, // debugger inherit opened handles - 0, // priority flags; 0 - normal priority - NULL, // pointer to new environment block; NULL - use this process environment - NULL, // pointer to current directory name; NULL - use this process correct directory - &startup_info, // pointer to STARTUPINFO that specifies main window appearance - &debugger_info // pointer to PROCESS_INFORMATION that will contain the new process identification - ); - - bool debugger_run_ok = false; - if( created ) - { - DWORD ret_code = ::WaitForSingleObject( dbg_init_done_ev, INFINITE ); - debugger_run_ok = ( ret_code == WAIT_OBJECT_0 ); - } - - safe_handle_obj.close_handle(); - - if( !created || !debugger_run_ok ) - return false; - - if( break_or_continue ) - debugger_break(); - - return true; - -#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX - - char init_done_lock_fn[] = "/tmp/btl_dbg_init_done_XXXXXX"; - fd_holder init_done_lock_fd( ::mkstemp( init_done_lock_fn ) ); - - if( init_done_lock_fd == -1 ) - return false; - - pid_t child_pid = fork(); - - if( child_pid == -1 ) - return false; - - if( child_pid != 0 ) { // parent process - here we will start the debugger - dbg_startup_info dsi; - - process_info pi( child_pid ); - if( pi.binary_path().is_empty() ) - ::exit( -1 ); - - dsi.pid = child_pid; - dsi.break_or_continue = break_or_continue; - dsi.binary_path = pi.binary_path(); - dsi.display = ::getenv( "DISPLAY" ); - dsi.init_done_lock = init_done_lock_fn; - - dbg_starter starter = s_info.m_dbg_starter_reg[s_info.p_dbg]; - if( !!starter ) - starter( dsi ); - - ::perror( "Boost.Test execution monitor failed to start a debugger:" ); - - ::exit( -1 ); - } - - // child process - here we will continue our test module execution ; // !! ?? should it be vice versa - - while( ::access( init_done_lock_fn, F_OK ) == 0 ) { - struct timeval to = { 0, 100 }; - - ::select( 0, 0, 0, 0, &to ); - } - -// char dummy; -// while( ::read( init_done_lock_fd, &dummy, sizeof(char) ) == 0 ); - - if( break_or_continue ) - debugger_break(); - - return true; - -#else // ****************************************************** default - (void) break_or_continue; // silence 'unused variable' warning - return false; - -#endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** switch on/off detect memory leaks feature ************** // -// ************************************************************************** // - -void -detect_memory_leaks( bool on_off, unit_test::const_string report_file ) -{ - unit_test::ut_detail::ignore_unused_variable_warning( on_off ); - -#ifdef BOOST_MS_CRT_BASED_DEBUG - int flags = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); - - if( !on_off ) - flags &= ~_CRTDBG_LEAK_CHECK_DF; - else { - flags |= _CRTDBG_LEAK_CHECK_DF; - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); - - if( report_file.is_empty() ) - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - else { - HANDLE hreport_f = ::CreateFileA( report_file.begin(), - GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - _CrtSetReportFile(_CRT_WARN, hreport_f ); - } - } - - _CrtSetDbgFlag ( flags ); -#else - unit_test::ut_detail::ignore_unused_variable_warning( report_file ); -#endif // BOOST_MS_CRT_BASED_DEBUG -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** cause program to break execution in ************** // -// ************** debugger at specific allocation point ************** // -// ************************************************************************** // - -void -break_memory_alloc( long mem_alloc_order_num ) -{ - unit_test::ut_detail::ignore_unused_variable_warning( mem_alloc_order_num ); - -#ifdef BOOST_MS_CRT_BASED_DEBUG - // only set the value if one was supplied (do not use default used by UTF just as a indicator to enable leak detection) - if( mem_alloc_order_num > 1 ) - _CrtSetBreakAlloc( mem_alloc_order_num ); -#endif // BOOST_MS_CRT_BASED_DEBUG -} - -//____________________________________________________________________________// - -} // namespace debug -} // namespace boost - -#include - -#endif // BOOST_TEST_DEBUG_API_IPP_112006GER - diff --git a/libraries/boost/include/boost/test/impl/decorator.ipp b/libraries/boost/include/boost/test/impl/decorator.ipp deleted file mode 100644 index 74d42b22a2..0000000000 --- a/libraries/boost/include/boost/test/impl/decorator.ipp +++ /dev/null @@ -1,202 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : unit test decorators implementation -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_DECORATOR_IPP_091911GER -#define BOOST_TEST_TREE_DECORATOR_IPP_091911GER - -// Boost.Test -#include -#include - -#include -#if BOOST_TEST_SUPPORT_TOKEN_ITERATOR -#include -#endif - -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace decorator { - -// ************************************************************************** // -// ************** decorator::collector ************** // -// ************************************************************************** // - -collector& -collector::operator*( base const& d ) -{ - m_tu_decorators.push_back( d.clone() ); - - return *this; -} - -//____________________________________________________________________________// - -void -collector::store_in( test_unit& tu ) -{ - tu.p_decorators.value.insert( tu.p_decorators.value.end(), m_tu_decorators.begin(), m_tu_decorators.end() ); -} - -//____________________________________________________________________________// - -void -collector::reset() -{ - m_tu_decorators.clear(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::base ************** // -// ************************************************************************** // - -collector& -base::operator*() const -{ - return collector::instance() * *this; -} - -// ************************************************************************** // -// ************** decorator::label ************** // -// ************************************************************************** // - -void -label::apply( test_unit& tu ) -{ - tu.add_label( m_label ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::expected_failures ************** // -// ************************************************************************** // - -void -expected_failures::apply( test_unit& tu ) -{ - tu.increase_exp_fail( m_exp_fail ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::timeout ************** // -// ************************************************************************** // - -void -timeout::apply( test_unit& tu ) -{ - tu.p_timeout.value = m_timeout; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::description ************** // -// ************************************************************************** // - -void -description::apply( test_unit& tu ) -{ - tu.p_description.value += m_description; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::depends_on ************** // -// ************************************************************************** // - -void -depends_on::apply( test_unit& tu ) -{ -#if !BOOST_TEST_SUPPORT_TOKEN_ITERATOR - BOOST_TEST_SETUP_ASSERT( false, "depends_on decorator is not supported on this platform" ); -#else - utils::string_token_iterator tit( m_dependency, (utils::dropped_delimeters = "/", utils::kept_delimeters = utils::dt_none) ); - - test_unit* dep = &framework::master_test_suite(); - while( tit != utils::string_token_iterator() ) { - BOOST_TEST_SETUP_ASSERT( dep->p_type == TUT_SUITE, std::string( "incorrect dependency specification " ) + m_dependency ); - - test_unit_id next_id = static_cast(dep)->get( *tit ); - - BOOST_TEST_SETUP_ASSERT( next_id != INV_TEST_UNIT_ID, - std::string( "incorrect dependency specification " ) + m_dependency ); - - dep = &framework::get( next_id, TUT_ANY ); - ++tit; - } - - tu.depends_on( dep ); -#endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::enable_if/enabled/disabled ************** // -// ************************************************************************** // - -void -enable_if_impl::apply_impl( test_unit& tu, bool condition ) -{ - BOOST_TEST_SETUP_ASSERT(tu.p_default_status == test_unit::RS_INHERIT, - "Can't apply multiple enabled/disabled decorators " - "to the same test unit " + tu.full_name()); - - tu.p_default_status.value = condition ? test_unit::RS_ENABLED : test_unit::RS_DISABLED; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::fixture ************** // -// ************************************************************************** // - -void -fixture_t::apply( test_unit& tu ) -{ - tu.p_fixtures.value.push_back( m_impl ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::depends_on ************** // -// ************************************************************************** // - -void -precondition::apply( test_unit& tu ) -{ - tu.add_precondition( m_precondition ); -} - -//____________________________________________________________________________// - -} // namespace decorator -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TREE_DECORATOR_IPP_091911GER diff --git a/libraries/boost/include/boost/test/impl/execution_monitor.ipp b/libraries/boost/include/boost/test/impl/execution_monitor.ipp deleted file mode 100644 index 035bb958c1..0000000000 --- a/libraries/boost/include/boost/test/impl/execution_monitor.ipp +++ /dev/null @@ -1,1448 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// (C) Copyright Beman Dawes and Ullrich Koethe 1995-2001. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Provides execution monitor implementation for all supported -/// configurations, including Microsoft structured exception based, unix signals -/// based and special workarounds for borland -/// -/// Note that when testing requirements or user wishes preclude use of this -/// file as a separate compilation unit, it may be included as a header file. -/// -/// Header dependencies are deliberately restricted to reduce coupling to other -/// boost libraries. -// *************************************************************************** - -#ifndef BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER -#define BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER - -// Boost.Test -#include -#include -#include -#include -#include - -// Boost -#include // for exit codes -#include // for workarounds -#include // for ignore_unused -#ifndef BOOST_NO_EXCEPTIONS -#include // for get_error_info -#include // for current_exception_cast -#endif - -// STL -#include // for std::string -#include // for std::bad_alloc -#include // for std::bad_cast, std::bad_typeid -#include // for std::exception, std::bad_exception -#include // for std exception hierarchy -#include // for C string API -#include // for assert -#include // for NULL -#include // for vsnprintf -#include // for varargs - -#include // for varargs - -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::strerror; using ::strlen; using ::strncat; } -#endif - -// to use vsnprintf -#if defined(__SUNPRO_CC) || defined(__SunOS) -# include -# include -using std::va_list; -#endif - -// to use vsnprintf -#if defined(__QNXNTO__) || defined(__VXWORKS__) -# include -using std::va_list; -#endif - -#if defined(__VXWORKS__) -# define BOOST_TEST_LIMITED_SIGNAL_DETAILS -#endif - -#ifdef BOOST_SEH_BASED_SIGNAL_HANDLING -# include - -# if defined(__MWERKS__) || (defined(_MSC_VER) && !defined(UNDER_CE)) -# include -# endif - -# if defined(__BORLANDC__) && __BORLANDC__ >= 0x560 || defined(__MWERKS__) -# include -# endif - -# if defined(__BORLANDC__) && __BORLANDC__ < 0x560 - typedef unsigned uintptr_t; -# endif - -# if defined(UNDER_CE) && BOOST_WORKAROUND(_MSC_VER, < 1500 ) - typedef void* uintptr_t; -# elif defined(UNDER_CE) -# include -# endif - -# if !defined(NDEBUG) && defined(_MSC_VER) && !defined(UNDER_CE) -# include -# define BOOST_TEST_CRT_HOOK_TYPE _CRT_REPORT_HOOK -# define BOOST_TEST_CRT_ASSERT _CRT_ASSERT -# define BOOST_TEST_CRT_ERROR _CRT_ERROR -# define BOOST_TEST_CRT_SET_HOOK(H) _CrtSetReportHook(H) -# else -# define BOOST_TEST_CRT_HOOK_TYPE void* -# define BOOST_TEST_CRT_ASSERT 2 -# define BOOST_TEST_CRT_ERROR 1 -# define BOOST_TEST_CRT_SET_HOOK(H) (void*)(H) -# endif - -# if (!BOOST_WORKAROUND(_MSC_VER, >= 1400 ) && \ - !defined(BOOST_COMO)) || defined(UNDER_CE) - -typedef void* _invalid_parameter_handler; - -inline _invalid_parameter_handler -_set_invalid_parameter_handler( _invalid_parameter_handler arg ) -{ - return arg; -} - -# endif - -# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564)) || defined(UNDER_CE) - -namespace { void _set_se_translator( void* ) {} } - -# endif - -#elif defined(BOOST_HAS_SIGACTION) - -# define BOOST_SIGACTION_BASED_SIGNAL_HANDLING - -# include -# include -# include - -# if defined(__FreeBSD__) - -# include - -# ifndef SIGPOLL -# define SIGPOLL SIGIO -# endif - -# if (__FreeBSD_version < 70100) - -# define ILL_ILLADR 0 // ILL_RESAD_FAULT -# define ILL_PRVOPC ILL_PRIVIN_FAULT -# define ILL_ILLOPN 2 // ILL_RESOP_FAULT -# define ILL_COPROC ILL_FPOP_FAULT - -# define BOOST_TEST_LIMITED_SIGNAL_DETAILS - -# endif -# endif - -# if defined(__ANDROID__) -# include -# endif - -// documentation of BOOST_TEST_DISABLE_ALT_STACK in execution_monitor.hpp -# if !defined(__CYGWIN__) && !defined(__QNXNTO__) && !defined(__bgq__) && \ - (!defined(__ANDROID__) || __ANDROID_API__ >= 8) && \ - !defined(BOOST_TEST_DISABLE_ALT_STACK) -# define BOOST_TEST_USE_ALT_STACK -# endif - -# if defined(SIGPOLL) && !defined(__CYGWIN__) && \ - !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && \ - !defined(__NetBSD__) && \ - !defined(__QNXNTO__) -# define BOOST_TEST_CATCH_SIGPOLL -# endif - -# ifdef BOOST_TEST_USE_ALT_STACK -# define BOOST_TEST_ALT_STACK_SIZE SIGSTKSZ -# endif - - -#else - -# define BOOST_NO_SIGNAL_HANDLING - -#endif - -#ifndef UNDER_CE -#include -#endif - -#if !defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) -# include -#endif - -#include - -//____________________________________________________________________________// - -namespace boost { - -// ************************************************************************** // -// ************** throw_exception ************** // -// ************************************************************************** // - -#ifdef BOOST_NO_EXCEPTIONS -void throw_exception( std::exception const & e ) { abort(); } -#endif - -// ************************************************************************** // -// ************** report_error ************** // -// ************************************************************************** // - -namespace detail { - -#ifdef __BORLANDC__ -# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) std::vsnprintf( (a1), (a2), (a3), (a4) ) -#elif BOOST_WORKAROUND(_MSC_VER, <= 1310) || \ - BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3000)) || \ - defined(UNDER_CE) -# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) _vsnprintf( (a1), (a2), (a3), (a4) ) -#else -# define BOOST_TEST_VSNPRINTF( a1, a2, a3, a4 ) vsnprintf( (a1), (a2), (a3), (a4) ) -#endif - -#ifndef BOOST_NO_EXCEPTIONS - -template -typename ErrorInfo::value_type -extract( boost::exception const* ex ) -{ - if( !ex ) - return 0; - - typename ErrorInfo::value_type const * val = boost::get_error_info( *ex ); - - return val ? *val : 0; -} - -//____________________________________________________________________________// - -static void -report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, va_list* args ) -{ - static const int REPORT_ERROR_BUFFER_SIZE = 4096; - static char buf[REPORT_ERROR_BUFFER_SIZE]; - - BOOST_TEST_VSNPRINTF( buf, sizeof(buf)-1, format, *args ); - buf[sizeof(buf)-1] = 0; - - va_end( *args ); - - BOOST_TEST_I_THROW(execution_exception( ec, buf, execution_exception::location( extract( be ), - (size_t)extract( be ), - extract( be ) ) )); -} - -//____________________________________________________________________________// - -static void -report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, ... ) -{ - va_list args; - va_start( args, format ); - - report_error( ec, be, format, &args ); -} - -#endif - -//____________________________________________________________________________// - -static void -report_error( execution_exception::error_code ec, char const* format, ... ) -{ - va_list args; - va_start( args, format ); - - report_error( ec, 0, format, &args ); -} - -//____________________________________________________________________________// - -template -inline int -do_invoke( Tr const& tr, Functor const& F ) -{ - return tr ? (*tr)( F ) : F(); -} - -//____________________________________________________________________________// - -struct fpe_except_guard { - explicit fpe_except_guard( unsigned detect_fpe ) - : m_detect_fpe( detect_fpe ) - { - // prepare fp exceptions control - m_previously_enabled = fpe::disable( fpe::BOOST_FPE_ALL ); - if( m_previously_enabled != fpe::BOOST_FPE_INV && detect_fpe != fpe::BOOST_FPE_OFF ) - fpe::enable( detect_fpe ); - } - ~fpe_except_guard() - { - if( m_detect_fpe != fpe::BOOST_FPE_OFF ) - fpe::disable( m_detect_fpe ); - if( m_previously_enabled != fpe::BOOST_FPE_INV ) - fpe::enable( m_previously_enabled ); - } - - unsigned m_detect_fpe; - unsigned m_previously_enabled; -}; - - -// ************************************************************************** // -// ************** typeid_name ************** // -// ************************************************************************** // - -#if !defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) -template -std::string -typeid_name( T const& t ) -{ - return boost::core::demangle(typeid(t).name()); -} -#endif - -} // namespace detail - -#if defined(BOOST_SIGACTION_BASED_SIGNAL_HANDLING) - -// ************************************************************************** // -// ************** Sigaction based signal handling ************** // -// ************************************************************************** // - -namespace detail { - -// ************************************************************************** // -// ************** boost::detail::system_signal_exception ************** // -// ************************************************************************** // - -class system_signal_exception { -public: - // Constructor - system_signal_exception() - : m_sig_info( 0 ) - , m_context( 0 ) - {} - - // Access methods - void operator()( siginfo_t* i, void* c ) - { - m_sig_info = i; - m_context = c; - } - void report() const; - -private: - // Data members - siginfo_t* m_sig_info; // system signal detailed info - void* m_context; // signal context -}; - -//____________________________________________________________________________// - -void -system_signal_exception::report() const -{ - if( !m_sig_info ) - return; // no error actually occur? - - switch( m_sig_info->si_code ) { -#ifdef __VXWORKS__ -// a bit of a hack to adapt code to small m_sig_info VxWorks uses -#define si_addr si_value.sival_int -#define si_band si_value.sival_int -#else - case SI_USER: - report_error( execution_exception::system_error, - "signal: generated by kill() (or family); uid=%d; pid=%d", - (int)m_sig_info->si_uid, (int)m_sig_info->si_pid ); - break; -#endif - case SI_QUEUE: - report_error( execution_exception::system_error, - "signal: sent by sigqueue()" ); - break; - case SI_TIMER: - report_error( execution_exception::system_error, - "signal: the expiration of a timer set by timer_settimer()" ); - break; - case SI_ASYNCIO: - report_error( execution_exception::system_error, - "signal: generated by the completion of an asynchronous I/O request" ); - break; - case SI_MESGQ: - report_error( execution_exception::system_error, - "signal: generated by the the arrival of a message on an empty message queue" ); - break; - default: - break; - } - - switch( m_sig_info->si_signo ) { - case SIGILL: - switch( m_sig_info->si_code ) { -#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS - case ILL_ILLOPC: - report_error( execution_exception::system_fatal_error, - "signal: illegal opcode; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case ILL_ILLTRP: - report_error( execution_exception::system_fatal_error, - "signal: illegal trap; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case ILL_PRVREG: - report_error( execution_exception::system_fatal_error, - "signal: privileged register; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case ILL_BADSTK: - report_error( execution_exception::system_fatal_error, - "signal: internal stack error; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; -#endif - case ILL_ILLOPN: - report_error( execution_exception::system_fatal_error, - "signal: illegal operand; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case ILL_ILLADR: - report_error( execution_exception::system_fatal_error, - "signal: illegal addressing mode; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case ILL_PRVOPC: - report_error( execution_exception::system_fatal_error, - "signal: privileged opcode; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case ILL_COPROC: - report_error( execution_exception::system_fatal_error, - "signal: co-processor error; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - default: - report_error( execution_exception::system_fatal_error, - "signal: SIGILL, si_code: %d (illegal instruction; address of failing instruction: 0x%08lx)", - m_sig_info->si_addr, m_sig_info->si_code ); - break; - } - break; - - case SIGFPE: - switch( m_sig_info->si_code ) { - case FPE_INTDIV: - report_error( execution_exception::system_error, - "signal: integer divide by zero; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case FPE_INTOVF: - report_error( execution_exception::system_error, - "signal: integer overflow; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case FPE_FLTDIV: - report_error( execution_exception::system_error, - "signal: floating point divide by zero; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case FPE_FLTOVF: - report_error( execution_exception::system_error, - "signal: floating point overflow; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case FPE_FLTUND: - report_error( execution_exception::system_error, - "signal: floating point underflow; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case FPE_FLTRES: - report_error( execution_exception::system_error, - "signal: floating point inexact result; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case FPE_FLTINV: - report_error( execution_exception::system_error, - "signal: invalid floating point operation; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - case FPE_FLTSUB: - report_error( execution_exception::system_error, - "signal: subscript out of range; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); - break; - default: - report_error( execution_exception::system_error, - "signal: SIGFPE, si_code: %d (errnoneous arithmetic operations; address of failing instruction: 0x%08lx)", - m_sig_info->si_addr, m_sig_info->si_code ); - break; - } - break; - - case SIGSEGV: - switch( m_sig_info->si_code ) { -#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS - case SEGV_MAPERR: - report_error( execution_exception::system_fatal_error, - "memory access violation at address: 0x%08lx: no mapping at fault address", - m_sig_info->si_addr ); - break; - case SEGV_ACCERR: - report_error( execution_exception::system_fatal_error, - "memory access violation at address: 0x%08lx: invalid permissions", - m_sig_info->si_addr ); - break; -#endif - default: - report_error( execution_exception::system_fatal_error, - "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)", - m_sig_info->si_addr, m_sig_info->si_code ); - break; - } - break; - - case SIGBUS: - switch( m_sig_info->si_code ) { -#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS - case BUS_ADRALN: - report_error( execution_exception::system_fatal_error, - "memory access violation at address: 0x%08lx: invalid address alignment", - m_sig_info->si_addr ); - break; - case BUS_ADRERR: - report_error( execution_exception::system_fatal_error, - "memory access violation at address: 0x%08lx: non-existent physical address", - m_sig_info->si_addr ); - break; - case BUS_OBJERR: - report_error( execution_exception::system_fatal_error, - "memory access violation at address: 0x%08lx: object specific hardware error", - m_sig_info->si_addr ); - break; -#endif - default: - report_error( execution_exception::system_fatal_error, - "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)", - m_sig_info->si_addr, m_sig_info->si_code ); - break; - } - break; - -#if defined(BOOST_TEST_CATCH_SIGPOLL) - - case SIGPOLL: - switch( m_sig_info->si_code ) { -#ifndef BOOST_TEST_LIMITED_SIGNAL_DETAILS - case POLL_IN: - report_error( execution_exception::system_error, - "data input available; band event %d", - (int)m_sig_info->si_band ); - break; - case POLL_OUT: - report_error( execution_exception::system_error, - "output buffers available; band event %d", - (int)m_sig_info->si_band ); - break; - case POLL_MSG: - report_error( execution_exception::system_error, - "input message available; band event %d", - (int)m_sig_info->si_band ); - break; - case POLL_ERR: - report_error( execution_exception::system_error, - "i/o error; band event %d", - (int)m_sig_info->si_band ); - break; - case POLL_PRI: - report_error( execution_exception::system_error, - "high priority input available; band event %d", - (int)m_sig_info->si_band ); - break; -#if defined(POLL_ERR) && defined(POLL_HUP) && (POLL_ERR - POLL_HUP) - case POLL_HUP: - report_error( execution_exception::system_error, - "device disconnected; band event %d", - (int)m_sig_info->si_band ); - break; -#endif -#endif - default: - report_error( execution_exception::system_error, - "signal: SIGPOLL, si_code: %d (asynchronous I/O event occurred; band event %d)", - (int)m_sig_info->si_band, m_sig_info->si_code ); - break; - } - break; - -#endif - - case SIGABRT: - report_error( execution_exception::system_error, - "signal: SIGABRT (application abort requested)" ); - break; - - case SIGALRM: - report_error( execution_exception::timeout_error, - "signal: SIGALRM (timeout while executing function)" ); - break; - - default: - report_error( execution_exception::system_error, - "unrecognized signal %d", m_sig_info->si_signo ); - } -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** boost::detail::signal_action ************** // -// ************************************************************************** // - -// Forward declaration -extern "C" { -static void boost_execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context ); -static void boost_execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context ); -} - -class signal_action { - typedef struct sigaction* sigaction_ptr; -public: - //Constructor - signal_action(); - signal_action( int sig, bool install, bool attach_dbg, char* alt_stack ); - ~signal_action(); - -private: - // Data members - int m_sig; - bool m_installed; - struct sigaction m_new_action; - struct sigaction m_old_action; -}; - -//____________________________________________________________________________// - -signal_action::signal_action() -: m_installed( false ) -{} - -//____________________________________________________________________________// - -signal_action::signal_action( int sig, bool install, bool attach_dbg, char* alt_stack ) -: m_sig( sig ) -, m_installed( install ) -{ - if( !install ) - return; - - std::memset( &m_new_action, 0, sizeof(struct sigaction) ); - - BOOST_TEST_SYS_ASSERT( ::sigaction( m_sig , sigaction_ptr(), &m_new_action ) != -1 ); - - if( m_new_action.sa_sigaction || m_new_action.sa_handler ) { - m_installed = false; - return; - } - - m_new_action.sa_flags |= SA_SIGINFO; - m_new_action.sa_sigaction = attach_dbg ? &boost_execution_monitor_attaching_signal_handler - : &boost_execution_monitor_jumping_signal_handler; - BOOST_TEST_SYS_ASSERT( sigemptyset( &m_new_action.sa_mask ) != -1 ); - -#ifdef BOOST_TEST_USE_ALT_STACK - if( alt_stack ) - m_new_action.sa_flags |= SA_ONSTACK; -#endif - - BOOST_TEST_SYS_ASSERT( ::sigaction( m_sig, &m_new_action, &m_old_action ) != -1 ); -} - -//____________________________________________________________________________// - -signal_action::~signal_action() -{ - if( m_installed ) - ::sigaction( m_sig, &m_old_action , sigaction_ptr() ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** boost::detail::signal_handler ************** // -// ************************************************************************** // - -class signal_handler { -public: - // Constructor - explicit signal_handler( bool catch_system_errors, bool detect_fpe, unsigned timeout, bool attach_dbg, char* alt_stack ); - - // Destructor - ~signal_handler(); - - // access methods - static sigjmp_buf& jump_buffer() - { - assert( !!s_active_handler ); - - return s_active_handler->m_sigjmp_buf; - } - - static system_signal_exception& sys_sig() - { - assert( !!s_active_handler ); - - return s_active_handler->m_sys_sig; - } - -private: - // Data members - signal_handler* m_prev_handler; - unsigned m_timeout; - - // Note: We intentionality do not catch SIGCHLD. Users have to deal with it themselves - signal_action m_ILL_action; - signal_action m_FPE_action; - signal_action m_SEGV_action; - signal_action m_BUS_action; - signal_action m_CHLD_action; - signal_action m_POLL_action; - signal_action m_ABRT_action; - signal_action m_ALRM_action; - - sigjmp_buf m_sigjmp_buf; - system_signal_exception m_sys_sig; - - static signal_handler* s_active_handler; -}; - -// !! need to be placed in thread specific storage -typedef signal_handler* signal_handler_ptr; -signal_handler* signal_handler::s_active_handler = signal_handler_ptr(); - -//____________________________________________________________________________// - -signal_handler::signal_handler( bool catch_system_errors, bool detect_fpe, unsigned timeout, bool attach_dbg, char* alt_stack ) -: m_prev_handler( s_active_handler ) -, m_timeout( timeout ) -, m_ILL_action ( SIGILL , catch_system_errors, attach_dbg, alt_stack ) -, m_FPE_action ( SIGFPE , detect_fpe , attach_dbg, alt_stack ) -, m_SEGV_action( SIGSEGV, catch_system_errors, attach_dbg, alt_stack ) -, m_BUS_action ( SIGBUS , catch_system_errors, attach_dbg, alt_stack ) -#ifdef BOOST_TEST_CATCH_SIGPOLL -, m_POLL_action( SIGPOLL, catch_system_errors, attach_dbg, alt_stack ) -#endif -, m_ABRT_action( SIGABRT, catch_system_errors, attach_dbg, alt_stack ) -, m_ALRM_action( SIGALRM, timeout > 0 , attach_dbg, alt_stack ) -{ - s_active_handler = this; - - if( m_timeout > 0 ) { - ::alarm( 0 ); - ::alarm( timeout ); - } - -#ifdef BOOST_TEST_USE_ALT_STACK - if( alt_stack ) { - stack_t sigstk; - std::memset( &sigstk, 0, sizeof(stack_t) ); - - BOOST_TEST_SYS_ASSERT( ::sigaltstack( 0, &sigstk ) != -1 ); - - if( sigstk.ss_flags & SS_DISABLE ) { - sigstk.ss_sp = alt_stack; - sigstk.ss_size = BOOST_TEST_ALT_STACK_SIZE; - sigstk.ss_flags = 0; - BOOST_TEST_SYS_ASSERT( ::sigaltstack( &sigstk, 0 ) != -1 ); - } - } -#endif -} - -//____________________________________________________________________________// - -signal_handler::~signal_handler() -{ - assert( s_active_handler == this ); - - if( m_timeout > 0 ) - ::alarm( 0 ); - -#ifdef BOOST_TEST_USE_ALT_STACK -#ifdef __GNUC__ - // We shouldn't need to explicitly initialize all the members here, - // but gcc warns if we don't, so add initializers for each of the - // members specified in the POSIX std: - stack_t sigstk = { 0, 0, 0 }; -#else - stack_t sigstk = { }; -#endif - - sigstk.ss_size = MINSIGSTKSZ; - sigstk.ss_flags = SS_DISABLE; - if( ::sigaltstack( &sigstk, 0 ) == -1 ) { - int error_n = errno; - std::cerr << "******** errors disabling the alternate stack:" << std::endl - << "\t#error:" << error_n << std::endl - << "\t" << std::strerror( error_n ) << std::endl; - } -#endif - - s_active_handler = m_prev_handler; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** execution_monitor_signal_handler ************** // -// ************************************************************************** // - -extern "C" { - -static void boost_execution_monitor_jumping_signal_handler( int sig, siginfo_t* info, void* context ) -{ - signal_handler::sys_sig()( info, context ); - - siglongjmp( signal_handler::jump_buffer(), sig ); -} - -//____________________________________________________________________________// - -static void boost_execution_monitor_attaching_signal_handler( int sig, siginfo_t* info, void* context ) -{ - if( !debug::attach_debugger( false ) ) - boost_execution_monitor_jumping_signal_handler( sig, info, context ); - - // debugger attached; it will handle the signal - BOOST_TEST_SYS_ASSERT( ::signal( sig, SIG_DFL ) != SIG_ERR ); -} - -//____________________________________________________________________________// - -} - -} // namespace detail - -// ************************************************************************** // -// ************** execution_monitor::catch_signals ************** // -// ************************************************************************** // - -int -execution_monitor::catch_signals( boost::function const& F ) -{ - using namespace detail; - -#if defined(__CYGWIN__) - p_catch_system_errors.value = false; -#endif - -#ifdef BOOST_TEST_USE_ALT_STACK - if( !!p_use_alt_stack && !m_alt_stack ) - m_alt_stack.reset( new char[BOOST_TEST_ALT_STACK_SIZE] ); -#else - p_use_alt_stack.value = false; -#endif - - signal_handler local_signal_handler( p_catch_system_errors, - p_catch_system_errors || (p_detect_fp_exceptions != fpe::BOOST_FPE_OFF), - p_timeout, - p_auto_start_dbg, - !p_use_alt_stack ? 0 : m_alt_stack.get() ); - - if( !sigsetjmp( signal_handler::jump_buffer(), 1 ) ) - return detail::do_invoke( m_custom_translators , F ); - else - BOOST_TEST_I_THROW( local_signal_handler.sys_sig() ); -} - -//____________________________________________________________________________// - -#elif defined(BOOST_SEH_BASED_SIGNAL_HANDLING) - -// ************************************************************************** // -// ************** Microsoft structured exception handling ************** // -// ************************************************************************** // - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564)) -namespace { void _set_se_translator( void* ) {} } -#endif - -namespace detail { - -// ************************************************************************** // -// ************** boost::detail::system_signal_exception ************** // -// ************************************************************************** // - -class system_signal_exception { -public: - // Constructor - explicit system_signal_exception( execution_monitor* em ) - : m_em( em ) - , m_se_id( 0 ) - , m_fault_address( 0 ) - , m_dir( false ) - {} - - void report() const; - int operator()( unsigned id, _EXCEPTION_POINTERS* exps ); - -private: - // Data members - execution_monitor* m_em; - - unsigned m_se_id; - void* m_fault_address; - bool m_dir; -}; - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) -static void -seh_catch_preventer( unsigned /* id */, _EXCEPTION_POINTERS* /* exps */ ) -{ - throw; -} -#endif - -//____________________________________________________________________________// - -int -system_signal_exception::operator()( unsigned id, _EXCEPTION_POINTERS* exps ) -{ - const unsigned MSFT_CPP_EXCEPT = 0xE06d7363; // EMSC - - // C++ exception - allow to go through - if( id == MSFT_CPP_EXCEPT ) - return EXCEPTION_CONTINUE_SEARCH; - - // FPE detection is enabled, while system exception detection is not - check if this is actually FPE - if( !m_em->p_catch_system_errors ) { - if( !m_em->p_detect_fp_exceptions ) - return EXCEPTION_CONTINUE_SEARCH; - - switch( id ) { - case EXCEPTION_FLT_DIVIDE_BY_ZERO: - case EXCEPTION_FLT_STACK_CHECK: - case EXCEPTION_FLT_DENORMAL_OPERAND: - case EXCEPTION_FLT_INEXACT_RESULT: - case EXCEPTION_FLT_OVERFLOW: - case EXCEPTION_FLT_UNDERFLOW: - case EXCEPTION_FLT_INVALID_OPERATION: - case STATUS_FLOAT_MULTIPLE_FAULTS: - case STATUS_FLOAT_MULTIPLE_TRAPS: - break; - default: - return EXCEPTION_CONTINUE_SEARCH; - } - } - - if( !!m_em->p_auto_start_dbg && debug::attach_debugger( false ) ) { - m_em->p_catch_system_errors.value = false; -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) - _set_se_translator( &seh_catch_preventer ); -#endif - return EXCEPTION_CONTINUE_EXECUTION; - } - - m_se_id = id; - if( m_se_id == EXCEPTION_ACCESS_VIOLATION && exps->ExceptionRecord->NumberParameters == 2 ) { - m_fault_address = (void*)exps->ExceptionRecord->ExceptionInformation[1]; - m_dir = exps->ExceptionRecord->ExceptionInformation[0] == 0; - } - - return EXCEPTION_EXECUTE_HANDLER; -} - -//____________________________________________________________________________// - -void -system_signal_exception::report() const -{ - switch( m_se_id ) { - // cases classified as system_fatal_error - case EXCEPTION_ACCESS_VIOLATION: { - if( !m_fault_address ) - detail::report_error( execution_exception::system_fatal_error, "memory access violation" ); - else - detail::report_error( - execution_exception::system_fatal_error, - "memory access violation occurred at address 0x%08lx, while attempting to %s", - m_fault_address, - m_dir ? " read inaccessible data" - : " write to an inaccessible (or protected) address" - ); - break; - } - - case EXCEPTION_ILLEGAL_INSTRUCTION: - detail::report_error( execution_exception::system_fatal_error, "illegal instruction" ); - break; - - case EXCEPTION_PRIV_INSTRUCTION: - detail::report_error( execution_exception::system_fatal_error, "tried to execute an instruction whose operation is not allowed in the current machine mode" ); - break; - - case EXCEPTION_IN_PAGE_ERROR: - detail::report_error( execution_exception::system_fatal_error, "access to a memory page that is not present" ); - break; - - case EXCEPTION_STACK_OVERFLOW: - detail::report_error( execution_exception::system_fatal_error, "stack overflow" ); - break; - - case EXCEPTION_NONCONTINUABLE_EXCEPTION: - detail::report_error( execution_exception::system_fatal_error, "tried to continue execution after a non continuable exception occurred" ); - break; - - // cases classified as (non-fatal) system_trap - case EXCEPTION_DATATYPE_MISALIGNMENT: - detail::report_error( execution_exception::system_error, "data misalignment" ); - break; - - case EXCEPTION_INT_DIVIDE_BY_ZERO: - detail::report_error( execution_exception::system_error, "integer divide by zero" ); - break; - - case EXCEPTION_INT_OVERFLOW: - detail::report_error( execution_exception::system_error, "integer overflow" ); - break; - - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - detail::report_error( execution_exception::system_error, "array bounds exceeded" ); - break; - - case EXCEPTION_FLT_DIVIDE_BY_ZERO: - detail::report_error( execution_exception::system_error, "floating point divide by zero" ); - break; - - case EXCEPTION_FLT_STACK_CHECK: - detail::report_error( execution_exception::system_error, - "stack overflowed or underflowed as the result of a floating-point operation" ); - break; - - case EXCEPTION_FLT_DENORMAL_OPERAND: - detail::report_error( execution_exception::system_error, - "operand of floating point operation is denormal" ); - break; - - case EXCEPTION_FLT_INEXACT_RESULT: - detail::report_error( execution_exception::system_error, - "result of a floating-point operation cannot be represented exactly" ); - break; - - case EXCEPTION_FLT_OVERFLOW: - detail::report_error( execution_exception::system_error, - "exponent of a floating-point operation is greater than the magnitude allowed by the corresponding type" ); - break; - - case EXCEPTION_FLT_UNDERFLOW: - detail::report_error( execution_exception::system_error, - "exponent of a floating-point operation is less than the magnitude allowed by the corresponding type" ); - break; - - case EXCEPTION_FLT_INVALID_OPERATION: - detail::report_error( execution_exception::system_error, "floating point error" ); - break; - - case STATUS_FLOAT_MULTIPLE_FAULTS: - detail::report_error( execution_exception::system_error, "multiple floating point errors" ); - break; - - case STATUS_FLOAT_MULTIPLE_TRAPS: - detail::report_error( execution_exception::system_error, "multiple floating point errors" ); - break; - - case EXCEPTION_BREAKPOINT: - detail::report_error( execution_exception::system_error, "breakpoint encountered" ); - break; - - default: - detail::report_error( execution_exception::system_error, "unrecognized exception. Id: 0x%08lx", m_se_id ); - break; - } -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** assert_reporting_function ************** // -// ************************************************************************** // - -int BOOST_TEST_CALL_DECL -assert_reporting_function( int reportType, char* userMessage, int* ) -{ - // write this way instead of switch to avoid unreachable statements - if( reportType == BOOST_TEST_CRT_ASSERT || reportType == BOOST_TEST_CRT_ERROR ) - detail::report_error( reportType == BOOST_TEST_CRT_ASSERT ? execution_exception::user_error : execution_exception::system_error, userMessage ); - - return 0; -} // assert_reporting_function - -//____________________________________________________________________________// - -void BOOST_TEST_CALL_DECL -invalid_param_handler( wchar_t const* /* expr */, - wchar_t const* /* func */, - wchar_t const* /* file */, - unsigned /* line */, - uintptr_t /* reserved */) -{ - detail::report_error( execution_exception::user_error, - "Invalid parameter detected by C runtime library" ); -} - -//____________________________________________________________________________// - -} // namespace detail - -// ************************************************************************** // -// ************** execution_monitor::catch_signals ************** // -// ************************************************************************** // - -int -execution_monitor::catch_signals( boost::function const& F ) -{ - _invalid_parameter_handler old_iph = _invalid_parameter_handler(); - BOOST_TEST_CRT_HOOK_TYPE old_crt_hook = 0; - - if( p_catch_system_errors ) { - old_crt_hook = BOOST_TEST_CRT_SET_HOOK( &detail::assert_reporting_function ); - - old_iph = _set_invalid_parameter_handler( - reinterpret_cast<_invalid_parameter_handler>( &detail::invalid_param_handler ) ); - } else if( !p_detect_fp_exceptions ) { -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) - _set_se_translator( &detail::seh_catch_preventer ); -#endif - } - - detail::system_signal_exception SSE( this ); - - int ret_val = 0; - // clang windows workaround: this not available in __finally scope - bool l_catch_system_errors = p_catch_system_errors; - - __try { - __try { - ret_val = detail::do_invoke( m_custom_translators, F ); - } - __except( SSE( GetExceptionCode(), GetExceptionInformation() ) ) { - throw SSE; - } - } - __finally { - if( l_catch_system_errors ) { - BOOST_TEST_CRT_SET_HOOK( old_crt_hook ); - - _set_invalid_parameter_handler( old_iph ); - } - } - - return ret_val; -} - -//____________________________________________________________________________// - -#else // default signal handler - -namespace detail { - -class system_signal_exception { -public: - void report() const {} -}; - -} // namespace detail - -int -execution_monitor::catch_signals( boost::function const& F ) -{ - return detail::do_invoke( m_custom_translators , F ); -} - -//____________________________________________________________________________// - -#endif // choose signal handler - -// ************************************************************************** // -// ************** execution_monitor ************** // -// ************************************************************************** // - -execution_monitor::execution_monitor() -: p_catch_system_errors( true ) -, p_auto_start_dbg( false ) -, p_timeout( 0 ) -, p_use_alt_stack( true ) -, p_detect_fp_exceptions( fpe::BOOST_FPE_OFF ) -{} - -//____________________________________________________________________________// - -int -execution_monitor::execute( boost::function const& F ) -{ - if( debug::under_debugger() ) - p_catch_system_errors.value = false; - - BOOST_TEST_I_TRY { - detail::fpe_except_guard G( p_detect_fp_exceptions ); - unit_test::ut_detail::ignore_unused_variable_warning( G ); - - return catch_signals( F ); - } - -#ifndef BOOST_NO_EXCEPTIONS - - // Catch-clause reference arguments are a bit different from function - // arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't - // required. Programmers ask for const anyhow, so we supply it. That's - // easier than answering questions about non-const usage. - - catch( char const* ex ) - { detail::report_error( execution_exception::cpp_exception_error, - "C string: %s", ex ); } - catch( std::string const& ex ) - { detail::report_error( execution_exception::cpp_exception_error, - "std::string: %s", ex.c_str() ); } - - // std:: exceptions -#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI) -#define CATCH_AND_REPORT_STD_EXCEPTION( ex_name ) \ - catch( ex_name const& ex ) \ - { detail::report_error( execution_exception::cpp_exception_error, \ - current_exception_cast(), \ - #ex_name ": %s", ex.what() ); } \ -/**/ -#else -#define CATCH_AND_REPORT_STD_EXCEPTION( ex_name ) \ - catch( ex_name const& ex ) \ - { detail::report_error( execution_exception::cpp_exception_error, \ - current_exception_cast(), \ - "%s: %s", detail::typeid_name(ex).c_str(), ex.what() ); } \ -/**/ -#endif - - CATCH_AND_REPORT_STD_EXCEPTION( std::bad_alloc ) - -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x0551) - CATCH_AND_REPORT_STD_EXCEPTION( std::bad_cast ) - CATCH_AND_REPORT_STD_EXCEPTION( std::bad_typeid ) -#else - CATCH_AND_REPORT_STD_EXCEPTION( std::bad_cast ) - CATCH_AND_REPORT_STD_EXCEPTION( std::bad_typeid ) -#endif - - CATCH_AND_REPORT_STD_EXCEPTION( std::bad_exception ) - CATCH_AND_REPORT_STD_EXCEPTION( std::domain_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::invalid_argument ) - CATCH_AND_REPORT_STD_EXCEPTION( std::length_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::out_of_range ) - CATCH_AND_REPORT_STD_EXCEPTION( std::range_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::overflow_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::underflow_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::logic_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::runtime_error ) - CATCH_AND_REPORT_STD_EXCEPTION( std::exception ) -#undef CATCH_AND_REPORT_STD_EXCEPTION - - catch( boost::exception const& ex ) - { detail::report_error( execution_exception::cpp_exception_error, - &ex, -#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI) - "unknown boost::exception" ); } -#else - typeid(ex).name() ); } -#endif - - // system errors - catch( system_error const& ex ) - { detail::report_error( execution_exception::cpp_exception_error, - "system_error produced by: %s: %s", ex.p_failed_exp, std::strerror( ex.p_errno ) ); } - catch( detail::system_signal_exception const& ex ) - { ex.report(); } - - // not an error - catch( execution_aborted const& ) - { return 0; } - - // just forward - catch( execution_exception const& ) - { throw; } - - // unknown error - catch( ... ) - { detail::report_error( execution_exception::cpp_exception_error, "unknown type" ); } - -#endif // !BOOST_NO_EXCEPTIONS - - return 0; // never reached; supplied to quiet compiler warnings -} // execute - -//____________________________________________________________________________// - -namespace detail { - -struct forward { - explicit forward( boost::function const& F ) : m_F( F ) {} - - int operator()() { m_F(); return 0; } - - boost::function const& m_F; -}; - -} // namespace detail -void -execution_monitor::vexecute( boost::function const& F ) -{ - execute( detail::forward( F ) ); -} - -// ************************************************************************** // -// ************** system_error ************** // -// ************************************************************************** // - -system_error::system_error( char const* exp ) -#ifdef UNDER_CE -: p_errno( GetLastError() ) -#else -: p_errno( errno ) -#endif -, p_failed_exp( exp ) -{} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** execution_exception ************** // -// ************************************************************************** // - -execution_exception::execution_exception( error_code ec_, const_string what_msg_, location const& location_ ) -: m_error_code( ec_ ) -, m_what( what_msg_.empty() ? BOOST_TEST_L( "uncaught exception, system error or abort requested" ) : what_msg_ ) -, m_location( location_ ) -{} - -//____________________________________________________________________________// - -execution_exception::location::location( char const* file_name, size_t line_num, char const* func ) -: m_file_name( file_name ? file_name : "unknown location" ) -, m_line_num( line_num ) -, m_function( func ) -{} - -execution_exception::location::location(const_string file_name, size_t line_num, char const* func ) -: m_file_name( file_name ) -, m_line_num( line_num ) -, m_function( func ) -{} - -//____________________________________________________________________________// - -// ************************************************************************** // -// **************Floating point exception management interface ************** // -// ************************************************************************** // - -namespace fpe { - -unsigned -enable( unsigned mask ) -{ - boost::ignore_unused(mask); -#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__) - _clearfp(); - -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) - unsigned old_cw = ::_controlfp( 0, 0 ); - ::_controlfp( old_cw & ~mask, BOOST_FPE_ALL ); -#else - unsigned old_cw; - if( ::_controlfp_s( &old_cw, 0, 0 ) != 0 ) - return BOOST_FPE_INV; - - // Set the control word - if( ::_controlfp_s( 0, old_cw & ~mask, BOOST_FPE_ALL ) != 0 ) - return BOOST_FPE_INV; -#endif - return ~old_cw & BOOST_FPE_ALL; - -#elif defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__) - // same macro definition as in execution_monitor.hpp - if (BOOST_FPE_ALL == BOOST_FPE_OFF) - /* Not Implemented */ - return BOOST_FPE_OFF; - feclearexcept(BOOST_FPE_ALL); - int res = feenableexcept( mask ); - return res == -1 ? (unsigned)BOOST_FPE_INV : (unsigned)res; -#else - /* Not Implemented */ - return BOOST_FPE_OFF; -#endif -} - -//____________________________________________________________________________// - -unsigned -disable( unsigned mask ) -{ - boost::ignore_unused(mask); - -#if defined(BOOST_TEST_FPE_SUPPORT_WITH_SEH__) - _clearfp(); -#if BOOST_WORKAROUND( BOOST_MSVC, <= 1310) - unsigned old_cw = ::_controlfp( 0, 0 ); - ::_controlfp( old_cw | mask, BOOST_FPE_ALL ); -#else - unsigned old_cw; - if( ::_controlfp_s( &old_cw, 0, 0 ) != 0 ) - return BOOST_FPE_INV; - - // Set the control word - if( ::_controlfp_s( 0, old_cw | mask, BOOST_FPE_ALL ) != 0 ) - return BOOST_FPE_INV; -#endif - return ~old_cw & BOOST_FPE_ALL; - -#elif defined(BOOST_TEST_FPE_SUPPORT_WITH_GLIBC_EXTENSIONS__) - if (BOOST_FPE_ALL == BOOST_FPE_OFF) - /* Not Implemented */ - return BOOST_FPE_INV; - feclearexcept(BOOST_FPE_ALL); - int res = fedisableexcept( mask ); - return res == -1 ? (unsigned)BOOST_FPE_INV : (unsigned)res; -#else - /* Not Implemented */ - return BOOST_FPE_INV; -#endif -} - -//____________________________________________________________________________// - -} // namespace fpe - -} // namespace boost - -#include - -#endif // BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/framework.ipp b/libraries/boost/include/boost/test/impl/framework.ipp deleted file mode 100644 index 496e7de859..0000000000 --- a/libraries/boost/include/boost/test/impl/framework.ipp +++ /dev/null @@ -1,1713 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements framework API - main driver for the test -// *************************************************************************** - -#ifndef BOOST_TEST_FRAMEWORK_IPP_021005GER -#define BOOST_TEST_FRAMEWORK_IPP_021005GER - -// Boost.Test -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#if BOOST_TEST_SUPPORT_TOKEN_ITERATOR -#include -#endif - -#include -#include -#include - -#include -#include - -// Boost -#include -#include - -// STL -#include -#include -#include -#include -#include -#include -#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE -#include -#endif - -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::time; using ::srand; } -#endif - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace framework { - -namespace impl { - -// ************************************************************************** // -// ************** order detection helpers ************** // -// ************************************************************************** // - -struct order_info { - order_info() : depth(-1) {} - - int depth; - std::vector dependant_siblings; -}; - -typedef std::set tu_id_set; -typedef std::map order_info_per_tu; // !! ?? unordered map - -//____________________________________________________________________________// - -static test_unit_id -get_tu_parent( test_unit_id tu_id ) -{ - return framework::get( tu_id, TUT_ANY ).p_parent_id; -} - -//____________________________________________________________________________// - -static int -tu_depth( test_unit_id tu_id, test_unit_id master_tu_id, order_info_per_tu& tuoi ) -{ - if( tu_id == master_tu_id ) - return 0; - - order_info& info = tuoi[tu_id]; - - if( info.depth == -1 ) - info.depth = tu_depth( get_tu_parent( tu_id ), master_tu_id, tuoi ) + 1; - - return info.depth; -} - -//____________________________________________________________________________// - -static void -collect_dependant_siblings( test_unit_id from, test_unit_id to, test_unit_id master_tu_id, order_info_per_tu& tuoi ) -{ - int from_depth = tu_depth( from, master_tu_id, tuoi ); - int to_depth = tu_depth( to, master_tu_id, tuoi ); - - while(from_depth > to_depth) { - from = get_tu_parent( from ); - --from_depth; - } - - while(from_depth < to_depth) { - to = get_tu_parent( to ); - --to_depth; - } - - while(true) { - test_unit_id from_parent = get_tu_parent( from ); - test_unit_id to_parent = get_tu_parent( to ); - if( from_parent == to_parent ) - break; - from = from_parent; - to = to_parent; - } - - tuoi[from].dependant_siblings.push_back( to ); -} - -//____________________________________________________________________________// - -static counter_t -assign_sibling_rank( test_unit_id tu_id, order_info_per_tu& tuoi ) -{ - test_unit& tu = framework::get( tu_id, TUT_ANY ); - - BOOST_TEST_SETUP_ASSERT( tu.p_sibling_rank != (std::numeric_limits::max)(), - "Cyclic dependency detected involving test unit \"" + tu.full_name() + "\"" ); - - if( tu.p_sibling_rank != 0 ) - return tu.p_sibling_rank; - - order_info const& info = tuoi[tu_id]; - - // indicate in progress - tu.p_sibling_rank.value = (std::numeric_limits::max)(); - - counter_t new_rank = 1; - BOOST_TEST_FOREACH( test_unit_id, sibling_id, info.dependant_siblings ) - new_rank = (std::max)(new_rank, assign_sibling_rank( sibling_id, tuoi ) + 1); - - return tu.p_sibling_rank.value = new_rank; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** test_init call wrapper ************** // -// ************************************************************************** // - -static void -invoke_init_func( init_unit_test_func init_func ) -{ -#ifdef BOOST_TEST_ALTERNATIVE_INIT_API - BOOST_TEST_I_ASSRT( (*init_func)(), std::runtime_error( "test module initialization failed" ) ); -#else - test_suite* manual_test_units = (*init_func)( framework::master_test_suite().argc, framework::master_test_suite().argv ); - - if( manual_test_units ) - framework::master_test_suite().add( manual_test_units ); -#endif -} - -// ************************************************************************** // -// ************** name_filter ************** // -// ************************************************************************** // - -class name_filter : public test_tree_visitor { - struct component { - component( const_string name ) // has to be implicit - { - if( name == "*" ) - m_kind = SFK_ALL; - else if( first_char( name ) == '*' && last_char( name ) == '*' ) { - m_kind = SFK_SUBSTR; - m_name = name.substr( 1, name.size()-1 ); - } - else if( first_char( name ) == '*' ) { - m_kind = SFK_TRAILING; - m_name = name.substr( 1 ); - } - else if( last_char( name ) == '*' ) { - m_kind = SFK_LEADING; - m_name = name.substr( 0, name.size()-1 ); - } - else { - m_kind = SFK_MATCH; - m_name = name; - } - } - - bool pass( test_unit const& tu ) const - { - const_string name( tu.p_name ); - - switch( m_kind ) { - default: - case SFK_ALL: - return true; - case SFK_LEADING: - return name.substr( 0, m_name.size() ) == m_name; - case SFK_TRAILING: - return name.size() >= m_name.size() && name.substr( name.size() - m_name.size() ) == m_name; - case SFK_SUBSTR: - return name.find( m_name ) != const_string::npos; - case SFK_MATCH: - return m_name == tu.p_name.get(); - } - } - enum kind { SFK_ALL, SFK_LEADING, SFK_TRAILING, SFK_SUBSTR, SFK_MATCH }; - - kind m_kind; - const_string m_name; - }; - -public: - // Constructor - name_filter( test_unit_id_list& targ_list, const_string filter_expr ) : m_targ_list( targ_list ), m_depth( 0 ) - { -#ifdef BOOST_TEST_SUPPORT_TOKEN_ITERATOR - utils::string_token_iterator tit( filter_expr, (utils::dropped_delimeters = "/", - utils::kept_delimeters = utils::dt_none) ); - - while( tit != utils::string_token_iterator() ) { - m_components.push_back( - std::vector( utils::string_token_iterator( *tit, (utils::dropped_delimeters = ",", - utils::kept_delimeters = utils::dt_none) ), - utils::string_token_iterator() ) ); - - ++tit; - } -#endif - } - -private: - bool filter_unit( test_unit const& tu ) - { - // skip master test suite - if( m_depth == 0 ) - return true; - - // corresponding name filters are at level m_depth-1 - std::vector const& filters = m_components[m_depth-1]; - - // look for match - using namespace boost::placeholders; - return std::find_if( filters.begin(), filters.end(), bind( &component::pass, _1, boost::ref(tu) ) ) != filters.end(); - } - - // test_tree_visitor interface - virtual void visit( test_case const& tc ) - { - // make sure we only accept test cases if we match last component of the filter - if( m_depth == m_components.size() && filter_unit( tc ) ) - m_targ_list.push_back( tc.p_id ); // found a test case - } - virtual bool test_suite_start( test_suite const& ts ) - { - if( !filter_unit( ts ) ) - return false; - - if( m_depth < m_components.size() ) { - ++m_depth; - return true; - } - - m_targ_list.push_back( ts.p_id ); // found a test suite - - return false; - } - virtual void test_suite_finish( test_suite const& /*ts*/ ) - { - --m_depth; - } - - // Data members - typedef std::vector > components_per_level; - - components_per_level m_components; - test_unit_id_list& m_targ_list; - unsigned m_depth; -}; - -// ************************************************************************** // -// ************** label_filter ************** // -// ************************************************************************** // - -class label_filter : public test_tree_visitor { -public: - label_filter( test_unit_id_list& targ_list, const_string label ) - : m_targ_list( targ_list ) - , m_label( label ) - {} - -private: - // test_tree_visitor interface - virtual bool visit( test_unit const& tu ) - { - if( tu.has_label( m_label ) ) { - // found a test unit; add it to list of tu to enable with children and stop recursion in case of suites - m_targ_list.push_back( tu.p_id ); - return false; - } - - return true; - } - - // Data members - test_unit_id_list& m_targ_list; - const_string m_label; -}; - -// ************************************************************************** // -// ************** set_run_status ************** // -// ************************************************************************** // - -class set_run_status : public test_tree_visitor { -public: - explicit set_run_status( test_unit::run_status rs, test_unit_id_list* dep_collector = 0 ) - : m_new_status( rs ) - , m_dep_collector( dep_collector ) - {} - - // test_tree_visitor interface - virtual bool visit( test_unit const& tu ) - { - const_cast(tu).p_run_status.value = m_new_status == test_unit::RS_INVALID ? tu.p_default_status : m_new_status; - if( m_dep_collector ) { - BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) { - test_unit const& dep = framework::get( dep_id, TUT_ANY ); - - if( dep.p_run_status == tu.p_run_status ) - continue; - - BOOST_TEST_FRAMEWORK_MESSAGE( "Including test " << dep.p_type_name << ' ' << dep.full_name() << - " as a dependency of test " << tu.p_type_name << ' ' << tu.full_name() ); - - m_dep_collector->push_back( dep_id ); - } - } - return true; - } - -private: - // Data members - test_unit::run_status m_new_status; - test_unit_id_list* m_dep_collector; -}; - -// ************************************************************************** // -// ************** parse_filters ************** // -// ************************************************************************** // - -static void -add_filtered_test_units( test_unit_id master_tu_id, const_string filter, test_unit_id_list& targ ) -{ - // Choose between two kinds of filters - if( filter[0] == '@' ) { - filter.trim_left( 1 ); - label_filter lf( targ, filter ); - traverse_test_tree( master_tu_id, lf, true ); - } - else { - name_filter nf( targ, filter ); - traverse_test_tree( master_tu_id, nf, true ); - } -} - -//____________________________________________________________________________// - -static bool -parse_filters( test_unit_id master_tu_id, test_unit_id_list& tu_to_enable, test_unit_id_list& tu_to_disable ) -{ - // 10. collect tu to enable and disable based on filters - bool had_selector_filter = false; - - std::vector const& filters = runtime_config::get >( runtime_config::btrt_run_filters ); - - BOOST_TEST_FOREACH( const_string, filter, filters ) { - BOOST_TEST_SETUP_ASSERT( !filter.is_empty(), "Invalid filter specification" ); - - // each --run_test command may also be separated by a ':' (environment variable) - utils::string_token_iterator t_filter_it( filter, (utils::dropped_delimeters = ":", - utils::kept_delimeters = utils::dt_none) ); - - while( t_filter_it != utils::string_token_iterator() ) { - const_string filter_token = *t_filter_it; - - enum { SELECTOR, ENABLER, DISABLER } filter_type = SELECTOR; - - // 11. Deduce filter type - if( filter_token[0] == '!' || filter_token[0] == '+' ) { - filter_type = filter_token[0] == '+' ? ENABLER : DISABLER; - filter_token.trim_left( 1 ); - BOOST_TEST_SETUP_ASSERT( !filter_token.is_empty(), "Invalid filter specification" ); - } - - had_selector_filter |= filter_type == SELECTOR; - - // 12. Add test units to corresponding list - switch( filter_type ) { - case SELECTOR: - case ENABLER: add_filtered_test_units( master_tu_id, filter_token, tu_to_enable ); break; - case DISABLER: add_filtered_test_units( master_tu_id, filter_token, tu_to_disable ); break; - } - - ++t_filter_it; - } - } - - return had_selector_filter; -} - -//____________________________________________________________________________// - -#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE - -// a poor man's implementation of random_shuffle -template< class RandomIt, class RandomFunc > -void random_shuffle( RandomIt first, RandomIt last, RandomFunc &r ) -{ - typedef typename std::iterator_traits::difference_type difference_type; - difference_type n = last - first; - for (difference_type i = n-1; i > 0; --i) { - difference_type j = r(i+1); - if (j != i) { - using std::swap; - swap(first[i], first[j]); - } - } -} - -#endif - - -// A simple handle for registering the global fixtures to the master test suite -// without deleting an existing static object (the global fixture itself) when the program -// terminates (shared_ptr). -class global_fixture_handle : public test_unit_fixture { -public: - global_fixture_handle(test_unit_fixture* fixture) : m_global_fixture(fixture) {} - ~global_fixture_handle() {} - - virtual void setup() { - m_global_fixture->setup(); - } - virtual void teardown() { - m_global_fixture->teardown(); - } - -private: - test_unit_fixture* m_global_fixture; -}; - - -} // namespace impl - -// ************************************************************************** // -// ************** framework::state ************** // -// ************************************************************************** // - -unsigned const TIMEOUT_EXCEEDED = static_cast( -1 ); - -class state { -public: - state() - : m_master_test_suite( 0 ) - , m_curr_test_unit( INV_TEST_UNIT_ID ) - , m_next_test_case_id( MIN_TEST_CASE_ID ) - , m_next_test_suite_id( MIN_TEST_SUITE_ID ) - , m_test_in_progress( false ) - , m_context_idx( 0 ) - , m_log_sinks( ) - , m_report_sink( std::cerr ) - { - } - - ~state() { clear(); } - - void clear() - { - while( !m_test_units.empty() ) { - test_unit_store::value_type const& tu = *m_test_units.begin(); - test_unit const* tu_ptr = tu.second; - - // the delete will erase this element from map - if( ut_detail::test_id_2_unit_type( tu.second->p_id ) == TUT_SUITE ) - delete static_cast(tu_ptr); - else - delete static_cast(tu_ptr); - } - } - - void set_tu_id( test_unit& tu, test_unit_id id ) { tu.p_id.value = id; } - - ////////////////////////////////////////////////////////////////// - - // Validates the dependency graph and deduces the sibling dependency rank for each child - void deduce_siblings_order( test_unit_id tu_id, test_unit_id master_tu_id, impl::order_info_per_tu& tuoi ) - { - test_unit& tu = framework::get( tu_id, TUT_ANY ); - - // collect all sibling dependancy from tu own list - BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) - collect_dependant_siblings( tu_id, dep_id, master_tu_id, tuoi ); - - if( tu.p_type != TUT_SUITE ) - return; - - test_suite& ts = static_cast(tu); - - // recursive call to children first - BOOST_TEST_FOREACH( test_unit_id, chld_id, ts.m_children ) - deduce_siblings_order( chld_id, master_tu_id, tuoi ); - - ts.m_ranked_children.clear(); - BOOST_TEST_FOREACH( test_unit_id, chld_id, ts.m_children ) { - counter_t rank = assign_sibling_rank( chld_id, tuoi ); - ts.m_ranked_children.insert( std::make_pair( rank, chld_id ) ); - } - } - - ////////////////////////////////////////////////////////////////// - - // Finalize default run status: - // 1) inherit run status from parent where applicable - // 2) if any of test units in test suite enabled enable it as well - bool finalize_default_run_status( test_unit_id tu_id, test_unit::run_status parent_status ) - { - test_unit& tu = framework::get( tu_id, TUT_ANY ); - - if( tu.p_default_status == test_suite::RS_INHERIT ) - tu.p_default_status.value = parent_status; - - // go through list of children - if( tu.p_type == TUT_SUITE ) { - bool has_enabled_child = false; - BOOST_TEST_FOREACH( test_unit_id, chld_id, static_cast(tu).m_children ) - has_enabled_child |= finalize_default_run_status( chld_id, tu.p_default_status ); - - tu.p_default_status.value = has_enabled_child ? test_suite::RS_ENABLED : test_suite::RS_DISABLED; - } - - return tu.p_default_status == test_suite::RS_ENABLED; - } - - ////////////////////////////////////////////////////////////////// - - bool finalize_run_status( test_unit_id tu_id ) - { - test_unit& tu = framework::get( tu_id, TUT_ANY ); - - // go through list of children - if( tu.p_type == TUT_SUITE ) { - bool has_enabled_child = false; - BOOST_TEST_FOREACH( test_unit_id, chld_id, static_cast(tu).m_children) - has_enabled_child |= finalize_run_status( chld_id ); - - tu.p_run_status.value = has_enabled_child ? test_suite::RS_ENABLED : test_suite::RS_DISABLED; - } - - return tu.is_enabled(); - } - - ////////////////////////////////////////////////////////////////// - - void deduce_run_status( test_unit_id master_tu_id ) - { - using namespace framework::impl; - test_unit_id_list tu_to_enable; - test_unit_id_list tu_to_disable; - - // 10. If there are any filters supplied, figure out lists of test units to enable/disable - bool had_selector_filter = !runtime_config::get >( runtime_config::btrt_run_filters ).empty() && - parse_filters( master_tu_id, tu_to_enable, tu_to_disable ); - - // 20. Set the stage: either use default run status or disable all test units - set_run_status initial_setter( had_selector_filter ? test_unit::RS_DISABLED : test_unit::RS_INVALID ); - traverse_test_tree( master_tu_id, initial_setter, true ); - - // 30. Apply all selectors and enablers. - while( !tu_to_enable.empty() ) { - test_unit& tu = framework::get( tu_to_enable.back(), TUT_ANY ); - - tu_to_enable.pop_back(); - - // 35. Ignore test units which are already enabled - if( tu.is_enabled() ) - continue; - - // set new status and add all dependencies into tu_to_enable - set_run_status enabler( test_unit::RS_ENABLED, &tu_to_enable ); - traverse_test_tree( tu.p_id, enabler, true ); - - // Add the dependencies of the parent suites, see trac #13149 - test_unit_id parent_id = tu.p_parent_id; - while( parent_id != INV_TEST_UNIT_ID - && parent_id != master_tu_id ) - { - // we do not use the traverse_test_tree as otherwise it would enable the sibblings and subtree - // of the test case we want to enable (we need to enable the parent suites and their dependencies only) - // the parent_id needs to be enabled in order to be properly parsed by finalize_run_status, the visit - // does the job - test_unit& tu_parent = framework::get( parent_id, TUT_ANY ); - enabler.visit( tu_parent ); - parent_id = tu_parent.p_parent_id; - } - } - - // 40. Apply all disablers - while( !tu_to_disable.empty() ) { - test_unit const& tu = framework::get( tu_to_disable.back(), TUT_ANY ); - - tu_to_disable.pop_back(); - - // 35. Ignore test units which already disabled - if( !tu.is_enabled() ) - continue; - - set_run_status disabler( test_unit::RS_DISABLED ); - traverse_test_tree( tu.p_id, disabler, true ); - } - - // 50. Make sure parents of enabled test units are also enabled - finalize_run_status( master_tu_id ); - } - - ////////////////////////////////////////////////////////////////// - - typedef unit_test_monitor_t::error_level execution_result; - - // Random generator using the std::rand function (seeded prior to the call) - struct random_generator_helper { - size_t operator()(size_t i) const { - return std::rand() % i; - } - }; - - // Executes the test tree with the root at specified test unit - execution_result execute_test_tree( test_unit_id tu_id, - unsigned timeout = 0, - random_generator_helper const * const p_random_generator = 0) - { - test_unit const& tu = framework::get( tu_id, TUT_ANY ); - - execution_result result = unit_test_monitor_t::test_ok; - - if( !tu.is_enabled() ) - return result; - - // 10. Check preconditions, including zero time left for execution and - // successful execution of all dependencies - if( timeout == TIMEOUT_EXCEEDED ) { - // notify all observers about skipped test unit - BOOST_TEST_FOREACH( test_observer*, to, m_observers ) - to->test_unit_skipped( tu, "timeout for the test unit is exceeded" ); - - return unit_test_monitor_t::os_timeout; - } - else if( timeout == 0 || timeout > tu.p_timeout ) // deduce timeout for this test unit - timeout = tu.p_timeout; - - test_tools::assertion_result const precondition_res = tu.check_preconditions(); - if( !precondition_res ) { - // notify all observers about skipped test unit - BOOST_TEST_FOREACH( test_observer*, to, m_observers ) - to->test_unit_skipped( tu, precondition_res.message() ); - - return unit_test_monitor_t::precondition_failure; - } - - // 20. Notify all observers about the start of the test unit - BOOST_TEST_FOREACH( test_observer*, to, m_observers ) - to->test_unit_start( tu ); - - // 30. Execute setup fixtures if any; any failure here leads to test unit abortion - BOOST_TEST_FOREACH( test_unit_fixture_ptr, F, tu.p_fixtures.get() ) { - ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tu.p_id); - result = unit_test_monitor.execute_and_translate( boost::bind( &test_unit_fixture::setup, F ) ); - if( result != unit_test_monitor_t::test_ok ) - break; - test_results const& test_rslt = unit_test::results_collector.results( m_curr_test_unit ); - if( test_rslt.aborted() ) { - result = unit_test_monitor_t::precondition_failure; - break; - } - } - - // This is the time we are going to spend executing the test unit - unsigned long elapsed = 0; - - if( result == unit_test_monitor_t::test_ok ) { - // 40. We are going to time the execution - boost::timer tu_timer; - - // we pass the random generator - const random_generator_helper& rand_gen = p_random_generator ? *p_random_generator : random_generator_helper(); - - if( tu.p_type == TUT_SUITE ) { - test_suite const& ts = static_cast( tu ); - - if( runtime_config::get( runtime_config::btrt_random_seed ) == 0 ) { - typedef std::pair value_type; - - BOOST_TEST_FOREACH( value_type, chld, ts.m_ranked_children ) { - unsigned chld_timeout = child_timeout( timeout, tu_timer.elapsed() ); - - result = (std::min)( result, execute_test_tree( chld.second, chld_timeout, &rand_gen ) ); - - if( unit_test_monitor.is_critical_error( result ) ) - break; - } - } - else { - // Go through ranges of children with the same dependency rank and shuffle them - // independently. Execute each subtree in this order - test_unit_id_list children_with_the_same_rank; - - typedef test_suite::children_per_rank::const_iterator it_type; - it_type it = ts.m_ranked_children.begin(); - while( it != ts.m_ranked_children.end() ) { - children_with_the_same_rank.clear(); - - std::pair range = ts.m_ranked_children.equal_range( it->first ); - it = range.first; - while( it != range.second ) { - children_with_the_same_rank.push_back( it->second ); - it++; - } - -#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE - impl::random_shuffle( children_with_the_same_rank.begin(), children_with_the_same_rank.end(), rand_gen ); -#else - std::random_shuffle( children_with_the_same_rank.begin(), children_with_the_same_rank.end(), rand_gen ); -#endif - - BOOST_TEST_FOREACH( test_unit_id, chld, children_with_the_same_rank ) { - unsigned chld_timeout = child_timeout( timeout, tu_timer.elapsed() ); - - result = (std::min)( result, execute_test_tree( chld, chld_timeout, &rand_gen ) ); - - if( unit_test_monitor.is_critical_error( result ) ) - break; - } - } - } - - elapsed = static_cast( tu_timer.elapsed() * 1e6 ); - } - else { // TUT_CASE - test_case const& tc = static_cast( tu ); - - // setup contexts - m_context_idx = 0; - - // setup current test case - ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tc.p_id); - - // execute the test case body - result = unit_test_monitor.execute_and_translate( tc.p_test_func, timeout ); - elapsed = static_cast( tu_timer.elapsed() * 1e6 ); - - // cleanup leftover context - m_context.clear(); - - // restore state (scope exit) and abort if necessary - } - } - - // if run error is critical skip teardown, who knows what the state of the program at this point - if( !unit_test_monitor.is_critical_error( result ) ) { - // execute teardown fixtures if any in reverse order - BOOST_TEST_REVERSE_FOREACH( test_unit_fixture_ptr, F, tu.p_fixtures.get() ) { - ut_detail::test_unit_id_restore restore_current_test_unit(m_curr_test_unit, tu.p_id); - result = (std::min)( result, unit_test_monitor.execute_and_translate( boost::bind( &test_unit_fixture::teardown, F ), 0 ) ); - - if( unit_test_monitor.is_critical_error( result ) ) - break; - } - } - - // notify all observers about abortion - if( unit_test_monitor.is_critical_error( result ) ) { - BOOST_TEST_FOREACH( test_observer*, to, m_observers ) - to->test_aborted(); - } - - // notify all observers about completion - BOOST_TEST_REVERSE_FOREACH( test_observer*, to, m_observers ) - to->test_unit_finish( tu, elapsed ); - - return result; - } - - ////////////////////////////////////////////////////////////////// - - unsigned child_timeout( unsigned tu_timeout, double elapsed ) - { - if( tu_timeout == 0U ) - return 0U; - - unsigned elpsed_sec = static_cast(elapsed); // rounding to number of whole seconds - - return tu_timeout > elpsed_sec ? tu_timeout - elpsed_sec : TIMEOUT_EXCEEDED; - } - - struct priority_order { - bool operator()( test_observer* lhs, test_observer* rhs ) const - { - return (lhs->priority() < rhs->priority()) || ((lhs->priority() == rhs->priority()) && (lhs < rhs)); - } - }; - - // Data members - typedef std::map test_unit_store; - typedef std::set observer_store; - struct context_frame { - context_frame( std::string const& d, int id, bool sticky ) - : descr( d ) - , frame_id( id ) - , is_sticky( sticky ) - {} - - std::string descr; - int frame_id; - bool is_sticky; - }; - typedef std::vector context_data; - - master_test_suite_t* m_master_test_suite; - std::vector m_auto_test_suites; - - test_unit_id m_curr_test_unit; - test_unit_store m_test_units; - - test_unit_id m_next_test_case_id; - test_unit_id m_next_test_suite_id; - - bool m_test_in_progress; - - observer_store m_observers; - context_data m_context; - int m_context_idx; - - std::set m_global_fixtures; - - boost::execution_monitor m_aux_em; - - std::map m_log_sinks; - runtime_config::stream_holder m_report_sink; -}; - -//____________________________________________________________________________// - -namespace impl { -namespace { - -#if defined(__CYGWIN__) -framework::state& s_frk_state() { static framework::state* the_inst = 0; if(!the_inst) the_inst = new framework::state; return *the_inst; } -#else -framework::state& s_frk_state() { static framework::state the_inst; return the_inst; } -#endif - -} // local namespace - -void -setup_for_execution( test_unit const& tu ) -{ - s_frk_state().deduce_run_status( tu.p_id ); -} - -struct sum_to_first_only { - sum_to_first_only() : is_first(true) {} - template - T operator()(T const& l_, U const& r_) { - if(is_first) { - is_first = false; - return l_ + r_.first; - } - return l_ + ", " + r_.first; - } - - bool is_first; -}; - -void -shutdown_loggers_and_reports() -{ - s_frk_state().m_log_sinks.clear(); - s_frk_state().m_report_sink.setup( "stderr" ); -} - -void -setup_loggers() -{ - - BOOST_TEST_I_TRY { - -#ifdef BOOST_TEST_SUPPORT_TOKEN_ITERATOR - bool has_combined_logger = runtime_config::has( runtime_config::btrt_combined_logger ) - && !runtime_config::get< std::vector >( runtime_config::btrt_combined_logger ).empty(); -#else - bool has_combined_logger = false; -#endif - - if( !has_combined_logger ) { - unit_test_log.set_threshold_level( runtime_config::get( runtime_config::btrt_log_level ) ); - const output_format format = runtime_config::get( runtime_config::btrt_log_format ); - unit_test_log.set_format( format ); - - runtime_config::stream_holder& stream_logger = s_frk_state().m_log_sinks[format]; - if( runtime_config::has( runtime_config::btrt_log_sink ) ) { - // we remove all streams in this case, so we do not specify the format - boost::function< void () > log_cleaner = boost::bind( &unit_test_log_t::set_stream, - &unit_test_log, - boost::ref(std::cout) - ); - stream_logger.setup( runtime_config::get( runtime_config::btrt_log_sink ), - log_cleaner ); - } - unit_test_log.set_stream( stream_logger.ref() ); - } - else - { - - const std::vector& v_output_format = runtime_config::get< std::vector >( runtime_config::btrt_combined_logger ) ; - - static const std::pair all_log_levels[] = { - std::make_pair( "all" , log_successful_tests ), - std::make_pair( "success" , log_successful_tests ), - std::make_pair( "test_suite" , log_test_units ), - std::make_pair( "unit_scope" , log_test_units ), - std::make_pair( "message" , log_messages ), - std::make_pair( "warning" , log_warnings ), - std::make_pair( "error" , log_all_errors ), - std::make_pair( "cpp_exception" , log_cpp_exception_errors ), - std::make_pair( "system_error" , log_system_errors ), - std::make_pair( "fatal_error" , log_fatal_errors ), - std::make_pair( "nothing" , log_nothing ) - }; - - static const std::pair all_formats[] = { - std::make_pair( "HRF" , OF_CLF ), - std::make_pair( "CLF" , OF_CLF ), - std::make_pair( "XML" , OF_XML ), - std::make_pair( "JUNIT", OF_JUNIT ) - }; - - - bool is_first = true; - - BOOST_TEST_FOREACH( const_string, current_multi_config, v_output_format ) { - - #ifdef BOOST_TEST_SUPPORT_TOKEN_ITERATOR - - // ':' may be used for file names: C:/tmp/mylogsink.xml - // we merge the tokens that start with / or \ with the previous one. - std::vector v_processed_tokens; - - { - utils::string_token_iterator current_config( current_multi_config, (utils::dropped_delimeters = ":", - utils::kept_delimeters = utils::dt_none) ); - - for( ; current_config != utils::string_token_iterator() ; ++current_config) { - std::string str_copy(current_config->begin(), current_config->end()); - if( ( str_copy[0] == '\\' || str_copy[0] == '/' ) - && v_processed_tokens.size() > 0) { - v_processed_tokens.back() += ":" + str_copy; // ':' has been eaten up - } - else { - v_processed_tokens.push_back(str_copy); - } - } - } - - BOOST_TEST_FOREACH( std::string const&, current_config, v_processed_tokens ) { - - utils::string_token_iterator current_format_specs( current_config, (utils::keep_empty_tokens, - utils::dropped_delimeters = ",", - utils::kept_delimeters = utils::dt_none) ); - - output_format format = OF_INVALID ; // default - if( current_format_specs != utils::string_token_iterator() && - current_format_specs->size() ) { - - for(size_t elem=0; elem < sizeof(all_formats)/sizeof(all_formats[0]); elem++) { - if(const_string(all_formats[elem].first) == *current_format_specs) { - format = all_formats[elem].second; - break; - } - } - } - - BOOST_TEST_I_ASSRT( format != OF_INVALID, - boost::runtime::access_to_missing_argument() - << "Unable to determine the logger type from '" - << current_config - << "'. Possible choices are: " - << std::accumulate(all_formats, - all_formats + sizeof(all_formats)/sizeof(all_formats[0]), - std::string(""), - sum_to_first_only()) - ); - - // activates this format - if( is_first ) { - unit_test_log.set_format( format ); - } - else { - unit_test_log.add_format( format ); - } - is_first = false; - - unit_test_log_formatter * const formatter = unit_test_log.get_formatter(format); - BOOST_TEST_SETUP_ASSERT( formatter, "Logger setup error" ); - - log_level formatter_log_level = invalid_log_level; - ++current_format_specs ; - if( !current_format_specs->size() ) { - formatter_log_level = formatter->get_log_level(); // default log level given by the formatter - } - else if( current_format_specs != utils::string_token_iterator() ) { - - for(size_t elem=0; elem < sizeof(all_log_levels)/sizeof(all_log_levels[0]); elem++) { - if(const_string(all_log_levels[elem].first) == *current_format_specs) { - formatter_log_level = all_log_levels[elem].second; - break; - } - } - } - - BOOST_TEST_I_ASSRT( formatter_log_level != invalid_log_level, - boost::runtime::access_to_missing_argument() - << "Unable to determine the log level from '" - << current_config - << "'. Possible choices are: " - << std::accumulate(all_log_levels, - all_log_levels + sizeof(all_log_levels)/sizeof(all_log_levels[0]), - std::string(""), - sum_to_first_only()) - ); - - unit_test_log.set_threshold_level( format, formatter_log_level ); - - runtime_config::stream_holder& stream_logger = s_frk_state().m_log_sinks[format]; - boost::function< void () > log_cleaner = boost::bind( &unit_test_log_t::set_stream, - &unit_test_log, - format, - boost::ref(std::cout) ); - if( ++current_format_specs != utils::string_token_iterator() && - current_format_specs->size() ) { - stream_logger.setup( *current_format_specs, - log_cleaner ); - } - else { - stream_logger.setup( formatter->get_default_stream_description(), - log_cleaner ); - } - unit_test_log.set_stream( format, stream_logger.ref() ); - } - #endif - } // for each logger - - } // if/else new logger API - } // BOOST_TEST_I_TRY - BOOST_TEST_I_CATCH( boost::runtime::init_error, ex ) { - BOOST_TEST_SETUP_ASSERT( false, ex.msg ); - } - BOOST_TEST_I_CATCH( boost::runtime::input_error, ex ) { - std::cerr << ex.msg << "\n\n"; - - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); - } - - -} - -//____________________________________________________________________________// - -} // namespace impl - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** framework::init ************** // -// ************************************************************************** // - -void -init( init_unit_test_func init_func, int argc, char* argv[] ) -{ - using namespace impl; - - // 10. Set up runtime parameters - runtime_config::init( argc, argv ); - - // 20. Set the desired log level, format and sink - impl::setup_loggers(); - - // 30. Set the desired report level, format and sink - results_reporter::set_level( runtime_config::get( runtime_config::btrt_report_level ) ); - results_reporter::set_format( runtime_config::get( runtime_config::btrt_report_format ) ); - - if( runtime_config::has( runtime_config::btrt_report_sink ) ) { - boost::function< void () > report_cleaner = boost::bind( &results_reporter::set_stream, - boost::ref(std::cerr) - ); - s_frk_state().m_report_sink.setup( runtime_config::get( runtime_config::btrt_report_sink ), - report_cleaner ); - } - - results_reporter::set_stream( s_frk_state().m_report_sink.ref() ); - - // 40. Register default test observers - register_observer( results_collector ); - register_observer( unit_test_log ); - register_observer( framework_init_observer ); - - if( runtime_config::get( runtime_config::btrt_show_progress ) ) { - progress_monitor.set_stream( std::cout ); // defaults to stdout - register_observer( progress_monitor ); - } - - // 50. Set up memory leak detection - unsigned long detect_mem_leak = runtime_config::get( runtime_config::btrt_detect_mem_leaks ); - if( detect_mem_leak > 0 ) { - debug::detect_memory_leaks( true, runtime_config::get( runtime_config::btrt_report_mem_leaks ) ); - debug::break_memory_alloc( (long)detect_mem_leak ); - } - - // 60. Initialize master unit test suite - master_test_suite().argc = argc; - master_test_suite().argv = argv; - - // 70. Invoke test module initialization routine - BOOST_TEST_I_TRY { - s_frk_state().m_aux_em.vexecute( boost::bind( &impl::invoke_init_func, init_func ) ); - } - BOOST_TEST_I_CATCH( execution_exception, ex ) { - BOOST_TEST_SETUP_ASSERT( false, ex.what() ); - } -} - -//____________________________________________________________________________// - -void -finalize_setup_phase( test_unit_id master_tu_id ) -{ - if( master_tu_id == INV_TEST_UNIT_ID ) - master_tu_id = master_test_suite().p_id; - - // 10. Apply all decorators to the auto test units - class apply_decorators : public test_tree_visitor { - private: - // test_tree_visitor interface - virtual bool visit( test_unit const& tu ) - { - BOOST_TEST_FOREACH( decorator::base_ptr, d, tu.p_decorators.get() ) - d->apply( const_cast(tu) ); - - return true; - } - } ad; - traverse_test_tree( master_tu_id, ad, true ); - - // 20. Finalize setup phase - impl::order_info_per_tu tuoi; - impl::s_frk_state().deduce_siblings_order( master_tu_id, master_tu_id, tuoi ); - impl::s_frk_state().finalize_default_run_status( master_tu_id, test_unit::RS_INVALID ); -} - -// ************************************************************************** // -// ************** test_in_progress ************** // -// ************************************************************************** // - -bool -test_in_progress() -{ - return impl::s_frk_state().m_test_in_progress; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** framework::shutdown ************** // -// ************************************************************************** // - -void -shutdown() -{ - impl::shutdown_loggers_and_reports(); - // eliminating some fake memory leak reports. See for more details: - // http://connect.microsoft.com/VisualStudio/feedback/details/106937/memory-leaks-reported-by-debug-crt-inside-typeinfo-name - -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1600 ) && !defined(_DLL) && defined(_DEBUG) -# if BOOST_WORKAROUND(BOOST_MSVC, < 1600 ) -#define _Next next -#define _MemPtr memPtr -#endif - __type_info_node* pNode = __type_info_root_node._Next; - __type_info_node* tmpNode = &__type_info_root_node; - - for( ; pNode!=NULL; pNode = tmpNode ) { - tmpNode = pNode->_Next; - delete pNode->_MemPtr; - delete pNode; - } -# if BOOST_WORKAROUND(BOOST_MSVC, < 1600 ) -#undef _Next -#undef _MemPtr -#endif -# endif -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** register_test_unit ************** // -// ************************************************************************** // - -void -register_test_unit( test_case* tc ) -{ - BOOST_TEST_SETUP_ASSERT( tc->p_id == INV_TEST_UNIT_ID, BOOST_TEST_L( "test case already registered" ) ); - - test_unit_id new_id = impl::s_frk_state().m_next_test_case_id; - - BOOST_TEST_SETUP_ASSERT( new_id != MAX_TEST_CASE_ID, BOOST_TEST_L( "too many test cases" ) ); - - typedef state::test_unit_store::value_type map_value_type; - - impl::s_frk_state().m_test_units.insert( map_value_type( new_id, tc ) ); - impl::s_frk_state().m_next_test_case_id++; - - impl::s_frk_state().set_tu_id( *tc, new_id ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** register_test_unit ************** // -// ************************************************************************** // - -void -register_test_unit( test_suite* ts ) -{ - BOOST_TEST_SETUP_ASSERT( ts->p_id == INV_TEST_UNIT_ID, BOOST_TEST_L( "test suite already registered" ) ); - - test_unit_id new_id = impl::s_frk_state().m_next_test_suite_id; - - BOOST_TEST_SETUP_ASSERT( new_id != MAX_TEST_SUITE_ID, BOOST_TEST_L( "too many test suites" ) ); - - typedef state::test_unit_store::value_type map_value_type; - - impl::s_frk_state().m_test_units.insert( map_value_type( new_id, ts ) ); - impl::s_frk_state().m_next_test_suite_id++; - - impl::s_frk_state().set_tu_id( *ts, new_id ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** deregister_test_unit ************** // -// ************************************************************************** // - -void -deregister_test_unit( test_unit* tu ) -{ - impl::s_frk_state().m_test_units.erase( tu->p_id ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** clear ************** // -// ************************************************************************** // - -void -clear() -{ - impl::s_frk_state().clear(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** register_observer ************** // -// ************************************************************************** // - -void -register_observer( test_observer& to ) -{ - impl::s_frk_state().m_observers.insert( &to ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** deregister_observer ************** // -// ************************************************************************** // - -void -deregister_observer( test_observer& to ) -{ - impl::s_frk_state().m_observers.erase( &to ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** register_global_fixture ************** // -// ************************************************************************** // - -void -register_global_fixture( test_unit_fixture& tuf ) -{ - impl::s_frk_state().m_global_fixtures.insert( &tuf ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** deregister_global_fixture ************** // -// ************************************************************************** // - -void -deregister_global_fixture( test_unit_fixture &tuf ) -{ - impl::s_frk_state().m_global_fixtures.erase( &tuf ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** add_context ************** // -// ************************************************************************** // - -int -add_context( ::boost::unit_test::lazy_ostream const& context_descr, bool sticky ) -{ - std::stringstream buffer; - context_descr( buffer ); - int res_idx = impl::s_frk_state().m_context_idx++; - - impl::s_frk_state().m_context.push_back( state::context_frame( buffer.str(), res_idx, sticky ) ); - - return res_idx; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** clear_context ************** // -// ************************************************************************** // - -struct frame_with_id { - explicit frame_with_id( int id ) : m_id( id ) {} - - bool operator()( state::context_frame const& f ) - { - return f.frame_id == m_id; - } - int m_id; -}; - -//____________________________________________________________________________// - -void -clear_context( int frame_id ) -{ - if( frame_id == -1 ) { // clear all non sticky frames - for( int i=static_cast(impl::s_frk_state().m_context.size())-1; i>=0; i-- ) - if( !impl::s_frk_state().m_context[i].is_sticky ) - impl::s_frk_state().m_context.erase( impl::s_frk_state().m_context.begin()+i ); - } - - else { // clear specific frame - state::context_data::iterator it = - std::find_if( impl::s_frk_state().m_context.begin(), impl::s_frk_state().m_context.end(), frame_with_id( frame_id ) ); - - if( it != impl::s_frk_state().m_context.end() ) // really an internal error if this is not true - impl::s_frk_state().m_context.erase( it ); - } -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** get_context ************** // -// ************************************************************************** // - -context_generator -get_context() -{ - return context_generator(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** context_generator ************** // -// ************************************************************************** // - -bool -context_generator::is_empty() const -{ - return impl::s_frk_state().m_context.empty(); -} - -//____________________________________________________________________________// - -const_string -context_generator::next() const -{ - return m_curr_frame < impl::s_frk_state().m_context.size() ? impl::s_frk_state().m_context[m_curr_frame++].descr : const_string(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** master_test_suite ************** // -// ************************************************************************** // - -master_test_suite_t& -master_test_suite() -{ - if( !impl::s_frk_state().m_master_test_suite ) - impl::s_frk_state().m_master_test_suite = new master_test_suite_t; - - return *impl::s_frk_state().m_master_test_suite; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** current_auto_test_suite ************** // -// ************************************************************************** // - -test_suite& -current_auto_test_suite( test_suite* ts, bool push_or_pop ) -{ - if( impl::s_frk_state().m_auto_test_suites.empty() ) - impl::s_frk_state().m_auto_test_suites.push_back( &framework::master_test_suite() ); - - if( !push_or_pop ) - impl::s_frk_state().m_auto_test_suites.pop_back(); - else if( ts ) - impl::s_frk_state().m_auto_test_suites.push_back( ts ); - - return *impl::s_frk_state().m_auto_test_suites.back(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** current_test_case ************** // -// ************************************************************************** // - -test_case const& -current_test_case() -{ - return get( impl::s_frk_state().m_curr_test_unit ); -} - - -test_unit const& -current_test_unit() -{ - return *impl::s_frk_state().m_test_units[impl::s_frk_state().m_curr_test_unit]; -} - -//____________________________________________________________________________// - -test_unit_id -current_test_case_id() -{ - return impl::s_frk_state().m_curr_test_unit; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** framework::get ************** // -// ************************************************************************** // - -test_unit& -get( test_unit_id id, test_unit_type t ) -{ - test_unit* res = impl::s_frk_state().m_test_units[id]; - - BOOST_TEST_I_ASSRT( (res->p_type & t) != 0, internal_error( "Invalid test unit type" ) ); - - return *res; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** framework::run ************** // -// ************************************************************************** // - -template -struct swap_on_delete { - swap_on_delete(Cont& c1, Cont& c2) : m_c1(c1), m_c2(c2){} - ~swap_on_delete() { - m_c1.swap(m_c2); - } - - Cont& m_c1; - Cont& m_c2; -}; - -void -run( test_unit_id id, bool continue_test ) -{ - if( id == INV_TEST_UNIT_ID ) - id = master_test_suite().p_id; - - // Figure out run status for execution phase - impl::s_frk_state().deduce_run_status( id ); - - test_case_counter tcc; - traverse_test_tree( id, tcc ); - - BOOST_TEST_SETUP_ASSERT( tcc.p_count != 0 , runtime_config::get >( runtime_config::btrt_run_filters ).empty() - ? BOOST_TEST_L( "test tree is empty" ) - : BOOST_TEST_L( "no test cases matching filter or all test cases were disabled" ) ); - - bool was_in_progress = framework::test_in_progress(); - bool call_start_finish = !continue_test || !was_in_progress; - bool init_ok = true; - const_string setup_error; - - if( call_start_finish ) { - // indicates the framework that no test is in progress now if observers need to be notified - impl::s_frk_state().m_test_in_progress = false; - // unit_test::framework_init_observer will get cleared first - BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) { - BOOST_TEST_I_TRY { - ut_detail::test_unit_id_restore restore_current_test_unit(impl::s_frk_state().m_curr_test_unit, id); - unit_test_monitor_t::error_level result = unit_test_monitor.execute_and_translate( boost::bind( &test_observer::test_start, to, tcc.p_count ) ); - if( init_ok ) { - if( result != unit_test_monitor_t::test_ok ) { - init_ok = false; - } - else { - if( unit_test::framework_init_observer.has_failed() ) { - init_ok = false; - } - } - } - } - BOOST_TEST_I_CATCH( execution_exception, ex ) { - if( init_ok ) { - // log only the first error - init_ok = false; - setup_error = ex.what(); - } - // break; // we should continue otherwise loggers may have improper structure (XML start missing for instance) - } - } - } - - if( init_ok ) { - - // attaching the global fixtures to the main entry point - test_unit& entry_test_unit = framework::get( id, TUT_ANY ); - std::vector v_saved_fixture(entry_test_unit.p_fixtures.value.begin(), - entry_test_unit.p_fixtures.value.end()); - - BOOST_TEST_FOREACH( test_unit_fixture*, tuf, impl::s_frk_state().m_global_fixtures ) { - entry_test_unit.p_fixtures.value.insert( entry_test_unit.p_fixtures.value.begin(), - test_unit_fixture_ptr(new impl::global_fixture_handle(tuf)) ); - } - - swap_on_delete< std::vector > raii_fixture(v_saved_fixture, entry_test_unit.p_fixtures.value); - - // now work in progress - impl::s_frk_state().m_test_in_progress = true; - unsigned seed = runtime_config::get( runtime_config::btrt_random_seed ); - switch( seed ) { - case 0: - break; - case 1: - seed = static_cast( std::rand() ^ std::time( 0 ) ); // better init using std::rand() ^ ... - BOOST_FALLTHROUGH; - default: - BOOST_TEST_FRAMEWORK_MESSAGE( "Test cases order is shuffled using seed: " << seed ); - std::srand( seed ); - } - - // executing the test tree - impl::s_frk_state().execute_test_tree( id ); - - // removing previously added global fixtures: dtor raii_fixture - } - - impl::s_frk_state().m_test_in_progress = false; - - results_reporter::make_report( INV_REPORT_LEVEL, id ); - - unit_test::framework_init_observer.clear(); - if( call_start_finish ) { - // indicates the framework that no test is in progress anymore if observers need to be notified - // and this is a teardown, so assertions should not raise any exception otherwise an exception - // might be raised in a dtor of a global fixture - impl::s_frk_state().m_test_in_progress = false; - BOOST_TEST_REVERSE_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) { - ut_detail::test_unit_id_restore restore_current_test_unit(impl::s_frk_state().m_curr_test_unit, id); - to->test_finish(); - } - } - - impl::s_frk_state().m_test_in_progress = was_in_progress; - - // propagates the init/teardown error if any - BOOST_TEST_SETUP_ASSERT( init_ok && !unit_test::framework_init_observer.has_failed(), setup_error ); -} - -//____________________________________________________________________________// - -void -run( test_unit const* tu, bool continue_test ) -{ - run( tu->p_id, continue_test ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** assertion_result ************** // -// ************************************************************************** // - -void -assertion_result( unit_test::assertion_result ar ) -{ - BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) - to->assertion_result( ar ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** exception_caught ************** // -// ************************************************************************** // - -void -exception_caught( execution_exception const& ex ) -{ - BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) - to->exception_caught( ex ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** test_unit_aborted ************** // -// ************************************************************************** // - -void -test_unit_aborted( test_unit const& tu ) -{ - BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) - to->test_unit_aborted( tu ); -} - -// ************************************************************************** // -// ************** test_aborted ************** // -// ************************************************************************** // - -void -test_aborted( ) -{ - BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) - to->test_aborted( ); -} - - -//____________________________________________________________________________// - -} // namespace framework -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_FRAMEWORK_IPP_021005GER diff --git a/libraries/boost/include/boost/test/impl/junit_log_formatter.ipp b/libraries/boost/include/boost/test/impl/junit_log_formatter.ipp deleted file mode 100644 index e82e2bd1b0..0000000000 --- a/libraries/boost/include/boost/test/impl/junit_log_formatter.ipp +++ /dev/null @@ -1,840 +0,0 @@ -// (C) Copyright 2016 Raffi Enficiaud. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@file -///@brief Contains the implementatoin of the Junit log formatter (OF_JUNIT) -// *************************************************************************** - -#ifndef BOOST_TEST_JUNIT_LOG_FORMATTER_IPP__ -#define BOOST_TEST_JUNIT_LOG_FORMATTER_IPP__ - -// Boost.Test -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -//#include - - -// Boost -#include - -// STL -#include -#include -#include - -#include - - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - - -struct s_replace_chars { - template - void operator()(T& to_replace) - { - if(to_replace == '/') - to_replace = '.'; - else if(to_replace == ' ') - to_replace = '_'; - } -}; - -inline std::string tu_name_normalize(std::string full_name) -{ - // maybe directly using normalize_test_case_name instead? - std::for_each(full_name.begin(), full_name.end(), s_replace_chars()); - return full_name; -} - -inline std::string tu_name_remove_newlines(std::string full_name) -{ - full_name.erase(std::remove(full_name.begin(), full_name.end(), '\n'), full_name.end()); - return full_name; -} - -const_string file_basename(const_string filename) { - - const_string path_sep( "\\/" ); - const_string::iterator it = unit_test::utils::find_last_of( filename.begin(), filename.end(), - path_sep.begin(), path_sep.end() ); - if( it != filename.end() ) - filename.trim_left( it + 1 ); - - return filename; - -} - -// ************************************************************************** // -// ************** junit_log_formatter ************** // -// ************************************************************************** // - -void -junit_log_formatter::log_start( std::ostream& /*ostr*/, counter_t /*test_cases_amount*/) -{ - map_tests.clear(); - list_path_to_root.clear(); - runner_log_entry.clear(); -} - -//____________________________________________________________________________// - -class junit_result_helper : public test_tree_visitor { -private: - typedef junit_impl::junit_log_helper::assertion_entry assertion_entry; - typedef std::vector< assertion_entry >::const_iterator vect_assertion_entry_citerator; - typedef std::list::const_iterator list_str_citerator; - -public: - explicit junit_result_helper( - std::ostream& stream, - test_unit const& ts, - junit_log_formatter::map_trace_t const& mt, - junit_impl::junit_log_helper const& runner_log_, - bool display_build_info ) - : m_stream(stream) - , m_ts( ts ) - , m_map_test( mt ) - , runner_log( runner_log_ ) - , m_id( 0 ) - , m_display_build_info(display_build_info) - { } - - void add_log_entry(assertion_entry const& log) const - { - std::string entry_type; - if( log.log_entry == assertion_entry::log_entry_failure ) { - entry_type = "failure"; - } - else if( log.log_entry == assertion_entry::log_entry_error ) { - entry_type = "error"; - } - else { - return; - } - - m_stream - << "<" << entry_type - << " message" << utils::attr_value() << log.logentry_message - << " type" << utils::attr_value() << log.logentry_type - << ">"; - - if(!log.output.empty()) { - m_stream << utils::cdata() << "\n" + log.output; - } - - m_stream << ""; - } - - struct conditional_cdata_helper { - std::ostream &ostr; - std::string const field; - bool empty; - - conditional_cdata_helper(std::ostream &ostr_, std::string field_) - : ostr(ostr_) - , field(field_) - , empty(true) - {} - - ~conditional_cdata_helper() { - if(!empty) { - ostr << BOOST_TEST_L( "]]>" ) << "' << std::endl; - } - } - - void operator()(const std::string& s) { - bool current_empty = s.empty(); - if(empty) { - if(!current_empty) { - empty = false; - ostr << '<' << field << '>' << BOOST_TEST_L( " build_skipping_chain(test_unit const & tu) const - { - // we enter here because we know that the tu has been skipped. - // either junit has not seen this tu, or it is indicated as disabled - assert(m_map_test.count(tu.p_id) == 0 || results_collector.results( tu.p_id ).p_skipped); - - std::list out; - - test_unit_id id(tu.p_id); - while( id != m_ts.p_id && id != INV_TEST_UNIT_ID) { - test_unit const& tu_hierarchy = boost::unit_test::framework::get( id, TUT_ANY ); - out.push_back("- disabled test unit: '" + tu_name_remove_newlines(tu_hierarchy.full_name()) + "'\n"); - if(m_map_test.count(id) > 0) - { - // junit has seen the reason: this is enough for constructing the chain - break; - } - id = tu_hierarchy.p_parent_id; - } - junit_log_formatter::map_trace_t::const_iterator it_element_stack(m_map_test.find(id)); - if( it_element_stack != m_map_test.end() ) - { - out.push_back("- reason: '" + it_element_stack->second.skipping_reason + "'"); - out.push_front("Test case disabled because of the following chain of decision:\n"); - } - - return out; - } - - std::string get_class_name(test_unit const & tu_class) const { - std::string classname; - test_unit_id id(tu_class.p_parent_id); - while( id != m_ts.p_id && id != INV_TEST_UNIT_ID ) { - test_unit const& tu = boost::unit_test::framework::get( id, TUT_ANY ); - classname = tu_name_normalize(tu.p_name) + "." + classname; - id = tu.p_parent_id; - } - - // removes the trailing dot - if(!classname.empty() && *classname.rbegin() == '.') { - classname.erase(classname.size()-1); - } - - return classname; - } - - void write_testcase_header(test_unit const & tu, - test_results const *tr, - int nb_assertions) const - { - std::string name; - std::string classname; - - if(tu.p_id == m_ts.p_id ) { - name = "boost_test"; - } - else { - classname = get_class_name(tu); - name = tu_name_normalize(tu.p_name); - } - - if( tu.p_type == TUT_SUITE ) { - name += "-setup-teardown"; - } - - m_stream << "p_duration_microseconds) * 1E-6 - << ">" << std::endl; - } - - void write_testcase_system_out(junit_impl::junit_log_helper const &detailed_log, - test_unit const * tu, - bool skipped) const - { - // system-out + all info/messages, the object skips the empty entries - conditional_cdata_helper system_out_helper(m_stream, "system-out"); - - // indicate why the test has been skipped first - if( skipped ) { - std::list skipping_decision_chain = build_skipping_chain(*tu); - for(list_str_citerator it(skipping_decision_chain.begin()), ite(skipping_decision_chain.end()); - it != ite; - ++it) - { - system_out_helper(*it); - } - } - - // stdout - for(list_str_citerator it(detailed_log.system_out.begin()), ite(detailed_log.system_out.end()); - it != ite; - ++it) - { - system_out_helper(*it); - } - - // warning/info message last - for(vect_assertion_entry_citerator it(detailed_log.assertion_entries.begin()); - it != detailed_log.assertion_entries.end(); - ++it) - { - if(it->log_entry != assertion_entry::log_entry_info) - continue; - system_out_helper(it->output); - } - } - - void write_testcase_system_err(junit_impl::junit_log_helper const &detailed_log, - test_unit const * tu, - test_results const *tr) const - { - // system-err output + test case informations - bool has_failed = (tr != 0) ? !tr->p_skipped && !tr->passed() : false; - if(!detailed_log.system_err.empty() || has_failed) - { - std::ostringstream o; - if(has_failed) { - o << "Failures detected in:" << std::endl; - } - else { - o << "ERROR STREAM:" << std::endl; - } - - if(tu->p_type == TUT_SUITE) { - if( tu->p_id == m_ts.p_id ) { - o << " boost.test global setup/teardown" << std::endl; - } else { - o << "- test suite: " << tu_name_remove_newlines(tu->full_name()) << std::endl; - } - } - else { - o << "- test case: " << tu_name_remove_newlines(tu->full_name()); - if(!tu->p_description.value.empty()) - o << " '" << tu->p_description << "'"; - - o << std::endl - << "- file: " << file_basename(tu->p_file_name) << std::endl - << "- line: " << tu->p_line_num << std::endl - ; - } - - if(!detailed_log.system_err.empty()) - o << std::endl << "STDERR BEGIN: ------------" << std::endl; - - for(list_str_citerator it(detailed_log.system_err.begin()), ite(detailed_log.system_err.end()); - it != ite; - ++it) - { - o << *it; - } - - if(!detailed_log.system_err.empty()) - o << std::endl << "STDERR END ------------" << std::endl; - - conditional_cdata_helper system_err_helper(m_stream, "system-err"); - system_err_helper(o.str()); - } - } - - int get_nb_assertions(junit_impl::junit_log_helper const &detailed_log, - test_unit const & tu, - test_results const *tr) const { - int nb_assertions(-1); - if( tu.p_type == TUT_SUITE ) { - nb_assertions = 0; - for(vect_assertion_entry_citerator it(detailed_log.assertion_entries.begin()); - it != detailed_log.assertion_entries.end(); - ++it) - { - if(it->log_entry != assertion_entry::log_entry_info) - nb_assertions++; - } - } - else { - nb_assertions = tr->p_assertions_passed + tr->p_assertions_failed; - } - - return nb_assertions; - } - - void output_detailed_logs(junit_impl::junit_log_helper const &detailed_log, - test_unit const & tu, - bool skipped, - test_results const *tr) const - { - int nb_assertions = get_nb_assertions(detailed_log, tu, tr); - if(!nb_assertions && tu.p_type == TUT_SUITE) - return; - - write_testcase_header(tu, tr, nb_assertions); - - if( skipped ) { - m_stream << "" << std::endl; - } - else { - - for(vect_assertion_entry_citerator it(detailed_log.assertion_entries.begin()); - it != detailed_log.assertion_entries.end(); - ++it) - { - add_log_entry(*it); - } - } - - write_testcase_system_out(detailed_log, &tu, skipped); - write_testcase_system_err(detailed_log, &tu, tr); - m_stream << "" << std::endl; - } - - void visit( test_case const& tc ) - { - - test_results const& tr = results_collector.results( tc.p_id ); - junit_log_formatter::map_trace_t::const_iterator it_find = m_map_test.find(tc.p_id); - if(it_find == m_map_test.end()) - { - // test has been skipped and not seen by the logger - output_detailed_logs(junit_impl::junit_log_helper(), tc, true, &tr); - } - else { - output_detailed_logs(it_find->second, tc, tr.p_skipped, &tr); - } - } - - bool test_suite_start( test_suite const& ts ) - { - test_results const& tr = results_collector.results( ts.p_id ); - - // unique test suite, without s, nesting not supported in CI - if( m_ts.p_id == ts.p_id ) { - m_stream << "" << std::endl; - - if(m_display_build_info) - { - m_stream << "" << std::endl; - m_stream << "" << std::endl; - m_stream << "" << std::endl; - m_stream << "" << std::endl; - - std::ostringstream o; - o << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100; - m_stream << "" << std::endl; - m_stream << "" << std::endl; - } - } - - if( !tr.p_skipped ) { - // if we land here, then this is a chance that we are logging the fixture setup/teardown of a test-suite. - // the setup/teardown logging of a test-case is part of the test case. - // we do not care about the test-suite that were skipped (really??) - junit_log_formatter::map_trace_t::const_iterator it_find = m_map_test.find(ts.p_id); - if(it_find != m_map_test.end()) { - output_detailed_logs(it_find->second, ts, false, &tr); - } - } - - return true; // indicates that the children should also be parsed - } - - virtual void test_suite_finish( test_suite const& ts ) - { - if( m_ts.p_id == ts.p_id ) { - write_testcase_system_out(runner_log, 0, false); - write_testcase_system_err(runner_log, 0, 0); - - m_stream << ""; - return; - } - } - -private: - // Data members - std::ostream& m_stream; - test_unit const& m_ts; - junit_log_formatter::map_trace_t const& m_map_test; - junit_impl::junit_log_helper const& runner_log; - size_t m_id; - bool m_display_build_info; -}; - - - -void -junit_log_formatter::log_finish( std::ostream& ostr ) -{ - ostr << "" << std::endl; - - // getting the root test suite - if(!map_tests.empty()) { - test_unit* root = &boost::unit_test::framework::get( map_tests.begin()->first, TUT_ANY ); - - // looking for the root of the SUBtree (we stay in the subtree) - while(root->p_parent_id != INV_TEST_UNIT_ID && map_tests.count(root->p_parent_id) > 0) { - root = &boost::unit_test::framework::get( root->p_parent_id, TUT_ANY ); - } - junit_result_helper ch( ostr, *root, map_tests, this->runner_log_entry, m_display_build_info ); - traverse_test_tree( root->p_id, ch, true ); // last is to ignore disabled suite special handling - } - else { - ostr << ""; - ostr << ""; - ostr << ""; - ostr << "Incorrect setup: no test case executed"; - ostr << ""; - } - return; -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_build_info( std::ostream& /*ostr*/ ) -{ - m_display_build_info = true; -} - -//____________________________________________________________________________// - -void -junit_log_formatter::test_unit_start( std::ostream& /*ostr*/, test_unit const& tu ) -{ - list_path_to_root.push_back( tu.p_id ); - map_tests.insert(std::make_pair(tu.p_id, junit_impl::junit_log_helper())); // current_test_case_id not working here -} - - - -//____________________________________________________________________________// - -void -junit_log_formatter::test_unit_finish( std::ostream& /*ostr*/, test_unit const& tu, unsigned long /*elapsed*/ ) -{ - // the time is already stored in the result_reporter - assert( tu.p_id == list_path_to_root.back() ); - list_path_to_root.pop_back(); -} - -void -junit_log_formatter::test_unit_aborted( std::ostream& /*ostr*/, test_unit const& tu ) -{ - assert( tu.p_id == list_path_to_root.back() ); - //list_path_to_root.pop_back(); -} - -//____________________________________________________________________________// - -void -junit_log_formatter::test_unit_skipped( std::ostream& /*ostr*/, test_unit const& tu, const_string reason ) -{ - // if a test unit is skipped, then the start of this TU has not been called yet. - // we cannot use get_current_log_entry here, but the TU id should appear in the map. - // The "skip" boolean is given by the boost.test framework - junit_impl::junit_log_helper& v = map_tests[tu.p_id]; // not sure if we can use get_current_log_entry() - v.skipping_reason.assign(reason.begin(), reason.end()); -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_exception_start( std::ostream& /*ostr*/, log_checkpoint_data const& checkpoint_data, execution_exception const& ex ) -{ - std::ostringstream o; - execution_exception::location const& loc = ex.where(); - - m_is_last_assertion_or_error = false; - - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - - junit_impl::junit_log_helper::assertion_entry entry; - - entry.logentry_message = "unexpected exception"; - entry.log_entry = junit_impl::junit_log_helper::assertion_entry::log_entry_error; - - switch(ex.code()) - { - case execution_exception::cpp_exception_error: - entry.logentry_type = "uncaught exception"; - break; - case execution_exception::timeout_error: - entry.logentry_type = "execution timeout"; - break; - case execution_exception::user_error: - entry.logentry_type = "user, assert() or CRT error"; - break; - case execution_exception::user_fatal_error: - // Looks like never used - entry.logentry_type = "user fatal error"; - break; - case execution_exception::system_error: - entry.logentry_type = "system error"; - break; - case execution_exception::system_fatal_error: - entry.logentry_type = "system fatal error"; - break; - default: - entry.logentry_type = "no error"; // not sure how to handle this one - break; - } - - o << "UNCAUGHT EXCEPTION:" << std::endl; - if( !loc.m_function.is_empty() ) - o << "- function: \"" << loc.m_function << "\"" << std::endl; - - o << "- file: " << file_basename(loc.m_file_name) << std::endl - << "- line: " << loc.m_line_num << std::endl - << std::endl; - - o << "\nEXCEPTION STACK TRACE: --------------\n" << ex.what() - << "\n-------------------------------------"; - - if( !checkpoint_data.m_file_name.is_empty() ) { - o << std::endl << std::endl - << "Last checkpoint:" << std::endl - << "- message: \"" << checkpoint_data.m_message << "\"" << std::endl - << "- file: " << file_basename(checkpoint_data.m_file_name) << std::endl - << "- line: " << checkpoint_data.m_line_num << std::endl - ; - } - - entry.output = o.str(); - - last_entry.assertion_entries.push_back(entry); -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_exception_finish( std::ostream& /*ostr*/ ) -{ - // sealing the last entry - assert(!get_current_log_entry().assertion_entries.back().sealed); - get_current_log_entry().assertion_entries.back().sealed = true; -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_entry_start( std::ostream& /*ostr*/, log_entry_data const& entry_data, log_entry_types let ) -{ - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - last_entry.skipping = false; - m_is_last_assertion_or_error = true; - switch(let) - { - case unit_test_log_formatter::BOOST_UTL_ET_INFO: - { - if(m_log_level_internal > log_successful_tests) { - last_entry.skipping = true; - break; - } - BOOST_FALLTHROUGH; - } - case unit_test_log_formatter::BOOST_UTL_ET_MESSAGE: - { - if(m_log_level_internal > log_messages) { - last_entry.skipping = true; - break; - } - BOOST_FALLTHROUGH; - } - case unit_test_log_formatter::BOOST_UTL_ET_WARNING: - { - if(m_log_level_internal > log_warnings) { - last_entry.skipping = true; - break; - } - std::ostringstream o; - junit_impl::junit_log_helper::assertion_entry entry; - - entry.log_entry = junit_impl::junit_log_helper::assertion_entry::log_entry_info; - entry.logentry_message = "info"; - entry.logentry_type = "message"; - - o << (let == unit_test_log_formatter::BOOST_UTL_ET_WARNING ? - "WARNING:" : (let == unit_test_log_formatter::BOOST_UTL_ET_MESSAGE ? - "MESSAGE:" : "INFO:")) - << std::endl - << "- file : " << file_basename(entry_data.m_file_name) << std::endl - << "- line : " << entry_data.m_line_num << std::endl - << "- message: "; // no CR - - entry.output += o.str(); - last_entry.assertion_entries.push_back(entry); - break; - } - default: - case unit_test_log_formatter::BOOST_UTL_ET_ERROR: - case unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR: - { - std::ostringstream o; - junit_impl::junit_log_helper::assertion_entry entry; - entry.log_entry = junit_impl::junit_log_helper::assertion_entry::log_entry_failure; - entry.logentry_message = "failure"; - entry.logentry_type = (let == unit_test_log_formatter::BOOST_UTL_ET_ERROR ? "assertion error" : "fatal error"); - - o << "ASSERTION FAILURE:" << std::endl - << "- file : " << file_basename(entry_data.m_file_name) << std::endl - << "- line : " << entry_data.m_line_num << std::endl - << "- message: " ; // no CR - - entry.output += o.str(); - last_entry.assertion_entries.push_back(entry); - break; - } - } -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_entry_value( std::ostream& /*ostr*/, const_string value ) -{ - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - if(last_entry.skipping) - return; - - assert(last_entry.assertion_entries.empty() || !last_entry.assertion_entries.back().sealed); - - if(!last_entry.assertion_entries.empty()) - { - junit_impl::junit_log_helper::assertion_entry& log_entry = last_entry.assertion_entries.back(); - log_entry.output += value; - } - else - { - // this may be a message coming from another observer - // the prefix is set in the log_entry_start - last_entry.system_out.push_back(std::string(value.begin(), value.end())); - } -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_entry_finish( std::ostream& /*ostr*/ ) -{ - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - if(!last_entry.skipping) - { - assert(last_entry.assertion_entries.empty() || !last_entry.assertion_entries.back().sealed); - - if(!last_entry.assertion_entries.empty()) { - junit_impl::junit_log_helper::assertion_entry& log_entry = last_entry.assertion_entries.back(); - log_entry.output += "\n\n"; // quote end, CR - log_entry.sealed = true; - } - else { - last_entry.system_out.push_back("\n\n"); // quote end, CR - } - } - - last_entry.skipping = false; -} - -//____________________________________________________________________________// - -void -junit_log_formatter::entry_context_start( std::ostream& /*ostr*/, log_level ) -{ - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - if(last_entry.skipping) - return; - - std::vector< junit_impl::junit_log_helper::assertion_entry > &v_failure_or_error = last_entry.assertion_entries; - assert(!v_failure_or_error.back().sealed); - - junit_impl::junit_log_helper::assertion_entry& last_log_entry = v_failure_or_error.back(); - if(m_is_last_assertion_or_error) - { - last_log_entry.output += "\n- context:\n"; - } - else - { - last_log_entry.output += "\n\nCONTEXT:\n"; - } -} - -//____________________________________________________________________________// - -void -junit_log_formatter::entry_context_finish( std::ostream& /*ostr*/, log_level ) -{ - // no op, may be removed - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - if(last_entry.skipping) - return; - assert(!get_current_log_entry().assertion_entries.back().sealed); -} - -//____________________________________________________________________________// - -void -junit_log_formatter::log_entry_context( std::ostream& /*ostr*/, log_level , const_string context_descr ) -{ - junit_impl::junit_log_helper& last_entry = get_current_log_entry(); - if(last_entry.skipping) - return; - - assert(!last_entry.assertion_entries.back().sealed); - junit_impl::junit_log_helper::assertion_entry& last_log_entry = get_current_log_entry().assertion_entries.back(); - - last_log_entry.output += - (m_is_last_assertion_or_error ? " - '": "- '") + std::string(context_descr.begin(), context_descr.end()) + "'\n"; // quote end -} - -//____________________________________________________________________________// - - -std::string -junit_log_formatter::get_default_stream_description() const { - std::string name = framework::master_test_suite().p_name.value; - - static const std::string to_replace[] = { " ", "\"", "/", "\\", ":"}; - static const std::string replacement[] = { "_", "_" , "_", "_" , "_"}; - - name = unit_test::utils::replace_all_occurrences_of( - name, - to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]), - replacement, replacement + sizeof(replacement)/sizeof(replacement[0])); - - std::ifstream check_init((name + ".xml").c_str()); - if(!check_init) - return name + ".xml"; - - int index = 0; - for(; index < 100; index++) { - std::string candidate = name + "_" + utils::string_cast(index) + ".xml"; - std::ifstream file(candidate.c_str()); - if(!file) - return candidate; - } - - return name + ".xml"; -} - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_junit_log_formatter_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/plain_report_formatter.ipp b/libraries/boost/include/boost/test/impl/plain_report_formatter.ipp deleted file mode 100644 index cbf5a4c029..0000000000 --- a/libraries/boost/include/boost/test/impl/plain_report_formatter.ipp +++ /dev/null @@ -1,207 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : plain report formatter definition -// *************************************************************************** - -#ifndef BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER -#define BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER - -// Boost.Test -#include -#include -#include -#include - -#include - -#include -#include - -// STL -#include -#include -#include - -#include - -# ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::log10; } -# endif - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -namespace { - -typedef utils::custom_manip quote; - -template -inline std::ostream& -operator<<( utils::custom_printer const& p, T const& value ) -{ - *p << '"' << value << '"'; - - return *p; -} - -//____________________________________________________________________________// - -void -print_stat_value( std::ostream& ostr, counter_t v, counter_t indent, counter_t total, const_string name, const_string res ) -{ - if( v == 0 ) - return; - - if( total > 0 ) - ostr << std::setw( static_cast(indent) ) << "" << v << ' ' << name << ( v != 1 ? "s" : "" ) - << " out of " << total << ' ' << res << '\n'; - else - ostr << std::setw( static_cast(indent) ) << "" << v << ' ' << res << ' ' << name << ( v != 1 ? "s" : "" ) << '\n'; -} - -//____________________________________________________________________________// - -} // local namespace - -// ************************************************************************** // -// ************** plain_report_formatter ************** // -// ************************************************************************** // - -void -plain_report_formatter::results_report_start( std::ostream& ostr ) -{ - m_indent = 0; - m_color_output = runtime_config::get( runtime_config::btrt_color_output ); - ostr << '\n'; -} - -//____________________________________________________________________________// - -void -plain_report_formatter::results_report_finish( std::ostream& ostr ) -{ - ostr.flush(); -} - -//____________________________________________________________________________// - -void -plain_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream& ostr ) -{ - test_results const& tr = results_collector.results( tu.p_id ); - - const_string descr; - - if( tr.passed() ) - descr = "has passed"; - else if( tr.p_skipped ) - descr = "was skipped"; - else if( tr.p_aborted ) - descr = "was aborted"; - else - descr = "has failed"; - - ostr << std::setw( static_cast(m_indent) ) << "" - << "Test " << tu.p_type_name << ' ' << quote() << tu.full_name() << ' ' << descr; - - if( tr.p_skipped ) { - ostr << "\n"; - m_indent += 2; - return; - } - - counter_t total_assertions = tr.p_assertions_passed + tr.p_assertions_failed; - counter_t total_tc = tr.p_test_cases_passed + tr.p_test_cases_warned + tr.p_test_cases_failed + tr.p_test_cases_skipped; - - if( total_assertions > 0 || total_tc > 0 || tr.p_warnings_failed > 0) - ostr << " with:"; - - ostr << '\n'; - m_indent += 2; - - print_stat_value( ostr, tr.p_test_cases_passed , m_indent, total_tc , "test case", "passed" ); - print_stat_value( ostr, tr.p_test_cases_warned , m_indent, total_tc , "test case", "passed with warnings" ); - print_stat_value( ostr, tr.p_test_cases_failed , m_indent, total_tc , "test case", "failed" ); - print_stat_value( ostr, tr.p_test_cases_skipped, m_indent, total_tc , "test case", "skipped" ); - print_stat_value( ostr, tr.p_test_cases_aborted, m_indent, total_tc , "test case", "aborted" ); - print_stat_value( ostr, tr.p_assertions_passed , m_indent, total_assertions, "assertion", "passed" ); - print_stat_value( ostr, tr.p_assertions_failed , m_indent, total_assertions, "assertion", "failed" ); - print_stat_value( ostr, tr.p_warnings_failed , m_indent, 0 , "warning" , "failed" ); - print_stat_value( ostr, tr.p_expected_failures , m_indent, 0 , "failure" , "expected" ); - - ostr << '\n'; -} - -//____________________________________________________________________________// - -void -plain_report_formatter::test_unit_report_finish( test_unit const&, std::ostream& ) -{ - m_indent -= 2; -} - -//____________________________________________________________________________// - -void -plain_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr ) -{ - test_results const& tr = results_collector.results( tu.p_id ); - - if( tr.passed() ) { - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, ostr, term_attr::BRIGHT, term_color::GREEN ); - - ostr << "*** No errors detected\n"; - return; - } - - BOOST_TEST_SCOPE_SETCOLOR( m_color_output, ostr, term_attr::BRIGHT, term_color::RED ); - - if( tr.p_skipped ) { - ostr << "*** The test " << tu.p_type_name << ' ' << quote() << tu.full_name() << " was skipped" - << "; see standard output for details\n"; - return; - } - - if( tr.p_aborted ) { - ostr << "*** The test " << tu.p_type_name << ' ' << quote() << tu.full_name() << " was aborted" - << "; see standard output for details\n"; - } - - if( tr.p_assertions_failed == 0 ) { - if( !tr.p_aborted ) - ostr << "*** Errors were detected in the test " << tu.p_type_name << ' ' << quote() << tu.full_name() - << "; see standard output for details\n"; - return; - } - - counter_t num_failures = tr.p_assertions_failed; - - ostr << "*** " << num_failures << " failure" << ( num_failures != 1 ? "s are" : " is" ) << " detected"; - - if( tr.p_expected_failures > 0 ) - ostr << " (" << tr.p_expected_failures << " failure" << ( tr.p_expected_failures != 1 ? "s are" : " is" ) << " expected)"; - - ostr << " in the test " << tu.p_type_name << " " << quote() << tu.full_name() << "\n"; -} - -//____________________________________________________________________________// - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/progress_monitor.ipp b/libraries/boost/include/boost/test/impl/progress_monitor.ipp deleted file mode 100644 index 34149745cf..0000000000 --- a/libraries/boost/include/boost/test/impl/progress_monitor.ipp +++ /dev/null @@ -1,185 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements simple text based progress monitor -// *************************************************************************** - -#ifndef BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER -#define BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER - -// Boost.Test -#include -#include - -#include - -#include -#include -#include - -// Boost -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** progress_monitor ************** // -// ************************************************************************** // - -struct progress_display { - progress_display( counter_t expected_count, std::ostream& os ) - : m_os(os) - , m_count( 0 ) - , m_expected_count( expected_count ) - , m_next_tic_count( 0 ) - , m_tic( 0 ) - { - - m_os << "\n0% 10 20 30 40 50 60 70 80 90 100%" - << "\n|----|----|----|----|----|----|----|----|----|----|" - << std::endl; - - if( !m_expected_count ) - m_expected_count = 1; // prevent divide by zero - } - - unsigned long operator+=( unsigned long increment ) - { - if( (m_count += increment) < m_next_tic_count ) - return m_count; - - // use of floating point ensures that both large and small counts - // work correctly. static_cast<>() is also used several places - // to suppress spurious compiler warnings. - unsigned int tics_needed = static_cast( - (static_cast(m_count)/m_expected_count)*50.0 ); - - do { - m_os << '*' << std::flush; - } while( ++m_tic < tics_needed ); - - m_next_tic_count = static_cast((m_tic/50.0) * m_expected_count); - - if( m_count == m_expected_count ) { - if( m_tic < 51 ) - m_os << '*'; - - m_os << std::endl; - } - - return m_count; - } - unsigned long operator++() { return operator+=( 1 ); } - unsigned long count() const { return m_count; } - -private: - BOOST_DELETED_FUNCTION(progress_display(progress_display const&)) - BOOST_DELETED_FUNCTION(progress_display& operator=(progress_display const&)) - - std::ostream& m_os; // may not be present in all imps - - unsigned long m_count; - unsigned long m_expected_count; - unsigned long m_next_tic_count; - unsigned int m_tic; -}; - -namespace { - -struct progress_monitor_impl { - // Constructor - progress_monitor_impl() - : m_stream( &std::cout ) - , m_color_output( false ) - { - } - - std::ostream* m_stream; - scoped_ptr m_progress_display; - bool m_color_output; -}; - -progress_monitor_impl& s_pm_impl() { static progress_monitor_impl the_inst; return the_inst; } - -#define PM_SCOPED_COLOR() \ - BOOST_TEST_SCOPE_SETCOLOR( s_pm_impl().m_color_output, *s_pm_impl().m_stream, term_attr::BRIGHT, term_color::MAGENTA ) - -} // local namespace - -//____________________________________________________________________________// - -void -progress_monitor_t::test_start( counter_t test_cases_amount ) -{ - s_pm_impl().m_color_output = runtime_config::get( runtime_config::btrt_color_output ); - - PM_SCOPED_COLOR(); - - s_pm_impl().m_progress_display.reset( new progress_display( test_cases_amount, *s_pm_impl().m_stream ) ); -} - -//____________________________________________________________________________// - -void -progress_monitor_t::test_aborted() -{ - PM_SCOPED_COLOR(); - - (*s_pm_impl().m_progress_display) += s_pm_impl().m_progress_display->count(); -} - -//____________________________________________________________________________// - -void -progress_monitor_t::test_unit_finish( test_unit const& tu, unsigned long ) -{ - PM_SCOPED_COLOR(); - - if( tu.p_type == TUT_CASE ) - ++(*s_pm_impl().m_progress_display); -} - -//____________________________________________________________________________// - -void -progress_monitor_t::test_unit_skipped( test_unit const& tu, const_string /*reason*/ ) -{ - PM_SCOPED_COLOR(); - - test_case_counter tcc; - traverse_test_tree( tu, tcc ); - - (*s_pm_impl().m_progress_display) += tcc.p_count; -} - -//____________________________________________________________________________// - -void -progress_monitor_t::set_stream( std::ostream& ostr ) -{ - s_pm_impl().m_stream = &ostr; -} - -//____________________________________________________________________________// - -#undef PM_SCOPED_COLOR - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/results_collector.ipp b/libraries/boost/include/boost/test/impl/results_collector.ipp deleted file mode 100644 index fd74bdb65c..0000000000 --- a/libraries/boost/include/boost/test/impl/results_collector.ipp +++ /dev/null @@ -1,285 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements Unit Test results collecting facility. -// *************************************************************************** - -#ifndef BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER -#define BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER - -// Boost.Test -#include -#include -#include - -#include -#include -#include -#include - -// Boost -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_results ************** // -// ************************************************************************** // - -test_results::test_results() -{ - clear(); -} - -//____________________________________________________________________________// - -bool -test_results::passed() const -{ - return !p_skipped && - p_test_cases_failed == 0 && - p_assertions_failed <= p_expected_failures && - p_test_cases_skipped == 0 && - !p_aborted; -} - -bool -test_results::aborted() const -{ - return p_aborted; -} - -//____________________________________________________________________________// - -int -test_results::result_code() const -{ - return passed() ? exit_success - : ( (p_assertions_failed > p_expected_failures || p_skipped ) - ? exit_test_failure - : exit_exception_failure ); -} - -//____________________________________________________________________________// - -void -test_results::operator+=( test_results const& tr ) -{ - p_assertions_passed.value += tr.p_assertions_passed; - p_assertions_failed.value += tr.p_assertions_failed; - p_warnings_failed.value += tr.p_warnings_failed; - p_test_cases_passed.value += tr.p_test_cases_passed; - p_test_cases_warned.value += tr.p_test_cases_warned; - p_test_cases_failed.value += tr.p_test_cases_failed; - p_test_cases_skipped.value += tr.p_test_cases_skipped; - p_test_cases_aborted.value += tr.p_test_cases_aborted; - p_duration_microseconds.value += tr.p_duration_microseconds; -} - -//____________________________________________________________________________// - -void -test_results::clear() -{ - p_assertions_passed.value = 0; - p_assertions_failed.value = 0; - p_warnings_failed.value = 0; - p_expected_failures.value = 0; - p_test_cases_passed.value = 0; - p_test_cases_warned.value = 0; - p_test_cases_failed.value = 0; - p_test_cases_skipped.value = 0; - p_test_cases_aborted.value = 0; - p_duration_microseconds.value= 0; - p_aborted.value = false; - p_skipped.value = false; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** results_collector ************** // -// ************************************************************************** // - -namespace { - -struct results_collector_impl { - std::map m_results_store; -}; - -results_collector_impl& s_rc_impl() { static results_collector_impl the_inst; return the_inst; } - -} // local namespace - -//____________________________________________________________________________// - -void -results_collector_t::test_start( counter_t ) -{ - s_rc_impl().m_results_store.clear(); -} - -//____________________________________________________________________________// - -void -results_collector_t::test_unit_start( test_unit const& tu ) -{ - // init test_results entry - test_results& tr = s_rc_impl().m_results_store[tu.p_id]; - - tr.clear(); - - tr.p_expected_failures.value = tu.p_expected_failures; -} - -//____________________________________________________________________________// - -class results_collect_helper : public test_tree_visitor { -public: - explicit results_collect_helper( test_results& tr, test_unit const& ts ) : m_tr( tr ), m_ts( ts ) {} - - void visit( test_case const& tc ) - { - test_results const& tr = results_collector.results( tc.p_id ); - m_tr += tr; - - if( tr.passed() ) { - if( tr.p_warnings_failed ) - m_tr.p_test_cases_warned.value++; - else - m_tr.p_test_cases_passed.value++; - } - else if( tr.p_skipped ) - m_tr.p_test_cases_skipped.value++; - else { - if( tr.p_aborted ) - m_tr.p_test_cases_aborted.value++; - - m_tr.p_test_cases_failed.value++; - } - } - bool test_suite_start( test_suite const& ts ) - { - if( m_ts.p_id == ts.p_id ) - return true; - - m_tr += results_collector.results( ts.p_id ); - return false; - } - -private: - // Data members - test_results& m_tr; - test_unit const& m_ts; -}; - -//____________________________________________________________________________// - -void -results_collector_t::test_unit_finish( test_unit const& tu, unsigned long elapsed_in_microseconds ) -{ - if( tu.p_type == TUT_SUITE ) { - results_collect_helper ch( s_rc_impl().m_results_store[tu.p_id], tu ); - - traverse_test_tree( tu, ch ); - } - else { - test_results & tr = s_rc_impl().m_results_store[tu.p_id]; - tr.p_duration_microseconds.value = elapsed_in_microseconds; - - bool num_failures_match = tr.p_aborted || tr.p_assertions_failed >= tr.p_expected_failures; - if( !num_failures_match ) - BOOST_TEST_FRAMEWORK_MESSAGE( "Test case " << tu.full_name() << " has fewer failures than expected" ); - - bool check_any_assertions = tr.p_aborted || (tr.p_assertions_failed != 0) || (tr.p_assertions_passed != 0); - if( !check_any_assertions ) - BOOST_TEST_FRAMEWORK_MESSAGE( "Test case " << tu.full_name() << " did not check any assertions" ); - } -} - -//____________________________________________________________________________// - -void -results_collector_t::test_unit_skipped( test_unit const& tu, const_string /*reason*/ ) -{ - test_results& tr = s_rc_impl().m_results_store[tu.p_id]; - - tr.clear(); - - tr.p_skipped.value = true; - - if( tu.p_type == TUT_SUITE ) { - test_case_counter tcc; - traverse_test_tree( tu, tcc ); - - tr.p_test_cases_skipped.value = tcc.p_count; - } -} - -//____________________________________________________________________________// - -void -results_collector_t::assertion_result( unit_test::assertion_result ar ) -{ - test_results& tr = s_rc_impl().m_results_store[framework::current_test_case_id()]; - - switch( ar ) { - case AR_PASSED: tr.p_assertions_passed.value++; break; - case AR_FAILED: tr.p_assertions_failed.value++; break; - case AR_TRIGGERED: tr.p_warnings_failed.value++; break; - } - - if( tr.p_assertions_failed == 1 ) - first_failed_assertion(); -} - -//____________________________________________________________________________// - -void -results_collector_t::exception_caught( execution_exception const& ) -{ - test_results& tr = s_rc_impl().m_results_store[framework::current_test_case_id()]; - - tr.p_assertions_failed.value++; -} - -//____________________________________________________________________________// - -void -results_collector_t::test_unit_aborted( test_unit const& tu ) -{ - s_rc_impl().m_results_store[tu.p_id].p_aborted.value = true; -} - -//____________________________________________________________________________// - -test_results const& -results_collector_t::results( test_unit_id id ) const -{ - return s_rc_impl().m_results_store[id]; -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER diff --git a/libraries/boost/include/boost/test/impl/results_reporter.ipp b/libraries/boost/include/boost/test/impl/results_reporter.ipp deleted file mode 100644 index 87c1172e12..0000000000 --- a/libraries/boost/include/boost/test/impl/results_reporter.ipp +++ /dev/null @@ -1,197 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : result reporting facilties -// *************************************************************************** - -#ifndef BOOST_TEST_RESULTS_REPORTER_IPP_020105GER -#define BOOST_TEST_RESULTS_REPORTER_IPP_020105GER - -// Boost.Test -#include -#include -#include - -#include -#include - -#include -#include -#include - -// Boost -#include -#include -typedef ::boost::io::ios_base_all_saver io_saver_type; - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace results_reporter { - -// ************************************************************************** // -// ************** result reporter implementation ************** // -// ************************************************************************** // - -namespace { - -struct results_reporter_impl : test_tree_visitor { - // Constructor - results_reporter_impl() - : m_stream( &std::cerr ) - , m_stream_state_saver( new io_saver_type( std::cerr ) ) - , m_report_level( CONFIRMATION_REPORT ) - , m_formatter( new output::plain_report_formatter ) - {} - - // test tree visitor interface implementation - void visit( test_case const& tc ) - { - m_formatter->test_unit_report_start( tc, *m_stream ); - m_formatter->test_unit_report_finish( tc, *m_stream ); - } - bool test_suite_start( test_suite const& ts ) - { - m_formatter->test_unit_report_start( ts, *m_stream ); - - if( m_report_level == DETAILED_REPORT && !results_collector.results( ts.p_id ).p_skipped ) - return true; - - m_formatter->test_unit_report_finish( ts, *m_stream ); - return false; - } - void test_suite_finish( test_suite const& ts ) - { - m_formatter->test_unit_report_finish( ts, *m_stream ); - } - - typedef scoped_ptr saver_ptr; - - // Data members - std::ostream* m_stream; - saver_ptr m_stream_state_saver; - report_level m_report_level; - scoped_ptr m_formatter; -}; - -results_reporter_impl& s_rr_impl() { static results_reporter_impl the_inst; return the_inst; } - -} // local namespace - -// ************************************************************************** // -// ************** report configuration ************** // -// ************************************************************************** // - -void -set_level( report_level l ) -{ - if( l != INV_REPORT_LEVEL ) - s_rr_impl().m_report_level = l; -} - -//____________________________________________________________________________// - -void -set_stream( std::ostream& ostr ) -{ - s_rr_impl().m_stream = &ostr; - s_rr_impl().m_stream_state_saver.reset( new io_saver_type( ostr ) ); -} - -//____________________________________________________________________________// - -std::ostream& -get_stream() -{ - return *s_rr_impl().m_stream; -} - -//____________________________________________________________________________// - -void -set_format( output_format rf ) -{ - switch( rf ) { - default: - case OF_CLF: - set_format( new output::plain_report_formatter ); - break; - case OF_XML: - set_format( new output::xml_report_formatter ); - break; - } -} - -//____________________________________________________________________________// - -void -set_format( results_reporter::format* f ) -{ - if( f ) - s_rr_impl().m_formatter.reset( f ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** report initiation ************** // -// ************************************************************************** // - -void -make_report( report_level l, test_unit_id id ) -{ - if( l == INV_REPORT_LEVEL ) - l = s_rr_impl().m_report_level; - - if( l == NO_REPORT ) - return; - - if( id == INV_TEST_UNIT_ID ) - id = framework::master_test_suite().p_id; - - s_rr_impl().m_stream_state_saver->restore(); - - report_level bkup = s_rr_impl().m_report_level; - s_rr_impl().m_report_level = l; - - s_rr_impl().m_formatter->results_report_start( *s_rr_impl().m_stream ); - - switch( l ) { - case CONFIRMATION_REPORT: - s_rr_impl().m_formatter->do_confirmation_report( framework::get( id ), *s_rr_impl().m_stream ); - break; - case SHORT_REPORT: - case DETAILED_REPORT: - traverse_test_tree( id, s_rr_impl() ); - break; - default: - break; - } - - s_rr_impl().m_formatter->results_report_finish( *s_rr_impl().m_stream ); - s_rr_impl().m_report_level = bkup; -} - -//____________________________________________________________________________// - -} // namespace results_reporter -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_RESULTS_REPORTER_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/test_framework_init_observer.ipp b/libraries/boost/include/boost/test/impl/test_framework_init_observer.ipp deleted file mode 100644 index 89f854aaed..0000000000 --- a/libraries/boost/include/boost/test/impl/test_framework_init_observer.ipp +++ /dev/null @@ -1,109 +0,0 @@ -// (c) Copyright Raffi Enficiaud 2017. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! An observer for monitoring the success/failure of the other observers -// *************************************************************************** - -#ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER -#define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER - -// Boost.Test -#include -#include -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** framework_init_observer_t ************** // -// ************************************************************************** // - -namespace { - -struct test_init_observer_check { - bool has_failure; - - void clear() - { - has_failure = false; - } -}; - - -test_init_observer_check& s_tioc_impl() { static test_init_observer_check the_inst; return the_inst; } - -} // local namespace - -void -framework_init_observer_t::clear() -{ - if(!framework::test_in_progress()) - s_tioc_impl().clear(); -} - -//____________________________________________________________________________// - -void -framework_init_observer_t::test_start( counter_t ) -{ - clear(); -} - -//____________________________________________________________________________// - -void -framework_init_observer_t::assertion_result( unit_test::assertion_result ar ) -{ - test_init_observer_check& tr = s_tioc_impl(); - switch( ar ) { - case AR_TRIGGERED: break; - case AR_PASSED: break; - case AR_FAILED: tr.has_failure = true; break; - default: - break; - } -} - -//____________________________________________________________________________// - -void -framework_init_observer_t::exception_caught( execution_exception const& ) -{ - test_init_observer_check& tr = s_tioc_impl(); - tr.has_failure = true; -} - -void -framework_init_observer_t::test_aborted() -{ - s_tioc_impl().has_failure = true; -} - - -//____________________________________________________________________________// - -bool -framework_init_observer_t::has_failed() const -{ - return s_tioc_impl().has_failure; -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_IPP_021105GER diff --git a/libraries/boost/include/boost/test/impl/test_main.ipp b/libraries/boost/include/boost/test/impl/test_main.ipp deleted file mode 100644 index 6adc5bb9c2..0000000000 --- a/libraries/boost/include/boost/test/impl/test_main.ipp +++ /dev/null @@ -1,65 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// (C) Copyright Beman Dawes 1995-2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Implements main function for Test Execution Monitor. -// *************************************************************************** - -#ifndef BOOST_TEST_TEST_MAIN_IPP_012205GER -#define BOOST_TEST_TEST_MAIN_IPP_012205GER - -// Boost.Test -#include -#include -#include - -// Boost -#include - -#include - -//____________________________________________________________________________// - -extern int test_main( int argc, char* argv[] ); // prototype for user's test_main() - -struct test_main_caller { - test_main_caller( int argc, char** argv ) : m_argc( argc ), m_argv( argv ) {} - - void operator()() { - int test_main_result = test_main( m_argc, m_argv ); - - // translate a test_main non-success return into a test error - BOOST_CHECK( test_main_result == 0 || test_main_result == boost::exit_success ); - } - -private: - // Data members - int m_argc; - char** m_argv; -}; - -// ************************************************************************** // -// ************** test main ************** // -// ************************************************************************** // - -::boost::unit_test::test_suite* -init_unit_test_suite( int argc, char* argv[] ) { - using namespace ::boost::unit_test; - - framework::master_test_suite().p_name.value = "Test Program"; - - framework::master_test_suite().add( BOOST_TEST_CASE( test_main_caller( argc, argv ) ) ); - - return 0; -} - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_TEST_MAIN_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/test_tools.ipp b/libraries/boost/include/boost/test/impl/test_tools.ipp deleted file mode 100644 index 2956879326..0000000000 --- a/libraries/boost/include/boost/test/impl/test_tools.ipp +++ /dev/null @@ -1,823 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : supplies offline implementation for the Test Tools -// *************************************************************************** - -#ifndef BOOST_TEST_TEST_TOOLS_IPP_012205GER -#define BOOST_TEST_TEST_TOOLS_IPP_012205GER - -// Boost.Test -#include -#include -#include - -#include -#include - -#include -#include -#include // execution_aborted - -#include - -#include - -// Boost -#include - -// STL -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// !! should we use #include -#include - -#include - -//____________________________________________________________________________// - -# ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::strcmp; using ::strlen; using ::isprint; } -#if !defined( BOOST_NO_CWCHAR ) -namespace std { using ::wcscmp; } -#endif -# endif - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** print_log_value ************** // -// ************************************************************************** // - -void -print_log_value::operator()( std::ostream& ostr, bool t ) -{ - ostr << std::boolalpha << t; -} - -void -print_log_value::operator()( std::ostream& ostr, char t ) -{ - if( (std::isprint)( static_cast(t) ) ) - ostr << '\'' << t << '\''; - else - ostr << std::hex -#if BOOST_TEST_USE_STD_LOCALE - << std::showbase -#else - << "0x" -#endif - << static_cast(t); -} - -//____________________________________________________________________________// - -void -print_log_value::operator()( std::ostream& ostr, unsigned char t ) -{ - ostr << std::hex - // showbase is only available for new style streams: -#if BOOST_TEST_USE_STD_LOCALE - << std::showbase -#else - << "0x" -#endif - << static_cast(t); -} - -//____________________________________________________________________________// - -void -print_log_value::operator()( std::ostream& ostr, char const* t ) -{ - ostr << ( t ? t : "null string" ); -} - -//____________________________________________________________________________// - -void -print_log_value::operator()( std::ostream& ostr, wchar_t const* t ) -{ - ostr << ( t ? t : L"null string" ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** TOOL BOX Implementation ************** // -// ************************************************************************** // - -using ::boost::unit_test::lazy_ostream; - -static char const* check_str [] = { " == ", " != ", " < " , " <= ", " > " , " >= " }; -static char const* rever_str [] = { " != ", " == ", " >= ", " > " , " <= ", " < " }; - -template -void -format_report( OutStream& os, assertion_result const& pr, unit_test::lazy_ostream const& assertion_descr, - tool_level tl, check_type ct, - std::size_t num_args, va_list args, - char const* prefix, char const* suffix ) -{ - using namespace unit_test; - - switch( ct ) { - case CHECK_PRED: - os << prefix << assertion_descr << suffix; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - - case CHECK_BUILT_ASSERTION: { - os << prefix << assertion_descr << suffix; - - if( tl != PASS ) { - const_string details_message = pr.message(); - - if( !details_message.is_empty() ) { - os << details_message; - } - } - break; - } - - case CHECK_MSG: - if( tl == PASS ) - os << prefix << "'" << assertion_descr << "'" << suffix; - else - os << assertion_descr; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - - case CHECK_EQUAL: - case CHECK_NE: - case CHECK_LT: - case CHECK_LE: - case CHECK_GT: - case CHECK_GE: { - char const* arg1_descr = va_arg( args, char const* ); - lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* ); - char const* arg2_descr = va_arg( args, char const* ); - lazy_ostream const* arg2_val = va_arg( args, lazy_ostream const* ); - - os << prefix << arg1_descr << check_str[ct-CHECK_EQUAL] << arg2_descr << suffix; - - if( tl != PASS ) - os << " [" << *arg1_val << rever_str[ct-CHECK_EQUAL] << *arg2_val << "]" ; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - } - - case CHECK_CLOSE: - case CHECK_CLOSE_FRACTION: { - char const* arg1_descr = va_arg( args, char const* ); - lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* ); - char const* arg2_descr = va_arg( args, char const* ); - lazy_ostream const* arg2_val = va_arg( args, lazy_ostream const* ); - /* toler_descr = */ va_arg( args, char const* ); - lazy_ostream const* toler_val = va_arg( args, lazy_ostream const* ); - - os << "difference{" << pr.message() - << "} between " << arg1_descr << "{" << *arg1_val - << "} and " << arg2_descr << "{" << *arg2_val - << ( tl == PASS ? "} doesn't exceed " : "} exceeds " ) - << *toler_val; - if( ct == CHECK_CLOSE ) - os << "%"; - break; - } - case CHECK_SMALL: { - char const* arg1_descr = va_arg( args, char const* ); - lazy_ostream const* arg1_val = va_arg( args, lazy_ostream const* ); - /* toler_descr = */ va_arg( args, char const* ); - lazy_ostream const* toler_val = va_arg( args, lazy_ostream const* ); - - os << "absolute value of " << arg1_descr << "{" << *arg1_val << "}" - << ( tl == PASS ? " doesn't exceed " : " exceeds " ) - << *toler_val; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - } - - case CHECK_PRED_WITH_ARGS: { - std::vector< std::pair > args_copy; - args_copy.reserve( num_args ); - for( std::size_t i = 0; i < num_args; ++i ) { - char const* desc = va_arg( args, char const* ); - lazy_ostream const* value = va_arg( args, lazy_ostream const* ); - args_copy.push_back( std::make_pair( desc, value ) ); - } - - os << prefix << assertion_descr; - - // print predicate call description - os << "( "; - for( std::size_t i = 0; i < num_args; ++i ) { - os << args_copy[i].first; - - if( i != num_args-1 ) - os << ", "; - } - os << " )" << suffix; - - if( tl != PASS ) { - os << " for ( "; - for( std::size_t i = 0; i < num_args; ++i ) { - os << *args_copy[i].second; - - if( i != num_args-1 ) - os << ", "; - } - os << " )"; - } - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - } - - case CHECK_EQUAL_COLL: { - char const* left_begin_descr = va_arg( args, char const* ); - char const* left_end_descr = va_arg( args, char const* ); - char const* right_begin_descr = va_arg( args, char const* ); - char const* right_end_descr = va_arg( args, char const* ); - - os << prefix << "{ " << left_begin_descr << ", " << left_end_descr << " } == { " - << right_begin_descr << ", " << right_end_descr << " }" - << suffix; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - } - - case CHECK_BITWISE_EQUAL: { - char const* left_descr = va_arg( args, char const* ); - char const* right_descr = va_arg( args, char const* ); - - os << prefix << left_descr << " =.= " << right_descr << suffix; - - if( !pr.has_empty_message() ) - os << ". " << pr.message(); - break; - } - } -} - -//____________________________________________________________________________// - -bool -report_assertion( assertion_result const& ar, - lazy_ostream const& assertion_descr, - const_string file_name, - std::size_t line_num, - tool_level tl, - check_type ct, - std::size_t num_args, ... ) -{ - using namespace unit_test; - - if( !framework::test_in_progress() ) { - // in case no test is in progress, we do not throw anything: - // raising an exception here may result in raising an exception in a destructor of a global fixture - // which will abort the process - // We flag this as aborted instead - - //BOOST_TEST_I_ASSRT( framework::current_test_case_id() != INV_TEST_UNIT_ID, - // std::runtime_error( "Can't use testing tools outside of test case implementation." ) ); - - framework::test_aborted(); - return false; - } - - - if( !!ar ) - tl = PASS; - - log_level ll; - char const* prefix; - char const* suffix; - - switch( tl ) { - case PASS: - ll = log_successful_tests; - prefix = "check "; - suffix = " has passed"; - break; - case WARN: - ll = log_warnings; - prefix = "condition "; - suffix = " is not satisfied"; - break; - case CHECK: - ll = log_all_errors; - prefix = "check "; - suffix = " has failed"; - break; - case REQUIRE: - ll = log_fatal_errors; - prefix = "critical check "; - suffix = " has failed"; - break; - default: - return true; - } - - unit_test_log << unit_test::log::begin( file_name, line_num ) << ll; - va_list args; - va_start( args, num_args ); - - format_report( unit_test_log, ar, assertion_descr, tl, ct, num_args, args, prefix, suffix ); - - va_end( args ); - unit_test_log << unit_test::log::end(); - - switch( tl ) { - case PASS: - framework::assertion_result( AR_PASSED ); - return true; - - case WARN: - framework::assertion_result( AR_TRIGGERED ); - return false; - - case CHECK: - framework::assertion_result( AR_FAILED ); - return false; - - case REQUIRE: - framework::assertion_result( AR_FAILED ); - framework::test_unit_aborted( framework::current_test_unit() ); - BOOST_TEST_I_THROW( execution_aborted() ); - return false; - } - - return true; -} - -//____________________________________________________________________________// - -assertion_result -format_assertion_result( const_string expr_val, const_string details ) -{ - assertion_result res(false); - - bool starts_new_line = first_char( expr_val ) == '\n'; - - if( !starts_new_line && !expr_val.is_empty() ) - res.message().stream() << " [" << expr_val << "]"; - - if( !details.is_empty() ) { - if( first_char(details) != '[' ) - res.message().stream() << ". "; - else - res.message().stream() << " "; - - res.message().stream() << details; - } - - if( starts_new_line ) - res.message().stream() << "." << expr_val; - - return res; -} - -//____________________________________________________________________________// - -BOOST_TEST_DECL std::string -prod_report_format( assertion_result const& ar, unit_test::lazy_ostream const& assertion_descr, check_type ct, std::size_t num_args, ... ) -{ - std::ostringstream msg_buff; - - va_list args; - va_start( args, num_args ); - - format_report( msg_buff, ar, assertion_descr, CHECK, ct, num_args, args, "assertion ", " failed" ); - - va_end( args ); - - return msg_buff.str(); -} - -//____________________________________________________________________________// - -assertion_result -equal_impl( char const* left, char const* right ) -{ - return (left && right) ? std::strcmp( left, right ) == 0 : (left == right); -} - -//____________________________________________________________________________// - -#if !defined( BOOST_NO_CWCHAR ) - -assertion_result -equal_impl( wchar_t const* left, wchar_t const* right ) -{ - return (left && right) ? std::wcscmp( left, right ) == 0 : (left == right); -} - -#endif // !defined( BOOST_NO_CWCHAR ) - -//____________________________________________________________________________// - -bool -is_defined_impl( const_string symbol_name, const_string symbol_value ) -{ - symbol_value.trim_left( 2 ); - return symbol_name != symbol_value; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** context_frame ************** // -// ************************************************************************** // - -context_frame::context_frame( ::boost::unit_test::lazy_ostream const& context_descr ) -: m_frame_id( unit_test::framework::add_context( context_descr, true ) ) -{ -} - -//____________________________________________________________________________// - -context_frame::~context_frame() -{ - unit_test::framework::clear_context( m_frame_id ); -} - -//____________________________________________________________________________// - -context_frame::operator bool() -{ - return true; -} - -//____________________________________________________________________________// - -} // namespace tt_detail - -// ************************************************************************** // -// ************** output_test_stream ************** // -// ************************************************************************** // - -struct output_test_stream::Impl -{ - std::fstream m_pattern; - bool m_match_or_save; - bool m_text_or_binary; - std::string m_synced_string; - - char get_char() - { - char res = 0; - do { - m_pattern.get( res ); - } while( m_text_or_binary && res == '\r' && !m_pattern.fail() && !m_pattern.eof() ); - - return res; - } - - void check_and_fill( assertion_result& res ) - { - if( !res.p_predicate_value ) - res.message() << "Output content: \"" << m_synced_string << '\"'; - } -}; - -//____________________________________________________________________________// - -output_test_stream::output_test_stream( const_string pattern_file_name, bool match_or_save, bool text_or_binary ) -: m_pimpl( new Impl ) -{ - if( !pattern_file_name.is_empty() ) { - std::ios::openmode m = match_or_save ? std::ios::in : std::ios::out; - if( !text_or_binary ) - m |= std::ios::binary; - - m_pimpl->m_pattern.open( pattern_file_name.begin(), m ); - - if( !m_pimpl->m_pattern.is_open() ) - BOOST_TEST_FRAMEWORK_MESSAGE( "Can't open pattern file " << pattern_file_name << " for " << (match_or_save ? "reading" : "writing") ); - } - - m_pimpl->m_match_or_save = match_or_save; - m_pimpl->m_text_or_binary = text_or_binary; -} - -//____________________________________________________________________________// - -output_test_stream::~output_test_stream() -{ - delete m_pimpl; -} - -//____________________________________________________________________________// - -assertion_result -output_test_stream::is_empty( bool flush_stream ) -{ - sync(); - - assertion_result res( m_pimpl->m_synced_string.empty() ); - - m_pimpl->check_and_fill( res ); - - if( flush_stream ) - flush(); - - return res; -} - -//____________________________________________________________________________// - -assertion_result -output_test_stream::check_length( std::size_t length_, bool flush_stream ) -{ - sync(); - - assertion_result res( m_pimpl->m_synced_string.length() == length_ ); - - m_pimpl->check_and_fill( res ); - - if( flush_stream ) - flush(); - - return res; -} - -//____________________________________________________________________________// - -assertion_result -output_test_stream::is_equal( const_string arg, bool flush_stream ) -{ - sync(); - - assertion_result res( const_string( m_pimpl->m_synced_string ) == arg ); - - m_pimpl->check_and_fill( res ); - - if( flush_stream ) - flush(); - - return res; -} - -//____________________________________________________________________________// - -std::string pretty_print_log(std::string str) { - - static const std::string to_replace[] = { "\r", "\n" }; - static const std::string replacement[] = { "\\r", "\\n" }; - - return unit_test::utils::replace_all_occurrences_of( - str, - to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]), - replacement, replacement + sizeof(replacement)/sizeof(replacement[0])); -} - -assertion_result -output_test_stream::match_pattern( bool flush_stream ) -{ - const std::string::size_type n_chars_presuffix = 10; - sync(); - - assertion_result result( true ); - - const std::string stream_string_repr = get_stream_string_representation(); - - if( !m_pimpl->m_pattern.is_open() ) { - result = false; - result.message() << "Pattern file can't be opened!"; - } - else { - if( m_pimpl->m_match_or_save ) { - - int offset = 0; - std::vector last_elements; - for ( std::string::size_type i = 0; static_cast(i + offset) < static_cast(stream_string_repr.length()); ++i ) { - - char c = m_pimpl->get_char(); - - if( last_elements.size() <= n_chars_presuffix ) { - last_elements.push_back( c ); - } - else { - last_elements[ i % last_elements.size() ] = c; - } - - bool is_same = !m_pimpl->m_pattern.fail() && - !m_pimpl->m_pattern.eof() && - (stream_string_repr[i+offset] == c); - - if( !is_same ) { - - result = false; - - std::string::size_type prefix_size = (std::min)( i + offset, n_chars_presuffix ); - - std::string::size_type suffix_size = (std::min)( stream_string_repr.length() - i - offset, - n_chars_presuffix ); - - // try to log area around the mismatch - std::string substr = stream_string_repr.substr(0, i+offset); - std::size_t line = std::count(substr.begin(), substr.end(), '\n'); - std::size_t column = i + offset - substr.rfind('\n'); - - result.message() - << "Mismatch at position " << i - << " (line " << line - << ", column " << column - << "): '" << pretty_print_log(std::string(1, stream_string_repr[i+offset])) << "' != '" << pretty_print_log(std::string(1, c)) << "' :\n"; - - // we already escape this substring because we need its actual size for the pretty print - // of the difference location. - std::string sub_str_prefix(pretty_print_log(stream_string_repr.substr( i + offset - prefix_size, prefix_size ))); - - // we need this substring as is because we compute the best matching substrings on it. - std::string sub_str_suffix(stream_string_repr.substr( i + offset, suffix_size)); - result.message() << "... " << sub_str_prefix + pretty_print_log(sub_str_suffix) << " ..." << '\n'; - - result.message() << "... "; - for( std::size_t j = 0; j < last_elements.size() ; j++ ) - result.message() << pretty_print_log(std::string(1, last_elements[(i + j + 1) % last_elements.size()])); - - std::vector last_elements_ordered; - last_elements_ordered.push_back(c); - for( std::string::size_type counter = 0; counter < suffix_size - 1 ; counter++ ) { - char c2 = m_pimpl->get_char(); - - if( m_pimpl->m_pattern.fail() || m_pimpl->m_pattern.eof() ) - break; - - result.message() << pretty_print_log(std::string(1, c2)); - - last_elements_ordered.push_back(c2); - } - - // tries to find the best substring matching in the remainder of the - // two strings - std::size_t max_nb_char_in_common = 0; - std::size_t best_pattern_start_index = 0; - std::size_t best_stream_start_index = 0; - for( std::size_t pattern_start_index = best_pattern_start_index; - pattern_start_index < last_elements_ordered.size(); - pattern_start_index++ ) { - for( std::size_t stream_start_index = best_stream_start_index; - stream_start_index < sub_str_suffix.size(); - stream_start_index++ ) { - - std::size_t max_size = (std::min)( last_elements_ordered.size() - pattern_start_index, sub_str_suffix.size() - stream_start_index ); - if( max_nb_char_in_common > max_size ) - break; // safely break to go to the outer loop - - std::size_t nb_char_in_common = 0; - for( std::size_t k = 0; k < max_size; k++) { - if( last_elements_ordered[pattern_start_index + k] == sub_str_suffix[stream_start_index + k] ) - nb_char_in_common ++; - else - break; // we take fully matching substring only - } - - if( nb_char_in_common > max_nb_char_in_common ) { - max_nb_char_in_common = nb_char_in_common; - best_pattern_start_index = pattern_start_index; - best_stream_start_index = stream_start_index; - } - } - } - - // indicates with more precision the location of the mismatchs in "ascii arts" ... - result.message() << " ...\n... "; - for( std::string::size_type j = 0; j < sub_str_prefix.size(); j++) { - result.message() << ' '; - } - - result.message() << '~'; // places the first tilde at the current char that mismatches - - for( std::size_t k = 1; k < (std::max)(best_pattern_start_index, best_stream_start_index); k++ ) { // 1 is for the current char c - std::string s1(pretty_print_log(std::string(1, last_elements_ordered[(std::min)(k, best_pattern_start_index)]))); - std::string s2(pretty_print_log(std::string(1, sub_str_suffix[(std::min)(k, best_stream_start_index)]))); - for( int h = (std::max)(s1.size(), s2.size()); h > 0; h--) - result.message() << "~"; - } - - if( m_pimpl->m_pattern.eof() ) { - result.message() << " (reference string shorter than current stream)"; - } - - result.message() << "\n"; - - // no need to continue if the EOF is reached - if( m_pimpl->m_pattern.eof() ) { - break; - } - - // first char is a replicat of c, so we do not copy it. - for(std::string::size_type counter = 0; counter < last_elements_ordered.size() - 1 ; counter++) - last_elements[ (i + 1 + counter) % last_elements.size() ] = last_elements_ordered[counter + 1]; - - i += last_elements_ordered.size()-1; - offset += best_stream_start_index - best_pattern_start_index; - - } - - } - - // not needed anymore - /* - if(offset > 0 && false) { - m_pimpl->m_pattern.ignore( - static_cast( offset )); - } - */ - } - else { - m_pimpl->m_pattern.write( stream_string_repr.c_str(), - static_cast( stream_string_repr.length() ) ); - m_pimpl->m_pattern.flush(); - } - } - - if( flush_stream ) - flush(); - - return result; -} - -//____________________________________________________________________________// - -void -output_test_stream::flush() -{ - m_pimpl->m_synced_string.erase(); - -#ifndef BOOST_NO_STRINGSTREAM - str( std::string() ); -#else - seekp( 0, std::ios::beg ); -#endif -} - - -std::string -output_test_stream::get_stream_string_representation() const { - return m_pimpl->m_synced_string; -} - -//____________________________________________________________________________// - -std::size_t -output_test_stream::length() -{ - sync(); - - return m_pimpl->m_synced_string.length(); -} - -//____________________________________________________________________________// - -void -output_test_stream::sync() -{ -#ifdef BOOST_NO_STRINGSTREAM - m_pimpl->m_synced_string.assign( str(), pcount() ); - freeze( false ); -#else - m_pimpl->m_synced_string = str(); -#endif -} - -//____________________________________________________________________________// - -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TEST_TOOLS_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/test_tree.ipp b/libraries/boost/include/boost/test/impl/test_tree.ipp deleted file mode 100644 index e0839e3dd1..0000000000 --- a/libraries/boost/include/boost/test/impl/test_tree.ipp +++ /dev/null @@ -1,504 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Provides core implementation for Unit Test Framework. -/// Extensions can be provided in separate files -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER -#define BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER - -// Boost.Test -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include - -// Boost -#include - -// STL -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_unit ************** // -// ************************************************************************** // - -test_unit::test_unit( const_string name, const_string file_name, std::size_t line_num, test_unit_type t ) -: p_type( t ) -, p_type_name( t == TUT_CASE ? "case" : "suite" ) -, p_file_name( file_name ) -, p_line_num( line_num ) -, p_id( INV_TEST_UNIT_ID ) -, p_parent_id( INV_TEST_UNIT_ID ) -, p_name( std::string( name.begin(), name.size() ) ) -, p_timeout( 0 ) -, p_expected_failures( 0 ) -, p_default_status( RS_INHERIT ) -, p_run_status( RS_INVALID ) -, p_sibling_rank(0) -{ -} - -//____________________________________________________________________________// - -test_unit::test_unit( const_string module_name ) -: p_type( TUT_SUITE ) -, p_type_name( "module" ) -, p_line_num( 0 ) -, p_id( INV_TEST_UNIT_ID ) -, p_parent_id( INV_TEST_UNIT_ID ) -, p_name( std::string( module_name.begin(), module_name.size() ) ) -, p_timeout( 0 ) -, p_expected_failures( 0 ) -, p_default_status( RS_INHERIT ) -, p_run_status( RS_INVALID ) -, p_sibling_rank(0) -{ -} - -//____________________________________________________________________________// - -test_unit::~test_unit() -{ - framework::deregister_test_unit( this ); -} - -//____________________________________________________________________________// - -void -test_unit::depends_on( test_unit* tu ) -{ - BOOST_TEST_SETUP_ASSERT( p_id != framework::master_test_suite().p_id, - "Can't add dependency to the master test suite" ); - - p_dependencies.value.push_back( tu->p_id ); -} - -//____________________________________________________________________________// - -void -test_unit::add_precondition( precondition_t const& pc ) -{ - p_preconditions.value.push_back( pc ); -} - -//____________________________________________________________________________// - -test_tools::assertion_result -test_unit::check_preconditions() const -{ - BOOST_TEST_FOREACH( test_unit_id, dep_id, p_dependencies.get() ) { - test_unit const& dep = framework::get( dep_id, TUT_ANY ); - - if( !dep.is_enabled() ) { - test_tools::assertion_result res(false); - res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << "\" is disabled"; - return res; - } - - test_results const& test_rslt = unit_test::results_collector.results( dep_id ); - if( !test_rslt.passed() ) { - test_tools::assertion_result res(false); - res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << "\" has failed"; - return res; - } - - if( test_rslt.p_test_cases_skipped > 0 ) { - test_tools::assertion_result res(false); - res.message() << "dependency test " << dep.p_type_name << " \"" << dep.full_name() << "\" has skipped test cases"; - return res; - } - } - - BOOST_TEST_FOREACH( precondition_t, precondition, p_preconditions.get() ) { - test_tools::assertion_result res = precondition( p_id ); - if( !res ) { - test_tools::assertion_result res_out(false); - res_out.message() << "precondition failed"; - if( !res.has_empty_message() ) - res_out.message() << ": " << res.message(); - return res_out; - } - } - - return true; -} - -//____________________________________________________________________________// - -void -test_unit::increase_exp_fail( counter_t num ) -{ - p_expected_failures.value += num; - - if( p_parent_id != INV_TEST_UNIT_ID ) - framework::get( p_parent_id ).increase_exp_fail( num ); -} - -//____________________________________________________________________________// - -std::string -test_unit::full_name() const -{ - if( p_parent_id == INV_TEST_UNIT_ID || p_parent_id == framework::master_test_suite().p_id ) - return p_name; - - std::string res = framework::get( p_parent_id ).full_name(); - res.append("/"); - - res.append( p_name ); - - return res; -} - -//____________________________________________________________________________// - -void -test_unit::add_label( const_string l ) -{ - p_labels.value.push_back( std::string() + l ); -} - -//____________________________________________________________________________// - -bool -test_unit::has_label( const_string l ) const -{ - return std::find( p_labels->begin(), p_labels->end(), l ) != p_labels->end(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** test_case ************** // -// ************************************************************************** // - -test_case::test_case( const_string name, boost::function const& test_func ) -: test_unit( name, "", 0, static_cast(type) ) -, p_test_func( test_func ) -{ - framework::register_test_unit( this ); -} - -//____________________________________________________________________________// - -test_case::test_case( const_string name, const_string file_name, std::size_t line_num, boost::function const& test_func ) -: test_unit( name, file_name, line_num, static_cast(type) ) -, p_test_func( test_func ) -{ - framework::register_test_unit( this ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** test_suite ************** // -// ************************************************************************** // - -//____________________________________________________________________________// - -test_suite::test_suite( const_string name, const_string file_name, std::size_t line_num ) -: test_unit( ut_detail::normalize_test_case_name( name ), file_name, line_num, static_cast(type) ) -{ - framework::register_test_unit( this ); -} - -//____________________________________________________________________________// - -test_suite::test_suite( const_string module_name ) -: test_unit( module_name ) -{ - framework::register_test_unit( this ); -} - -//____________________________________________________________________________// - -void -test_suite::add( test_unit* tu, counter_t expected_failures, unsigned timeout ) -{ - // check for clashing names #12597 - for( test_unit_id_list::const_iterator it(m_children.begin()), ite(m_children.end()); - it < ite; - ++it) { - BOOST_TEST_SETUP_ASSERT( tu->p_name != framework::get(*it, TUT_ANY).p_name, - "test unit with name '" + tu->p_name.value + std::string("' registered multiple times") ); - } - - tu->p_timeout.value = timeout; - - m_children.push_back( tu->p_id ); - tu->p_parent_id.value = p_id; - - if( tu->p_expected_failures != 0 ) - increase_exp_fail( tu->p_expected_failures ); - - if( expected_failures ) - tu->increase_exp_fail( expected_failures ); -} - -//____________________________________________________________________________// - -void -test_suite::add( test_unit_generator const& gen, unsigned timeout ) -{ - test_unit* tu; - while((tu = gen.next()) != 0) - add( tu, 0, timeout ); -} - -//____________________________________________________________________________// - -void -test_suite::add( test_unit_generator const& gen, decorator::collector& decorators ) -{ - test_unit* tu; - while((tu = gen.next()) != 0) { - decorators.store_in( *tu ); - add( tu, 0 ); - } - - decorators.reset(); -} - -//____________________________________________________________________________// - -void -test_suite::remove( test_unit_id id ) -{ - test_unit_id_list::iterator it = std::find( m_children.begin(), m_children.end(), id ); - - if( it != m_children.end() ) - m_children.erase( it ); -} - -//____________________________________________________________________________// - -test_unit_id -test_suite::get( const_string tu_name ) const -{ - BOOST_TEST_FOREACH( test_unit_id, id, m_children ) { - if( tu_name == framework::get( id, ut_detail::test_id_2_unit_type( id ) ).p_name.get() ) - return id; - } - - return INV_TEST_UNIT_ID; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** master_test_suite ************** // -// ************************************************************************** // - -master_test_suite_t::master_test_suite_t() -: test_suite( "Master Test Suite" ) -, argc( 0 ) -, argv( 0 ) -{ - p_default_status.value = RS_ENABLED; -} - -// ************************************************************************** // -// ************** traverse_test_tree ************** // -// ************************************************************************** // - -void -traverse_test_tree( test_case const& tc, test_tree_visitor& V, bool ignore_status ) -{ - if( tc.is_enabled() || ignore_status ) - V.visit( tc ); -} - -//____________________________________________________________________________// - -void -traverse_test_tree( test_suite const& suite, test_tree_visitor& V, bool ignore_status ) -{ - // skip disabled test suite unless we asked to ignore this condition - if( !ignore_status && !suite.is_enabled() ) - return; - - // Invoke test_suite_start callback - if( !V.test_suite_start( suite ) ) - return; - - // Recurse into children - std::size_t total_children = suite.m_children.size(); - for( std::size_t i=0; i < total_children; ) { - // this statement can remove the test unit from this list - traverse_test_tree( suite.m_children[i], V, ignore_status ); - if( total_children > suite.m_children.size() ) - total_children = suite.m_children.size(); - else - ++i; - } - - // Invoke test_suite_finish callback - V.test_suite_finish( suite ); -} - -//____________________________________________________________________________// - -void -traverse_test_tree( test_unit_id id, test_tree_visitor& V, bool ignore_status ) -{ - if( ut_detail::test_id_2_unit_type( id ) == TUT_CASE ) - traverse_test_tree( framework::get( id ), V, ignore_status ); - else - traverse_test_tree( framework::get( id ), V, ignore_status ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** object generators ************** // -// ************************************************************************** // - -namespace ut_detail { - -std::string -normalize_test_case_name( const_string name ) -{ - std::string norm_name( name.begin(), name.size() ); - - if( name[0] == '&' ) - norm_name = norm_name.substr( 1 ); - - // trim spaces - std::size_t first_not_space = norm_name.find_first_not_of(' '); - if( first_not_space ) { - norm_name.erase(0, first_not_space); - } - - std::size_t last_not_space = norm_name.find_last_not_of(' '); - if( last_not_space !=std::string::npos ) { - norm_name.erase(last_not_space + 1); - } - - // sanitize all chars that might be used in runtime filters - static const char to_replace[] = { ':', '*', '@', '+', '!', '/' }; - for(std::size_t index = 0; - index < sizeof(to_replace)/sizeof(to_replace[0]); - index++) { - std::replace(norm_name.begin(), norm_name.end(), to_replace[index], '_'); - } - - return norm_name; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** auto_test_unit_registrar ************** // -// ************************************************************************** // - -auto_test_unit_registrar::auto_test_unit_registrar( test_case* tc, decorator::collector& decorators, counter_t exp_fail ) -{ - framework::current_auto_test_suite().add( tc, exp_fail ); - - decorators.store_in( *tc ); - decorators.reset(); -} - -//____________________________________________________________________________// - -auto_test_unit_registrar::auto_test_unit_registrar( const_string ts_name, const_string ts_file, std::size_t ts_line, decorator::collector& decorators ) -{ - test_unit_id id = framework::current_auto_test_suite().get( ts_name ); - - test_suite* ts; - - if( id != INV_TEST_UNIT_ID ) { - ts = &framework::get( id ); - BOOST_ASSERT( ts->p_parent_id == framework::current_auto_test_suite().p_id ); - } - else { - ts = new test_suite( ts_name, ts_file, ts_line ); - framework::current_auto_test_suite().add( ts ); - } - - decorators.store_in( *ts ); - decorators.reset(); - - framework::current_auto_test_suite( ts ); -} - -//____________________________________________________________________________// - -auto_test_unit_registrar::auto_test_unit_registrar( test_unit_generator const& tc_gen, decorator::collector& decorators ) -{ - framework::current_auto_test_suite().add( tc_gen, decorators ); -} - -//____________________________________________________________________________// - -auto_test_unit_registrar::auto_test_unit_registrar( int ) -{ - framework::current_auto_test_suite( 0, false ); -} - -//____________________________________________________________________________// - -} // namespace ut_detail - -// ************************************************************************** // -// ************** global_fixture ************** // -// ************************************************************************** // - -global_fixture::global_fixture() -{ - framework::register_global_fixture( *this ); -} - -global_fixture::~global_fixture() -{ - framework::deregister_global_fixture( *this ); -} - -// ************************************************************************** // -// ************** global_configuration ************** // -// ************************************************************************** // - -global_configuration::global_configuration() -{ - framework::register_observer( *this ); -} - -global_configuration::~global_configuration() -{ - framework::deregister_observer( *this ); -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/unit_test_log.ipp b/libraries/boost/include/boost/test/impl/unit_test_log.ipp deleted file mode 100644 index 2a6c0f4bc6..0000000000 --- a/libraries/boost/include/boost/test/impl/unit_test_log.ipp +++ /dev/null @@ -1,691 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implemets Unit Test Log -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER -#define BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER - -// Boost.Test -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -// Boost -#include -#include -typedef ::boost::io::ios_base_all_saver io_saver_type; - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** entry_value_collector ************** // -// ************************************************************************** // - -namespace ut_detail { - -entry_value_collector const& -entry_value_collector::operator<<( lazy_ostream const& v ) const -{ - unit_test_log << v; - - return *this; -} - -//____________________________________________________________________________// - -entry_value_collector const& -entry_value_collector::operator<<( const_string v ) const -{ - unit_test_log << v; - - return *this; -} - -//____________________________________________________________________________// - -entry_value_collector::~entry_value_collector() -{ - if( m_last ) - unit_test_log << log::end(); -} - -//____________________________________________________________________________// - -} // namespace ut_detail - -// ************************************************************************** // -// ************** unit_test_log ************** // -// ************************************************************************** // - -namespace { - -// log data -struct unit_test_log_data_helper_impl { - typedef boost::shared_ptr formatter_ptr; - typedef boost::shared_ptr saver_ptr; - - bool m_enabled; - output_format m_format; - std::ostream* m_stream; - saver_ptr m_stream_state_saver; - formatter_ptr m_log_formatter; - bool m_entry_in_progress; - - unit_test_log_data_helper_impl(unit_test_log_formatter* p_log_formatter, output_format format, bool enabled = false) - : m_enabled( enabled ) - , m_format( format ) - , m_stream( &std::cout ) - , m_stream_state_saver( new io_saver_type( std::cout ) ) - , m_log_formatter() - , m_entry_in_progress( false ) - { - m_log_formatter.reset(p_log_formatter); - m_log_formatter->set_log_level(log_all_errors); - } - - // helper functions - std::ostream& stream() - { - return *m_stream; - } - - log_level get_log_level() const - { - return m_log_formatter->get_log_level(); - } -}; - -struct unit_test_log_impl { - // Constructor - unit_test_log_impl() - { - m_log_formatter_data.push_back( unit_test_log_data_helper_impl(new output::compiler_log_formatter, OF_CLF, true) ); // only this one is active by default, - m_log_formatter_data.push_back( unit_test_log_data_helper_impl(new output::xml_log_formatter, OF_XML, false) ); - m_log_formatter_data.push_back( unit_test_log_data_helper_impl(new output::junit_log_formatter, OF_JUNIT, false) ); - } - - typedef std::vector v_formatter_data_t; - v_formatter_data_t m_log_formatter_data; - - // entry data - log_entry_data m_entry_data; - - bool has_entry_in_progress() const { - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl const&, current_logger_data, m_log_formatter_data ) { - if( current_logger_data.m_entry_in_progress ) - return true; - } - return false; - } - - // check point data - log_checkpoint_data m_checkpoint_data; - - void set_checkpoint( const_string file, std::size_t line_num, const_string msg ) - { - assign_op( m_checkpoint_data.m_message, msg, 0 ); - m_checkpoint_data.m_file_name = file; - m_checkpoint_data.m_line_num = line_num; - } -}; - -unit_test_log_impl& s_log_impl() { static unit_test_log_impl the_inst; return the_inst; } - -} // local namespace - -//____________________________________________________________________________// - -void -unit_test_log_t::test_start( counter_t test_cases_amount ) -{ - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() == log_nothing ) - continue; - - current_logger_data.m_log_formatter->log_start( current_logger_data.stream(), test_cases_amount ); - - if( runtime_config::get( runtime_config::btrt_build_info ) ) - current_logger_data.m_log_formatter->log_build_info( current_logger_data.stream() ); - - //current_logger_data.stream().flush(); - - current_logger_data.m_entry_in_progress = false; - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::test_finish() -{ - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() == log_nothing ) - continue; - - current_logger_data.m_log_formatter->log_finish( current_logger_data.stream() ); - - current_logger_data.stream().flush(); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::test_aborted() -{ - BOOST_TEST_LOG_ENTRY( log_messages ) << "Test is aborted"; -} - -//____________________________________________________________________________// - -void -unit_test_log_t::test_unit_start( test_unit const& tu ) -{ - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) - continue; - current_logger_data.m_log_formatter->test_unit_start( current_logger_data.stream(), tu ); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::test_unit_finish( test_unit const& tu, unsigned long elapsed ) -{ - s_log_impl().m_checkpoint_data.clear(); - - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) - continue; - - current_logger_data.m_log_formatter->test_unit_finish( current_logger_data.stream(), tu, elapsed ); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::test_unit_skipped( test_unit const& tu, const_string reason ) -{ - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) - continue; - - current_logger_data.m_log_formatter->test_unit_skipped( current_logger_data.stream(), tu, reason ); - } -} - -void -unit_test_log_t::test_unit_aborted( test_unit const& tu ) -{ - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) - continue; - - current_logger_data.m_log_formatter->test_unit_aborted(current_logger_data.stream(), tu ); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::exception_caught( execution_exception const& ex ) -{ - log_level l = - ex.code() <= execution_exception::cpp_exception_error ? log_cpp_exception_errors : - (ex.code() <= execution_exception::timeout_error ? log_system_errors - : log_fatal_errors ); - - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - - if( current_logger_data.m_enabled && l >= current_logger_data.get_log_level() ) { - - current_logger_data.m_log_formatter->log_exception_start( current_logger_data.stream(), s_log_impl().m_checkpoint_data, ex ); - - log_entry_context( l ); - - current_logger_data.m_log_formatter->log_exception_finish( current_logger_data.stream() ); - } - } - clear_entry_context(); -} - -//____________________________________________________________________________// - -void -unit_test_log_t::set_checkpoint( const_string file, std::size_t line_num, const_string msg ) -{ - s_log_impl().set_checkpoint( file, line_num, msg ); -} - -//____________________________________________________________________________// - -char -set_unix_slash( char in ) -{ - return in == '\\' ? '/' : in; -} - -unit_test_log_t& -unit_test_log_t::operator<<( log::begin const& b ) -{ - if( s_log_impl().has_entry_in_progress() ) - *this << log::end(); - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled ) { - current_logger_data.m_stream_state_saver->restore(); - } - } - - s_log_impl().m_entry_data.clear(); - - assign_op( s_log_impl().m_entry_data.m_file_name, b.m_file_name, 0 ); - - // normalize file name - std::transform( s_log_impl().m_entry_data.m_file_name.begin(), s_log_impl().m_entry_data.m_file_name.end(), - s_log_impl().m_entry_data.m_file_name.begin(), - &set_unix_slash ); - - s_log_impl().m_entry_data.m_line_num = b.m_line_num; - - return *this; -} - -//____________________________________________________________________________// - -unit_test_log_t& -unit_test_log_t::operator<<( log::end const& ) -{ - if( s_log_impl().has_entry_in_progress() ) { - log_entry_context( s_log_impl().m_entry_data.m_level ); - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled && current_logger_data.m_entry_in_progress ) { - current_logger_data.m_log_formatter->log_entry_finish( current_logger_data.stream() ); - } - current_logger_data.m_entry_in_progress = false; - } - } - - clear_entry_context(); - - return *this; -} - -//____________________________________________________________________________// - -unit_test_log_t& -unit_test_log_t::operator<<( log_level l ) -{ - s_log_impl().m_entry_data.m_level = l; - - return *this; -} - -//____________________________________________________________________________// - -ut_detail::entry_value_collector -unit_test_log_t::operator()( log_level l ) -{ - *this << l; - - return ut_detail::entry_value_collector(); -} - -//____________________________________________________________________________// - -bool -unit_test_log_t::log_entry_start(output_format log_format) -{ - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - - if( current_logger_data.m_format != log_format ) - continue; - - if( current_logger_data.m_entry_in_progress ) - return true; - - if( !current_logger_data.m_enabled ) - return false; - - switch( s_log_impl().m_entry_data.m_level ) { - case log_successful_tests: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_INFO ); - break; - case log_messages: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_MESSAGE ); - break; - case log_warnings: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_WARNING ); - break; - case log_all_errors: - case log_cpp_exception_errors: - case log_system_errors: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_ERROR ); - break; - case log_fatal_errors: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR ); - break; - case log_nothing: - case log_test_units: - case invalid_log_level: - return false; - } - - current_logger_data.m_entry_in_progress = true; - return true; - } - - return false; -} - -//____________________________________________________________________________// - -unit_test_log_t& -unit_test_log_t::operator<<( const_string value ) -{ - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled && s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() && !value.empty() && log_entry_start(current_logger_data.m_format) ) - current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value ); - - } - return *this; -} - -//____________________________________________________________________________// - -unit_test_log_t& -unit_test_log_t::operator<<( lazy_ostream const& value ) -{ - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled && s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() && !value.empty() ) { - if( log_entry_start(current_logger_data.m_format) ) { - current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value ); - } - } - } - return *this; -} - -//____________________________________________________________________________// - -void -unit_test_log_t::log_entry_context( log_level l ) -{ - framework::context_generator const& context = framework::get_context(); - if( context.is_empty() ) - return; - - const_string frame; - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled ) { - current_logger_data.m_log_formatter->entry_context_start( current_logger_data.stream(), l ); - } - } - - while( !(frame=context.next()).is_empty() ) - { - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled ) { - current_logger_data.m_log_formatter->log_entry_context( current_logger_data.stream(), l, frame ); - } - } - } - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled ) { - current_logger_data.m_log_formatter->entry_context_finish( current_logger_data.stream(), l ); - } - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::clear_entry_context() -{ - framework::clear_context(); -} - -//____________________________________________________________________________// - -void -unit_test_log_t::set_stream( std::ostream& str ) -{ - if( s_log_impl().has_entry_in_progress() ) - return; - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - current_logger_data.m_stream = &str; - current_logger_data.m_stream_state_saver.reset( new io_saver_type( str ) ); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::set_stream( output_format log_format, std::ostream& str ) -{ - if( s_log_impl().has_entry_in_progress() ) - return; - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_format == log_format) { - current_logger_data.m_stream = &str; - current_logger_data.m_stream_state_saver.reset( new io_saver_type( str ) ); - break; - } - } -} - -std::ostream* -unit_test_log_t::get_stream( output_format log_format ) const -{ - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_format == log_format) { - return current_logger_data.m_stream; - } - } - return 0; -} - -//____________________________________________________________________________// - -void -unit_test_log_t::set_threshold_level( log_level lev ) -{ - if( s_log_impl().has_entry_in_progress() || lev == invalid_log_level ) - return; - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - current_logger_data.m_log_formatter->set_log_level( lev ); - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::set_threshold_level( output_format log_format, log_level lev ) -{ - if( s_log_impl().has_entry_in_progress() || lev == invalid_log_level ) - return; - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_format == log_format) { - current_logger_data.m_log_formatter->set_log_level( lev ); - break; - } - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::set_format( output_format log_format ) -{ - if( s_log_impl().has_entry_in_progress() ) - return; - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - current_logger_data.m_enabled = current_logger_data.m_format == log_format; - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::add_format( output_format log_format ) -{ - if( s_log_impl().has_entry_in_progress() ) - return; - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_format == log_format) { - current_logger_data.m_enabled = true; - break; - } - } -} - -//____________________________________________________________________________// - -unit_test_log_formatter* -unit_test_log_t::get_formatter( output_format log_format ) { - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_format == log_format) { - return current_logger_data.m_log_formatter.get(); - } - } - return 0; -} - - -void -unit_test_log_t::add_formatter( unit_test_log_formatter* the_formatter ) -{ - // remove only user defined logger - for(unit_test_log_impl::v_formatter_data_t::iterator it(s_log_impl().m_log_formatter_data.begin()), - ite(s_log_impl().m_log_formatter_data.end()); - it != ite; - ++it) - { - if( it->m_format == OF_CUSTOM_LOGGER) { - s_log_impl().m_log_formatter_data.erase(it); - break; - } - } - - if( the_formatter ) { - s_log_impl().m_log_formatter_data.push_back( unit_test_log_data_helper_impl(the_formatter, OF_CUSTOM_LOGGER, true) ); - } -} - -void -unit_test_log_t::set_formatter( unit_test_log_formatter* the_formatter ) -{ - // remove only user defined logger - log_level current_level = invalid_log_level; - std::ostream *current_stream = 0; - output_format previous_format = OF_INVALID; - for(unit_test_log_impl::v_formatter_data_t::iterator it(s_log_impl().m_log_formatter_data.begin()), - ite(s_log_impl().m_log_formatter_data.end()); - it != ite; - ++it) - { - if( it->m_enabled ) { - if( current_level == invalid_log_level || it->m_format < previous_format || it->m_format == OF_CUSTOM_LOGGER) { - current_level = it->get_log_level(); - current_stream = &(it->stream()); - previous_format = it->m_format; - } - } - } - - if( the_formatter ) { - add_formatter(the_formatter); - set_format(OF_CUSTOM_LOGGER); - set_threshold_level(OF_CUSTOM_LOGGER, current_level); - set_stream(OF_CUSTOM_LOGGER, *current_stream); - } -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** unit_test_log_formatter ************** // -// ************************************************************************** // - -void -unit_test_log_formatter::log_entry_value( std::ostream& ostr, lazy_ostream const& value ) -{ - log_entry_value( ostr, (wrap_stringstream().ref() << value).str() ); -} - -void -unit_test_log_formatter::set_log_level(log_level new_log_level) -{ - m_log_level = new_log_level; -} - -log_level -unit_test_log_formatter::get_log_level() const -{ - return m_log_level; -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER - diff --git a/libraries/boost/include/boost/test/impl/unit_test_main.ipp b/libraries/boost/include/boost/test/impl/unit_test_main.ipp deleted file mode 100644 index 1780c6b93b..0000000000 --- a/libraries/boost/include/boost/test/impl/unit_test_main.ipp +++ /dev/null @@ -1,293 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : main function implementation for Unit Test Framework -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER -#define BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER - -// Boost.Test -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -// Boost -#include - -// STL -#include -#include -#include -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -namespace ut_detail { - -// ************************************************************************** // -// ************** hrf_content_reporter ************** // -// ************************************************************************** // - -struct hrf_content_reporter : test_tree_visitor { - explicit hrf_content_reporter( std::ostream& os ) : m_os( os ), m_indent( -4 ) {} // skip master test suite - -private: - void report_test_unit( test_unit const& tu ) - { - m_os << std::setw( m_indent ) << "" << tu.p_name; - m_os << (tu.p_default_status == test_unit::RS_ENABLED ? "*" : " "); - //m_os << '[' << tu.p_sibling_rank << ']'; - if( !tu.p_description->empty() ) - m_os << ": " << tu.p_description; - - m_os << "\n"; - } - virtual void visit( test_case const& tc ) { report_test_unit( tc ); } - virtual bool test_suite_start( test_suite const& ts ) - { - if( m_indent >= 0 ) - report_test_unit( ts ); - m_indent += 4; - return true; - } - virtual void test_suite_finish( test_suite const& ) - { - m_indent -= 4; - } - - // Data members - std::ostream& m_os; - int m_indent; -}; - -// ************************************************************************** // -// ************** dot_content_reporter ************** // -// ************************************************************************** // - -struct dot_content_reporter : test_tree_visitor { - explicit dot_content_reporter( std::ostream& os ) : m_os( os ) {} - -private: - void report_test_unit( test_unit const& tu ) - { - bool master_ts = tu.p_parent_id == INV_TEST_UNIT_ID; - - m_os << "tu" << tu.p_id; - - m_os << (master_ts ? "[shape=ellipse,peripheries=2" : "[shape=Mrecord" ); - - m_os << ",fontname=Helvetica"; - - m_os << (tu.p_default_status == test_unit::RS_ENABLED ? ",color=green" : ",color=yellow"); - - if( master_ts ) - m_os << ",label=\"" << tu.p_name << "\"];\n"; - else { - m_os << ",label=\"" << tu.p_name << "|" << tu.p_file_name << "(" << tu.p_line_num << ")"; - if( tu.p_timeout > 0 ) - m_os << "|timeout=" << tu.p_timeout; - if( tu.p_expected_failures != 0 ) - m_os << "|expected failures=" << tu.p_expected_failures; - if( !tu.p_labels->empty() ) { - m_os << "|labels:"; - - BOOST_TEST_FOREACH( std::string const&, l, tu.p_labels.get() ) - m_os << " @" << l; - } - m_os << "\"];\n"; - } - - if( !master_ts ) - m_os << "tu" << tu.p_parent_id << " -> " << "tu" << tu.p_id << ";\n"; - - BOOST_TEST_FOREACH( test_unit_id, dep_id, tu.p_dependencies.get() ) { - test_unit const& dep = framework::get( dep_id, TUT_ANY ); - - m_os << "tu" << tu.p_id << " -> " << "tu" << dep.p_id << "[color=red,style=dotted,constraint=false];\n"; - } - - } - virtual void visit( test_case const& tc ) - { - report_test_unit( tc ); - } - virtual bool test_suite_start( test_suite const& ts ) - { - if( ts.p_parent_id == INV_TEST_UNIT_ID ) - m_os << "digraph G {rankdir=LR;\n"; - - report_test_unit( ts ); - - m_os << "{\n"; - - return true; - } - virtual void test_suite_finish( test_suite const& ts ) - { - m_os << "}\n"; - if( ts.p_parent_id == INV_TEST_UNIT_ID ) - m_os << "}\n"; - } - - std::ostream& m_os; -}; - -// ************************************************************************** // -// ************** labels_collector ************** // -// ************************************************************************** // - -struct labels_collector : test_tree_visitor { - std::set const& labels() const { return m_labels; } - -private: - virtual bool visit( test_unit const& tu ) - { - m_labels.insert( tu.p_labels->begin(), tu.p_labels->end() ); - return true; - } - - // Data members - std::set m_labels; -}; - -} // namespace ut_detail - -// ************************************************************************** // -// ************** unit_test_main ************** // -// ************************************************************************** // - -int BOOST_TEST_DECL -unit_test_main( init_unit_test_func init_func, int argc, char* argv[] ) -{ - int result_code = 0; - - BOOST_TEST_I_TRY { - framework::init( init_func, argc, argv ); - - if( runtime_config::get( runtime_config::btrt_wait_for_debugger ) ) { - results_reporter::get_stream() << "Press any key to continue..." << std::endl; - - // getchar is defined as a macro in uClibc. Use parenthesis to fix - // gcc bug 58952 for gcc <= 4.8.2. - (std::getchar)(); - results_reporter::get_stream() << "Continuing..." << std::endl; - } - - framework::finalize_setup_phase(); - - output_format list_cont = runtime_config::get( runtime_config::btrt_list_content ); - if( list_cont != unit_test::OF_INVALID ) { - if( list_cont == unit_test::OF_DOT ) { - ut_detail::dot_content_reporter reporter( results_reporter::get_stream() ); - - traverse_test_tree( framework::master_test_suite().p_id, reporter, true ); - } - else { - ut_detail::hrf_content_reporter reporter( results_reporter::get_stream() ); - - traverse_test_tree( framework::master_test_suite().p_id, reporter, true ); - } - - return boost::exit_success; - } - - if( runtime_config::get( runtime_config::btrt_list_labels ) ) { - ut_detail::labels_collector collector; - - traverse_test_tree( framework::master_test_suite().p_id, collector, true ); - - results_reporter::get_stream() << "Available labels:\n "; - std::copy( collector.labels().begin(), collector.labels().end(), - std::ostream_iterator( results_reporter::get_stream(), "\n " ) ); - results_reporter::get_stream() << "\n"; - - return boost::exit_success; - } - - framework::run(); - - result_code = !runtime_config::get( runtime_config::btrt_result_code ) - ? boost::exit_success - : results_collector.results( framework::master_test_suite().p_id ).result_code(); - } - BOOST_TEST_I_CATCH( framework::nothing_to_test, ex ) { - result_code = ex.m_result_code; - } - BOOST_TEST_I_CATCH( framework::internal_error, ex ) { - results_reporter::get_stream() << "Boost.Test framework internal error: " << ex.what() << std::endl; - - result_code = boost::exit_exception_failure; - } - BOOST_TEST_I_CATCH( framework::setup_error, ex ) { - results_reporter::get_stream() << "Test setup error: " << ex.what() << std::endl; - - result_code = boost::exit_exception_failure; - } - BOOST_TEST_I_CATCHALL() { - results_reporter::get_stream() << "Boost.Test framework internal error: unknown reason" << std::endl; - - result_code = boost::exit_exception_failure; - } - - framework::shutdown(); - - return result_code; -} - -} // namespace unit_test -} // namespace boost - -#if !defined(BOOST_TEST_DYN_LINK) && !defined(BOOST_TEST_NO_MAIN) - -// ************************************************************************** // -// ************** main function for tests using lib ************** // -// ************************************************************************** // - -int BOOST_TEST_CALL_DECL -main( int argc, char* argv[] ) -{ - // prototype for user's unit test init function -#ifdef BOOST_TEST_ALTERNATIVE_INIT_API - extern bool init_unit_test(); - - boost::unit_test::init_unit_test_func init_func = &init_unit_test; -#else - extern ::boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] ); - - boost::unit_test::init_unit_test_func init_func = &init_unit_test_suite; -#endif - - return ::boost::unit_test::unit_test_main( init_func, argc, argv ); -} - -#endif // !BOOST_TEST_DYN_LINK && !BOOST_TEST_NO_MAIN - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/unit_test_monitor.ipp b/libraries/boost/include/boost/test/impl/unit_test_monitor.ipp deleted file mode 100644 index cfb41a239c..0000000000 --- a/libraries/boost/include/boost/test/impl/unit_test_monitor.ipp +++ /dev/null @@ -1,75 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements specific subclass of Executon Monitor used by Unit -// Test Framework to monitor test cases run. -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER -#define BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER - -// Boost.Test -#include -#include -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** unit_test_monitor ************** // -// ************************************************************************** // - -unit_test_monitor_t::error_level -unit_test_monitor_t::execute_and_translate( boost::function const& func, unsigned timeout ) -{ - BOOST_TEST_I_TRY { - p_catch_system_errors.value = runtime_config::get( runtime_config::btrt_catch_sys_errors ); - p_timeout.value = timeout; - p_auto_start_dbg.value = runtime_config::get( runtime_config::btrt_auto_start_dbg ); - p_use_alt_stack.value = runtime_config::get( runtime_config::btrt_use_alt_stack ); - p_detect_fp_exceptions.value = runtime_config::get( runtime_config::btrt_detect_fp_except ); - - vexecute( func ); - } - BOOST_TEST_I_CATCH( execution_exception, ex ) { - framework::exception_caught( ex ); - framework::test_unit_aborted( framework::current_test_unit() ); - - // translate execution_exception::error_code to error_level - switch( ex.code() ) { - case execution_exception::no_error: return test_ok; - case execution_exception::user_error: return unexpected_exception; - case execution_exception::cpp_exception_error: return unexpected_exception; - case execution_exception::system_error: return os_exception; - case execution_exception::timeout_error: return os_timeout; - case execution_exception::user_fatal_error: - case execution_exception::system_fatal_error: return fatal_error; - default: return unexpected_exception; - } - } - - return test_ok; -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/unit_test_parameters.ipp b/libraries/boost/include/boost/test/impl/unit_test_parameters.ipp deleted file mode 100644 index 428c10116f..0000000000 --- a/libraries/boost/include/boost/test/impl/unit_test_parameters.ipp +++ /dev/null @@ -1,772 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : simple implementation for Unit Test Framework parameter -// handling routines. May be rewritten in future to use some kind of -// command-line arguments parsing facility and environment variable handling -// facility -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER -#define BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER - -// Boost.Test -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include - -// Boost.Runtime.Param -#include -#include -#include -#include -#include - -// Boost -#include -#include -#include -#include - -// STL -#include -#include -#include - -#include - -//____________________________________________________________________________// - -# ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::getenv; using ::strncmp; using ::strcmp; } -# endif - -namespace boost { -namespace unit_test { - -namespace rt = boost::runtime; - -// ************************************************************************** // -// ************** runtime_config ************** // -// ************************************************************************** // - -namespace runtime_config { - -// UTF parameters -std::string btrt_auto_start_dbg = "auto_start_dbg"; -std::string btrt_break_exec_path = "break_exec_path"; -std::string btrt_build_info = "build_info"; -std::string btrt_catch_sys_errors = "catch_system_errors"; -std::string btrt_color_output = "color_output"; -std::string btrt_detect_fp_except = "detect_fp_exceptions"; -std::string btrt_detect_mem_leaks = "detect_memory_leaks"; -std::string btrt_list_content = "list_content"; -std::string btrt_list_labels = "list_labels"; -std::string btrt_log_format = "log_format"; -std::string btrt_log_level = "log_level"; -std::string btrt_log_sink = "log_sink"; -std::string btrt_combined_logger = "logger"; -std::string btrt_output_format = "output_format"; -std::string btrt_random_seed = "random"; -std::string btrt_report_format = "report_format"; -std::string btrt_report_level = "report_level"; -std::string btrt_report_mem_leaks = "report_memory_leaks_to"; -std::string btrt_report_sink = "report_sink"; -std::string btrt_result_code = "result_code"; -std::string btrt_run_filters = "run_test"; -std::string btrt_save_test_pattern = "save_pattern"; -std::string btrt_show_progress = "show_progress"; -std::string btrt_use_alt_stack = "use_alt_stack"; -std::string btrt_wait_for_debugger = "wait_for_debugger"; - -std::string btrt_help = "help"; -std::string btrt_usage = "usage"; -std::string btrt_version = "version"; - -//____________________________________________________________________________// - -namespace { - -void -register_parameters( rt::parameters_store& store ) -{ - rt::option auto_start_dbg( btrt_auto_start_dbg, ( - rt::description = "Automatically attaches debugger in case of system level failure (signal).", - rt::env_var = "BOOST_TEST_AUTO_START_DBG", - - rt::help = "Specifies whether Boost.Test should attempt " - "to attach a debugger when fatal system error occurs. At the moment this feature " - "is only available on a few selected platforms: Win32 and *nix. There is a " - "default debugger configured for these platforms. You can manually configure " - "different debugger. For more details on how to configure the debugger see the " - "Boost.Test debug API, specifically the function boost::debug::set_debugger." - )); - - auto_start_dbg.add_cla_id( "--", btrt_auto_start_dbg, "=" ); - auto_start_dbg.add_cla_id( "-", "d", " " ); - store.add( auto_start_dbg ); - - /////////////////////////////////////////////// - - rt::parameter break_exec_path( btrt_break_exec_path, ( - rt::description = "For the exception safety testing allows to break at specific execution path.", - rt::env_var = "BOOST_TEST_BREAK_EXEC_PATH" -#ifndef BOOST_NO_CXX11_LAMBDAS - , - rt::callback = [](rt::cstring) { - BOOST_TEST_SETUP_ASSERT( false, "parameter break_exec_path is disabled in this release" ); - } -#endif - )); - - break_exec_path.add_cla_id( "--", btrt_break_exec_path, "=" ); - store.add( break_exec_path ); - - /////////////////////////////////////////////// - - rt::option build_info( btrt_build_info, ( - rt::description = "Displays library build information.", - rt::env_var = "BOOST_TEST_BUILD_INFO", - rt::help = "Displays library build information, including: platform, " - "compiler, STL version and Boost version." - )); - - build_info.add_cla_id( "--", btrt_build_info, "=" ); - build_info.add_cla_id( "-", "i", " " ); - store.add( build_info ); - - /////////////////////////////////////////////// - - rt::option catch_sys_errors( btrt_catch_sys_errors, ( - rt::description = "Allows to switch between catching and ignoring system errors (signals).", - rt::env_var = "BOOST_TEST_CATCH_SYSTEM_ERRORS", - rt::default_value = -#ifdef BOOST_TEST_DEFAULTS_TO_CORE_DUMP - false, -#else - true, -#endif - rt::help = "If option " + btrt_catch_sys_errors + " has value 'no' the frameworks does not attempt to catch " - "asynchronous system failure events (signals on *NIX platforms or structured exceptions on Windows). " - " Default value is " -#ifdef BOOST_TEST_DEFAULTS_TO_CORE_DUMP - "no." -#else - "true." -#endif - )); - - catch_sys_errors.add_cla_id( "--", btrt_catch_sys_errors, "=", true ); - catch_sys_errors.add_cla_id( "-", "s", " " ); - store.add( catch_sys_errors ); - - /////////////////////////////////////////////// - - rt::option color_output( btrt_color_output, ( - rt::description = "Enables color output of the framework log and report messages.", - rt::env_var = "BOOST_TEST_COLOR_OUTPUT", - rt::default_value = true, - rt::help = "Produces color output for logs, reports and help. " - "Defaults to true. " - )); - - color_output.add_cla_id( "--", btrt_color_output, "=", true ); - color_output.add_cla_id( "-", "x", " " ); - store.add( color_output ); - - /////////////////////////////////////////////// - - rt::option detect_fp_except( btrt_detect_fp_except, ( - rt::description = "Enables/disables floating point exceptions traps.", - rt::env_var = "BOOST_TEST_DETECT_FP_EXCEPTIONS", - rt::help = "Enables/disables hardware traps for the floating " - "point exceptions (if supported on your platfrom)." - )); - - detect_fp_except.add_cla_id( "--", btrt_detect_fp_except, "=", true ); - store.add( detect_fp_except ); - - /////////////////////////////////////////////// - - rt::parameter detect_mem_leaks( btrt_detect_mem_leaks, ( - rt::description = "Turns on/off memory leaks detection (optionally breaking on specified alloc order number).", - rt::env_var = "BOOST_TEST_DETECT_MEMORY_LEAK", - rt::default_value = 1L, - rt::optional_value = 1L, - rt::value_hint = "", - rt::help = "Enables/disables memory leaks detection. " - "This parameter has optional long integer value. The default value is 1, which " - "enables the memory leak detection. The value 0 disables memory leak detection. " - "Any value N greater than 1 is treated as leak allocation number and tells the " - "framework to setup runtime breakpoint at Nth heap allocation. If value is " - "omitted the default value is assumed." - )); - - detect_mem_leaks.add_cla_id( "--", btrt_detect_mem_leaks, "=" ); - store.add( detect_mem_leaks ); - - /////////////////////////////////////////////// - - rt::enum_parameter list_content( btrt_list_content, ( - rt::description = "Lists the content of test tree - names of all test suites and test cases.", - rt::env_var = "BOOST_TEST_LIST_CONTENT", - rt::default_value = OF_INVALID, - rt::optional_value = OF_CLF, - rt::enum_values::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "HRF", OF_CLF }, - { "DOT", OF_DOT } - }, -#else - rt::enum_values_list() - ( "HRF", OF_CLF ) - ( "DOT", OF_DOT ) - , -#endif - rt::help = "Lists the test suites and cases " - "of the test module instead of executing the test cases. The format of the " - "desired output can be passed to the command. Currently the " - "framework supports two formats: human readable format (HRF) and dot graph " - "format (DOT). If value is omitted HRF value is assumed." - )); - list_content.add_cla_id( "--", btrt_list_content, "=" ); - store.add( list_content ); - - /////////////////////////////////////////////// - - rt::option list_labels( btrt_list_labels, ( - rt::description = "Lists all available labels.", - rt::env_var = "BOOST_TEST_LIST_LABELS", - rt::help = "Option " + btrt_list_labels + " instructs the framework to list all the the labels " - "defined in the test module instead of executing the test cases." - )); - - list_labels.add_cla_id( "--", btrt_list_labels, "=" ); - store.add( list_labels ); - - /////////////////////////////////////////////// - - rt::enum_parameter log_format( btrt_log_format, ( - rt::description = "Specifies log format.", - rt::env_var = "BOOST_TEST_LOG_FORMAT", - rt::default_value = OF_CLF, - rt::enum_values::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "HRF", OF_CLF }, - { "CLF", OF_CLF }, - { "XML", OF_XML }, - { "JUNIT", OF_JUNIT }, - }, -#else - rt::enum_values_list() - ( "HRF", OF_CLF ) - ( "CLF", OF_CLF ) - ( "XML", OF_XML ) - ( "JUNIT", OF_JUNIT ) - , -#endif - rt::help = "Set the frameowrk's log format to one " - "of the formats supplied by the framework. The only acceptable values for this " - "parameter are the names of the output formats supplied by the framework. By " - "default the framework uses human readable format (HRF) for testing log. This " - "format is similar to compiler error format. Alternatively you can specify XML " - "or JUNIT as log format, which are easier to process by testing automation tools." - )); - - log_format.add_cla_id( "--", btrt_log_format, "=" ); - log_format.add_cla_id( "-", "f", " " ); - store.add( log_format ); - - /////////////////////////////////////////////// - - rt::enum_parameter log_level( btrt_log_level, ( - rt::description = "Specifies the logging level of the test execution.", - rt::env_var = "BOOST_TEST_LOG_LEVEL", - rt::default_value = log_all_errors, - rt::enum_values::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "all" , log_successful_tests }, - { "success" , log_successful_tests }, - { "test_suite" , log_test_units }, - { "unit_scope" , log_test_units }, - { "message" , log_messages }, - { "warning" , log_warnings }, - { "error" , log_all_errors }, - { "cpp_exception" , log_cpp_exception_errors }, - { "system_error" , log_system_errors }, - { "fatal_error" , log_fatal_errors }, - { "nothing" , log_nothing } - }, -#else - rt::enum_values_list() - ( "all" , log_successful_tests ) - ( "success" , log_successful_tests ) - ( "test_suite" , log_test_units ) - ( "unit_scope" , log_test_units ) - ( "message" , log_messages ) - ( "warning" , log_warnings ) - ( "error" , log_all_errors ) - ( "cpp_exception" , log_cpp_exception_errors ) - ( "system_error" , log_system_errors ) - ( "fatal_error" , log_fatal_errors ) - ( "nothing" , log_nothing ) - , -#endif - rt::help = "Set the framework's log level. " - "The log level defines the verbosity of the testing logs produced by a test " - "module. The verbosity ranges from a complete log, when all assertions " - "(both successful and failing) are reported, all notifications about " - "test units start and finish are included, to an empty log when nothing " - "is reported to a testing log stream." - )); - - log_level.add_cla_id( "--", btrt_log_level, "=" ); - log_level.add_cla_id( "-", "l", " " ); - store.add( log_level ); - - /////////////////////////////////////////////// - - rt::parameter log_sink( btrt_log_sink, ( - rt::description = "Specifies log sink: stdout (default), stderr or file name.", - rt::env_var = "BOOST_TEST_LOG_SINK", - rt::value_hint = "", - rt::help = "Sets the log sink - the location " - "where Boost.Test writes the logs of the test execution. it allows to easily redirect the " - "test logs to file or standard streams. By default testing log is " - "directed to standard output." - )); - - log_sink.add_cla_id( "--", btrt_log_sink, "=" ); - log_sink.add_cla_id( "-", "k", " " ); - store.add( log_sink ); - - /////////////////////////////////////////////// - - rt::enum_parameter output_format( btrt_output_format, ( - rt::description = "Specifies output format (both log and report).", - rt::env_var = "BOOST_TEST_OUTPUT_FORMAT", - rt::enum_values::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "HRF", OF_CLF }, - { "CLF", OF_CLF }, - { "XML", OF_XML } - }, -#else - rt::enum_values_list() - ( "HRF", OF_CLF ) - ( "CLF", OF_CLF ) - ( "XML", OF_XML ) - , -#endif - rt::help = "Combines an effect of " + btrt_report_format + - " and " + btrt_log_format + " parameters. This parameter has higher priority " - "than either one of them. In other words if this parameter is specified " - "it overrides the value of other two parameters. This parameter does not " - "have a default value. The only acceptable values are string names of " - "output formats: HRF - human readable format and XML - XML formats for " - "automation tools processing." - )); - - output_format.add_cla_id( "--", btrt_output_format, "=" ); - output_format.add_cla_id( "-", "o", " " ); - store.add( output_format ); - - /////////////////////////////////////////////// combined logger option - - rt::parameter combined_logger( btrt_combined_logger, ( - rt::description = "Specifies log level and sink for one or several log format", - rt::env_var = "BOOST_TEST_LOGGER", - rt::value_hint = "log_format,log_level,log_sink[:log_format,log_level,log_sink]", - rt::help = "Specify one or more logging definition, which include the logger type, level and sink. " - "The log format, level and sink follow the same format as for the argument '--" + btrt_log_format + - "', '--" + btrt_log_level + "' and '--" + btrt_log_sink + "' respetively. " - "This command can take several logging definition separated by a ':', or be repeated " - "on the command line." - )); - - combined_logger.add_cla_id( "--", btrt_combined_logger, "=" ); - store.add( combined_logger ); - - /////////////////////////////////////////////// - - rt::parameter random_seed( btrt_random_seed, ( - rt::description = "Allows to switch between sequential and random order of test units execution." - " Optionally allows to specify concrete seed for random number generator.", - rt::env_var = "BOOST_TEST_RANDOM", - rt::default_value = 0U, - rt::optional_value = 1U, - rt::value_hint = "", - rt::help = "Instructs the framework to execute the " - "test cases in random order. This parameter accepts an optional unsigned " - "integer argument. If parameter is specified without the argument value testing " - "order is randomized based on current time. Alternatively you can specify " - "any positive value greater than 1 and it will be used as random seed for " - "the run. " - "By default, the test cases are executed in an " - "order defined by their declaration and the optional dependencies among the test units." - )); - - random_seed.add_cla_id( "--", btrt_random_seed, "=" ); - store.add( random_seed ); - - /////////////////////////////////////////////// - - rt::enum_parameter report_format( btrt_report_format, ( - rt::description = "Specifies the test report format.", - rt::env_var = "BOOST_TEST_REPORT_FORMAT", - rt::default_value = OF_CLF, - rt::enum_values::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "HRF", OF_CLF }, - { "CLF", OF_CLF }, - { "XML", OF_XML } - }, -#else - rt::enum_values_list() - ( "HRF", OF_CLF ) - ( "CLF", OF_CLF ) - ( "XML", OF_XML ) - , -#endif - rt::help = "Set the framework's report format " - "to one of the formats supplied by the framework. The only acceptable values " - "for this parameter are the names of the output formats. By default the framework " - "uses human readable format (HRF) for results reporting. Alternatively you can " - "specify XML as report format. This format is easier to process by testing " - "automation tools." - )); - - report_format.add_cla_id( "--", btrt_report_format, "=" ); - report_format.add_cla_id( "-", "m", " " ); - store.add( report_format ); - - /////////////////////////////////////////////// - - rt::enum_parameter report_level( btrt_report_level, ( - rt::description = "Specifies test report level.", - rt::env_var = "BOOST_TEST_REPORT_LEVEL", - rt::default_value = CONFIRMATION_REPORT, - rt::enum_values::value = -#if defined(BOOST_TEST_CLA_NEW_API) - { - { "confirm", CONFIRMATION_REPORT }, - { "short", SHORT_REPORT }, - { "detailed", DETAILED_REPORT }, - { "no", NO_REPORT } - }, -#else - rt::enum_values_list() - ( "confirm", CONFIRMATION_REPORT ) - ( "short", SHORT_REPORT ) - ( "detailed", DETAILED_REPORT ) - ( "no", NO_REPORT ) - , -#endif - rt::help = "Set the verbosity level of the " - "result report generated by the testing framework. Use value 'no' to " - "disable the results report completely." - )); - - report_level.add_cla_id( "--", btrt_report_level, "=" ); - report_level.add_cla_id( "-", "r", " " ); - store.add( report_level ); - - /////////////////////////////////////////////// - - rt::parameter report_mem_leaks( btrt_report_mem_leaks, ( - rt::description = "File where to report memory leaks to.", - rt::env_var = "BOOST_TEST_REPORT_MEMORY_LEAKS_TO", - rt::default_value = std::string(), - rt::value_hint = "", - rt::help = "Parameter " + btrt_report_mem_leaks + " allows to specify a file where to report " - "memory leaks to. The parameter does not have default value. If it is not specified, " - "memory leaks (if any) are reported to the standard error stream." - )); - - report_mem_leaks.add_cla_id( "--", btrt_report_mem_leaks, "=" ); - store.add( report_mem_leaks ); - - /////////////////////////////////////////////// - - rt::parameter report_sink( btrt_report_sink, ( - rt::description = "Specifies report sink: stderr(default), stdout or file name.", - rt::env_var = "BOOST_TEST_REPORT_SINK", - rt::value_hint = "", - rt::help = "Sets the result report sink - " - "the location where the framework writes the result report to. " - "The sink may be a a file or a standard " - "stream. The default is 'stderr': the " - "standard error stream." - )); - - report_sink.add_cla_id( "--", btrt_report_sink, "=" ); - report_sink.add_cla_id( "-", "e", " " ); - store.add( report_sink ); - - /////////////////////////////////////////////// - - rt::option result_code( btrt_result_code, ( - rt::description = "Disables test modules's result code generation.", - rt::env_var = "BOOST_TEST_RESULT_CODE", - rt::default_value = true, - rt::help = "The 'no' argument value for the parameter " + btrt_result_code + " instructs the " - "framework to always return zero result code. This can be used for test programs " - "executed within IDE. By default this parameter has value 'yes'." - )); - - result_code.add_cla_id( "--", btrt_result_code, "=", true ); - result_code.add_cla_id( "-", "c", " " ); - store.add( result_code ); - - /////////////////////////////////////////////// - - rt::parameter tests_to_run( btrt_run_filters, ( - rt::description = "Filters which tests to execute.", - rt::env_var = "BOOST_TEST_RUN_FILTERS", - rt::value_hint = "", - rt::help = "Filters which test units to execute. " - "The framework supports both 'selection filters', which allow to select " - "which test units to enable from the set of available test units, and 'disabler " - "filters', which allow to disable some test units. Boost.test also supports " - "enabling/disabling test units at compile time. These settings identify the default " - "set of test units to run. Parameter " + btrt_run_filters + " is used to change this default. " - "This parameter is repeatable, so you can specify more than one filter if necessary." - )); - - tests_to_run.add_cla_id( "--", btrt_run_filters, "=" ); - tests_to_run.add_cla_id( "-", "t", " " ); - store.add( tests_to_run ); - - /////////////////////////////////////////////// - - rt::option save_test_pattern( btrt_save_test_pattern, ( - rt::description = "Allows to switch between saving or matching test pattern file.", - rt::env_var = "BOOST_TEST_SAVE_PATTERN", - rt::help = "Parameter " + btrt_save_test_pattern + " facilitates switching mode of operation for " - "testing output streams.\n\nThis parameter serves no particular purpose within the " - "framework itself. It can be used by test modules relying on output_test_stream to " - "implement testing logic. Default mode is 'match' (false)." - )); - - save_test_pattern.add_cla_id( "--", btrt_save_test_pattern, "=" ); - store.add( save_test_pattern ); - - /////////////////////////////////////////////// - - rt::option show_progress( btrt_show_progress, ( - rt::description = "Turns on progress display.", - rt::env_var = "BOOST_TEST_SHOW_PROGRESS", - rt::help = "Instructs the framework to display the progress of the tests. " - "This feature is turned off by default." - )); - - show_progress.add_cla_id( "--", btrt_show_progress, "=" ); - show_progress.add_cla_id( "-", "p", " " ); - store.add( show_progress ); - - /////////////////////////////////////////////// - - rt::option use_alt_stack( btrt_use_alt_stack, ( - rt::description = "Turns on/off usage of an alternative stack for signal handling.", - rt::env_var = "BOOST_TEST_USE_ALT_STACK", - rt::default_value = true, - rt::help = "Instructs the framework to use an alternative " - "stack for operating system's signals handling (on platforms where this is supported). " - "The feature is enabled by default, but can be disabled using this command line switch." - )); - - use_alt_stack.add_cla_id( "--", btrt_use_alt_stack, "=", true ); - store.add( use_alt_stack ); - - /////////////////////////////////////////////// - - rt::option wait_for_debugger( btrt_wait_for_debugger, ( - rt::description = "Forces test module to wait for button to be pressed before starting test run.", - rt::env_var = "BOOST_TEST_WAIT_FOR_DEBUGGER", - rt::help = "Instructs the framework to pause before starting " - "test units execution, so that you can attach a debugger to the test module process. " - "This feature is turned off by default." - )); - - wait_for_debugger.add_cla_id( "--", btrt_wait_for_debugger, "=" ); - wait_for_debugger.add_cla_id( "-", "w", " " ); - store.add( wait_for_debugger ); - - /////////////////////////////////////////////// - - rt::parameter help( btrt_help, ( - rt::description = "Help for framework parameters.", - rt::optional_value = std::string(), - rt::value_hint = "", - rt::help = "Displays help on the framework's parameters. " - "The parameter accepts an optional argument value. If present, an argument value is " - "interpreted as a parameter name (name guessing works as well, so for example " - "'--help=rand' displays help on the parameter 'random'). If the parameter name is unknown " - "or ambiguous error is reported. If argument value is absent, a summary of all " - "framework's parameter is displayed." - )); - help.add_cla_id( "--", btrt_help, "=" ); - store.add( help ); - - /////////////////////////////////////////////// - - rt::option usage( btrt_usage, ( - rt::description = "Short message explaining usage of Boost.Test parameters." - )); - usage.add_cla_id( "-", "?", " " ); - store.add( usage ); - - /////////////////////////////////////////////// - - rt::option version( btrt_version, ( - rt::description = "Prints Boost.Test version and exits." - )); - version.add_cla_id( "--", btrt_version, " " ); - store.add( version ); -} - -static rt::arguments_store s_arguments_store; -static rt::parameters_store s_parameters_store; - -//____________________________________________________________________________// - -} // local namespace - -void -init( int& argc, char** argv ) -{ - shared_ptr parser; - - BOOST_TEST_I_TRY { - // Initialize parameters list - if( s_parameters_store.is_empty() ) - register_parameters( s_parameters_store ); - - // Clear up arguments store just in case (of multiple init invocations) - s_arguments_store.clear(); - - // Parse CLA they take precedence over environment - parser.reset( new rt::cla::parser( s_parameters_store, (rt::end_of_params = "--", rt::negation_prefix = "no_") ) ); - argc = parser->parse( argc, argv, s_arguments_store ); - - // Try to fetch missing arguments from environment - rt::env::fetch_absent( s_parameters_store, s_arguments_store ); - - // Set arguments to default values if defined and perform all the validations - rt::finalize_arguments( s_parameters_store, s_arguments_store ); - - // check if colorized output is enabled - bool use_color = true; - if( s_arguments_store.has(btrt_color_output ) ) { - use_color = runtime_config::get(runtime_config::btrt_color_output); - } - - // Report help if requested - if( runtime_config::get( btrt_version ) ) { - parser->version( std::cerr ); - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_success ) ); - } - else if( runtime_config::get( btrt_usage ) ) { - parser->usage( std::cerr, runtime::cstring(), use_color ); - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_success ) ); - } - else if( s_arguments_store.has( btrt_help ) ) { - parser->help(std::cerr, - s_parameters_store, - runtime_config::get( btrt_help ), - use_color ); - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_success ) ); - } - - // A bit of business logic: output_format takes precedence over log/report formats - if( s_arguments_store.has( btrt_output_format ) ) { - unit_test::output_format of = s_arguments_store.get( btrt_output_format ); - s_arguments_store.set( btrt_report_format, of ); - s_arguments_store.set( btrt_log_format, of ); - } - - } - BOOST_TEST_I_CATCH( rt::init_error, ex ) { - BOOST_TEST_SETUP_ASSERT( false, ex.msg ); - } - BOOST_TEST_I_CATCH( rt::ambiguous_param, ex ) { - std::cerr << ex.msg << "\n Did you mean one of these?\n"; - - BOOST_TEST_FOREACH( rt::cstring, name, ex.m_amb_candidates ) - std::cerr << " " << name << "\n"; - - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); - } - BOOST_TEST_I_CATCH( rt::unrecognized_param, ex ) { - std::cerr << ex.msg << "\n"; - - if( !ex.m_typo_candidates.empty() ) { - std::cerr << " Did you mean one of these?\n"; - - BOOST_TEST_FOREACH( rt::cstring, name, ex.m_typo_candidates ) - std::cerr << " " << name << "\n"; - } - else if( parser ) { - std::cerr << "\n"; - parser->usage( std::cerr ); - } - - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); - } - BOOST_TEST_I_CATCH( rt::input_error, ex ) { - std::cerr << ex.msg << "\n\n"; - - if( parser ) - parser->usage( std::cerr, ex.param_name ); - - BOOST_TEST_I_THROW( framework::nothing_to_test( boost::exit_exception_failure ) ); - } -} - -//____________________________________________________________________________// - -rt::arguments_store const& -argument_store() -{ - return s_arguments_store; -} - -//____________________________________________________________________________// - -bool -save_pattern() -{ - return runtime_config::get( btrt_save_test_pattern ); -} - -//____________________________________________________________________________// - -} // namespace runtime_config -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER diff --git a/libraries/boost/include/boost/test/impl/xml_log_formatter.ipp b/libraries/boost/include/boost/test/impl/xml_log_formatter.ipp deleted file mode 100644 index ef44f1eade..0000000000 --- a/libraries/boost/include/boost/test/impl/xml_log_formatter.ipp +++ /dev/null @@ -1,223 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements OF_XML Log formatter -// *************************************************************************** - -#ifndef BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER -#define BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER - -// Boost.Test -#include -#include -#include -#include -#include -#include - -// Boost -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -static const_string tu_type_name( test_unit const& tu ) -{ - return tu.p_type == TUT_CASE ? "TestCase" : "TestSuite"; -} - -// ************************************************************************** // -// ************** xml_log_formatter ************** // -// ************************************************************************** // - -void -xml_log_formatter::log_start( std::ostream& ostr, counter_t ) -{ - ostr << ""; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_finish( std::ostream& ostr ) -{ - ostr << ""; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_build_info( std::ostream& ostr ) -{ - ostr << ""; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::test_unit_start( std::ostream& ostr, test_unit const& tu ) -{ - ostr << "<" << tu_type_name( tu ) << " name" << utils::attr_value() << tu.p_name.get(); - - if( !tu.p_file_name.empty() ) - ostr << BOOST_TEST_L( " file" ) << utils::attr_value() << tu.p_file_name - << BOOST_TEST_L( " line" ) << utils::attr_value() << tu.p_line_num; - - ostr << ">"; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::test_unit_finish( std::ostream& ostr, test_unit const& tu, unsigned long elapsed ) -{ - if( tu.p_type == TUT_CASE ) - ostr << "" << elapsed << ""; - - ostr << ""; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::test_unit_skipped( std::ostream& ostr, test_unit const& tu, const_string reason ) -{ - ostr << "<" << tu_type_name( tu ) - << " name" << utils::attr_value() << tu.p_name - << " skipped" << utils::attr_value() << "yes" - << " reason" << utils::attr_value() << reason - << "/>"; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_exception_start( std::ostream& ostr, log_checkpoint_data const& checkpoint_data, execution_exception const& ex ) -{ - execution_exception::location const& loc = ex.where(); - - ostr << "" << utils::cdata() << ex.what(); - - if( !checkpoint_data.m_file_name.is_empty() ) { - ostr << "" - << utils::cdata() << checkpoint_data.m_message - << ""; - } -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_exception_finish( std::ostream& ostr ) -{ - ostr << ""; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_entry_start( std::ostream& ostr, log_entry_data const& entry_data, log_entry_types let ) -{ - static literal_string xml_tags[] = { "Info", "Message", "Warning", "Error", "FatalError" }; - - m_curr_tag = xml_tags[let]; - ostr << '<' << m_curr_tag - << BOOST_TEST_L( " file" ) << utils::attr_value() << entry_data.m_file_name - << BOOST_TEST_L( " line" ) << utils::attr_value() << entry_data.m_line_num - << BOOST_TEST_L( ">" ); - m_value_closed = true; - } - - ostr << BOOST_TEST_L( "" ); - - m_curr_tag.clear(); -} - -//____________________________________________________________________________// - -void -xml_log_formatter::entry_context_start( std::ostream& ostr, log_level ) -{ - if( !m_value_closed ) { - ostr << BOOST_TEST_L( "]]>" ); - m_value_closed = true; - } - - ostr << BOOST_TEST_L( "" ); -} - -//____________________________________________________________________________// - -void -xml_log_formatter::entry_context_finish( std::ostream& ostr, log_level ) -{ - ostr << BOOST_TEST_L( "" ); -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_entry_context( std::ostream& ostr, log_level, const_string context_descr ) -{ - ostr << BOOST_TEST_L( "" ) << utils::cdata() << context_descr << BOOST_TEST_L( "" ); -} - -//____________________________________________________________________________// - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER diff --git a/libraries/boost/include/boost/test/impl/xml_report_formatter.ipp b/libraries/boost/include/boost/test/impl/xml_report_formatter.ipp deleted file mode 100644 index 424ef4ba44..0000000000 --- a/libraries/boost/include/boost/test/impl/xml_report_formatter.ipp +++ /dev/null @@ -1,111 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : OF_XML report formatter -// *************************************************************************** - -#ifndef BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER -#define BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER - -// Boost.Test -#include -#include - -#include -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -void -xml_report_formatter::results_report_start( std::ostream& ostr ) -{ - ostr << ""; -} - -//____________________________________________________________________________// - -void -xml_report_formatter::results_report_finish( std::ostream& ostr ) -{ - ostr << ""; -} - - -//____________________________________________________________________________// - -void -xml_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream& ostr ) -{ - test_results const& tr = results_collector.results( tu.p_id ); - - const_string descr; - - if( tr.passed() ) - descr = "passed"; - else if( tr.p_skipped ) - descr = "skipped"; - else if( tr.p_aborted ) - descr = "aborted"; - else - descr = "failed"; - - ostr << '<' << ( tu.p_type == TUT_CASE ? "TestCase" : "TestSuite" ) - << " name" << utils::attr_value() << tu.p_name.get() - << " result" << utils::attr_value() << descr - << " assertions_passed" << utils::attr_value() << tr.p_assertions_passed - << " assertions_failed" << utils::attr_value() << tr.p_assertions_failed - << " warnings_failed" << utils::attr_value() << tr.p_warnings_failed - << " expected_failures" << utils::attr_value() << tr.p_expected_failures; - - if( tu.p_type == TUT_SUITE ) { - ostr << " test_cases_passed" << utils::attr_value() << tr.p_test_cases_passed - << " test_cases_passed_with_warnings" << utils::attr_value() << tr.p_test_cases_warned - << " test_cases_failed" << utils::attr_value() << tr.p_test_cases_failed - << " test_cases_skipped" << utils::attr_value() << tr.p_test_cases_skipped - << " test_cases_aborted" << utils::attr_value() << tr.p_test_cases_aborted; - } - - ostr << '>'; -} - -//____________________________________________________________________________// - -void -xml_report_formatter::test_unit_report_finish( test_unit const& tu, std::ostream& ostr ) -{ - ostr << "'; -} - -//____________________________________________________________________________// - -void -xml_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr ) -{ - test_unit_report_start( tu, ostr ); - test_unit_report_finish( tu, ostr ); -} - -//____________________________________________________________________________// - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER diff --git a/libraries/boost/include/boost/test/included/execution_monitor.hpp b/libraries/boost/include/boost/test/included/execution_monitor.hpp deleted file mode 100644 index cff2adc9a0..0000000000 --- a/libraries/boost/include/boost/test/included/execution_monitor.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : included variant of Execution Monitor to be used independently -// *************************************************************************** - -#ifndef BOOST_INCLUDED_EXECUTION_MONITOR_HPP_051410GER -#define BOOST_INCLUDED_EXECUTION_MONITOR_HPP_051410GER - -#include -#include - -#endif // BOOST_INCLUDED_EXECUTION_MONITOR_HPP_051410GER diff --git a/libraries/boost/include/boost/test/included/prg_exec_monitor.hpp b/libraries/boost/include/boost/test/included/prg_exec_monitor.hpp deleted file mode 100644 index ff48ce5594..0000000000 --- a/libraries/boost/include/boost/test/included/prg_exec_monitor.hpp +++ /dev/null @@ -1,25 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : included (vs. linked ) version of Program Execution Monitor -// *************************************************************************** - -#ifndef BOOST_INCLUDED_PRG_EXEC_MONITOR_HPP_071894GER -#define BOOST_INCLUDED_PRG_EXEC_MONITOR_HPP_071894GER - -#include -#include -#include - -#define BOOST_TEST_INCLUDED -#include - -#endif // BOOST_INCLUDED_PRG_EXEC_MONITOR_HPP_071894GER diff --git a/libraries/boost/include/boost/test/included/test_exec_monitor.hpp b/libraries/boost/include/boost/test/included/test_exec_monitor.hpp deleted file mode 100644 index e75b4698f2..0000000000 --- a/libraries/boost/include/boost/test/included/test_exec_monitor.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// -/// @file -/// @brief Included (vs. linked) version of Test Execution Monitor -// *************************************************************************** - -#ifndef BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP_071894GER -#define BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP_071894GER - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BOOST_TEST_INCLUDED -#include - -#endif // BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP_071894GER diff --git a/libraries/boost/include/boost/test/included/unit_test.hpp b/libraries/boost/include/boost/test/included/unit_test.hpp deleted file mode 100644 index 90882eb178..0000000000 --- a/libraries/boost/include/boost/test/included/unit_test.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// -//!@file -//!@brief Included (vs. linked) version of Unit Test Framework -// *************************************************************************** - -#ifndef BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER -#define BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER - -#define BOOST_TEST_INCLUDED - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#endif // BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER diff --git a/libraries/boost/include/boost/test/included/unit_test_framework.hpp b/libraries/boost/include/boost/test/included/unit_test_framework.hpp deleted file mode 100644 index 5bf366ad80..0000000000 --- a/libraries/boost/include/boost/test/included/unit_test_framework.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @deprecated -// *************************************************************************** - -#include diff --git a/libraries/boost/include/boost/test/minimal.hpp b/libraries/boost/include/boost/test/minimal.hpp deleted file mode 100644 index c52295309e..0000000000 --- a/libraries/boost/include/boost/test/minimal.hpp +++ /dev/null @@ -1,156 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Deprecated implementation of simple minimal testing -/// @deprecated -/// To convert to Unit Test Framework simply rewrite: -/// @code -/// #include -/// -/// int test_main( int, char *[] ) -/// { -/// ... -/// } -/// @endcode -/// as -/// @code -/// #include -/// -/// BOOST_AUTO_TEST_CASE(test_main) -/// { -/// ... -/// } -/// @endcode -// *************************************************************************** - -#ifndef BOOST_TEST_MINIMAL_HPP_071894GER -#define BOOST_TEST_MINIMAL_HPP_071894GER - -#define BOOST_CHECK(exp) \ - ( (exp) \ - ? static_cast(0) \ - : boost::minimal_test::report_error(#exp,__FILE__,__LINE__, BOOST_CURRENT_FUNCTION) ) - -#define BOOST_REQUIRE(exp) \ - ( (exp) \ - ? static_cast(0) \ - : boost::minimal_test::report_critical_error(#exp,__FILE__,__LINE__,BOOST_CURRENT_FUNCTION)) - -#define BOOST_ERROR( msg_ ) \ - boost::minimal_test::report_error( (msg_),__FILE__,__LINE__, BOOST_CURRENT_FUNCTION, true ) -#define BOOST_FAIL( msg_ ) \ - boost::minimal_test::report_critical_error( (msg_),__FILE__,__LINE__, BOOST_CURRENT_FUNCTION, true ) - -//____________________________________________________________________________// - -// Boost.Test -#include -#include -#include -#include -#include - -// Boost -#include // for exit codes -#include // for BOOST_CURRENT_FUNCTION - -// STL -#include // std::cerr, std::endl -#include // std::string - -#include - -//____________________________________________________________________________// - -int test_main( int argc, char* argv[] ); // prototype for users test_main() - -namespace boost { -namespace minimal_test { - -typedef boost::unit_test::const_string const_string; - -inline unit_test::counter_t& errors_counter() { static unit_test::counter_t ec = 0; return ec; } - -inline void -report_error( const char* msg, const char* file, int line, const_string func_name, bool is_msg = false ) -{ - ++errors_counter(); - std::cerr << file << "(" << line << "): "; - - if( is_msg ) - std::cerr << msg; - else - std::cerr << "test " << msg << " failed"; - - if( func_name != "(unknown)" ) - std::cerr << " in function: '" << func_name << "'"; - - std::cerr << std::endl; -} - -inline void -report_critical_error( const char* msg, const char* file, int line, const_string func_name, bool is_msg = false ) -{ - report_error( msg, file, line, func_name, is_msg ); - - throw boost::execution_aborted(); -} - -class caller { -public: - // constructor - caller( int argc, char** argv ) - : m_argc( argc ), m_argv( argv ) {} - - // execution monitor hook implementation - int operator()() { return test_main( m_argc, m_argv ); } - -private: - // Data members - int m_argc; - char** m_argv; -}; // monitor - -} // namespace minimal_test -} // namespace boost - -//____________________________________________________________________________// - -int BOOST_TEST_CALL_DECL main( int argc, char* argv[] ) -{ - using namespace boost::minimal_test; - - try { - ::boost::execution_monitor ex_mon; - int run_result = ex_mon.execute( caller( argc, argv ) ); - - BOOST_CHECK( run_result == 0 || run_result == boost::exit_success ); - } - catch( boost::execution_exception const& exex ) { - if( exex.code() != boost::execution_exception::no_error ) - BOOST_ERROR( (std::string( "exception \"" ) + exex.what() + "\" caught").c_str() ); - std::cerr << "\n**** Testing aborted."; - } - - if( boost::minimal_test::errors_counter() != 0 ) { - std::cerr << "\n**** " << errors_counter() - << " error" << (errors_counter() > 1 ? "s" : "" ) << " detected\n"; - - return boost::exit_test_failure; - } - - std::cout << "\n**** no errors detected\n"; - - return boost::exit_success; -} - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_MINIMAL_HPP_071894GER diff --git a/libraries/boost/include/boost/test/output/compiler_log_formatter.hpp b/libraries/boost/include/boost/test/output/compiler_log_formatter.hpp deleted file mode 100644 index 50359334b1..0000000000 --- a/libraries/boost/include/boost/test/output/compiler_log_formatter.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Contains the formatter for the Human Readable Format (HRF) -// *************************************************************************** - -#ifndef BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER -#define BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER - -// Boost.Test -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -// ************************************************************************** // -// ************** compiler_log_formatter ************** // -// ************************************************************************** // - -//!@brief Log formatter for the Human Readable Format (HRF) log format -class BOOST_TEST_DECL compiler_log_formatter : public unit_test_log_formatter { -public: - compiler_log_formatter() : m_color_output( false ) {} - - // Formatter interface - void log_start( std::ostream&, counter_t test_cases_amount ); - void log_finish( std::ostream& ); - void log_build_info( std::ostream& ); - - void test_unit_start( std::ostream&, test_unit const& tu ); - void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ); - void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason ); - - void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex ); - void log_exception_finish( std::ostream& ); - - void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ); - void log_entry_value( std::ostream&, const_string value ); - void log_entry_value( std::ostream&, lazy_ostream const& value ); - void log_entry_finish( std::ostream& ); - - void entry_context_start( std::ostream&, log_level ); - void log_entry_context( std::ostream&, log_level l, const_string ); - void entry_context_finish( std::ostream&, log_level l ); - -protected: - virtual void print_prefix( std::ostream&, const_string file, std::size_t line ); - - // Data members - bool m_color_output; -}; - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER diff --git a/libraries/boost/include/boost/test/output/junit_log_formatter.hpp b/libraries/boost/include/boost/test/output/junit_log_formatter.hpp deleted file mode 100644 index 713d3b016c..0000000000 --- a/libraries/boost/include/boost/test/output/junit_log_formatter.hpp +++ /dev/null @@ -1,167 +0,0 @@ -// (C) Copyright 2016 Raffi Enficiaud. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@file -///@brief Contains the definition of the Junit log formatter (OF_JUNIT) -// *************************************************************************** - -#ifndef BOOST_TEST_JUNIT_LOG_FORMATTER__ -#define BOOST_TEST_JUNIT_LOG_FORMATTER__ - -// Boost.Test -#include -#include -#include - -//#include - -// STL -#include // std::size_t -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - - - namespace junit_impl { - - // helper for the JUnit logger - struct junit_log_helper - { - struct assertion_entry { - - enum log_entry_t { - log_entry_info, - log_entry_error, - log_entry_failure - }; - - assertion_entry() : sealed(false) - {} - - std::string logentry_message; // the message associated to the JUnit error/entry - std::string logentry_type; // the one that will get expanded in the final junit (failure, error) - std::string output; // additional information/message generated by the assertion - - log_entry_t log_entry; // the type associated to the assertion (or error) - - bool sealed; // indicates if the entry can accept additional information - }; - - std::list system_out; // sysout: additional information - std::list system_err; // syserr: additional information - std::string skipping_reason; - - // list of failure, errors and messages (assertions message and the full log) - std::vector< assertion_entry > assertion_entries; - - bool skipping; - - junit_log_helper(): skipping(false) - {} - - void clear() { - assertion_entries.clear(); - system_out.clear(); - system_err.clear(); - skipping_reason.clear(); - skipping = false; - } - - }; - } - -// ************************************************************************** // -// ************** junit_log_formatter ************** // -// ************************************************************************** // - -/// JUnit logger class -class junit_log_formatter : public unit_test_log_formatter { -public: - - junit_log_formatter() : m_display_build_info(false) - { - // we log everything from the logger singleton point of view - // because we need to know about all the messages/commands going to the logger - // we decide what we put inside the logs internally - this->m_log_level = log_successful_tests; - m_log_level_internal = log_messages; - } - - // Formatter interface - void log_start( std::ostream&, counter_t test_cases_amount ); - void log_finish( std::ostream& ); - void log_build_info( std::ostream& ); - - void test_unit_start( std::ostream&, test_unit const& tu ); - void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ); - void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason ); - void test_unit_aborted( std::ostream& os, test_unit const& tu ); - - void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex ); - void log_exception_finish( std::ostream& ); - - void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ); - - using unit_test_log_formatter::log_entry_value; // bring base class functions into overload set - void log_entry_value( std::ostream&, const_string value ); - void log_entry_finish( std::ostream& ); - - void entry_context_start( std::ostream&, log_level ); - void log_entry_context( std::ostream&, log_level, const_string ); - void entry_context_finish( std::ostream&, log_level ); - - //! Discards changes in the log level - virtual void set_log_level(log_level ll) - { - if(ll > log_successful_tests && ll < log_messages) - ll = log_successful_tests; - else if (ll > log_all_errors) - ll = log_all_errors; - - this->m_log_level_internal = ll; - } - - //! Instead of a regular stream, returns a file name corresponding to - //! the current master test suite. If the file already exists, adds an index - //! to it. - virtual std::string get_default_stream_description() const; - - -private: - typedef std::map map_trace_t; - map_trace_t map_tests; - junit_impl::junit_log_helper runner_log_entry; - - junit_impl::junit_log_helper& get_current_log_entry() { - if(list_path_to_root.empty()) - return runner_log_entry; - map_trace_t::iterator it = map_tests.find(list_path_to_root.back()); - return (it == map_tests.end() ? runner_log_entry : it->second); - } - - std::list list_path_to_root; - bool m_display_build_info; - bool m_is_last_assertion_or_error; // true if failure, false if error - - log_level m_log_level_internal; - friend class junit_result_helper; -}; - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_JUNIT_LOG_FORMATTER__ diff --git a/libraries/boost/include/boost/test/output/plain_report_formatter.hpp b/libraries/boost/include/boost/test/output/plain_report_formatter.hpp deleted file mode 100644 index 8c50964597..0000000000 --- a/libraries/boost/include/boost/test/output/plain_report_formatter.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : plain report formatter implementation -// *************************************************************************** - -#ifndef BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER -#define BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER - -// Boost.Test -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -// ************************************************************************** // -// ************** plain_report_formatter ************** // -// ************************************************************************** // - -class plain_report_formatter : public results_reporter::format { -public: - plain_report_formatter() : m_indent( 0 ), m_color_output( false ) {} - - // Formatter interface - void results_report_start( std::ostream& ostr ); - void results_report_finish( std::ostream& ostr ); - - void test_unit_report_start( test_unit const&, std::ostream& ostr ); - void test_unit_report_finish( test_unit const&, std::ostream& ostr ); - - void do_confirmation_report( test_unit const&, std::ostream& ostr ); - -private: - // Data members - counter_t m_indent; - bool m_color_output; -}; - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER diff --git a/libraries/boost/include/boost/test/output/xml_log_formatter.hpp b/libraries/boost/include/boost/test/output/xml_log_formatter.hpp deleted file mode 100644 index 1d8dec0f95..0000000000 --- a/libraries/boost/include/boost/test/output/xml_log_formatter.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : contains OF_XML Log formatter definition -// *************************************************************************** - -#ifndef BOOST_TEST_XML_LOG_FORMATTER_020105GER -#define BOOST_TEST_XML_LOG_FORMATTER_020105GER - -// Boost.Test -#include -#include - -// STL -#include // std::size_t - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -// ************************************************************************** // -// ************** xml_log_formatter ************** // -// ************************************************************************** // - -class xml_log_formatter : public unit_test_log_formatter { -public: - // Formatter interface - void log_start( std::ostream&, counter_t test_cases_amount ); - void log_finish( std::ostream& ); - void log_build_info( std::ostream& ); - - void test_unit_start( std::ostream&, test_unit const& tu ); - void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ); - void test_unit_skipped( std::ostream&, test_unit const& tu, const_string reason ); - - void log_exception_start( std::ostream&, log_checkpoint_data const&, execution_exception const& ex ); - void log_exception_finish( std::ostream& ); - - void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ); - using unit_test_log_formatter::log_entry_value; // bring base class functions into overload set - void log_entry_value( std::ostream&, const_string value ); - void log_entry_finish( std::ostream& ); - - void entry_context_start( std::ostream&, log_level ); - void log_entry_context( std::ostream&, log_level, const_string ); - void entry_context_finish( std::ostream&, log_level ); - -private: - // Data members - const_string m_curr_tag; - bool m_value_closed; -}; - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_XML_LOG_FORMATTER_020105GER diff --git a/libraries/boost/include/boost/test/output/xml_report_formatter.hpp b/libraries/boost/include/boost/test/output/xml_report_formatter.hpp deleted file mode 100644 index ca5e47182f..0000000000 --- a/libraries/boost/include/boost/test/output/xml_report_formatter.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : OF_XML report formatter implementation -// *************************************************************************** - -#ifndef BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER -#define BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER - -// Boost.Test -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace output { - -// ************************************************************************** // -// ************** xml_report_formatter ************** // -// ************************************************************************** // - -class xml_report_formatter : public results_reporter::format { -public: - // Formatter interface - void results_report_start( std::ostream& ostr ); - void results_report_finish( std::ostream& ostr ); - - void test_unit_report_start( test_unit const&, std::ostream& ostr ); - void test_unit_report_finish( test_unit const&, std::ostream& ostr ); - - void do_confirmation_report( test_unit const&, std::ostream& ostr ); -}; - -} // namespace output -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER diff --git a/libraries/boost/include/boost/test/output_test_stream.hpp b/libraries/boost/include/boost/test/output_test_stream.hpp deleted file mode 100644 index 26eaf320ac..0000000000 --- a/libraries/boost/include/boost/test/output_test_stream.hpp +++ /dev/null @@ -1,14 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Deprecated header. -//!@deprecated Use boost/test/tools/output_test_stream.hpp instead -// *************************************************************************** - -// Boost.Test -#include diff --git a/libraries/boost/include/boost/test/parameterized_test.hpp b/libraries/boost/include/boost/test/parameterized_test.hpp deleted file mode 100644 index cc9487abc2..0000000000 --- a/libraries/boost/include/boost/test/parameterized_test.hpp +++ /dev/null @@ -1,176 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief generators and helper macros for parameterized tests -// *************************************************************************** - -#ifndef BOOST_TEST_PARAMETERIZED_TEST_HPP_021102GER -#define BOOST_TEST_PARAMETERIZED_TEST_HPP_021102GER - -// Boost.Test -#include -#include - -// Boost -#include -#include - -#include -#include - -#include - -//____________________________________________________________________________// - -#define BOOST_PARAM_TEST_CASE( function, begin, end ) \ -boost::unit_test::make_test_case( function, \ - BOOST_TEST_STRINGIZE( function ), \ - __FILE__, __LINE__, \ - (begin), (end) ) \ -/**/ - -#define BOOST_PARAM_CLASS_TEST_CASE( function, tc_instance, begin, end ) \ -boost::unit_test::make_test_case( function, \ - BOOST_TEST_STRINGIZE( function ), \ - __FILE__, __LINE__, \ - (tc_instance), \ - (begin), (end) ) \ -/**/ - -namespace boost { -namespace unit_test { - -namespace ut_detail { - -// ************************************************************************** // -// ************** param_test_case_generator ************** // -// ************************************************************************** // - -template -class param_test_case_generator : public test_unit_generator { -public: - param_test_case_generator( boost::function const& test_func, - const_string tc_name, - const_string tc_file, - std::size_t tc_line, - ParamIter par_begin, - ParamIter par_end ) - : m_test_func( test_func ) - , m_tc_name( ut_detail::normalize_test_case_name( tc_name ) ) - , m_tc_file( tc_file ) - , m_tc_line( tc_line ) - , m_par_begin( par_begin ) - , m_par_end( par_end ) - , m_index( 0 ) - {} - - virtual test_unit* next() const - { - if( m_par_begin == m_par_end ) - return (test_unit*)0; - - test_unit* res = new test_case( m_tc_name + "_" + utils::string_cast(m_index), m_tc_file, m_tc_line, boost::bind( m_test_func, *m_par_begin ) ); - - ++m_par_begin; - ++m_index; - - return res; - } - -private: - // Data members - boost::function m_test_func; - std::string m_tc_name; - const_string m_tc_file; - std::size_t m_tc_line; - mutable ParamIter m_par_begin; - ParamIter m_par_end; - mutable std::size_t m_index; -}; - -//____________________________________________________________________________// - -template -struct user_param_tc_method_invoker { - typedef void (UserTestCase::*test_method)( ParamType ); - - // Constructor - user_param_tc_method_invoker( shared_ptr inst, test_method test_method ) - : m_inst( inst ), m_test_method( test_method ) {} - - void operator()( ParamType p ) { ((*m_inst).*m_test_method)( p ); } - - // Data members - shared_ptr m_inst; - test_method m_test_method; -}; - -//____________________________________________________________________________// - -} // namespace ut_detail - -template -inline ut_detail::param_test_case_generator -make_test_case( boost::function const& test_func, - const_string tc_name, - const_string tc_file, - std::size_t tc_line, - ParamIter par_begin, - ParamIter par_end ) -{ - return ut_detail::param_test_case_generator( test_func, tc_name, tc_file, tc_line, par_begin, par_end ); -} - -//____________________________________________________________________________// - -template -inline ut_detail::param_test_case_generator< - BOOST_DEDUCED_TYPENAME remove_const::type>::type,ParamIter> -make_test_case( void (*test_func)( ParamType ), - const_string tc_name, - const_string tc_file, - std::size_t tc_line, - ParamIter par_begin, - ParamIter par_end ) -{ - typedef BOOST_DEDUCED_TYPENAME remove_const::type>::type param_value_type; - return ut_detail::param_test_case_generator( test_func, tc_name, tc_file, tc_line, par_begin, par_end ); -} - -//____________________________________________________________________________// - -template -inline ut_detail::param_test_case_generator< - BOOST_DEDUCED_TYPENAME remove_const::type>::type,ParamIter> -make_test_case( void (UserTestCase::*test_method )( ParamType ), - const_string tc_name, - const_string tc_file, - std::size_t tc_line, - boost::shared_ptr const& user_test_case, - ParamIter par_begin, - ParamIter par_end ) -{ - typedef BOOST_DEDUCED_TYPENAME remove_const::type>::type param_value_type; - return ut_detail::param_test_case_generator( - ut_detail::user_param_tc_method_invoker( user_test_case, test_method ), - tc_name, - tc_file, - tc_line, - par_begin, - par_end ); -} - -//____________________________________________________________________________// - -} // unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_PARAMETERIZED_TEST_HPP_021102GER - diff --git a/libraries/boost/include/boost/test/predicate_result.hpp b/libraries/boost/include/boost/test/predicate_result.hpp deleted file mode 100644 index 9b57363713..0000000000 --- a/libraries/boost/include/boost/test/predicate_result.hpp +++ /dev/null @@ -1,14 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Deprecated header -/// @deprecated Use boost/test/tools/assertion_result.hpp instead -// *************************************************************************** - -// Boost.Test -#include diff --git a/libraries/boost/include/boost/test/prg_exec_monitor.hpp b/libraries/boost/include/boost/test/prg_exec_monitor.hpp deleted file mode 100644 index f072e215db..0000000000 --- a/libraries/boost/include/boost/test/prg_exec_monitor.hpp +++ /dev/null @@ -1,81 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Entry point for the end user into the Program Execution Monitor. -/// -/// Use this header to forward declare function prg_exec_monitor_main and to automatically define a main -/// function for you. If you prefer to use your own main you are free to do so, but you need to define -/// BOOST_TEST_NO_MAIN before incuding this header. To initiate your main program body execution you -/// would use statement like this: -/// @code ::boost::prg_exec_monitor_main( &my_main, argc, argv ); @endcode -/// Also this header facilitate auto linking with the Program Execution Monitor library if this feature -/// is supported -// *************************************************************************** - -#ifndef BOOST_PRG_EXEC_MONITOR_HPP_071894GER -#define BOOST_PRG_EXEC_MONITOR_HPP_071894GER - -#include - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** Auto Linking ************** // -// ************************************************************************** // - -// Automatically link to the correct build variant where possible. -#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \ - !defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED) -# define BOOST_LIB_NAME boost_prg_exec_monitor - -// If we're importing code from a dll, then tell auto_link.hpp about it: -# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TEST_DYN_LINK) -# define BOOST_DYN_LINK -# endif - -# include - -#endif // auto-linking disabled - -// ************************************************************************** // -// ************** prg_exec_monitor_main ************** // -// ************************************************************************** // - -namespace boost { - -/// @brief Wrapper around the main function -/// -/// Call this routine instead of your own main body implementation directly. This routine impements all the monitoring -/// functionality. THe monitor behavior is configurable by using the environment variable BOOST_TEST_CATCH_SYSTEM_ERRORS. -/// If set to string value "no", the monitor will not attempt to catch system errors (signals) -/// @param[in] cpp_main main function body. Should have the same signature as regular main function -/// @param[in] argc, argv command line arguments -int BOOST_TEST_DECL prg_exec_monitor_main( int (*cpp_main)( int argc, char* argv[] ), int argc, char* argv[] ); - -} // boost - -#if defined(BOOST_TEST_DYN_LINK) && !defined(BOOST_TEST_NO_MAIN) - -// ************************************************************************** // -// ************** main function for tests using dll ************** // -// ************************************************************************** // - -// prototype for user's cpp_main() -int cpp_main( int argc, char* argv[] ); - -int BOOST_TEST_CALL_DECL -main( int argc, char* argv[] ) -{ - return ::boost::prg_exec_monitor_main( &cpp_main, argc, argv ); -} - -//____________________________________________________________________________// - -#endif // BOOST_TEST_DYN_LINK && !BOOST_TEST_NO_MAIN - -#endif // BOOST_PRG_EXEC_MONITOR_HPP_071894GER diff --git a/libraries/boost/include/boost/test/progress_monitor.hpp b/libraries/boost/include/boost/test/progress_monitor.hpp deleted file mode 100644 index 2f661f5825..0000000000 --- a/libraries/boost/include/boost/test/progress_monitor.hpp +++ /dev/null @@ -1,66 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief defines simple text based progress monitor -// *************************************************************************** - -#ifndef BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER -#define BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER - -// Boost.Test -#include -#include - -// STL -#include // for std::ostream& - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** progress_monitor ************** // -// ************************************************************************** // - -/// This class implements test observer interface and updates test progress as test units finish or get aborted -class BOOST_TEST_DECL progress_monitor_t : public test_observer, public singleton { -public: - /// @name Test observer interface - /// @{ - virtual void test_start( counter_t test_cases_amount ); - virtual void test_aborted(); - - virtual void test_unit_finish( test_unit const&, unsigned long ); - virtual void test_unit_skipped( test_unit const&, const_string ); - - virtual int priority() { return 4; } - /// @} - - /// @name Configuration - /// @{ - void set_stream( std::ostream& ); - /// @} - -private: - BOOST_TEST_SINGLETON_CONS( progress_monitor_t ) -}; // progress_monitor_t - -BOOST_TEST_SINGLETON_INST( progress_monitor ) - -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER - diff --git a/libraries/boost/include/boost/test/results_collector.hpp b/libraries/boost/include/boost/test/results_collector.hpp deleted file mode 100644 index 3acd7b87bc..0000000000 --- a/libraries/boost/include/boost/test/results_collector.hpp +++ /dev/null @@ -1,143 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Defines testing result collector components -/// -/// Defines classes for keeping track (@ref test_results) and collecting -/// (@ref results_collector_t) the states of the test units. -// *************************************************************************** - -#ifndef BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER -#define BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER - -// Boost.Test -#include - -#include -#include - -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -namespace { - -// ************************************************************************** // -/// First failed assertion debugger hook -/// -/// This function is a placeholder where user can set a breakpoint in debugger to catch the -/// very first assertion failure in each test case -// ************************************************************************** // -inline void first_failed_assertion() {} -} - -// ************************************************************************** // -/// @brief Collection of attributes constituting test unit results -/// -/// This class is a collection of attributes describing a test result. -/// -/// The attributes presented as public properties on -/// an instance of the class. In addition summary conclusion methods are presented to generate simple answer to pass/fail question - -class BOOST_TEST_DECL test_results { -public: - test_results(); - - /// Type representing counter like public property - typedef BOOST_READONLY_PROPERTY( counter_t, (results_collector_t) - (test_results) - (results_collect_helper) ) counter_prop; - /// Type representing boolean like public property - typedef BOOST_READONLY_PROPERTY( bool, (results_collector_t) - (test_results) - (results_collect_helper) ) bool_prop; - - counter_prop p_assertions_passed; //!< Number of successful assertions - counter_prop p_assertions_failed; //!< Number of failing assertions - counter_prop p_warnings_failed; //!< Number of warnings - counter_prop p_expected_failures; - counter_prop p_test_cases_passed; //!< Number of successfull test cases - counter_prop p_test_cases_warned; //!< Number of warnings in test cases - counter_prop p_test_cases_failed; //!< Number of failing test cases - counter_prop p_test_cases_skipped; //!< Number of skipped test cases - counter_prop p_test_cases_aborted; //!< Number of aborted test cases - counter_prop p_duration_microseconds; //!< Duration of the test in microseconds - bool_prop p_aborted; //!< Indicates that the test unit execution has been aborted - bool_prop p_skipped; //!< Indicates that the test unit execution has been skipped - - /// Returns true if test unit passed - bool passed() const; - - /// Returns true if the test unit was aborted (hard failure) - bool aborted() const; - - /// Produces result code for the test unit execution - /// - /// This methhod return one of the result codes defined in @c boost/cstdlib.hpp - /// @returns - /// - @c boost::exit_success on success, - /// - @c boost::exit_exception_failure in case test unit - /// was aborted for any reason (incuding uncaught exception) - /// - and @c boost::exit_test_failure otherwise - int result_code() const; - - //! Combines the results of the current instance with another - //! - //! Only the counters are updated and the @c p_aborted and @c p_skipped are left unchanged. - void operator+=( test_results const& ); - - //! Resets the current state of the result - void clear(); -}; - -// ************************************************************************** // -/// @brief Collects and combines the test results -/// -/// This class collects and combines the results of the test unit during the execution of the -/// test tree. The results_collector_t::results() function combines the test results on a subtree -/// of the test tree. -/// -/// @see boost::unit_test::test_observer -class BOOST_TEST_DECL results_collector_t : public test_observer, public singleton { -public: - - virtual void test_start( counter_t ); - - virtual void test_unit_start( test_unit const& ); - virtual void test_unit_finish( test_unit const&, unsigned long ); - virtual void test_unit_skipped( test_unit const&, const_string ); - virtual void test_unit_aborted( test_unit const& ); - - virtual void assertion_result( unit_test::assertion_result ); - virtual void exception_caught( execution_exception const& ); - - virtual int priority() { return 3; } - - /// Results access per test unit - /// - /// @param[in] tu_id id of a test unit - test_results const& results( test_unit_id tu_id ) const; - -private: - BOOST_TEST_SINGLETON_CONS( results_collector_t ) -}; - -BOOST_TEST_SINGLETON_INST( results_collector ) - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER diff --git a/libraries/boost/include/boost/test/results_reporter.hpp b/libraries/boost/include/boost/test/results_reporter.hpp deleted file mode 100644 index 6f8d8f1105..0000000000 --- a/libraries/boost/include/boost/test/results_reporter.hpp +++ /dev/null @@ -1,122 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief defines testing result reporter interfaces -/// -/// This file defines interfaces that are responsible for results reporting. Interface is presented in a form of -/// free standing function implemented in namespace result_reporter -// *************************************************************************** - -#ifndef BOOST_TEST_RESULTS_REPORTER_HPP_021205GER -#define BOOST_TEST_RESULTS_REPORTER_HPP_021205GER - -// Boost.Test -#include -#include - -// STL -#include // for std::ostream& - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -/// Namespace for results reporter interfaces -namespace results_reporter { - -// ************************************************************************** // -/// @brief Results report formatter interface -/// -/// This is abstract interface for the report formatter used by results reporter routines. -/// You can define a custom formatter by implementing this interface and setting the formatter using set_format function. -/// This is usually done during test module initialization -// ************************************************************************** // - -class BOOST_TEST_DECL format { -public: - // Destructor - virtual ~format() {} - - virtual void results_report_start( std::ostream& ostr ) = 0; - virtual void results_report_finish( std::ostream& ostr ) = 0; - - virtual void test_unit_report_start( test_unit const&, std::ostream& ostr ) = 0; - virtual void test_unit_report_finish( test_unit const&, std::ostream& ostr ) = 0; - - virtual void do_confirmation_report( test_unit const&, std::ostream& ostr ) = 0; -}; - -// ************************************************************************** // -/// @name report configuration -// ************************************************************************** // - -/// Sets reporting level - -/// There are only four possible levels for results report: -/// - confirmation report (boost::unit_test::CONFIRMATION_REPORT). This report level only produces short confirmation -/// message about test module pass/fail status -/// - short report (boost::unit_test::SHORT_REPORT). This report level produces short summary report for failed/passed -/// assertions and test units. -/// - detailed report (boost::unit_test::DETAILED_REPORT). This report level produces detailed report per test unit for -/// passed/failed assertions and uncaught exceptions -/// - no report (boost::unit_test::NO_REPORT). This report level produces no results report. This is used for test modules -/// running as part of some kind of continues integration framework -/// @param[in] l report level -BOOST_TEST_DECL void set_level( report_level l ); - -/// Sets output stream for results reporting - -/// By default std::cerr is used. Use this function to set a different stream. The framework -/// refers to the stream by reference, so you need to make sure the stream object lifetime exceeds the testing main scope. -BOOST_TEST_DECL void set_stream( std::ostream& ); - -/// Sets one of the predefined formats - -/// The framework implements two results report formats: -/// - plain human readable format (boost::unit_test::OF_CLF) -/// - XML format (boost::unit_test::OF_XML) -/// @param[in] of one of the presefined enumeration values for output formats -BOOST_TEST_DECL void set_format( output_format of ); - -/// Sets custom report formatter - -/// The framework takes ownership of the pointer passed as an argument. So this should be a pointer to -/// a heap allocated object -/// @param[in] f pointer to heap allocated instance of custom report formatter class -BOOST_TEST_DECL void set_format( results_reporter::format* f ); - -/// @brief Access to configured results reporter stream -/// -/// Use this stream to report additional information abut test module execution -BOOST_TEST_DECL std::ostream& get_stream(); - -/// @} - -// ************************************************************************** // -// ************** report initiation ************** // -// ************************************************************************** // - -BOOST_TEST_DECL void make_report( report_level l = INV_REPORT_LEVEL, test_unit_id = INV_TEST_UNIT_ID ); -inline void confirmation_report( test_unit_id id = INV_TEST_UNIT_ID ) -{ make_report( CONFIRMATION_REPORT, id ); } -inline void short_report( test_unit_id id = INV_TEST_UNIT_ID ) -{ make_report( SHORT_REPORT, id ); } -inline void detailed_report( test_unit_id id = INV_TEST_UNIT_ID ) -{ make_report( DETAILED_REPORT, id ); } - -} // namespace results_reporter -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_RESULTS_REPORTER_HPP_021205GER - diff --git a/libraries/boost/include/boost/test/test_case_template.hpp b/libraries/boost/include/boost/test/test_case_template.hpp deleted file mode 100644 index c01bd0738a..0000000000 --- a/libraries/boost/include/boost/test/test_case_template.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Deprecated header. -/// @deprecated Use @c boost/test/unit_test.hpp instead -// *************************************************************************** - -#include diff --git a/libraries/boost/include/boost/test/test_exec_monitor.hpp b/libraries/boost/include/boost/test/test_exec_monitor.hpp deleted file mode 100644 index 0450809335..0000000000 --- a/libraries/boost/include/boost/test/test_exec_monitor.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Deprecated implementation of Test Execution Monitor -/// -/// To convert to Unit Test Framework simply rewrite: -/// @code -/// #include -/// -/// int test_main( int, char *[] ) -/// { -/// ... -/// } -/// @endcode -/// as -/// @code -/// #include -/// -/// BOOST_AUTO_TEST_CASE(test_main) -/// { -/// ... -/// } -/// @endcode -/// and link with boost_unit_test_framework library *instead of* boost_test_exec_monitor -// *************************************************************************** - -#ifndef BOOST_TEST_EXEC_MONITOR_HPP_071894GER -#define BOOST_TEST_EXEC_MONITOR_HPP_071894GER - -// Boost.Test -#include - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** Auto Linking ************** // -// ************************************************************************** // - -// Automatically link to the correct build variant where possible. -#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \ - !defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED) - -# define BOOST_LIB_NAME boost_test_exec_monitor -# include - -#endif // auto-linking disabled - -#endif // BOOST_TEST_EXEC_MONITOR_HPP_071894GER diff --git a/libraries/boost/include/boost/test/test_framework_init_observer.hpp b/libraries/boost/include/boost/test/test_framework_init_observer.hpp deleted file mode 100644 index cdf5ef5edd..0000000000 --- a/libraries/boost/include/boost/test/test_framework_init_observer.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// (c) Copyright Raffi Enficiaud 2017. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Defines an observer that monitors the init of the unit test framework -// *************************************************************************** - -#ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER -#define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER - -// Boost.Test -#include - -#include -#include - -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -/// @brief Monitors the init of the framework -/// -/// This class collects the state of the init/termination of the unit test framework. -/// -/// @see boost::unit_test::test_observer -class BOOST_TEST_DECL framework_init_observer_t : public test_observer, public singleton { -public: - - virtual void test_start( counter_t ); - - virtual void assertion_result( unit_test::assertion_result ); - virtual void exception_caught( execution_exception const& ); - virtual void test_aborted(); - - virtual int priority() { return 0; } - - void clear(); - - /// Indicates if a failure has been recorded so far - bool has_failed( ) const; - -private: - BOOST_TEST_SINGLETON_CONS( framework_init_observer_t ) -}; - -BOOST_TEST_SINGLETON_INST( framework_init_observer ) - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER diff --git a/libraries/boost/include/boost/test/test_tools.hpp b/libraries/boost/include/boost/test/test_tools.hpp deleted file mode 100644 index a542d5fcde..0000000000 --- a/libraries/boost/include/boost/test/test_tools.hpp +++ /dev/null @@ -1,68 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief test tools compatibility header -/// -/// This file is used to select the test tools implementation and includes all the necessary headers -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_HPP_111812GER -#define BOOST_TEST_TOOLS_HPP_111812GER - -#include - -// brings some compiler configuration like BOOST_PP_VARIADICS -#include - -#include - -#if defined(BOOST_NO_CXX11_VARIADIC_MACROS) \ - || defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \ - || defined(BOOST_NO_CXX11_DECLTYPE) -# define BOOST_TEST_MACRO_LIMITED_SUPPORT -#endif - -// Boost.Test -// #define BOOST_TEST_NO_OLD_TOOLS - -#if defined(BOOST_TEST_MACRO_LIMITED_SUPPORT) \ - && ( !BOOST_PP_VARIADICS \ - || !(__cplusplus >= 201103L) && defined(BOOST_NO_CXX11_VARIADIC_MACROS)) -# define BOOST_TEST_NO_NEW_TOOLS -#endif - -// #define BOOST_TEST_TOOLS_UNDER_DEBUGGER -// #define BOOST_TEST_TOOLS_DEBUGGABLE - -#include - -#ifndef BOOST_TEST_NO_OLD_TOOLS -# include -# include - -# include -#endif - -#ifndef BOOST_TEST_NO_NEW_TOOLS -# include -# include -# include -# include -# include - -# include -# include -# include - -# include -# include -# include -# include -#endif - -#endif // BOOST_TEST_TOOLS_HPP_111812GER diff --git a/libraries/boost/include/boost/test/tools/assertion.hpp b/libraries/boost/include/boost/test/tools/assertion.hpp deleted file mode 100644 index cca2f52beb..0000000000 --- a/libraries/boost/include/boost/test/tools/assertion.hpp +++ /dev/null @@ -1,410 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Defines framework for automated assertion construction -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER -#define BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER - -// Boost.Test -#include -#include -#include - -// Boost -#include -#include -#include -#include -#include -#include - -// STL -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -#include -#endif - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace assertion { - -// ************************************************************************** // -// ************** assertion::operators ************** // -// ************************************************************************** // -// precedence 4: ->*, .* -// precedence 5: *, /, % -// precedence 6: +, - -// precedence 7: << , >> -// precedence 8: <, <=, > and >= -// precedence 9: == and != -// precedence 10: bitwise AND -// precedence 11: bitwise XOR -// precedence 12: bitwise OR -// precedence 13: logical AND -// disabled -// precedence 14: logical OR -// disabled -// precedence 15: ternary conditional -// disabled -// precedence 16: = and OP= operators -// precedence 17: throw operator -// not supported -// precedence 18: comma -// not supported - -namespace op { - -#define BOOST_TEST_FOR_EACH_COMP_OP(action) \ - action( < , LT, >= ) \ - action( <=, LE, > ) \ - action( > , GT, <= ) \ - action( >=, GE, < ) \ - action( ==, EQ, != ) \ - action( !=, NE, == ) \ -/**/ - -//____________________________________________________________________________// - -#ifndef BOOST_NO_CXX11_DECLTYPE - -#define BOOST_TEST_FOR_EACH_CONST_OP(action)\ - action(->*, MEMP, ->* ) \ - \ - action( * , MUL, * ) \ - action( / , DIV, / ) \ - action( % , MOD, % ) \ - \ - action( + , ADD, + ) \ - action( - , SUB, - ) \ - \ - action( <<, LSH, << ) \ - action( >>, RSH, >> ) \ - \ - BOOST_TEST_FOR_EACH_COMP_OP(action) \ - \ - action( & , BAND, & ) \ - action( ^ , XOR, ^ ) \ - action( | , BOR, | ) \ -/**/ - -#else - -#define BOOST_TEST_FOR_EACH_CONST_OP(action)\ - BOOST_TEST_FOR_EACH_COMP_OP(action) \ -/**/ - -#endif - -//____________________________________________________________________________// - -#define BOOST_TEST_FOR_EACH_MUT_OP(action) \ - action( = , SET , = ) \ - action( +=, IADD, += ) \ - action( -=, ISUB, -= ) \ - action( *=, IMUL, *= ) \ - action( /=, IDIV, /= ) \ - action( %=, IMOD, %= ) \ - action(<<=, ILSH, <<=) \ - action(>>=, IRSH, >>=) \ - action( &=, IAND, &= ) \ - action( ^=, IXOR, ^= ) \ - action( |=, IOR , |= ) \ -/**/ - -//____________________________________________________________________________// - -#ifndef BOOST_NO_CXX11_DECLTYPE -# define DEDUCE_RESULT_TYPE( oper ) \ - decltype(boost::declval() oper boost::declval() ) optype; \ - typedef typename boost::remove_reference::type \ -/**/ -#else -# define DEDUCE_RESULT_TYPE( oper ) bool -#endif - -#define DEFINE_CONST_OPER( oper, name, rev ) \ -template \ -struct name { \ - typedef DEDUCE_RESULT_TYPE( oper ) result_type; \ - \ - static result_type \ - eval( Lhs const& lhs, Rhs const& rhs ) \ - { \ - return lhs oper rhs; \ - } \ - \ - template \ - static void \ - report( std::ostream& ostr, \ - PrevExprType const& lhs, \ - Rhs const& rhs) \ - { \ - lhs.report( ostr ); \ - ostr << revert() \ - << tt_detail::print_helper( rhs ); \ - } \ - \ - static char const* revert() \ - { return " " #rev " "; } \ -}; \ -/**/ - -BOOST_TEST_FOR_EACH_CONST_OP( DEFINE_CONST_OPER ) - -#undef DEDUCE_RESULT_TYPE -#undef DEFINE_CONST_OPER - -//____________________________________________________________________________// - -} // namespace op - -// ************************************************************************** // -// ************** assertion::expression_base ************** // -// ************************************************************************** // -// Defines expression operators - -template class binary_expr; - -template -class expression_base { -public: - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - template - struct RhsT : remove_const::type> {}; - -#define ADD_OP_SUPPORT( oper, name, _ ) \ - template \ - binary_expr::type> > \ - operator oper( T&& rhs ) \ - { \ - return binary_expr::type> > \ - ( std::forward( \ - *static_cast(this) ), \ - std::forward(rhs) ); \ - } \ -/**/ -#else - -#define ADD_OP_SUPPORT( oper, name, _ ) \ - template \ - binary_expr::type, \ - op::name::type> >\ - operator oper( T const& rhs ) const \ - { \ - typedef typename boost::decay::type Rhs; \ - return binary_expr > \ - ( *static_cast(this), \ - rhs ); \ - } \ -/**/ -#endif - - BOOST_TEST_FOR_EACH_CONST_OP( ADD_OP_SUPPORT ) - #undef ADD_OP_SUPPORT - -#ifndef BOOST_NO_CXX11_AUTO_DECLARATIONS - // Disabled operators - template - ExprType& - operator ||( T const& /*rhs*/ ) - { - BOOST_MPL_ASSERT_MSG(false, CANT_USE_LOGICAL_OPERATOR_OR_WITHIN_THIS_TESTING_TOOL, () ); - - return *static_cast(this); - } - - template - ExprType& - operator &&( T const& /*rhs*/ ) - { - BOOST_MPL_ASSERT_MSG(false, CANT_USE_LOGICAL_OPERATOR_AND_WITHIN_THIS_TESTING_TOOL, () ); - - return *static_cast(this); - } - - operator bool() - { - BOOST_MPL_ASSERT_MSG(false, CANT_USE_TERNARY_OPERATOR_WITHIN_THIS_TESTING_TOOL, () ); - - return false; - } -#endif -}; - -// ************************************************************************** // -// ************** assertion::value_expr ************** // -// ************************************************************************** // -// simple value expression - -template -class value_expr : public expression_base,typename remove_const::type>::type> { -public: - // Public types - typedef T result_type; - - // Constructor -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - value_expr( value_expr&& ve ) - : m_value( std::forward(ve.m_value) ) - {} - explicit value_expr( T&& val ) - : m_value( std::forward(val) ) - {} -#else - explicit value_expr( T const& val ) - : m_value( val ) - {} -#endif - - // Specific expression interface - T const& value() const - { - return m_value; - } - void report( std::ostream& ostr ) const - { - ostr << tt_detail::print_helper( m_value ); - } - - // Mutating operators -#define ADD_OP_SUPPORT( OPER, ID, _ ) \ - template \ - value_expr& \ - operator OPER( U const& rhs ) \ - { \ - m_value OPER rhs; \ - \ - return *this; \ - } \ -/**/ - - BOOST_TEST_FOR_EACH_MUT_OP( ADD_OP_SUPPORT ) -#undef ADD_OP_SUPPORT - - // expression interface - assertion_result evaluate( bool no_message = false ) const - { - assertion_result res( value() ); - if( no_message || res ) - return res; - - format_message( res.message(), value() ); - - return tt_detail::format_assertion_result( "", res.message().str() ); - } - -private: - template - static void format_message( wrap_stringstream& ostr, U const& v ) { ostr << "[(bool)" << v << " is false]"; } - static void format_message( wrap_stringstream& /*ostr*/, bool /*v*/ ) {} - static void format_message( wrap_stringstream& /*ostr*/, assertion_result const& /*v*/ ) {} - - // Data members - T m_value; -}; - -// ************************************************************************** // -// ************** assertion::binary_expr ************** // -// ************************************************************************** // -// binary expression - -template -class binary_expr : public expression_base,typename OP::result_type> { -public: - // Public types - typedef typename OP::result_type result_type; - - // Constructor -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - binary_expr( binary_expr&& be ) - : m_lhs( std::forward(be.m_lhs) ) - , m_rhs( std::forward(be.m_rhs) ) - {} - binary_expr( LExpr&& lhs, Rhs&& rhs ) - : m_lhs( std::forward(lhs) ) - , m_rhs( std::forward(rhs) ) - {} -#else - binary_expr( LExpr const& lhs, Rhs const& rhs ) - : m_lhs( lhs ) - , m_rhs( rhs ) - {} -#endif - - // Specific expression interface - result_type value() const - { - return OP::eval( m_lhs.value(), m_rhs ); - } - void report( std::ostream& ostr ) const - { - return OP::report( ostr, m_lhs, m_rhs ); - } - - assertion_result evaluate( bool no_message = false ) const - { - assertion_result const expr_res( value() ); - if( no_message || expr_res ) - return expr_res; - - wrap_stringstream buff; - report( buff.stream() ); - - return tt_detail::format_assertion_result( buff.stream().str(), expr_res.message() ); - } - - // To support custom manipulators - LExpr const& lhs() const { return m_lhs; } - Rhs const& rhs() const { return m_rhs; } -private: - // Data members - LExpr m_lhs; - Rhs m_rhs; -}; - -// ************************************************************************** // -// ************** assertion::seed ************** // -// ************************************************************************** // -// seed added ot the input expression to form an assertion expression - -class seed { -public: - // ->* is highest precedence left to right operator - template - value_expr -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - operator->*( T&& v ) const - { - return value_expr( std::forward( v ) ); - } -#else - operator->*( T const& v ) const - { - return value_expr( v ); - } -#endif -}; - -#undef BOOST_TEST_FOR_EACH_CONST_OP - -} // namespace assertion -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_ASSERTION_HPP_100911GER diff --git a/libraries/boost/include/boost/test/tools/assertion_result.hpp b/libraries/boost/include/boost/test/tools/assertion_result.hpp deleted file mode 100644 index 85eea741f7..0000000000 --- a/libraries/boost/include/boost/test/tools/assertion_result.hpp +++ /dev/null @@ -1,90 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Enhanced result for test predicate that include message explaining failure -// *************************************************************************** - -#ifndef BOOST_TEST_PREDICATE_RESULT_HPP_012705GER -#define BOOST_TEST_PREDICATE_RESULT_HPP_012705GER - -// Boost.Test -#include -#include -#include - -// Boost -#include -#include - -// STL -#include // for std::size_t - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { - -// ************************************************************************** // -// ************** assertion_result ************** // -// ************************************************************************** // - -//!@brief Type used for storing the result of an assertion. -class BOOST_TEST_DECL assertion_result { - - //!@internal - typedef unit_test::const_string const_string; - - //!@internal - struct dummy { void nonnull() {} }; - - //!@internal - typedef void (dummy::*safe_bool)(); - -public: - // Constructor - assertion_result( bool pv_ ) - : p_predicate_value( pv_ ) - {} - - template - assertion_result( BoolConvertable const& pv_ ) : p_predicate_value( !!pv_ ) {} - - // Access methods - bool operator!() const { return !p_predicate_value; } - void operator=( bool pv_ ) { p_predicate_value.value = pv_; } - operator safe_bool() const { return !!p_predicate_value ? &dummy::nonnull : 0; } - - // Public properties - BOOST_READONLY_PROPERTY( bool, (assertion_result) ) p_predicate_value; - - // Access methods - bool has_empty_message() const { return !m_message; } - wrap_stringstream& message() - { - if( !m_message ) - m_message.reset( new wrap_stringstream ); - - return *m_message; - } - const_string message() const { return !m_message ? const_string() : const_string( m_message->str() ); } - -private: - // Data members - shared_ptr m_message; -}; - -typedef assertion_result predicate_result; - -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_PREDICATE_RESULT_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/collection_comparison_op.hpp b/libraries/boost/include/boost/test/tools/collection_comparison_op.hpp deleted file mode 100644 index 864103fb4a..0000000000 --- a/libraries/boost/include/boost/test/tools/collection_comparison_op.hpp +++ /dev/null @@ -1,449 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Collection comparison with enhanced reporting -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER -#define BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER - -// Boost.Test -#include - -#include -#include - -// Boost -#include -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace assertion { - -// ************************************************************************** // -// ************* selectors for specialized comparizon routines ************** // -// ************************************************************************** // - -template -struct specialized_compare : public mpl::false_ {}; - -template -struct is_c_array : public mpl::false_ {}; - -template -struct is_c_array : public mpl::true_ {}; - -template -struct is_c_array : public mpl::true_ {}; - -#define BOOST_TEST_SPECIALIZED_COLLECTION_COMPARE(Col) \ -namespace boost { namespace test_tools { namespace assertion { \ -template<> \ -struct specialized_compare : public mpl::true_ {}; \ -}}} \ -/**/ - -// ************************************************************************** // -// ************** lexicographic_compare ************** // -// ************************************************************************** // - -namespace op { - -template -inline -typename boost::enable_if_c< - unit_test::is_forward_iterable::value && !unit_test::is_cstring::value - && unit_test::is_forward_iterable::value && !unit_test::is_cstring::value, - assertion_result>::type -lexicographic_compare( Lhs const& lhs, Rhs const& rhs ) -{ - assertion_result ar( true ); - - typedef unit_test::bt_iterator_traits t_Lhs_iterator; - typedef unit_test::bt_iterator_traits t_Rhs_iterator; - - typename t_Lhs_iterator::const_iterator first1 = t_Lhs_iterator::begin(lhs); - typename t_Rhs_iterator::const_iterator first2 = t_Rhs_iterator::begin(rhs); - typename t_Lhs_iterator::const_iterator last1 = t_Lhs_iterator::end(lhs); - typename t_Rhs_iterator::const_iterator last2 = t_Rhs_iterator::end(rhs); - std::size_t pos = 0; - - for( ; (first1 != last1) && (first2 != last2); ++first1, ++first2, ++pos ) { - assertion_result const& element_ar = OP::eval(*first1, *first2); - if( !can_be_equal && element_ar ) - return ar; // a < b - - assertion_result const& reverse_ar = OP::eval(*first2, *first1); - if( element_ar && !reverse_ar ) - return ar; // a<=b and !(b<=a) => a < b => return true - - if( element_ar || !reverse_ar ) - continue; // (a<=b and b<=a) or (!(a a == b => keep looking - - // !(a<=b) and b<=a => b < a => return false - ar = false; - ar.message() << "\nFailure at position " << pos << ": " - << tt_detail::print_helper(*first1) - << OP::revert() - << tt_detail::print_helper(*first2) - << ". " << element_ar.message(); - return ar; - } - - if( first1 != last1 ) { - if( prefer_shorter ) { - ar = false; - ar.message() << "\nFirst collection has extra trailing elements."; - } - } - else if( first2 != last2 ) { - if( !prefer_shorter ) { - ar = false; - ar.message() << "\nSecond collection has extra trailing elements."; - } - } - else if( !can_be_equal ) { - ar = false; - ar.message() << "\nCollections appear to be equal."; - } - - return ar; -} - -template -inline -typename boost::enable_if_c< - (unit_test::is_cstring::value || unit_test::is_cstring::value), - assertion_result>::type -lexicographic_compare( Lhs const& lhs, Rhs const& rhs ) -{ - typedef typename unit_test::deduce_cstring::type lhs_char_type; - typedef typename unit_test::deduce_cstring::type rhs_char_type; - - return lexicographic_compare( - lhs_char_type(lhs), - rhs_char_type(rhs)); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** equality_compare ************** // -// ************************************************************************** // - -template -inline -typename boost::enable_if_c< - unit_test::is_forward_iterable::value && !unit_test::is_cstring::value - && unit_test::is_forward_iterable::value && !unit_test::is_cstring::value, - assertion_result>::type -element_compare( Lhs const& lhs, Rhs const& rhs ) -{ - typedef unit_test::bt_iterator_traits t_Lhs_iterator; - typedef unit_test::bt_iterator_traits t_Rhs_iterator; - - assertion_result ar( true ); - - if( t_Lhs_iterator::size(lhs) != t_Rhs_iterator::size(rhs) ) { - ar = false; - ar.message() << "\nCollections size mismatch: " << t_Lhs_iterator::size(lhs) << " != " << t_Rhs_iterator::size(rhs); - return ar; - } - - typename t_Lhs_iterator::const_iterator left = t_Lhs_iterator::begin(lhs); - typename t_Rhs_iterator::const_iterator right = t_Rhs_iterator::begin(rhs); - std::size_t pos = 0; - - for( ; pos < t_Lhs_iterator::size(lhs); ++left, ++right, ++pos ) { - assertion_result const element_ar = OP::eval( *left, *right ); - if( element_ar ) - continue; - - ar = false; - ar.message() << "\nMismatch at position " << pos << ": " - << tt_detail::print_helper(*left) - << OP::revert() - << tt_detail::print_helper(*right) - << ". " << element_ar.message(); - } - - return ar; -} - -// In case string comparison is branching here -template -inline -typename boost::enable_if_c< - (unit_test::is_cstring::value || unit_test::is_cstring::value), - assertion_result>::type -element_compare( Lhs const& lhs, Rhs const& rhs ) -{ - typedef typename unit_test::deduce_cstring::type lhs_char_type; - typedef typename unit_test::deduce_cstring::type rhs_char_type; - - return element_compare(lhs_char_type(lhs), - rhs_char_type(rhs)); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** non_equality_compare ************** // -// ************************************************************************** // - -template -inline assertion_result -non_equality_compare( Lhs const& lhs, Rhs const& rhs ) -{ - typedef unit_test::bt_iterator_traits t_Lhs_iterator; - typedef unit_test::bt_iterator_traits t_Rhs_iterator; - - assertion_result ar( true ); - - if( t_Lhs_iterator::size(lhs) != t_Rhs_iterator::size(rhs) ) - return ar; - - typename t_Lhs_iterator::const_iterator left = t_Lhs_iterator::begin(lhs); - typename t_Rhs_iterator::const_iterator right = t_Rhs_iterator::begin(rhs); - typename t_Lhs_iterator::const_iterator end = t_Lhs_iterator::end(lhs); - - for( ; left != end; ++left, ++right ) { - if( OP::eval( *left, *right ) ) - return ar; - } - - ar = false; - ar.message() << "\nCollections appear to be equal"; - - return ar; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** cctraits ************** // -// ************************************************************************** // -// set of collection comparison traits per comparison OP - -template -struct cctraits; - -template -struct cctraits > { - typedef specialized_compare is_specialized; -}; - -template -struct cctraits > { - typedef specialized_compare is_specialized; -}; - -template -struct cctraits > { - static const bool can_be_equal = false; - static const bool prefer_short = true; - - typedef specialized_compare is_specialized; -}; - -template -struct cctraits > { - static const bool can_be_equal = true; - static const bool prefer_short = true; - - typedef specialized_compare is_specialized; -}; - -template -struct cctraits > { - static const bool can_be_equal = false; - static const bool prefer_short = false; - - typedef specialized_compare is_specialized; -}; - -template -struct cctraits > { - static const bool can_be_equal = true; - static const bool prefer_short = false; - - typedef specialized_compare is_specialized; -}; - -// ************************************************************************** // -// ************** compare_collections ************** // -// ************************************************************************** // -// Overloaded set of functions dispatching to specific implementation of comparison - -template -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::true_ ) -{ - return assertion::op::element_compare >( lhs, rhs ); -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) -{ - return lhs == rhs; -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::true_ ) -{ - return assertion::op::non_equality_compare >( lhs, rhs ); -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) -{ - return lhs != rhs; -} - -//____________________________________________________________________________// - -template -inline assertion_result -lexicographic_compare( Lhs const& lhs, Rhs const& rhs ) -{ - return assertion::op::lexicographic_compare::can_be_equal, cctraits::prefer_short>( lhs, rhs ); -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type*, mpl::true_ ) -{ - return lexicographic_compare( lhs, rhs ); -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) -{ - return lhs < rhs; -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) -{ - return lhs <= rhs; -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) -{ - return lhs > rhs; -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >*, mpl::false_ ) -{ - return lhs >= rhs; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ********* specialization of comparison operators for collections ********* // -// ************************************************************************** // - -#define DEFINE_COLLECTION_COMPARISON( oper, name, rev ) \ -template \ -struct name::value \ - && !unit_test::is_cstring_comparable::value \ - && unit_test::is_forward_iterable::value \ - && !unit_test::is_cstring_comparable::value>::type> { \ -public: \ - typedef assertion_result result_type; \ - typedef unit_test::bt_iterator_traits t_Lhs_iterator_helper; \ - typedef unit_test::bt_iterator_traits t_Rhs_iterator_helper; \ - \ - typedef name OP; \ - \ - typedef typename \ - mpl::if_c< \ - mpl::or_< \ - typename is_c_array::type, \ - typename is_c_array::type \ - >::value, \ - mpl::true_, \ - typename \ - mpl::if_c::type, \ - typename decay::type>::value, \ - typename cctraits::is_specialized, \ - mpl::false_>::type \ - >::type is_specialized; \ - \ - typedef name elem_op; \ - \ - static assertion_result \ - eval( Lhs const& lhs, Rhs const& rhs) \ - { \ - return assertion::op::compare_collections( lhs, rhs, \ - (boost::type*)0, \ - is_specialized() ); \ - } \ - \ - template \ - static void \ - report( std::ostream&, \ - PrevExprType const&, \ - Rhs const& ) {} \ - \ - static char const* revert() \ - { return " " #rev " "; } \ - \ -}; \ -/**/ - -BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_COLLECTION_COMPARISON ) -#undef DEFINE_COLLECTION_COMPARISON - -//____________________________________________________________________________// - -} // namespace op -} // namespace assertion -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_COLLECTION_COMPARISON_OP_HPP_050815GER diff --git a/libraries/boost/include/boost/test/tools/context.hpp b/libraries/boost/include/boost/test/tools/context.hpp deleted file mode 100644 index 71650065ef..0000000000 --- a/libraries/boost/include/boost/test/tools/context.hpp +++ /dev/null @@ -1,65 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : test tools context interfaces -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER -#define BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER - -// Boost.Test -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** context_frame ************** // -// ************************************************************************** // - -struct BOOST_TEST_DECL context_frame { - explicit context_frame( ::boost::unit_test::lazy_ostream const& context_descr ); - ~context_frame(); - - operator bool(); - -private: - // Data members - int m_frame_id; -}; - -//____________________________________________________________________________// - -#define BOOST_TEST_INFO( context_descr ) \ - ::boost::unit_test::framework::add_context( BOOST_TEST_LAZY_MSG( context_descr ) , false ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_TEST_CONTEXT( context_descr ) \ - if( ::boost::test_tools::tt_detail::context_frame BOOST_JOIN( context_frame_, __LINE__ ) = \ - ::boost::test_tools::tt_detail::context_frame( BOOST_TEST_LAZY_MSG( context_descr ) ) ) \ -/**/ - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER diff --git a/libraries/boost/include/boost/test/tools/cstring_comparison_op.hpp b/libraries/boost/include/boost/test/tools/cstring_comparison_op.hpp deleted file mode 100644 index 50f181d858..0000000000 --- a/libraries/boost/include/boost/test/tools/cstring_comparison_op.hpp +++ /dev/null @@ -1,88 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief C string comparison with enhanced reporting -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER -#define BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER - -// Boost.Test -#include - -#include -#include - -// Boost -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace assertion { -namespace op { - -// ************************************************************************** // -// ************** string_compare ************** // -// ************************************************************************** // - -#define DEFINE_CSTRING_COMPARISON( oper, name, rev ) \ -template \ -struct name::value \ - && unit_test::is_cstring_comparable::value) \ - >::type > \ -{ \ - typedef typename unit_test::deduce_cstring::type lhs_char_type; \ - typedef typename unit_test::deduce_cstring::type rhs_char_type; \ -public: \ - typedef assertion_result result_type; \ - \ - typedef name< \ - typename lhs_char_type::value_type, \ - typename rhs_char_type::value_type> elem_op; \ - \ - static bool \ - eval( Lhs const& lhs, Rhs const& rhs) \ - { \ - return lhs_char_type(lhs) oper rhs_char_type(rhs); \ - } \ - \ - template \ - static void \ - report( std::ostream& ostr, \ - PrevExprType const& lhs, \ - Rhs const& rhs) \ - { \ - lhs.report( ostr ); \ - ostr << revert() \ - << tt_detail::print_helper( rhs ); \ - } \ - \ - static char const* revert() \ - { return " " #rev " "; } \ -}; \ -/**/ - -BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_CSTRING_COMPARISON ) -#undef DEFINE_CSTRING_COMPARISON - -//____________________________________________________________________________// - -} // namespace op -} // namespace assertion -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER - diff --git a/libraries/boost/include/boost/test/tools/detail/bitwise_manip.hpp b/libraries/boost/include/boost/test/tools/detail/bitwise_manip.hpp deleted file mode 100644 index f8c9685c10..0000000000 --- a/libraries/boost/include/boost/test/tools/detail/bitwise_manip.hpp +++ /dev/null @@ -1,123 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! Bitwise comparison manipulator implementation -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER -#define BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER - -// Boost Test -#include -#include - -#include -#include - -// STL -#include // for CHAR_BIT - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { - -// ************************************************************************** // -// ************** bitwise comparison manipulator ************** // -// ************************************************************************** // - -//! Bitwise comparison manipulator -struct bitwise {}; - -//____________________________________________________________________________// - -inline int -operator<<( unit_test::lazy_ostream const&, bitwise ) { return 0; } - -//____________________________________________________________________________// - -namespace tt_detail { - -/*!@brief Bitwise comparison of two operands - * - * This class constructs an @ref assertion_result that contains precise bit comparison information. - * In particular the location of the mismatches (if any) are printed in the assertion result. - */ -template -inline assertion_result -bitwise_compare(Lhs const& lhs, Rhs const& rhs, E const& expr ) -{ - assertion_result pr( true ); - - std::size_t left_bit_size = sizeof(Lhs)*CHAR_BIT; - std::size_t right_bit_size = sizeof(Rhs)*CHAR_BIT; - - static Lhs const leftOne( 1 ); - static Rhs const rightOne( 1 ); - - std::size_t total_bits = left_bit_size < right_bit_size ? left_bit_size : right_bit_size; - - for( std::size_t counter = 0; counter < total_bits; ++counter ) { - if( (lhs & ( leftOne << counter )) != (rhs & (rightOne << counter)) ) { - if( pr ) { - pr.message() << " ["; - expr.report( pr.message().stream() ); - pr.message() << "]. Bitwise comparison failed"; - pr = false; - } - pr.message() << "\nMismatch at position " << counter; - } - } - - if( left_bit_size != right_bit_size ) { - if( pr ) { - pr.message() << " ["; - expr.report( pr.message().stream() ); - pr.message() << "]. Bitwise comparison failed"; - pr = false; - } - pr.message() << "\nOperands bit sizes mismatch: " << left_bit_size << " != " << right_bit_size; - } - - return pr; -} - -//____________________________________________________________________________// - -//! Returns an assertion_result using the bitwise comparison out of an expression -//! -//! This is used as a modifer of the normal operator<< on expressions to use the -//! bitwise comparison. -//! -//! @note Available only for compilers supporting the @c auto declaration. -template -inline assertion_result -operator<<(assertion_evaluate_t > > const& ae, bitwise ) -{ - return bitwise_compare( ae.m_e.lhs().value(), ae.m_e.rhs(), ae.m_e ); -} - -//____________________________________________________________________________// - -inline check_type -operator<<( assertion_type const& , bitwise ) -{ - return CHECK_BUILT_ASSERTION; -} - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_DETAIL_BITWISE_MANIP_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/detail/expression_holder.hpp b/libraries/boost/include/boost/test/tools/detail/expression_holder.hpp deleted file mode 100644 index 694a2d5f4e..0000000000 --- a/libraries/boost/include/boost/test/tools/detail/expression_holder.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : toolbox implementation details -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER -#define BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER - -#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** tt_detail::expression_holder ************** // -// ************************************************************************** // - -class expression_holder { -public: - virtual ~expression_holder() {} - virtual assertion_result evaluate( bool no_message = false ) const = 0; -}; - -//____________________________________________________________________________// - -template -class expression_holder_t: public expression_holder { -public: - explicit expression_holder_t( E const& e ) : m_expr( e ) {} - -private: - virtual assertion_result evaluate( bool no_message = false ) const { return m_expr.evaluate( no_message ); } - - E m_expr; -}; - -//____________________________________________________________________________// - -template -expression_holder_t -hold_expression( E const& e ) -{ - return expression_holder_t( e ); -} - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include - -#endif - -#endif // BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/detail/fwd.hpp b/libraries/boost/include/boost/test/tools/detail/fwd.hpp deleted file mode 100644 index 339ab39eda..0000000000 --- a/libraries/boost/include/boost/test/tools/detail/fwd.hpp +++ /dev/null @@ -1,121 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : toolbox implementation types and forward declarations -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER -#define BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER - -// Boost.Test -#include -#include - -// STL -#include // for std::size_t - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -class lazy_ostream; - -} // namespace unit_test - -namespace test_tools { - -using unit_test::const_string; -class assertion_result; - -//____________________________________________________________________________// - -namespace tt_detail { - -inline bool dummy_cond() { return false; } - -// ************************************************************************** // -// ************** types of supported assertions ************** // -// ************************************************************************** // - -//____________________________________________________________________________// - -enum check_type { - CHECK_PRED, - CHECK_MSG, - CHECK_EQUAL, - CHECK_NE, - CHECK_LT, - CHECK_LE, - CHECK_GT, - CHECK_GE, - CHECK_CLOSE, - CHECK_CLOSE_FRACTION, - CHECK_SMALL, - CHECK_BITWISE_EQUAL, - CHECK_PRED_WITH_ARGS, - CHECK_EQUAL_COLL, - CHECK_BUILT_ASSERTION -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** levels of supported assertions ************** // -// ************************************************************************** // - -enum tool_level { - WARN, CHECK, REQUIRE, PASS -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** Tools offline implementation ************** // -// ************************************************************************** // - -BOOST_TEST_DECL bool -report_assertion( assertion_result const& pr, unit_test::lazy_ostream const& assertion_descr, - const_string file_name, std::size_t line_num, - tool_level tl, check_type ct, - std::size_t num_args, ... ); - -//____________________________________________________________________________// - -BOOST_TEST_DECL assertion_result -format_assertion_result( const_string expr_val, const_string details ); - -//____________________________________________________________________________// - -BOOST_TEST_DECL assertion_result -format_fpc_report( const_string expr_val, const_string details ); - -//____________________________________________________________________________// - -BOOST_TEST_DECL bool -is_defined_impl( const_string symbol_name, const_string symbol_value ); - -//____________________________________________________________________________// - -BOOST_TEST_DECL assertion_result -equal_impl( char const* left, char const* right ); - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_DETAIL_FWD_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/detail/indirections.hpp b/libraries/boost/include/boost/test/tools/detail/indirections.hpp deleted file mode 100644 index 836218d98d..0000000000 --- a/libraries/boost/include/boost/test/tools/detail/indirections.hpp +++ /dev/null @@ -1,94 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : inidiration interfaces to support manipulators and message output -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER -#define BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER - -// Boost.Test -#include - -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** assertion_evaluate indirection ************** // -// ************************************************************************** // - -template -struct assertion_evaluate_t { - assertion_evaluate_t( E const& e ) : m_e( e ) {} - operator assertion_result() { return m_e.evaluate( true ); } - - E const& m_e; -}; - -//____________________________________________________________________________// - -template -inline assertion_evaluate_t -assertion_evaluate( E const& e ) { return assertion_evaluate_t( e ); } - -//____________________________________________________________________________// - -template -inline assertion_evaluate_t -operator<<( assertion_evaluate_t const& ae, T const& ) { return ae; } - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** assertion_text indirection ************** // -// ************************************************************************** // - -template -inline unit_test::lazy_ostream const& -assertion_text( unit_test::lazy_ostream const& /*et*/, T const& m ) { return m; } - -//____________________________________________________________________________// - -inline unit_test::lazy_ostream const& -assertion_text( unit_test::lazy_ostream const& et, int ) { return et; } - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** assertion_evaluate indirection ************** // -// ************************************************************************** // - -struct assertion_type { - operator check_type() { return CHECK_MSG; } -}; - -//____________________________________________________________________________// - -template -inline assertion_type -operator<<( assertion_type const& at, T const& ) { return at; } - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER diff --git a/libraries/boost/include/boost/test/tools/detail/it_pair.hpp b/libraries/boost/include/boost/test/tools/detail/it_pair.hpp deleted file mode 100644 index 4352fd464f..0000000000 --- a/libraries/boost/include/boost/test/tools/detail/it_pair.hpp +++ /dev/null @@ -1,74 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : support for backward compatible collection comparison interface -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER -#define BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER - -#ifdef BOOST_TEST_NO_OLD_TOOLS - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** backward compatibility support ************** // -// ************************************************************************** // - -template -struct it_pair { - typedef It const_iterator; - typedef typename std::iterator_traits::value_type value_type; - - it_pair( It const& b, It const& e ) : m_begin( b ), m_size( 0 ) - { - It tmp = b; - while( tmp != e ) { ++m_size; ++tmp; } - } - - It begin() const { return m_begin; } - It end() const { return m_begin + m_size; } - size_t size() const { return m_size; } - -private: - It m_begin; - size_t m_size; -}; - -//____________________________________________________________________________// - -template -it_pair -make_it_pair( It const& b, It const& e ) { return it_pair( b, e ); } - -//____________________________________________________________________________// - -template -it_pair -make_it_pair( T const* b, T const* e ) { return it_pair( b, e ); } - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_NO_OLD_TOOLS - -#endif // BOOST_TEST_TOOLS_DETAIL_IT_PAIR_HPP_112812GER diff --git a/libraries/boost/include/boost/test/tools/detail/lexicographic_manip.hpp b/libraries/boost/include/boost/test/tools/detail/lexicographic_manip.hpp deleted file mode 100644 index f6ffff7a34..0000000000 --- a/libraries/boost/include/boost/test/tools/detail/lexicographic_manip.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! Lexicographic comparison manipulator implementation -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER -#define BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER - -// Boost Test -#include -#include - -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { - -// ************************************************************************** // -// ************** per element comparison manipulator ************** // -// ************************************************************************** // - -//! Lexicographic comparison manipulator, for containers -struct lexicographic {}; - -//____________________________________________________________________________// - -inline int -operator<<( unit_test::lazy_ostream const&, lexicographic ) { return 0; } - -//____________________________________________________________________________// - -namespace tt_detail { - -template -inline assertion_result -operator<<(assertion_evaluate_t > const& ae, lexicographic ) -{ - typedef typename OP::elem_op elem_op; - return assertion::op::lexicographic_compare( ae.m_e.lhs().value(), ae.m_e.rhs() ); -} - -//____________________________________________________________________________// - -inline check_type -operator<<( assertion_type const&, lexicographic ) -{ - return CHECK_BUILT_ASSERTION; -} - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_DETAIL_LEXICOGRAPHIC_MANIP_HPP_050815GER diff --git a/libraries/boost/include/boost/test/tools/detail/per_element_manip.hpp b/libraries/boost/include/boost/test/tools/detail/per_element_manip.hpp deleted file mode 100644 index 4a9aebbaaa..0000000000 --- a/libraries/boost/include/boost/test/tools/detail/per_element_manip.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! Per element comparison manipulator implementation -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER -#define BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER - -// Boost Test -#include -#include - -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { - -// ************************************************************************** // -// ************** per element comparison manipulator ************** // -// ************************************************************************** // - -//! Per element comparison manipulator, for containers -struct per_element {}; - -//____________________________________________________________________________// - -inline int -operator<<( unit_test::lazy_ostream const&, per_element ) { return 0; } - -//____________________________________________________________________________// - -namespace tt_detail { - -template -inline assertion_result -operator<<(assertion_evaluate_t > const& ae, per_element ) -{ - typedef typename OP::elem_op elem_op; - return assertion::op::element_compare( ae.m_e.lhs().value(), ae.m_e.rhs() ); -} - -//____________________________________________________________________________// - -inline check_type -operator<<( assertion_type const&, per_element ) -{ - return CHECK_BUILT_ASSERTION; -} - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER diff --git a/libraries/boost/include/boost/test/tools/detail/print_helper.hpp b/libraries/boost/include/boost/test/tools/detail/print_helper.hpp deleted file mode 100644 index 2c6a3b5e80..0000000000 --- a/libraries/boost/include/boost/test/tools/detail/print_helper.hpp +++ /dev/null @@ -1,246 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : defines level of indiration facilitating workarounds for non printable types -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER -#define BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER - -// Boost.Test -#include -#include -#include - -// Boost -#include -#include -#include -#include -#include -#include - -#include - -#if !defined(BOOST_NO_CXX11_NULLPTR) -#include -#endif - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** boost_test_print_type ************** // -// ************************************************************************** // - - namespace impl { - template - std::ostream& boost_test_print_type(std::ostream& ostr, T const& t) { - BOOST_STATIC_ASSERT_MSG( (boost::has_left_shift::value), - "Type has to implement operator<< to be printable"); - ostr << t; - return ostr; - } - - struct boost_test_print_type_impl { - template - std::ostream& operator()(std::ostream& ostr, R const& r) const { - return boost_test_print_type(ostr, r); - } - }; - } - - // To avoid ODR violations, see N4381 - template struct static_const { static const T value; }; - template const T static_const::value = T(); - - namespace { - static const impl::boost_test_print_type_impl& boost_test_print_type = - static_const::value; - } - - -// ************************************************************************** // -// ************** print_log_value ************** // -// ************************************************************************** // - -template -struct print_log_value { - void operator()( std::ostream& ostr, T const& t ) - { - typedef typename mpl::or_,is_function,is_abstract >::type cant_use_nl; - - std::streamsize old_precision = set_precision( ostr, cant_use_nl() ); - - //ostr << t; - using boost::test_tools::tt_detail::boost_test_print_type; - boost_test_print_type(ostr, t); - - if( old_precision != (std::streamsize)-1 ) - ostr.precision( old_precision ); - } - - std::streamsize set_precision( std::ostream& ostr, mpl::false_ ) - { - if( std::numeric_limits::is_specialized && std::numeric_limits::radix == 2 ) - return ostr.precision( 2 + std::numeric_limits::digits * 301/1000 ); - else if ( std::numeric_limits::is_specialized && std::numeric_limits::radix == 10 ) { -#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS - // (was BOOST_NO_NUMERIC_LIMITS_LOWEST but now deprecated). - // No support for std::numeric_limits::max_digits10, - // so guess that a couple of guard digits more than digits10 will display any difference. - return ostr.precision( 2 + std::numeric_limits::digits10 ); -#else - // std::numeric_limits::max_digits10; IS supported. - // Any noisy or guard digits needed to display any difference are included in max_digits10. - return ostr.precision( std::numeric_limits::max_digits10 ); -#endif - } - // else if T is not specialized for std::numeric_limits<>, - // then will just get the default precision of 6 digits. - return (std::streamsize)-1; - } - - std::streamsize set_precision( std::ostream&, mpl::true_ ) { return (std::streamsize)-1; } -}; - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -template -struct print_log_value< T[N] > { - void operator()( std::ostream& ostr, T const* t ) - { - ostr << t; - } -}; -#endif - -//____________________________________________________________________________// - -template<> -struct BOOST_TEST_DECL print_log_value { - void operator()( std::ostream& ostr, bool t ); -}; - -//____________________________________________________________________________// - -template<> -struct BOOST_TEST_DECL print_log_value { - void operator()( std::ostream& ostr, char t ); -}; - -//____________________________________________________________________________// - -template<> -struct BOOST_TEST_DECL print_log_value { - void operator()( std::ostream& ostr, unsigned char t ); -}; - -//____________________________________________________________________________// - -template<> -struct BOOST_TEST_DECL print_log_value { - void operator()( std::ostream& ostr, char const* t ); -}; - -//____________________________________________________________________________// - -template<> -struct BOOST_TEST_DECL print_log_value { - void operator()( std::ostream& ostr, wchar_t const* t ); -}; - -#if !defined(BOOST_NO_CXX11_NULLPTR) -template<> -struct print_log_value { - // declaration and definition is here because of #12969 https://svn.boost.org/trac10/ticket/12969 - void operator()( std::ostream& ostr, std::nullptr_t /*t*/ ) { - ostr << "nullptr"; - } -}; -#endif - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** print_helper ************** // -// ************************************************************************** // -// Adds level of indirection to the output operation, allowing us to customize -// it for types that do not support operator << directly or for any other reason - -template -struct print_helper_t { - explicit print_helper_t( T const& t ) : m_t( t ) {} - - T const& m_t; -}; - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -// Borland suffers premature pointer decay passing arrays by reference -template -struct print_helper_t< T[N] > { - explicit print_helper_t( T const * t ) : m_t( t ) {} - - T const * m_t; -}; -#endif - -//____________________________________________________________________________// - -template -inline print_helper_t -print_helper( T const& t ) -{ - return print_helper_t( t ); -} - -//____________________________________________________________________________// - -template -inline std::ostream& -operator<<( std::ostream& ostr, print_helper_t const& ph ) -{ - print_log_value()( ostr, ph.m_t ); - - return ostr; -} - -//____________________________________________________________________________// - -} // namespace tt_detail - -// ************************************************************************** // -// ************** BOOST_TEST_DONT_PRINT_LOG_VALUE ************** // -// ************************************************************************** // - -#define BOOST_TEST_DONT_PRINT_LOG_VALUE( the_type ) \ -namespace boost{ namespace test_tools{ namespace tt_detail{ \ -template<> \ -struct print_log_value { \ - void operator()( std::ostream&, the_type const& ) {} \ -}; \ -}}} \ -/**/ - -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_IMPL_COMMON_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/detail/tolerance_manip.hpp b/libraries/boost/include/boost/test/tools/detail/tolerance_manip.hpp deleted file mode 100644 index e07b043591..0000000000 --- a/libraries/boost/include/boost/test/tools/detail/tolerance_manip.hpp +++ /dev/null @@ -1,130 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! @brief Floating point comparison tolerance manipulators -//! -//! This file defines several manipulators for floating point comparison. These -//! manipulators are intended to be used with BOOST_TEST. -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER -#define BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER - -// Boost Test -#include -#include - -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** fpc tolerance manipulator ************** // -// ************************************************************************** // - -template -struct tolerance_manip { - explicit tolerance_manip( FPT const & tol ) : m_value( tol ) {} - - FPT m_value; -}; - -//____________________________________________________________________________// - -struct tolerance_manip_delay {}; - -template -inline tolerance_manip -operator%( FPT v, tolerance_manip_delay const& ) -{ - BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based::value), - "tolerance should be specified using a floating points type" ); - - return tolerance_manip( FPT(v / 100) ); -} - -//____________________________________________________________________________// - -template -inline assertion_result -operator<<(assertion_evaluate_t const& ae, tolerance_manip const& tol) -{ - local_fpc_tolerance lt( tol.m_value ); - - return ae.m_e.evaluate(); -} - -//____________________________________________________________________________// - -template -inline int -operator<<( unit_test::lazy_ostream const&, tolerance_manip const& ) { return 0; } - -//____________________________________________________________________________// - -template -inline check_type -operator<<( assertion_type const& /*at*/, tolerance_manip const& ) { return CHECK_BUILT_ASSERTION; } - -//____________________________________________________________________________// - -} // namespace tt_detail - - -/*! Tolerance manipulator - * - * These functions return a manipulator that can be used in conjunction with BOOST_TEST - * in order to specify the tolerance with which floating point comparisons are made. - */ -template -inline tt_detail::tolerance_manip -tolerance( FPT v ) -{ - BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based::value), - "tolerance only for floating points" ); - - return tt_detail::tolerance_manip( v ); -} - -//____________________________________________________________________________// - -//! @overload tolerance( FPT v ) -template -inline tt_detail::tolerance_manip -tolerance( fpc::percent_tolerance_t v ) -{ - BOOST_STATIC_ASSERT_MSG( (fpc::tolerance_based::value), - "tolerance only for floating points" ); - - return tt_detail::tolerance_manip( static_cast(v.m_value / 100) ); -} - -//____________________________________________________________________________// - -//! @overload tolerance( FPT v ) -inline tt_detail::tolerance_manip_delay -tolerance() -{ - return tt_detail::tolerance_manip_delay(); -} - -//____________________________________________________________________________// - -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_DETAIL_TOLERANCE_MANIP_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/floating_point_comparison.hpp b/libraries/boost/include/boost/test/tools/floating_point_comparison.hpp deleted file mode 100644 index d704a41092..0000000000 --- a/libraries/boost/include/boost/test/tools/floating_point_comparison.hpp +++ /dev/null @@ -1,315 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief algorithms for comparing floating point values -// *************************************************************************** - -#ifndef BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER -#define BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER - -// Boost.Test -#include -#include - -// Boost -#include // for std::numeric_limits -#include -#include -#include -#include -#include -#include -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace math { -namespace fpc { - -// ************************************************************************** // -// ************** fpc::tolerance_based ************** // -// ************************************************************************** // - - -//! @internal -//! Protects the instanciation of std::numeric_limits from non-supported types (eg. T=array) -template -struct tolerance_based_delegate; - -template -struct tolerance_based_delegate : mpl::false_ {}; - -template -struct tolerance_based_delegate -: mpl::bool_< - is_floating_point::value || - (!std::numeric_limits::is_integer && std::numeric_limits::is_specialized && !std::numeric_limits::is_exact)> -{}; - - -/*!@brief Indicates if a type can be compared using a tolerance scheme - * - * This is a metafunction that should evaluate to @c mpl::true_ if the type - * @c T can be compared using a tolerance based method, typically for floating point - * types. - * - * This metafunction can be specialized further to declare user types that are - * floating point (eg. boost.multiprecision). - */ -template -struct tolerance_based : tolerance_based_delegate::value >::type {}; - -// ************************************************************************** // -// ************** fpc::strength ************** // -// ************************************************************************** // - -//! Method for comparing floating point numbers -enum strength { - FPC_STRONG, //!< "Very close" - equation 2' in docs, the default - FPC_WEAK //!< "Close enough" - equation 3' in docs. -}; - - -// ************************************************************************** // -// ************** tolerance presentation types ************** // -// ************************************************************************** // - -template -struct percent_tolerance_t { - explicit percent_tolerance_t( FPT v ) : m_value( v ) {} - - FPT m_value; -}; - -//____________________________________________________________________________// - -template -inline std::ostream& operator<<( std::ostream& out, percent_tolerance_t t ) -{ - return out << t.m_value; -} - -//____________________________________________________________________________// - -template -inline percent_tolerance_t -percent_tolerance( FPT v ) -{ - return percent_tolerance_t( v ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** details ************** // -// ************************************************************************** // - -namespace fpc_detail { - -// FPT is Floating-Point Type: float, double, long double or User-Defined. -template -inline FPT -fpt_abs( FPT fpv ) -{ - return fpv < static_cast(0) ? -fpv : fpv; -} - -//____________________________________________________________________________// - -template -struct fpt_specialized_limits -{ - static FPT min_value() { return (std::numeric_limits::min)(); } - static FPT max_value() { return (std::numeric_limits::max)(); } -}; - -template -struct fpt_non_specialized_limits -{ - static FPT min_value() { return static_cast(0); } - static FPT max_value() { return static_cast(1000000); } // for our purposes it doesn't really matter what value is returned here -}; - -template -struct fpt_limits : boost::conditional::is_specialized, - fpt_specialized_limits, - fpt_non_specialized_limits - >::type -{}; - -//____________________________________________________________________________// - -// both f1 and f2 are unsigned here -template -inline FPT -safe_fpt_division( FPT f1, FPT f2 ) -{ - // Avoid overflow. - if( (f2 < static_cast(1)) && (f1 > f2*fpt_limits::max_value()) ) - return fpt_limits::max_value(); - - // Avoid underflow. - if( (f1 == static_cast(0)) || - ((f2 > static_cast(1)) && (f1 < f2*fpt_limits::min_value())) ) - return static_cast(0); - - return f1/f2; -} - -//____________________________________________________________________________// - -template -inline FPT -fraction_tolerance( ToleranceType tolerance ) -{ - return static_cast(tolerance); -} - -//____________________________________________________________________________// - -template -inline FPT2 -fraction_tolerance( percent_tolerance_t tolerance ) -{ - return FPT2(tolerance.m_value)*FPT2(0.01); -} - -//____________________________________________________________________________// - -} // namespace fpc_detail - -// ************************************************************************** // -// ************** close_at_tolerance ************** // -// ************************************************************************** // - - -/*!@brief Predicate for comparing floating point numbers - * - * This predicate is used to compare floating point numbers. In addition the comparison produces maximum - * related differnce, which can be used to generate detailed error message - * The methods for comparing floating points are detailed in the documentation. The method is chosen - * by the @ref boost::math::fpc::strength given at construction. - */ -template -class close_at_tolerance { -public: - // Public typedefs - typedef bool result_type; - - // Constructor - template - explicit close_at_tolerance( ToleranceType tolerance, fpc::strength fpc_strength = FPC_STRONG ) - : m_fraction_tolerance( fpc_detail::fraction_tolerance( tolerance ) ) - , m_strength( fpc_strength ) - , m_tested_rel_diff( 0 ) - { - BOOST_ASSERT_MSG( m_fraction_tolerance >= FPT(0), "tolerance must not be negative!" ); // no reason for tolerance to be negative - } - - // Access methods - //! Returns the tolerance - FPT fraction_tolerance() const { return m_fraction_tolerance; } - - //! Returns the comparison method - fpc::strength strength() const { return m_strength; } - - //! Returns the failing fraction - FPT tested_rel_diff() const { return m_tested_rel_diff; } - - /*! Compares two floating point numbers a and b such that their "left" relative difference |a-b|/a and/or - * "right" relative difference |a-b|/b does not exceed specified relative (fraction) tolerance. - * - * @param[in] left first floating point number to be compared - * @param[in] right second floating point number to be compared - * - * What is reported by @c tested_rel_diff in case of failure depends on the comparison method: - * - for @c FPC_STRONG: the max of the two fractions - * - for @c FPC_WEAK: the min of the two fractions - * The rationale behind is to report the tolerance to set in order to make a test pass. - */ - bool operator()( FPT left, FPT right ) const - { - FPT diff = fpc_detail::fpt_abs( left - right ); - FPT fraction_of_right = fpc_detail::safe_fpt_division( diff, fpc_detail::fpt_abs( right ) ); - FPT fraction_of_left = fpc_detail::safe_fpt_division( diff, fpc_detail::fpt_abs( left ) ); - - FPT max_rel_diff = (std::max)( fraction_of_left, fraction_of_right ); - FPT min_rel_diff = (std::min)( fraction_of_left, fraction_of_right ); - - m_tested_rel_diff = m_strength == FPC_STRONG ? max_rel_diff : min_rel_diff; - - return m_tested_rel_diff <= m_fraction_tolerance; - } - -private: - // Data members - FPT m_fraction_tolerance; - fpc::strength m_strength; - mutable FPT m_tested_rel_diff; -}; - -// ************************************************************************** // -// ************** small_with_tolerance ************** // -// ************************************************************************** // - - -/*!@brief Predicate for comparing floating point numbers against 0 - * - * Serves the same purpose as boost::math::fpc::close_at_tolerance, but used when one - * of the operand is null. - */ -template -class small_with_tolerance { -public: - // Public typedefs - typedef bool result_type; - - // Constructor - explicit small_with_tolerance( FPT tolerance ) // <= absolute tolerance - : m_tolerance( tolerance ) - { - BOOST_ASSERT( m_tolerance >= FPT(0) ); // no reason for the tolerance to be negative - } - - // Action method - bool operator()( FPT fpv ) const - { - return fpc::fpc_detail::fpt_abs( fpv ) <= m_tolerance; - } - -private: - // Data members - FPT m_tolerance; -}; - -// ************************************************************************** // -// ************** is_small ************** // -// ************************************************************************** // - -template -inline bool -is_small( FPT fpv, FPT tolerance ) -{ - return small_with_tolerance( tolerance )( fpv ); -} - -//____________________________________________________________________________// - -} // namespace fpc -} // namespace math -} // namespace boost - -#include - -#endif // BOOST_FLOATING_POINT_COMAPARISON_HPP_071894GER diff --git a/libraries/boost/include/boost/test/tools/fpc_op.hpp b/libraries/boost/include/boost/test/tools/fpc_op.hpp deleted file mode 100644 index b879d218f2..0000000000 --- a/libraries/boost/include/boost/test/tools/fpc_op.hpp +++ /dev/null @@ -1,210 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief Floating point comparison with enhanced reporting -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER -#define BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER - -// Boost.Test -#include - -#include -#include - -// Boost -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace assertion { -namespace op { - -// ************************************************************************** // -// ************** fpctraits ************** // -// ************************************************************************** // -// set of floating point comparison traits per comparison OP - -template -struct fpctraits { - // indicate if we should perform the operation with a "logical OR" - // with the "equality under tolerance". - static const bool equality_logical_disjunction = true; -}; - -template -struct fpctraits > { - static const bool equality_logical_disjunction = false; -}; - -template -struct fpctraits > { - static const bool equality_logical_disjunction = false; -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** set of overloads to select correct fpc algo ************** // -// ************************************************************************** // -// we really only care about EQ vs NE. All other comparisons use direct first -// and then need EQ. For example a <= b (tolerance t) IFF a <= b OR a == b (tolerance t) - -template -inline assertion_result -compare_fpv( Lhs const& lhs, Rhs const& rhs, OP* cmp_operator) -{ - bool result = cmp_operator->eval_direct(lhs, rhs); - if(fpctraits::equality_logical_disjunction) { - return result || compare_fpv(lhs, rhs, (op::EQ*)0); - } - return result && compare_fpv(lhs, rhs, (op::NE*)0); -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_fpv_near_zero( FPT const& fpv, op::EQ* ) -{ - fpc::small_with_tolerance P( fpc_tolerance() ); - - assertion_result ar( P( fpv ) ); - if( !ar ) - ar.message() << "Absolute value exceeds tolerance [|" << fpv << "| > "<< fpc_tolerance() << ']'; - - return ar; -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_fpv_near_zero( FPT const& fpv, op::NE* ) -{ - fpc::small_with_tolerance P( fpc_tolerance() ); - - assertion_result ar( !P( fpv ) ); - if( !ar ) - ar.message() << "Absolute value is within tolerance [|" << fpv << "| < "<< fpc_tolerance() << ']'; - return ar; -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_fpv( Lhs const& lhs, Rhs const& rhs, op::EQ* ) -{ - if( lhs == 0 ) { - return compare_fpv_near_zero( rhs, (op::EQ*)0 ); - } - else if( rhs == 0) { - return compare_fpv_near_zero( lhs, (op::EQ*)0 ); - } - else { - fpc::close_at_tolerance P( fpc_tolerance(), fpc::FPC_STRONG ); - - assertion_result ar( P( lhs, rhs ) ); - if( !ar ) - ar.message() << "Relative difference exceeds tolerance [" - << P.tested_rel_diff() << " > " << P.fraction_tolerance() << ']'; - return ar; - } -} - -//____________________________________________________________________________// - -template -inline assertion_result -compare_fpv( Lhs const& lhs, Rhs const& rhs, op::NE* ) -{ - if( lhs == 0 ) { - return compare_fpv_near_zero( rhs, (op::NE*)0 ); - } - else if( rhs == 0 ) { - return compare_fpv_near_zero( lhs, (op::NE*)0 ); - } - else { - fpc::close_at_tolerance P( fpc_tolerance(), fpc::FPC_WEAK ); - - assertion_result ar( !P( lhs, rhs ) ); - if( !ar ) - ar.message() << "Relative difference is within tolerance [" - << P.tested_rel_diff() << " < " << fpc_tolerance() << ']'; - - return ar; - } -} - -//____________________________________________________________________________// - -#define DEFINE_FPV_COMPARISON( oper, name, rev ) \ -template \ -struct name::value && \ - fpc::tolerance_based::value)>::type> { \ -public: \ - typedef typename common_type::type FPT; \ - typedef name OP; \ - \ - typedef assertion_result result_type; \ - \ - static bool \ - eval_direct( Lhs const& lhs, Rhs const& rhs ) \ - { \ - return lhs oper rhs; \ - } \ - \ - static assertion_result \ - eval( Lhs const& lhs, Rhs const& rhs ) \ - { \ - if( fpc_tolerance() == FPT(0) ) \ - { \ - return eval_direct( lhs, rhs ); \ - } \ - \ - return compare_fpv( lhs, rhs, (OP*)0 ); \ - } \ - \ - template \ - static void \ - report( std::ostream& ostr, \ - PrevExprType const& lhs, \ - Rhs const& rhs ) \ - { \ - lhs.report( ostr ); \ - ostr << revert() \ - << tt_detail::print_helper( rhs ); \ - } \ - \ - static char const* revert() \ - { return " " #rev " "; } \ -}; \ -/**/ - -BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_FPV_COMPARISON ) -#undef DEFINE_FPV_COMPARISON - -//____________________________________________________________________________// - -} // namespace op -} // namespace assertion -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_FPC_OP_HPP_050915GER - diff --git a/libraries/boost/include/boost/test/tools/fpc_tolerance.hpp b/libraries/boost/include/boost/test/tools/fpc_tolerance.hpp deleted file mode 100644 index c862a17e75..0000000000 --- a/libraries/boost/include/boost/test/tools/fpc_tolerance.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : FPC tools tolerance holder -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER -#define BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER - -// Boost Test -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { - -namespace fpc = math::fpc; - -// ************************************************************************** // -// ************** floating point comparison tolerance ************** // -// ************************************************************************** // - -template -inline FPT& -fpc_tolerance() -{ - static FPT s_value = 0; - return s_value; -} - -//____________________________________________________________________________// - -template -struct local_fpc_tolerance { - local_fpc_tolerance( FPT fraction_tolerance ) : m_old_tolerance( fpc_tolerance() ) - { - fpc_tolerance() = fraction_tolerance; - } - - ~local_fpc_tolerance() - { - if( m_old_tolerance != (FPT)-1 ) - fpc_tolerance() = m_old_tolerance; - } - -private: - // Data members - FPT m_old_tolerance; -}; - -//____________________________________________________________________________// - -} // namespace test_tools - -// ************************************************************************** // -// ************** decorator::tolerance ************** // -// ************************************************************************** // - -namespace unit_test { -namespace decorator { - -template -inline fixture_t -tolerance( FPT v ) -{ - return fixture_t( test_unit_fixture_ptr( - new unit_test::class_based_fixture,FPT>( v ) ) ); -} - -//____________________________________________________________________________// - -template -inline fixture_t -tolerance( test_tools::fpc::percent_tolerance_t v ) -{ - return fixture_t( test_unit_fixture_ptr( - new unit_test::class_based_fixture,FPT>( boost::math::fpc::fpc_detail::fraction_tolerance( v ) ) ) ); -} - -//____________________________________________________________________________// - -} // namespace decorator - -using decorator::tolerance; - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_FPC_TOLERANCE_HPP_121612GER diff --git a/libraries/boost/include/boost/test/tools/interface.hpp b/libraries/boost/include/boost/test/tools/interface.hpp deleted file mode 100644 index 5e84f1c6d4..0000000000 --- a/libraries/boost/include/boost/test/tools/interface.hpp +++ /dev/null @@ -1,369 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 81247 $ -// -// Description : contains definition for all test tools in test toolbox -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER -#define BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER - -// Boost.Test -#include -#ifdef BOOST_TEST_TOOLS_DEBUGGABLE -#include -#endif -#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS -#include -#endif - -#include - -#ifdef BOOST_TEST_NO_OLD_TOOLS -#include - -#include -#endif // BOOST_TEST_NO_OLD_TOOLS - -#include - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** BOOST_TEST_ ************** // -// ************************************************************************** // - -#define BOOST_TEST_BUILD_ASSERTION( P ) \ - (::boost::test_tools::assertion::seed()->*P) \ -/**/ - -//____________________________________________________________________________// - -// Implementation based on direct predicate evaluation -#define BOOST_TEST_TOOL_DIRECT_IMPL( P, level, M ) \ -do { \ - ::boost::test_tools::assertion_result res = (P); \ - report_assertion( \ - res, \ - BOOST_TEST_LAZY_MSG( M ), \ - BOOST_TEST_L(__FILE__), \ - static_cast(__LINE__), \ - ::boost::test_tools::tt_detail::level, \ - ::boost::test_tools::tt_detail::CHECK_MSG, \ - 0 ); \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -//____________________________________________________________________________// - -// Implementation based on expression template construction -#define BOOST_TEST_TOOL_ET_IMPL( P, level ) \ -do { \ - BOOST_TEST_PASSPOINT(); \ - \ - ::boost::test_tools::tt_detail:: \ - report_assertion( \ - BOOST_TEST_BUILD_ASSERTION( P ).evaluate(), \ - BOOST_TEST_LAZY_MSG( BOOST_TEST_STRINGIZE( P ) ), \ - BOOST_TEST_L(__FILE__), \ - static_cast(__LINE__), \ - ::boost::test_tools::tt_detail::level, \ - ::boost::test_tools::tt_detail::CHECK_BUILT_ASSERTION, \ - 0 ); \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -//____________________________________________________________________________// - -// Implementation based on expression template construction with extra tool arguments -#define BOOST_TEST_TOOL_ET_IMPL_EX( P, level, arg ) \ -do { \ - BOOST_TEST_PASSPOINT(); \ - \ - ::boost::test_tools::tt_detail:: \ - report_assertion( \ - ::boost::test_tools::tt_detail::assertion_evaluate( \ - BOOST_TEST_BUILD_ASSERTION( P ) ) \ - << arg, \ - ::boost::test_tools::tt_detail::assertion_text( \ - BOOST_TEST_LAZY_MSG( BOOST_TEST_STRINGIZE(P) ), \ - BOOST_TEST_LAZY_MSG( arg ) ), \ - BOOST_TEST_L(__FILE__), \ - static_cast(__LINE__), \ - ::boost::test_tools::tt_detail::level, \ - ::boost::test_tools::tt_detail::assertion_type() \ - << arg, \ - 0 ); \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -//____________________________________________________________________________// - -#ifdef BOOST_TEST_TOOLS_UNDER_DEBUGGER - -#define BOOST_TEST_TOOL_UNIV( level, P ) \ - BOOST_TEST_TOOL_DIRECT_IMPL( P, level, BOOST_TEST_STRINGIZE( P ) ) \ -/**/ - -#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \ - BOOST_TEST_TOOL_UNIV( level, P ) \ -/**/ - -#elif defined(BOOST_TEST_TOOLS_DEBUGGABLE) - -#define BOOST_TEST_TOOL_UNIV( level, P ) \ -do { \ - if( ::boost::debug::under_debugger() ) \ - BOOST_TEST_TOOL_DIRECT_IMPL( P, level, BOOST_TEST_STRINGIZE( P ) ); \ - else \ - BOOST_TEST_TOOL_ET_IMPL( P, level ); \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \ - BOOST_TEST_TOOL_UNIV( level, P ) \ -/**/ - -#else - -#define BOOST_TEST_TOOL_UNIV( level, P ) \ - BOOST_TEST_TOOL_ET_IMPL( P, level ) \ -/**/ - -#define BOOST_TEST_TOOL_UNIV_EX( level, P, ... ) \ - BOOST_TEST_TOOL_ET_IMPL_EX( P, level, __VA_ARGS__ ) \ -/**/ - -#endif - -//____________________________________________________________________________// - -#define BOOST_TEST_WARN( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ - 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, WARN, __VA_ARGS__ ) \ -/**/ -#define BOOST_TEST_CHECK( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ - 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, CHECK, __VA_ARGS__ ) \ -/**/ -#define BOOST_TEST_REQUIRE( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ - 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, REQUIRE, __VA_ARGS__ )\ -/**/ - -#define BOOST_TEST( ... ) BOOST_TEST_INVOKE_IF_N_ARGS( \ - 2, BOOST_TEST_TOOL_UNIV, BOOST_TEST_TOOL_UNIV_EX, CHECK, __VA_ARGS__ ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_TEST_ERROR( M ) BOOST_CHECK_MESSAGE( false, M ) -#define BOOST_TEST_FAIL( M ) BOOST_REQUIRE_MESSAGE( false, M ) - -//____________________________________________________________________________// - -#define BOOST_TEST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( symb, BOOST_STRINGIZE(= symb) ) - -//____________________________________________________________________________// - -#ifdef BOOST_TEST_NO_OLD_TOOLS - -#ifdef BOOST_TEST_TOOLS_UNDER_DEBUGGER - -#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\ -do { try { \ - S; \ - BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \ -} catch( E ) { \ - BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \ -}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -#elif defined(BOOST_TEST_TOOLS_DEBUGGABLE) - -#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\ -do { try { \ - if( ::boost::debug::under_debugger() ) \ - BOOST_TEST_PASSPOINT(); \ - S; \ - BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \ -} catch( E ) { \ - BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \ -}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -#else - -#define BOOST_CHECK_THROW_IMPL(S, E, TL, Ppassed, Mpassed, Pcaught, Mcaught)\ -do { try { \ - BOOST_TEST_PASSPOINT(); \ - S; \ - BOOST_TEST_TOOL_DIRECT_IMPL( Ppassed, TL, Mpassed ); \ -} catch( E ) { \ - BOOST_TEST_TOOL_DIRECT_IMPL( Pcaught, TL, Mcaught ); \ -}} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -#endif - -//____________________________________________________________________________// - -#define BOOST_WARN_THROW( S, E ) \ - BOOST_CHECK_THROW_IMPL(S, E const&, WARN, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - true , "exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ -#define BOOST_CHECK_THROW( S, E ) \ - BOOST_CHECK_THROW_IMPL(S, E const&, CHECK, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - true , "exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ -#define BOOST_REQUIRE_THROW( S, E ) \ - BOOST_CHECK_THROW_IMPL(S, E const&, REQUIRE, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - true , "exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_EXCEPTION( S, E, P ) \ - BOOST_CHECK_THROW_IMPL(S, E const& ex, WARN, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ -#define BOOST_CHECK_EXCEPTION( S, E, P ) \ - BOOST_CHECK_THROW_IMPL(S, E const& ex, CHECK, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ -#define BOOST_REQUIRE_EXCEPTION( S, E, P ) \ - BOOST_CHECK_THROW_IMPL(S, E const& ex, REQUIRE, \ - false, "exception " BOOST_STRINGIZE(E) " is expected", \ - P(ex), "incorrect exception " BOOST_STRINGIZE(E) " is caught" ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_NO_THROW( S ) \ - BOOST_CHECK_THROW_IMPL(S, ..., WARN, \ - true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \ - false, "exception thrown by " BOOST_STRINGIZE( S ) ) \ -/**/ -#define BOOST_CHECK_NO_THROW( S ) \ - BOOST_CHECK_THROW_IMPL(S, ..., CHECK, \ - true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \ - false, "exception thrown by " BOOST_STRINGIZE( S ) ) \ -/**/ -#define BOOST_REQUIRE_NO_THROW( S ) \ - BOOST_CHECK_THROW_IMPL(S, ..., REQUIRE, \ - true , "no exceptions thrown by " BOOST_STRINGIZE( S ), \ - false, "exception thrown by " BOOST_STRINGIZE( S ) ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, WARN, M ) -#define BOOST_CHECK_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, CHECK, M ) -#define BOOST_REQUIRE_MESSAGE( P, M ) BOOST_TEST_TOOL_DIRECT_IMPL( P, REQUIRE, M ) - -//____________________________________________________________________________// - -//////////////////////////////////////////////////////////////////////////////// -///////////////////////////// DEPRECATED TOOLS ///////////////////////////// - -#define BOOST_WARN( P ) BOOST_TEST_WARN( P ) -#define BOOST_CHECK( P ) BOOST_TEST_CHECK( P ) -#define BOOST_REQUIRE( P ) BOOST_TEST_REQUIRE( P ) - -//____________________________________________________________________________// - -#define BOOST_ERROR( M ) BOOST_TEST_ERROR( M ) -#define BOOST_FAIL( M ) BOOST_TEST_FAIL( M ) - -//____________________________________________________________________________// - -#define BOOST_WARN_EQUAL( L, R ) BOOST_TEST_WARN( L == R ) -#define BOOST_CHECK_EQUAL( L, R ) BOOST_TEST_CHECK( L == R ) -#define BOOST_REQUIRE_EQUAL( L, R ) BOOST_TEST_REQUIRE( L == R ) - -#define BOOST_WARN_NE( L, R ) BOOST_TEST_WARN( L != R ) -#define BOOST_CHECK_NE( L, R ) BOOST_TEST_CHECK( L != R ) -#define BOOST_REQUIRE_NE( L, R ) BOOST_TEST_REQUIRE( L != R ) - -#define BOOST_WARN_LT( L, R ) BOOST_TEST_WARN( L < R ) -#define BOOST_CHECK_LT( L, R ) BOOST_TEST_CHECK( L < R ) -#define BOOST_REQUIRE_LT( L, R ) BOOST_TEST_REQUIRE( L < R ) - -#define BOOST_WARN_LE( L, R ) BOOST_TEST_WARN( L <= R ) -#define BOOST_CHECK_LE( L, R ) BOOST_TEST_CHECK( L <= R ) -#define BOOST_REQUIRE_LE( L, R ) BOOST_TEST_REQUIRE( L <= R ) - -#define BOOST_WARN_GT( L, R ) BOOST_TEST_WARN( L > R ) -#define BOOST_CHECK_GT( L, R ) BOOST_TEST_CHECK( L > R ) -#define BOOST_REQUIRE_GT( L, R ) BOOST_TEST_REQUIRE( L > R ) - -#define BOOST_WARN_GE( L, R ) BOOST_TEST_WARN( L >= R ) -#define BOOST_CHECK_GE( L, R ) BOOST_TEST_CHECK( L >= R ) -#define BOOST_REQUIRE_GE( L, R ) BOOST_TEST_REQUIRE( L >= R ) - -//____________________________________________________________________________// - -#define BOOST_WARN_CLOSE( L, R, T ) BOOST_TEST_WARN( L == R, T % ::boost::test_tools::tolerance() ) -#define BOOST_CHECK_CLOSE( L, R, T ) BOOST_TEST_CHECK( L == R, T % ::boost::test_tools::tolerance() ) -#define BOOST_REQUIRE_CLOSE( L, R, T ) BOOST_TEST_REQUIRE( L == R, T % ::boost::test_tools::tolerance() ) - -#define BOOST_WARN_CLOSE_FRACTION(L, R, T) BOOST_TEST_WARN( L == R, ::boost::test_tools::tolerance( T ) ) -#define BOOST_CHECK_CLOSE_FRACTION(L, R, T) BOOST_TEST_CHECK( L == R, ::boost::test_tools::tolerance( T ) ) -#define BOOST_REQUIRE_CLOSE_FRACTION(L,R,T) BOOST_TEST_REQUIRE( L == R, ::boost::test_tools::tolerance( T ) ) - -#define BOOST_WARN_SMALL( FPV, T ) BOOST_TEST_WARN( FPV == 0., ::boost::test_tools::tolerance( T ) ) -#define BOOST_CHECK_SMALL( FPV, T ) BOOST_TEST_CHECK( FPV == 0., ::boost::test_tools::tolerance( T ) ) -#define BOOST_REQUIRE_SMALL( FPV, T ) BOOST_TEST_REQUIRE( FPV == 0., ::boost::test_tools::tolerance( T ) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_WARN( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\ - ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \ - ::boost::test_tools::per_element() ) \ -/**/ - -#define BOOST_CHECK_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_CHECK( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\ - ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \ - ::boost::test_tools::per_element() ) \ -/**/ - -#define BOOST_REQUIRE_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_REQUIRE( ::boost::test_tools::tt_detail::make_it_pair(L_begin, L_end) ==\ - ::boost::test_tools::tt_detail::make_it_pair(R_begin, R_end), \ - ::boost::test_tools::per_element() ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_BITWISE_EQUAL( L, R ) BOOST_TEST_WARN( L == R, ::boost::test_tools::bitwise() ) -#define BOOST_CHECK_BITWISE_EQUAL( L, R ) BOOST_TEST_CHECK( L == R, ::boost::test_tools::bitwise() ) -#define BOOST_REQUIRE_BITWISE_EQUAL( L, R ) BOOST_TEST_REQUIRE( L == R, ::boost::test_tools::bitwise() ) - -//____________________________________________________________________________// - -#define BOOST_WARN_PREDICATE( P, ARGS ) BOOST_TEST_WARN( P BOOST_PP_SEQ_TO_TUPLE(ARGS) ) -#define BOOST_CHECK_PREDICATE( P, ARGS ) BOOST_TEST_CHECK( P BOOST_PP_SEQ_TO_TUPLE(ARGS) ) -#define BOOST_REQUIRE_PREDICATE( P, ARGS ) BOOST_TEST_REQUIRE( P BOOST_PP_SEQ_TO_TUPLE(ARGS) ) - -//____________________________________________________________________________// - -#define BOOST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( #symb, BOOST_STRINGIZE(= symb) ) - -//____________________________________________________________________________// - -#endif // BOOST_TEST_NO_OLD_TOOLS - -#include - -#endif // BOOST_TEST_TOOLS_INTERFACE_HPP_111712GER diff --git a/libraries/boost/include/boost/test/tools/old/impl.hpp b/libraries/boost/include/boost/test/tools/old/impl.hpp deleted file mode 100644 index b975f61b38..0000000000 --- a/libraries/boost/include/boost/test/tools/old/impl.hpp +++ /dev/null @@ -1,358 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : implementation details for old toolbox -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER -#define BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER - -// Boost.Test -#include -#include -#include - -#include -#include - -// Boost -#include -#include // for numeric::conversion_traits -#include - -#include -#include - -// STL -#include // for std::size_t -#include // for CHAR_BIT - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** old TOOLBOX Implementation ************** // -// ************************************************************************** // - -// This function adds level of indirection, but it makes sure we evaluate predicate -// arguments only once - -#ifndef BOOST_TEST_PROD -#define TEMPL_PARAMS( z, m, dummy ) , typename BOOST_JOIN( Arg, m ) - -#define FUNC_PARAMS( z, m, dummy ) \ - , BOOST_JOIN( Arg, m ) const& BOOST_JOIN( arg, m ) \ - , char const* BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \ -/**/ - -#define PRED_PARAMS( z, m, dummy ) BOOST_PP_COMMA_IF( m ) BOOST_JOIN( arg, m ) - -#define ARG_INFO( z, m, dummy ) \ - , BOOST_JOIN( BOOST_JOIN( arg, m ), _descr ) \ - , &static_cast(unit_test::lazy_ostream::instance() \ - << ::boost::test_tools::tt_detail::print_helper( BOOST_JOIN( arg, m ) )) \ -/**/ - -#define IMPL_FRWD( z, n, dummy ) \ -template \ -inline bool \ -check_frwd( Pred P, unit_test::lazy_ostream const& assertion_descr, \ - const_string file_name, std::size_t line_num, \ - tool_level tl, check_type ct \ - BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), FUNC_PARAMS, _ ) \ -) \ -{ \ - return \ - report_assertion( P( BOOST_PP_REPEAT_ ## z(BOOST_PP_ADD(n, 1), PRED_PARAMS,_) ),\ - assertion_descr, file_name, line_num, tl, ct, \ - BOOST_PP_ADD( n, 1 ) \ - BOOST_PP_REPEAT_ ## z( BOOST_PP_ADD( n, 1 ), ARG_INFO, _ ) \ - ); \ -} \ -/**/ - -#ifndef BOOST_TEST_MAX_PREDICATE_ARITY -#define BOOST_TEST_MAX_PREDICATE_ARITY 5 -#endif - -BOOST_PP_REPEAT( BOOST_TEST_MAX_PREDICATE_ARITY, IMPL_FRWD, _ ) - -#undef TEMPL_PARAMS -#undef FUNC_PARAMS -#undef PRED_INFO -#undef ARG_INFO -#undef IMPL_FRWD - -#endif - -//____________________________________________________________________________// - -template -inline assertion_result equal_impl( Left const& left, Right const& right ) -{ - return left == right; -} - -//____________________________________________________________________________// - -inline assertion_result equal_impl( char* left, char const* right ) { return equal_impl( static_cast(left), static_cast(right) ); } -inline assertion_result equal_impl( char const* left, char* right ) { return equal_impl( static_cast(left), static_cast(right) ); } -inline assertion_result equal_impl( char* left, char* right ) { return equal_impl( static_cast(left), static_cast(right) ); } - -#if !defined( BOOST_NO_CWCHAR ) -assertion_result BOOST_TEST_DECL equal_impl( wchar_t const* left, wchar_t const* right ); -inline assertion_result equal_impl( wchar_t* left, wchar_t const* right ) { return equal_impl( static_cast(left), static_cast(right) ); } -inline assertion_result equal_impl( wchar_t const* left, wchar_t* right ) { return equal_impl( static_cast(left), static_cast(right) ); } -inline assertion_result equal_impl( wchar_t* left, wchar_t* right ) { return equal_impl( static_cast(left), static_cast(right) ); } -#endif - -//____________________________________________________________________________// - -struct equal_impl_frwd { - template - inline assertion_result - call_impl( Left const& left, Right const& right, mpl::false_ ) const - { - return equal_impl( left, right ); - } - - template - inline assertion_result - call_impl( Left const& left, Right const& right, mpl::true_ ) const - { - return (*this)( right, &left[0] ); - } - - template - inline assertion_result - operator()( Left const& left, Right const& right ) const - { - typedef typename is_array::type left_is_array; - return call_impl( left, right, left_is_array() ); - } -}; - -//____________________________________________________________________________// - -struct ne_impl { - template - assertion_result operator()( Left const& left, Right const& right ) - { - return !equal_impl_frwd()( left, right ); - } -}; - -//____________________________________________________________________________// - -struct lt_impl { - template - assertion_result operator()( Left const& left, Right const& right ) - { - return left < right; - } -}; - -//____________________________________________________________________________// - -struct le_impl { - template - assertion_result operator()( Left const& left, Right const& right ) - { - return left <= right; - } -}; - -//____________________________________________________________________________// - -struct gt_impl { - template - assertion_result operator()( Left const& left, Right const& right ) - { - return left > right; - } -}; - -//____________________________________________________________________________// - -struct ge_impl { - template - assertion_result operator()( Left const& left, Right const& right ) - { - return left >= right; - } -}; - -//____________________________________________________________________________// - -struct equal_coll_impl { - template - assertion_result operator()( Left left_begin, Left left_end, Right right_begin, Right right_end ) - { - assertion_result pr( true ); - std::size_t pos = 0; - - for( ; left_begin != left_end && right_begin != right_end; ++left_begin, ++right_begin, ++pos ) { - if( *left_begin != *right_begin ) { - pr = false; - pr.message() << "\nMismatch at position " << pos << ": " - << ::boost::test_tools::tt_detail::print_helper(*left_begin) - << " != " - << ::boost::test_tools::tt_detail::print_helper(*right_begin); - } - } - - if( left_begin != left_end ) { - std::size_t r_size = pos; - while( left_begin != left_end ) { - ++pos; - ++left_begin; - } - - pr = false; - pr.message() << "\nCollections size mismatch: " << pos << " != " << r_size; - } - - if( right_begin != right_end ) { - std::size_t l_size = pos; - while( right_begin != right_end ) { - ++pos; - ++right_begin; - } - - pr = false; - pr.message() << "\nCollections size mismatch: " << l_size << " != " << pos; - } - - return pr; - } -}; - -//____________________________________________________________________________// - -struct bitwise_equal_impl { - template - assertion_result operator()( Left const& left, Right const& right ) - { - assertion_result pr( true ); - - std::size_t left_bit_size = sizeof(Left)*CHAR_BIT; - std::size_t right_bit_size = sizeof(Right)*CHAR_BIT; - - static Left const leftOne( 1 ); - static Right const rightOne( 1 ); - - std::size_t total_bits = left_bit_size < right_bit_size ? left_bit_size : right_bit_size; - - for( std::size_t counter = 0; counter < total_bits; ++counter ) { - if( ( left & ( leftOne << counter ) ) != ( right & ( rightOne << counter ) ) ) { - pr = false; - pr.message() << "\nMismatch at position " << counter; - } - } - - if( left_bit_size != right_bit_size ) { - pr = false; - pr.message() << "\nOperands bit sizes mismatch: " << left_bit_size << " != " << right_bit_size; - } - - return pr; - } -}; - -//____________________________________________________________________________// - -template -struct comp_supertype { - // deduce "better" type from types of arguments being compared - // if one type is floating and the second integral we use floating type and - // value of integral type is promoted to the floating. The same for float and double - // But we don't want to compare two values of integral types using this tool. - typedef typename numeric::conversion_traits::supertype type; - BOOST_STATIC_ASSERT_MSG( !is_integral::value, "Only floating-point types can be compared!"); -}; - -} // namespace tt_detail - -namespace fpc = math::fpc; - -// ************************************************************************** // -// ************** check_is_close ************** // -// ************************************************************************** // - -struct BOOST_TEST_DECL check_is_close_t { - // Public typedefs - typedef assertion_result result_type; - - template - assertion_result - operator()( FPT1 left, FPT2 right, ToleranceType tolerance ) const - { - fpc::close_at_tolerance::type> pred( tolerance, fpc::FPC_STRONG ); - - assertion_result ar( pred( left, right ) ); - - if( !ar ) - ar.message() << pred.tested_rel_diff(); - - return ar; - } -}; - -//____________________________________________________________________________// - -template -inline assertion_result -check_is_close( FPT1 left, FPT2 right, ToleranceType tolerance ) -{ - return check_is_close_t()( left, right, tolerance ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** check_is_small ************** // -// ************************************************************************** // - -struct BOOST_TEST_DECL check_is_small_t { - // Public typedefs - typedef bool result_type; - - template - bool - operator()( FPT fpv, FPT tolerance ) const - { - return fpc::is_small( fpv, tolerance ); - } -}; - -//____________________________________________________________________________// - -template -inline bool -check_is_small( FPT fpv, FPT tolerance ) -{ - return fpc::is_small( fpv, tolerance ); -} - -//____________________________________________________________________________// - -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_TOOLS_OLD_IMPL_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tools/old/interface.hpp b/libraries/boost/include/boost/test/tools/old/interface.hpp deleted file mode 100644 index 2d6f8b78c0..0000000000 --- a/libraries/boost/include/boost/test/tools/old/interface.hpp +++ /dev/null @@ -1,282 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 81247 $ -// -// Description : contains definition for all test tools in old test toolbox -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER -#define BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER - -// Boost -#include -#include -#include - -#include - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** TOOL BOX ************** // -// ************************************************************************** // - -// In macros below following argument abbreviations are used: -// P - predicate -// M - message -// S - statement -// E - exception -// L - left argument -// R - right argument -// TL - tool level -// CT - check type -// ARGS - arguments list (as PP sequence) - -// frwd_type: -// 0 - args exists and need to be forwarded; call check_frwd -// 1 - args exists, but do not need to be forwarded; call report_assertion directly -// 2 - no arguments; call report_assertion directly - -#define BOOST_TEST_TOOL_PASS_PRED0( P, ARGS ) P -#define BOOST_TEST_TOOL_PASS_PRED1( P, ARGS ) P BOOST_PP_SEQ_TO_TUPLE(ARGS) -#define BOOST_TEST_TOOL_PASS_PRED2( P, ARGS ) P - -#define BOOST_TEST_TOOL_PASS_ARG( r, _, arg ) , arg, BOOST_STRINGIZE( arg ) -#define BOOST_TEST_TOOL_PASS_ARG_DSCR( r, _, arg ) , BOOST_STRINGIZE( arg ) - -#define BOOST_TEST_TOOL_PASS_ARGS0( ARGS ) \ - BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_TOOL_PASS_ARG, _, ARGS ) -#define BOOST_TEST_TOOL_PASS_ARGS1( ARGS ) \ - , BOOST_PP_SEQ_SIZE(ARGS) BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_TOOL_PASS_ARG_DSCR, _, ARGS ) -#define BOOST_TEST_TOOL_PASS_ARGS2( ARGS ) \ - , 0 - -#define BOOST_TEST_TOOL_IMPL( frwd_type, P, assertion_descr, TL, CT, ARGS ) \ -do { \ - BOOST_TEST_PASSPOINT(); \ - ::boost::test_tools::tt_detail:: \ - BOOST_PP_IF( frwd_type, report_assertion, check_frwd ) ( \ - BOOST_JOIN( BOOST_TEST_TOOL_PASS_PRED, frwd_type )( P, ARGS ), \ - BOOST_TEST_LAZY_MSG( assertion_descr ), \ - BOOST_TEST_L(__FILE__), \ - static_cast(__LINE__), \ - ::boost::test_tools::tt_detail::TL, \ - ::boost::test_tools::tt_detail::CT \ - BOOST_JOIN( BOOST_TEST_TOOL_PASS_ARGS, frwd_type )( ARGS ) ); \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN( P ) BOOST_TEST_TOOL_IMPL( 2, \ - (P), BOOST_TEST_STRINGIZE( P ), WARN, CHECK_PRED, _ ) -#define BOOST_CHECK( P ) BOOST_TEST_TOOL_IMPL( 2, \ - (P), BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED, _ ) -#define BOOST_REQUIRE( P ) BOOST_TEST_TOOL_IMPL( 2, \ - (P), BOOST_TEST_STRINGIZE( P ), REQUIRE, CHECK_PRED, _ ) - -//____________________________________________________________________________// - -#define BOOST_WARN_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, WARN, CHECK_MSG, _ ) -#define BOOST_CHECK_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, CHECK, CHECK_MSG, _ ) -#define BOOST_REQUIRE_MESSAGE( P, M ) BOOST_TEST_TOOL_IMPL( 2, (P), M, REQUIRE, CHECK_MSG, _ ) - -//____________________________________________________________________________// - -#define BOOST_ERROR( M ) BOOST_CHECK_MESSAGE( false, M ) -#define BOOST_FAIL( M ) BOOST_REQUIRE_MESSAGE( false, M ) - -//____________________________________________________________________________// - -#define BOOST_CHECK_THROW_IMPL( S, E, P, postfix, TL ) \ -do { \ - try { \ - BOOST_TEST_PASSPOINT(); \ - S; \ - BOOST_TEST_TOOL_IMPL( 2, false, "exception " BOOST_STRINGIZE(E) " expected but not raised", \ - TL, CHECK_MSG, _ ); \ - } catch( E const& ex ) { \ - ::boost::unit_test::ut_detail::ignore_unused_variable_warning( ex ); \ - BOOST_TEST_TOOL_IMPL( 2, P, \ - "exception \"" BOOST_STRINGIZE( E )"\" raised as expected" postfix, \ - TL, CHECK_MSG, _ ); \ - } \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "", WARN ) -#define BOOST_CHECK_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "", CHECK ) -#define BOOST_REQUIRE_THROW( S, E ) BOOST_CHECK_THROW_IMPL( S, E, true, "", REQUIRE ) - -//____________________________________________________________________________// - -#define BOOST_WARN_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), \ - ": validation on the raised exception through predicate \"" BOOST_STRINGIZE(P) "\"", WARN ) -#define BOOST_CHECK_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), \ - ": validation on the raised exception through predicate \"" BOOST_STRINGIZE(P) "\"", CHECK ) -#define BOOST_REQUIRE_EXCEPTION( S, E, P ) BOOST_CHECK_THROW_IMPL( S, E, P( ex ), \ - ": validation on the raised exception through predicate \"" BOOST_STRINGIZE(P) "\"", REQUIRE ) - -//____________________________________________________________________________// - -#define BOOST_CHECK_NO_THROW_IMPL( S, TL ) \ -do { \ - try { \ - S; \ - BOOST_TEST_TOOL_IMPL( 2, true, "no exceptions thrown by " BOOST_STRINGIZE( S ), \ - TL, CHECK_MSG, _ ); \ - } catch( ... ) { \ - BOOST_TEST_TOOL_IMPL( 2, false, "unexpected exception thrown by " BOOST_STRINGIZE( S ), \ - TL, CHECK_MSG, _ ); \ - } \ -} while( ::boost::test_tools::tt_detail::dummy_cond() ) \ -/**/ - -#define BOOST_WARN_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, WARN ) -#define BOOST_CHECK_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, CHECK ) -#define BOOST_REQUIRE_NO_THROW( S ) BOOST_CHECK_NO_THROW_IMPL( S, REQUIRE ) - -//____________________________________________________________________________// - -#define BOOST_WARN_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::equal_impl_frwd(), "", WARN, CHECK_EQUAL, (L)(R) ) -#define BOOST_CHECK_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::equal_impl_frwd(), "", CHECK, CHECK_EQUAL, (L)(R) ) -#define BOOST_REQUIRE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::equal_impl_frwd(), "", REQUIRE, CHECK_EQUAL, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ne_impl(), "", WARN, CHECK_NE, (L)(R) ) -#define BOOST_CHECK_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ne_impl(), "", CHECK, CHECK_NE, (L)(R) ) -#define BOOST_REQUIRE_NE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ne_impl(), "", REQUIRE, CHECK_NE, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::lt_impl(), "", WARN, CHECK_LT, (L)(R) ) -#define BOOST_CHECK_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::lt_impl(), "", CHECK, CHECK_LT, (L)(R) ) -#define BOOST_REQUIRE_LT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::lt_impl(), "", REQUIRE, CHECK_LT, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::le_impl(), "", WARN, CHECK_LE, (L)(R) ) -#define BOOST_CHECK_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::le_impl(), "", CHECK, CHECK_LE, (L)(R) ) -#define BOOST_REQUIRE_LE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::le_impl(), "", REQUIRE, CHECK_LE, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::gt_impl(), "", WARN, CHECK_GT, (L)(R) ) -#define BOOST_CHECK_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::gt_impl(), "", CHECK, CHECK_GT, (L)(R) ) -#define BOOST_REQUIRE_GT( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::gt_impl(), "", REQUIRE, CHECK_GT, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ge_impl(), "", WARN, CHECK_GE, (L)(R) ) -#define BOOST_CHECK_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ge_impl(), "", CHECK, CHECK_GE, (L)(R) ) -#define BOOST_REQUIRE_GE( L, R ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::tt_detail::ge_impl(), "", REQUIRE, CHECK_GE, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", WARN, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) ) -#define BOOST_CHECK_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", CHECK, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) ) -#define BOOST_REQUIRE_CLOSE( L, R, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", REQUIRE, CHECK_CLOSE, (L)(R)(::boost::math::fpc::percent_tolerance(T)) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_CLOSE_FRACTION(L, R, T) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", WARN, CHECK_CLOSE_FRACTION, (L)(R)(T) ) -#define BOOST_CHECK_CLOSE_FRACTION(L, R, T) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", CHECK, CHECK_CLOSE_FRACTION, (L)(R)(T) ) -#define BOOST_REQUIRE_CLOSE_FRACTION(L,R,T) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_close_t(), "", REQUIRE, CHECK_CLOSE_FRACTION, (L)(R)(T) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_small_t(), "", WARN, CHECK_SMALL, (FPV)(T) ) -#define BOOST_CHECK_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_small_t(), "", CHECK, CHECK_SMALL, (FPV)(T) ) -#define BOOST_REQUIRE_SMALL( FPV, T ) BOOST_TEST_TOOL_IMPL( 0, \ - ::boost::test_tools::check_is_small_t(), "", REQUIRE, CHECK_SMALL, (FPV)(T) ) - -//____________________________________________________________________________// - -#define BOOST_WARN_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \ - P, BOOST_TEST_STRINGIZE( P ), WARN, CHECK_PRED_WITH_ARGS, ARGS ) -#define BOOST_CHECK_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \ - P, BOOST_TEST_STRINGIZE( P ), CHECK, CHECK_PRED_WITH_ARGS, ARGS ) -#define BOOST_REQUIRE_PREDICATE( P, ARGS ) BOOST_TEST_TOOL_IMPL( 0, \ - P, BOOST_TEST_STRINGIZE( P ), REQUIRE, CHECK_PRED_WITH_ARGS, ARGS ) - -//____________________________________________________________________________// - -#define BOOST_WARN_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \ - "", WARN, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \ -/**/ -#define BOOST_CHECK_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \ - "", CHECK, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \ -/**/ -#define BOOST_REQUIRE_EQUAL_COLLECTIONS( L_begin, L_end, R_begin, R_end ) \ - BOOST_TEST_TOOL_IMPL( 1, ::boost::test_tools::tt_detail::equal_coll_impl(), \ - "", REQUIRE, CHECK_EQUAL_COLL, (L_begin)(L_end)(R_begin)(R_end) ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_WARN_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ - ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", WARN, CHECK_BITWISE_EQUAL, (L)(R) ) -#define BOOST_CHECK_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ - ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", CHECK, CHECK_BITWISE_EQUAL, (L)(R) ) -#define BOOST_REQUIRE_BITWISE_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 1, \ - ::boost::test_tools::tt_detail::bitwise_equal_impl(), "", REQUIRE, CHECK_BITWISE_EQUAL, (L)(R) ) - -//____________________________________________________________________________// - -#define BOOST_IS_DEFINED( symb ) ::boost::test_tools::tt_detail::is_defined_impl( #symb, BOOST_STRINGIZE(= symb) ) - -//____________________________________________________________________________// - -#ifdef BOOST_TEST_NO_NEW_TOOLS - -#define BOOST_TEST_WARN( P ) BOOST_WARN( P ) -#define BOOST_TEST_CHECK( P ) BOOST_CHECK( P ) -#define BOOST_TEST_REQUIRE( P ) BOOST_REQUIRE( P ) - -#define BOOST_TEST( P ) BOOST_CHECK( P ) - -#endif - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_TOOLS_OLD_INTERFACE_HPP_111712GER diff --git a/libraries/boost/include/boost/test/tools/output_test_stream.hpp b/libraries/boost/include/boost/test/tools/output_test_stream.hpp deleted file mode 100644 index 2abbf7b521..0000000000 --- a/libraries/boost/include/boost/test/tools/output_test_stream.hpp +++ /dev/null @@ -1,107 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief output_test_stream class definition -// *************************************************************************** - -#ifndef BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER -#define BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER - -// Boost.Test -#include -#include -#include - -// STL -#include // for std::size_t - -#include - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** output_test_stream ************** // -// ************************************************************************** // - - - -namespace boost { -namespace test_tools { - -//! Class to be used to simplify testing of ostream-based output operations -class BOOST_TEST_DECL output_test_stream : public wrap_stringstream::wrapped_stream { - typedef unit_test::const_string const_string; -public: - //! Constructor - //! - //!@param[in] pattern_file_name indicates the name of the file for matching. If the - //! string is empty, the standard input or output streams are used instead - //! (depending on match_or_save) - //!@param[in] match_or_save if true, the pattern file will be read, otherwise it will be - //! written - //!@param[in] text_or_binary if false, opens the stream in binary mode. Otherwise the stream - //! is opened with default flags and the carriage returns are ignored. - explicit output_test_stream( const_string pattern_file_name = const_string(), - bool match_or_save = true, - bool text_or_binary = true ); - - // Destructor - virtual ~output_test_stream(); - - //! Checks if the stream is empty - //! - //!@param[in] flush_stream if true, flushes the stream after the call - virtual assertion_result is_empty( bool flush_stream = true ); - - //! Checks the length of the stream - //! - //!@param[in] length target length - //!@param[in] flush_stream if true, flushes the stream after the call. Set to false to call - //! additional checks on the same content. - virtual assertion_result check_length( std::size_t length, bool flush_stream = true ); - - //! Checks the content of the stream against a string - //! - //!@param[in] arg_ the target stream - //!@param[in] flush_stream if true, flushes the stream after the call. - virtual assertion_result is_equal( const_string arg_, bool flush_stream = true ); - - //! Checks the content of the stream against a pattern file - //! - //!@param[in] flush_stream if true, flushes/resets the stream after the call. - virtual assertion_result match_pattern( bool flush_stream = true ); - - //! Flushes the stream - void flush(); - -protected: - - //! Returns the string representation of the stream - //! - //! May be overriden in order to mutate the string before the matching operations. - virtual std::string get_stream_string_representation() const; - -private: - // helper functions - - //! Length of the stream - std::size_t length(); - - //! Synching the stream into an internal string representation - virtual void sync(); - - struct Impl; - Impl* m_pimpl; -}; - -} // namespace test_tools -} // namespace boost - -#include - -#endif // BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER diff --git a/libraries/boost/include/boost/test/tree/auto_registration.hpp b/libraries/boost/include/boost/test/tree/auto_registration.hpp deleted file mode 100644 index a3fe32fda7..0000000000 --- a/libraries/boost/include/boost/test/tree/auto_registration.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74640 $ -// -// Description : defines auto_test_unit_registrar -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER -#define BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER - -// Boost.Test -#include -#include -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace ut_detail { - -// ************************************************************************** // -// ************** auto_test_unit_registrar ************** // -// ************************************************************************** // - -struct BOOST_TEST_DECL auto_test_unit_registrar { - // Constructors - auto_test_unit_registrar( test_case* tc, decorator::collector& decorators, counter_t exp_fail = 0 ); - explicit auto_test_unit_registrar( const_string ts_name, const_string ts_file, std::size_t ts_line, decorator::collector& decorators ); - explicit auto_test_unit_registrar( test_unit_generator const& tc_gen, decorator::collector& decorators ); - explicit auto_test_unit_registrar( int ); -}; - -} // namespace ut_detail -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TREE_AUTO_REGISTRATION_HPP_100211GER - diff --git a/libraries/boost/include/boost/test/tree/decorator.hpp b/libraries/boost/include/boost/test/tree/decorator.hpp deleted file mode 100644 index 27c46682a0..0000000000 --- a/libraries/boost/include/boost/test/tree/decorator.hpp +++ /dev/null @@ -1,277 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 62016 $ -// -// Description : defines decorators to be using with auto registered test units -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_DECORATOR_HPP_091911GER -#define BOOST_TEST_TREE_DECORATOR_HPP_091911GER - -// Boost.Test -#include -#include - -#include - -#include - -#include -#include - -// Boost -#include -#include -#include - -#include - -// STL -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -class test_unit; - -namespace decorator { - -// ************************************************************************** // -// ************** decorator::collector ************** // -// ************************************************************************** // - -class base; -typedef boost::shared_ptr base_ptr; - -class BOOST_TEST_DECL collector : public singleton { -public: - collector& operator*( base const& d ); - - void store_in( test_unit& tu ); - - void reset(); - -private: - BOOST_TEST_SINGLETON_CONS( collector ) - - // Data members - std::vector m_tu_decorators; -}; - -// ************************************************************************** // -// ************** decorator::base ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL base { -public: - // composition interface - collector& operator*() const; - - // application interface - virtual void apply( test_unit& tu ) = 0; - - // deep cloning interface - virtual base_ptr clone() const = 0; - -protected: - virtual ~base() {} -}; - -// ************************************************************************** // -// ************** decorator::label ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL label : public decorator::base { -public: - explicit label( const_string l ) : m_label( l ) {} - -private: - // decorator::base interface - virtual void apply( test_unit& tu ); - virtual base_ptr clone() const { return base_ptr(new label( m_label )); } - - // Data members - const_string m_label; -}; - -// ************************************************************************** // -// ************** decorator::expected_failures ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL expected_failures : public decorator::base { -public: - explicit expected_failures( counter_t ef ) : m_exp_fail( ef ) {} - -private: - // decorator::base interface - virtual void apply( test_unit& tu ); - virtual base_ptr clone() const { return base_ptr(new expected_failures( m_exp_fail )); } - - // Data members - counter_t m_exp_fail; -}; - -// ************************************************************************** // -// ************** decorator::timeout ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL timeout : public decorator::base { -public: - explicit timeout( unsigned t ) : m_timeout( t ) {} - -private: - // decorator::base interface - virtual void apply( test_unit& tu ); - virtual base_ptr clone() const { return base_ptr(new timeout( m_timeout )); } - - // Data members - unsigned m_timeout; -}; - -// ************************************************************************** // -// ************** decorator::description ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL description : public decorator::base { -public: - explicit description( const_string descr ) : m_description( descr ) {} - -private: - // decorator::base interface - virtual void apply( test_unit& tu ); - virtual base_ptr clone() const { return base_ptr(new description( m_description )); } - - // Data members - const_string m_description; -}; - -// ************************************************************************** // -// ************** decorator::depends_on ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL depends_on : public decorator::base { -public: - explicit depends_on( const_string dependency ) : m_dependency( dependency ) {} - -private: - // decorator::base interface - virtual void apply( test_unit& tu ); - virtual base_ptr clone() const { return base_ptr(new depends_on( m_dependency )); } - - // Data members - const_string m_dependency; -}; - -// ************************************************************************** // -// ************** decorator::enable_if/enabled/disabled ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL enable_if_impl : public decorator::base { -protected: - void apply_impl( test_unit& tu, bool condition ); -}; - -template -class enable_if : public enable_if_impl { -private: - // decorator::base interface - virtual void apply( test_unit& tu ) { this->apply_impl( tu, condition ); } - virtual base_ptr clone() const { return base_ptr(new enable_if()); } -}; - -typedef enable_if enabled; -typedef enable_if disabled; - -// ************************************************************************** // -// ************** decorator::fixture ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL fixture_t : public decorator::base { -public: - // Constructor - explicit fixture_t( test_unit_fixture_ptr impl ) : m_impl( impl ) {} - -private: - // decorator::base interface - virtual void apply( test_unit& tu ); - virtual base_ptr clone() const { return base_ptr(new fixture_t( m_impl )); } - - // Data members - test_unit_fixture_ptr m_impl; -}; - -//____________________________________________________________________________// - -template -inline fixture_t -fixture() -{ - return fixture_t( test_unit_fixture_ptr( new unit_test::class_based_fixture() ) ); -} - -//____________________________________________________________________________// - -template -inline fixture_t -fixture( Arg const& arg ) -{ - return fixture_t( test_unit_fixture_ptr( new unit_test::class_based_fixture( arg ) ) ); -} - -//____________________________________________________________________________// - -inline fixture_t -fixture( boost::function const& setup, boost::function const& teardown = boost::function() ) -{ - return fixture_t( test_unit_fixture_ptr( new unit_test::function_based_fixture( setup, teardown ) ) ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** decorator::depends_on ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL precondition : public decorator::base { -public: - typedef boost::function predicate_t; - - explicit precondition( predicate_t p ) : m_precondition( p ) {} - -private: - // decorator::base interface - virtual void apply( test_unit& tu ); - virtual base_ptr clone() const { return base_ptr(new precondition( m_precondition )); } - - // Data members - predicate_t m_precondition; -}; - -} // namespace decorator - -using decorator::label; -using decorator::expected_failures; -using decorator::timeout; -using decorator::description; -using decorator::depends_on; -using decorator::enable_if; -using decorator::enabled; -using decorator::disabled; -using decorator::fixture; -using decorator::precondition; - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TREE_DECORATOR_HPP_091911GER diff --git a/libraries/boost/include/boost/test/tree/fixture.hpp b/libraries/boost/include/boost/test/tree/fixture.hpp deleted file mode 100644 index 8e07b2aa1d..0000000000 --- a/libraries/boost/include/boost/test/tree/fixture.hpp +++ /dev/null @@ -1,191 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines fixture interface and object makers -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_FIXTURE_HPP_100311GER -#define BOOST_TEST_TREE_FIXTURE_HPP_100311GER - -// Boost.Test -#include - -// Boost -#include -#include -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_unit_fixture ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL test_unit_fixture { -public: - virtual ~test_unit_fixture() {} - - // Fixture interface - virtual void setup() = 0; - virtual void teardown() = 0; -}; - -typedef shared_ptr test_unit_fixture_ptr; - -// ************************************************************************** // -// ************** fixture helper functions ************** // -// ************************************************************************** // - -namespace impl_fixture { - -#if defined(BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) - - template struct fixture_detect {}; - - template - struct has_setup { - private: - template static char Test(fixture_detect*); - template static int Test(...); - public: - static const bool value = sizeof(Test(0)) == sizeof(char); - }; - - template - struct has_teardown { - private: - template static char Test(fixture_detect*); - template static int Test(...); - public: - static const bool value = sizeof(Test(0)) == sizeof(char); - }; - -#else - - template struct fixture_detect { typedef char type; }; - template - struct has_setup { - private: - template static auto Test(U*) -> typename fixture_detect().setup())>::type; - template static int Test(...); - public: - static const bool value = sizeof(Test(0)) == sizeof(char); - }; - - template - struct has_teardown { - private: - template static auto Test(U*) -> typename fixture_detect().teardown())>::type; - template static int Test(...); - public: - static const bool value = sizeof(Test(0)) == sizeof(char); - }; - -#endif - - template - struct call_setup { template void operator()(U& ) { } }; - - template <> - struct call_setup { template void operator()(U& u) { u.setup(); } }; - - template - struct call_teardown { template void operator()(U& ) { } }; - - template <> - struct call_teardown { template void operator()(U& u) { u.teardown(); } }; -} - -//! Calls the fixture "setup" if detected by the compiler, otherwise does nothing. -template -void setup_conditional(U& u) { - return impl_fixture::call_setup::value>()(u); -} - -//! Calls the fixture "teardown" if detected by the compiler, otherwise does nothing. -template -void teardown_conditional(U& u) { - return impl_fixture::call_teardown::value>()(u); -} - - -// ************************************************************************** // -// ************** class_based_fixture ************** // -// ************************************************************************** // - -template -class class_based_fixture : public test_unit_fixture { -public: - // Constructor - explicit class_based_fixture( Arg const& arg ) : m_inst(), m_arg( arg ) {} - -private: - // Fixture interface - virtual void setup() { m_inst.reset( new F( m_arg ) ); setup_conditional(*m_inst); } - virtual void teardown() { teardown_conditional(*m_inst); m_inst.reset(); } - - // Data members - scoped_ptr m_inst; - Arg m_arg; -}; - -//____________________________________________________________________________// - -template -class class_based_fixture : public test_unit_fixture { -public: - // Constructor - class_based_fixture() : m_inst( 0 ) {} - -private: - // Fixture interface - virtual void setup() { m_inst.reset( new F ); setup_conditional(*m_inst); } - virtual void teardown() { teardown_conditional(*m_inst); m_inst.reset(); } - - // Data members - scoped_ptr m_inst; -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** function_based_fixture ************** // -// ************************************************************************** // - -class function_based_fixture : public test_unit_fixture { -public: - // Constructor - function_based_fixture( boost::function const& setup_, boost::function const& teardown_ ) - : m_setup( setup_ ) - , m_teardown( teardown_ ) - { - } - -private: - // Fixture interface - virtual void setup() { if( m_setup ) m_setup(); } - virtual void teardown() { if( m_teardown ) m_teardown(); } - - // Data members - boost::function m_setup; - boost::function m_teardown; -}; - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TREE_FIXTURE_HPP_100311GER - diff --git a/libraries/boost/include/boost/test/tree/global_fixture.hpp b/libraries/boost/include/boost/test/tree/global_fixture.hpp deleted file mode 100644 index 7c96d34e89..0000000000 --- a/libraries/boost/include/boost/test/tree/global_fixture.hpp +++ /dev/null @@ -1,123 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines global_fixture -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER -#define BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER - -// Boost.Test -#include -#include - -#include -#include - -#include - - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** global_configuration ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL global_configuration : public test_observer { - -public: - // Constructor - global_configuration(); - - // Dtor - virtual ~global_configuration(); - - // Happens after the framework global observer init has been done - virtual int priority() { return 1; } -}; - - - -// ************************************************************************** // -// ************** global_fixture ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL global_fixture : public test_unit_fixture { - -public: - // Constructor - global_fixture(); - - // Dtor - virtual ~global_fixture(); -}; - -//____________________________________________________________________________// - -namespace ut_detail { - -template -struct global_configuration_impl : public global_configuration { - // Constructor - global_configuration_impl() : m_configuration_observer( 0 ) { - } - - // test observer interface - virtual void test_start( counter_t ) { - m_configuration_observer = new F; - } - - // test observer interface - virtual void test_finish() { - if(m_configuration_observer) { - delete m_configuration_observer; - m_configuration_observer = 0; - } - } -private: - // Data members - F* m_configuration_observer; -}; - -template -struct global_fixture_impl : public global_fixture { - // Constructor - global_fixture_impl() : m_fixture( 0 ) { - } - - // test fixture interface - virtual void setup() { - m_fixture = new F; - setup_conditional(*m_fixture); - } - - // test fixture interface - virtual void teardown() { - if(m_fixture) { - teardown_conditional(*m_fixture); - } - delete m_fixture; - m_fixture = 0; - } - -private: - // Data members - F* m_fixture; -}; - -} // namespace ut_detail -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TREE_GLOBAL_FIXTURE_HPP_091911GER - diff --git a/libraries/boost/include/boost/test/tree/observer.hpp b/libraries/boost/include/boost/test/tree/observer.hpp deleted file mode 100644 index bd6fc9bff5..0000000000 --- a/libraries/boost/include/boost/test/tree/observer.hpp +++ /dev/null @@ -1,116 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief defines abstract interface for test observer -// *************************************************************************** - -#ifndef BOOST_TEST_TEST_OBSERVER_HPP_021005GER -#define BOOST_TEST_TEST_OBSERVER_HPP_021005GER - -// Boost.Test -#include -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_observer ************** // -// ************************************************************************** // - -/// @brief Generic test observer interface -/// -/// This interface is used by observers in order to receive notifications from the -/// Boost.Test framework on the current execution state. -/// -/// Several observers can be running at the same time, and it is not unusual to -/// have interactions among them. The @ref test_observer::priority member function allows the specification -/// of a particular order among them (lowest priority executed first, except specified otherwise). -/// -class BOOST_TEST_DECL test_observer { -public: - - //! Called before the framework starts executing the test cases - //! - //! @param[in] number_of_test_cases indicates the number of test cases. Only active - //! test cases are taken into account. - virtual void test_start( counter_t /* number_of_test_cases */ ) {} - - //! Called after the framework ends executing the test cases - //! - //! @note The call is made with a reversed priority order. - virtual void test_finish() {} - - //! Called when a critical error is detected - //! - //! The critical errors are mainly the signals sent by the system and caught by the Boost.Test framework. - //! Since the running binary may be in incoherent/instable state, the test execution is aborted and all remaining - //! tests are discarded. - //! - //! @note may be called before test_observer::test_unit_finish() - virtual void test_aborted() {} - - //! Called before the framework starts executing a test unit - //! - //! @param[in] test_unit the test being executed - virtual void test_unit_start( test_unit const& /* test */) {} - - //! Called at each end of a test unit. - //! - //! @param elapsed duration of the test unit in microseconds. - virtual void test_unit_finish( test_unit const& /* test */, unsigned long /* elapsed */ ) {} - virtual void test_unit_skipped( test_unit const& tu, const_string ) { test_unit_skipped( tu ); } - virtual void test_unit_skipped( test_unit const& ) {} ///< backward compatibility - - //! Called when a test unit indicates a fatal error. - //! - //! A fatal error happens when - //! - a strong assertion (with @c REQUIRE) fails, which indicates that the test case cannot continue - //! - an unexpected exception is caught by the Boost.Test framework - virtual void test_unit_aborted( test_unit const& ) {} - - virtual void assertion_result( unit_test::assertion_result ar ) - { - switch( ar ) { - case AR_PASSED: assertion_result( true ); break; - case AR_FAILED: assertion_result( false ); break; - case AR_TRIGGERED: break; - default: break; - } - } - - //! Called when an exception is intercepted - //! - //! In case an exception is intercepted, this call happens before the call - //! to @ref test_unit_aborted in order to log - //! additional data about the exception. - virtual void exception_caught( execution_exception const& ) {} - - //! The priority indicates the order at which this observer is initialized - //! and tore down in the UTF framework. The order is lowest to highest priority. - virtual int priority() { return 0; } - -protected: - //! Deprecated - virtual void assertion_result( bool /* passed */ ) {} - - BOOST_TEST_PROTECTED_VIRTUAL ~test_observer() {} -}; - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TEST_OBSERVER_HPP_021005GER - diff --git a/libraries/boost/include/boost/test/tree/test_case_counter.hpp b/libraries/boost/include/boost/test/tree/test_case_counter.hpp deleted file mode 100644 index a74f37f152..0000000000 --- a/libraries/boost/include/boost/test/tree/test_case_counter.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines @ref test_case_counter -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER -#define BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER - -// Boost.Test -#include -#include - -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_case_counter ************** // -// ************************************************************************** // - -///! Counts the number of enabled test cases -class test_case_counter : public test_tree_visitor { -public: - // Constructor - test_case_counter() : p_count( 0 ) {} - - BOOST_READONLY_PROPERTY( counter_t, (test_case_counter)) p_count; -private: - // test tree visitor interface - virtual void visit( test_case const& tc ) { if( tc.is_enabled() ) ++p_count.value; } - virtual bool test_suite_start( test_suite const& ts ) { return ts.is_enabled(); } -}; - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TREE_TEST_CASE_COUNTER_HPP_100211GER - diff --git a/libraries/boost/include/boost/test/tree/test_case_template.hpp b/libraries/boost/include/boost/test/tree/test_case_template.hpp deleted file mode 100644 index 83a13f00f5..0000000000 --- a/libraries/boost/include/boost/test/tree/test_case_template.hpp +++ /dev/null @@ -1,190 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -///@ file -/// Defines template_test_case_gen -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER -#define BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER - -// Boost.Test -#include -#include -#include -#include - -#include - -#include - - -// Boost -#include -#include -#include -#include -#include -#include - -#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI) -# include -#else -# include -#endif - -// STL -#include // for std::string -#include // for std::list - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ - !defined(BOOST_NO_CXX11_HDR_TUPLE) && \ - !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) - #include -#endif - -#include - - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace ut_detail { - -// ************************************************************************** // -// ************** test_case_template_invoker ************** // -// ************************************************************************** // - -template -class test_case_template_invoker { -public: - void operator()() { TestCaseTemplate::run( (boost::type*)0 ); } -}; - -// ************************************************************************** // -// ************** generate_test_case_4_type ************** // -// ************************************************************************** // - -template -struct generate_test_case_4_type { - explicit generate_test_case_4_type( const_string tc_name, const_string tc_file, std::size_t tc_line, Generator& G ) - : m_test_case_name( tc_name ) - , m_test_case_file( tc_file ) - , m_test_case_line( tc_line ) - , m_holder( G ) - {} - - template - void operator()( mpl::identity ) - { - std::string full_name; - assign_op( full_name, m_test_case_name, 0 ); - full_name += '<'; -#if !defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) - full_name += boost::core::demangle(typeid(TestType).name()); // same as execution_monitor.ipp -#else - full_name += BOOST_CURRENT_FUNCTION; -#endif - if( boost::is_const::value ) - full_name += "_const"; - full_name += '>'; - - m_holder.m_test_cases.push_back( new test_case( ut_detail::normalize_test_case_name( full_name ), - m_test_case_file, - m_test_case_line, - test_case_template_invoker() ) ); - } - -private: - // Data members - const_string m_test_case_name; - const_string m_test_case_file; - std::size_t m_test_case_line; - Generator& m_holder; -}; - -// ************************************************************************** // -// ************** test_case_template ************** // -// ************************************************************************** // - -class template_test_case_gen_base : public test_unit_generator { -public: - virtual test_unit* next() const - { - if( m_test_cases.empty() ) - return 0; - - test_unit* res = m_test_cases.front(); - m_test_cases.pop_front(); - - return res; - } - - // Data members - mutable std::list m_test_cases; -}; - -template -class template_test_case_gen : public template_test_case_gen_base { -public: - // Constructor - template_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line ) - { - typedef generate_test_case_4_type,TestCaseTemplate> single_test_gen; - - mpl::for_each >( single_test_gen( tc_name, tc_file, tc_line, *this ) ); - } -}; - -// adding support for tuple -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \ - !defined(BOOST_NO_CXX11_HDR_TUPLE) && \ - !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) - -template -class template_test_case_gen > : public template_test_case_gen_base { - - template - struct seq { }; - - template - struct gen_seq : gen_seq { }; - - template - struct gen_seq<0, Is...> : seq { }; - - template - void for_each(F &f, seq) - { - auto l = { (f(mpl::identity::type>()), 0)... }; - (void)l; // silence warning - } - -public: - // Constructor - template_test_case_gen( const_string tc_name, const_string tc_file, std::size_t tc_line ) - { - using tuple_t = std::tuple; - using this_type = template_test_case_gen; - using single_test_gen = generate_test_case_4_type; - - single_test_gen op( tc_name, tc_file, tc_line, *this ); - - this->for_each(op, gen_seq()); - } -}; - -#endif /* C++11 variadic and tuples */ - -} // namespace ut_detail -} // unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TREE_TEST_CASE_TEMPLATE_HPP_091911GER diff --git a/libraries/boost/include/boost/test/tree/test_unit.hpp b/libraries/boost/include/boost/test/tree/test_unit.hpp deleted file mode 100644 index 273fa14ff3..0000000000 --- a/libraries/boost/include/boost/test/tree/test_unit.hpp +++ /dev/null @@ -1,275 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Defines @ref boost::unit_test::test_unit "test_unit", @ref boost::unit_test::test_case "test_case", -/// @ref boost::unit_test::test_suite "test_suite" and @ref boost::unit_test::master_test_suite_t "master_test_suite_t" -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER -#define BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER - -// Boost.Test -#include -#include -#include - -#include -#include - -#include - -#include - -// Boost -#include -#include - -// STL -#include -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -namespace framework { -class state; -} - -// ************************************************************************** // -// ************** test_unit ************** // -// ************************************************************************** // - -typedef std::vector test_unit_id_list; - -class BOOST_TEST_DECL test_unit { -public: - enum { type = TUT_ANY }; - enum run_status { RS_DISABLED, RS_ENABLED, RS_INHERIT, RS_INVALID }; - - typedef std::vector id_list; - typedef std::vector fixture_list_t; - typedef BOOST_READONLY_PROPERTY(test_unit_id,(framework::state)) id_t; - typedef BOOST_READONLY_PROPERTY(test_unit_id,(test_suite)) parent_id_t; - typedef BOOST_READONLY_PROPERTY(id_list,(test_unit)) id_list_t; - typedef std::vector decor_list_t; - typedef BOOST_READONLY_PROPERTY(std::vector,(test_unit)) label_list_t; - - typedef boost::function precondition_t; - typedef BOOST_READONLY_PROPERTY(std::vector,(test_unit)) precond_list_t; - - // preconditions management - void depends_on( test_unit* tu ); - void add_precondition( precondition_t const& ); - test_tools::assertion_result check_preconditions() const; - - // labels management - void add_label( const_string l ); - bool has_label( const_string l ) const; - - // helper access methods - void increase_exp_fail( counter_t num ); - bool is_enabled() const { return p_run_status == RS_ENABLED; } - std::string full_name() const; - - // Public r/o properties - test_unit_type const p_type; ///< type for this test unit - const_string const p_type_name; ///< "case"/"suite"/"module" - const_string const p_file_name; - std::size_t const p_line_num; - id_t p_id; ///< unique id for this test unit - parent_id_t p_parent_id; ///< parent test suite id - label_list_t p_labels; ///< list of labels associated with this test unit - - id_list_t p_dependencies; ///< list of test units this one depends on - precond_list_t p_preconditions; ///< user supplied preconditions for this test unit; - - // Public r/w properties - readwrite_property p_name; ///< name for this test unit - readwrite_property p_description; ///< description for this test unit - readwrite_property p_timeout; ///< timeout for the test unit execution in seconds - readwrite_property p_expected_failures; ///< number of expected failures in this test unit - - readwrite_property p_default_status; ///< run status obtained by this unit during setup phase - readwrite_property p_run_status; ///< run status assigned to this unit before execution phase after applying all filters - - readwrite_property p_sibling_rank; ///< rank of this test unit amoung siblings of the same parent - - readwrite_property p_decorators; ///< automatically assigned decorators; execution is delayed till framework::finalize_setup_phase function - readwrite_property p_fixtures; ///< fixtures associated with this test unit - -protected: - ~test_unit(); - // Constructor - test_unit( const_string tu_name, const_string tc_file, std::size_t tc_line, test_unit_type t ); - // Master test suite constructor - explicit test_unit( const_string module_name ); - -private: -}; - -// ************************************************************************** // -// ************** test_unit_generator ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL test_unit_generator { -public: - virtual test_unit* next() const = 0; - -protected: - BOOST_TEST_PROTECTED_VIRTUAL ~test_unit_generator() {} -}; - -// ************************************************************************** // -// ************** test_case ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL test_case : public test_unit { -public: - enum { type = TUT_CASE }; - - // Constructor - test_case( const_string tc_name, boost::function const& test_func ); - test_case( const_string tc_name, const_string tc_file, std::size_t tc_line, boost::function const& test_func ); - - // Public property - typedef BOOST_READONLY_PROPERTY(boost::function,(test_case)) test_func; - - test_func p_test_func; - -private: - friend class framework::state; - ~test_case() {} -}; - -// ************************************************************************** // -// ************** test_suite ************** // -// ************************************************************************** // - -//! Class representing test suites -class BOOST_TEST_DECL test_suite : public test_unit { -public: - enum { type = TUT_SUITE }; - - // Constructor - explicit test_suite( const_string ts_name, const_string ts_file, std::size_t ts_line ); - - // test unit list management - - /*!@brief Adds a test unit to a test suite. - * - * It is possible to specify the timeout and the expected failures. - */ - void add( test_unit* tu, counter_t expected_failures = 0, unsigned timeout = 0 ); - - /// @overload - void add( test_unit_generator const& gen, unsigned timeout = 0 ); - - /// @overload - void add( test_unit_generator const& gen, decorator::collector& decorators ); - - //! Removes a test from the test suite. - void remove( test_unit_id id ); - - - // access methods - test_unit_id get( const_string tu_name ) const; - std::size_t size() const { return m_children.size(); } - -protected: - // Master test suite constructor - explicit test_suite( const_string module_name ); - - friend BOOST_TEST_DECL - void traverse_test_tree( test_suite const&, test_tree_visitor&, bool ); - friend class framework::state; - virtual ~test_suite() {} - - typedef std::multimap children_per_rank; - // Data members - - test_unit_id_list m_children; - children_per_rank m_ranked_children; ///< maps child sibling rank to list of children with that rank -}; - -// ************************************************************************** // -// ************** master_test_suite ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL master_test_suite_t : public test_suite { -public: - master_test_suite_t(); - - // Data members - int argc; - char** argv; -}; - -// ************************************************************************** // -// ************** user_tc_method_invoker ************** // -// ************************************************************************** // - -namespace ut_detail { - -BOOST_TEST_DECL std::string normalize_test_case_name( const_string tu_name ); - -//____________________________________________________________________________// - -template -struct user_tc_method_invoker { - typedef void (UserTestCase::*TestMethod )(); - - user_tc_method_invoker( shared_ptr inst, TestMethod test_method ) - : m_inst( inst ), m_test_method( test_method ) {} - - void operator()() { ((*m_inst).*m_test_method)(); } - - shared_ptr m_inst; - TestMethod m_test_method; -}; - -} // namespace ut_detail - -// ************************************************************************** // -// ************** make_test_case ************** // -// ************************************************************************** // - -inline test_case* -make_test_case( boost::function const& test_func, const_string tc_name, const_string tc_file, std::size_t tc_line ) -{ - return new test_case( ut_detail::normalize_test_case_name( tc_name ), tc_file, tc_line, test_func ); -} - -//____________________________________________________________________________// - -template -inline test_case* -make_test_case( void (UserTestCase::* test_method )(), - const_string tc_name, - const_string tc_file, - std::size_t tc_line, - boost::shared_ptr user_test_case ) -{ - return new test_case( ut_detail::normalize_test_case_name( tc_name ), - tc_file, - tc_line, - ut_detail::user_tc_method_invoker( user_test_case, test_method ) ); -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TREE_TEST_UNIT_HPP_100211GER diff --git a/libraries/boost/include/boost/test/tree/traverse.hpp b/libraries/boost/include/boost/test/tree/traverse.hpp deleted file mode 100644 index d27917cace..0000000000 --- a/libraries/boost/include/boost/test/tree/traverse.hpp +++ /dev/null @@ -1,58 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: -1 $ -// -// Description : defines traverse_test_tree algorithm -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_TRAVERSE_HPP_100211GER -#define BOOST_TEST_TREE_TRAVERSE_HPP_100211GER - -// Boost.Test -#include - -#include -#include - -#include - - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** traverse_test_tree ************** // -// ************************************************************************** // - -BOOST_TEST_DECL void traverse_test_tree( test_case const&, test_tree_visitor&, bool ignore_status = false ); -BOOST_TEST_DECL void traverse_test_tree( test_suite const&, test_tree_visitor&, bool ignore_status = false ); -BOOST_TEST_DECL void traverse_test_tree( test_unit_id , test_tree_visitor&, bool ignore_status = false ); - -//____________________________________________________________________________// - -inline void -traverse_test_tree( test_unit const& tu, test_tree_visitor& V, bool ignore_status = false ) -{ - if( tu.p_type == TUT_CASE ) - traverse_test_tree( static_cast( tu ), V, ignore_status ); - else - traverse_test_tree( static_cast( tu ), V, ignore_status ); -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TREE_TRAVERSE_HPP_100211GER diff --git a/libraries/boost/include/boost/test/tree/visitor.hpp b/libraries/boost/include/boost/test/tree/visitor.hpp deleted file mode 100644 index 8f1bae5c92..0000000000 --- a/libraries/boost/include/boost/test/tree/visitor.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: -1 $ -// -// Description : defines test_tree_visitor -// *************************************************************************** - -#ifndef BOOST_TEST_TREE_VISITOR_HPP_100211GER -#define BOOST_TEST_TREE_VISITOR_HPP_100211GER - -// Boost.Test -#include - -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** test_tree_visitor ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL test_tree_visitor { -public: - // test tree visitor interface - virtual bool visit( test_unit const& ) { return true; } - virtual void visit( test_case const& tc ) { visit( (test_unit const&)tc ); } - virtual bool test_suite_start( test_suite const& ts ){ return visit( (test_unit const&)ts ); } - virtual void test_suite_finish( test_suite const& ) {} - -protected: - BOOST_TEST_PROTECTED_VIRTUAL ~test_tree_visitor() {} -}; - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_TREE_VISITOR_HPP_100211GER - diff --git a/libraries/boost/include/boost/test/unit_test.hpp b/libraries/boost/include/boost/test/unit_test.hpp deleted file mode 100644 index e6a236a1b5..0000000000 --- a/libraries/boost/include/boost/test/unit_test.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Entry point into the Unit Test Framework -/// -/// This header should be the only header necessary to include to start using the framework -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_HPP_071894GER -#define BOOST_TEST_UNIT_TEST_HPP_071894GER - -// Boost.Test -#include -#include - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** Auto Linking ************** // -// ************************************************************************** // - -#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \ - !defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED) -# define BOOST_LIB_NAME boost_unit_test_framework - -# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TEST_DYN_LINK) -# define BOOST_DYN_LINK -# endif - -# include - -#endif // auto-linking disabled - -// ************************************************************************** // -// ************** unit_test_main ************** // -// ************************************************************************** // - -namespace boost { namespace unit_test { - -int BOOST_TEST_DECL unit_test_main( init_unit_test_func init_func, int argc, char* argv[] ); - -} - -// !! ?? to remove -namespace unit_test_framework=unit_test; - -} - -#if defined(BOOST_TEST_DYN_LINK) && defined(BOOST_TEST_MAIN) && !defined(BOOST_TEST_NO_MAIN) - -// ************************************************************************** // -// ************** main function for tests using dll ************** // -// ************************************************************************** // - -int BOOST_TEST_CALL_DECL -main( int argc, char* argv[] ) -{ - return ::boost::unit_test::unit_test_main( &init_unit_test, argc, argv ); -} - -//____________________________________________________________________________// - -#endif // BOOST_TEST_DYN_LINK && BOOST_TEST_MAIN && !BOOST_TEST_NO_MAIN - -#endif // BOOST_TEST_UNIT_TEST_HPP_071894GER diff --git a/libraries/boost/include/boost/test/unit_test_log.hpp b/libraries/boost/include/boost/test/unit_test_log.hpp deleted file mode 100644 index 6944ffa79a..0000000000 --- a/libraries/boost/include/boost/test/unit_test_log.hpp +++ /dev/null @@ -1,280 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief defines singleton class unit_test_log and all manipulators. -/// unit_test_log has output stream like interface. It's implementation is -/// completely hidden with pimple idiom -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER -#define BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER - -// Boost.Test -#include - -#include -#include -#include - -#include -#include -#include - -// Boost - -// STL -#include // for std::ostream& - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** log manipulators ************** // -// ************************************************************************** // - -namespace log { - -struct BOOST_TEST_DECL begin { - begin( const_string fn, std::size_t ln ) - : m_file_name( fn ) - , m_line_num( ln ) - {} - - const_string m_file_name; - std::size_t m_line_num; -}; - -struct end {}; - -} // namespace log - -// ************************************************************************** // -// ************** entry_value_collector ************** // -// ************************************************************************** // - -namespace ut_detail { - -class BOOST_TEST_DECL entry_value_collector { -public: - // Constructors - entry_value_collector() : m_last( true ) {} - entry_value_collector( entry_value_collector const& rhs ) : m_last( true ) { rhs.m_last = false; } - ~entry_value_collector(); - - // collection interface - entry_value_collector const& operator<<( lazy_ostream const& ) const; - entry_value_collector const& operator<<( const_string ) const; - -private: - // Data members - mutable bool m_last; -}; - -} // namespace ut_detail - -// ************************************************************************** // -// ************** unit_test_log ************** // -// ************************************************************************** // - -/// @brief Manages the sets of loggers, their streams and log levels -/// -/// The Boost.Test framework allows for having several formatters/loggers at the same time, each of which -/// having their own log level and output stream. -/// -/// This class serves the purpose of -/// - exposing an interface to the test framework (as a boost::unit_test::test_observer) -/// - exposing an interface to the testing tools -/// - managing several loggers -/// -/// @note Accesses to the functions exposed by this class are made through the singleton -/// @c boost::unit_test::unit_test_log. -/// -/// Users/developers willing to implement their own formatter need to: -/// - implement a boost::unit_test::unit_test_log_formatter that will output the desired format -/// - register the formatter during a eg. global fixture using the method @c set_formatter (though the framework singleton). -/// -/// @warning this observer has a higher priority than the @ref boost::unit_test::results_collector_t. This means -/// that the various @ref boost::unit_test::test_results associated to each test unit may not be available at the time -/// the @c test_unit_start, @c test_unit_finish ... are called. -/// -/// @see -/// - boost::unit_test::test_observer -/// - boost::unit_test::unit_test_log_formatter -class BOOST_TEST_DECL unit_test_log_t : public test_observer, public singleton { -public: - // test_observer interface implementation - virtual void test_start( counter_t test_cases_amount ); - virtual void test_finish(); - virtual void test_aborted(); - - virtual void test_unit_start( test_unit const& ); - virtual void test_unit_finish( test_unit const&, unsigned long elapsed ); - virtual void test_unit_skipped( test_unit const&, const_string ); - virtual void test_unit_aborted( test_unit const& ); - - virtual void exception_caught( execution_exception const& ex ); - - virtual int priority() { return 2; } - - // log configuration methods - //! Sets the stream for all loggers - //! - //! This will override the log sink/stream of all loggers, whether enabled or not. - void set_stream( std::ostream& ); - - //! Sets the stream for specific logger - //! - //! @note Has no effect if the specified format is not found - //! @par Since Boost 1.62 - void set_stream( output_format, std::ostream& ); - - //! Returns a pointer to the stream associated to specific logger - //! - //! @note Returns a null pointer if the format is not found - //! @par Since Boost 1.67 - std::ostream* get_stream( output_format ) const; - - - //! Sets the threshold level for all loggers/formatters. - //! - //! This will override the log level of all loggers, whether enabled or not. - void set_threshold_level( log_level ); - - //! Sets the threshold/log level of a specific format - //! - //! @note Has no effect if the specified format is not found - //! @par Since Boost 1.62 - void set_threshold_level( output_format, log_level ); - - //! Add a format to the set of loggers - //! - //! Adding a logger means that the specified logger is enabled. The log level is managed by the formatter itself - //! and specifies what events are forwarded to the underlying formatter. - //! @par Since Boost 1.62 - void add_format( output_format ); - - //! Sets the format of the logger - //! - //! This will become the only active format of the logs. - void set_format( output_format ); - - //! Returns the logger instance for a specific format. - //! - //! @returns the logger/formatter instance, or @c (unit_test_log_formatter*)0 if the format is not found. - //! @par Since Boost 1.62 - unit_test_log_formatter* get_formatter( output_format ); - - //! Sets the logger instance - //! - //! The specified logger becomes the unique active one. The custom log formatter has the - //! format @c OF_CUSTOM_LOGGER. If such a format exists already, its formatter gets replaced by the one - //! given in argument. - //! - //! The log level and output stream of the new formatter are taken from the currently active logger. In case - //! several loggers are active, the order of priority is CUSTOM, HRF, XML, and JUNIT. - //! If (unit_test_log_formatter*)0 is given as argument, the custom logger (if any) is removed. - //! - //! @note The ownership of the pointer is transfered to the Boost.Test framework. This call is equivalent to - //! - a call to @c add_formatter - //! - a call to @c set_format(OF_CUSTOM_LOGGER) - //! - a configuration of the newly added logger with a previously configured stream and log level. - void set_formatter( unit_test_log_formatter* ); - - //! Adds a custom log formatter to the set of formatters - //! - //! The specified logger is added with the format @c OF_CUSTOM_LOGGER, such that it can - //! be futher selected or its stream/log level can be specified. - //! If there is already a custom logger (with @c OF_CUSTOM_LOGGER), then - //! the existing one gets replaced by the one given in argument. - //! The provided logger is added with an enabled state. - //! If (unit_test_log_formatter*)0 is given as argument, the custom logger (if any) is removed and - //! no other action is performed. - //! - //! @note The ownership of the pointer is transfered to the Boost.Test framework. - //! @par Since Boost 1.62 - void add_formatter( unit_test_log_formatter* the_formatter ); - - // test progress logging - void set_checkpoint( const_string file, std::size_t line_num, const_string msg = const_string() ); - - // entry logging - unit_test_log_t& operator<<( log::begin const& ); // begin entry - unit_test_log_t& operator<<( log::end const& ); // end entry - unit_test_log_t& operator<<( log_level ); // set entry level - unit_test_log_t& operator<<( const_string ); // log entry value - unit_test_log_t& operator<<( lazy_ostream const& ); // log entry value - - ut_detail::entry_value_collector operator()( log_level ); // initiate entry collection - -private: - // Implementation helpers - bool log_entry_start(output_format log_format); - void log_entry_context( log_level l ); - void clear_entry_context(); - - BOOST_TEST_SINGLETON_CONS( unit_test_log_t ) -}; // unit_test_log_t - -BOOST_TEST_SINGLETON_INST( unit_test_log ) - -// helper macros -#define BOOST_TEST_LOG_ENTRY( ll ) \ - (::boost::unit_test::unit_test_log \ - << ::boost::unit_test::log::begin( BOOST_TEST_L(__FILE__), __LINE__ ))(ll) \ -/**/ - -} // namespace unit_test -} // namespace boost - -// ************************************************************************** // -// ************** Unit test log interface helpers ************** // -// ************************************************************************** // - -// messages sent by the framework -#define BOOST_TEST_FRAMEWORK_MESSAGE( M ) \ - (::boost::unit_test::unit_test_log \ - << ::boost::unit_test::log::begin( \ - "boost.test framework", \ - __LINE__ )) \ - ( ::boost::unit_test::log_messages ) \ - << BOOST_TEST_LAZY_MSG( M ) \ -/**/ - - -#define BOOST_TEST_MESSAGE( M ) \ - BOOST_TEST_LOG_ENTRY( ::boost::unit_test::log_messages ) \ - << BOOST_TEST_LAZY_MSG( M ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_TEST_PASSPOINT() \ - ::boost::unit_test::unit_test_log.set_checkpoint( \ - BOOST_TEST_L(__FILE__), \ - static_cast(__LINE__) ) \ -/**/ - -//____________________________________________________________________________// - -#define BOOST_TEST_CHECKPOINT( M ) \ - ::boost::unit_test::unit_test_log.set_checkpoint( \ - BOOST_TEST_L(__FILE__), \ - static_cast(__LINE__), \ - (::boost::wrap_stringstream().ref() << M).str() ) \ -/**/ - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER - diff --git a/libraries/boost/include/boost/test/unit_test_log_formatter.hpp b/libraries/boost/include/boost/test/unit_test_log_formatter.hpp deleted file mode 100644 index 79b74e0849..0000000000 --- a/libraries/boost/include/boost/test/unit_test_log_formatter.hpp +++ /dev/null @@ -1,322 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Defines unit test log formatter interface -/// -/// You can define a class with implements this interface and use an instance of it -/// as a Unit Test Framework log formatter -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER -#define BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER - -// Boost.Test -#include -#include -#include - -// STL -#include -#include // for std::string -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -/// Collection of log entry attributes -// ************************************************************************** // - -struct BOOST_TEST_DECL log_entry_data { - log_entry_data() - { - m_file_name.reserve( 200 ); - } - - std::string m_file_name; ///< log entry file name - std::size_t m_line_num; ///< log entry line number - log_level m_level; ///< log entry level - - void clear() - { - m_file_name.erase(); - m_line_num = 0; - m_level = log_nothing; - } -}; - -// ************************************************************************** // -/// Collection of log checkpoint attributes -// ************************************************************************** // - -struct BOOST_TEST_DECL log_checkpoint_data -{ - const_string m_file_name; ///< log checkpoint file name - std::size_t m_line_num; ///< log checkpoint file name - std::string m_message; ///< log checkpoint message - - void clear() - { - m_file_name.clear(); - m_line_num = 0; - m_message = std::string(); - } -}; - -// ************************************************************************** // -/// @brief Abstract Unit Test Framework log formatter interface -/// -/// During the test module execution Unit Test Framework can report messages about success -/// or failure of assertions, which test suites are being run and more (specifically which -/// messages are reported depends on log level threshold selected by the user). -/// -/// All these messages constitute Unit Test Framework log. There are many ways (formats) to present -/// these messages to the user. -/// -/// Boost.Test comes with three formats: -/// - Compiler-like log format: intended for human consumption/diagnostic -/// - XML based log format: intended for processing by automated regression test systems. -/// - JUNIT based log format: intended for processing by automated regression test systems. -/// -/// If you want to produce some other format you need to implement class with specific interface and use -/// method @c unit_test_log_t::set_formatter during a test module initialization to set an active formatter. -/// The class unit_test_log_formatter defines this interface. -/// -/// This interface requires you to format all possible messages being produced in the log. -/// These includes error messages about failed assertions, messages about caught exceptions and -/// information messages about test units being started/ended. All the methods in this interface takes -/// a reference to standard stream as a first argument. This is where final messages needs to be directed -/// to. Also you are given all the information necessary to produce a message. -/// -/// @par Since Boost 1.62: -/// - Each formatter may indicate the default output stream. This is convenient for instance for streams intended -/// for automated processing that indicate a file. See @c get_default_stream_description for more details. -/// - Each formatter may manage its own log level through the getter/setter @c get_log_level and @c set_log_level . -/// -/// @see -/// - boost::unit_test::test_observer for an indication of the calls of the test observer interface -class BOOST_TEST_DECL unit_test_log_formatter { -public: - /// Types of log entries (messages written into a log) - enum log_entry_types { BOOST_UTL_ET_INFO, ///< Information message from the framework - BOOST_UTL_ET_MESSAGE, ///< Information message from the user - BOOST_UTL_ET_WARNING, ///< Warning (non error) condition notification message - BOOST_UTL_ET_ERROR, ///< Non fatal error notification message - BOOST_UTL_ET_FATAL_ERROR ///< Fatal error notification message - }; - - //! Constructor - unit_test_log_formatter() - : m_log_level(log_all_errors) - {} - - // Destructor - virtual ~unit_test_log_formatter() {} - - // @name Test start/finish - - /// Invoked at the beginning of test module execution - /// - /// @param[in] os output stream to write a messages to - /// @param[in] test_cases_amount total test case amount to be run - /// @see log_finish - virtual void log_start( std::ostream& os, counter_t test_cases_amount ) = 0; - - /// Invoked at the end of test module execution - /// - /// @param[in] os output stream to write a messages into - /// @see log_start - virtual void log_finish( std::ostream& os ) = 0; - - /// Invoked when Unit Test Framework build information is requested - /// - /// @param[in] os output stream to write a messages into - virtual void log_build_info( std::ostream& os ) = 0; - // @} - - // @name Test unit start/finish - - /// Invoked when test unit starts (either test suite or test case) - /// - /// @param[in] os output stream to write a messages into - /// @param[in] tu test unit being started - /// @see test_unit_finish - virtual void test_unit_start( std::ostream& os, test_unit const& tu ) = 0; - - /// Invoked when test unit finishes - /// - /// @param[in] os output stream to write a messages into - /// @param[in] tu test unit being finished - /// @param[in] elapsed time in microseconds spend executing this test unit - /// @see test_unit_start - virtual void test_unit_finish( std::ostream& os, test_unit const& tu, unsigned long elapsed ) = 0; - - /// Invoked if test unit skipped for any reason - /// - /// @param[in] os output stream to write a messages into - /// @param[in] tu skipped test unit - /// @param[in] reason explanation why was it skipped - virtual void test_unit_skipped( std::ostream& os, test_unit const& tu, const_string /* reason */) - { - test_unit_skipped( os, tu ); - } - - /// Deprecated version of this interface - virtual void test_unit_skipped( std::ostream& /* os */, test_unit const& /* tu */) {} - - /// Invoked when a test unit is aborted - virtual void test_unit_aborted( std::ostream& /* os */, test_unit const& /* tu */) {} - - // @} - - // @name Uncaught exception report - - /// Invoked when Unit Test Framework detects uncaught exception - /// - /// The framwork calls this function when an uncaught exception it detected. - /// This call is followed by context information: - /// - one call to @c entry_context_start, - /// - as many calls to @c log_entry_context as there are context entries - /// - one call to @c entry_context_finish - /// - /// The logging of the exception information is finilized by a call to @c log_exception_finish. - /// - /// @param[in] os output stream to write a messages into - /// @param[in] lcd information about the last checkpoint before the exception was triggered - /// @param[in] ex information about the caught exception - /// @see log_exception_finish - virtual void log_exception_start( std::ostream& os, log_checkpoint_data const& lcd, execution_exception const& ex ) = 0; - - /// Invoked when Unit Test Framework detects uncaught exception - /// - /// Call to this function finishes uncaught exception report. - /// @param[in] os output stream to write a messages into - /// @see log_exception_start - virtual void log_exception_finish( std::ostream& os ) = 0; - // @} - - // @name Regular log entry - - /// Invoked by Unit Test Framework to start new log entry - - /// Call to this function starts new log entry. It is followed by series of log_entry_value calls and finally call to log_entry_finish. - /// A log entry may consist of one or more values being reported. Some of these values will be plain strings, while others can be complicated - /// expressions in a form of "lazy" expression template lazy_ostream. - /// @param[in] os output stream to write a messages into - /// @param[in] led log entry attributes - /// @param[in] let log entry type log_entry_finish - /// @see log_entry_value, log_entry_finish - /// - /// @note call to this function may happen before any call to test_unit_start or all calls to test_unit_finish as the - /// framework might log errors raised during global initialization/shutdown. - virtual void log_entry_start( std::ostream& os, log_entry_data const& led, log_entry_types let ) = 0; - - /// Invoked by Unit Test Framework to report a log entry content - /// - /// This is one of two overloaded methods to report log entry content. This one is used to report plain string value. - /// @param[in] os output stream to write a messages into. - /// @param[in] value log entry string value - /// @see log_entry_start, log_entry_finish - virtual void log_entry_value( std::ostream& os, const_string value ) = 0; - - /// Invoked by Unit Test Framework to report a log entry content - - /// This is one of two overloaded methods to report log entry content. This one is used to report some complicated expression passed as - /// an expression template lazy_ostream. In most cases default implementation provided by the framework should work as is (it just converts - /// the lazy expression into a string. - /// @param[in] os output stream to write a messages into - /// @param[in] value log entry "lazy" value - /// @see log_entry_start, log_entry_finish - virtual void log_entry_value( std::ostream& os, lazy_ostream const& value ); // there is a default impl - - /// Invoked by Unit Test Framework to finish a log entry report - - /// @param[in] os output stream to write a messages into - /// @see log_entry_start, log_entry_start - virtual void log_entry_finish( std::ostream& os ) = 0; - // @} - - // @name Log entry context report - - /// Invoked by Unit Test Framework to start log entry context report - // - /// Unit Test Framework logs for failed assertions and uncaught exceptions context if one was defined by a test module. - /// Context consists of multiple "scopes" identified by description messages assigned by the test module using - /// BOOST_TEST_INFO/BOOST_TEST_CONTEXT statements. - /// @param[in] os output stream to write a messages into - /// @param[in] l entry log_level, to be used to fine tune the message - /// @see log_entry_context, entry_context_finish - virtual void entry_context_start( std::ostream& os, log_level l ) = 0; - - /// Invoked by Unit Test Framework to report log entry context "scope" description - // - /// Each "scope" description is reported by separate call to log_entry_context. - /// @param[in] os output stream to write a messages into - /// @param[in] l entry log_level, to be used to fine tune the message - /// @param[in] value context "scope" description - /// @see log_entry_start, entry_context_finish - virtual void log_entry_context( std::ostream& os, log_level l, const_string value ) = 0; - - /// Invoked by Unit Test Framework to finish log entry context report - /// - /// @param[in] os output stream to write a messages into - /// @param[in] l entry log_level, to be used to fine tune the message - /// @see log_entry_start, entry_context_context - virtual void entry_context_finish( std::ostream& os, log_level l ) = 0; - // @} - - // @name Log level management - - /// Sets the log level of the logger/formatter - /// - /// Some loggers need to manage the log level by their own. This - /// member function let the implementation decide of that. - /// @par Since Boost 1.62 - virtual void set_log_level(log_level new_log_level); - - /// Returns the log level of the logger/formatter - /// @par Since Boost 1.62 - virtual log_level get_log_level() const; - // @} - - - // @name Stream management - - /// Returns a default stream for this logger. - /// - /// The returned string describes the stream as if it was passed from - /// the command line @c "--log_sink" parameter. With that regards, @b stdout and @b stderr - /// have special meaning indicating the standard output or error stream respectively. - /// - /// @par Since Boost 1.62 - virtual std::string get_default_stream_description() const - { - return "stdout"; - } - - // @} - - -protected: - log_level m_log_level; - -}; - -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER - diff --git a/libraries/boost/include/boost/test/unit_test_monitor.hpp b/libraries/boost/include/boost/test/unit_test_monitor.hpp deleted file mode 100644 index 1f937fa674..0000000000 --- a/libraries/boost/include/boost/test/unit_test_monitor.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief defines specific version of execution monitor used to managed run unit of test cases -/// -/// Translates execution exception into error level -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER -#define BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER - -// Boost.Test -#include -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** unit_test_monitor ************** // -// ************************************************************************** // - -class BOOST_TEST_DECL unit_test_monitor_t : public singleton, public execution_monitor { -public: - enum error_level { - test_ok = 0, - precondition_failure = -1, - unexpected_exception = -2, - os_exception = -3, - os_timeout = -4, - fatal_error = -5 // includes both system and user - }; - - static bool is_critical_error( error_level e ) { return e <= fatal_error; } - - // monitor method - error_level execute_and_translate( boost::function const& func, unsigned timeout = 0 ); - -private: - BOOST_TEST_SINGLETON_CONS( unit_test_monitor_t ) -}; - -BOOST_TEST_SINGLETON_INST( unit_test_monitor ) - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER diff --git a/libraries/boost/include/boost/test/unit_test_parameters.hpp b/libraries/boost/include/boost/test/unit_test_parameters.hpp deleted file mode 100644 index e01bbd7aed..0000000000 --- a/libraries/boost/include/boost/test/unit_test_parameters.hpp +++ /dev/null @@ -1,158 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Provides access to various Unit Test Framework runtime parameters -/// -/// Primarily for use by the framework itself -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER -#define BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER - -// Boost.Test -#include -#include -#include - -// Boost -#include - -// STL -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace runtime_config { - -// ************************************************************************** // -// ************** runtime_config ************** // -// ************************************************************************** // - -// UTF parameters -BOOST_TEST_DECL extern std::string btrt_auto_start_dbg; -BOOST_TEST_DECL extern std::string btrt_break_exec_path; -BOOST_TEST_DECL extern std::string btrt_build_info; -BOOST_TEST_DECL extern std::string btrt_catch_sys_errors; -BOOST_TEST_DECL extern std::string btrt_color_output; -BOOST_TEST_DECL extern std::string btrt_detect_fp_except; -BOOST_TEST_DECL extern std::string btrt_detect_mem_leaks; -BOOST_TEST_DECL extern std::string btrt_list_content; -BOOST_TEST_DECL extern std::string btrt_list_labels; -BOOST_TEST_DECL extern std::string btrt_log_format; -BOOST_TEST_DECL extern std::string btrt_log_level; -BOOST_TEST_DECL extern std::string btrt_log_sink; -BOOST_TEST_DECL extern std::string btrt_combined_logger; -BOOST_TEST_DECL extern std::string btrt_output_format; -BOOST_TEST_DECL extern std::string btrt_random_seed; -BOOST_TEST_DECL extern std::string btrt_report_format; -BOOST_TEST_DECL extern std::string btrt_report_level; -BOOST_TEST_DECL extern std::string btrt_report_mem_leaks; -BOOST_TEST_DECL extern std::string btrt_report_sink; -BOOST_TEST_DECL extern std::string btrt_result_code; -BOOST_TEST_DECL extern std::string btrt_run_filters; -BOOST_TEST_DECL extern std::string btrt_save_test_pattern; -BOOST_TEST_DECL extern std::string btrt_show_progress; -BOOST_TEST_DECL extern std::string btrt_use_alt_stack; -BOOST_TEST_DECL extern std::string btrt_wait_for_debugger; -BOOST_TEST_DECL extern std::string btrt_help; -BOOST_TEST_DECL extern std::string btrt_usage; -BOOST_TEST_DECL extern std::string btrt_version; - -BOOST_TEST_DECL void init( int& argc, char** argv ); - -// ************************************************************************** // -// ************** runtime_param::get ************** // -// ************************************************************************** // - -/// Access to arguments -BOOST_TEST_DECL runtime::arguments_store const& argument_store(); - -template -inline T const& -get( runtime::cstring parameter_name ) -{ - return argument_store().get( parameter_name ); -} - -inline bool has( runtime::cstring parameter_name ) -{ - return argument_store().has( parameter_name ); -} - -/// For public access -BOOST_TEST_DECL bool save_pattern(); - -// ************************************************************************** // -// ************** stream_holder ************** // -// ************************************************************************** // - -class stream_holder { -public: - // Constructor - explicit stream_holder( std::ostream& default_stream = std::cout ) - : m_stream( &default_stream ) - { - } - - void setup( const const_string& stream_name, - boost::function const &cleaner_callback = boost::function() ) - { - if(stream_name.empty()) - return; - - if( stream_name == "stderr" ) { - m_stream = &std::cerr; - m_cleaner.reset(); - } - else if( stream_name == "stdout" ) { - m_stream = &std::cout; - m_cleaner.reset(); - } - else { - m_cleaner = boost::make_shared(cleaner_callback); - m_cleaner->m_file.open( std::string(stream_name.begin(), stream_name.end()).c_str() ); - m_stream = &m_cleaner->m_file; - } - } - - // Access methods - std::ostream& ref() const { return *m_stream; } - -private: - struct callback_cleaner { - callback_cleaner(boost::function cleaner_callback) - : m_cleaner_callback(cleaner_callback) - , m_file() { - } - ~callback_cleaner() { - if( m_cleaner_callback ) - m_cleaner_callback(); - } - boost::function m_cleaner_callback; - std::ofstream m_file; - }; - - // Data members - boost::shared_ptr m_cleaner; - std::ostream* m_stream; -}; - -} // namespace runtime_config -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER diff --git a/libraries/boost/include/boost/test/unit_test_suite.hpp b/libraries/boost/include/boost/test/unit_test_suite.hpp deleted file mode 100644 index 13ff804b44..0000000000 --- a/libraries/boost/include/boost/test/unit_test_suite.hpp +++ /dev/null @@ -1,403 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// @brief Defines Unit Test Framework public API -// *************************************************************************** - -#ifndef BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER -#define BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER - -// Boost.Test -#include -#include -#include -#include - - -#include - - -#include - - - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** Non-auto (explicit) test case interface ************** // -// ************************************************************************** // - -#define BOOST_TEST_CASE( test_function ) \ -boost::unit_test::make_test_case( boost::function(test_function), \ - BOOST_TEST_STRINGIZE( test_function ), \ - __FILE__, __LINE__ ) -#define BOOST_CLASS_TEST_CASE( test_function, tc_instance ) \ -boost::unit_test::make_test_case( (test_function), \ - BOOST_TEST_STRINGIZE( test_function ), \ - __FILE__, __LINE__, tc_instance ) - -// ************************************************************************** // -// ************** BOOST_TEST_SUITE ************** // -// ************************************************************************** // - -#define BOOST_TEST_SUITE( testsuite_name ) \ -( new boost::unit_test::test_suite( testsuite_name, __FILE__, __LINE__ ) ) - -// ************************************************************************** // -// ************** BOOST_AUTO_TEST_SUITE ************** // -// ************************************************************************** // - -#define BOOST_AUTO_TEST_SUITE_WITH_DECOR( suite_name, decorators ) \ -namespace suite_name { \ -BOOST_AUTO_TU_REGISTRAR( suite_name )( \ - BOOST_STRINGIZE( suite_name ), \ - __FILE__, __LINE__, \ - decorators ); \ -/**/ - -#define BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \ - BOOST_AUTO_TEST_SUITE_WITH_DECOR( \ - suite_name, \ - boost::unit_test::decorator::collector::instance() ) \ -/**/ - -#if BOOST_PP_VARIADICS -#define BOOST_AUTO_TEST_SUITE( ... ) \ - BOOST_TEST_INVOKE_IF_N_ARGS( 1, \ - BOOST_AUTO_TEST_SUITE_NO_DECOR, \ - BOOST_AUTO_TEST_SUITE_WITH_DECOR, \ - __VA_ARGS__) \ -/**/ - -#else /* BOOST_PP_VARIADICS */ - -#define BOOST_AUTO_TEST_SUITE( suite_name ) \ - BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \ -/**/ - - -#endif /* BOOST_PP_VARIADICS */ - -// ************************************************************************** // -// ************** BOOST_FIXTURE_TEST_SUITE ************** // -// ************************************************************************** // - -#define BOOST_FIXTURE_TEST_SUITE_WITH_DECOR(suite_name, F, decorators) \ - BOOST_AUTO_TEST_SUITE_WITH_DECOR( suite_name, decorators ) \ -typedef F BOOST_AUTO_TEST_CASE_FIXTURE; \ -/**/ - -#define BOOST_FIXTURE_TEST_SUITE_NO_DECOR( suite_name, F ) \ - BOOST_AUTO_TEST_SUITE_NO_DECOR( suite_name ) \ -typedef F BOOST_AUTO_TEST_CASE_FIXTURE; \ -/**/ - -#if BOOST_PP_VARIADICS - -#define BOOST_FIXTURE_TEST_SUITE( ... ) \ - BOOST_TEST_INVOKE_IF_N_ARGS( 2, \ - BOOST_FIXTURE_TEST_SUITE_NO_DECOR, \ - BOOST_FIXTURE_TEST_SUITE_WITH_DECOR, \ - __VA_ARGS__) \ -/**/ - -#else /* BOOST_PP_VARIADICS */ - -#define BOOST_FIXTURE_TEST_SUITE( suite_name, F ) \ - BOOST_FIXTURE_TEST_SUITE_NO_DECOR( suite_name, F ) \ -/**/ - - -#endif /* BOOST_PP_VARIADICS */ - - -// ************************************************************************** // -// ************** BOOST_AUTO_TEST_SUITE_END ************** // -// ************************************************************************** // - -#define BOOST_AUTO_TEST_SUITE_END() \ -BOOST_AUTO_TU_REGISTRAR( end_suite )( 1 ); \ -} \ -/**/ - -// ************************************************************************** // -// ************** BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES ************** // -// ************************************************************************** // - -/// @deprecated use decorator instead -#define BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES( test_name, n ) \ -BOOST_TEST_DECORATOR( * boost::unit_test::expected_failures( n ) ) \ -/**/ - -// ************************************************************************** // -// ************** BOOST_FIXTURE_TEST_CASE ************** // -// ************************************************************************** // - -#define BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, F, decorators ) \ -struct test_name : public F { void test_method(); }; \ - \ -static void BOOST_AUTO_TC_INVOKER( test_name )() \ -{ \ - BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture ctor"); \ - test_name t; \ - BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture setup"); \ - boost::unit_test::setup_conditional(t); \ - BOOST_TEST_CHECKPOINT('"' << #test_name << "\" test entry"); \ - t.test_method(); \ - BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture teardown"); \ - boost::unit_test::teardown_conditional(t); \ - BOOST_TEST_CHECKPOINT('"' << #test_name << "\" fixture dtor"); \ -} \ - \ -struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {}; \ - \ -BOOST_AUTO_TU_REGISTRAR( test_name )( \ - boost::unit_test::make_test_case( \ - &BOOST_AUTO_TC_INVOKER( test_name ), \ - #test_name, __FILE__, __LINE__ ), \ - decorators ); \ - \ -void test_name::test_method() \ -/**/ - -#define BOOST_FIXTURE_TEST_CASE_NO_DECOR( test_name, F ) \ -BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, F, \ - boost::unit_test::decorator::collector::instance() ) \ -/**/ - -#if BOOST_PP_VARIADICS - -#define BOOST_FIXTURE_TEST_CASE( ... ) \ - BOOST_TEST_INVOKE_IF_N_ARGS( 2, \ - BOOST_FIXTURE_TEST_CASE_NO_DECOR, \ - BOOST_FIXTURE_TEST_CASE_WITH_DECOR, \ - __VA_ARGS__) \ -/**/ - -#else /* BOOST_PP_VARIADICS */ - -#define BOOST_FIXTURE_TEST_CASE( test_name, F ) \ - BOOST_FIXTURE_TEST_CASE_NO_DECOR(test_name, F) \ -/**/ - - -#endif /* BOOST_PP_VARIADICS */ - -// ************************************************************************** // -// ************** BOOST_AUTO_TEST_CASE ************** // -// ************************************************************************** // - -#define BOOST_AUTO_TEST_CASE_NO_DECOR( test_name ) \ - BOOST_FIXTURE_TEST_CASE_NO_DECOR( test_name, \ - BOOST_AUTO_TEST_CASE_FIXTURE ) \ -/**/ - -#define BOOST_AUTO_TEST_CASE_WITH_DECOR( test_name, decorators ) \ - BOOST_FIXTURE_TEST_CASE_WITH_DECOR( test_name, \ - BOOST_AUTO_TEST_CASE_FIXTURE, decorators ) \ -/**/ - -#if BOOST_PP_VARIADICS - -#define BOOST_AUTO_TEST_CASE( ... ) \ - BOOST_TEST_INVOKE_IF_N_ARGS( 1, \ - BOOST_AUTO_TEST_CASE_NO_DECOR, \ - BOOST_AUTO_TEST_CASE_WITH_DECOR, \ - __VA_ARGS__) \ -/**/ - -#else /* BOOST_PP_VARIADICS */ - -#define BOOST_AUTO_TEST_CASE( test_name ) \ - BOOST_AUTO_TEST_CASE_NO_DECOR( test_name ) \ -/**/ - - -#endif /* BOOST_PP_VARIADICS */ - -// ************************************************************************** // -// ************** BOOST_FIXTURE_TEST_CASE_TEMPLATE ************** // -// ************************************************************************** // - -#define BOOST_FIXTURE_TEST_CASE_TEMPLATE( test_name, type_name, TL, F ) \ -template \ -struct test_name : public F \ -{ void test_method(); }; \ - \ -struct BOOST_AUTO_TC_INVOKER( test_name ) { \ - template \ - static void run( boost::type* = 0 ) \ - { \ - BOOST_TEST_CHECKPOINT('"' << #test_name <<"\" fixture entry."); \ - test_name t; boost::unit_test::setup_conditional(t); \ - BOOST_TEST_CHECKPOINT('"' << #test_name << "\" entry."); \ - t.test_method(); \ - BOOST_TEST_CHECKPOINT('"' << #test_name << "\" exit."); \ - boost::unit_test::teardown_conditional(t); \ - } \ -}; \ - \ -BOOST_AUTO_TU_REGISTRAR( test_name )( \ - boost::unit_test::ut_detail::template_test_case_gen< \ - BOOST_AUTO_TC_INVOKER( test_name ),TL >( \ - BOOST_STRINGIZE( test_name ), __FILE__, __LINE__ ), \ - boost::unit_test::decorator::collector::instance() ); \ - \ -template \ -void test_name::test_method() \ -/**/ - -// ************************************************************************** // -// ************** BOOST_AUTO_TEST_CASE_TEMPLATE ************** // -// ************************************************************************** // - -#define BOOST_AUTO_TEST_CASE_TEMPLATE( test_name, type_name, TL ) \ -BOOST_FIXTURE_TEST_CASE_TEMPLATE( test_name, type_name, TL, \ - BOOST_AUTO_TEST_CASE_FIXTURE ) \ -/**/ - -// ************************************************************************** // -// ************** BOOST_TEST_CASE_TEMPLATE ************** // -// ************************************************************************** // - -#define BOOST_TEST_CASE_TEMPLATE( name, typelist ) \ - boost::unit_test::ut_detail::template_test_case_gen( \ - BOOST_TEST_STRINGIZE( name ), __FILE__, __LINE__ ) \ -/**/ - -// ************************************************************************** // -// ************** BOOST_TEST_CASE_TEMPLATE_FUNCTION ************** // -// ************************************************************************** // - -#define BOOST_TEST_CASE_TEMPLATE_FUNCTION( name, type_name ) \ -template \ -void BOOST_JOIN( name, _impl )( boost::type* ); \ - \ -struct name { \ - template \ - static void run( boost::type* frwrd = 0 ) \ - { \ - BOOST_JOIN( name, _impl )( frwrd ); \ - } \ -}; \ - \ -template \ -void BOOST_JOIN( name, _impl )( boost::type* ) \ -/**/ - -// ************************************************************************** // -// ************** BOOST_GLOBAL_FIXTURE ************** // -// ************************************************************************** // - -#define BOOST_GLOBAL_FIXTURE( F ) \ -static boost::unit_test::ut_detail::global_configuration_impl BOOST_JOIN( gf_, F ) \ -/**/ - -// ************************************************************************** // -// ************** BOOST_TEST_GLOBAL_CONFIGURATION ************** // -// ************************************************************************** // - -#define BOOST_TEST_GLOBAL_CONFIGURATION( F ) \ -static boost::unit_test::ut_detail::global_configuration_impl BOOST_JOIN( gf_, F ) \ -/**/ - -// ************************************************************************** // -// ************** BOOST_TEST_GLOBAL_FIXTURE ************** // -// ************************************************************************** // - -#define BOOST_TEST_GLOBAL_FIXTURE( F ) \ -static boost::unit_test::ut_detail::global_fixture_impl BOOST_JOIN( gf_, F ) \ -/**/ - -// ************************************************************************** // -// ************** BOOST_TEST_DECORATOR ************** // -// ************************************************************************** // - -#define BOOST_TEST_DECORATOR( D ) \ -static boost::unit_test::decorator::collector const& \ -BOOST_TEST_APPEND_UNIQUE_ID(decorator_collector) = D; \ -/**/ - -// ************************************************************************** // -// ************** BOOST_AUTO_TEST_CASE_FIXTURE ************** // -// ************************************************************************** // - -namespace boost { namespace unit_test { namespace ut_detail { - -struct nil_t {}; - -} // namespace ut_detail -} // unit_test -} // namespace boost - -// Intentionally is in global namespace, so that FIXTURE_TEST_SUITE can reset it in user code. -typedef ::boost::unit_test::ut_detail::nil_t BOOST_AUTO_TEST_CASE_FIXTURE; - -// ************************************************************************** // -// ************** Auto registration facility helper macros ************** // -// ************************************************************************** // - -// Facility for having a unique name based on __LINE__ and __COUNTER__ (later if available) -#if defined(__COUNTER__) - #define BOOST_TEST_INTERNAL_HAS_COUNTER -#endif - -#if defined(BOOST_TEST_INTERNAL_HAS_COUNTER) - #define BOOST_TEST_APPEND_UNIQUE_ID( name ) \ - BOOST_JOIN( BOOST_JOIN( name, __LINE__ ), __COUNTER__) - /**/ -#else - #define BOOST_TEST_APPEND_UNIQUE_ID( name ) \ - BOOST_JOIN( name, __LINE__ ) - /**/ -#endif -/**/ - -#define BOOST_AUTO_TU_REGISTRAR( test_name ) \ -static boost::unit_test::ut_detail::auto_test_unit_registrar \ -BOOST_TEST_APPEND_UNIQUE_ID( BOOST_JOIN( test_name, _registrar ) ) \ -/**/ -#define BOOST_AUTO_TC_INVOKER( test_name ) BOOST_JOIN( test_name, _invoker ) -#define BOOST_AUTO_TC_UNIQUE_ID( test_name ) BOOST_JOIN( test_name, _id ) - -// ************************************************************************** // -// ************** BOOST_TEST_MAIN ************** // -// ************************************************************************** // - -#if defined(BOOST_TEST_MAIN) - -#ifdef BOOST_TEST_ALTERNATIVE_INIT_API -bool init_unit_test() { -#else -::boost::unit_test::test_suite* -init_unit_test_suite( int, char* [] ) { -#endif - -#ifdef BOOST_TEST_MODULE - using namespace ::boost::unit_test; - assign_op( framework::master_test_suite().p_name.value, BOOST_TEST_STRINGIZE( BOOST_TEST_MODULE ).trim( "\"" ), 0 ); - -#endif - -#ifdef BOOST_TEST_ALTERNATIVE_INIT_API - return true; -} -#else - return 0; -} -#endif - -#endif - -//____________________________________________________________________________// - -#include - - -#endif // BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER - diff --git a/libraries/boost/include/boost/test/utils/algorithm.hpp b/libraries/boost/include/boost/test/utils/algorithm.hpp deleted file mode 100644 index 7f16816c3a..0000000000 --- a/libraries/boost/include/boost/test/utils/algorithm.hpp +++ /dev/null @@ -1,326 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -/// @file -/// Addition to STL algorithms -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_ALGORITHM_HPP -#define BOOST_TEST_UTILS_ALGORITHM_HPP - -// STL -#include -#include // std::find -#include // std::bind1st or std::bind - -#include - -#ifdef BOOST_NO_CXX98_BINDERS -#define BOOST_TEST_BIND1ST(F,A) std::bind( (F), (A), std::placeholders::_1 ) -#else -#define BOOST_TEST_BIND1ST(F,A) std::bind1st( (F), (A) ) -#endif - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -/// @brief this algorithm search through two collections for first mismatch position that get returned as a pair -/// of iterators, first pointing to the mismatch position in first collection, second iterator in second one -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -template -inline std::pair -mismatch( InputIter1 first1, InputIter1 last1, - InputIter2 first2, InputIter2 last2 ) -{ - while( first1 != last1 && first2 != last2 && *first1 == *first2 ) { - ++first1; - ++first2; - } - - return std::pair(first1, first2); -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through two collections for first mismatch position that get returned as a pair -/// of iterators, first pointing to the mismatch position in first collection, second iterator in second one. This algorithms -/// uses supplied predicate for collection elements comparison -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -/// @param pred - predicate to be used for search -template -inline std::pair -mismatch( InputIter1 first1, InputIter1 last1, - InputIter2 first2, InputIter2 last2, - Predicate pred ) -{ - while( first1 != last1 && first2 != last2 && pred( *first1, *first2 ) ) { - ++first1; - ++first2; - } - - return std::pair(first1, first2); -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for first element that does not belong a second one -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -template -inline ForwardIterator1 -find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2 ) -{ - while( first1 != last1 ) { - if( std::find( first2, last2, *first1 ) == last2 ) - break; - ++first1; - } - - return first1; -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for first element that does not satisfy binary -/// predicate in conjunction will any element in second collection -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -/// @param pred - predicate to be used for search -template -inline ForwardIterator1 -find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - Predicate pred ) -{ - while( first1 != last1 ) { - if( std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *first1 ) ) == last2 ) - break; - ++first1; - } - - return first1; -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for last element that belongs to a second one -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -template -inline BidirectionalIterator1 -find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2 ) -{ - if( first1 == last1 || first2 == last2 ) - return last1; - - BidirectionalIterator1 it1 = last1; - while( --it1 != first1 && std::find( first2, last2, *it1 ) == last2 ) {} - - return it1 == first1 && std::find( first2, last2, *it1 ) == last2 ? last1 : it1; -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for last element that satisfy binary -/// predicate in conjunction will at least one element in second collection -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -/// @param pred - predicate to be used for search -template -inline BidirectionalIterator1 -find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - Predicate pred ) -{ - if( first1 == last1 || first2 == last2 ) - return last1; - - BidirectionalIterator1 it1 = last1; - while( --it1 != first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ) {} - - return it1 == first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ? last1 : it1; -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for last element that does not belong to a second one -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -template -inline BidirectionalIterator1 -find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2 ) -{ - if( first1 == last1 || first2 == last2 ) - return last1; - - BidirectionalIterator1 it1 = last1; - while( --it1 != first1 && std::find( first2, last2, *it1 ) != last2 ) {} - - return it1 == first1 && std::find( first2, last2, *it1 ) != last2 ? last1 : it1; -} - -//____________________________________________________________________________// - -/// @brief this algorithm search through first collection for last element that does not satisfy binary -/// predicate in conjunction will any element in second collection -/// -/// @param first1 - first collection begin iterator -/// @param last1 - first collection end iterator -/// @param first2 - second collection begin iterator -/// @param last2 - second collection end iterator -/// @param pred - predicate to be used for search -template -inline BidirectionalIterator1 -find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - Predicate pred ) -{ - if( first1 == last1 || first2 == last2 ) - return last1; - - BidirectionalIterator1 it1 = last1; - while( --it1 != first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) != last2 ) {} - - return it1 == first1 && std::find_if( first2, last2, BOOST_TEST_BIND1ST( pred, *it1 ) ) == last2 ? last1 : it1; -} - -//____________________________________________________________________________// - - -/// @brief This algorithm replaces all occurrences of a set of substrings by another substrings -/// -/// @param str - string of operation -/// @param first1 - iterator to the beginning of the substrings to replace -/// @param last1 - iterator to the end of the substrings to replace -/// @param first2 - iterator to the beginning of the substrings to replace with -/// @param last2 - iterator to the end of the substrings to replace with -template -inline StringClass -replace_all_occurrences_of( StringClass str, - ForwardIterator first1, ForwardIterator last1, - ForwardIterator first2, ForwardIterator last2) -{ - for(; first1 != last1 && first2 != last2; ++first1, ++first2) { - std::size_t found = str.find( *first1 ); - while( found != StringClass::npos ) { - str.replace(found, first1->size(), *first2 ); - found = str.find( *first1, found + first2->size() ); - } - } - - return str; -} - -/// @brief This algorithm replaces all occurrences of a string with basic wildcards -/// with another (optionally containing wildcards as well). -/// -/// @param str - string to transform -/// @param it_string_to_find - iterator to the beginning of the substrings to replace -/// @param it_string_to_find_end - iterator to the end of the substrings to replace -/// @param it_string_to_replace - iterator to the beginning of the substrings to replace with -/// @param it_string_to_replace_end - iterator to the end of the substrings to replace with -/// -/// The wildcard is the symbol '*'. Only a unique wildcard per string is supported. The replacement -/// string may also contain a wildcard, in which case it is considered as a placeholder to the content -/// of the wildcard in the source string. -/// Example: -/// - In order to replace the occurrences of @c 'time=\"some-variable-value\"' to a constant string, -/// one may use @c 'time=\"*\"' as the string to search for, and 'time=\"0.0\"' as the replacement string. -/// - In order to replace the occurrences of 'file.cpp(XX)' per 'file.cpp:XX', where XX is a variable to keep, -/// on may use @c 'file.cpp(*)' as the string to search for, and 'file.cpp:*' as the replacement string. -template -inline StringClass -replace_all_occurrences_with_wildcards( - StringClass str, - ForwardIterator it_string_to_find, ForwardIterator it_string_to_find_end, - ForwardIterator it_string_to_replace, ForwardIterator it_string_to_replace_end) -{ - for(; it_string_to_find != it_string_to_find_end && it_string_to_replace != it_string_to_replace_end; - ++it_string_to_find, ++ it_string_to_replace) { - - std::size_t wildcard_pos = it_string_to_find->find("*"); - if(wildcard_pos == StringClass::npos) { - ForwardIterator it_to_find_current_end(it_string_to_find); - ForwardIterator it_to_replace_current_end(it_string_to_replace); - str = replace_all_occurrences_of( - str, - it_string_to_find, ++it_to_find_current_end, - it_string_to_replace, ++it_to_replace_current_end); - continue; - } - - std::size_t wildcard_pos_replace = it_string_to_replace->find("*"); - - std::size_t found_begin = str.find( it_string_to_find->substr(0, wildcard_pos) ); - while( found_begin != StringClass::npos ) { - std::size_t found_end = str.find(it_string_to_find->substr(wildcard_pos+1), found_begin + wildcard_pos + 1); // to simplify - if( found_end != StringClass::npos ) { - - if( wildcard_pos_replace == StringClass::npos ) { - StringClass replace_content = *it_string_to_replace; - str.replace( - found_begin, - found_end + (it_string_to_find->size() - wildcard_pos - 1 ) - found_begin, - replace_content); - } else { - StringClass replace_content = - it_string_to_replace->substr(0, wildcard_pos_replace) - + str.substr(found_begin + wildcard_pos, - found_end - found_begin - wildcard_pos) - + it_string_to_replace->substr(wildcard_pos_replace+1) ; - str.replace( - found_begin, - found_end + (it_string_to_find->size() - wildcard_pos - 1 ) - found_begin, - replace_content); - - } - } - - // may adapt the restart to the replacement and be more efficient - found_begin = str.find( it_string_to_find->substr(0, wildcard_pos), found_begin + 1 ); - } - } - - return str; -} - -} // namespace utils -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_ALGORITHM_HPP diff --git a/libraries/boost/include/boost/test/utils/assign_op.hpp b/libraries/boost/include/boost/test/utils/assign_op.hpp deleted file mode 100644 index 89d8bfa956..0000000000 --- a/libraries/boost/include/boost/test/utils/assign_op.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : overloadable assignment -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_ASSIGN_OP_HPP -#define BOOST_TEST_UTILS_ASSIGN_OP_HPP - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** generic assign operator ************** // -// ************************************************************************** // - -// generic -template -inline void -assign_op( T& t, S const& s, long ) -{ - t = s; -} - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - -#endif // BOOST_TEST_UTILS_ASSIGN_OP_HPP - diff --git a/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring.hpp b/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring.hpp deleted file mode 100644 index cec0214b73..0000000000 --- a/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring.hpp +++ /dev/null @@ -1,749 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : class basic_cstring wraps C string and provide std_string like -// interface -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_HPP -#define BOOST_TEST_UTILS_BASIC_CSTRING_HPP - -// Boost.Test -#include -#include - -// Boost -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { - -namespace unit_test { - -// ************************************************************************** // -// ************** basic_cstring ************** // -// ************************************************************************** // - -template -class basic_cstring { - typedef basic_cstring self_type; -public: - // Subtypes - typedef ut_detail::bcs_char_traits traits_type; - typedef typename traits_type::std_string std_string; - - typedef CharT value_type; - typedef typename remove_cv::type value_ret_type; - typedef value_type* pointer; - typedef value_type const* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - - typedef value_type const* const_iterator; - typedef value_type* iterator; - - // !! should also present reverse_iterator, const_reverse_iterator - -#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) && !defined(__DCC__) - BOOST_STATIC_CONSTANT(size_type, npos = static_cast(-1)); -#else - // IBM/VisualAge version 6 is not able to handle enums larger than 4 bytes. - // But size_type is 8 bytes in 64bit mode. - static const size_type npos = -1 ; -#endif - - static pointer null_str(); - - // Constructors; default copy constructor is generated by compiler - basic_cstring(); - basic_cstring( basic_cstring const & ); - basic_cstring( std_string const& s ); - basic_cstring( pointer s ); - template - basic_cstring( pointer s, LenType len ) : m_begin( s ), m_end( m_begin + len ) {} - basic_cstring( pointer first, pointer last ); - - // data access methods - value_ret_type operator[]( size_type index ) const; - value_ret_type at( size_type index ) const; - - // size operators - size_type size() const; - bool is_empty() const; - void clear(); - void resize( size_type new_len ); - - // !! only for STL container conformance use is_empty instead - bool empty() const; - - // Trimming - self_type& trim_right( size_type trim_size ); - self_type& trim_left( size_type trim_size ); - self_type& trim_right( iterator it ); - self_type& trim_left( iterator it ); -#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(800)) - self_type& trim_left( self_type exclusions = self_type() ) ; - self_type& trim_right( self_type exclusions = self_type() ) ; - self_type& trim( self_type exclusions = self_type() ) ; -#else - // VA C++/XL C++ v6 and v8 has in this case a problem with the default arguments. - self_type& trim_left( self_type exclusions ); - self_type& trim_right( self_type exclusions ); - self_type& trim( self_type exclusions ); - self_type& trim_left() { return trim_left( self_type() ); } - self_type& trim_right() { return trim_right( self_type() ); } - self_type& trim() { return trim( self_type() ); } -#endif - - // Assignment operators - basic_cstring& operator=( self_type const& s ); - basic_cstring& operator=( std_string const& s ); - basic_cstring& operator=( pointer s ); - - template - basic_cstring& assign( basic_cstring const& s ) - { - return *this = basic_cstring( s.begin(), s.end() ); - } - template - basic_cstring& assign( self_type const& s, PosType pos, LenType len ) - { - return *this = self_type( s.m_begin + pos, len ); - } - - basic_cstring& assign( std_string const& s ); - template - basic_cstring& assign( std_string const& s, PosType pos, LenType len ) - { - return *this = self_type( s.c_str() + pos, len ); - } - basic_cstring& assign( pointer s ); - template - basic_cstring& assign( pointer s, LenType len ) - { - return *this = self_type( s, len ); - } - basic_cstring& assign( pointer f, pointer l ); - - // swapping - void swap( self_type& s ); - - // Iterators - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; - - // !! should have rbegin, rend - - // substring search operation - size_type find( basic_cstring ) const; - size_type rfind( basic_cstring ) const; - self_type substr( size_type beg_index, size_type end_index = npos ) const; - -private: - static self_type default_trim_ex(); - - // Data members - iterator m_begin; - iterator m_end; -}; - -//____________________________________________________________________________// - -template -inline typename basic_cstring::pointer -basic_cstring::null_str() -{ - static CharT null = 0; - return &null; -} - -//____________________________________________________________________________// - -template -inline -basic_cstring::basic_cstring() -: m_begin( null_str() ) -, m_end( m_begin ) -{ -} - -//____________________________________________________________________________// - -template -inline -basic_cstring::basic_cstring(basic_cstring const & s) -: m_begin( s.m_begin ) -, m_end( s.m_end ) -{ -} - -//____________________________________________________________________________// - -template -inline -basic_cstring::basic_cstring( std_string const& s ) -: m_begin( s.c_str() ) -, m_end( m_begin + s.size() ) -{ -} - -//____________________________________________________________________________// - -template -inline -basic_cstring::basic_cstring( pointer s ) -: m_begin( s ? s : null_str() ) -, m_end ( m_begin + (s ? traits_type::length( s ) : 0 ) ) -{ -} - -//____________________________________________________________________________// - -template -inline -basic_cstring::basic_cstring( pointer first, pointer last ) -: m_begin( first ) -, m_end( last ) -{ -} - -//____________________________________________________________________________// - -template -inline typename basic_cstring::value_ret_type -basic_cstring::operator[]( size_type index ) const -{ - return m_begin[index]; -} - -//____________________________________________________________________________// - -template -inline typename basic_cstring::value_ret_type -basic_cstring::at( size_type index ) const -{ - if( m_begin + index >= m_end ) - return static_cast(0); - - return m_begin[index]; -} - -//____________________________________________________________________________// - -template -inline typename basic_cstring::size_type -basic_cstring::size() const -{ - return static_cast(m_end - m_begin); -} - -//____________________________________________________________________________// - -template -inline bool -basic_cstring::is_empty() const -{ - return m_end == m_begin; -} - -//____________________________________________________________________________// - -template -inline bool -basic_cstring::empty() const -{ - return is_empty(); -} - -//____________________________________________________________________________// - -template -inline void -basic_cstring::clear() -{ - m_begin = m_end; -} - -//____________________________________________________________________________// - -template -inline void -basic_cstring::resize( size_type new_len ) -{ - if( m_begin + new_len < m_end ) - m_end = m_begin + new_len; -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::trim_left( size_type trim_size ) -{ - m_begin += trim_size; - if( m_end <= m_begin ) - clear(); - - return *this; -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::trim_left( iterator it ) -{ - m_begin = it; - if( m_end <= m_begin ) - clear(); - - return *this; -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::trim_left( basic_cstring exclusions ) -{ - if( exclusions.is_empty() ) - exclusions = default_trim_ex(); - - iterator it; - for( it = begin(); it != end(); ++it ) { - if( traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast(0) ) - break; - } - - return trim_left( it ); -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::trim_right( size_type trim_size ) -{ - m_end -= trim_size; - if( m_end <= m_begin ) - clear(); - - return *this; -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::trim_right( iterator it ) -{ - m_end = it; - if( m_end <= m_begin ) - clear(); - - return *this; -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::trim_right( basic_cstring exclusions ) -{ - if( exclusions.is_empty() ) - exclusions = default_trim_ex(); - - iterator it; - - for( it = end()-1; it != begin()-1; --it ) { - if( self_type::traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast(0) ) - break; - } - - return trim_right( it+1 ); -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::trim( basic_cstring exclusions ) -{ - trim_left( exclusions ); - trim_right( exclusions ); - - return *this; -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::operator=( basic_cstring const& s ) -{ - m_begin = s.m_begin; - m_end = s.m_end; - - return *this; -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::operator=( std_string const& s ) -{ - return *this = self_type( s ); -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::operator=( pointer s ) -{ - return *this = self_type( s ); -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::assign( std_string const& s ) -{ - return *this = self_type( s ); -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::assign( pointer s ) -{ - return *this = self_type( s ); -} - -//____________________________________________________________________________// - -template -inline basic_cstring& -basic_cstring::assign( pointer f, pointer l ) -{ - return *this = self_type( f, l ); -} - -//____________________________________________________________________________// - -template -inline void -basic_cstring::swap( basic_cstring& s ) -{ - // do not want to include alogrithm - pointer tmp1 = m_begin; - pointer tmp2 = m_end; - - m_begin = s.m_begin; - m_end = s.m_end; - - s.m_begin = tmp1; - s.m_end = tmp2; -} - -//____________________________________________________________________________// - -template -inline typename basic_cstring::iterator -basic_cstring::begin() -{ - return m_begin; -} - -//____________________________________________________________________________// - -template -inline typename basic_cstring::const_iterator -basic_cstring::begin() const -{ - return m_begin; -} - -//____________________________________________________________________________// - -template -inline typename basic_cstring::iterator -basic_cstring::end() -{ - return m_end; -} - -//____________________________________________________________________________// - -template -inline typename basic_cstring::const_iterator -basic_cstring::end() const -{ - return m_end; -} - -//____________________________________________________________________________// - -template -inline typename basic_cstring::size_type -basic_cstring::find( basic_cstring str ) const -{ - if( str.is_empty() || str.size() > size() ) - return static_cast(npos); - - const_iterator it = begin(); - const_iterator last = end() - str.size() + 1; - - while( it != last ) { - if( traits_type::compare( it, str.begin(), str.size() ) == 0 ) - break; - - ++it; - } - - return it == last ? npos : static_cast(it - begin()); -} - -//____________________________________________________________________________// - -template -inline typename basic_cstring::size_type -basic_cstring::rfind( basic_cstring str ) const -{ - if( str.is_empty() || str.size() > size() ) - return static_cast(npos); - - const_iterator it = end() - str.size(); - const_iterator last = begin()-1; - - while( it != last ) { - if( traits_type::compare( it, str.begin(), str.size() ) == 0 ) - break; - - --it; - } - - return it == last ? static_cast(npos) : static_cast(it - begin()); -} - -//____________________________________________________________________________// - -template -inline basic_cstring -basic_cstring::substr( size_type beg_index, size_type end_index ) const -{ - return beg_index > size() - ? self_type() - : end_index > size() - ? self_type( m_begin + beg_index, m_end ) - : self_type( m_begin + beg_index, m_begin + end_index ); -} - -//____________________________________________________________________________// - -template -inline basic_cstring -basic_cstring::default_trim_ex() -{ - static CharT ws[3] = { CharT(' '), CharT('\t'), CharT('\n') }; // !! wide case - - return self_type( ws, 3 ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** comparison operators ************** // -// ************************************************************************** // - -template -inline bool -operator==( basic_cstring const& s1, basic_cstring const& s2 ) -{ - typedef typename basic_cstring::traits_type traits_type; - return s1.size() == s2.size() && - traits_type::compare( s1.begin(), s2.begin(), s1.size() ) == 0; -} - -//____________________________________________________________________________// - -template -inline bool -operator==( basic_cstring const& s1, CharT2* s2 ) -{ -#if !defined(__DMC__) - return s1 == basic_cstring( s2 ); -#else - return s1 == basic_cstring( s2 ); -#endif -} - -//____________________________________________________________________________// - -template -inline bool -operator==( basic_cstring const& s1, typename basic_cstring::std_string const& s2 ) -{ - return s1 == basic_cstring( s2 ); -} - -//____________________________________________________________________________// - -template -inline bool -operator==( CharT1* s2, basic_cstring const& s1 ) -{ - return s1 == s2; -} - -//____________________________________________________________________________// - -template -inline bool -operator==( typename basic_cstring::std_string const& s2, basic_cstring const& s1 ) -{ - return s1 == s2; -} - -//____________________________________________________________________________// - -template -inline bool -operator!=( basic_cstring const& s1, CharT* s2 ) -{ - return !(s1 == s2); -} - -//____________________________________________________________________________// - -template -inline bool -operator!=( CharT* s2, basic_cstring const& s1 ) -{ - return !(s1 == s2); -} - -//____________________________________________________________________________// - -template -inline bool -operator!=( basic_cstring const& s1, basic_cstring const& s2 ) -{ - return !(s1 == s2); -} - -//____________________________________________________________________________// - -template -inline bool -operator!=( basic_cstring const& s1, typename basic_cstring::std_string const& s2 ) -{ - return !(s1 == s2); -} - -//____________________________________________________________________________// - -template -inline bool -operator!=( typename basic_cstring::std_string const& s2, basic_cstring const& s1 ) -{ - return !(s1 == s2); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** first_char ************** // -// ************************************************************************** // - -template -inline typename basic_cstring::value_ret_type -first_char( basic_cstring source ) -{ - typedef typename basic_cstring::value_ret_type res_type; - - return source.is_empty() ? static_cast(0) : *source.begin(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** last_char ************** // -// ************************************************************************** // - -template -inline typename basic_cstring::value_ret_type -last_char( basic_cstring source ) -{ - typedef typename basic_cstring::value_ret_type res_type; - - return source.is_empty() ? static_cast(0) : *(source.end()-1); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** assign_op ************** // -// ************************************************************************** // - -template -inline void -assign_op( std::basic_string& target, basic_cstring src, int ) -{ - target.assign( src.begin(), src.size() ); -} - -//____________________________________________________________________________// - -template -inline std::basic_string& -operator+=( std::basic_string& target, basic_cstring const& str ) -{ - target.append( str.begin(), str.end() ); - return target; -} - -//____________________________________________________________________________// - -template -inline std::basic_string -operator+( std::basic_string const& lhs, basic_cstring const& rhs ) -{ - std::basic_string res( lhs ); - - res.append( rhs.begin(), rhs.end() ); - return res; -} - -//____________________________________________________________________________// - -} // namespace unit_test - -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_UTILS_BASIC_CSTRING_HPP diff --git a/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp b/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp deleted file mode 100644 index f0622263d1..0000000000 --- a/libraries/boost/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : basic_cstring class wrap C string and provide std_string like -// interface -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP -#define BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP - -#include - -namespace boost { - -namespace unit_test { - -template class basic_cstring; -typedef basic_cstring const_string; -#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590041)) -typedef const_string literal_string; -#else -typedef const_string const literal_string; -#endif - -typedef char const* const c_literal_string; - -} // namespace unit_test - -} // namespace boost - -#endif // BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP - diff --git a/libraries/boost/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp b/libraries/boost/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp deleted file mode 100644 index eb77f474c7..0000000000 --- a/libraries/boost/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp +++ /dev/null @@ -1,150 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : generic char traits class; wraps std::char_traits -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP -#define BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP - -// Boost -#include -#include -#include -#include - -// STL -#include // std::char_traits -#include // std::size_t - -#include - -//____________________________________________________________________________// - -namespace boost { - -namespace unit_test { - -namespace ut_detail { - -template struct bcs_base_char { typedef CharT type; }; - -template<> struct bcs_base_char { typedef char type; }; -template<> struct bcs_base_char { typedef char type; }; -#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) -template<> struct bcs_base_char { typedef char type; }; -#endif - -template<> struct bcs_base_char { typedef wchar_t type; }; - -// ************************************************************************** // -// ************** bcs_char_traits ************** // -// ************************************************************************** // - -template -struct bcs_char_traits_impl -{ -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - typedef CharT const const_char; -#else - typedef typename boost::add_const::type const_char; -#endif - static bool eq( CharT c1, CharT c2 ) - { - return c1 == c2; - } - static bool lt( CharT c1, CharT c2 ) - { - return c1 < c2; - } - - static int compare( const_char* cstr1, const_char* cstr2, std::size_t n ) - { - while( n > 0 ) { - if( !eq( *cstr1, *cstr2 ) ) - return lt( *cstr1, *cstr2 ) ? -1 : 1; - ++cstr1; - ++cstr2; - --n; - } - - return 0; - } - - static std::size_t length( const_char* cstr ) - { - const_char null_char = CharT(); - - const_char* ptr = cstr; - while( !eq( *ptr, null_char ) ) - ++ptr; - - return ptr - cstr; - } - - static const_char* find( const_char* s, std::size_t n, CharT c ) - { - while( n > 0 ) { - if( eq( *s, c ) ) - return s; - - ++s; - --n; - } - return 0; - } -}; - -#ifdef BOOST_CLASSIC_IOSTREAMS -template -struct char_traits_with_find : std::string_char_traits { - static CharT const* find( CharT const* s, std::size_t n, CharT c ) - { - while( n > 0 ) { - if( eq( *s, c ) ) - return s; - - ++s; - --n; - } - return 0; - } -}; - -template<> struct bcs_char_traits_impl : public char_traits_with_find {}; -template<> struct bcs_char_traits_impl : public char_traits_with_find {}; -#else -template<> struct bcs_char_traits_impl : public std::char_traits {}; -template<> struct bcs_char_traits_impl : public std::char_traits {}; -#endif - -template -class bcs_char_traits : public bcs_char_traits_impl { - typedef typename ut_detail::bcs_base_char::type the_base_char; -public: -#ifdef BOOST_CLASSIC_IOSTREAMS - typedef std::basic_string > std_string; -#else - typedef std::basic_string > std_string; -#endif -}; - -} // namespace ut_detail - -} // namespace unit_test - -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP diff --git a/libraries/boost/include/boost/test/utils/basic_cstring/compare.hpp b/libraries/boost/include/boost/test/utils/basic_cstring/compare.hpp deleted file mode 100644 index 2a256fc6be..0000000000 --- a/libraries/boost/include/boost/test/utils/basic_cstring/compare.hpp +++ /dev/null @@ -1,151 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : class basic_cstring comparisons implementation -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP -#define BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP - -// Boost.Test -#include - -// STL -#include -#include - -#include - -//____________________________________________________________________________// - -# if defined(BOOST_NO_STDC_NAMESPACE) && !BOOST_WORKAROUND(__BORLANDC__, <= 0x570) -namespace std { using ::toupper; } -# endif - -namespace boost { - -namespace unit_test { - -// ************************************************************************** // -// ************** case_ins_compare ************** // -// ************************************************************************** // - -namespace ut_detail { - -template -struct case_ins -{ - static bool eq( CharT c1, CharT c2 ) { return (std::toupper)( c1 ) == (std::toupper)( c2 ); } - static bool lt( CharT c1, CharT c2 ) { return (std::toupper)( c1 ) < (std::toupper)( c2 ); } - - static int compare( CharT const* s1, CharT const* s2, std::size_t n ) - { - for( std::size_t i = 0; i < n; ++i ) { - if( !eq( s1[i], s2[i] ) ) - return lt( s1[i], s2[i] ) ? -1 : 1; - } - return 0; - } -}; - -} // namespace ut_detail - -// ************************************************************************** // -// ************** case_ins_eq ************** // -// ************************************************************************** // - -template -inline bool -case_ins_eq( basic_cstring x, basic_cstring y ) -{ - return x.size() == y.size() && ut_detail::case_ins::compare( x.begin(), y.begin(), x.size() ) == 0; -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** case_ins_less ************** // -// ************************************************************************** // - -template -class case_ins_less -{ -public: - typedef bool result_type; - typedef basic_cstring first_argument_type; - typedef basic_cstring second_argument_type; - - bool operator()( basic_cstring x, basic_cstring y ) const - { - return x.size() != y.size() - ? x.size() < y.size() - : ut_detail::case_ins::compare( x.begin(), y.begin(), x.size() ) < 0; - } -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** operators <,> ************** // -// ************************************************************************** // - -template -inline bool -operator <( boost::unit_test::basic_cstring const& x, - boost::unit_test::basic_cstring const& y ) -{ - typedef typename boost::unit_test::basic_cstring::traits_type traits_type; - return x.size() != y.size() - ? x.size() < y.size() - : traits_type::compare( x.begin(), y.begin(), x.size() ) < 0; -} - -//____________________________________________________________________________// - -template -inline bool -operator <=( boost::unit_test::basic_cstring const& x, - boost::unit_test::basic_cstring const& y ) -{ - return !(y < x); -} - -//____________________________________________________________________________// - -template -inline bool -operator >( boost::unit_test::basic_cstring const& x, - boost::unit_test::basic_cstring const& y ) -{ - return y < x; -} - -//____________________________________________________________________________// - -template -inline bool -operator >=( boost::unit_test::basic_cstring const& x, - boost::unit_test::basic_cstring const& y ) -{ - return !(x < y); -} - -//____________________________________________________________________________// - -} // namespace unit_test - -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_BASIC_CSTRING_COMPARE_HPP_071894GER diff --git a/libraries/boost/include/boost/test/utils/basic_cstring/io.hpp b/libraries/boost/include/boost/test/utils/basic_cstring/io.hpp deleted file mode 100644 index 02ccb126f8..0000000000 --- a/libraries/boost/include/boost/test/utils/basic_cstring/io.hpp +++ /dev/null @@ -1,73 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : basic_cstring i/o implementation -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_IO_HPP -#define BOOST_TEST_UTILS_BASIC_CSTRING_IO_HPP - -// Boost.Test -#include - -// STL -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { - -namespace unit_test { - -#ifdef BOOST_CLASSIC_IOSTREAMS - -template -inline std::ostream& -operator<<( std::ostream& os, basic_cstring const& str ) -{ - typedef typename ut_detail::bcs_base_char::type char_type; - char_type const* const beg = reinterpret_cast( str.begin() ); - char_type const* const end = reinterpret_cast( str.end() ); - os << std::basic_string( beg, end - beg ); - - return os; -} - -#else - -template -inline std::basic_ostream& -operator<<( std::basic_ostream& os, basic_cstring const& str ) -{ - CharT1 const* const beg = reinterpret_cast( str.begin() ); // !! - CharT1 const* const end = reinterpret_cast( str.end() ); - os << std::basic_string( beg, end - beg ); - - return os; -} - -#endif - -//____________________________________________________________________________// - - -} // namespace unit_test - -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER diff --git a/libraries/boost/include/boost/test/utils/class_properties.hpp b/libraries/boost/include/boost/test/utils/class_properties.hpp deleted file mode 100644 index d4f3db3f2d..0000000000 --- a/libraries/boost/include/boost/test/utils/class_properties.hpp +++ /dev/null @@ -1,195 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : simple facility that mimmic notion of read-only read-write -// properties in C++ classes. Original idea by Henrik Ravn. -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP -#define BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP - -// Boost.Test -#include - -// Boost -#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) -#include -#endif -#include -#include -#include -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** class_property ************** // -// ************************************************************************** // - -template -class class_property { -protected: - typedef typename call_traits::const_reference read_access_t; - typedef typename call_traits::param_type write_param_t; - typedef typename add_pointer::type>::type address_res_t; -public: - // Constructor - class_property() : value( PropertyType() ) {} - explicit class_property( write_param_t init_value ) - : value( init_value ) {} - - // Access methods - operator read_access_t() const { return value; } - read_access_t get() const { return value; } - bool operator!() const { return !value; } - address_res_t operator&() const { return &value; } - - // Data members -#ifndef BOOST_TEST_NO_PROTECTED_USING -protected: -#endif - PropertyType value; -}; - -//____________________________________________________________________________// - -#ifdef BOOST_CLASSIC_IOSTREAMS - -template -inline std::ostream& -operator<<( std::ostream& os, class_property const& p ) - -#else - -template -inline std::basic_ostream& -operator<<( std::basic_ostream& os, class_property const& p ) - -#endif -{ - return os << p.get(); -} - -//____________________________________________________________________________// - -#define DEFINE_PROPERTY_FREE_BINARY_OPERATOR( op ) \ -template \ -inline bool \ -operator op( PropertyType const& lhs, class_property const& rhs ) \ -{ \ - return lhs op rhs.get(); \ -} \ -template \ -inline bool \ -operator op( class_property const& lhs, PropertyType const& rhs ) \ -{ \ - return lhs.get() op rhs; \ -} \ -template \ -inline bool \ -operator op( class_property const& lhs, \ - class_property const& rhs ) \ -{ \ - return lhs.get() op rhs.get(); \ -} \ -/**/ - -DEFINE_PROPERTY_FREE_BINARY_OPERATOR( == ) -DEFINE_PROPERTY_FREE_BINARY_OPERATOR( != ) - -#undef DEFINE_PROPERTY_FREE_BINARY_OPERATOR - -// ************************************************************************** // -// ************** readonly_property ************** // -// ************************************************************************** // - -template -class readonly_property : public class_property { - typedef class_property base_prop; - typedef typename base_prop::address_res_t arrow_res_t; -protected: - typedef typename base_prop::write_param_t write_param_t; -public: - // Constructor - readonly_property() {} - explicit readonly_property( write_param_t init_value ) : base_prop( init_value ) {} - - // access methods - arrow_res_t operator->() const { return boost::addressof( base_prop::value ); } -}; - -//____________________________________________________________________________// - -#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) - -#define BOOST_READONLY_PROPERTY( property_type, friends ) boost::unit_test::readwrite_property - -#else - -#define BOOST_READONLY_PROPERTY_DECLARE_FRIEND(r, data, elem) friend class elem; - -#define BOOST_READONLY_PROPERTY( property_type, friends ) \ -class BOOST_JOIN( readonly_property, __LINE__ ) \ -: public boost::unit_test::readonly_property { \ - typedef boost::unit_test::readonly_property base_prop; \ - BOOST_PP_SEQ_FOR_EACH( BOOST_READONLY_PROPERTY_DECLARE_FRIEND, ' ', friends ) \ - typedef base_prop::write_param_t write_param_t; \ -public: \ - BOOST_JOIN( readonly_property, __LINE__ )() {} \ - explicit BOOST_JOIN( readonly_property, __LINE__ )( write_param_t init_v ) \ - : base_prop( init_v ) {} \ -} \ -/**/ - -#endif - -// ************************************************************************** // -// ************** readwrite_property ************** // -// ************************************************************************** // - -template -class readwrite_property : public class_property { - typedef class_property base_prop; - typedef typename add_pointer::type arrow_res_t; - typedef typename base_prop::address_res_t const_arrow_res_t; - typedef typename base_prop::write_param_t write_param_t; -public: - readwrite_property() : base_prop() {} - explicit readwrite_property( write_param_t init_value ) : base_prop( init_value ) {} - - // access methods - void set( write_param_t v ) { base_prop::value = v; } - arrow_res_t operator->() { return boost::addressof( base_prop::value ); } - const_arrow_res_t operator->() const { return boost::addressof( base_prop::value ); } - -#ifndef BOOST_TEST_NO_PROTECTED_USING - using base_prop::value; -#endif -}; - -//____________________________________________________________________________// - -} // unit_test -} // namespace boost - -#include - -#undef BOOST_TEST_NO_PROTECTED_USING - -#endif // BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP diff --git a/libraries/boost/include/boost/test/utils/custom_manip.hpp b/libraries/boost/include/boost/test/utils/custom_manip.hpp deleted file mode 100644 index d5ddaf5c07..0000000000 --- a/libraries/boost/include/boost/test/utils/custom_manip.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : simple helpers for creating cusom output manipulators -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_CUSTOM_MANIP_HPP -#define BOOST_TEST_UTILS_CUSTOM_MANIP_HPP - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** custom manipulators helpers ************** // -// ************************************************************************** // - -template -struct custom_printer { - explicit custom_printer( std::ostream& ostr ) : m_ostr( &ostr ) {} - - std::ostream& operator*() const { return *m_ostr; } - -private: - std::ostream* const m_ostr; -}; - -//____________________________________________________________________________// - -template struct custom_manip {}; - -//____________________________________________________________________________// - -template -inline custom_printer > -operator<<( std::ostream& ostr, custom_manip const& ) { return custom_printer >( ostr ); } - -//____________________________________________________________________________// - -} // namespace utils -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_CUSTOM_MANIP_HPP diff --git a/libraries/boost/include/boost/test/utils/foreach.hpp b/libraries/boost/include/boost/test/utils/foreach.hpp deleted file mode 100644 index 68462ae719..0000000000 --- a/libraries/boost/include/boost/test/utils/foreach.hpp +++ /dev/null @@ -1,316 +0,0 @@ -// (C) Copyright Eric Niebler 2004-2005 -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : this is an abridged version of an excelent BOOST_FOREACH facility -// presented by Eric Niebler. I am so fond of it so I can't wait till it -// going to be accepted into Boost. Also I need version with less number of dependencies -// and more portable. This version doesn't support rvalues and will reeveluate it's -// parameters, but should be good enough for my purposes. -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_FOREACH_HPP -#define BOOST_TEST_UTILS_FOREACH_HPP - -// Boost.Test -#include - -// Boost -#include -#include -#include - -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace for_each { - -// ************************************************************************** // -// ************** static_any ************** // -// ************************************************************************** // - -struct static_any_base -{ - operator bool() const { return false; } -}; - -//____________________________________________________________________________// - -template -struct static_any : static_any_base -{ - static_any( Iter const& t ) : m_it( t ) {} - - mutable Iter m_it; -}; - -//____________________________________________________________________________// - -typedef static_any_base const& static_any_t; - -//____________________________________________________________________________// - -template -inline Iter& -static_any_cast( static_any_t a, Iter* = 0 ) -{ - return static_cast( static_cast const&>( a ).m_it ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** is_const ************** // -// ************************************************************************** // - -template -inline is_const -is_const_coll( C& ) -{ - return is_const(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** begin ************** // -// ************************************************************************** // - -template -inline static_any -begin( C& t, mpl::false_ ) -{ - return static_any( t.begin() ); -} - -//____________________________________________________________________________// - -template -inline static_any -begin( C const& t, mpl::true_ ) -{ - return static_any( t.begin() ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** end ************** // -// ************************************************************************** // - -template -inline static_any -end( C& t, mpl::false_ ) -{ - return static_any( t.end() ); -} - -//____________________________________________________________________________// - -template -inline static_any -end( C const& t, mpl::true_ ) -{ - return static_any( t.end() ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** done ************** // -// ************************************************************************** // - -template -inline bool -done( static_any_t cur, static_any_t end, C&, mpl::false_ ) -{ - return static_any_cast( cur ) == - static_any_cast( end ); -} - -//____________________________________________________________________________// - -template -inline bool -done( static_any_t cur, static_any_t end, C const&, mpl::true_ ) -{ - return static_any_cast( cur ) == - static_any_cast( end ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** next ************** // -// ************************************************************************** // - -template -inline void -next( static_any_t cur, C&, mpl::false_ ) -{ - ++static_any_cast( cur ); -} - -//____________________________________________________________________________// - -template -inline void -next( static_any_t cur, C const&, mpl::true_ ) -{ - ++static_any_cast( cur ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** prev ************** // -// ************************************************************************** // - -template -inline void -prev( static_any_t cur, C&, mpl::false_ ) -{ - --static_any_cast( cur ); -} - -//____________________________________________________________________________// - -template -inline void -prev( static_any_t cur, C const&, mpl::true_ ) -{ - --static_any_cast( cur ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** deref ************** // -// ************************************************************************** // - -template -inline RefType -deref( static_any_t cur, C&, ::boost::type, mpl::false_ ) -{ - return *static_any_cast( cur ); -} - -//____________________________________________________________________________// - -template -inline RefType -deref( static_any_t cur, C const&, ::boost::type, mpl::true_ ) -{ - return *static_any_cast( cur ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** BOOST_TEST_FOREACH ************** // -// ************************************************************************** // - -#define BOOST_TEST_FE_ANY ::boost::unit_test::for_each::static_any_t -#define BOOST_TEST_FE_IS_CONST( COL ) ::boost::unit_test::for_each::is_const_coll( COL ) - -#define BOOST_TEST_FE_BEG( COL ) \ - ::boost::unit_test::for_each::begin( \ - COL, \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#define BOOST_TEST_FE_END( COL ) \ - ::boost::unit_test::for_each::end( \ - COL, \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#define BOOST_TEST_FE_DONE( COL ) \ - ::boost::unit_test::for_each::done( \ - BOOST_TEST_FE_CUR_VAR, \ - BOOST_TEST_FE_END_VAR, \ - COL, \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#define BOOST_TEST_FE_NEXT( COL ) \ - ::boost::unit_test::for_each::next( \ - BOOST_TEST_FE_CUR_VAR, \ - COL, \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#define BOOST_TEST_FE_PREV( COL ) \ - ::boost::unit_test::for_each::prev( \ - BOOST_TEST_FE_CUR_VAR, \ - COL, \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#define BOOST_FOREACH_NOOP(COL) \ - ((void)&(COL)) - -#define BOOST_TEST_FE_DEREF( COL, RefType ) \ - ::boost::unit_test::for_each::deref( \ - BOOST_TEST_FE_CUR_VAR, \ - COL, \ - ::boost::type(), \ - BOOST_TEST_FE_IS_CONST( COL ) ) \ -/**/ - -#if BOOST_WORKAROUND( BOOST_MSVC, == 1310 ) -#define BOOST_TEST_LINE_NUM -#else -#define BOOST_TEST_LINE_NUM __LINE__ -#endif - -#define BOOST_TEST_FE_CUR_VAR BOOST_JOIN( _fe_cur_, BOOST_TEST_LINE_NUM ) -#define BOOST_TEST_FE_END_VAR BOOST_JOIN( _fe_end_, BOOST_TEST_LINE_NUM ) -#define BOOST_TEST_FE_CON_VAR BOOST_JOIN( _fe_con_, BOOST_TEST_LINE_NUM ) - -#define BOOST_TEST_FOREACH( RefType, var, COL ) \ -if( BOOST_TEST_FE_ANY BOOST_TEST_FE_CUR_VAR = BOOST_TEST_FE_BEG( COL ) ) {} else \ -if( BOOST_TEST_FE_ANY BOOST_TEST_FE_END_VAR = BOOST_TEST_FE_END( COL ) ) {} else \ -for( bool BOOST_TEST_FE_CON_VAR = true; \ - BOOST_TEST_FE_CON_VAR && !BOOST_TEST_FE_DONE( COL ); \ - BOOST_TEST_FE_CON_VAR ? BOOST_TEST_FE_NEXT( COL ) : BOOST_FOREACH_NOOP( COL )) \ - \ - if( (BOOST_TEST_FE_CON_VAR = false, false) ) {} else \ - for( RefType var = BOOST_TEST_FE_DEREF( COL, RefType ); \ - !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \ -/**/ - -#define BOOST_TEST_REVERSE_FOREACH( RefType, var, COL ) \ -if( BOOST_TEST_FE_ANY BOOST_TEST_FE_CUR_VAR = BOOST_TEST_FE_END( COL ) ) {} else \ -if( BOOST_TEST_FE_ANY BOOST_TEST_FE_END_VAR = BOOST_TEST_FE_BEG( COL ) ) {} else \ -for( bool BOOST_TEST_FE_CON_VAR = true; \ - BOOST_TEST_FE_CON_VAR && !BOOST_TEST_FE_DONE( COL ); ) \ - \ - if( (BOOST_TEST_FE_CON_VAR = false, false) ) {} else \ - if( (BOOST_TEST_FE_PREV( COL ), false) ) {} else \ - for( RefType var = BOOST_TEST_FE_DEREF( COL, RefType ); \ - !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \ -/**/ - -//____________________________________________________________________________// - -} // namespace for_each -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_FOREACH_HPP diff --git a/libraries/boost/include/boost/test/utils/is_cstring.hpp b/libraries/boost/include/boost/test/utils/is_cstring.hpp deleted file mode 100644 index 12326b0418..0000000000 --- a/libraries/boost/include/boost/test/utils/is_cstring.hpp +++ /dev/null @@ -1,116 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : defines the is_cstring type trait -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_IS_CSTRING_HPP -#define BOOST_TEST_UTILS_IS_CSTRING_HPP - -// Boost -#include -#include -#include -#include -#include -#include - -#include -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** is_cstring ************** // -// ************************************************************************** // - -namespace ut_detail { - -template -struct is_cstring_impl : public mpl::false_ {}; - -template -struct is_cstring_impl : public is_cstring_impl {}; - -template -struct is_cstring_impl : public is_cstring_impl {}; - -template<> -struct is_cstring_impl : public mpl::true_ {}; - -template<> -struct is_cstring_impl : public mpl::true_ {}; - -template ::type>::value > -struct deduce_cstring_impl; - -template -struct deduce_cstring_impl : public deduce_cstring_impl{}; - -template -struct deduce_cstring_impl : public deduce_cstring_impl{}; - -template -struct deduce_cstring_impl { - typedef typename boost::add_const< - typename boost::remove_pointer< - typename boost::decay::type - >::type - >::type U; - typedef boost::unit_test::basic_cstring type; -}; - -template -struct deduce_cstring_impl< T, false > { - typedef typename - boost::remove_const< - typename boost::remove_reference::type - >::type type; -}; - -template -struct deduce_cstring_impl< std::basic_string >, false > { - typedef boost::unit_test::basic_cstring::type> type; -}; - -} // namespace ut_detail - -template -struct is_cstring : public ut_detail::is_cstring_impl::type> {}; - -template::type>::value > -struct is_cstring_comparable: public mpl::false_ {}; - -template -struct is_cstring_comparable< T, true > : public mpl::true_ {}; - -template -struct is_cstring_comparable< std::basic_string >, false > : public mpl::true_ {}; - -template -struct is_cstring_comparable< boost::unit_test::basic_cstring, false > : public mpl::true_ {}; - -template -struct deduce_cstring { - typedef typename - boost::remove_const< - typename boost::remove_reference::type - >::type U; - typedef typename ut_detail::deduce_cstring_impl::type>::type type; -}; - -} // namespace unit_test -} // namespace boost - -#endif // BOOST_TEST_UTILS_IS_CSTRING_HPP diff --git a/libraries/boost/include/boost/test/utils/is_forward_iterable.hpp b/libraries/boost/include/boost/test/utils/is_forward_iterable.hpp deleted file mode 100644 index 1c9108054b..0000000000 --- a/libraries/boost/include/boost/test/utils/is_forward_iterable.hpp +++ /dev/null @@ -1,267 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//! @file -//! Defines the is_forward_iterable collection type trait -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP -#define BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP - -#if defined(BOOST_NO_CXX11_DECLTYPE) || \ - defined(BOOST_NO_CXX11_NULLPTR) || \ - defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) - - // this feature works with VC2012 upd 5 while BOOST_NO_CXX11_TRAILING_RESULT_TYPES is defined - #if !defined(BOOST_MSVC) || BOOST_MSVC_FULL_VER < 170061030 /* VC2012 upd 5 */ - #define BOOST_TEST_FWD_ITERABLE_CXX03 - #endif -#endif - -#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) -// Boost -#include - -// STL -#include -#include -#include -#include - -#else - -// Boost -#include -#include -#include -#include -#include -#include - -// STL -#include -#include - -#endif -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -template -struct is_forward_iterable; - -// ************************************************************************** // -// ************** is_forward_iterable ************** // -// ************************************************************************** // - -#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) && !defined(BOOST_TEST_DOXYGEN_DOC__) -template -struct is_forward_iterable : public mpl::false_ {}; - -template -struct is_forward_iterable : public is_forward_iterable {}; - -template -struct is_forward_iterable : public is_forward_iterable {}; - -template -struct is_forward_iterable< T [N] > : public mpl::true_ {}; - -template -struct is_forward_iterable< std::vector > : public mpl::true_ {}; - -template -struct is_forward_iterable< std::list > : public mpl::true_ {}; - -template -struct is_forward_iterable< std::map > : public mpl::true_ {}; - -template -struct is_forward_iterable< std::set > : public mpl::true_ {}; - -// string is also forward iterable, even if sometimes we want to treat the -// assertions differently. -template<> -struct is_forward_iterable< std::string > : public mpl::true_ {}; - -#else - -namespace ut_detail { - -// SFINAE helper -template -struct is_present : public mpl::true_ {}; - -//____________________________________________________________________________// - -// some compiler do not implement properly decltype non expression involving members (eg. VS2013) -// a workaround is to use -> decltype syntax. -template -struct has_member_size { -private: - struct nil_t {}; - template static auto test( U* ) -> decltype(boost::declval().size()); - template static nil_t test( ... ); - -public: - static bool const value = !std::is_same< decltype(test( nullptr )), nil_t>::value; -}; - -//____________________________________________________________________________// - -template -struct has_member_begin { -private: - struct nil_t {}; - template static auto test( U* ) -> decltype(std::begin(boost::declval())); // does not work with boost::begin - template static nil_t test( ... ); -public: - static bool const value = !std::is_same< decltype(test( nullptr )), nil_t>::value; -}; - -//____________________________________________________________________________// - -template -struct has_member_end { -private: - struct nil_t {}; - template static auto test( U* ) -> decltype(std::end(boost::declval())); // does not work with boost::end - template static nil_t test( ... ); -public: - static bool const value = !std::is_same< decltype(test( nullptr )), nil_t>::value; -}; - -//____________________________________________________________________________// - -template -struct is_forward_iterable_impl : std::false_type { -}; - -template -struct is_forward_iterable_impl< - T, - typename std::enable_if< - has_member_begin::value && - has_member_end::value - >::type -> : std::true_type -{}; - -//____________________________________________________________________________// - -template -struct is_container_forward_iterable_impl : std::false_type { -}; - -template -struct is_container_forward_iterable_impl< - T, - typename std::enable_if< - is_present::value && - is_present::value && - has_member_size::value && - is_forward_iterable_impl::value - >::type -> : is_forward_iterable_impl -{}; - -//____________________________________________________________________________// - -} // namespace ut_detail - -/*! Indicates that a specific type implements the forward iterable concept. */ -template -struct is_forward_iterable { - typedef typename std::remove_reference::type T_ref; - typedef ut_detail::is_forward_iterable_impl is_fwd_it_t; - typedef mpl::bool_ type; - enum { value = is_fwd_it_t::value }; -}; - -/*! Indicates that a specific type implements the forward iterable concept. */ -template -struct is_container_forward_iterable { - typedef typename std::remove_reference::type T_ref; - typedef ut_detail::is_container_forward_iterable_impl is_fwd_it_t; - typedef mpl::bool_ type; - enum { value = is_fwd_it_t::value }; -}; - -#endif /* defined(BOOST_TEST_FWD_ITERABLE_CXX03) */ - - -//! Helper structure for accessing the content of a container or an array -template ::value > -struct bt_iterator_traits; - -template -struct bt_iterator_traits< T, true >{ - BOOST_STATIC_ASSERT((is_forward_iterable::value)); - -#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) || \ - (defined(BOOST_MSVC) && (BOOST_MSVC_FULL_VER <= 170061030)) - typedef typename T::const_iterator const_iterator; - typedef typename std::iterator_traits::value_type value_type; -#else - typedef decltype(boost::declval< - typename boost::add_const< - typename boost::remove_reference::type - >::type>().begin()) const_iterator; - - typedef typename std::iterator_traits::value_type value_type; -#endif /* BOOST_TEST_FWD_ITERABLE_CXX03 */ - - static const_iterator begin(T const& container) { - return container.begin(); - } - static const_iterator end(T const& container) { - return container.end(); - } - -#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) || \ - (defined(BOOST_MSVC) && (BOOST_MSVC_FULL_VER <= 170061030)) - static std::size_t - size(T const& container) { - return container.size(); - } -#else - static std::size_t - size(T const& container) { - return size(container, - std::integral_constant::value>()); - } -private: - static std::size_t - size(T const& container, std::true_type) { return container.size(); } - - static std::size_t - size(T const& container, std::false_type) { return std::distance(begin(container), end(container)); } -#endif /* BOOST_TEST_FWD_ITERABLE_CXX03 */ -}; - -template -struct bt_iterator_traits< T [N], true > { - typedef typename boost::add_const::type T_const; - typedef typename boost::add_pointer::type const_iterator; - typedef T value_type; - - static const_iterator begin(T_const (&array)[N]) { - return &array[0]; - } - static const_iterator end(T_const (&array)[N]) { - return &array[N]; - } - static std::size_t size(T_const (&)[N]) { - return N; - } -}; - -} // namespace unit_test -} // namespace boost - -#endif // BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP diff --git a/libraries/boost/include/boost/test/utils/iterator/input_iterator_facade.hpp b/libraries/boost/include/boost/test/utils/iterator/input_iterator_facade.hpp deleted file mode 100644 index d695ee3a87..0000000000 --- a/libraries/boost/include/boost/test/utils/iterator/input_iterator_facade.hpp +++ /dev/null @@ -1,105 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//! Input iterator facade -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP -#define BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP - -// Boost -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** input_iterator_core_access ************** // -// ************************************************************************** // - -class input_iterator_core_access -{ -#if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) -public: -#else - template friend class input_iterator_facade; -#endif - - template - static bool get( Facade& f ) - { - return f.get(); - } - -private: - // objects of this class are useless - input_iterator_core_access(); //undefined -}; - -// ************************************************************************** // -// ************** input_iterator_facade ************** // -// ************************************************************************** // - -template -class input_iterator_facade : public iterator_facade -{ -public: - // Constructor - input_iterator_facade() : m_valid( false ), m_value() {} - -protected: // provide access to the Derived - void init() - { - m_valid = true; - increment(); - } - - // Data members - mutable bool m_valid; - ValueType m_value; - -private: - friend class boost::iterator_core_access; - - // iterator facade interface implementation - void increment() - { - // we make post-end incrementation indefinetly safe - if( m_valid ) - m_valid = input_iterator_core_access::get( *static_cast(this) ); - } - Reference dereference() const - { - return m_value; - } - - // iterator facade interface implementation - bool equal( input_iterator_facade const& rhs ) const - { - // two invalid iterator equals, inequal otherwise - return !m_valid && !rhs.m_valid; - } -}; - -} // namespace utils -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP diff --git a/libraries/boost/include/boost/test/utils/iterator/token_iterator.hpp b/libraries/boost/include/boost/test/utils/iterator/token_iterator.hpp deleted file mode 100644 index e3a923a2ee..0000000000 --- a/libraries/boost/include/boost/test/utils/iterator/token_iterator.hpp +++ /dev/null @@ -1,421 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : token iterator for string and range tokenization -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP -#define BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP - -// Boost -#include -#include - -#include -#include - -#include -#include -#include -#include - -// STL -#include -#include - -#include - -//____________________________________________________________________________// - -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std{ using ::ispunct; using ::isspace; } -#endif - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** ti_delimeter_type ************** // -// ************************************************************************** // - -enum ti_delimeter_type { - dt_char, // character is delimeter if it among explicit list of some characters - dt_ispunct, // character is delimeter if it satisfies ispunct functor - dt_isspace, // character is delimeter if it satisfies isspace functor - dt_none // no character is delimeter -}; - -namespace ut_detail { - -// ************************************************************************** // -// ************** default_char_compare ************** // -// ************************************************************************** // - -template -class default_char_compare { -public: - bool operator()( CharT c1, CharT c2 ) - { -#ifdef BOOST_CLASSIC_IOSTREAMS - return std::string_char_traits::eq( c1, c2 ); -#else - return std::char_traits::eq( c1, c2 ); -#endif - } -}; - -// ************************************************************************** // -// ************** delim_policy ************** // -// ************************************************************************** // - -template -class delim_policy { - typedef basic_cstring cstring; -public: - // Constructor - explicit delim_policy( ti_delimeter_type type_ = dt_char, cstring delimeters_ = cstring() ) - : m_type( type_ ) - { - set_delimeters( delimeters_ ); - } - - void set_delimeters( ti_delimeter_type type_ ) { m_type = type_; } - void set_delimeters( cstring delimeters_ ) - { - m_delimeters = delimeters_; - - if( !m_delimeters.is_empty() ) - m_type = dt_char; - } - void set_delimeters( nfp::nil ) {} - bool operator()( CharT c ) - { - switch( m_type ) { - case dt_char: { - BOOST_TEST_FOREACH( CharT, delim, m_delimeters ) - if( CharCompare()( delim, c ) ) - return true; - - return false; - } - case dt_ispunct: - return (std::ispunct)( c ) != 0; - case dt_isspace: - return (std::isspace)( c ) != 0; - case dt_none: - return false; - } - - return false; - } - -private: - // Data members - cstring m_delimeters; - ti_delimeter_type m_type; -}; - -// ************************************************************************** // -// ************** token_assigner ************** // -// ************************************************************************** // - -template -struct token_assigner { -#if BOOST_WORKAROUND( BOOST_DINKUMWARE_STDLIB, < 306 ) - template - static void assign( Iterator b, Iterator e, std::basic_string& t ) - { for( ; b != e; ++b ) t += *b; } - - template - static void assign( Iterator b, Iterator e, basic_cstring& t ) { t.assign( b, e ); } -#else - template - static void assign( Iterator b, Iterator e, Token& t ) { t.assign( b, e ); } -#endif - template - static void append_move( Iterator& b, Token& ) { ++b; } -}; - -//____________________________________________________________________________// - -template<> -struct token_assigner { - template - static void assign( Iterator /*b*/, Iterator /*e*/, Token& /*t*/ ) {} - - template - static void append_move( Iterator& b, Token& t ) { t += *b; ++b; } -}; - -} // namespace ut_detail - -// ************************************************************************** // -// ************** modifiers ************** // -// ************************************************************************** // - -namespace { -nfp::keyword dropped_delimeters; -nfp::keyword kept_delimeters; -nfp::typed_keyword keep_empty_tokens; -nfp::typed_keyword max_tokens; -} - -// ************************************************************************** // -// ************** token_iterator_base ************** // -// ************************************************************************** // - -template, - typename ValueType = basic_cstring, - typename Reference = basic_cstring, - typename Traversal = forward_traversal_tag> -class token_iterator_base -: public input_iterator_facade { - typedef basic_cstring cstring; - typedef ut_detail::delim_policy delim_policy; - typedef input_iterator_facade base; - -protected: - // Constructor - explicit token_iterator_base() - : m_is_dropped( dt_isspace ) - , m_is_kept( dt_ispunct ) - , m_keep_empty_tokens( false ) - , m_tokens_left( static_cast(-1) ) - , m_token_produced( false ) - { - } - - template - void - apply_modifier( Modifier const& m ) - { - if( m.has( dropped_delimeters ) ) - m_is_dropped.set_delimeters( m[dropped_delimeters] ); - - if( m.has( kept_delimeters ) ) - m_is_kept.set_delimeters( m[kept_delimeters] ); - - if( m.has( keep_empty_tokens ) ) - m_keep_empty_tokens = true; - - nfp::opt_assign( m_tokens_left, m, max_tokens ); - } - - template - bool get( Iter& begin, Iter end ) - { - typedef ut_detail::token_assigner::type> Assigner; - Iter check_point; - - this->m_value.clear(); - - if( !m_keep_empty_tokens ) { - while( begin != end && m_is_dropped( *begin ) ) - ++begin; - - if( begin == end ) - return false; - - check_point = begin; - - if( m_tokens_left == 1 ) - while( begin != end ) - Assigner::append_move( begin, this->m_value ); - else if( m_is_kept( *begin ) ) - Assigner::append_move( begin, this->m_value ); - else - while( begin != end && !m_is_dropped( *begin ) && !m_is_kept( *begin ) ) - Assigner::append_move( begin, this->m_value ); - - --m_tokens_left; - } - else { // m_keep_empty_tokens is true - check_point = begin; - - if( begin == end ) { - if( m_token_produced ) - return false; - - m_token_produced = true; - } - if( m_is_kept( *begin ) ) { - if( m_token_produced ) - Assigner::append_move( begin, this->m_value ); - - m_token_produced = !m_token_produced; - } - else if( !m_token_produced && m_is_dropped( *begin ) ) - m_token_produced = true; - else { - if( m_is_dropped( *begin ) ) - check_point = ++begin; - - while( begin != end && !m_is_dropped( *begin ) && !m_is_kept( *begin ) ) - Assigner::append_move( begin, this->m_value ); - - m_token_produced = true; - } - } - - Assigner::assign( check_point, begin, this->m_value ); - - return true; - } - -private: - // Data members - delim_policy m_is_dropped; - delim_policy m_is_kept; - bool m_keep_empty_tokens; - std::size_t m_tokens_left; - bool m_token_produced; -}; - -// ************************************************************************** // -// ************** basic_string_token_iterator ************** // -// ************************************************************************** // - -template > -class basic_string_token_iterator -: public token_iterator_base,CharT,CharCompare> { - typedef basic_cstring cstring; - typedef token_iterator_base,CharT,CharCompare> base; -public: - explicit basic_string_token_iterator() {} - explicit basic_string_token_iterator( cstring src ) - : m_src( src ) - { - this->init(); - } - - // warning: making the constructor accept anything else than a cstring should - // ensure that no temporary object is created during string creation (previous - // definition was "template basic_string_token_iterator( Src src ..." - // which may create a temporary string copy when called with an std::string. - template - basic_string_token_iterator( cstring src, Modifier const& m ) - : m_src( src ) - { - this->apply_modifier( m ); - - this->init(); - } - -private: - friend class input_iterator_core_access; - - // input iterator implementation - bool get() - { - typename cstring::iterator begin = m_src.begin(); - bool res = base::get( begin, m_src.end() ); - - m_src.assign( begin, m_src.end() ); - - return res; - } - - // Data members - cstring m_src; -}; - -typedef basic_string_token_iterator string_token_iterator; -typedef basic_string_token_iterator wstring_token_iterator; - -// ************************************************************************** // -// ************** range_token_iterator ************** // -// ************************************************************************** // - -template::type>, - typename ValueType = std::basic_string::type>, - typename Reference = ValueType const&> -class range_token_iterator -: public token_iterator_base, - typename iterator_value::type,CharCompare,ValueType,Reference> { - typedef basic_cstring cstring; - typedef token_iterator_base, - typename iterator_value::type,CharCompare,ValueType,Reference> base; -public: - explicit range_token_iterator() {} - explicit range_token_iterator( Iter begin, Iter end = Iter() ) - : m_begin( begin ), m_end( end ) - { - this->init(); - } - range_token_iterator( range_token_iterator const& rhs ) - : base( rhs ) - { - if( this->m_valid ) { - m_begin = rhs.m_begin; - m_end = rhs.m_end; - } - } - - template - range_token_iterator( Iter begin, Iter end, Modifier const& m ) - : m_begin( begin ), m_end( end ) - { - this->apply_modifier( m ); - - this->init(); - } - -private: - friend class input_iterator_core_access; - - // input iterator implementation - bool get() - { - return base::get( m_begin, m_end ); - } - - // Data members - Iter m_begin; - Iter m_end; -}; - -// ************************************************************************** // -// ************** make_range_token_iterator ************** // -// ************************************************************************** // - -template -inline range_token_iterator -make_range_token_iterator( Iter begin, Iter end = Iter() ) -{ - return range_token_iterator( begin, end ); -} - -//____________________________________________________________________________// - -template -inline range_token_iterator -make_range_token_iterator( Iter begin, Iter end, Modifier const& m ) -{ - return range_token_iterator( begin, end, m ); -} - -//____________________________________________________________________________// - -} // namespace utils -} // namespace unit_test -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP - diff --git a/libraries/boost/include/boost/test/utils/lazy_ostream.hpp b/libraries/boost/include/boost/test/utils/lazy_ostream.hpp deleted file mode 100644 index 26bd8ed385..0000000000 --- a/libraries/boost/include/boost/test/utils/lazy_ostream.hpp +++ /dev/null @@ -1,128 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// Description : contains definition for all test tools in test toolbox -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_LAZY_OSTREAM_HPP -#define BOOST_TEST_UTILS_LAZY_OSTREAM_HPP - -// Boost.Test -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** lazy_ostream ************** // -// ************************************************************************** // - -namespace boost { -namespace unit_test { - -class lazy_ostream { -public: - virtual ~lazy_ostream() {} - - static lazy_ostream& instance() { static lazy_ostream inst; return inst; } - - friend std::ostream& operator<<( std::ostream& ostr, lazy_ostream const& o ) { return o( ostr ); } - - // access method - bool empty() const { return m_empty; } - - // actual printing interface; to be accessed only by this class and children - virtual std::ostream& operator()( std::ostream& ostr ) const { return ostr; } -protected: - explicit lazy_ostream( bool p_empty = true ) : m_empty( p_empty ) {} - -private: - // Data members - bool m_empty; -}; - -//____________________________________________________________________________// - -template -class lazy_ostream_impl : public lazy_ostream { -public: - lazy_ostream_impl( PrevType const& prev, T const& value ) - : lazy_ostream( false ) - , m_prev( prev ) - , m_value( value ) - { - } - - virtual std::ostream& operator()( std::ostream& ostr ) const - { - return m_prev(ostr) << m_value; - } -private: - // Data members - PrevType const& m_prev; - StorageT m_value; -}; - -//____________________________________________________________________________// - -template -inline lazy_ostream_impl -operator<<( lazy_ostream const& prev, T const& v ) -{ - return lazy_ostream_impl( prev, v ); -} - -//____________________________________________________________________________// - -template -inline lazy_ostream_impl,T> -operator<<( lazy_ostream_impl const& prev, T const& v ) -{ - typedef lazy_ostream_impl PrevType; - return lazy_ostream_impl( prev, v ); -} - -//____________________________________________________________________________// - -#if BOOST_TEST_USE_STD_LOCALE - -template -inline lazy_ostream_impl -operator<<( lazy_ostream const& prev, R& (BOOST_TEST_CALL_DECL *man)(S&) ) -{ - typedef R& (BOOST_TEST_CALL_DECL * ManipType)(S&); - - return lazy_ostream_impl( prev, man ); -} - -//____________________________________________________________________________// - -template -inline lazy_ostream_impl,R& (BOOST_TEST_CALL_DECL *)(S&),R& (BOOST_TEST_CALL_DECL *)(S&)> -operator<<( lazy_ostream_impl const& prev, R& (BOOST_TEST_CALL_DECL *man)(S&) ) -{ - typedef R& (BOOST_TEST_CALL_DECL * ManipType)(S&); - - return lazy_ostream_impl,ManipType,ManipType>( prev, man ); -} - -//____________________________________________________________________________// - -#endif - -#define BOOST_TEST_LAZY_MSG( M ) (::boost::unit_test::lazy_ostream::instance() << M) - -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_LAZY_OSTREAM_HPP diff --git a/libraries/boost/include/boost/test/utils/named_params.hpp b/libraries/boost/include/boost/test/utils/named_params.hpp deleted file mode 100644 index 50de5bfba0..0000000000 --- a/libraries/boost/include/boost/test/utils/named_params.hpp +++ /dev/null @@ -1,388 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : named function parameters library -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_NAMED_PARAM -#define BOOST_TEST_UTILS_NAMED_PARAM - -// Boost -#include -#include - -// Boost.Test -#include -#include - -#include -#include - -#include - -// Boost -#include -#include -#include -#include -#include -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace nfp { // named function parameters - -// ************************************************************************** // -// ************** forward declarations ************** // -// ************************************************************************** // - -template struct keyword; -template struct typed_keyword; - -template struct named_parameter; -template struct named_parameter_combine; - -// ************************************************************************** // -// ************** is_named_param_pack ************** // -// ************************************************************************** // - -/// is_named_param_pack::value is true if T is parameters pack - -template -struct is_named_param_pack : public mpl::false_ {}; - -template -struct is_named_param_pack > : public mpl::true_ {}; - -template -struct is_named_param_pack > : public mpl::true_ {}; - -// ************************************************************************** // -// ************** param_type ************** // -// ************************************************************************** // - -/// param_type::type is the type of the parameter -/// corresponding to the Keyword (if parameter is present) or Default - -template -struct param_type -: mpl::if_::type, - typename remove_cv::type, - DefaultType> {}; - -template -struct param_type,Keyword,DefaultType> -: mpl::if_::type, - typename remove_cv::type, - typename param_type::type> {}; - -// ************************************************************************** // -// ************** has_param ************** // -// ************************************************************************** // - -/// has_param::value is true if Params has parameter corresponding -/// to the Keyword - -template -struct has_param : is_same {}; - -template -struct has_param,Keyword> -: mpl::or_::type, - typename has_param::type> {}; - -// ************************************************************************** // -// ************** access_to_invalid_parameter ************** // -// ************************************************************************** // - -namespace nfp_detail { - -struct access_to_invalid_parameter {}; - -//____________________________________________________________________________// - -inline void -report_access_to_invalid_parameter( bool v ) -{ - BOOST_TEST_I_ASSRT( !v, access_to_invalid_parameter() ); -} - -} // namespace nfp_detail - -// ************************************************************************** // -// ************** nil ************** // -// ************************************************************************** // - -struct nil { - template -#if defined(__GNUC__) || defined(__HP_aCC) || defined(__EDG__) || defined(__SUNPRO_CC) - operator T() const -#else - operator T const&() const -#endif - { nfp_detail::report_access_to_invalid_parameter(true); static T* v = 0; return *v; } - - template - T any_cast() const - { nfp_detail::report_access_to_invalid_parameter(true); static typename remove_reference::type* v = 0; return *v; } - - template - nil operator()( Arg1 const& ) - { nfp_detail::report_access_to_invalid_parameter(true); return nil(); } - - template - nil operator()( Arg1 const&, Arg2 const& ) - { nfp_detail::report_access_to_invalid_parameter(true); return nil(); } - - template - nil operator()( Arg1 const&, Arg2 const&, Arg3 const& ) - { nfp_detail::report_access_to_invalid_parameter(true); return nil(); } - - // Visitation support - template - void apply_to( Visitor& /*v*/ ) const {} - - static nil& inst() { static nil s_inst; return s_inst; } -private: - nil() {} -}; - -// ************************************************************************** // -// ************** named_parameter_base ************** // -// ************************************************************************** // - -namespace nfp_detail { - -template -struct named_parameter_base { - template - named_parameter_combine - operator,( NP const& np ) const { return named_parameter_combine( np, *static_cast(this) ); } -}; - -} // namespace nfp_detail - -// ************************************************************************** // -// ************** named_parameter_combine ************** // -// ************************************************************************** // - -template -struct named_parameter_combine -: Rest -, nfp_detail::named_parameter_base > { - typedef typename NP::ref_type res_type; - typedef named_parameter_combine self_type; - - // Constructor - named_parameter_combine( NP const& np, Rest const& r ) - : Rest( r ) - , m_param( np ) - { - } - - // Access methods - res_type operator[]( keyword kw ) const { return m_param[kw]; } - res_type operator[]( keyword kw ) const { return m_param[kw]; } - using Rest::operator[]; - - bool has( keyword kw ) const { return m_param.has( kw ); } - using Rest::has; - - void erase( keyword kw ) const { m_param.erase( kw ); } - using Rest::erase; - - using nfp_detail::named_parameter_base >::operator,; - - // Visitation support - template - void apply_to( Visitor& V ) const - { - m_param.apply_to( V ); - - Rest::apply_to( V ); - } -private: - // Data members - NP m_param; -}; - -// ************************************************************************** // -// ************** named_parameter ************** // -// ************************************************************************** // - -template -struct named_parameter -: nfp_detail::named_parameter_base > -{ - typedef T data_type; - typedef RefType ref_type; - typedef unique_id id; - - // Constructor - explicit named_parameter( ref_type v ) - : m_value( v ) - , m_erased( false ) - {} - named_parameter( named_parameter const& np ) - : m_value( np.m_value ) - , m_erased( np.m_erased ) - {} - - // Access methods - ref_type operator[]( keyword ) const { return m_erased ? nil::inst().template any_cast() : m_value; } - ref_type operator[]( keyword ) const { return m_erased ? nil::inst().template any_cast() : m_value; } - template - nil operator[]( keyword ) const { return nil::inst(); } - - bool has( keyword ) const { return !m_erased; } - template - bool has( keyword ) const { return false; } - - void erase( keyword ) const { m_erased = true; } - template - void erase( keyword ) const {} - - // Visitation support - template - void apply_to( Visitor& V ) const - { - V.set_parameter( rtti::type_id(), m_value ); - } - -private: - // Data members - ref_type m_value; - mutable bool m_erased; -}; - -// ************************************************************************** // -// ************** no_params ************** // -// ************************************************************************** // - -typedef named_parameter no_params_type; - -namespace { -no_params_type no_params( '\0' ); -} // local namespace - -// ************************************************************************** // -// ************** keyword ************** // -// ************************************************************************** // - -template -struct keyword { - typedef unique_id id; - - template - named_parameter - operator=( T const& t ) const { return named_parameter( t ); } - - template - named_parameter - operator=( T& t ) const { return named_parameter( t ); } - - named_parameter - operator=( char const* t ) const { return named_parameter( t ); } -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** typed_keyword ************** // -// ************************************************************************** // - -template -struct typed_keyword : keyword { - named_parameter - operator=( T const& t ) const { return named_parameter( t ); } - - named_parameter - operator=( T& t ) const { return named_parameter( t ); } -}; - -//____________________________________________________________________________// - -template -struct typed_keyword -: keyword -, named_parameter { - typedef unique_id id; - - typed_keyword() : named_parameter( true ) {} - - named_parameter - operator!() const { return named_parameter( false ); } -}; - -// ************************************************************************** // -// ************** opt_assign ************** // -// ************************************************************************** // - -template -inline typename enable_if_c::value,void>::type -opt_assign( T& /*target*/, Params const& /*p*/, Keyword /*k*/ ) -{ -} - -//____________________________________________________________________________// - -template -inline typename enable_if_c::value,void>::type -opt_assign( T& target, Params const& p, Keyword k ) -{ - using namespace unit_test; - - assign_op( target, p[k], static_cast(0) ); -} - -// ************************************************************************** // -// ************** opt_get ************** // -// ************************************************************************** // - -template -inline T -opt_get( Params const& p, Keyword k, T default_val ) -{ - opt_assign( default_val, p, k ); - - return default_val; -} - -// ************************************************************************** // -// ************** opt_get ************** // -// ************************************************************************** // - -template -inline typename enable_if_c >::value, -named_parameter_combine >::type -opt_append( Params const& params, NP const& np ) -{ - return (params,np); -} - -//____________________________________________________________________________// - -template -inline typename enable_if_c >::value,Params>::type -opt_append( Params const& params, NP const& ) -{ - return params; -} - -} // namespace nfp -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_NAMED_PARAM diff --git a/libraries/boost/include/boost/test/utils/nullstream.hpp b/libraries/boost/include/boost/test/utils/nullstream.hpp deleted file mode 100644 index 27b17fae14..0000000000 --- a/libraries/boost/include/boost/test/utils/nullstream.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// (C) Copyright Daryle Walker 2000-2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : simulate /dev/null stream -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_NULLSTREAM_HPP -#define BOOST_TEST_UTILS_NULLSTREAM_HPP - -// STL -#include // for std::basic_ostream -#include // for std::basic_streambuf -#include // for std::char_traits - -// Boost -#include - -#include - -//____________________________________________________________________________// - -namespace boost { - -// ************************************************************************** // -// ************** basic_nullbuf ************** // -// ************************************************************************** // -// Class for a buffer that reads nothing and writes to nothing. -// Idea from an Usenet post by Tom at -// 27 Oct 2000 14:06:21 GMT on comp.lang.c++. - -template > -class basic_nullbuf : public ::std::basic_streambuf { - typedef ::std::basic_streambuf base_type; -public: - // Types - typedef typename base_type::char_type char_type; - typedef typename base_type::traits_type traits_type; - typedef typename base_type::int_type int_type; - typedef typename base_type::pos_type pos_type; - typedef typename base_type::off_type off_type; - - // Use automatic default constructor and destructor - -protected: - // The default implementations of the miscellaneous virtual - // member functions are sufficient. - - // The default implementations of the input & putback virtual - // member functions, being nowhere but EOF, are sufficient. - - // The output virtual member functions need to be changed to - // accept anything without any problems, instead of being at EOF. - virtual ::std::streamsize xsputn( char_type const* /*s*/, ::std::streamsize n ) { return n; } // "s" is unused - virtual int_type overflow( int_type c = traits_type::eof() ) { return traits_type::not_eof( c ); } -}; - -typedef basic_nullbuf nullbuf; -typedef basic_nullbuf wnullbuf; - -// ************************************************************************** // -// ************** basic_onullstream ************** // -// ************************************************************************** // -// Output streams based on basic_nullbuf. - -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable: 4355) // 'this' : used in base member initializer list -#endif - -template< typename CharType, class CharTraits = ::std::char_traits > -class basic_onullstream : private boost::base_from_member > - , public ::std::basic_ostream { - typedef boost::base_from_member > pbase_type; - typedef ::std::basic_ostream base_type; -public: - // Constructor - basic_onullstream() : pbase_type(), base_type( &this->pbase_type::member ) {} -}; - -#ifdef BOOST_MSVC -# pragma warning(default: 4355) -# pragma warning(pop) -#endif - -typedef basic_onullstream onullstream; -typedef basic_onullstream wonullstream; - -} // namespace boost - -//____________________________________________________________________________// - -#include - -#endif // BOOST_TEST_UTILS_NULLSTREAM_HPP diff --git a/libraries/boost/include/boost/test/utils/rtti.hpp b/libraries/boost/include/boost/test/utils/rtti.hpp deleted file mode 100644 index b230692d80..0000000000 --- a/libraries/boost/include/boost/test/utils/rtti.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : simple facilities for accessing type information at runtime -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RTTI_HPP -#define BOOST_TEST_UTILS_RTTI_HPP - -// C Runtime -#include - -namespace boost { -namespace rtti { - -// ************************************************************************** // -// ************** rtti::type_id ************** // -// ************************************************************************** // - -typedef std::ptrdiff_t id_t; - -namespace rtti_detail { - -template -struct rttid_holder { - static id_t id() { return reinterpret_cast( &inst() ); } - -private: - struct rttid {}; - - static rttid const& inst() { static rttid s_inst; return s_inst; } -}; - -} // namespace rtti_detail - -//____________________________________________________________________________// - -template -inline id_t -type_id() -{ - return rtti_detail::rttid_holder::id(); -} - -//____________________________________________________________________________// - -#define BOOST_RTTI_SWITCH( type_id_ ) if( ::boost::rtti::id_t switch_by_id = type_id_ ) -#define BOOST_RTTI_CASE( type ) if( switch_by_id == ::boost::rtti::type_id() ) - -//____________________________________________________________________________// - -} // namespace rtti -} // namespace boost - -#endif // BOOST_TEST_UTILS_RTTI_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/argument.hpp b/libraries/boost/include/boost/test/utils/runtime/argument.hpp deleted file mode 100644 index 879ee96f9f..0000000000 --- a/libraries/boost/include/boost/test/utils/runtime/argument.hpp +++ /dev/null @@ -1,131 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : model of actual argument (both typed and abstract interface) -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP -#define BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP - -// Boost.Test Runtime parameters -#include -#include - -// Boost.Test -#include -#include -#include -#include - -// STL -#include - -#include - -namespace boost { -namespace runtime { - -// ************************************************************************** // -// ************** runtime::argument ************** // -// ************************************************************************** // - -class argument { -public: - // Constructor - argument( rtti::id_t value_type ) - : p_value_type( value_type ) - {} - - // Destructor - virtual ~argument() {} - - // Public properties - rtti::id_t const p_value_type; -}; - -// ************************************************************************** // -// ************** runtime::typed_argument ************** // -// ************************************************************************** // - -template -class typed_argument : public argument { -public: - // Constructor - explicit typed_argument( T const& v ) - : argument( rtti::type_id() ) - , p_value( v ) - {} - - unit_test::readwrite_property p_value; -}; - -// ************************************************************************** // -// ************** runtime::arguments_store ************** // -// ************************************************************************** // - -class arguments_store { -public: - typedef std::map storage_type; - - /// Returns number of arguments in the store; mostly used for testing - std::size_t size() const { return m_arguments.size(); } - - /// Clears the store for reuse - void clear() { m_arguments.clear(); } - - /// Returns true if there is an argument corresponding to the specified parameter name - bool has( cstring parameter_name ) const - { - return m_arguments.find( parameter_name ) != m_arguments.end(); - } - - /// Provides types access to argument value by parameter name - template - T const& get( cstring parameter_name ) const { - return const_cast(this)->get( parameter_name ); - } - - template - T& get( cstring parameter_name ) { - storage_type::const_iterator found = m_arguments.find( parameter_name ); - BOOST_TEST_I_ASSRT( found != m_arguments.end(), - access_to_missing_argument() - << "There is no argument provided for parameter " - << parameter_name ); - - argument_ptr arg = found->second; - - BOOST_TEST_I_ASSRT( arg->p_value_type == rtti::type_id(), - arg_type_mismatch() - << "Access with invalid type for argument corresponding to parameter " - << parameter_name ); - - return static_cast&>( *arg ).p_value.value; - } - - /// Set's the argument value for specified parameter name - template - void set( cstring parameter_name, T const& value ) - { - m_arguments[parameter_name] = argument_ptr( new typed_argument( value ) ); - } - -private: - // Data members - storage_type m_arguments; -}; - -} // namespace runtime -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/argument_factory.hpp b/libraries/boost/include/boost/test/utils/runtime/argument_factory.hpp deleted file mode 100644 index f3448f8cc4..0000000000 --- a/libraries/boost/include/boost/test/utils/runtime/argument_factory.hpp +++ /dev/null @@ -1,242 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : argument factories for different kinds of parameters -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_ARGUMENT_FACTORY_HPP -#define BOOST_TEST_UTILS_RUNTIME_ARGUMENT_FACTORY_HPP - -// Boost.Test Runtime parameters -#include -#include - -// Boost.Test -#include -#include -#include - -// Boost -#include - -// STL -#include - -#include - -namespace boost { -namespace runtime { - -// ************************************************************************** // -// ************** runtime::value_interpreter ************** // -// ************************************************************************** // - -template -struct value_interpreter; - -//____________________________________________________________________________// - -template -struct value_interpreter { - template - explicit value_interpreter( Modifiers const& ) {} - - ValueType interpret( cstring param_name, cstring source ) const - { - ValueType res; - if( !unit_test::utils::string_as( source, res ) ) - BOOST_TEST_I_THROW( format_error( param_name ) << source << - " can't be interpreted as value of parameter " << param_name << "." ); - return res; - } -}; - -//____________________________________________________________________________// - -template<> -struct value_interpreter { - template - explicit value_interpreter( Modifiers const& ) {} - - std::string interpret( cstring, cstring source ) const - { - return std::string( source.begin(), source.size() ); - } -}; - -//____________________________________________________________________________// - -template<> -struct value_interpreter { - template - explicit value_interpreter( Modifiers const& ) {} - - cstring interpret( cstring, cstring source ) const - { - return source; - } -}; - -//____________________________________________________________________________// - -template<> -struct value_interpreter { - template - explicit value_interpreter( Modifiers const& ) {} - - bool interpret( cstring param_name, cstring source ) const - { - static cstring const s_YES( "YES" ); - static cstring const s_Y( "Y" ); - static cstring const s_NO( "NO" ); - static cstring const s_N( "N" ); - static cstring const s_TRUE( "TRUE" ); - static cstring const s_FALSE( "FALSE" ); - static cstring const s_one( "1" ); - static cstring const s_zero( "0" ); - - source.trim(); - - if( source.is_empty() || - case_ins_eq( source, s_YES ) || - case_ins_eq( source, s_Y ) || - case_ins_eq( source, s_one ) || - case_ins_eq( source, s_TRUE ) ) - return true; - - if( case_ins_eq( source, s_NO ) || - case_ins_eq( source, s_N ) || - case_ins_eq( source, s_zero ) || - case_ins_eq( source, s_FALSE ) ) - return false; - - BOOST_TEST_I_THROW( format_error( param_name ) << source << " can't be interpreted as bool value." ); - } -}; - -//____________________________________________________________________________// - -template -struct value_interpreter { - template - explicit value_interpreter( Modifiers const& m ) -#if defined(BOOST_TEST_CLA_NEW_API) - : m_name_to_value( m[enum_values::value] ) - { - } -#else - { - std::vector > const& values = m[enum_values::value]; - - m_name_to_value.insert( values.begin(), values.end() ); - } -#endif - - EnumType interpret( cstring param_name, cstring source ) const - { - typename std::map::const_iterator found = m_name_to_value.find( source ); - - BOOST_TEST_I_ASSRT( found != m_name_to_value.end(), - format_error( param_name ) << source << - " is not a valid enumeration value name for parameter " << param_name << "." ); - - return found->second; - } - -private: - // Data members - std::map m_name_to_value; -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** runtime::argument_factory ************** // -// ************************************************************************** // - -template -class argument_factory; - -//____________________________________________________________________________// - -template -class argument_factory { -public: - template - explicit argument_factory( Modifiers const& m ) - : m_interpreter( m ) - , m_optional_value( nfp::opt_get( m, optional_value, ValueType() ) ) - , m_default_value( nfp::opt_get( m, default_value, ValueType() ) ) - { - } - - void produce_argument( cstring source, cstring param_name, arguments_store& store ) const - { - store.set( param_name, source.empty() ? m_optional_value : m_interpreter.interpret( param_name, source ) ); - } - - void produce_default( cstring param_name, arguments_store& store ) const - { - store.set( param_name, m_default_value ); - } - -private: - // Data members - typedef value_interpreter interp_t; - interp_t m_interpreter; - ValueType m_optional_value; - ValueType m_default_value; -}; - -//____________________________________________________________________________// - -template -class argument_factory { -public: - template - explicit argument_factory( Modifiers const& m ) - : m_interpreter( m ) - { - } - - void produce_argument( cstring source, cstring param_name, arguments_store& store ) const - { - ValueType value = m_interpreter.interpret( param_name, source ); - - if( store.has( param_name ) ) { - std::vector& values = store.get >( param_name ); - values.push_back( value ); - } - else { - std::vector values( 1, value ); - - store.set( param_name, values ); - } - - } - void produce_default( cstring param_name, arguments_store& store ) const - { - store.set( param_name, std::vector() ); - } - -private: - // Data members - value_interpreter m_interpreter; -}; - -//____________________________________________________________________________// - -} // namespace runtime -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_RUNTIME_ARGUMENT_FACTORY_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/cla/argv_traverser.hpp b/libraries/boost/include/boost/test/utils/runtime/cla/argv_traverser.hpp deleted file mode 100644 index 10fb67bde4..0000000000 --- a/libraries/boost/include/boost/test/utils/runtime/cla/argv_traverser.hpp +++ /dev/null @@ -1,105 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : defines facility to hide input traversing details -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP -#define BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP - -// Boost.Test Runtime parameters -#include - -#include - -namespace boost { -namespace runtime { -namespace cla { - -// ************************************************************************** // -// ************** runtime::cla::argv_traverser ************** // -// ************************************************************************** // - -class argv_traverser { - typedef char const** argv_type; -public: - /// Constructs traverser based on argc/argv pair - /// argv is taken "by reference" and later can be - /// updated in remainder method - argv_traverser( int argc, argv_type argv ) - : m_argc( argc ) - , m_curr_token( 0 ) - , m_token_size( 0 ) - , m_argv( argv ) - { - // save program name - save_token(); - } - - /// Returns new argc - int remainder() - { - return m_argc; - } - - /// Returns true, if we reached end on input - bool eoi() const - { - return m_curr_token == m_argc; - } - - /// Returns current token in the input - cstring current_token() - { - if( eoi() ) - return cstring(); - - return cstring( m_argv[m_curr_token], m_token_size ); - } - - /// Saves current token for remainder - void save_token() - { - ++m_curr_token; - - if( !eoi() ) - m_token_size = ::strlen( m_argv[m_curr_token] ); - } - - /// Commit current token and iterate to next one - void next_token() - { - if( !eoi() ) { - for( std::size_t i = m_curr_token; i < m_argc-1; ++i ) - m_argv[i] = m_argv[i + 1]; - - --m_argc; - - m_token_size = ::strlen( m_argv[m_curr_token] ); - } - } - -private: - - // Data members - std::size_t m_argc; // total number of arguments - std::size_t m_curr_token; // current token index in argv - std::size_t m_token_size; // current token size - argv_type m_argv; // all arguments -}; - -} // namespace cla -} // namespace runtime -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/cla/parser.hpp b/libraries/boost/include/boost/test/utils/runtime/cla/parser.hpp deleted file mode 100644 index a57091b474..0000000000 --- a/libraries/boost/include/boost/test/utils/runtime/cla/parser.hpp +++ /dev/null @@ -1,584 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -//!@file -//!@brief CLA parser -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP -#define BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP - -// Boost.Test Runtime parameters -#include -#include -#include - -#include - -// Boost.Test -#include -#include -#include -#include - -#include // !! ?? unnecessary after cxx11 - -// STL -// !! ?? #include -#include -#include - -#include - -namespace boost { -namespace runtime { -namespace cla { - -// ************************************************************************** // -// ************** runtime::cla::parameter_trie ************** // -// ************************************************************************** // - -namespace rt_cla_detail { - -struct parameter_trie; -typedef shared_ptr parameter_trie_ptr; -typedef std::map trie_per_char; -typedef std::vector > param_cla_id_list; - -struct parameter_trie { - parameter_trie() : m_has_final_candidate( false ) {} - - /// If subtrie corresponding to the char c exists returns it otherwise creates new - parameter_trie_ptr make_subtrie( char c ) - { - trie_per_char::const_iterator it = m_subtrie.find( c ); - - if( it == m_subtrie.end() ) - it = m_subtrie.insert( std::make_pair( c, parameter_trie_ptr( new parameter_trie ) ) ).first; - - return it->second; - } - - /// Creates series of sub-tries per characters in a string - parameter_trie_ptr make_subtrie( cstring s ) - { - parameter_trie_ptr res; - - BOOST_TEST_FOREACH( char, c, s ) - res = (res ? res->make_subtrie( c ) : make_subtrie( c )); - - return res; - } - - /// Registers candidate parameter for this subtrie. If final, it needs to be unique - void add_candidate_id( parameter_cla_id const& param_id, basic_param_ptr param_candidate, bool final ) - { - BOOST_TEST_I_ASSRT( !m_has_final_candidate && (!final || m_id_candidates.empty()), - conflicting_param() << "Parameter cla id " << param_id.m_tag << " conflicts with the " - << "parameter cla id " << m_id_candidates.back().get().m_tag ); - - m_has_final_candidate = final; - m_id_candidates.push_back( ref(param_id) ); - - if( m_id_candidates.size() == 1 ) - m_param_candidate = param_candidate; - else - m_param_candidate.reset(); - } - - /// Gets subtrie for specified char if present or nullptr otherwise - parameter_trie_ptr get_subtrie( char c ) const - { - trie_per_char::const_iterator it = m_subtrie.find( c ); - - return it != m_subtrie.end() ? it->second : parameter_trie_ptr(); - } - - // Data members - trie_per_char m_subtrie; - param_cla_id_list m_id_candidates; - basic_param_ptr m_param_candidate; - bool m_has_final_candidate; -}; - -// ************************************************************************** // -// ************** runtime::cla::report_foreing_token ************** // -// ************************************************************************** // - -static void -report_foreing_token( cstring program_name, cstring token ) -{ - std::cerr << "Boost.Test WARNING: token \"" << token << "\" does not correspond to the Boost.Test argument \n" - << " and should be placed after all Boost.Test arguments and the -- separator.\n" - << " For example: " << program_name << " --random -- " << token << "\n"; -} - -} // namespace rt_cla_detail - -// ************************************************************************** // -// ************** runtime::cla::parser ************** // -// ************************************************************************** // - -class parser { -public: - /// Initializes a parser and builds internal trie representation used for - /// parsing based on the supplied parameters -#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS - template - parser( parameters_store const& parameters, Modifiers const& m = nfp::no_params ) -#else - template - parser( parameters_store const& parameters, Modifiers const& m ) -#endif - { - nfp::opt_assign( m_end_of_param_indicator, m, end_of_params ); - nfp::opt_assign( m_negation_prefix, m, negation_prefix ); - - BOOST_TEST_I_ASSRT( algorithm::all_of( m_end_of_param_indicator.begin(), - m_end_of_param_indicator.end(), - parameter_cla_id::valid_prefix_char ), - invalid_cla_id() << "End of parameters indicator can only consist of prefix characters." ); - - BOOST_TEST_I_ASSRT( algorithm::all_of( m_negation_prefix.begin(), - m_negation_prefix.end(), - parameter_cla_id::valid_name_char ), - invalid_cla_id() << "Negation prefix can only consist of prefix characters." ); - - build_trie( parameters ); - } - - // input processing method - int - parse( int argc, char** argv, runtime::arguments_store& res ) - { - // save program name for help message - m_program_name = argv[0]; - cstring path_sep( "\\/" ); - - cstring::iterator it = unit_test::utils::find_last_of( m_program_name.begin(), m_program_name.end(), - path_sep.begin(), path_sep.end() ); - if( it != m_program_name.end() ) - m_program_name.trim_left( it + 1 ); - - // Set up the traverser - argv_traverser tr( argc, (char const**)argv ); - - // Loop till we reach end of input - while( !tr.eoi() ) { - cstring curr_token = tr.current_token(); - - cstring prefix; - cstring name; - cstring value_separator; - bool negative_form = false; - - // Perform format validations and split the argument into prefix, name and separator - // False return value indicates end of params indicator is met - if( !validate_token_format( curr_token, prefix, name, value_separator, negative_form ) ) { - // get rid of "end of params" token - tr.next_token(); - break; - } - - // Locate trie corresponding to found prefix and skip it in the input - trie_ptr curr_trie = m_param_trie[prefix]; - - if( !curr_trie ) { - // format_error() << "Unrecognized parameter prefix in the argument " << tr.current_token() - rt_cla_detail::report_foreing_token( m_program_name, curr_token ); - tr.save_token(); - continue; - } - - curr_token.trim_left( prefix.size() ); - - // Locate parameter based on a name and skip it in the input - locate_result locate_res = locate_parameter( curr_trie, name, curr_token ); - parameter_cla_id const& found_id = locate_res.first; - basic_param_ptr found_param = locate_res.second; - - if( negative_form ) { - BOOST_TEST_I_ASSRT( found_id.m_negatable, - format_error( found_param->p_name ) - << "Parameter tag " << found_id.m_tag << " is not negatable." ); - - curr_token.trim_left( m_negation_prefix.size() ); - } - - curr_token.trim_left( name.size() ); - - cstring value; - - // Skip validations if parameter has optional value and we are at the end of token - if( !value_separator.is_empty() || !found_param->p_has_optional_value ) { - // Validate and skip value separator in the input - BOOST_TEST_I_ASSRT( found_id.m_value_separator == value_separator, - format_error( found_param->p_name ) - << "Invalid separator for the parameter " - << found_param->p_name - << " in the argument " << tr.current_token() ); - - curr_token.trim_left( value_separator.size() ); - - // Deduce value source - value = curr_token; - if( value.is_empty() ) { - tr.next_token(); - value = tr.current_token(); - } - - BOOST_TEST_I_ASSRT( !value.is_empty(), - format_error( found_param->p_name ) - << "Missing an argument value for the parameter " - << found_param->p_name - << " in the argument " << tr.current_token() ); - } - - // Validate against argument duplication - BOOST_TEST_I_ASSRT( !res.has( found_param->p_name ) || found_param->p_repeatable, - duplicate_arg( found_param->p_name ) - << "Duplicate argument value for the parameter " - << found_param->p_name - << " in the argument " << tr.current_token() ); - - // Produce argument value - found_param->produce_argument( value, negative_form, res ); - - tr.next_token(); - } - - // generate the remainder and return it's size - return tr.remainder(); - } - - // help/usage/version - void - version( std::ostream& ostr ) - { - ostr << "Boost.Test module "; - -#if defined(BOOST_TEST_MODULE) - // we do not want to refer to the master test suite there - ostr << '\'' << BOOST_TEST_STRINGIZE( BOOST_TEST_MODULE ).trim( "\"" ) << "' "; -#endif - - ostr << "in executable '" << m_program_name << "'\n"; - ostr << "Compiled from Boost version " - << BOOST_VERSION/100000 << "." - << BOOST_VERSION/100 % 1000 << "." - << BOOST_VERSION % 100 ; - ostr << " with "; -#if defined(BOOST_TEST_INCLUDED) - ostr << "single header inclusion of"; -#elif defined(BOOST_TEST_DYN_LINK) - ostr << "dynamic linking to"; -#else - ostr << "static linking to"; -#endif - ostr << " Boost.Test\n"; - ostr << "- Compiler: " << BOOST_COMPILER << '\n' - << "- Platform: " << BOOST_PLATFORM << '\n' - << "- STL : " << BOOST_STDLIB; - ostr << std::endl; - } - - void - usage(std::ostream& ostr, - cstring param_name = cstring(), - bool use_color = true) - { - namespace utils = unit_test::utils; - namespace ut_detail = unit_test::ut_detail; - - if( !param_name.is_empty() ) { - basic_param_ptr param = locate_parameter( m_param_trie[help_prefix], param_name, "" ).second; - param->usage( ostr, m_negation_prefix ); - } - else { - ostr << "\n The program '" << m_program_name << "' is a Boost.test module containing unit tests."; - - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL ); - ostr << "\n\n Usage\n "; - } - - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); - ostr << m_program_name << " [Boost.Test argument]... "; - } - if( !m_end_of_param_indicator.empty() ) { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); - ostr << '[' << m_end_of_param_indicator << " [custom test module argument]...]"; - } - } - - ostr << "\n\n Use\n "; - { - - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); - ostr << m_program_name << " --help"; - } - ostr << "\n or "; - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); - ostr << m_program_name << " --help="; - } - ostr << "\n for detailed help on Boost.Test parameters.\n"; - } - - void - help(std::ostream& ostr, - parameters_store const& parameters, - cstring param_name, - bool use_color = true) - { - namespace utils = unit_test::utils; - namespace ut_detail = unit_test::ut_detail; - - if( !param_name.is_empty() ) { - basic_param_ptr param = locate_parameter( m_param_trie[help_prefix], param_name, "" ).second; - param->help( ostr, m_negation_prefix, use_color); - return; - } - - usage(ostr, cstring(), use_color); - - ostr << "\n\n"; - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL ); - ostr << " Command line flags:\n"; - } - runtime::commandline_pretty_print( - ostr, - " ", - "The command line flags of Boost.Test are listed below. " - "All parameters are optional. You can specify parameter value either " - "as a command line argument or as a value of its corresponding environment " - "variable. If a flag is specified as a command line argument and an environment variable " - "at the same time, the command line takes precedence. " - "The command line argument " - "support name guessing, and works with shorter names as long as those are not ambiguous." - ); - - if( !m_end_of_param_indicator.empty() ) { - ostr << "\n\n All the arguments after the '"; - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); - ostr << m_end_of_param_indicator; - } - ostr << "' are ignored by Boost.Test."; - } - - - { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::ORIGINAL ); - ostr << "\n\n Environment variables:\n"; - } - runtime::commandline_pretty_print( - ostr, - " ", - "Every argument listed below may also be set by a corresponding environment" - "variable. For an argument '--argument_x=', the corresponding " - "environment variable is 'BOOST_TEST_ARGUMENT_X=value" - ); - - - - ostr << "\n\n The following parameters are supported:\n"; - - BOOST_TEST_FOREACH( - parameters_store::storage_type::value_type const&, - v, - parameters.all() ) - { - basic_param_ptr param = v.second; - ostr << "\n"; - param->usage( ostr, m_negation_prefix, use_color); - } - - } - -private: - typedef rt_cla_detail::parameter_trie_ptr trie_ptr; - typedef rt_cla_detail::trie_per_char trie_per_char; - typedef std::map str_to_trie; - - void - build_trie( parameters_store const& parameters ) - { - // Iterate over all parameters - BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, parameters.all() ) { - basic_param_ptr param = v.second; - - // Register all parameter's ids in trie. - BOOST_TEST_FOREACH( parameter_cla_id const&, id, param->cla_ids() ) { - // This is the trie corresponding to the prefix. - trie_ptr next_trie = m_param_trie[id.m_prefix]; - if( !next_trie ) - next_trie = m_param_trie[id.m_prefix] = trie_ptr( new rt_cla_detail::parameter_trie ); - - // Build the trie, by following name's characters - // and register this parameter as candidate on each level - for( size_t index = 0; index < id.m_tag.size(); ++index ) { - next_trie = next_trie->make_subtrie( id.m_tag[index] ); - - next_trie->add_candidate_id( id, param, index == (id.m_tag.size() - 1) ); - } - } - } - } - - bool - validate_token_format( cstring token, cstring& prefix, cstring& name, cstring& separator, bool& negative_form ) - { - // Match prefix - cstring::iterator it = token.begin(); - while( it != token.end() && parameter_cla_id::valid_prefix_char( *it ) ) - ++it; - - prefix.assign( token.begin(), it ); - - if( prefix.empty() ) - return true; - - // Match name - while( it != token.end() && parameter_cla_id::valid_name_char( *it ) ) - ++it; - - name.assign( prefix.end(), it ); - - if( name.empty() ) { - if( prefix == m_end_of_param_indicator ) - return false; - - BOOST_TEST_I_THROW( format_error() << "Invalid format for an actual argument " << token ); - } - - // Match value separator - while( it != token.end() && parameter_cla_id::valid_separator_char( *it ) ) - ++it; - - separator.assign( name.end(), it ); - - // Match negation prefix - negative_form = !m_negation_prefix.empty() && ( name.substr( 0, m_negation_prefix.size() ) == m_negation_prefix ); - if( negative_form ) - name.trim_left( m_negation_prefix.size() ); - - return true; - } - - // C++03: cannot have references as types - typedef std::pair locate_result; - - locate_result - locate_parameter( trie_ptr curr_trie, cstring name, cstring token ) - { - std::vector typo_candidates; - std::vector next_typo_candidates; - trie_ptr next_trie; - - BOOST_TEST_FOREACH( char, c, name ) { - if( curr_trie ) { - // locate next subtrie corresponding to the char - next_trie = curr_trie->get_subtrie( c ); - - if( next_trie ) - curr_trie = next_trie; - else { - // Initiate search for typo candicates. We will account for 'wrong char' typo - // 'missing char' typo and 'extra char' typo - BOOST_TEST_FOREACH( trie_per_char::value_type const&, typo_cand, curr_trie->m_subtrie ) { - // 'wrong char' typo - typo_candidates.push_back( typo_cand.second ); - - // 'missing char' typo - if( (next_trie = typo_cand.second->get_subtrie( c )) ) - typo_candidates.push_back( next_trie ); - } - - // 'extra char' typo - typo_candidates.push_back( curr_trie ); - - curr_trie.reset(); - } - } - else { - // go over existing typo candidates and see if they are still viable - BOOST_TEST_FOREACH( trie_ptr, typo_cand, typo_candidates ) { - trie_ptr next_typo_cand = typo_cand->get_subtrie( c ); - - if( next_typo_cand ) - next_typo_candidates.push_back( next_typo_cand ); - } - - next_typo_candidates.swap( typo_candidates ); - next_typo_candidates.clear(); - } - } - - if( !curr_trie ) { - std::vector typo_candidate_names; - std::set unique_typo_candidate; // !! ?? unordered_set - typo_candidate_names.reserve( typo_candidates.size() ); -// !! ?? unique_typo_candidate.reserve( typo_candidates.size() ); - - BOOST_TEST_FOREACH( trie_ptr, trie_cand, typo_candidates ) { - // avoid ambiguos candidate trie - if( trie_cand->m_id_candidates.size() > 1 ) - continue; - - BOOST_TEST_FOREACH( parameter_cla_id const&, param_cand, trie_cand->m_id_candidates ) { - if( !unique_typo_candidate.insert( ¶m_cand ).second ) - continue; - - typo_candidate_names.push_back( param_cand.m_tag ); - } - } - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - BOOST_TEST_I_THROW( unrecognized_param( std::move(typo_candidate_names) ) - << "An unrecognized parameter in the argument " - << token ); -#else - BOOST_TEST_I_THROW( unrecognized_param( typo_candidate_names ) - << "An unrecognized parameter in the argument " - << token ); -#endif - } - - if( curr_trie->m_id_candidates.size() > 1 ) { - std::vector amb_names; - BOOST_TEST_FOREACH( parameter_cla_id const&, param_id, curr_trie->m_id_candidates ) - amb_names.push_back( param_id.m_tag ); - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - BOOST_TEST_I_THROW( ambiguous_param( std::move( amb_names ) ) - << "An ambiguous parameter name in the argument " << token ); -#else - BOOST_TEST_I_THROW( ambiguous_param( amb_names ) - << "An ambiguous parameter name in the argument " << token ); -#endif - } - - return locate_result( curr_trie->m_id_candidates.back().get(), curr_trie->m_param_candidate ); - } - - // Data members - cstring m_program_name; - std::string m_end_of_param_indicator; - std::string m_negation_prefix; - str_to_trie m_param_trie; -}; - -} // namespace cla -} // namespace runtime -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/env/fetch.hpp b/libraries/boost/include/boost/test/utils/runtime/env/fetch.hpp deleted file mode 100644 index 97d54d4905..0000000000 --- a/libraries/boost/include/boost/test/utils/runtime/env/fetch.hpp +++ /dev/null @@ -1,108 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements fetching absent parameter athuments from environment -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_FETCH_HPP -#define BOOST_TEST_UTILS_RUNTIME_ENV_FETCH_HPP - -// Boost.Test Runtime parameters -#include -#include - -#include - -// C Runtime -#include - -namespace boost { -namespace runtime { -namespace env { - -namespace env_detail { - -#ifndef UNDER_CE - -#ifdef BOOST_MSVC -#pragma warning(push) -#pragma warning(disable:4996) // getenv -#endif - -inline std::pair -sys_read_var( cstring var_name ) -{ - using namespace std; - char const* res = getenv( var_name.begin() ); - - return std::make_pair( cstring(res), res != NULL ); -} - -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif - -#else - -inline std::pair -sys_read_var( cstring var_name ) -{ - return std::make_pair( cstring(), false ); -} - -#endif - -//____________________________________________________________________________// - -template -inline void -fetch_absent( parameters_store const& params, runtime::arguments_store& args, ReadFunc read_func ) -{ - BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, params.all() ) { - basic_param_ptr param = v.second; - - if( args.has( param->p_name ) || param->p_env_var.empty() ) - continue; - - std::pair value = read_func( param->p_env_var ); - - if( !value.second ) - continue; - - // Validate against unexpected empty value - BOOST_TEST_I_ASSRT( !value.first.is_empty() || param->p_has_optional_value, - format_error( param->p_name ) - << "Missing an argument value for the parameter " << param->p_name - << " in the environment." ); - - // Produce argument value - param->produce_argument( value.first, false, args ); - - } -} - -//____________________________________________________________________________// - -} // namespace env_detail - -inline void -fetch_absent( parameters_store const& params, runtime::arguments_store& args ) -{ - env_detail::fetch_absent( params, args, &env_detail::sys_read_var ); -} - -} // namespace env -} // namespace runtime -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_RUNTIME_ENV_FETCH_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/errors.hpp b/libraries/boost/include/boost/test/utils/runtime/errors.hpp deleted file mode 100644 index 5b263d21c5..0000000000 --- a/libraries/boost/include/boost/test/utils/runtime/errors.hpp +++ /dev/null @@ -1,195 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : defines runtime parameters setup error -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP -#define BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP - -// Boost.Test Runtime parameters -#include - -// Boost.Test -#include - -// Boost.Test -#include - -// STL -#include -#include - -#include - -namespace boost { -namespace runtime { - -// ************************************************************************** // -// ************** runtime::param_error ************** // -// ************************************************************************** // - -class param_error : public std::exception { -public: - ~param_error() BOOST_NOEXCEPT_OR_NOTHROW {} - - virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW - { - return msg.c_str(); - } - - cstring param_name; - std::string msg; - -protected: - explicit param_error( cstring param_name_ ) : param_name( param_name_) {} -}; - -//____________________________________________________________________________// - -class init_error : public param_error { -protected: - explicit init_error( cstring param_name ) : param_error( param_name ) {} - ~init_error() BOOST_NOEXCEPT_OR_NOTHROW {} -}; - -class input_error : public param_error { -protected: - explicit input_error( cstring param_name ) : param_error( param_name ) {} - ~input_error() BOOST_NOEXCEPT_OR_NOTHROW {} -}; - -//____________________________________________________________________________// - -template -class specific_param_error : public Base { -protected: - explicit specific_param_error( cstring param_name ) : Base( param_name ) {} - ~specific_param_error() BOOST_NOEXCEPT_OR_NOTHROW {} - -public: - -//____________________________________________________________________________// - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ - !defined(BOOST_NO_CXX11_REF_QUALIFIERS) - - Derived operator<<(char const* val) && - { - this->msg.append( val ); - - return static_cast(*this); - } - - //____________________________________________________________________________// - - template - Derived operator<<(T const& val) && - { - this->msg.append( unit_test::utils::string_cast( val ) ); - - return static_cast(*this); - } - - //____________________________________________________________________________// - -#else - - Derived const& operator<<(char const* val) const - { - const_cast&>(*this).msg.append( val ); - - return static_cast(*this); - } - - //____________________________________________________________________________// - - template - Derived const& operator<<(T const& val) const - { - const_cast&>(*this).msg.append( unit_test::utils::string_cast( val ) ); - - return static_cast(*this); - } - - //____________________________________________________________________________// - -#endif - -}; - - - -// ************************************************************************** // -// ************** specific exception types ************** // -// ************************************************************************** // - -#define SPECIFIC_EX_TYPE( type, base ) \ -class type : public specific_param_error { \ -public: \ - explicit type( cstring param_name = cstring() ) \ - : specific_param_error( param_name ) \ - {} \ -} \ -/**/ - -SPECIFIC_EX_TYPE( invalid_cla_id, init_error ); -SPECIFIC_EX_TYPE( duplicate_param, init_error ); -SPECIFIC_EX_TYPE( conflicting_param, init_error ); -SPECIFIC_EX_TYPE( unknown_param, init_error ); -SPECIFIC_EX_TYPE( access_to_missing_argument, init_error ); -SPECIFIC_EX_TYPE( arg_type_mismatch, init_error ); -SPECIFIC_EX_TYPE( invalid_param_spec, init_error ); - -SPECIFIC_EX_TYPE( format_error, input_error ); -SPECIFIC_EX_TYPE( duplicate_arg, input_error ); -SPECIFIC_EX_TYPE( missing_req_arg, input_error ); - -#undef SPECIFIC_EX_TYPE - -class ambiguous_param : public specific_param_error { -public: -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - explicit ambiguous_param( std::vector&& amb_candidates ) - : specific_param_error( "" ) - , m_amb_candidates( std::move( amb_candidates ) ) {} -#else - explicit ambiguous_param( std::vector const& amb_candidates ) - : specific_param_error( "" ) - , m_amb_candidates( amb_candidates ) {} -#endif - ~ambiguous_param() BOOST_NOEXCEPT_OR_NOTHROW {} - - std::vector m_amb_candidates; -}; - -class unrecognized_param : public specific_param_error { -public: -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - explicit unrecognized_param( std::vector&& type_candidates ) - : specific_param_error( "" ) - , m_typo_candidates( std::move( type_candidates ) ) {} -#else - explicit unrecognized_param( std::vector const& type_candidates ) - : specific_param_error( "" ) - , m_typo_candidates( type_candidates ) {} -#endif - ~unrecognized_param() BOOST_NOEXCEPT_OR_NOTHROW {} - - std::vector m_typo_candidates; -}; - -} // namespace runtime -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_RUNTIME_INIT_ERROR_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/finalize.hpp b/libraries/boost/include/boost/test/utils/runtime/finalize.hpp deleted file mode 100644 index 181428550c..0000000000 --- a/libraries/boost/include/boost/test/utils/runtime/finalize.hpp +++ /dev/null @@ -1,56 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : runtime parameters initialization final step -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP -#define BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP - -// Boost.Test Runtime parameters -#include -#include - -// Boost.Test -#include - -#include - -namespace boost { -namespace runtime { - -inline void -finalize_arguments( parameters_store const& params, runtime::arguments_store& args ) -{ - BOOST_TEST_FOREACH( parameters_store::storage_type::value_type const&, v, params.all() ) { - basic_param_ptr param = v.second; - - if( !args.has( param->p_name ) ) { - if( param->p_has_default_value ) - param->produce_default( args ); - - if( !args.has( param->p_name ) ) { - BOOST_TEST_I_ASSRT( param->p_optional, - missing_req_arg( param->p_name ) << "Missing argument for required parameter " << param->p_name << "." ); - } - } - - if( args.has( param->p_name ) && !!param->p_callback ) - param->p_callback( param->p_name ); - } -} - -} // namespace runtime -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_RUNTIME_FINALIZE_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/fwd.hpp b/libraries/boost/include/boost/test/utils/runtime/fwd.hpp deleted file mode 100644 index 17ae881222..0000000000 --- a/libraries/boost/include/boost/test/utils/runtime/fwd.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : runtime parameters forward declaration -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_FWD_HPP -#define BOOST_TEST_UTILS_RUNTIME_FWD_HPP - -// Boost.Test -#include -#include -#include // operator<<(boost::runtime::cstring) - -// Boost -#include - -// STL -#include - -namespace boost { -namespace runtime { - -typedef unit_test::const_string cstring; - -class argument; -typedef shared_ptr argument_ptr; - -template class typed_argument; - -class basic_param; -typedef shared_ptr basic_param_ptr; - -} // namespace runtime -} // namespace boost - -#endif // BOOST_TEST_UTILS_RUNTIME_FWD_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/modifier.hpp b/libraries/boost/include/boost/test/utils/runtime/modifier.hpp deleted file mode 100644 index f4f5a42baa..0000000000 --- a/libraries/boost/include/boost/test/utils/runtime/modifier.hpp +++ /dev/null @@ -1,106 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : parameter modifiers -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP -#define BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP - -// Boost.Test Runtime parameters -#include - -// Boost.Test -#include - -#include - - -// New CLA API available only for some C++11 compilers -#if !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \ - && !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) \ - && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) \ - && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) -#define BOOST_TEST_CLA_NEW_API -#endif - -namespace boost { -namespace runtime { - -// ************************************************************************** // -// ************** environment variable modifiers ************** // -// ************************************************************************** // - -namespace { - -#ifdef BOOST_TEST_CLA_NEW_API -auto const& description = unit_test::static_constant>::value; -auto const& help = unit_test::static_constant>::value; -auto const& env_var = unit_test::static_constant>::value; -auto const& end_of_params = unit_test::static_constant>::value; -auto const& negation_prefix = unit_test::static_constant>::value; -auto const& value_hint = unit_test::static_constant>::value; -auto const& optional_value = unit_test::static_constant>::value; -auto const& default_value = unit_test::static_constant>::value; -auto const& callback = unit_test::static_constant>::value; - -template -using enum_values = unit_test::static_constant< - nfp::typed_keyword>, struct enum_values_t> ->; - -#else - -nfp::typed_keyword description; -nfp::typed_keyword help; -nfp::typed_keyword env_var; -nfp::typed_keyword end_of_params; -nfp::typed_keyword negation_prefix; -nfp::typed_keyword value_hint; -nfp::keyword optional_value; -nfp::keyword default_value; -nfp::keyword callback; - -template -struct enum_values_list { - typedef std::pair ElemT; - typedef std::vector ValuesT; - - enum_values_list const& - operator()( cstring k, EnumType v ) const - { - const_cast(this)->m_values.push_back( ElemT( k, v ) ); - - return *this; - } - - operator ValuesT const&() const { return m_values; } - -private: - ValuesT m_values; -}; - -template -struct enum_values : unit_test::static_constant< - nfp::typed_keyword, struct enum_values_t> > -{ -}; - -#endif - -} // local namespace - -} // namespace runtime -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_RUNTIME_MODIFIER_HPP diff --git a/libraries/boost/include/boost/test/utils/runtime/parameter.hpp b/libraries/boost/include/boost/test/utils/runtime/parameter.hpp deleted file mode 100644 index 420b60264d..0000000000 --- a/libraries/boost/include/boost/test/utils/runtime/parameter.hpp +++ /dev/null @@ -1,526 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : formal parameter definition -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP -#define BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP - -// Boost.Test Runtime parameters -#include -#include -#include -#include - -// Boost.Test -#include -#include -#include - -// Boost -#include -#include - -// STL -#include - -#include - -namespace boost { -namespace runtime { - -inline -std::ostream& commandline_pretty_print( - std::ostream& ostr, - std::string const& prefix, - std::string const& to_print) { - - const int split_at = 80; - - std::string::size_type current = 0; - - while(current < to_print.size()) { - - // discards spaces at the beginning - std::string::size_type startpos = to_print.find_first_not_of(" \t\n", current); - current += startpos - current; - - bool has_more_lines = (current + split_at) < to_print.size(); - - if(has_more_lines) { - std::string::size_type endpos = to_print.find_last_of(" \t\n", current + split_at); - std::string sub(to_print.substr(current, endpos - current)); - ostr << prefix << sub; - ostr << "\n"; - current += endpos - current; - } - else - { - ostr << prefix << to_print.substr(current, split_at); - current += split_at; - } - } - return ostr; -} - -// ************************************************************************** // -// ************** runtime::parameter_cla_id ************** // -// ************************************************************************** // -// set of attributes identifying the parameter in the command line - -struct parameter_cla_id { - parameter_cla_id( cstring prefix, cstring tag, cstring value_separator, bool negatable ) - : m_prefix( prefix.begin(), prefix.size() ) - , m_tag( tag.begin(), tag.size() ) - , m_value_separator( value_separator.begin(), value_separator.size() ) - , m_negatable( negatable ) - { - - BOOST_TEST_I_ASSRT( algorithm::all_of( m_prefix.begin(), m_prefix.end(), valid_prefix_char ), - invalid_cla_id() << "Parameter " << m_tag - << " has invalid characters in prefix." ); - - BOOST_TEST_I_ASSRT( algorithm::all_of( m_tag.begin(), m_tag.end(), valid_name_char ), - invalid_cla_id() << "Parameter " << m_tag - << " has invalid characters in name." ); - - BOOST_TEST_I_ASSRT( algorithm::all_of( m_value_separator.begin(), m_value_separator.end(), valid_separator_char ), - invalid_cla_id() << "Parameter " << m_tag - << " has invalid characters in value separator." ); - } - - static bool valid_prefix_char( char c ) - { - return c == '-' || c == '/' ; - } - static bool valid_separator_char( char c ) - { - return c == '=' || c == ':' || c == ' ' || c == '\0'; - } - static bool valid_name_char( char c ) - { - return std::isalnum( c ) || c == '+' || c == '_' || c == '?'; - } - - std::string m_prefix; - std::string m_tag; - std::string m_value_separator; - bool m_negatable; -}; - -typedef std::vector param_cla_ids; - -// ************************************************************************** // -// ************** runtime::basic_param ************** // -// ************************************************************************** // - -cstring const help_prefix("////"); - -class basic_param { - typedef function callback_type; - typedef unit_test::readwrite_property bool_property; - -protected: - /// Constructor with modifiers - template - basic_param( cstring name, bool is_optional, bool is_repeatable, Modifiers const& m ) - : p_name( name.begin(), name.end() ) - , p_description( nfp::opt_get( m, description, std::string() ) ) - , p_help( nfp::opt_get( m, runtime::help, std::string() ) ) - , p_env_var( nfp::opt_get( m, env_var, std::string() ) ) - , p_value_hint( nfp::opt_get( m, value_hint, std::string() ) ) - , p_optional( is_optional ) - , p_repeatable( is_repeatable ) - , p_has_optional_value( m.has( optional_value ) ) - , p_has_default_value( m.has( default_value ) || is_repeatable ) - , p_callback( nfp::opt_get( m, callback, callback_type() ) ) - { - add_cla_id( help_prefix, name, ":" ); - } - -public: - virtual ~basic_param() {} - - // Pubic properties - std::string const p_name; - std::string const p_description; - std::string const p_help; - std::string const p_env_var; - std::string const p_value_hint; - bool const p_optional; - bool const p_repeatable; - bool_property p_has_optional_value; - bool_property p_has_default_value; - callback_type const p_callback; - - /// interface for cloning typed parameters - virtual basic_param_ptr clone() const = 0; - - /// Access methods - param_cla_ids const& cla_ids() const { return m_cla_ids; } - void add_cla_id( cstring prefix, cstring tag, cstring value_separator ) - { - add_cla_id_impl( prefix, tag, value_separator, false, true ); - } - - /// interface for producing argument values for this parameter - virtual void produce_argument( cstring token, bool negative_form, arguments_store& store ) const = 0; - virtual void produce_default( arguments_store& store ) const = 0; - - /// interfaces for help message reporting - virtual void usage( std::ostream& ostr, cstring negation_prefix_, bool use_color = true ) - { - namespace utils = unit_test::utils; - namespace ut_detail = unit_test::ut_detail; - - // - ostr << " "; - { - - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::GREEN ); - ostr << p_name; - } - - ostr << '\n'; - - if( !p_description.empty() ) { - commandline_pretty_print(ostr, " ", p_description) << '\n'; - } - - BOOST_TEST_FOREACH( parameter_cla_id const&, id, cla_ids() ) { - if( id.m_prefix == help_prefix ) - continue; - - ostr << " " << id.m_prefix; - - if( id.m_negatable ) - cla_name_help( ostr, id.m_tag, negation_prefix_, use_color ); - else - cla_name_help( ostr, id.m_tag, "", use_color ); - - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); - bool optional_value_ = false; - - if( p_has_optional_value ) { - optional_value_ = true; - ostr << '['; - } - - - if( id.m_value_separator.empty() ) - ostr << ' '; - else { - ostr << id.m_value_separator; - } - - value_help( ostr ); - - if( optional_value_ ) - ostr << ']'; - - ostr << '\n'; - } - } - - virtual void help( std::ostream& ostr, cstring negation_prefix_, bool use_color = true ) - { - usage( ostr, negation_prefix_, use_color ); - - if( !p_help.empty() ) { - ostr << '\n'; - commandline_pretty_print(ostr, " ", p_help); - } - } - -protected: - void add_cla_id_impl( cstring prefix, - cstring tag, - cstring value_separator, - bool negatable, - bool validate_value_separator ) - { - BOOST_TEST_I_ASSRT( !tag.is_empty(), - invalid_cla_id() << "Parameter can't have an empty name." ); - - BOOST_TEST_I_ASSRT( !prefix.is_empty(), - invalid_cla_id() << "Parameter " << tag - << " can't have an empty prefix." ); - - BOOST_TEST_I_ASSRT( !value_separator.is_empty(), - invalid_cla_id() << "Parameter " << tag - << " can't have an empty value separator." ); - - // We trim value separator from all the spaces, so token end will indicate separator - value_separator.trim(); - BOOST_TEST_I_ASSRT( !validate_value_separator || !value_separator.is_empty() || !p_has_optional_value, - invalid_cla_id() << "Parameter " << tag - << " with optional value attribute can't use space as value separator." ); - - m_cla_ids.push_back( parameter_cla_id( prefix, tag, value_separator, negatable ) ); - } - -private: - /// interface for usage/help customization - virtual void cla_name_help( std::ostream& ostr, cstring cla_tag, cstring /*negation_prefix_*/, bool /*use_color*/ = true) const - { - ostr << cla_tag; - } - virtual void value_help( std::ostream& ostr ) const - { - if( p_value_hint.empty() ) - ostr << ""; - else - ostr << p_value_hint; - } - - // Data members - param_cla_ids m_cla_ids; -}; - -// ************************************************************************** // -// ************** runtime::parameter ************** // -// ************************************************************************** // - -enum args_amount { - OPTIONAL_PARAM, // 0-1 - REQUIRED_PARAM, // exactly 1 - REPEATABLE_PARAM // 0-N -}; - -//____________________________________________________________________________// - -template -class parameter : public basic_param { -public: - /// Constructor with modifiers -#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS - template - parameter( cstring name, Modifiers const& m = nfp::no_params ) -#else - template - parameter( cstring name, Modifiers const& m ) -#endif - : basic_param( name, a != runtime::REQUIRED_PARAM, a == runtime::REPEATABLE_PARAM, m ) - , m_arg_factory( m ) - { - BOOST_TEST_I_ASSRT( !m.has( default_value ) || a == runtime::OPTIONAL_PARAM, - invalid_param_spec() << "Parameter " << name - << " is not optional and can't have default_value." ); - - BOOST_TEST_I_ASSRT( !m.has( optional_value ) || !this->p_repeatable, - invalid_param_spec() << "Parameter " << name - << " is repeatable and can't have optional_value." ); - } - -private: - virtual basic_param_ptr clone() const - { - return basic_param_ptr( new parameter( *this ) ); - } - virtual void produce_argument( cstring token, bool , arguments_store& store ) const - { - m_arg_factory.produce_argument( token, this->p_name, store ); - } - virtual void produce_default( arguments_store& store ) const - { - if( !this->p_has_default_value ) - return; - - m_arg_factory.produce_default( this->p_name, store ); - } - - // Data members - typedef argument_factory factory_t; - factory_t m_arg_factory; -}; - -//____________________________________________________________________________// - -class option : public basic_param { -public: - /// Constructor with modifiers -#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS - template - option( cstring name, Modifiers const& m = nfp::no_params ) -#else - template - option( cstring name, Modifiers const& m ) -#endif - : basic_param( name, true, false, nfp::opt_append( nfp::opt_append( m, optional_value = true), default_value = false) ) - , m_arg_factory( nfp::opt_append( nfp::opt_append( m, optional_value = true), default_value = false) ) - { - } - - void add_cla_id( cstring prefix, cstring tag, cstring value_separator, bool negatable = false ) - { - add_cla_id_impl( prefix, tag, value_separator, negatable, false ); - } - -private: - virtual basic_param_ptr clone() const - { - return basic_param_ptr( new option( *this ) ); - } - - virtual void produce_argument( cstring token, bool negative_form, arguments_store& store ) const - { - if( token.empty() ) - store.set( p_name, !negative_form ); - else { - BOOST_TEST_I_ASSRT( !negative_form, - format_error( p_name ) << "Can't set value to negative form of the argument." ); - - m_arg_factory.produce_argument( token, p_name, store ); - } - } - - virtual void produce_default( arguments_store& store ) const - { - m_arg_factory.produce_default( p_name, store ); - } - virtual void cla_name_help( std::ostream& ostr, cstring cla_tag, cstring negation_prefix_, bool use_color = true ) const - { - namespace utils = unit_test::utils; - namespace ut_detail = unit_test::ut_detail; - - if( !negation_prefix_.is_empty() ) { - BOOST_TEST_SCOPE_SETCOLOR( use_color, ostr, term_attr::BRIGHT, term_color::YELLOW ); - ostr << '[' << negation_prefix_ << ']'; - } - ostr << cla_tag; - } - virtual void value_help( std::ostream& ostr ) const - { - if( p_value_hint.empty() ) - ostr << ""; - else - ostr << p_value_hint; - } - - // Data members - typedef argument_factory factory_t; - factory_t m_arg_factory; -}; - -//____________________________________________________________________________// - -template -class enum_parameter : public parameter { - typedef parameter base; -public: - /// Constructor with modifiers -#ifndef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS - template - enum_parameter( cstring name, Modifiers const& m = nfp::no_params ) -#else - template - enum_parameter( cstring name, Modifiers const& m ) -#endif - : base( name, m ) - { -#ifdef BOOST_TEST_CLA_NEW_API - auto const& values = m[enum_values::value]; - auto it = values.begin(); -#else - std::vector > const& values = m[enum_values::value]; - typename std::vector >::const_iterator it = values.begin(); -#endif - while( it != values.end() ) { - m_valid_names.push_back( it->first ); - ++it; - } - } - -private: - virtual basic_param_ptr clone() const - { - return basic_param_ptr( new enum_parameter( *this ) ); - } - - virtual void value_help( std::ostream& ostr ) const - { - if( this->p_value_hint.empty() ) { - ostr << "<"; - bool first = true; - BOOST_TEST_FOREACH( cstring, name, m_valid_names ) { - if( first ) - first = false; - else - ostr << '|'; - ostr << name; - } - ostr << ">"; - } - else - ostr << this->p_value_hint; - } - - // Data members - std::vector m_valid_names; -}; - - -// ************************************************************************** // -// ************** runtime::parameters_store ************** // -// ************************************************************************** // - -class parameters_store { - struct lg_compare { - bool operator()( cstring lh, cstring rh ) const - { - return std::lexicographical_compare(lh.begin(), lh.end(), - rh.begin(), rh.end()); - } - }; -public: - - typedef std::map storage_type; - - /// Adds parameter into the persistent store - void add( basic_param const& in ) - { - basic_param_ptr p = in.clone(); - - BOOST_TEST_I_ASSRT( m_parameters.insert( std::make_pair( cstring(p->p_name), p ) ).second, - duplicate_param() << "Parameter " << p->p_name << " is duplicate." ); - } - - /// Returns true if there is no parameters registered - bool is_empty() const { return m_parameters.empty(); } - /// Returns map of all the registered parameter - storage_type const& all() const { return m_parameters; } - /// Returns true if parameter with psecified name is registered - bool has( cstring name ) const - { - return m_parameters.find( name ) != m_parameters.end(); - } - /// Returns map of all the registered parameter - basic_param_ptr get( cstring name ) const - { - storage_type::const_iterator const& found = m_parameters.find( name ); - BOOST_TEST_I_ASSRT( found != m_parameters.end(), - unknown_param() << "Parameter " << name << " is unknown." ); - - return found->second; - } - -private: - // Data members - storage_type m_parameters; -}; - -} // namespace runtime -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP diff --git a/libraries/boost/include/boost/test/utils/setcolor.hpp b/libraries/boost/include/boost/test/utils/setcolor.hpp deleted file mode 100644 index 91b068ae6f..0000000000 --- a/libraries/boost/include/boost/test/utils/setcolor.hpp +++ /dev/null @@ -1,315 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : contains definition for setcolor iostream manipulator -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_SETCOLOR_HPP -#define BOOST_TEST_UTILS_SETCOLOR_HPP - -// Boost.Test -#include - -// STL -#include -#include - -#include - -#ifdef _WIN32 - #include - - #if defined(__MINGW32__) && !defined(COMMON_LVB_UNDERSCORE) - // mingw badly mimicking windows.h - #define COMMON_LVB_UNDERSCORE 0x8000 - #endif -#endif - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** term_attr ************** // -// ************************************************************************** // - -struct term_attr { enum _ { - NORMAL = 0, - BRIGHT = 1, - DIM = 2, - UNDERLINE = 4, - BLINK = 5, - REVERSE = 7, - CROSSOUT = 9 -}; }; - -// ************************************************************************** // -// ************** term_color ************** // -// ************************************************************************** // - -struct term_color { enum _ { - BLACK = 0, - RED = 1, - GREEN = 2, - YELLOW = 3, - BLUE = 4, - MAGENTA = 5, - CYAN = 6, - WHITE = 7, - ORIGINAL = 9 -}; }; - -// ************************************************************************** // -// ************** setcolor ************** // -// ************************************************************************** // - -#ifndef _WIN32 -class setcolor { -public: - // Constructor - explicit setcolor( term_attr::_ attr = term_attr::NORMAL, - term_color::_ fg = term_color::ORIGINAL, - term_color::_ bg = term_color::ORIGINAL ) - { - m_command_size = std::sprintf( m_control_command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40 ); - } - - friend std::ostream& - operator<<( std::ostream& os, setcolor const& sc ) - { - if (&os == &std::cout || &os == &std::cerr) { - return os.write( sc.m_control_command, sc.m_command_size ); - } - return os; - } - -private: - // Data members - char m_control_command[13]; - int m_command_size; -}; - -#else - -class setcolor { - -protected: - void set_console_color(std::ostream& os, WORD *attributes = NULL) const { - DWORD console_type; - if (&os == &std::cout) { - console_type = STD_OUTPUT_HANDLE; - } - else if (&os == &std::cerr) { - console_type = STD_ERROR_HANDLE; - } - else { - return; - } - HANDLE hConsole = GetStdHandle(console_type); - - if(hConsole == INVALID_HANDLE_VALUE || hConsole == NULL ) - return; - - if(attributes != NULL) { - SetConsoleTextAttribute(hConsole, *attributes); - return; - } - - CONSOLE_SCREEN_BUFFER_INFO consoleInfo; - GetConsoleScreenBufferInfo(hConsole, &consoleInfo); - //if(!has_written_console_ext) { - saved_attributes = consoleInfo.wAttributes; - //} - - WORD fg_attr = 0; - switch(m_fg) - { - case term_color::WHITE: - fg_attr = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; - break; - case term_color::BLACK: - fg_attr = 0; - break; - case term_color::RED: - fg_attr = FOREGROUND_RED; - break; - case term_color::GREEN: - fg_attr = FOREGROUND_GREEN; - break; - case term_color::CYAN: - fg_attr = FOREGROUND_GREEN | FOREGROUND_BLUE; - break; - case term_color::MAGENTA: - fg_attr = FOREGROUND_RED | FOREGROUND_BLUE; - break; - case term_color::BLUE: - fg_attr = FOREGROUND_BLUE; - break; - case term_color::YELLOW: - fg_attr = FOREGROUND_RED | FOREGROUND_GREEN; - break; - case term_color::ORIGINAL: - default: - fg_attr = saved_attributes & (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); - break; - } - - WORD bg_attr = 0; - switch(m_bg) - { - case term_color::BLACK: - bg_attr = 0; - break; - case term_color::WHITE: - bg_attr = BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE; - break; - case term_color::RED: - bg_attr = BACKGROUND_RED; - break; - case term_color::GREEN: - bg_attr = BACKGROUND_GREEN; - break; - case term_color::BLUE: - bg_attr = BACKGROUND_BLUE; - break; - case term_color::ORIGINAL: - default: - bg_attr = saved_attributes & (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE); - break; - } - - WORD text_attr = 0; - switch(m_attr) - { - case term_attr::BRIGHT: - text_attr = FOREGROUND_INTENSITY; - break; - case term_attr::UNDERLINE: - text_attr = COMMON_LVB_UNDERSCORE; - break; - default: - break; - } - - SetConsoleTextAttribute(hConsole, fg_attr | bg_attr | text_attr); - - //has_written_console_ext = true; - return; - } - -public: - // Constructor - explicit setcolor( - term_attr::_ attr = term_attr::NORMAL, - term_color::_ fg = term_color::ORIGINAL, - term_color::_ bg = term_color::ORIGINAL ) - : /*has_written_console_ext(false) - , */m_attr(attr) - , m_fg(fg) - , m_bg(bg) - {} - - friend std::ostream& - operator<<( std::ostream& os, setcolor const& sc ) - { - sc.set_console_color(os); - return os; - } - -private: - term_attr::_ m_attr; - term_color::_ m_fg; - term_color::_ m_bg; - -protected: - // Data members - mutable WORD saved_attributes; - //mutable bool has_written_console_ext; -}; - -#endif -// ************************************************************************** // -// ************** scope_setcolor ************** // -// ************************************************************************** // - -#ifndef _WIN32 - -struct scope_setcolor { - scope_setcolor() : m_os( 0 ) {} - explicit scope_setcolor( std::ostream& os, - term_attr::_ attr = term_attr::NORMAL, - term_color::_ fg = term_color::ORIGINAL, - term_color::_ bg = term_color::ORIGINAL ) - : m_os( &os ) - { - os << setcolor( attr, fg, bg ); - } - ~scope_setcolor() - { - if( m_os ) - *m_os << setcolor(); - } -private: - scope_setcolor(const scope_setcolor& r); - scope_setcolor& operator=(const scope_setcolor& r); - // Data members - std::ostream* m_os; -}; - -#else - -struct scope_setcolor : setcolor { - scope_setcolor() : m_os( 0 ) {} - explicit scope_setcolor( - std::ostream& os, - term_attr::_ attr = term_attr::NORMAL, - term_color::_ fg = term_color::ORIGINAL, - term_color::_ bg = term_color::ORIGINAL ) - : - setcolor(attr, fg, bg), - m_os( &os ) - { - os << *this; - } - - ~scope_setcolor() - { - if (m_os) { - set_console_color(*m_os, &this->saved_attributes); - } - } -private: - scope_setcolor(const scope_setcolor& r); - scope_setcolor& operator=(const scope_setcolor& r); - // Data members - std::ostream* m_os; -}; - - -#endif - -#define BOOST_TEST_SCOPE_SETCOLOR( is_color_output, os, attr, color ) \ - utils::scope_setcolor const sc( \ - os, \ - is_color_output ? utils::attr : utils::term_attr::NORMAL, \ - is_color_output ? utils::color : utils::term_color::ORIGINAL);\ - ut_detail::ignore_unused_variable_warning( sc ) \ -/**/ - -} // namespace utils -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_SETCOLOR_HPP diff --git a/libraries/boost/include/boost/test/utils/string_cast.hpp b/libraries/boost/include/boost/test/utils/string_cast.hpp deleted file mode 100644 index 3c069a8403..0000000000 --- a/libraries/boost/include/boost/test/utils/string_cast.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : trivial utility to cast to/from strings -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_STRING_CAST_HPP -#define BOOST_TEST_UTILS_STRING_CAST_HPP - -// Boost.Test -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** string_cast ************** // -// ************************************************************************** // - -template -inline std::string -string_cast( T const& t ) -{ - std::ostringstream buff; - buff << t; - return buff.str(); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** string_as ************** // -// ************************************************************************** // - -template -inline bool -string_as( const_string str, T& res ) -{ - std::istringstream buff( std::string( str.begin(), str.end() ) ); - buff >> res; - - return !buff.fail() && buff.eof(); -} - -//____________________________________________________________________________// - -} // namespace utils -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_STRING_CAST_HPP diff --git a/libraries/boost/include/boost/test/utils/trivial_singleton.hpp b/libraries/boost/include/boost/test/utils/trivial_singleton.hpp deleted file mode 100644 index ac612b6393..0000000000 --- a/libraries/boost/include/boost/test/utils/trivial_singleton.hpp +++ /dev/null @@ -1,79 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : simple helpers for creating cusom output manipulators -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP -#define BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP - -// Boost.Test -#include -#include - -// Boost -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { - -// ************************************************************************** // -// ************** singleton ************** // -// ************************************************************************** // - -template -class singleton { -public: - static Derived& instance() { static Derived the_inst; return the_inst; } - - BOOST_DELETED_FUNCTION(singleton(singleton const&)) - BOOST_DELETED_FUNCTION(singleton& operator=(singleton const&)) - -protected: - BOOST_DEFAULTED_FUNCTION(singleton(), {}) - BOOST_DEFAULTED_FUNCTION(~singleton(), {}) -}; - -//____________________________________________________________________________// - -#define BOOST_TEST_SINGLETON_CONS( type ) \ -friend class boost::unit_test::singleton; \ -type() {} \ -/**/ - -#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) - -#define BOOST_TEST_SINGLETON_INST( inst ) \ -template class unit_test::singleton< BOOST_JOIN( inst, _t ) > ; \ -namespace { BOOST_JOIN( inst, _t)& inst = BOOST_JOIN( inst, _t)::instance(); } - -#elif defined(__APPLE_CC__) && defined(__GNUC__) && __GNUC__ < 4 -#define BOOST_TEST_SINGLETON_INST( inst ) \ -static BOOST_JOIN( inst, _t)& inst = BOOST_JOIN (inst, _t)::instance(); - -#else - -#define BOOST_TEST_SINGLETON_INST( inst ) \ -namespace { BOOST_JOIN( inst, _t)& inst = BOOST_JOIN( inst, _t)::instance(); } - -#endif - -//____________________________________________________________________________// - -} // namespace unit_test -} // namespace boost - - -#include - -#endif // BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP diff --git a/libraries/boost/include/boost/test/utils/wrap_stringstream.hpp b/libraries/boost/include/boost/test/utils/wrap_stringstream.hpp deleted file mode 100644 index 425d7ed75b..0000000000 --- a/libraries/boost/include/boost/test/utils/wrap_stringstream.hpp +++ /dev/null @@ -1,162 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : wraps strstream and stringstream (depends with one is present) -// to provide the unified interface -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP -#define BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP - -// Boost.Test -#include - -// STL -#ifdef BOOST_NO_STRINGSTREAM -#include // for std::ostrstream -#else -#include // for std::ostringstream -#endif // BOOST_NO_STRINGSTREAM - -#include - -//____________________________________________________________________________// - -namespace boost { - -// ************************************************************************** // -// ************** basic_wrap_stringstream ************** // -// ************************************************************************** // - -template -class basic_wrap_stringstream { -public: -#if defined(BOOST_CLASSIC_IOSTREAMS) - typedef std::ostringstream wrapped_stream; -#elif defined(BOOST_NO_STRINGSTREAM) - typedef std::basic_ostrstream wrapped_stream; -#else - typedef std::basic_ostringstream wrapped_stream; -#endif // BOOST_NO_STRINGSTREAM - // Access methods - basic_wrap_stringstream& ref(); - wrapped_stream& stream(); - std::basic_string const& str(); - -private: - // Data members - wrapped_stream m_stream; - std::basic_string m_str; -}; - -//____________________________________________________________________________// - -template -inline basic_wrap_stringstream& -operator<<( basic_wrap_stringstream& targ, T const& t ) -{ - targ.stream() << t; - return targ; -} - -//____________________________________________________________________________// - -template -inline typename basic_wrap_stringstream::wrapped_stream& -basic_wrap_stringstream::stream() -{ - return m_stream; -} - -//____________________________________________________________________________// - -template -inline basic_wrap_stringstream& -basic_wrap_stringstream::ref() -{ - return *this; -} - -//____________________________________________________________________________// - -template -inline std::basic_string const& -basic_wrap_stringstream::str() -{ - -#ifdef BOOST_NO_STRINGSTREAM - m_str.assign( m_stream.str(), m_stream.pcount() ); - m_stream.freeze( false ); -#else - m_str = m_stream.str(); -#endif - - return m_str; -} - -//____________________________________________________________________________// - -template -inline basic_wrap_stringstream& -operator<<( basic_wrap_stringstream& targ, basic_wrap_stringstream& src ) -{ - targ << src.str(); - return targ; -} - -//____________________________________________________________________________// - -#if BOOST_TEST_USE_STD_LOCALE - -template -inline basic_wrap_stringstream& -operator<<( basic_wrap_stringstream& targ, std::ios_base& (BOOST_TEST_CALL_DECL *man)(std::ios_base&) ) -{ - targ.stream() << man; - return targ; -} - -//____________________________________________________________________________// - -template -inline basic_wrap_stringstream& -operator<<( basic_wrap_stringstream& targ, std::basic_ostream& (BOOST_TEST_CALL_DECL *man)(std::basic_ostream&) ) -{ - targ.stream() << man; - return targ; -} - -//____________________________________________________________________________// - -template -inline basic_wrap_stringstream& -operator<<( basic_wrap_stringstream& targ, std::basic_ios& (BOOST_TEST_CALL_DECL *man)(std::basic_ios&) ) -{ - targ.stream() << man; - return targ; -} - -//____________________________________________________________________________// - -#endif - -// ************************************************************************** // -// ************** wrap_stringstream ************** // -// ************************************************************************** // - -typedef basic_wrap_stringstream wrap_stringstream; -typedef basic_wrap_stringstream wrap_wstringstream; - -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP diff --git a/libraries/boost/include/boost/test/utils/xml_printer.hpp b/libraries/boost/include/boost/test/utils/xml_printer.hpp deleted file mode 100644 index ffaf8fcc05..0000000000 --- a/libraries/boost/include/boost/test/utils/xml_printer.hpp +++ /dev/null @@ -1,143 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : common code used by any agent serving as OF_XML printer -// *************************************************************************** - -#ifndef BOOST_TEST_UTILS_XML_PRINTER_HPP -#define BOOST_TEST_UTILS_XML_PRINTER_HPP - -// Boost.Test -#include -#include -#include -#include - -// Boost -#include - -// STL -#include - -#include - -//____________________________________________________________________________// - -namespace boost { -namespace unit_test { -namespace utils { - -// ************************************************************************** // -// ************** xml print helpers ************** // -// ************************************************************************** // - -inline void -print_escaped( std::ostream& where_to, const_string value ) -{ -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) - static std::map const char_type{{ - {'<' , "lt"}, - {'>' , "gt"}, - {'&' , "amp"}, - {'\'', "apos"}, - {'"' , "quot"} - }}; -#else - static std::map char_type; - - if( char_type.empty() ) { - char_type['<'] = "lt"; - char_type['>'] = "gt"; - char_type['&'] = "amp"; - char_type['\'']= "apos"; - char_type['"'] = "quot"; - } -#endif - - BOOST_TEST_FOREACH( char, c, value ) { - std::map::const_iterator found_ref = char_type.find( c ); - - if( found_ref != char_type.end() ) - where_to << '&' << found_ref->second << ';'; - else - where_to << c; - } -} - -//____________________________________________________________________________// - -inline void -print_escaped( std::ostream& where_to, std::string const& value ) -{ - print_escaped( where_to, const_string( value ) ); -} - -//____________________________________________________________________________// - -template -inline void -print_escaped( std::ostream& where_to, T const& value ) -{ - where_to << value; -} - -//____________________________________________________________________________// - -inline void -print_escaped_cdata( std::ostream& where_to, const_string value ) -{ - static const_string cdata_end( "]]>" ); - - const_string::size_type pos = value.find( cdata_end ); - if( pos == const_string::npos ) - where_to << value; - else { - where_to << value.substr( 0, pos+2 ) << cdata_end - << BOOST_TEST_L( " attr_value; - -template -inline std::ostream& -operator<<( custom_printer const& p, T const& value ) -{ - *p << "=\""; - print_escaped( *p, value ); - *p << '"'; - - return *p; -} - -//____________________________________________________________________________// - -typedef custom_manip cdata; - -inline std::ostream& -operator<<( custom_printer const& p, const_string value ) -{ - *p << BOOST_TEST_L( "" ); -} - -//____________________________________________________________________________// - -} // namespace utils -} // namespace unit_test -} // namespace boost - -#include - -#endif // BOOST_TEST_UTILS_XML_PRINTER_HPP diff --git a/libraries/boost/include/boost/throw_exception.hpp b/libraries/boost/include/boost/throw_exception.hpp deleted file mode 100644 index aa977dfc79..0000000000 --- a/libraries/boost/include/boost/throw_exception.hpp +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef UUID_AA15E74A856F11E08B8D93F24824019B -#define UUID_AA15E74A856F11E08B8D93F24824019B -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma GCC system_header -#endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(push,1) -#endif - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/throw_exception.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2008-2009 Emil Dotchevski and Reverge Studios, Inc. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// http://www.boost.org/libs/utility/throw_exception.html -// - -#include -#include -#include - -#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) ) -# define BOOST_EXCEPTION_DISABLE -#endif - -#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1310 ) -# define BOOST_EXCEPTION_DISABLE -#endif - -#if !defined( BOOST_EXCEPTION_DISABLE ) -# include -#if !defined(BOOST_THROW_EXCEPTION_CURRENT_FUNCTION) -# include -# define BOOST_THROW_EXCEPTION_CURRENT_FUNCTION BOOST_CURRENT_FUNCTION -#endif -# define BOOST_THROW_EXCEPTION(x) ::boost::exception_detail::throw_exception_(x,BOOST_THROW_EXCEPTION_CURRENT_FUNCTION,__FILE__,__LINE__) -#else -# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x) -#endif - -namespace boost -{ -#ifdef BOOST_NO_EXCEPTIONS - -void throw_exception( std::exception const & e ); // user defined - -#else - -inline void throw_exception_assert_compatibility( std::exception const & ) { } - -template BOOST_NORETURN inline void throw_exception( E const & e ) -{ - //All boost exceptions are required to derive from std::exception, - //to ensure compatibility with BOOST_NO_EXCEPTIONS. - throw_exception_assert_compatibility(e); - -#ifndef BOOST_EXCEPTION_DISABLE - throw enable_current_exception(enable_error_info(e)); -#else - throw e; -#endif -} - -#endif - -#if !defined( BOOST_EXCEPTION_DISABLE ) - namespace - exception_detail - { - template - BOOST_NORETURN - void - throw_exception_( E const & x, char const * current_function, char const * file, int line ) - { - boost::throw_exception( - set_info( - set_info( - set_info( - enable_error_info(x), - throw_function(current_function)), - throw_file(file)), - throw_line(line))); - } - } -#endif -} // namespace boost - -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(pop) -#endif -#endif diff --git a/libraries/boost/include/boost/timer.hpp b/libraries/boost/include/boost/timer.hpp deleted file mode 100644 index 1e3571e417..0000000000 --- a/libraries/boost/include/boost/timer.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// boost timer.hpp header file ---------------------------------------------// - -// Copyright Beman Dawes 1994-99. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/timer for documentation. - -// Revision History -// 01 Apr 01 Modified to use new header. (JMaddock) -// 12 Jan 01 Change to inline implementation to allow use without library -// builds. See docs for more rationale. (Beman Dawes) -// 25 Sep 99 elapsed_max() and elapsed_min() added (John Maddock) -// 16 Jul 99 Second beta -// 6 Jul 99 Initial boost version - -#ifndef BOOST_TIMER_HPP -#define BOOST_TIMER_HPP - -#include -#include -#include - -# ifdef BOOST_NO_STDC_NAMESPACE - namespace std { using ::clock_t; using ::clock; } -# endif - - -namespace boost { - -// timer -------------------------------------------------------------------// - -// A timer object measures elapsed time. - -// It is recommended that implementations measure wall clock rather than CPU -// time since the intended use is performance measurement on systems where -// total elapsed time is more important than just process or CPU time. - -// Warnings: The maximum measurable elapsed time may well be only 596.5+ hours -// due to implementation limitations. The accuracy of timings depends on the -// accuracy of timing information provided by the underlying platform, and -// this varies a great deal from platform to platform. - -class timer -{ - public: - timer() { _start_time = std::clock(); } // postcondition: elapsed()==0 -// timer( const timer& src ); // post: elapsed()==src.elapsed() -// ~timer(){} -// timer& operator=( const timer& src ); // post: elapsed()==src.elapsed() - void restart() { _start_time = std::clock(); } // post: elapsed()==0 - double elapsed() const // return elapsed time in seconds - { return double(std::clock() - _start_time) / CLOCKS_PER_SEC; } - - double elapsed_max() const // return estimated maximum value for elapsed() - // Portability warning: elapsed_max() may return too high a value on systems - // where std::clock_t overflows or resets at surprising values. - { - return (double((std::numeric_limits::max)()) - - double(_start_time)) / double(CLOCKS_PER_SEC); - } - - double elapsed_min() const // return minimum value for elapsed() - { return double(1)/double(CLOCKS_PER_SEC); } - - private: - std::clock_t _start_time; -}; // timer - -} // namespace boost - -#endif // BOOST_TIMER_HPP diff --git a/libraries/boost/include/boost/type.hpp b/libraries/boost/include/boost/type.hpp deleted file mode 100644 index ab81c916d7..0000000000 --- a/libraries/boost/include/boost/type.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// (C) Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_TYPE_DWA20010120_HPP -# define BOOST_TYPE_DWA20010120_HPP - -namespace boost { - - // Just a simple "type envelope". Useful in various contexts, mostly to work - // around some MSVC deficiencies. - template - struct type {}; - -} - -#endif // BOOST_TYPE_DWA20010120_HPP diff --git a/libraries/boost/include/boost/type_index.hpp b/libraries/boost/include/boost/type_index.hpp deleted file mode 100644 index 5311ac8795..0000000000 --- a/libraries/boost/include/boost/type_index.hpp +++ /dev/null @@ -1,265 +0,0 @@ -// -// Copyright (c) Antony Polukhin, 2012-2018. -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_TYPE_INDEX_HPP -#define BOOST_TYPE_INDEX_HPP - -/// \file boost/type_index.hpp -/// \brief Includes minimal set of headers required to use the Boost.TypeIndex library. -/// -/// By inclusion of this file most optimal type index classes will be included and used -/// as a boost::typeindex::type_index and boost::typeindex::type_info. - -#include - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -#if defined(BOOST_TYPE_INDEX_USER_TYPEINDEX) -# include BOOST_TYPE_INDEX_USER_TYPEINDEX -# ifdef BOOST_HAS_PRAGMA_DETECT_MISMATCH -# pragma detect_mismatch( "boost__type_index__abi", "user defined type_index class is used: " BOOST_STRINGIZE(BOOST_TYPE_INDEX_USER_TYPEINDEX)) -# endif -#elif (!defined(BOOST_NO_RTTI) && !defined(BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)) || defined(BOOST_MSVC) -# include -# if defined(BOOST_NO_RTTI) || defined(BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY) -# include -# ifdef BOOST_HAS_PRAGMA_DETECT_MISMATCH -# pragma detect_mismatch( "boost__type_index__abi", "RTTI is off - typeid() is used only for templates") -# endif -# else -# ifdef BOOST_HAS_PRAGMA_DETECT_MISMATCH -# pragma detect_mismatch( "boost__type_index__abi", "RTTI is used") -# endif -# endif -#else -# include -# include -# ifdef BOOST_HAS_PRAGMA_DETECT_MISMATCH -# pragma detect_mismatch( "boost__type_index__abi", "RTTI is off - using CTTI") -# endif -#endif - -#ifndef BOOST_TYPE_INDEX_REGISTER_CLASS -#define BOOST_TYPE_INDEX_REGISTER_CLASS -#endif - -namespace boost { namespace typeindex { - -#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) - -/// \def BOOST_TYPE_INDEX_FUNCTION_SIGNATURE -/// BOOST_TYPE_INDEX_FUNCTION_SIGNATURE is used by boost::typeindex::ctti_type_index class to -/// deduce the name of a type. If your compiler is not recognized -/// by the TypeIndex library and you wish to work with boost::typeindex::ctti_type_index, you may -/// define this macro by yourself. -/// -/// BOOST_TYPE_INDEX_FUNCTION_SIGNATURE must be defined to a compiler specific macro -/// that outputs the \b whole function signature \b including \b template \b parameters. -/// -/// If your compiler is not recognised and BOOST_TYPE_INDEX_FUNCTION_SIGNATURE is not defined, -/// then a compile-time error will arise at any attempt to use boost::typeindex::ctti_type_index classes. -/// -/// See BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS and BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING -/// for an information of how to tune the implementation to make a nice pretty_name() output. -#define BOOST_TYPE_INDEX_FUNCTION_SIGNATURE BOOST_CURRENT_FUNCTION - -/// \def BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING -/// This is a helper macro for making correct pretty_names() with RTTI off. -/// -/// BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING macro may be defined to -/// '(begin_skip, end_skip, runtime_skip, runtime_skip_until)' with parameters for adding a -/// support for compilers, that by default are not recognized by TypeIndex library. -/// -/// \b Example: -/// -/// Imagine the situation when -/// \code boost::typeindex::ctti_type_index::type_id().pretty_name() \endcode -/// returns the following string: -/// \code "static const char *boost::detail::ctti::n() [T = int]" \endcode -/// and \code boost::typeindex::ctti_type_index::type_id().pretty_name() \endcode returns the following: -/// \code "static const char *boost::detail::ctti::n() [T = short]" \endcode -/// -/// As we may see first 39 characters are "static const char *boost::detail::ctti<" and they do not depend on -/// the type T. After first 39 characters we have a human readable type name which is duplicated at the end -/// of a string. String always ends on ']', which consumes 1 character. -/// -/// Now if we define `BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING` to -/// `(39, 1, false, "")` we'll be getting \code "int>::n() [T = int" \endcode -/// for `boost::typeindex::ctti_type_index::type_id().pretty_name()` and \code "short>::n() [T = short" \endcode -/// for `boost::typeindex::ctti_type_index::type_id().pretty_name()`. -/// -/// Now we need to take additional care of the characters that go before the last mention of our type. We'll -/// do that by telling the macro that we need to cut off everything that goes before the "T = " including the "T = " -/// itself: -/// -/// \code (39, 1, true, "T = ") \endcode -/// -/// In case of GCC or Clang command line we need to add the following line while compiling all the sources: -/// -/// \code -/// -DBOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING='(39, 1, true, "T = ")' -/// \endcode -/// \param begin_skip How many characters must be skipped at the beginning of the type holding string. -/// Must be a compile time constant. -/// \param end_skip How many characters must be skipped at the end of the type holding string. -/// Must be a compile time constant. -/// \param runtime_skip Do we need additional checks at runtime to cut off the more characters. -/// Must be `true` or `false`. -/// \param runtime_skip_until Skip all the characters before the following string (including the string itself). -/// Must be a compile time array of characters. -/// -/// See [RTTI emulation limitations](boost_typeindex/rtti_emulation_limitations.html) for more info. -#define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING (0, 0, false, "") - - - /// Depending on a compiler flags, optimal implementation of type_index will be used - /// as a default boost::typeindex::type_index. - /// - /// Could be a boost::typeindex::stl_type_index, boost::typeindex::ctti_type_index or - /// user defined type_index class. - /// - /// \b See boost::typeindex::type_index_facade for a full description of type_index functions. - typedef platform_specific type_index; -#elif defined(BOOST_TYPE_INDEX_USER_TYPEINDEX) - // Nothing to do -#elif (!defined(BOOST_NO_RTTI) && !defined(BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)) || defined(BOOST_MSVC) - typedef boost::typeindex::stl_type_index type_index; -#else - typedef boost::typeindex::ctti_type_index type_index; -#endif - -/// Depending on a compiler flags, optimal implementation of type_info will be used -/// as a default boost::typeindex::type_info. -/// -/// Could be a std::type_info, boost::typeindex::detail::ctti_data or -/// some user defined class. -/// -/// type_info \b is \b not copyable or default constructible. It is \b not assignable too! -typedef type_index::type_info_t type_info; - -#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) - -/// \def BOOST_TYPE_INDEX_USER_TYPEINDEX -/// BOOST_TYPE_INDEX_USER_TYPEINDEX can be defined to the path to header file -/// with user provided implementation of type_index. -/// -/// See [Making a custom type_index](boost_typeindex/making_a_custom_type_index.html) section -/// of documentation for usage example. -#define BOOST_TYPE_INDEX_USER_TYPEINDEX - - -/// \def BOOST_TYPE_INDEX_REGISTER_CLASS -/// BOOST_TYPE_INDEX_REGISTER_CLASS is used to help to emulate RTTI. -/// Put this macro into the public section of polymorphic class to allow runtime type detection. -/// -/// Depending on the typeid() availability this macro will expand to nothing or to virtual helper function -/// `virtual const type_info& boost_type_info_type_id_runtime_() const noexcept`. -/// -/// \b Example: -/// \code -/// class A { -/// public: -/// BOOST_TYPE_INDEX_REGISTER_CLASS -/// virtual ~A(){} -/// }; -/// -/// struct B: public A { -/// BOOST_TYPE_INDEX_REGISTER_CLASS -/// }; -/// -/// struct C: public B { -/// BOOST_TYPE_INDEX_REGISTER_CLASS -/// }; -/// -/// ... -/// -/// C c1; -/// A* pc1 = &c1; -/// assert(boost::typeindex::type_id() == boost::typeindex::type_id_runtime(*pc1)); -/// \endcode -#define BOOST_TYPE_INDEX_REGISTER_CLASS nothing-or-some-virtual-functions - -/// \def BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY -/// BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY is a helper macro that must be defined if mixing -/// RTTI on/off modules. See -/// [Mixing sources with RTTI on and RTTI off](boost_typeindex/mixing_sources_with_rtti_on_and_.html) -/// section of documentation for more info. -#define BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY - -#endif // defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) - - -/// Function to get boost::typeindex::type_index for a type T. -/// Removes const, volatile && and & modifiers from T. -/// -/// \b Example: -/// \code -/// type_index ti = type_id(); -/// std::cout << ti.pretty_name(); // Outputs 'int' -/// \endcode -/// -/// \tparam T Type for which type_index must be created. -/// \throw Nothing. -/// \return boost::typeindex::type_index with information about the specified type T. -template -inline type_index type_id() BOOST_NOEXCEPT { - return type_index::type_id(); -} - -/// Function for constructing boost::typeindex::type_index instance for type T. -/// Does not remove const, volatile, & and && modifiers from T. -/// -/// If T has no const, volatile, & and && modifiers, then returns exactly -/// the same result as in case of calling `type_id()`. -/// -/// \b Example: -/// \code -/// type_index ti = type_id_with_cvr(); -/// std::cout << ti.pretty_name(); // Outputs 'int&' -/// \endcode -/// -/// \tparam T Type for which type_index must be created. -/// \throw Nothing. -/// \return boost::typeindex::type_index with information about the specified type T. -template -inline type_index type_id_with_cvr() BOOST_NOEXCEPT { - return type_index::type_id_with_cvr(); -} - -/// Function that works exactly like C++ typeid(rtti_val) call, but returns boost::type_index. -/// -/// Returns runtime information about specified type. -/// -/// \b Requirements: RTTI available or Base and Derived classes must be marked with BOOST_TYPE_INDEX_REGISTER_CLASS. -/// -/// \b Example: -/// \code -/// struct Base { virtual ~Base(){} }; -/// struct Derived: public Base {}; -/// ... -/// Derived d; -/// Base& b = d; -/// type_index ti = type_id_runtime(b); -/// std::cout << ti.pretty_name(); // Outputs 'Derived' -/// \endcode -/// -/// \param runtime_val Variable which runtime type must be returned. -/// \throw Nothing. -/// \return boost::typeindex::type_index with information about the specified variable. -template -inline type_index type_id_runtime(const T& runtime_val) BOOST_NOEXCEPT { - return type_index::type_id_runtime(runtime_val); -} - -}} // namespace boost::typeindex - - - -#endif // BOOST_TYPE_INDEX_HPP - diff --git a/libraries/boost/include/boost/type_index/ctti_type_index.hpp b/libraries/boost/include/boost/type_index/ctti_type_index.hpp deleted file mode 100644 index a59b2d80a7..0000000000 --- a/libraries/boost/include/boost/type_index/ctti_type_index.hpp +++ /dev/null @@ -1,213 +0,0 @@ -// -// Copyright (c) Antony Polukhin, 2013-2018. -// -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_TYPE_INDEX_CTTI_TYPE_INDEX_HPP -#define BOOST_TYPE_INDEX_CTTI_TYPE_INDEX_HPP - -/// \file ctti_type_index.hpp -/// \brief Contains boost::typeindex::ctti_type_index class that is constexpr if C++14 constexpr is supported by compiler. -/// -/// boost::typeindex::ctti_type_index class can be used as a drop-in replacement -/// for std::type_index. -/// -/// It is used in situations when typeid() method is not available or -/// BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY macro is defined. - -#include -#include - -#include -#include -#include -#include -#include - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -namespace boost { namespace typeindex { - -namespace detail { - -// That's the most trickiest part of the TypeIndex library: -// 1) we do not want to give user ability to manually construct and compare `struct-that-represents-type` -// 2) we need to distinguish between `struct-that-represents-type` and `const char*` -// 3) we need a thread-safe way to have references to instances `struct-that-represents-type` -// 4) we need a compile-time control to make sure that user does not copy or -// default construct `struct-that-represents-type` -// -// Solution would be the following: - -/// \class ctti_data -/// Standard-layout class with private constructors and assignment operators. -/// -/// You can not work with this class directly. The purpose of this class is to hold type info -/// \b when \b RTTI \b is \b off and allow ctti_type_index construction from itself. -/// -/// \b Example: -/// \code -/// const detail::ctti_data& foo(); -/// ... -/// type_index ti = type_index(foo()); -/// std::cout << ti.pretty_name(); -/// \endcode -class ctti_data { -#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS -public: - ctti_data() = delete; - ctti_data(const ctti_data&) = delete; - ctti_data& operator=(const ctti_data&) = delete; -#else -private: - ctti_data(); - ctti_data(const ctti_data&); - ctti_data& operator=(const ctti_data&); -#endif -}; - -} // namespace detail - -/// Helper method for getting detail::ctti_data of a template parameter T. -template -inline const detail::ctti_data& ctti_construct() BOOST_NOEXCEPT { - // Standard C++11, 5.2.10 Reinterpret cast: - // An object pointer can be explicitly converted to an object pointer of a different type. When a prvalue - // v of type "pointer to T1" is converted to the type "pointer to cv T2", the result is static_cast(static_cast(v)) if both T1 and T2 are standard-layout types (3.9) and the alignment - // requirements of T2 are no stricter than those of T1, or if either type is void. Converting a prvalue of type - // "pointer to T1" to the type "pointer to T2" (where T1 and T2 are object types and where the alignment - // requirements of T2 are no stricter than those of T1) and back to its original type yields the original pointer - // value. - // - // Alignments are checked in `type_index_test_ctti_alignment.cpp` test. - return *reinterpret_cast(boost::detail::ctti::n()); -} - -/// \class ctti_type_index -/// This class is a wrapper that pretends to work exactly like stl_type_index, but does -/// not require RTTI support. \b For \b description \b of \b functions \b see type_index_facade. -/// -/// This class on C++14 compatible compilers has following functions marked as constexpr: -/// * default constructor -/// * copy constructors and assignemnt operations -/// * class methods: name(), before(const ctti_type_index& rhs), equal(const ctti_type_index& rhs) -/// * static methods type_id(), type_id_with_cvr() -/// * comparison operators -/// -/// This class produces slightly longer type names, so consider using stl_type_index -/// in situations when typeid() is working. -class ctti_type_index: public type_index_facade { - const char* data_; - - inline std::size_t get_raw_name_length() const BOOST_NOEXCEPT; - - BOOST_CXX14_CONSTEXPR inline explicit ctti_type_index(const char* data) BOOST_NOEXCEPT - : data_(data) - {} - -public: - typedef detail::ctti_data type_info_t; - - BOOST_CXX14_CONSTEXPR inline ctti_type_index() BOOST_NOEXCEPT - : data_(boost::detail::ctti::n()) - {} - - inline ctti_type_index(const type_info_t& data) BOOST_NOEXCEPT - : data_(reinterpret_cast(&data)) - {} - - inline const type_info_t& type_info() const BOOST_NOEXCEPT; - BOOST_CXX14_CONSTEXPR inline const char* raw_name() const BOOST_NOEXCEPT; - BOOST_CXX14_CONSTEXPR inline const char* name() const BOOST_NOEXCEPT; - inline std::string pretty_name() const; - inline std::size_t hash_code() const BOOST_NOEXCEPT; - - BOOST_CXX14_CONSTEXPR inline bool equal(const ctti_type_index& rhs) const BOOST_NOEXCEPT; - BOOST_CXX14_CONSTEXPR inline bool before(const ctti_type_index& rhs) const BOOST_NOEXCEPT; - - template - BOOST_CXX14_CONSTEXPR inline static ctti_type_index type_id() BOOST_NOEXCEPT; - - template - BOOST_CXX14_CONSTEXPR inline static ctti_type_index type_id_with_cvr() BOOST_NOEXCEPT; - - template - inline static ctti_type_index type_id_runtime(const T& variable) BOOST_NOEXCEPT; -}; - - -inline const ctti_type_index::type_info_t& ctti_type_index::type_info() const BOOST_NOEXCEPT { - return *reinterpret_cast(data_); -} - - -BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::equal(const ctti_type_index& rhs) const BOOST_NOEXCEPT { - const char* const left = raw_name(); - const char* const right = rhs.raw_name(); - return /*left == right ||*/ !boost::typeindex::detail::constexpr_strcmp(left, right); -} - -BOOST_CXX14_CONSTEXPR inline bool ctti_type_index::before(const ctti_type_index& rhs) const BOOST_NOEXCEPT { - const char* const left = raw_name(); - const char* const right = rhs.raw_name(); - return /*left != right &&*/ boost::typeindex::detail::constexpr_strcmp(left, right) < 0; -} - - -template -BOOST_CXX14_CONSTEXPR inline ctti_type_index ctti_type_index::type_id() BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type no_ref_t; - typedef BOOST_DEDUCED_TYPENAME boost::remove_cv::type no_cvr_t; - return ctti_type_index(boost::detail::ctti::n()); -} - - - -template -BOOST_CXX14_CONSTEXPR inline ctti_type_index ctti_type_index::type_id_with_cvr() BOOST_NOEXCEPT { - return ctti_type_index(boost::detail::ctti::n()); -} - - -template -inline ctti_type_index ctti_type_index::type_id_runtime(const T& variable) BOOST_NOEXCEPT { - return variable.boost_type_index_type_id_runtime_(); -} - - -BOOST_CXX14_CONSTEXPR inline const char* ctti_type_index::raw_name() const BOOST_NOEXCEPT { - return data_; -} - - -BOOST_CXX14_CONSTEXPR inline const char* ctti_type_index::name() const BOOST_NOEXCEPT { - return data_; -} - -inline std::size_t ctti_type_index::get_raw_name_length() const BOOST_NOEXCEPT { - return std::strlen(raw_name() + detail::ctti_skip_size_at_end); -} - - -inline std::string ctti_type_index::pretty_name() const { - std::size_t len = get_raw_name_length(); - while (raw_name()[len - 1] == ' ') --len; // MSVC sometimes adds whitespaces - return std::string(raw_name(), len); -} - - -inline std::size_t ctti_type_index::hash_code() const BOOST_NOEXCEPT { - return boost::hash_range(raw_name(), raw_name() + get_raw_name_length()); -} - - -}} // namespace boost::typeindex - -#endif // BOOST_TYPE_INDEX_CTTI_TYPE_INDEX_HPP - diff --git a/libraries/boost/include/boost/type_index/detail/compile_time_type_info.hpp b/libraries/boost/include/boost/type_index/detail/compile_time_type_info.hpp deleted file mode 100644 index 4eb2017ffc..0000000000 --- a/libraries/boost/include/boost/type_index/detail/compile_time_type_info.hpp +++ /dev/null @@ -1,291 +0,0 @@ -// -// Copyright (c) Antony Polukhin, 2012-2016. -// -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_TYPE_INDEX_DETAIL_COMPILE_TIME_TYPE_INFO_HPP -#define BOOST_TYPE_INDEX_DETAIL_COMPILE_TIME_TYPE_INFO_HPP - -/// \file compile_time_type_info.hpp -/// \brief Contains helper macros and implementation details of boost::typeindex::ctti_type_index. -/// Not intended for inclusion from user's code. - -#include -#include -#include - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -/// @cond -#define BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(begin_skip, end_skip, runtime_skip, runtime_skip_until) \ - namespace boost { namespace typeindex { namespace detail { \ - BOOST_STATIC_CONSTEXPR std::size_t ctti_skip_size_at_begin = begin_skip; \ - BOOST_STATIC_CONSTEXPR std::size_t ctti_skip_size_at_end = end_skip; \ - BOOST_STATIC_CONSTEXPR bool ctti_skip_more_at_runtime = runtime_skip; \ - BOOST_STATIC_CONSTEXPR char ctti_skip_until_runtime[] = runtime_skip_until; \ - }}} /* namespace boost::typeindex::detail */ \ - /**/ -/// @endcond - - -#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) - /* Nothing to document. All the macro docs are moved to */ -#elif defined(BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING) -# include - BOOST_PP_EXPAND( BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING ) -#elif defined(_MSC_VER) && defined (BOOST_NO_CXX11_NOEXCEPT) - // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void)") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 10, false, "") -#elif defined(_MSC_VER) && !defined (BOOST_NO_CXX11_NOEXCEPT) - // sizeof("const char *__cdecl boost::detail::ctti<") - 1, sizeof(">::n(void) noexcept") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(40, 19, false, "") -#elif defined(__clang__) && defined(__APPLE__) - // Someone made __clang_major__ equal to LLVM version rather than compiler version - // on APPLE platform. - // - // Using less efficient solution because there is no good way to detect real version of Clang. - // sizeof("static const char *boost::detail::ctti<") - 1, sizeof("]") - 1, true, "???????????>::n() [T = int" - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 1, true, "T = ") -#elif defined(__clang__) && (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ == 0)) - // sizeof("static const char *boost::detail::ctti<") - 1, sizeof(">::n()") - 1 - // note: checked on 3.0 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 6, false, "") -#elif defined(__clang__) && (__clang_major__ >= 4 || (__clang_major__ == 3 && __clang_minor__ > 0)) - // sizeof("static const char *boost::detail::ctti<") - 1, sizeof("]") - 1, true, "int>::n() [T = int" - // note: checked on 3.1, 3.4 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(39, 1, true, "T = ") -#elif defined(__GNUC__) && (__GNUC__ < 7) && !defined(BOOST_NO_CXX14_CONSTEXPR) - // sizeof("static constexpr char boost::detail::ctti::s() [with unsigned int I = 0u; T = ") - 1, sizeof("]") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(81, 1, false, "") -#elif defined(__GNUC__) && (__GNUC__ >= 7) && !defined(BOOST_NO_CXX14_CONSTEXPR) - // sizeof("static constexpr char boost::detail::ctti::s() [with unsigned int I = 0; T = ") - 1, sizeof("]") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(80, 1, false, "") -#elif defined(__GNUC__) && defined(BOOST_NO_CXX14_CONSTEXPR) - // sizeof("static const char* boost::detail::ctti::n() [with T = ") - 1, sizeof("]") - 1 - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(57, 1, false, "") -#else - // Deafult code for other platforms... Just skip nothing! - BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS(0, 0, false, "") -#endif - -#undef BOOST_TYPE_INDEX_REGISTER_CTTI_PARSING_PARAMS - -namespace boost { namespace typeindex { namespace detail { - template - BOOST_CXX14_CONSTEXPR inline void assert_compile_time_legths() BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( - Condition, - "TypeIndex library is misconfigured for your compiler. " - "Please define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING to correct values. See section " - "'RTTI emulation limitations' of the documentation for more information." - ); - } - - template - BOOST_CXX14_CONSTEXPR inline void failed_to_get_function_name() BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( - sizeof(T) && false, - "TypeIndex library could not detect your compiler. " - "Please make the BOOST_TYPE_INDEX_FUNCTION_SIGNATURE macro use " - "correct compiler macro for getting the whole function name. " - "Define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING to correct value after that." - ); - } - - template - BOOST_CXX14_CONSTEXPR inline const char* skip_begining_runtime(const char* begin, boost::mpl::false_) BOOST_NOEXCEPT { - return begin; - } - - template - BOOST_CXX14_CONSTEXPR inline ForwardIterator1 constexpr_search( - ForwardIterator1 first1, - ForwardIterator1 last1, - ForwardIterator2 first2, - ForwardIterator2 last2) BOOST_NOEXCEPT - { - if (first2 == last2) { - return first1; // specified in C++11 - } - - while (first1 != last1) { - ForwardIterator1 it1 = first1; - ForwardIterator2 it2 = first2; - - while (*it1 == *it2) { - ++it1; - ++it2; - if (it2 == last2) return first1; - if (it1 == last1) return last1; - } - - ++first1; - } - - return last1; - } - - BOOST_CXX14_CONSTEXPR inline int constexpr_strcmp(const char *v1, const char *v2) BOOST_NOEXCEPT { - while (*v1 != '\0' && *v1 == *v2) { - ++v1; - ++v2; - }; - - return static_cast(*v1) - *v2; - } - - template - BOOST_CXX14_CONSTEXPR inline const char* skip_begining_runtime(const char* begin, boost::mpl::true_) BOOST_NOEXCEPT { - const char* const it = constexpr_search( - begin, begin + ArrayLength, - ctti_skip_until_runtime, ctti_skip_until_runtime + sizeof(ctti_skip_until_runtime) - 1 - ); - return (it == begin + ArrayLength ? begin : it + sizeof(ctti_skip_until_runtime) - 1); - } - - template - BOOST_CXX14_CONSTEXPR inline const char* skip_begining(const char* begin) BOOST_NOEXCEPT { - assert_compile_time_legths<(ArrayLength > ctti_skip_size_at_begin + ctti_skip_size_at_end)>(); - return skip_begining_runtime( - begin + ctti_skip_size_at_begin, - boost::mpl::bool_() - ); - } - -#if !defined(__clang__) && defined(__GNUC__) && !defined(BOOST_NO_CXX14_CONSTEXPR) - template - struct index_seq {}; - - template - struct make_index_sequence_join; - - template - struct make_index_sequence_join, index_seq > { - typedef index_seq type; - }; - - template - struct make_index_seq_impl { - typedef typename make_index_sequence_join< - typename make_index_seq_impl::type, - typename make_index_seq_impl::type - >::type type; - }; - - template - struct make_index_seq_impl { - typedef index_seq<> type; - }; - - template - struct make_index_seq_impl { - typedef index_seq type; - }; - - template - struct cstring { - static constexpr unsigned int size_ = sizeof...(C); - static constexpr char data_[size_] = { C... }; - }; - - template - constexpr char cstring::data_[]; -#endif - -}}} // namespace boost::typeindex::detail - -namespace boost { namespace detail { - -/// Noncopyable type_info that does not require RTTI. -/// CTTI == Compile Time Type Info. -/// This name must be as short as possible, to avoid code bloat -template -struct ctti { - -#if !defined(__clang__) && defined(__GNUC__) && !defined(BOOST_NO_CXX14_CONSTEXPR) - //helper functions - template - constexpr static char s() BOOST_NOEXCEPT { // step - constexpr unsigned int offset = - (I >= 10u ? 1u : 0u) - + (I >= 100u ? 1u : 0u) - + (I >= 1000u ? 1u : 0u) - + (I >= 10000u ? 1u : 0u) - + (I >= 100000u ? 1u : 0u) - + (I >= 1000000u ? 1u : 0u) - ; - - #if defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) - return BOOST_TYPE_INDEX_FUNCTION_SIGNATURE[I + offset]; - #elif defined(__FUNCSIG__) - return __FUNCSIG__[I + offset]; - #else - return __PRETTY_FUNCTION__[I + offset]; - #endif - } - - template - constexpr static const char* impl(::boost::typeindex::detail::index_seq ) BOOST_NOEXCEPT { - return ::boost::typeindex::detail::cstring()...>::data_; - } - - template // `D` means `Dummy` - constexpr static const char* n() BOOST_NOEXCEPT { - #if defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) - constexpr unsigned int size = sizeof(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE); - #elif defined(__FUNCSIG__) - constexpr unsigned int size = sizeof(__FUNCSIG__); - #elif defined(__PRETTY_FUNCTION__) \ - || defined(__GNUC__) \ - || (defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)) \ - || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) \ - || (defined(__ICC) && (__ICC >= 600)) \ - || defined(__ghs__) \ - || defined(__DMC__) - constexpr unsigned int size = sizeof(__PRETTY_FUNCTION__); - #else - boost::typeindex::detail::failed_to_get_function_name(); - #endif - - boost::typeindex::detail::assert_compile_time_legths< - (size > boost::typeindex::detail::ctti_skip_size_at_begin + boost::typeindex::detail::ctti_skip_size_at_end + sizeof("const *") - 1) - >(); - static_assert(!boost::typeindex::detail::ctti_skip_more_at_runtime, "Skipping for GCC in C++14 mode is unsupported"); - - typedef typename boost::typeindex::detail::make_index_seq_impl< - boost::typeindex::detail::ctti_skip_size_at_begin, - size - sizeof("const *") + 1 - boost::typeindex::detail::ctti_skip_size_at_begin - >::type idx_seq; - return impl(idx_seq()); - } -#else - /// Returns raw name. Must be as short, as possible, to avoid code bloat - BOOST_CXX14_CONSTEXPR static const char* n() BOOST_NOEXCEPT { - #if defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) - return boost::typeindex::detail::skip_begining< sizeof(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) >(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE); - #elif defined(__FUNCSIG__) - return boost::typeindex::detail::skip_begining< sizeof(__FUNCSIG__) >(__FUNCSIG__); - #elif defined(__PRETTY_FUNCTION__) \ - || defined(__GNUC__) \ - || (defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130)) \ - || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) \ - || (defined(__ICC) && (__ICC >= 600)) \ - || defined(__ghs__) \ - || defined(__DMC__) - return boost::typeindex::detail::skip_begining< sizeof(__PRETTY_FUNCTION__) >(__PRETTY_FUNCTION__); - #else - boost::typeindex::detail::failed_to_get_function_name(); - return ""; - #endif - } -#endif -}; - -}} // namespace boost::detail - -#endif // BOOST_TYPE_INDEX_DETAIL_COMPILE_TIME_TYPE_INFO_HPP diff --git a/libraries/boost/include/boost/type_index/detail/ctti_register_class.hpp b/libraries/boost/include/boost/type_index/detail/ctti_register_class.hpp deleted file mode 100644 index a8cef2c497..0000000000 --- a/libraries/boost/include/boost/type_index/detail/ctti_register_class.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright (c) Antony Polukhin, 2013-2014. -// -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_TYPE_INDEX_CTTI_REGISTER_CLASS_HPP -#define BOOST_TYPE_INDEX_CTTI_REGISTER_CLASS_HPP - -/// \file ctti_register_class.hpp -/// \brief Contains BOOST_TYPE_INDEX_REGISTER_CLASS macro implementation that uses boost::typeindex::ctti_type_index. -/// Not intended for inclusion from user's code. - -#include - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -namespace boost { namespace typeindex { namespace detail { - -template -inline const ctti_data& ctti_construct_typeid_ref(const T*) BOOST_NOEXCEPT { - return ctti_construct(); -} - -}}} // namespace boost::typeindex::detail - -/// @cond -#define BOOST_TYPE_INDEX_REGISTER_CLASS \ - virtual const boost::typeindex::detail::ctti_data& boost_type_index_type_id_runtime_() const BOOST_NOEXCEPT { \ - return boost::typeindex::detail::ctti_construct_typeid_ref(this); \ - } \ -/**/ -/// @endcond - -#endif // BOOST_TYPE_INDEX_CTTI_REGISTER_CLASS_HPP - diff --git a/libraries/boost/include/boost/type_index/detail/stl_register_class.hpp b/libraries/boost/include/boost/type_index/detail/stl_register_class.hpp deleted file mode 100644 index 95a26f7b0e..0000000000 --- a/libraries/boost/include/boost/type_index/detail/stl_register_class.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright (c) Antony Polukhin, 2013-2014. -// -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP -#define BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP - -/// \file stl_register_class.hpp -/// \brief Contains BOOST_TYPE_INDEX_REGISTER_CLASS macro implementation that uses boost::typeindex::stl_type_index. -/// Not intended for inclusion from user's code. - -#include - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -namespace boost { namespace typeindex { namespace detail { - -template -inline const stl_type_index::type_info_t& stl_construct_typeid_ref(const T*) BOOST_NOEXCEPT { - return typeid(T); -} - -}}} // namespace boost::typeindex::detail - -/// @cond -#define BOOST_TYPE_INDEX_REGISTER_CLASS \ - virtual const boost::typeindex::stl_type_index::type_info_t& boost_type_index_type_id_runtime_() const BOOST_NOEXCEPT { \ - return boost::typeindex::detail::stl_construct_typeid_ref(this); \ - } \ -/**/ -/// @endcond - -#endif // BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP - diff --git a/libraries/boost/include/boost/type_index/stl_type_index.hpp b/libraries/boost/include/boost/type_index/stl_type_index.hpp deleted file mode 100644 index 3a9834d685..0000000000 --- a/libraries/boost/include/boost/type_index/stl_type_index.hpp +++ /dev/null @@ -1,276 +0,0 @@ -// -// Copyright (c) Antony Polukhin, 2013-2018. -// -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_TYPE_INDEX_STL_TYPE_INDEX_HPP -#define BOOST_TYPE_INDEX_STL_TYPE_INDEX_HPP - -/// \file stl_type_index.hpp -/// \brief Contains boost::typeindex::stl_type_index class. -/// -/// boost::typeindex::stl_type_index class can be used as a drop-in replacement -/// for std::type_index. -/// -/// It is used in situations when RTTI is enabled or typeid() method is available. -/// When typeid() is disabled or BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY macro -/// is defined boost::typeindex::ctti is usually used instead of boost::typeindex::stl_type_index. - -#include - -// MSVC is capable of calling typeid(T) even when RTTI is off -#if defined(BOOST_NO_RTTI) && !defined(BOOST_MSVC) -#error "File boost/type_index/stl_type_index.ipp is not usable when typeid() is not available." -#endif - -#include -#include // std::strcmp, std::strlen, std::strstr -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \ - || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744) -# include -# include -# include -#endif - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -namespace boost { namespace typeindex { - -/// \class stl_type_index -/// This class is a wrapper around std::type_info, that workarounds issues and provides -/// much more rich interface. \b For \b description \b of \b functions \b see type_index_facade. -/// -/// This class requires typeid() to work. For cases when RTTI is disabled see ctti_type_index. -class stl_type_index - : public type_index_facade< - stl_type_index, - #ifdef BOOST_NO_STD_TYPEINFO - type_info - #else - std::type_info - #endif - > -{ -public: -#ifdef BOOST_NO_STD_TYPEINFO - typedef type_info type_info_t; -#else - typedef std::type_info type_info_t; -#endif - -private: - const type_info_t* data_; - -public: - inline stl_type_index() BOOST_NOEXCEPT - : data_(&typeid(void)) - {} - - inline stl_type_index(const type_info_t& data) BOOST_NOEXCEPT - : data_(&data) - {} - - inline const type_info_t& type_info() const BOOST_NOEXCEPT; - - inline const char* raw_name() const BOOST_NOEXCEPT; - inline const char* name() const BOOST_NOEXCEPT; - inline std::string pretty_name() const; - - inline std::size_t hash_code() const BOOST_NOEXCEPT; - inline bool equal(const stl_type_index& rhs) const BOOST_NOEXCEPT; - inline bool before(const stl_type_index& rhs) const BOOST_NOEXCEPT; - - template - inline static stl_type_index type_id() BOOST_NOEXCEPT; - - template - inline static stl_type_index type_id_with_cvr() BOOST_NOEXCEPT; - - template - inline static stl_type_index type_id_runtime(const T& value) BOOST_NOEXCEPT; -}; - -inline const stl_type_index::type_info_t& stl_type_index::type_info() const BOOST_NOEXCEPT { - return *data_; -} - - -inline const char* stl_type_index::raw_name() const BOOST_NOEXCEPT { -#ifdef _MSC_VER - return data_->raw_name(); -#else - return data_->name(); -#endif -} - -inline const char* stl_type_index::name() const BOOST_NOEXCEPT { - return data_->name(); -} - -inline std::string stl_type_index::pretty_name() const { - static const char cvr_saver_name[] = "boost::typeindex::detail::cvr_saver<"; - static BOOST_CONSTEXPR_OR_CONST std::string::size_type cvr_saver_name_len = sizeof(cvr_saver_name) - 1; - - // In case of MSVC demangle() is a no-op, and name() already returns demangled name. - // In case of GCC and Clang (on non-Windows systems) name() returns mangled name and demangle() undecorates it. - const boost::core::scoped_demangled_name demangled_name(data_->name()); - - const char* begin = demangled_name.get(); - if (!begin) { - boost::throw_exception(std::runtime_error("Type name demangling failed")); - } - - const std::string::size_type len = std::strlen(begin); - const char* end = begin + len; - - if (len > cvr_saver_name_len) { - const char* b = std::strstr(begin, cvr_saver_name); - if (b) { - b += cvr_saver_name_len; - - // Trim leading spaces - while (*b == ' ') { // the string is zero terminated, we won't exceed the buffer size - ++ b; - } - - // Skip the closing angle bracket - const char* e = end - 1; - while (e > b && *e != '>') { - -- e; - } - - // Trim trailing spaces - while (e > b && *(e - 1) == ' ') { - -- e; - } - - if (b < e) { - // Parsing seems to have succeeded, the type name is not empty - begin = b; - end = e; - } - } - } - - return std::string(begin, end); -} - - -inline std::size_t stl_type_index::hash_code() const BOOST_NOEXCEPT { -#if (defined(_MSC_VER) && _MSC_VER > 1600) \ - || (defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ > 5 && defined(__GXX_EXPERIMENTAL_CXX0X__)) \ - || (defined(__GNUC__) && __GNUC__ > 4 && __cplusplus >= 201103) - return data_->hash_code(); -#else - return boost::hash_range(raw_name(), raw_name() + std::strlen(raw_name())); -#endif -} - - -/// @cond - -// for this compiler at least, cross-shared-library type_info -// comparisons don't work, so we are using typeid(x).name() instead. -# if (defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))) \ - || defined(_AIX) \ - || (defined(__sgi) && defined(__host_mips)) \ - || (defined(__hpux) && defined(__HP_aCC)) \ - || (defined(linux) && defined(__INTEL_COMPILER) && defined(__ICC)) -# define BOOST_CLASSINFO_COMPARE_BY_NAMES -# endif - -/// @endcond - -inline bool stl_type_index::equal(const stl_type_index& rhs) const BOOST_NOEXCEPT { -#ifdef BOOST_CLASSINFO_COMPARE_BY_NAMES - return raw_name() == rhs.raw_name() || !std::strcmp(raw_name(), rhs.raw_name()); -#else - return !!(*data_ == *rhs.data_); -#endif -} - -inline bool stl_type_index::before(const stl_type_index& rhs) const BOOST_NOEXCEPT { -#ifdef BOOST_CLASSINFO_COMPARE_BY_NAMES - return raw_name() != rhs.raw_name() && std::strcmp(raw_name(), rhs.raw_name()) < 0; -#else - return !!data_->before(*rhs.data_); -#endif -} - -#ifdef BOOST_CLASSINFO_COMPARE_BY_NAMES -#undef BOOST_CLASSINFO_COMPARE_BY_NAMES -#endif - - - -template -inline stl_type_index stl_type_index::type_id() BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type no_ref_t; - typedef BOOST_DEDUCED_TYPENAME boost::remove_cv::type no_cvr_prefinal_t; - - # if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \ - || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744) - - // Old EDG-based compilers seem to mistakenly distinguish 'integral' from 'signed integral' - // in typeid() expressions. Full template specialization for 'integral' fixes that issue: - typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< - boost::is_signed, - boost::make_signed, - boost::mpl::identity - >::type no_cvr_prefinal_lazy_t; - - typedef BOOST_DEDUCED_TYPENAME no_cvr_prefinal_t::type no_cvr_t; - #else - typedef no_cvr_prefinal_t no_cvr_t; - #endif - - return typeid(no_cvr_t); -} - -namespace detail { - template class cvr_saver{}; -} - -template -inline stl_type_index stl_type_index::type_id_with_cvr() BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< - boost::mpl::or_, boost::is_const, boost::is_volatile >, - detail::cvr_saver, - T - >::type type; - - return typeid(type); -} - - -template -inline stl_type_index stl_type_index::type_id_runtime(const T& value) BOOST_NOEXCEPT { -#ifdef BOOST_NO_RTTI - return value.boost_type_index_type_id_runtime_(); -#else - return typeid(value); -#endif -} - -}} // namespace boost::typeindex - -#endif // BOOST_TYPE_INDEX_STL_TYPE_INDEX_HPP diff --git a/libraries/boost/include/boost/type_index/type_index_facade.hpp b/libraries/boost/include/boost/type_index/type_index_facade.hpp deleted file mode 100644 index e6dde8f3f9..0000000000 --- a/libraries/boost/include/boost/type_index/type_index_facade.hpp +++ /dev/null @@ -1,297 +0,0 @@ -// -// Copyright (c) Antony Polukhin, 2013-2018. -// -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_TYPE_INDEX_TYPE_INDEX_FACADE_HPP -#define BOOST_TYPE_INDEX_TYPE_INDEX_FACADE_HPP - -#include -#include -#include -#include - -#if !defined(BOOST_NO_IOSTREAM) -#if !defined(BOOST_NO_IOSFWD) -#include // for std::basic_ostream -#else -#include -#endif -#endif - -#ifdef BOOST_HAS_PRAGMA_ONCE -# pragma once -#endif - -namespace boost { namespace typeindex { - -/// \class type_index_facade -/// -/// This class takes care about the comparison operators, hash functions and -/// ostream operators. Use this class as a public base class for defining new -/// type_info-conforming classes. -/// -/// \b Example: -/// \code -/// class stl_type_index: public type_index_facade -/// { -/// public: -/// typedef std::type_info type_info_t; -/// private: -/// const type_info_t* data_; -/// -/// public: -/// stl_type_index(const type_info_t& data) noexcept -/// : data_(&data) -/// {} -/// // ... -/// }; -/// \endcode -/// -/// \tparam Derived Class derived from type_index_facade. -/// \tparam TypeInfo Class that will be used as a base type_info class. -/// \note Take a look at the protected methods. They are \b not \b defined in type_index_facade. -/// Protected member functions raw_name() \b must be defined in Derived class. All the other -/// methods are mandatory. -/// \see 'Making a custom type_index' section for more information about -/// creating your own type_index using type_index_facade. -template -class type_index_facade { -private: - /// @cond - BOOST_CXX14_CONSTEXPR const Derived & derived() const BOOST_NOEXCEPT { - return *static_cast(this); - } - /// @endcond -public: - typedef TypeInfo type_info_t; - - /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. - /// \return Name of a type. By default returns Derived::raw_name(). - inline const char* name() const BOOST_NOEXCEPT { - return derived().raw_name(); - } - - /// \b Override: This function \b may be redefined in Derived class. Overrides may throw. - /// \return Human readable type name. By default returns Derived::name(). - inline std::string pretty_name() const { - return derived().name(); - } - - /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. - /// \return True if two types are equal. By default compares types by raw_name(). - inline bool equal(const Derived& rhs) const BOOST_NOEXCEPT { - const char* const left = derived().raw_name(); - const char* const right = rhs.raw_name(); - return left == right || !std::strcmp(left, right); - } - - /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. - /// \return True if rhs is greater than this. By default compares types by raw_name(). - inline bool before(const Derived& rhs) const BOOST_NOEXCEPT { - const char* const left = derived().raw_name(); - const char* const right = rhs.raw_name(); - return left != right && std::strcmp(left, right) < 0; - } - - /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. - /// \return Hash code of a type. By default hashes types by raw_name(). - /// \note Derived class header \b must include , \b unless this function is redefined in - /// Derived class to not use boost::hash_range(). - inline std::size_t hash_code() const BOOST_NOEXCEPT { - const char* const name_raw = derived().raw_name(); - return boost::hash_range(name_raw, name_raw + std::strlen(name_raw)); - } - -#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) -protected: - /// \b Override: This function \b must be redefined in Derived class. Overrides \b must not throw. - /// \return Pointer to unredable/raw type name. - inline const char* raw_name() const BOOST_NOEXCEPT; - - /// \b Override: This function \b may be redefined in Derived class. Overrides \b must not throw. - /// \return Const reference to underlying low level type_info_t. - inline const type_info_t& type_info() const BOOST_NOEXCEPT; - - /// This is a factory method that is used to create instances of Derived classes. - /// boost::typeindex::type_id() will call this method, if Derived has same type as boost::typeindex::type_index. - /// - /// \b Override: This function \b may be redefined and made public in Derived class. Overrides \b must not throw. - /// Overrides \b must remove const, volatile && and & modifiers from T. - /// \tparam T Type for which type_index must be created. - /// \return type_index for type T. - template - static Derived type_id() BOOST_NOEXCEPT; - - /// This is a factory method that is used to create instances of Derived classes. - /// boost::typeindex::type_id_with_cvr() will call this method, if Derived has same type as boost::typeindex::type_index. - /// - /// \b Override: This function \b may be redefined and made public in Derived class. Overrides \b must not throw. - /// Overrides \b must \b not remove const, volatile && and & modifiers from T. - /// \tparam T Type for which type_index must be created. - /// \return type_index for type T. - template - static Derived type_id_with_cvr() BOOST_NOEXCEPT; - - /// This is a factory method that is used to create instances of Derived classes. - /// boost::typeindex::type_id_runtime(const T&) will call this method, if Derived has same type as boost::typeindex::type_index. - /// - /// \b Override: This function \b may be redefined and made public in Derived class. - /// \param variable Variable which runtime type will be stored in type_index. - /// \return type_index with runtime type of variable. - template - static Derived type_id_runtime(const T& variable) BOOST_NOEXCEPT; - -#endif - -}; - -/// @cond -template -BOOST_CXX14_CONSTEXPR inline bool operator == (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return static_cast(lhs).equal(static_cast(rhs)); -} - -template -BOOST_CXX14_CONSTEXPR inline bool operator < (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return static_cast(lhs).before(static_cast(rhs)); -} - - - -template -BOOST_CXX14_CONSTEXPR inline bool operator > (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return rhs < lhs; -} - -template -BOOST_CXX14_CONSTEXPR inline bool operator <= (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return !(lhs > rhs); -} - -template -BOOST_CXX14_CONSTEXPR inline bool operator >= (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return !(lhs < rhs); -} - -template -BOOST_CXX14_CONSTEXPR inline bool operator != (const type_index_facade& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return !(lhs == rhs); -} - -// ######################### COMPARISONS with Derived ############################ // -template -inline bool operator == (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return Derived(lhs) == rhs; -} - -template -inline bool operator < (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return Derived(lhs) < rhs; -} - -template -inline bool operator > (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return rhs < Derived(lhs); -} - -template -inline bool operator <= (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return !(Derived(lhs) > rhs); -} - -template -inline bool operator >= (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return !(Derived(lhs) < rhs); -} - -template -inline bool operator != (const TypeInfo& lhs, const type_index_facade& rhs) BOOST_NOEXCEPT { - return !(Derived(lhs) == rhs); -} - - -template -inline bool operator == (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { - return lhs == Derived(rhs); -} - -template -inline bool operator < (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { - return lhs < Derived(rhs); -} - -template -inline bool operator > (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { - return Derived(rhs) < lhs; -} - -template -inline bool operator <= (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { - return !(lhs > Derived(rhs)); -} - -template -inline bool operator >= (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { - return !(lhs < Derived(rhs)); -} - -template -inline bool operator != (const type_index_facade& lhs, const TypeInfo& rhs) BOOST_NOEXCEPT { - return !(lhs == Derived(rhs)); -} - -// ######################### COMPARISONS with Derived END ############################ // - -/// @endcond - -#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) - -/// noexcept comparison operators for type_index_facade classes. -bool operator ==, !=, <, ... (const type_index_facade& lhs, const type_index_facade& rhs) noexcept; - -/// noexcept comparison operators for type_index_facade and it's TypeInfo classes. -bool operator ==, !=, <, ... (const type_index_facade& lhs, const TypeInfo& rhs) noexcept; - -/// noexcept comparison operators for type_index_facade's TypeInfo and type_index_facade classes. -bool operator ==, !=, <, ... (const TypeInfo& lhs, const type_index_facade& rhs) noexcept; - -#endif - -#ifndef BOOST_NO_IOSTREAM -#ifdef BOOST_NO_TEMPLATED_IOSTREAMS -/// @cond -/// Ostream operator that will output demangled name -template -inline std::ostream& operator<<(std::ostream& ostr, const type_index_facade& ind) { - ostr << static_cast(ind).pretty_name(); - return ostr; -} -/// @endcond -#else -/// Ostream operator that will output demangled name. -template -inline std::basic_ostream& operator<<( - std::basic_ostream& ostr, - const type_index_facade& ind) -{ - ostr << static_cast(ind).pretty_name(); - return ostr; -} -#endif // BOOST_NO_TEMPLATED_IOSTREAMS -#endif // BOOST_NO_IOSTREAM - -/// This free function is used by Boost's unordered containers. -/// \note has to be included if this function is used. -template -inline std::size_t hash_value(const type_index_facade& lhs) BOOST_NOEXCEPT { - return static_cast(lhs).hash_code(); -} - -}} // namespace boost::typeindex - -#endif // BOOST_TYPE_INDEX_TYPE_INDEX_FACADE_HPP - diff --git a/libraries/boost/include/boost/visit_each.hpp b/libraries/boost/include/boost/visit_each.hpp deleted file mode 100644 index 6463ca9c2f..0000000000 --- a/libraries/boost/include/boost/visit_each.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Boost.Signals library - -// Copyright Douglas Gregor 2001-2003. Use, modification and -// distribution is subject to the Boost Software License, Version -// 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// For more information, see http://www.boost.org/libs/signals - -#ifndef BOOST_VISIT_EACH_HPP -#define BOOST_VISIT_EACH_HPP - -namespace boost { - template - inline void visit_each(Visitor& visitor, const T& t, long) - { - visitor(t); - } - - template - inline void visit_each(Visitor& visitor, const T& t) - { - visit_each(visitor, t, 0); - } -} - -#endif // BOOST_VISIT_EACH_HPP From 26ae6691163564658bcd42995e03efef9c3ff885 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Thu, 27 Feb 2020 17:31:33 -0500 Subject: [PATCH 50/50] Switch tests to catch --- tests/integration/action_results_test.cpp | 11 +- tests/integration/capi_tests.cpp | 8 +- tests/integration/codegen_tests.cpp | 10 +- tests/integration/contracts.hpp.in | 4 +- tests/integration/main.cpp | 4 +- tests/integration/memory_tests.cpp | 8 +- tests/tester/tester.cpp | 116 +++++++++++----------- 7 files changed, 73 insertions(+), 88 deletions(-) diff --git a/tests/integration/action_results_test.cpp b/tests/integration/action_results_test.cpp index 5593fb9456..16810649d3 100644 --- a/tests/integration/action_results_test.cpp +++ b/tests/integration/action_results_test.cpp @@ -1,18 +1,17 @@ -#include +#include #include #include using namespace eosio; +using eosio::testing::contracts; -BOOST_AUTO_TEST_SUITE(action_results_tests_suite) - -BOOST_FIXTURE_TEST_CASE( action_results_tests, test_chain ) { +TEST_CASE_METHOD( test_chain, "Tests for action results", "[action_results]" ) { create_account( "test"_n ); finish_block(); - set_code( N(test), contracts::action_results_test_wasm() ); #if 0 + set_code( "test"_n, contracts::action_results_test_wasm() ); produce_blocks(); auto trace = push_action(N(test), N(action1), N(test), mvo()); // need to fix this test after Kevin fixes action_return @@ -25,5 +24,3 @@ BOOST_FIXTURE_TEST_CASE( action_results_tests, test_chain ) { wdump((trace)); #endif } - -BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/integration/capi_tests.cpp b/tests/integration/capi_tests.cpp index b7cc065c4e..e2dc61905e 100644 --- a/tests/integration/capi_tests.cpp +++ b/tests/integration/capi_tests.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -8,9 +8,7 @@ using namespace eosio; using eosio::testing::contracts; using std::tuple; -BOOST_AUTO_TEST_SUITE(capi_tests) - -BOOST_FIXTURE_TEST_CASE( capi_tests, test_chain ) { +TEST_CASE_METHOD( test_chain, "C API tests", "[capi]" ) { create_code_account( "test"_n ); finish_block(); set_code( "test"_n, contracts::capi_tests_wasm() ); @@ -18,5 +16,3 @@ BOOST_FIXTURE_TEST_CASE( capi_tests, test_chain ) { transact({action({"test"_n, "active"_n}, "test"_n, "act"_n, std::tuple())}); } - -BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/integration/codegen_tests.cpp b/tests/integration/codegen_tests.cpp index 987761c84a..895697c816 100644 --- a/tests/integration/codegen_tests.cpp +++ b/tests/integration/codegen_tests.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -10,9 +10,7 @@ using eosio::testing::contracts; using namespace std::literals; using std::tuple; -BOOST_AUTO_TEST_SUITE(codegen_tests) - -BOOST_FIXTURE_TEST_CASE( simple_tests, test_chain ) { +TEST_CASE_METHOD( test_chain, "Simple tests", "[simple]" ) { create_code_account( "test"_n ); create_code_account( "eosio.token"_n ); create_code_account( "someone"_n ); @@ -49,7 +47,7 @@ BOOST_FIXTURE_TEST_CASE( simple_tests, test_chain ) { } -BOOST_FIXTURE_TEST_CASE( simple_eosio_tests, test_chain ) { +TEST_CASE_METHOD( test_chain, "Simple tests on eosio account", "[simple]" ) { set_code( "eosio"_n, contracts::simple_wasm() ); finish_block(); transact({{{"eosio"_n, "active"_n}, "eosio"_n, "test1"_n, tuple("bucky"_n)}}); @@ -62,5 +60,3 @@ BOOST_FIXTURE_TEST_CASE( simple_eosio_tests, test_chain ) { transact({{{"eosio"_n, "active"_n}, "eosio"_n, "test3"_n, tuple(33, "some string"s)}}); } - -BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/integration/contracts.hpp.in b/tests/integration/contracts.hpp.in index 1a6fbd5e5d..832ab6b3ed 100644 --- a/tests/integration/contracts.hpp.in +++ b/tests/integration/contracts.hpp.in @@ -12,8 +12,8 @@ struct contracts { static const char* capi_tests_wasm() { return "${CMAKE_BINARY_DIR}/../unit/test_contracts/capi_tests.wasm"; } - static std::vector action_results_test_wasm() { return read_wasm("${CMAKE_BINARY_DIR}/../unit/test_contracts/action_results_test.wasm"); } - static std::vector action_results_test_abi() { return read_abi("${CMAKE_BINARY_DIR}/../unit/test_contracts/action_results_test.abi"); } + static const char* action_results_test_wasm() { return "${CMAKE_BINARY_DIR}/../unit/test_contracts/action_results_test.wasm"; } + static const char* action_results_test_abi() { return "${CMAKE_BINARY_DIR}/../unit/test_contracts/action_results_test.abi"; } }; }} //ns eosio::testing diff --git a/tests/integration/main.cpp b/tests/integration/main.cpp index 29469f8044..4ed06df1f7 100644 --- a/tests/integration/main.cpp +++ b/tests/integration/main.cpp @@ -1,2 +1,2 @@ -#define BOOST_TEST_MODULE integration_tests -#include +#define CATCH_CONFIG_MAIN +#include diff --git a/tests/integration/memory_tests.cpp b/tests/integration/memory_tests.cpp index 5fb7f2f18a..d2711ffd10 100644 --- a/tests/integration/memory_tests.cpp +++ b/tests/integration/memory_tests.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -7,9 +7,7 @@ using namespace eosio; using eosio::testing::contracts; using std::tuple; -BOOST_AUTO_TEST_SUITE(memory_tests) - -BOOST_FIXTURE_TEST_CASE( malloc_tests, test_chain ) { +TEST_CASE_METHOD( test_chain, "Tests for malloc", "[malloc]" ) { create_code_account( "test"_n ); finish_block(); set_code( "test"_n, contracts::malloc_tests_wasm() ); @@ -19,5 +17,3 @@ BOOST_FIXTURE_TEST_CASE( malloc_tests, test_chain ) { transact({{{"test"_n, "active"_n}, "test"_n, "mallocalign"_n, tuple()}}); transact({{{"test"_n, "active"_n}, "test"_n, "mallocfail"_n, tuple()}}, "failed to allocate pages"); } - -BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/tester/tester.cpp b/tests/tester/tester.cpp index 7a70304d04..d844121c1a 100644 --- a/tests/tester/tester.cpp +++ b/tests/tester/tester.cpp @@ -2,8 +2,8 @@ #include #include "../unit/test_contracts/tester_tests.hpp" -#define BOOST_TEST_MAIN -#include +#define CATCH_CONFIG_MAIN +#include eosio::checksum256 make_checksum256(std::string_view src) { std::array buf; @@ -11,54 +11,54 @@ eosio::checksum256 make_checksum256(std::string_view src) { return eosio::checksum256(buf); } -BOOST_FIXTURE_TEST_CASE(start_finish_block, eosio::test_chain) +TEST_CASE_METHOD(eosio::test_chain, "start_block", "[start_block][finish_block]") { { eosio::block_info info = get_head_block_info(); - BOOST_TEST(info.block_num == 1); - BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("00000001F9175EC5AE6DA2F9FE99481374AC391603400534E0562E9124325F75")); - BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304000)); + CHECK(info.block_num == 1); + CHECK(eosio::checksum256(info.block_id) == make_checksum256("00000001F9175EC5AE6DA2F9FE99481374AC391603400534E0562E9124325F75")); + CHECK(info.timestamp == eosio::block_timestamp(1262304000)); } start_block(); { eosio::block_info info = get_head_block_info(); - BOOST_TEST(info.block_num == 2); - BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("00000002273D84013E8FC942B2F11646B07E8E31774951C5CE19ABD663A1999B")); - BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304001)); + CHECK(info.block_num == 2); + CHECK(eosio::checksum256(info.block_id) == make_checksum256("00000002273D84013E8FC942B2F11646B07E8E31774951C5CE19ABD663A1999B")); + CHECK(info.timestamp == eosio::block_timestamp(1262304001)); } finish_block(); { eosio::block_info info = get_head_block_info(); - BOOST_TEST(info.block_num == 3); - BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("00000003082FC6F82362072BA12D953FF3A9F0F4AC6FEC83072417662212E993")); - BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304002)); + CHECK(info.block_num == 3); + CHECK(eosio::checksum256(info.block_id) == make_checksum256("00000003082FC6F82362072BA12D953FF3A9F0F4AC6FEC83072417662212E993")); + CHECK(info.timestamp == eosio::block_timestamp(1262304002)); } start_block(); // no pending block to finish { eosio::block_info info = get_head_block_info(); - BOOST_TEST(info.block_num == 3); - BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("00000003082FC6F82362072BA12D953FF3A9F0F4AC6FEC83072417662212E993")); - BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304002)); + CHECK(info.block_num == 3); + CHECK(eosio::checksum256(info.block_id) == make_checksum256("00000003082FC6F82362072BA12D953FF3A9F0F4AC6FEC83072417662212E993")); + CHECK(info.timestamp == eosio::block_timestamp(1262304002)); } start_block(499); // finish block 4 finish_block(); { eosio::block_info info = get_head_block_info(); - BOOST_TEST(info.block_num == 5); - BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("00000005D4C5FF96B4FBB319E1CB81E581B518AC8133B490C1BB78216B14A0B5")); - BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304004)); + CHECK(info.block_num == 5); + CHECK(eosio::checksum256(info.block_id) == make_checksum256("00000005D4C5FF96B4FBB319E1CB81E581B518AC8133B490C1BB78216B14A0B5")); + CHECK(info.timestamp == eosio::block_timestamp(1262304004)); } start_block(500); finish_block(); { eosio::block_info info = get_head_block_info(); - BOOST_TEST(info.block_num == 7); - BOOST_TEST(eosio::checksum256(info.block_id) == make_checksum256("000000075DC2520236FAF327E55690B73039EA1AFB6D522C86CBD2A053DB167E")); - BOOST_TEST(info.timestamp == eosio::block_timestamp(1262304006)); + CHECK(info.block_num == 7); + CHECK(eosio::checksum256(info.block_id) == make_checksum256("000000075DC2520236FAF327E55690B73039EA1AFB6D522C86CBD2A053DB167E")); + CHECK(info.timestamp == eosio::block_timestamp(1262304006)); } } -BOOST_FIXTURE_TEST_CASE(start_block_skip, eosio::test_chain) { +TEST_CASE_METHOD(eosio::test_chain, "start_block skipping time", "[start_block]") { eosio::action empty{ { { "eosio"_n, "active"_n } }, "eosio"_n, eosio::name(), std::tuple() }; start_block(500); transact({empty}); @@ -77,60 +77,60 @@ eosio::checksum256 sha256(const T& t) { return eosio::sha256(packed.data(), packed.size()); } -BOOST_FIXTURE_TEST_CASE(transaction_trace, eosio::test_chain) { +TEST_CASE_METHOD(eosio::test_chain, "transaction_trace members", "[transaction_trace]") { eosio::action empty{ { { "eosio"_n, "active"_n } }, "eosio"_n, eosio::name(), std::tuple() }; eosio::transaction t = make_transaction( { empty } ); auto trace = push_transaction( t ); - BOOST_TEST(trace.id == sha256(t)); - BOOST_TEST(trace.status == eosio::transaction_status::executed); - BOOST_TEST(trace.cpu_usage_us == 2000); // The tester always bills 2 ms per transaction. - BOOST_TEST(trace.net_usage_words == 12); // default minimum net usage - BOOST_TEST(trace.elapsed > 0); // Variable - BOOST_TEST(trace.net_usage == 96); // net_usage_words*8 - BOOST_TEST(trace.scheduled == false); + CHECK(trace.id == sha256(t)); + CHECK(trace.status == eosio::transaction_status::executed); + CHECK(trace.cpu_usage_us == 2000); // The tester always bills 2 ms per transaction. + CHECK(trace.net_usage_words == 12); // default minimum net usage + CHECK(trace.elapsed > 0); // Variable + CHECK(trace.net_usage == 96); // net_usage_words*8 + CHECK(trace.scheduled == false); // action_trace - BOOST_TEST(trace.action_traces.size() == 1); - BOOST_TEST(trace.action_traces[0].action_ordinal == 1); - BOOST_TEST(trace.action_traces[0].creator_action_ordinal == 0); - BOOST_TEST(trace.action_traces[0].receipt->receiver == "eosio"_n); - BOOST_TEST(trace.action_traces[0].receipt->act_digest == sha256(empty)); - BOOST_TEST(trace.action_traces[0].receipt->global_sequence == 2); - BOOST_TEST(trace.action_traces[0].receipt->recv_sequence == 2); - BOOST_TEST(trace.action_traces[0].receipt->auth_sequence == (std::vector{ { "eosio"_n, 2 } }), boost::test_tools::per_element()); - BOOST_TEST(trace.action_traces[0].receipt->code_sequence == 0); - BOOST_TEST(trace.action_traces[0].receipt->abi_sequence == 0); - BOOST_TEST(trace.action_traces[0].receiver == "eosio"_n); - BOOST_TEST(trace.action_traces[0].context_free == false); - BOOST_TEST(trace.action_traces[0].elapsed > 0); - BOOST_TEST(trace.action_traces[0].console == ""); - BOOST_TEST(trace.action_traces[0].account_ram_deltas == std::vector{}, boost::test_tools::per_element()); - BOOST_TEST(!trace.action_traces[0].except); - BOOST_TEST(!trace.action_traces[0].error_code); + CHECK(trace.action_traces.size() == 1); + CHECK(trace.action_traces[0].action_ordinal == 1); + CHECK(trace.action_traces[0].creator_action_ordinal == 0); + CHECK(trace.action_traces[0].receipt->receiver == "eosio"_n); + CHECK(trace.action_traces[0].receipt->act_digest == sha256(empty)); + CHECK(trace.action_traces[0].receipt->global_sequence == 2); + CHECK(trace.action_traces[0].receipt->recv_sequence == 2); + CHECK(trace.action_traces[0].receipt->auth_sequence == (std::vector{ { "eosio"_n, 2 } })); + CHECK(trace.action_traces[0].receipt->code_sequence == 0); + CHECK(trace.action_traces[0].receipt->abi_sequence == 0); + CHECK(trace.action_traces[0].receiver == "eosio"_n); + CHECK(trace.action_traces[0].context_free == false); + CHECK(trace.action_traces[0].elapsed > 0); + CHECK(trace.action_traces[0].console == ""); + CHECK(trace.action_traces[0].account_ram_deltas == std::vector{}); + CHECK(!trace.action_traces[0].except); + CHECK(!trace.action_traces[0].error_code); - BOOST_TEST(!trace.account_ram_delta); - BOOST_TEST(!trace.except); - BOOST_TEST(!trace.error_code); - BOOST_TEST(trace.failed_dtrx_trace.size() == 0); + CHECK(!trace.account_ram_delta); + CHECK(!trace.except); + CHECK(!trace.error_code); + CHECK(trace.failed_dtrx_trace.size() == 0); } -BOOST_FIXTURE_TEST_CASE(send, eosio::test_chain) { +TEST_CASE_METHOD(eosio::test_chain, "Simple action::send", "[send]") { eosio::action empty{ { { "eosio"_n, "active"_n } }, "eosio"_n, eosio::name(), std::tuple() }; empty.send(); } -BOOST_FIXTURE_TEST_CASE(multi_index_tests, eosio::test_chain) { +TEST_CASE_METHOD(eosio::test_chain, "MultiIndex API", "[multi_index]") { create_account("test"_n); set_code("test"_n, "../unit/test_contracts/tester_tests.wasm"); tester_tests::putdb_action("test"_n, { "test"_n, "active"_n }).send(1, 2); tester_tests::table t("test"_n, 0); for(auto& item : t) { - BOOST_TEST(item.key == 1); - BOOST_TEST(item.value == 2); + CHECK(item.key == 1); + CHECK(item.value == 2); } } -BOOST_FIXTURE_TEST_CASE(query, eosio::test_chain) { +TEST_CASE_METHOD(eosio::test_chain, "Database queries", "[query]") { create_account("test"_n); set_code("test"_n, "../unit/test_contracts/tester_tests.wasm"); tester_tests::putdb_action("test"_n, { "test"_n, "active"_n }).send(1, 2); @@ -138,8 +138,8 @@ BOOST_FIXTURE_TEST_CASE(query, eosio::test_chain) { query.first = query.last = { "test"_n, "table"_n, eosio::name(), 0 }; query.last.primary_key = std::uint64_t(-1); eosio::for_each_contract_row(query_database(query), [](const eosio::contract_row&, auto* item) { - BOOST_TEST(item->key == 1); - BOOST_TEST(item->value == 2); + CHECK(item->key == 1); + CHECK(item->value == 2); return true; }); }