Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Commit 2020-02-04 - Compatibility improvements for MSVC 2012, GCC 6.x [2]
  • Fixed missing hexdump.hpp.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | msvc_max_1700 | msvc_min_1500 | release | y2020 | gcc_max_605 | gcc_min_408 | tagfiles
Files: files | file ages | folders
SHA3-256:2e1ff3401151955f721a662ecb54fe96bf8d16e73d1953656d1e091ef5fe9cb1
User & Date: luismachuca 2020-02-07 16:45:46
Context
2020-02-28
03:36
Commit 2020-02-27 - The 27F Release [1].
  • cxxomfort: No longer needs or uses a TR1 forwarder. Note this is a breaking change. (Closes: [5a9e81910e]).
  • cxxomfort: Base components now no longer rely on any header inside impl/.
  • cxxomfort: portable stdint header moved to new vendor/ folder.
  • cxxomfort: explicit_cast support now correctly checked in when Clang announces explicit operators as an extension, for compatibility and for avoiding warnings (Enhances: [f245681931]) (See also: [1cbdc0b48d], [5ba7743db6)). * functional: Added missing namespace std connection to <tt>invoke</tt>. * functional: Added partial <tt>invoke</tt> emulation for C++03. * functional: <tt>invoke()</tt> implementation moved to its own file for clarity. * functional: <tt>invoke()</tt> now uses std version when in C++>=17. * ostream: Added, with implementations of <tt><ostream></tt>-dependent functionality in other headers. * string_view: Now works with Open Watcom (Enhances: [b8ea55b791]).
  • tuple: Partial implementation of tuple_cat for C++03.
  • type_traits: Added is_[bounded/unbounded]_array from C++20.
  • type_traits: Added remove_cvref from C++20.
  • type_traits: Added remove_all_extents from C++11.
  • type_traits: Added fix to_bool(), to_integral() for pre-C++11 integral_constant.
  • type_traits: Enabled OpenWatcom to default missing intrinsics to false_type when using cxxomfort's internal TR1 (Enhances: [b8ea55b791]).
  • utility: Changes to integer_sequence implementation to compile better under C++11.
  • utility: integer_sequence now uses std version when in C++>=14.
  • library:algorithm: Add is_clamped from p1440 .
  • library:algorithm: Add clamp_halfopen and is_clamped_halfopen, half-open interval clamping operations complementary to std::clamp.
  • library:tuple: Partial implementation of tuple_pop, tuple_shift for tuples up to 5 elements.
  • library:tuple: Now clearly exposes types for tuple pop, push, shift and unshift operations.
  • impl: Moved type_traits from util to the impl directory.
  • impl: Reworked type_traits.

This is the first "major" release of cxxomfort for 202x and thus it is marked as release and trunk. Users pulling from the default repo should be able to upgrade automagically.

There are a number of major, "shaking" changes starting with this version which feature what could be considered the "final" structure for the project. Among the most important:

* The baseline is now more streamlined. In fact, it is possible from now on to set up a minimal base with only the cxxomfort basics by keeping only these five files and folders:
cxxomfort.hpp, base.hpp, config.hpp, base/, config/. * Starting this version cxxomfort no longer requires a TR1 forwarder (and in fact, might not even work with one) when working with compilers in pre-C++11 mode that require one (see Per-Compiler Notes in the wiki). * Conversely, when needing a TR1 implementation (such as in pre-TR1 compilers), the library now honors the previously unsupported macro CXXOMFORT_USE_INTERNAL_TR1 which enables automatically a minimum TR1 featureset. * The compiler now discerns between a C++98/03 mode with TR1 support available ("C++2007"), normal C++98 mode, and a C++ mode without C++98 support ("pre-1997"). This distinction is mostly relevant for compilers such as MSVC <= 2008 and OpenWatcom. * Some files from external sources are now moved to a vendor directory space. * When on Windows, the library now requires and enforces the value of the __STDC_LIMIT_MACROS macro.

This release has been tested on: GCC 4.6 to 5.5 in C++03 mode; GCC 4.6 to 6.0 in C++11 mode; GCC 6 in C++14 mode; MSVC 2008 SP1; MSVC 2012; MSVC 2013 (partially); clang 3.0 to 3.4 in C++03 mode; clang 3.2 to 4.0 in C++11 mode; clang 4.0 in C++14 mode; Open Watcom CI release (partial).

