Merge branch 'main' of github.com:rconybea/xo-umbrella2

This commit is contained in:
Roland Conybeare 2026-01-06 10:39:22 -05:00
commit e1f45308ab
47 changed files with 444 additions and 139 deletions

View file

@ -75,9 +75,10 @@ set(DOX_EXCLUDE_PATTERNS [=[
# in reverse topological order i.e. dependencies first
add_subdirectory(xo-cmake)
add_subdirectory(xo-reflectutil) # header-only reflect support
add_subdirectory(xo-facet) # sep iface,data
add_subdirectory(xo-indentlog)
add_subdirectory(xo-reflectutil) # header-only reflect support
add_subdirectory(xo-arena) # arena allocator (DArena)
add_subdirectory(xo-facet) # sep iface,data
add_subdirectory(xo-allocutil)
add_subdirectory(xo-refcnt)
add_subdirectory(xo-subsys)

View file

@ -2,6 +2,7 @@
include(CMakeFindDependencyMacro)
#find_dependency(indentlog)
find_depnedency(xo_arena)
find_dependency(xo_facet)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components("@PROJECT_NAME@")

View file

@ -1,70 +0,0 @@
/** @file ArenaConfig.hpp
*
* @author Roland Conybeare, Dec 2025
**/
#pragma once
#include <string>
#include <cstdint>
namespace xo {
namespace mm {
/** @class ArenaConfig
* @brief configuration for a @ref DArena instance
**/
struct ArenaConfig {
/** @defgroup mm-arenaconfig-ctors ArenaConfig ctors **/
///@{
/** create anonymous arena with size @p z **/
static ArenaConfig simple(std::size_t z);
///@}
/** @defgroup mm-arenaconfig-instance-vars ArenaConfig members **/
///@{
/** optional name, for diagnostics **/
std::string name_;
/** desired arena size -- hard max = reserved virtual memory **/
std::size_t size_;
/** hugepage size -- using huge pages relieves some TLB pressure
* (provided you use their full extent :)
**/
std::size_t hugepage_z_ = 2 * 1024 * 1024;
/** if non-zero, allocate extra space between allocs, and fill
* with fixed test-pattern contents. Allows for simple
* runtime arena sanitizing checks.
* Will be rounded up to multiple of @ref padding::c_alloc_alignment
**/
std::size_t guard_z_ = 0;
/** if guard_z_ > 0, write at least that many copies
* of this guard byte following each complete allocation
**/
std::uint8_t guard_byte_ = 0xfd;
/** if store_header_flag_ is true: mask bits for allocation size.
* remaining bits can be stolen for other purposes
* otherwise ignored
**/
/** true to store header (8 bytes) at the beginning of each allocation.
* necessary and sufficient to allows iterating over allocs
* present in arena
**/
bool store_header_flag_ = false;
/** mask applied to 8-byte alloc header.
* bits set to 1 store alloc size; remaining
* bits in alloc header can be used for other purposes.
**/
std::uint64_t header_size_mask_ = 0xffffffff;
/** true to enable debug logging **/
bool debug_flag_ = false;
///@}
};
} /*namespace mm*/
} /*namespace xo*/
/* end ArenaConfig.hpp */

View file

@ -23,7 +23,7 @@ namespace xo {
**/
struct AAllocIterator {
using obj_AAllocIterator = xo::facet::obj<AAllocIterator>;
using typeseq = xo::facet::typeseq;
using typeseq = xo::reflect::typeseq;
/** @defgroup mm-allociterator-methods AllocIterator methods **/
///@{

View file

@ -5,7 +5,7 @@
#pragma once
#include "AllocError.hpp"
#include <xo/arena/AllocError.hpp>
#include "AllocInfo.hpp"
//#include "AllocIterator.hpp"
#include "AllocRange.hpp"

View file

@ -20,7 +20,7 @@ namespace xo {
* @brief AllocIterator implementation for empty variant instance
**/
struct IAllocIterator_Any : public AAllocIterator {
using typeseq = xo::facet::typeseq;
using typeseq = xo::reflect::typeseq;
const AAllocIterator * iface() const { return std::launder(this); }

View file

@ -18,7 +18,7 @@ namespace xo {
typename IAllocIterator_DRepr>
struct IAllocIterator_Xfer : public AAllocIterator {
using Impl = IAllocIterator_DRepr;
using typeseq = xo::facet::typeseq;
using typeseq = xo::reflect::typeseq;
static const DRepr & _dcast(Copaque d) { return *(const DRepr *)d; }
static DRepr & _dcast(Opaque d) { return *(DRepr *)d; }
@ -48,9 +48,9 @@ namespace xo {
};
template <typename DRepr, typename IAllocIterator_DRepr>
xo::facet::typeseq
xo::reflect::typeseq
IAllocIterator_Xfer<DRepr, IAllocIterator_DRepr>::s_typeseq
= facet::typeseq::id<DRepr>();
= reflect::typeseq::id<DRepr>();
template <typename DRepr, typename IAllocIterator_DRepr>
bool

View file

@ -17,7 +17,7 @@ namespace xo {
public:
using ObjectType = Object;
using DataPtr = Object::DataPtr;
using typeseq = xo::facet::typeseq;
using typeseq = xo::reflect::typeseq;
RAllocIterator() {}
RAllocIterator(Object::DataPtr data) : Object{std::move(data)} {}

View file

@ -6,7 +6,7 @@
#pragma once
#include "alloc/IAllocIterator_Xfer.hpp"
#include "arena/DArenaIterator.hpp"
#include <xo/arena/DArenaIterator.hpp>
namespace xo {
namespace mm { struct IAllocIterator_DArenaIterator; }

View file

@ -5,7 +5,7 @@
#include "alloc/AAllocator.hpp"
#include "alloc/IAllocator_Xfer.hpp"
#include "arena/DArena.hpp"
#include <xo/arena/DArena.hpp>
namespace xo {
namespace mm { struct IAllocator_DArena; }

View file

@ -1,17 +0,0 @@
/** @file ArenaConfig.cpp
*
* @author Roland Conybeare, Dec 2025
**/
#include "ArenaConfig.hpp"
namespace xo {
namespace mm {
ArenaConfig
ArenaConfig::simple(std::size_t z)
{
return ArenaConfig { .name_ = "anonymous", .size_ = z };
}
}
}
/* end ArenaConfig.cpp */

View file

@ -3,23 +3,24 @@
set(SELF_LIB xo_alloc2)
set(SELF_SRCS
AllocError.cpp
AllocInfo.cpp
cmpresult.cpp
# AllocError.cpp
# AllocInfo.cpp
# cmpresult.cpp
AAllocator.cpp
ArenaConfig.cpp
DArena.cpp
# ArenaConfig.cpp
# DArena.cpp
IAllocator_Any.cpp
IAllocator_DArena.cpp
IAllocIterator_Any.cpp
DArenaIterator.cpp
# DArenaIterator.cpp
IAllocIterator_DArenaIterator.cpp
)
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
# note: deps here must also appear in cmake/xo_alloc2Config.cmake.in
xo_dependency(${SELF_LIB} xo_arena)
xo_dependency(${SELF_LIB} xo_facet)
xo_dependency(${SELF_LIB} indentlog)

View file

@ -9,8 +9,8 @@
namespace xo {
namespace mm {
using xo::facet::DVariantPlaceholder;
using xo::facet::typeseq;
using xo::facet::valid_facet_implementation;
using xo::reflect::typeseq;
void
IAllocIterator_Any::_fatal() {

View file

@ -6,8 +6,8 @@
#include "AllocIterator.hpp"
#include "arena/IAllocator_DArena.hpp"
#include "arena/IAllocIterator_DArenaIterator.hpp" // for alloc_range
#include "arena/DArenaIterator.hpp"
#include "padding.hpp"
#include <xo/arena/DArenaIterator.hpp>
#include <xo/arena/padding.hpp>
#include <xo/facet/obj.hpp>
#include <xo/indentlog/scope.hpp>
#include <cassert>

View file

@ -5,11 +5,9 @@
#include "xo/alloc2/Allocator.hpp"
#include "xo/alloc2/alloc/IAllocator_Xfer.hpp"
//#include "xo/alloc2/DArena.hpp"
#include "xo/alloc2/arena/IAllocator_DArena.hpp"
//#include "xo/alloc2/alloc/RAllocator.hpp"
#include "xo/alloc2/print.hpp"
#include "xo/alloc2/padding.hpp"
#include "xo/arena/padding.hpp"
#include <xo/facet/obj.hpp>
#include <xo/indentlog/scope.hpp>
#include <catch2/catch.hpp>

View file

@ -4,8 +4,8 @@
**/
#include "random_allocs.hpp"
#include "arena/DArena.hpp"
#include "padding.hpp"
#include <xo/arena/DArena.hpp>
#include <xo/arena/padding.hpp>
#include <xo/indentlog/scope.hpp>
#include <xo/indentlog/print/tag.hpp>
#include <catch2/catch.hpp>

31
xo-arena/CMakeLists.txt Normal file
View file

@ -0,0 +1,31 @@
# xo-arena/CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(xo_arena VERSION 1.0)
enable_language(CXX)
include(GNUInstallDirs)
include(cmake/xo-bootstrap-macros.cmake)
xo_cxx_toplevel_options3()
# ----------------------------------------------------------------
# c++ settings
# one-time project-specific c++ flags. usually empty
set(PROJECT_CXX_FLAGS "")
add_definitions(${PROJECT_CXX_FLAGS})
# ----------------------------------------------------------------
# output targets
add_subdirectory(src/arena)
#add_subdirectory(utest)
# ----------------------------------------------------------------
# cmake export
xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
# end CMakeLists.txt

View file

@ -1 +0,0 @@
# xo-arena

View file

@ -0,0 +1,33 @@
# ----------------------------------------------------------------
# for example:
# $ PREFIX=/usr/local # for example
# $ cmake -DCMAKE_MODULE_PATH=prefix -DCMAKE_INSTALL_PREFIX=$PREFIX -B .build
#
# will get
# CMAKE_MODULE_PATH
# from xo-cmake-config --cmake-module-path
#
# and expect .cmake macros in
# CMAKE_MODULE_PATH/xo_macros/xo_cxx.cmake
# ----------------------------------------------------------------
find_program(XO_CMAKE_CONFIG_EXECUTABLE NAMES xo-cmake-config REQUIRED)
if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL "prefix"))
message(FATAL "could not find xo-cmake-config executable")
endif()
if (NOT XO_SUBMODULE_BUILD)
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)
message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
endif()
endif()
# needs to have been installed somewhere on CMAKE_MODULE_PATH,
# (e.g. from xo-cmake with the same value for CMAKE_INSTALL_PREFIX)
#
include(xo_macros/xo_cxx)
xo_cxx_bootstrap_message()

View file

@ -0,0 +1,13 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
# note: changes to find_dependency() calls here
# must coordinate with xo_dependency() calls
# in CMakeLists.txt
#
find_dependency(xo_reflectutil)
find_dependency(indentlog)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components("@PROJECT_NAME@")

View file

View file

@ -6,7 +6,6 @@
#pragma once
#include "AllocHeaderConfig.hpp"
//#include "alloc/AllocError.hpp"
#include <string>
#include <cstdint>

View file

@ -8,7 +8,7 @@
#include "ArenaConfig.hpp"
#include "AllocError.hpp"
#include "AllocInfo.hpp"
#include <xo/facet/typeseq.hpp>
#include <xo/reflectutil/typeseq.hpp>
namespace xo {
namespace mm {
@ -46,7 +46,7 @@ namespace xo {
/** @brief type for allocation header (if enabled) **/
using header_type = AllocHeader;
/** integer identifying a type (see xo::facet::typeid<T>()) **/
using typeseq = xo::facet::typeseq;
using typeseq = xo::reflect::typeseq;
/** @brief mode argument for @ref _alloc **/
enum class alloc_mode : uint8_t {
@ -280,7 +280,7 @@ namespace xo {
static T *
construct_with(DArena & ialloc, Args&&... args)
{
using xo::facet::typeseq;
using xo::reflect::typeseq;
typeseq t = typeseq::id<T>();
std::byte * mem = ialloc.alloc(t, sizeof(T));

View file

@ -0,0 +1,24 @@
# xo-arena/src/CMakeLists.txt
set(SELF_LIB xo_arena)
set(SELF_SRCS
cmpresult.cpp
AllocError.cpp
AllocInfo.cpp
DArena.cpp
DArenaIterator.cpp
)
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
xo_install_include_tree3(include/xo/arena)
# ----------------------------------------------------------------
# input dependencies
#
# NOTE: dependency set here must be kept consistent with
# xo-arena/cmake/xo_arenaConfig.cmake.in
xo_dependency(${SELF_LIB} xo_reflectutil)
xo_dependency(${SELF_LIB} indentlog)
# end src/CMakeLists.txt

View file

@ -3,19 +3,19 @@
* @author Roland Conybeare, Dec 2025
**/
#include "alloc/AAllocator.hpp"
#include "arena/DArena.hpp"
#include "arena/DArenaIterator.hpp"
#include "xo/alloc2/padding.hpp"
#include "xo/indentlog/scope.hpp"
#include "xo/indentlog/print/tag.hpp"
//#include "alloc/AAllocator.hpp"
#include "DArena.hpp"
#include "DArenaIterator.hpp"
#include <xo/arena/padding.hpp>
#include <xo/indentlog/scope.hpp>
#include <xo/indentlog/print/tag.hpp>
#include <cassert>
#include <sys/mman.h> // for ::munmap()
#include <unistd.h> // for ::getpagesize()
#include <string.h> // for ::memset()
namespace xo {
using xo::facet::typeseq;
using xo::reflect::typeseq;
using std::byte;
using std::cerr;
using std::endl;

View file

@ -3,8 +3,8 @@
* @author Roland Conybeare, Dec 2025
**/
#include "arena/DArenaIterator.hpp"
#include "arena/DArena.hpp"
#include "DArenaIterator.hpp"
#include "DArena.hpp"
#include <xo/indentlog/scope.hpp>
#include <xo/indentlog/print/tag.hpp>
#include <cassert>

282
xo-cmake/bin/scaffold-headeronly Executable file
View file

@ -0,0 +1,282 @@
#!/usr/bin/env bash
#
# scaffold-headeronly - Create a new xo library subdirectory
#
# Usage: scaffold-headeronly [--mode=headeronly|shared] <name>
# where <name> is the short name (e.g., "arena" creates "xo-arena")
#
set -euo pipefail
usage() {
echo "Usage: $0 [--mode=headeronly|shared] <name>"
echo " Creates xo-<name>/ with library scaffolding"
echo ""
echo "Options:"
echo " --mode=headeronly Create header-only library (default)"
echo " --mode=shared Create shared library with src/ directory"
echo ""
echo "Example: $0 arena"
echo " Creates xo-arena/CMakeLists.txt"
echo " xo-arena/cmake/xo-bootstrap-macros.cmake"
echo " xo-arena/cmake/xo_arenaConfig.cmake.in"
echo " xo-arena/include/xo/arena/"
echo ""
echo "Example: $0 --mode=shared mylib"
echo " Creates xo-mylib/CMakeLists.txt"
echo " xo-mylib/cmake/xo-bootstrap-macros.cmake"
echo " xo-mylib/cmake/xo_mylibConfig.cmake.in"
echo " xo-mylib/include/xo/mylib/"
echo " xo-mylib/src/CMakeLists.txt"
exit 1
}
# Default mode
MODE="headeronly"
# Parse arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--mode=*)
MODE="${1#--mode=}"
if [[ "$MODE" != "headeronly" && "$MODE" != "shared" ]]; then
echo "Error: --mode must be 'headeronly' or 'shared'"
exit 1
fi
shift
;;
--help|-h)
usage
;;
-*)
echo "Error: unknown option $1"
usage
;;
*)
break
;;
esac
done
if [[ $# -ne 1 ]]; then
usage
fi
NAME="$1"
# Validate name: alphanumeric and underscores only
if [[ ! "$NAME" =~ ^[a-zA-Z][a-zA-Z0-9_]*$ ]]; then
echo "Error: name must start with letter and contain only alphanumeric/underscores"
exit 1
fi
# Derive names
DIR_NAME="xo-${NAME}"
LIB_NAME="xo_${NAME}"
PROJECT_NAME="xo_${NAME}"
# Get script directory to find umbrella root
XO_UMBRELLA_ROOT=$(git rev-parse --show-toplevel)
TARGET_DIR="${XO_UMBRELLA_ROOT}/${DIR_NAME}"
if [[ -d "$TARGET_DIR" ]]; then
echo "Error: ${TARGET_DIR} already exists"
exit 1
fi
echo "Creating ${DIR_NAME} (${MODE}) in ${XO_UMBRELLA_ROOT}..."
# Create directories
mkdir -p "${TARGET_DIR}/cmake"
mkdir -p "${TARGET_DIR}/include/xo/${NAME}"
if [[ "$MODE" == "shared" ]]; then
mkdir -p "${TARGET_DIR}/src"
fi
# Create CMakeLists.txt (different content based on mode)
if [[ "$MODE" == "headeronly" ]]; then
cat > "${TARGET_DIR}/CMakeLists.txt" << EOF
# ${DIR_NAME}/CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(${PROJECT_NAME} VERSION 1.0)
enable_language(CXX)
include(GNUInstallDirs)
include(cmake/xo-bootstrap-macros.cmake)
xo_cxx_toplevel_options3()
# ----------------------------------------------------------------
# c++ settings
# one-time project-specific c++ flags. usually empty
set(PROJECT_CXX_FLAGS "")
add_definitions(\${PROJECT_CXX_FLAGS})
# ----------------------------------------------------------------
# output targets
#add_subdirectory(utest)
# ----------------------------------------------------------------
# header-only library
set(SELF_LIB ${LIB_NAME})
xo_add_headeronly_library(\${SELF_LIB})
xo_install_library4(\${SELF_LIB} \${PROJECT_NAME}Targets)
xo_export_cmake_config(\${PROJECT_NAME} \${PROJECT_VERSION} \${PROJECT_NAME}Targets)
# ----------------------------------------------------------------
# input dependencies
#
# NOTE: dependency set here must be kept consistent with
# ${DIR_NAME}/cmake/${LIB_NAME}Config.cmake.in
#xo_headeronly_dependency(\${SELF_LIB} xo_flatstring)
# end CMakeLists.txt
EOF
else
# Shared library mode
cat > "${TARGET_DIR}/CMakeLists.txt" << EOF
# ${DIR_NAME}/CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(${PROJECT_NAME} VERSION 1.0)
enable_language(CXX)
include(GNUInstallDirs)
include(cmake/xo-bootstrap-macros.cmake)
xo_cxx_toplevel_options3()
# ----------------------------------------------------------------
# c++ settings
# one-time project-specific c++ flags. usually empty
set(PROJECT_CXX_FLAGS "")
add_definitions(\${PROJECT_CXX_FLAGS})
# ----------------------------------------------------------------
# output targets
add_subdirectory(src)
#add_subdirectory(utest)
# ----------------------------------------------------------------
# cmake export
xo_export_cmake_config(\${PROJECT_NAME} \${PROJECT_VERSION} \${PROJECT_NAME}Targets)
# end CMakeLists.txt
EOF
fi
# Create cmake/xo-bootstrap-macros.cmake
cat > "${TARGET_DIR}/cmake/xo-bootstrap-macros.cmake" << EOF
# ----------------------------------------------------------------
# for example:
# $ PREFIX=/usr/local # for example
# $ cmake -DCMAKE_MODULE_PATH=prefix -DCMAKE_INSTALL_PREFIX=\$PREFIX -B .build
#
# will get
# CMAKE_MODULE_PATH
# from xo-cmake-config --cmake-module-path
#
# and expect .cmake macros in
# CMAKE_MODULE_PATH/xo_macros/xo_cxx.cmake
# ----------------------------------------------------------------
find_program(XO_CMAKE_CONFIG_EXECUTABLE NAMES xo-cmake-config REQUIRED)
if (("\${CMAKE_MODULE_PATH}" STREQUAL "") OR ("\${CMAKE_MODULE_PATH}" STREQUAL "prefix"))
message(FATAL "could not find xo-cmake-config executable")
endif()
if (NOT XO_SUBMODULE_BUILD)
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)
message(STATUS "CMAKE_MODULE_PATH=\${CMAKE_MODULE_PATH}")
endif()
endif()
# needs to have been installed somewhere on CMAKE_MODULE_PATH,
# (e.g. from xo-cmake with the same value for CMAKE_INSTALL_PREFIX)
#
include(xo_macros/xo_cxx)
xo_cxx_bootstrap_message()
EOF
# Create cmake/xo_${NAME}Config.cmake.in
cat > "${TARGET_DIR}/cmake/${LIB_NAME}Config.cmake.in" << EOF
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
# note: changes to find_dependency() calls here
# must coordinate with xo_dependency() calls
# in CMakeLists.txt
#
#find_dependency(xo_flatstring)
include("\${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components("@PROJECT_NAME@")
EOF
# Create src/CMakeLists.txt for shared library mode
if [[ "$MODE" == "shared" ]]; then
cat > "${TARGET_DIR}/src/CMakeLists.txt" << EOF
# ${DIR_NAME}/src/CMakeLists.txt
set(SELF_LIB ${LIB_NAME})
set(SELF_SRCS
# Add source files here, e.g.:
# ${NAME}.cpp
)
xo_add_shared_library4(\${SELF_LIB} \${PROJECT_NAME}Targets \${PROJECT_VERSION} 1 \${SELF_SRCS})
xo_install_include_tree3(include/xo/${NAME})
# ----------------------------------------------------------------
# input dependencies
#
# NOTE: dependency set here must be kept consistent with
# ${DIR_NAME}/cmake/${LIB_NAME}Config.cmake.in
#xo_dependency(\${SELF_LIB} xo_indentlog)
# end src/CMakeLists.txt
EOF
fi
# Create placeholder .gitkeep in include dir
touch "${TARGET_DIR}/include/xo/${NAME}/.gitkeep"
echo ""
echo "Created ${DIR_NAME}/ (${MODE}) with:"
echo " ${DIR_NAME}/CMakeLists.txt"
echo " ${DIR_NAME}/cmake/xo-bootstrap-macros.cmake"
echo " ${DIR_NAME}/cmake/${LIB_NAME}Config.cmake.in"
echo " ${DIR_NAME}/include/xo/${NAME}/"
if [[ "$MODE" == "shared" ]]; then
echo " ${DIR_NAME}/src/CMakeLists.txt"
fi
echo ""
echo "Next steps:"
if [[ "$MODE" == "headeronly" ]]; then
echo " 1. Add header files to ${DIR_NAME}/include/xo/${NAME}/"
echo " 2. Add ${DIR_NAME} to umbrella CMakeLists.txt"
echo " 3. Uncomment dependencies as needed in CMakeLists.txt and Config.cmake.in"
else
echo " 1. Add header files to ${DIR_NAME}/include/xo/${NAME}/"
echo " 2. Add source files to ${DIR_NAME}/src/ and update src/CMakeLists.txt SELF_SRCS"
echo " 3. Add ${DIR_NAME} to umbrella CMakeLists.txt"
echo " 4. Uncomment dependencies as needed in src/CMakeLists.txt and Config.cmake.in"
fi

View file

@ -6,7 +6,7 @@
#pragma once
#include "facet_implementation.hpp"
#include "typeseq.hpp"
#include <xo/reflectutil/typeseq.hpp>
#include <new>
#include <cstring>
#include <cstddef>
@ -64,6 +64,7 @@ namespace xo {
using DataType = DRepr;
using DataPtr = DRepr*;
using Opaque = void *;
using typeseq = xo::reflect::typeseq;
/* required for vtable swapping to work */
//static_assert(std::is_trivially_copyable_v<AFacet>);

View file

@ -8,6 +8,7 @@ set(UTEST_SRCS
if (ENABLE_TESTING)
xo_add_utest_executable(${UTEST_EXE} ${UTEST_SRCS})
xo_self_dependency(${UTEST_EXE} xo_arena)
xo_external_target_dependency(${UTEST_EXE} Catch2 Catch2::Catch2)
endif()

View file

@ -10,8 +10,8 @@
#include "object_age.hpp"
#include "role.hpp"
#include <xo/alloc2/Allocator.hpp>
#include <xo/alloc2/arena/ArenaConfig.hpp>
#include <xo/alloc2/arena/DArena.hpp>
#include <xo/arena/DArena.hpp>
#include <xo/arena/ArenaConfig.hpp>
#include <memory>
#include <array>

View file

@ -7,8 +7,8 @@
#include "AllocInfo.hpp"
#include "generation.hpp"
#include "arena/DArenaIterator.hpp"
#include "cmpresult.hpp"
#include <xo/arena/DArenaIterator.hpp>
#include <xo/arena/cmpresult.hpp>
namespace xo {
namespace mm {

View file

@ -8,7 +8,7 @@
#include "DX1CollectorIterator.hpp"
#include "detail/IAllocator_DX1Collector.hpp"
#include "detail/IAllocIterator_DX1CollectorIterator.hpp"
#include "arena/ArenaConfig.hpp"
#include <xo/arena/ArenaConfig.hpp>
#include "padding.hpp"
#include <xo/indentlog/scope.hpp>
#include <xo/indentlog/print/tag.hpp>

View file

@ -4,8 +4,8 @@
**/
#include "random_allocs.hpp"
#include "arena/DArena.hpp"
#include "padding.hpp"
#include <xo/arena/DArena.hpp>
#include <xo/arena/padding.hpp>
#include <xo/indentlog/scope.hpp>
#include <xo/indentlog/print/tag.hpp>
#include <catch2/catch.hpp>

View file

@ -8,6 +8,7 @@
#include <xo/gc/GCObject.hpp>
//#include "xo/alloc2/gcobject/RGCObject.hpp"
#include <xo/facet/obj.hpp>
#include <xo/indentlog/print/ppindentinfo.hpp>
namespace xo {
namespace scm {
@ -16,6 +17,7 @@ namespace xo {
using size_type = std::size_t;
using AGCObject = xo::mm::AGCObject;
using AAllocator = xo::mm::AAllocator;
using ppindentinfo = xo::print::ppindentinfo;
DList(xo::obj<AGCObject> h,
DList * r) : head_{h}, rest_{r} {}

View file

@ -4,6 +4,7 @@
**/
#include "DList.hpp"
#include <xo/indentlog/print/pretty.hpp>
#include <xo/indentlog/print/tag.hpp>
namespace xo {
@ -84,7 +85,6 @@ namespace xo {
return l->head_;
}
#ifdef NOT_YET
bool
DList::pretty(const ppindentinfo & ppii) const
{
@ -95,19 +95,24 @@ namespace xo {
ppstate * pps = ppii.pps();
if (ppii.upto()) {
/* perhaps print on one line */
if (!pps->print_upto("(")
/* perhaps print on one line */
if (!pps->print_upto("(...)"))
return false;
#ifdef NOT_YET
/* TODO: probably use iterators here, when available */
const DList * l = this;
while (!l->is_empty()) {
obj<APrintable>(l->head_.data());
}
#endif
return true;
} else {
pps->write("(...)");
return false;
}
}
#endif
} /*namespace scm*/
} /*namespace xo*/

View file

@ -16,8 +16,8 @@
#include <xo/gc/detail/IAllocator_DX1Collector.hpp>
#include <xo/gc/detail/ICollector_DX1Collector.hpp>
#include <xo/alloc2/AllocInfo.hpp>
#include <xo/alloc2/padding.hpp>
#include <xo/arena/AllocInfo.hpp>
#include <xo/arena/padding.hpp>
#include <xo/indentlog/scope.hpp>
#include <xo/indentlog/print/tag.hpp>

View file

@ -20,6 +20,7 @@ if (ENABLE_TESTING)
xo_headeronly_dependency(${SELF_EXE} xo_reflectutil)
xo_dependency(${SELF_EXE} randomgen)
xo_dependency(${SELF_EXE} indentlog)
xo_dependency(${SELF_EXE} xo_flatstring)
xo_external_target_dependency(${SELF_EXE} Catch2 Catch2::Catch2)
endif()