From fad6b45d86ffeae625e6ff07b356ce44d1fcd39e Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 13 Jul 2025 21:16:24 -0500 Subject: [PATCH 1/6] xo-flatstring: doc: minor adds --- docs/install.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/install.rst b/docs/install.rst index faa72baf..be0fd537 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -42,7 +42,7 @@ Include as git submodule cd myproject git submodule add -b main https://github.com/rconybea/xo-flatstring ext/xo-flatstring - git submodule update --init + git submodule update --init ext/xo-flatstring This assumes you organize directly-incorporated dependencies under directory ``myproject/ext``. You would then add ``myproject/ext/xo-flatstring/include`` to your compiler's include path, @@ -54,11 +54,6 @@ and from c++ do something like in c++ source files that rely on xo-flatstring -Supported compilers -------------------- - -* developed with gcc 13.2.0; github CI using gcc 11.4.0 (asof April 2024) - Building from source -------------------- @@ -84,3 +79,8 @@ To build documentation, will also need: * `sphinx` * `breathe` * `sphinx_rtd_theme` + +Supported compilers +------------------- + +* developed with gcc 13.2.0; github CI using gcc 11.4.0 (asof April 2024) From 0cabcf2f2cdf0eb4284084aebc8f4eedd3c2538b Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 19 Jul 2025 11:47:03 -0500 Subject: [PATCH 2/6] pretty printing -- copmlete for xo::ast::GeneralizedExpression --- include/xo/flatstring/flatstring.hpp | 1 + include/xo/flatstring/flatstring_pretty.hpp | 28 +++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 include/xo/flatstring/flatstring_pretty.hpp diff --git a/include/xo/flatstring/flatstring.hpp b/include/xo/flatstring/flatstring.hpp index a332950d..947d70da 100644 --- a/include/xo/flatstring/flatstring.hpp +++ b/include/xo/flatstring/flatstring.hpp @@ -636,6 +636,7 @@ namespace xo { return ((s1 <=> s2) == std::strong_ordering::equal); } ///@} + } /*namespace xo*/ /** end flatstring.hpp **/ diff --git a/include/xo/flatstring/flatstring_pretty.hpp b/include/xo/flatstring/flatstring_pretty.hpp new file mode 100644 index 00000000..2474a3a4 --- /dev/null +++ b/include/xo/flatstring/flatstring_pretty.hpp @@ -0,0 +1,28 @@ +/** @file flatstring_pretty.hpp + * + * Author: Roland Conybeare, Jul 2025 + **/ + +#pragma once + +#include "flatstring.hpp" +#include "flatstring_iostream.hpp" +#include "xo/indentlog/print/ppdetail_atomic.hpp" + +namespace xo { +#ifndef ppdetail_atomic + namespace print { + struct ppindentinfo; + + template + struct ppdetail> { + static bool print_pretty(const ppindentinfo & ppii, + const flatstring & x) { + return ppdetail_atomic>::print_pretty(ppii, x); + }; + }; + } +#endif +} + +/** end flatstring_pretty.hpp **/ From 12f275a5d90be9cf433776d2b0cedf38f530fe12 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 22 Aug 2025 15:10:30 -0400 Subject: [PATCH 3/6] xo-flatstrint: + .data() + .ensure_final_null() --- include/xo/flatstring/flatstring.hpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/include/xo/flatstring/flatstring.hpp b/include/xo/flatstring/flatstring.hpp index 947d70da..c1594b04 100644 --- a/include/xo/flatstring/flatstring.hpp +++ b/include/xo/flatstring/flatstring.hpp @@ -246,6 +246,10 @@ namespace xo { /** @defgroup flatstring-access access methods **/ ///@{ + /** @brief get writeable access to string representation + * Caller responsible for ensuring trailing null char + **/ + constexpr char * data() noexcept { return value_; } /** @brief return char at position @p pos in this string (counting from zero). * * Throws @c std::out_of_range exception if @p pos >= @c N @@ -283,10 +287,20 @@ namespace xo { /** @defgroup flatstring-assign assignment **/ ///@{ - /** @brief put string into empty state. fills entire char array with nulls **/ + /** put string into empty state. fills entire char array with nulls **/ constexpr void clear() noexcept { std::fill_n(value_, N, '\0'); } + /** ensure null-terminated representation. + * + * Example: + * @code + * flatstring x; + * snprintf(x.data(), x.capacity(), ...); + * return x.ensure_final_null(); + * @endcode + **/ + constexpr flatstring & ensure_final_null() noexcept { value_[N-1] = '\0'; return *this; } - /** @brief replace contents with min(count,N-1) copies of character ch **/ + /** replace contents with min(count,N-1) copies of character ch **/ constexpr flatstring & assign(size_type count, value_type ch) { std::size_t pos = 0; for (; pos < std::min(count, N-1); ++pos) From ca9fd7a96bf83e8c166f389e67ddd826e792aaea Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 22 Sep 2025 12:29:29 -0400 Subject: [PATCH 4/6] xo-flatstring: build: install examples if XO_ENABLE_EXAMPLES --- CMakeLists.txt | 6 ++++++ example/ex1/CMakeLists.txt | 15 ++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 357c5113..cd561e87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,12 @@ xo_install_library4(${SELF_LIB} ${PROJECT_NAME}Targets) # provide find_package() support for projects using this library xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets) +# ---------------------------------------------------------------- + +if (XO_ENABLE_EXAMPLES) + install(TARGETS flatstring_ex1) +endif() + # ---------------------------------------------------------------- # docs targets depend on all the other library/utest targets # diff --git a/example/ex1/CMakeLists.txt b/example/ex1/CMakeLists.txt index c026a159..a16109d1 100644 --- a/example/ex1/CMakeLists.txt +++ b/example/ex1/CMakeLists.txt @@ -1,15 +1,12 @@ # xo-flatstring/example/ex1/CMakeLists.txt -set(SELF_EXE xo_flatstring_ex1) +set(SELF_EXE flatstring_ex1) set(SELF_SRCS ex1.cpp) -add_executable(${SELF_EXE} ${SELF_SRCS}) -xo_include_options2(${SELF_EXE}) - -# ---------------------------------------------------------------- -# dependencies.. - -xo_self_headeronly_dependency(${SELF_EXE} xo_flatstring) -#xo_dependency(${SELF_EXE} reflect) +if (XO_ENABLE_EXAMPLES) + add_executable(${SELF_EXE} ${SELF_SRCS}) + xo_include_options2(${SELF_EXE}) + xo_self_headeronly_dependency(${SELF_EXE} xo_flatstring) +endif() # end CMakeLists.txt From 9c144b6038e40dd5da12e836edf122aa95c0824c Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 27 Feb 2026 19:38:53 +1100 Subject: [PATCH 5/6] xo-cmake: setup to make share target available via cmake install --- cmake/xo_flatstringConfig.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/xo_flatstringConfig.cmake.in b/cmake/xo_flatstringConfig.cmake.in index e5ee1778..c6b988e1 100644 --- a/cmake/xo_flatstringConfig.cmake.in +++ b/cmake/xo_flatstringConfig.cmake.in @@ -14,4 +14,5 @@ include(CMakeFindDependencyMacro) #find_dependency(callback) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Share.cmake") check_required_components("@PROJECT_NAME@") From 07a0ec100bbf41918e29ab474e4289974a7d43eb Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 31 May 2026 09:50:13 -0400 Subject: [PATCH 6/6] build: update cmake bootstrap macros for in-tree builds Once these are done for all xo-foo satellites, should be able to complete cmake build without first installing xo-cmake. --- cmake/xo-bootstrap-macros.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/xo-bootstrap-macros.cmake b/cmake/xo-bootstrap-macros.cmake index aba31169..592272c0 100644 --- a/cmake/xo-bootstrap-macros.cmake +++ b/cmake/xo-bootstrap-macros.cmake @@ -19,7 +19,13 @@ endif() message(STATUS "XO_CMAKE_CONFIG_EXECUTABLE=${XO_CMAKE_CONFIG_EXECUTABLE}") -if (NOT XO_SUBMODULE_BUILD) +if (XO_SUBMODULE_BUILD) + if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix)) + # local version of xo-cmake macros + set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/xo-cmake/cmake") + message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") + endif() +else() if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix)) # default to typical install location for xo-project-macros execute_process(COMMAND ${XO_CMAKE_CONFIG_EXECUTABLE} --cmake-module-path OUTPUT_VARIABLE CMAKE_MODULE_PATH)