The autogenerated documentation ( http://ryan.gulix.cl/fossil.cgi/cxxomfort/uv/html/) is updated for this release.

Planned updates for the future:

  • Evaluating in full invoke() for C++03.
  • Backporting shift operations from <algorithm> down to at least C++11.
  • Backporting bind_front() down to at least C++11.
  • Backporting bit_cast() down to at least C++11.
  • A true arithmetic type with sizeof()==1 (à-la signed/unsigned char).
  • p0192 "short floats" (16-bit floating point types for storage only).
  • p1402 "cstring_view" (view of native C++ strings).
  • Refining is_contiguous_sequence.
  • "Moving" accumulate and partial_sum as per p0616.

[1] "27F": The release coincides with the 10th anniversary of the 27F Event or Great Cobquecura Earthquake of 2010 (2010-02-27): see https://en.wikipedia.org/wiki/2010_Chile_earthquake . This is why I say it is a shaking release. check-in: 4dad71eb user: luismachuca tags: trunk, msvc_min_1500, clang_min_302, openwatcom_min_200, release, y2020, gcc_min_406

2020-02-07
16:45
Commit 2020-02-04 - Compatibility improvements for MSVC 2012, GCC 6.x [2]
  • Fixed missing hexdump.hpp.
check-in: 2e1ff340 user: luismachuca tags: msvc_max_1700, msvc_min_1500, release, y2020, gcc_max_605, gcc_min_408, tagfiles
16:42
Commit 2020-02-04 - Compatibility improvements for MSVC 2012, GCC 6.x.
  • cxxomfort: Added better compatibility with GCC in C++14 mode (Enhances: []).
  • cxxomfort: Added better detection of MSVC 2012 and MSVC 2013 (Enhances: [70b70d8017]).
  • cstddef: Moved CXXOMFORT_IMPLEMENTS_decltype from utility.
  • cstddef: Moved to_byte to fixes (cxxomfort::fix).
  • ctime: Now uses POSIX timespec functions when in POSIX env.
  • ctime: Now implements timespec_get() in terms of GetSystemTime() when in Windows env.
  • memory: Fixed make_unique double / conflicting definition in GCC C++14 emulation mode (Enhances: []).
  • numeric: Fixed an issue where the template argument names for gcd, lcm cause conflicts in MSVC >= 2010.
  • string_view: Fixed a copy-ctor and assignment compilation error due to partial constexpr support (see library:array_ref).
  • string_view: Fixed missing reverse iterators.
  • system_error: Fixed an issue where code including the header would not compile if it was the only backported header it was using.
  • tuple: Fixed get<type>(tuple<...>) not being backported to C++11 in GCC≥5.
  • tuple: Fixed get<type>(tuple<...>) clashing with GCC 6.x in C++14 emulation mode (__cplusplus==201500) (Enhances: []).
  • tuple: Fixed make_from_tuple not being backported to C++11, C++14 in GCC≥5.
  • utility: moved CXXOMFORT_IMPLEMENTS_decltype to cstddef.
  • library:algorithm: Added [any,all,none]_on.
  • library:array_ref: Made front, back noexcept where available.
  • library:array_ref: Added size_bytes member function, adapting from C++20 span.
  • library:array_ref: Added a workaround for GCC bug on "defaulted declaration differs" for GCC < 7 (see [E1])
  • library:array_ref: Added missing operator==, operator!=.
  • library:functional: Fixed anachronistic parameter passing in constant_fn().
  • library:numeric: static_min, static_max now take up to 10 arguments.
  • library:utility: Added hexdump, hexload.
  • library:utility: Added utility typedefs bytes_view, const_bytes_view and utility function as_bytes_view().

[E1] https://stackoverflow.com/questions/20610658/defaulted-move-assignment-cannot-be-explicitly-noexcept-if-a-member-has-a-non-tr check-in: f22f0a4b user: luismachuca tags: msvc_max_1700, msvc_min_1500, release, y2020, gcc_max_605, gcc_min_408, tagfiles

Changes

Added cxxomfort/cxxomfort/impl/hexdump.hpp.

















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef CXXOMFORT_IMPL_HEXDUMP_HPP
#define CXXOMFORT_IMPL_HEXDUMP_HPP

namespace cxxomfort { namespace library {

namespace utility {

/**
 * @brief Dumps hex string representation of an area of memory.
 * @ingroup cxxo-sup-utility
 * @overload hexdump
 * @param dest An <tt>array_ref<char></tt> pointing to a writable area of memory of the specified size.
 * @param buffer The data buffer to read, as an <tt>array_ref<byte></tt>.
 * 
 * @returns An integer with the following possible values: <br/>
 * * <tt>==length</tt> if all characters were dumped without issues. <br/>
 * * <tt>0</tt> if there is no data to read, or if <tt>dest</tt> does not hold enough room to write the representation. <br/>
 * * <tt><0</tt> if there was an error when writing the data to @a dest .
 * 
 * @throws Only throws if <tt>sprintf()</tt> were somehow to throw.
 * 
 * */
inline 
int hexdump (cxxomfort::library::array_ref<char> dest, const_bytes_view buffer) {
	using namespace std;
	//error_code ec;
	if (buffer.size() < 1 || dest.size() * 2 < buffer.size()) {
		return 0;
	}
	char const * const buff = ( reinterpret_cast<char const * const>(buffer.data()) );
	size_t i= 0;
	for (i= 0; i < buffer.size(); ++i) {
		int sp = sprintf(dest.data()+2*i, "%hhx", buff[i]); 
		if (sp < 2) {
			return -static_cast<int>(i) -1;
		}
	}
	return i;
	//return ec;
}


inline 
int hexdump (cxxomfort::library::array_ref<char> dest, cxxomfort::library::array_ref<char const> buffer) {
	return hexdump(dest, cxxomfort::library::carrayref<std::byte>(buffer) ) ;
}
/**
 * @brief Dumps hex string representation of an area of memory.
 * @ingroup cxxo-sup-utility
 * @param dest An <tt>array_ref<unsigned char></tt> pointing to a writable area of memory of the specified size.
 * @param ptr A pointer to an area of memory to read.
 * @param length Length of the area of memory to read.
 * */
inline 
int hexdump (cxxomfort::library::array_ref<char> dest, void const * const ptr, size_t length) {
	std::byte const* b = (std::byte const*)(ptr);
	return hexdump(dest, cxxomfort::library::carrayref(b, length) );
}


inline
int hexload (bytes_view dest, std::string_view src) {
	int res= 0;
	(void)(src);
	(void)(dest);
	return res;
}


} 
} } // cxxomfort::library 
#endif  // guard