aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Add 'uint64_t getWallClockSeconds()'v0.3.2Sven Gothel2021-02-211-3/+10
|
* Add 'fprintf_td(FILE* stream, const char * format, ...) noexcept', ↵Sven Gothel2021-02-141-0/+9
| | | | fprintf(..) + prepending the environment::getElapsedMillisecond() timestamp
* Consolidate conversion to hex and decimal string: template<> to_hexstring() ↵Sven Gothel2021-02-101-10/+10
| | | | and to_decstring(), drop <type>[Hex|Dec]String(..)
* basic_types.hpp: Cleanup; Add constexpr 'enum class endian', ↵Sven Gothel2021-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'pointer_cast()' and 'bit_cast()' and have all byte-order conversion and get/set functions be of constexpr; Add generalized template [get|put]_value(..) and to_hex_string(..) Cleanup - Split basic_types.hpp -> basic_types.hpp + byte_util.hpp + int_types.hpp + string_util.hpp - Moved nsize_t, snsize_t to int_types.hpp and using 'uint_fast32_t' and 'int_fast32_t' as natural types. - Renamed cpp_lang_macros.hpp -> cpp_lang_util.hpp +++ Add constexpr 'enum class endian', 'pointer_cast()' and 'bit_cast()' and have all byte-order conversion and get/set functions be of constexpr. - Exposing '__builtin_bit_cast(Dest_type, arg)' via 'constexpr bool is_builtin_bit_cast_available()' and type traits. - Adding constexpr bit_cast<>() template for C++17 (a C++20 std), allowing constexpr type conversion using '__builtin_bit_cast(Dest_type, arg)', if the latter is available. - Adding constexpr pointer_cast<>() template, allowing constexpr pointer type conversion. Either using '__builtin_bit_cast(Dest_type, arg)' or reinterpret_cast<>(). - Add constexpr 'enum class endian' API, providing compile-time C++ endian evaluation w/o predefined macros. Inspired by C++20. - Replace linux bswap_[16,32,64] with either __builtin_bswap[16,32,64] or own const definition, both allowing constexpr - Add unified overloaded 'constexpr bswap(uint[16,32,64,128,192,256]_t const &)' using constexpr endian API. - Have all [get|put]_<type>(..) operations be of constexpr, using pointer_cast<>() instead of plain reinterpret_cast<>() and the new 'constexpr bswap(..)' methods. +++ Add generalized template [get|put]_value(..) and to_hex_string(..) - Add generalized template 'constexpr T [get|put]_value(..) {}' for std::is_standard_layout_v<T> - Add generalized template 'inline to_hex_string(T const &) {}' for std::is_standard_layout_v<T> +++ All of the above is covered by unit test 'test_basictypecon.cpp' '-std=c++17': - gcc 8.3.0 on arm32, arm64: __builtin_bit_cast() not available - gcc 10.2.1 on amd64: __builtin_bit_cast() not available - clang 9.0.1 on amd64, arm64: __builtin_bit_cast() is available - clang 11.0.1 on amd64: __builtin_bit_cast() is available Full build time (user) incl unit tests (C++ and Java) on GCC - amd64 gcc 11.0.1, 32 cores: 1m38s - arm64 gcc 8.3.0, 4 cores: 13m30s - arm32 gcc 8.3.0, 4 cores: 17m58s
* bytesHexString: Remove arg 'leading0X': Have a leading '0x' if !lsbFirst ↵Sven Gothel2021-02-061-11/+8
| | | | always, denoting byte-order in a sensible strict way.
* java: install single jaulib_jar (next to jaulib_fat_jar) & java-source-zip; ↵Sven Gothel2021-01-251-0/+8
| | | | | | RELEASE: strip native libs, no java debug symbols. Do not install java sub-modules jaulib_base, jaulib_jni, jaulib_net nor jaulib_pkg.
* Java import and modularization: jaulib_base, jaulib_jni, jaulib_net, ↵Sven Gothel2021-01-251-1/+1
| | | | jaulib_pkg (WIP)
* RuntimeException::RuntimeException: Adjust to get_backtrace API changeSven Gothel2021-01-111-1/+1
|
* debug: get_backtrace(..): Add max_frames to limit output, document semanticsSven Gothel2021-01-111-8/+9
|
* Adding type traits queries from basic_type -> type_traits_queries and other ↵Sven Gothel2021-01-091-16/+15
| | | | authors: Added member function queries w/ return types and args
* jau::RuntimeException::what(): Fix compliance, return 'const char*' from ↵Sven Gothel2021-01-031-8/+3
| | | | | | locally stored std::string Construct what_ std::string in ctor.
* cmake: Build using relative path and unique 'doc_jau' target, allowing ↵Sven Gothel2020-12-211-7/+7
| | | | user's hosting parent project to use 'add_subdirectory(jaulib)' for testing and header distribution
* Rename jaucpp -> jaulib (internally and api-doc); Don't distributed binaries ↵Sven Gothel2020-12-211-8/+8
| | | | | | | | | | | | (shared lib) As I prepare to add more languages to this utility project, rename from jaucpp -> jaulib. Also do not distribute a binarie, i.e. no installation of a share lib artifact. This to emphasize the intention to have artifacts being included in the user project directly, instead of linking. This may change, but for now it serves for best efficiency and removes binary distribution issues with the user's project.
* Add basic_types.hpp: byteHexString(..) for fast byte -> hex-string conversionSven Gothel2020-12-101-0/+13
|
* debug.hpp: Have PLAIN_PRINT(..) only optionally print the prefixSven Gothel2020-12-031-2/+4
|
* debug.cpp: Use jau::uint64DecString(..) instead of fprintf's decimal ↵Sven Gothel2020-12-021-10/+10
| | | | separator output (which depends on LANG and LC_MEASUREMENT environment.
* basic_types.hpp: Add noexcept template function to_decimal_string(..), ↵Sven Gothel2020-12-021-73/+0
| | | | | | | | | | | | | | implementing <type>DecString() inline functions. This generalizes earlier <type>SeparatedString() type specific functions by type, minimum width and whether a seperator shall be actually used or not. Hence allows replacing snprintf(..) for decimals altogether. Implementation uses new jau::digits10<T>(T v) as well as std::numeric_limits<T>::digits10 to determine numbers of decimal digits of: - the given value - the maximum value of the integral template type
* basic_types.hpp: Use bytesHexString(..) for all <type>HexString(..) function ↵Sven Gothel2020-12-021-63/+0
| | | | | | | | | | inline (lower-case hex-strings) Turns out, we could reduce our early implementation using 'snprintf(..)' using our simple bytesHexString(..) loop and lookup implementation. This removes 'snprintf(..)' format string parsing at least, perhaps our bytesHexString(..) is also more optimal in other aspects.
* basic_types.hpp: bytesHexString(..): Add paramter 'bool lowerCase=true', to ↵Sven Gothel2020-12-021-6/+10
| | | | have the default output using lower-case hex characters
* Adding uint128HexString() and uint256HexString()Sven Gothel2020-11-091-0/+7
|
* Small footprint compromise: Use jau::nsize_t where appropriateSven Gothel2020-10-201-27/+27
| | | | | This revises commit 8e603953e960eb683c7fa00c9cf9fc39ab890c85 to use the smaller footprint nsize_t.
* Use -Wshadow: Shadowing (or local scope override) often causing sloppy bugs, ↵Sven Gothel2020-10-201-5/+5
| | | | avoid.
* Normalize: Use size_t where appropriateSven Gothel2020-10-201-7/+9
|
* basic_types: [int64_t -> uint64_t] getCurrentMilliseconds()Sven Gothel2020-10-201-2/+2
|
* cmake: Drop all sub-folder CXX settings. Use root CMakeLists.txt global ↵Sven Gothel2020-10-201-3/+0
| | | | settings for all, avoiding confusion.
* debug: [get|print]_backtrace(..): Add 'skip_anon_frames' arg to suppress ↵Sven Gothel2020-10-192-13/+23
| | | | adding frames w/o proc-name
* basic_types: Handle unaligned access via compiler magic 'struct ↵Sven Gothel2020-10-171-4/+6
| | | | | | | | | | | | __attribute__((__packed__))' access - much cheaper! Utilizing a no-cost template struct having the __packed__ attribute utilizes the compiler to generate safe load and store operations. This is validated via '-Wcast-align=strict', which verifies safe pointer cast for all platforms on the current compilation host. This also lead to fixing merge_uint128(*) unsafe cast + assignment.
* Compile clean on g++ 8+10 on 64bit and 32bit with full Warnings (=Error)Sven Gothel2020-10-171-2/+2
| | | | | | Full Warnings = Error: -Wall -Wextra -Wformat=2 -Wformat-overflow=2 -Wformat-nonliteral -Wformat-security -Wformat-signedness -Wformat-y2k -Wnull-dereference -Winit-self -Werror
* environment: Generalize instantiation using 'root_prefix_domain', lower case ↵Sven Gothel2020-10-161-33/+34
| | | | | | | | | | for 'debug', 'debug_jni' and 'verbose' const fields. Since environment is intended to be used for any project, introduce 'root_prefix_domain' as set on the initial environment::get(..) call. Use lower case 'debug' to avoid collision with DEBUG macro, hence use all lower case const fields.
* Add standalone Eclipse CDT project; Fixing one -Wformat-security warning/errorSven Gothel2020-10-161-1/+1
|
* Move jaucpp files to root-folderSven Gothel2020-10-165-0/+882
|
* Extract common C++ Support Library inclusive Java JNI Binding to sub-project ↵Sven Gothel2020-10-163-606/+0
| | | | jaucpp, namespace jau
* Add DBTEnv::DEBUG_JNI 'direct_bt.debug.jni' for JNI only related ↵Sven Gothel2020-10-141-2/+4
| | | | DBG_JNI_PRINT(); IRQ_PRINT(..) shall not print_backtrace().
* direct_bt::RuntimeException: backtrace must be fetched at ctor (duh!), ↵Sven Gothel2020-10-131-2/+8
| | | | expose std::string backtrace via get_backtrace()
* direct_bt::get_backtrace(): Ensure '\n' is added, proper frame count ↵Sven Gothel2020-10-131-12/+16
| | | | starting @ 1, more efficient local cstr usage
* dbt_debug/direct_bt::RuntimeException: Add de-mangled backtrace using ↵Sven Gothel2020-10-132-24/+55
| | | | | | | | | libunwind and abi::__cxa_demangle The backtrace is used by default for - direct_bt::ABORT(..) - direct_bt::ERR_PRINT(..) - direct_bt::RuntimeException::what()
* dbt_debug: Have DBG_PRINT and WORDY_PRINT as macros, suppressing argument ↵Sven Gothel2020-10-081-22/+18
| | | | | | | | | evaluation if condition is false Following commit 581260d3f4144df3716eac736c9e8792be264edb Also reverting COND_PRINT to drop __func__, __FILE__ and __LINE__ as not intended for this verbose ourput instrument (like DBG_PRINT etc).
* dbt_debug: Add __func__ to ABORT, ERR_PRINT, IRQ_PRINT and WARN_PRINTSven Gothel2020-10-071-10/+10
|
* dbt_debug.hpp COND_PRINT: Don't produce arguments if condition not met, use ↵Sven Gothel2020-10-071-10/+8
| | | | | | | | | | | | | | | | | preprocessor! Caught using Valgrind's helgrind 'possible data race' by producing the arguments for COND_PRINT while condition was false - hence a waste of resources, not efficient. The 'possible data race' itself was of no interest, just an informal vector<>::size(), but the COND_PRINT caused to generate std::string instances even if not desired. Here the preprocessor generates the conditional code and hides the arguments inside the condition==true block. Alternatively, we could use stdd::enbale_if<> template and/or lambdas etc, see <https://en.cppreference.com/w/cpp/types/enable_if>. However, this does its job.
* Handle abort() via dbt_debug's new ABORT(..), ensure a message is being send ↵Sven Gothel2020-09-202-8/+15
| | | | and process aborted; Use it.
* dbt_debug: Generalize ERR_PRINT2 -> ERR_PRINT_IMPL w/ prefix param; Add ↵Sven Gothel2020-09-191-3/+3
| | | | | | | | | | | | | IRQ_PRINT(.. "Interrupted" ), to clarify class of event. An interruption might not be an error, but expected behavior - e.g. if a device is powered off. Use IRQ_ERROR in GattHandler on: - l2cap write error -> disconnect + exception - l2cap nullptr reply (sendWithReply) -> disconnect + exception - l2cap read error (l2capReaderThread) -> disconnect We might find other occassions where this informal output fits.
* dbt_debug: INFO_PRINT(..) -> WORDY_PRINT(..) cond DBTEnv::VERBOSE, add ↵Sven Gothel2020-09-181-2/+12
| | | | | | | | | | | | | | | uncond INFO_PRINT(..) Turns out INFO_PRINT(..) is confusing, as it was not clear that it is conditional on DBTEnv::VERBOSE. Hence rename it to the short English from for Latin 'verbosus', and hence hinting it is conditional on DBTEnv::VERBOSE. INFO_PRINT(..) renamed to WORDY_PRINT(..), using prefix 'Wordy:' (Verbose is just too long) Add unconditional INFO_PRINT(..) for plain informal messages. Hope this clears up the confusion. Hint: I was looking for an INFO_PRINT(..) ouput myself ;-)
* C++ noexcept: Remaining BasicTypes getCurrentMilliseconds(), ↵Sven Gothel2020-09-141-10/+15
| | | | uintXHexString(..) using ERR_PRINT and abort for internal error
* C++: Second round propagating noexcept and using OctetTypes nocheck '_nc'Sven Gothel2020-09-141-8/+8
| | | | | | | | | | | | | RELEASE Builds w/ -O3: pre-opt: 2,131,720 dist-amd64/lib/libdirect_bt.so.2.1.20 noexcept round-1: (added OctetTypes _nc methods, hence offsetting reduction) 2,132,112 dist-amd64/lib/libdirect_bt.so.2.1.20 noexcept round-2: (reductions only) ~20k less 2,111,632 dist-amd64/lib/libdirect_bt.so.2.1.20
* C++: First round propagating noexcept: Adding nocheck '_nc' variants in ↵Sven Gothel2020-09-141-11/+11
| | | | OctetTypes and use them if allowed.
* dbt_debug.hpp: Ressurect ERR_PRINT and WARN_PRINT inline __FILE__ and __LINE__Sven Gothel2020-08-261-8/+22
|
* dbt_debug.hpp: Move implementation to dbt_debug.cpp, since we moved to ↵Sven Gothel2020-08-261-0/+96
| | | | | | proper C++ functions Dropping inline will also reduce footprint of library.
* Adapt to new DBG_PRINT(..) semantics, reduce verbosity, use specific macros ↵Sven Gothel2020-08-241-3/+1
| | | | for special cases (e.g. GATT_PRINT, ..)
* Extract dfa_utf8_decode.[cpp/hpp] added to libtinyb.so, i.e. used for both ↵Sven Gothel2020-07-042-80/+99
| | | | native libs commonly exposed in Java via BluetoothUtils.cxx JNI
* BasicTypes: Rename getUTF8String(..) -> decodeUTF8String(..): Adding API doc ↵Sven Gothel2020-06-041-1/+1
| | | | section with reference to used algo