.xo-type subrepo tidy

This commit is contained in:
Roland Conybeare 2026-06-06 22:27:31 -04:00
commit 6986bfed0b
72 changed files with 0 additions and 3687 deletions

View file

@ -1,130 +0,0 @@
# xo-type/CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(xo_type 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})
# ----------------------------------------------------------------
# facet code generation
xo_add_genfacet(
TARGET xo-type-facet-type
FACET Type
INPUT idl/Type.json5
OUTPUT_HPP_DIR include/xo/type
OUTPUT_IMPL_SUBDIR type
)
# ----------------------------------------------------------------
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-type-facetimpl-type-atomictype
FACET_PKG xo_type
INPUT idl/IType_DAtomicType.json5
)
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-type-facetimpl-gcobject-atomictype
FACET_PKG xo_alloc2
INPUT idl/IGCObject_DAtomicType.json5
)
# ----------------------------------------------------------------
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-type-facetimpl-type-listtype
FACET_PKG xo_type
INPUT idl/IType_DListType.json5
)
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-type-facetimpl-gcobject-listtype
FACET_PKG xo_alloc2
INPUT idl/IGCObject_DListType.json5
)
# ----------------------------------------------------------------
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-type-facetimpl-type-arraytype
FACET_PKG xo_type
INPUT idl/IType_DArrayType.json5
)
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-type-facetimpl-gcobject-arraytype
FACET_PKG xo_alloc2
INPUT idl/IGCObject_DArrayType.json5
)
# ----------------------------------------------------------------
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-type-facetimpl-type-functiontype
FACET_PKG xo_type
INPUT idl/IType_DFunctionType.json5
)
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-type-facetimpl-gcobject-functiontype
FACET_PKG xo_alloc2
INPUT idl/IGCObject_DFunctionType.json5
)
# ----------------------------------------------------------------
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-type-facetimpl-type-typevarref
FACET_PKG xo_type
INPUT idl/IType_DTypeVarRef.json5
)
# note: manual target; generated code committed to git
xo_add_genfacetimpl(
TARGET xo-type-facetimpl-gcobject-typevarref
FACET_PKG xo_alloc2
INPUT idl/IGCObject_DTypeVarRef.json5
)
# ----------------------------------------------------------------
xo_add_genfacet_all(xo-type-genfacet-all)
install(DIRECTORY idl/
DESTINATION share/${PROJECT_NAME}/idl
FILES_MATCHING PATTERN "*.json5")
# ----------------------------------------------------------------
# output targets
add_subdirectory(src/type)
add_subdirectory(utest)
# ----------------------------------------------------------------
# cmake export
xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
# end CMakeLists.txt

View file

@ -1,41 +0,0 @@
# ----------------------------------------------------------------
# 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 ("${XO_CMAKE_CONFIG_EXECUTABLE}" STREQUAL "XO_CMAKE_CONFIG_EXECUTABLE-NOT_FOUND")
message(FATAL "could not find xo-cmake-config executable")
endif()
message(STATUS "XO_CMAKE_CONFIG_EXECUTABLE=${XO_CMAKE_CONFIG_EXECUTABLE}")
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)
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

@ -1,18 +0,0 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(xo_object2)
find_dependency(reflect)
find_dependency(xo_alloc2)
find_dependency(xo_facet)
find_dependency(subsys)
# note: changes to find_dependency() calls here
# must coordinate with xo_dependency() calls
# in src/type/CMakeLists.txt
#
#find_dependency(xo_indentlog)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Share.cmake")
check_required_components("@PROJECT_NAME@")

View file

@ -1,16 +0,0 @@
{
mode: "implementation",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "array",
includes: [
],
local_types: [ ],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/GCObject.json5",
brief: "provide AGCObject interface for DArrayType",
using_doxygen: true,
repr: "DArrayType",
doc: [ "implement AGCObject for DArrayType" ],
}

View file

@ -1,16 +0,0 @@
{
mode: "implementation",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "atomic",
includes: [
],
local_types: [ ],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/GCObject.json5",
brief: "provide AGCObject interface for DAtomicType",
using_doxygen: true,
repr: "DAtomicType",
doc: [ "implement AGCObject for DAtomicType" ],
}

View file

@ -1,16 +0,0 @@
{
mode: "implementation",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "function",
includes: [
],
local_types: [ ],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/GCObject.json5",
brief: "provide AGCObject interface for DFunctionType",
using_doxygen: true,
repr: "DFunctionType",
doc: [ "implement AGCObject for DFunctionType" ],
}

View file

@ -1,16 +0,0 @@
{
mode: "implementation",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "list",
includes: [
],
local_types: [ ],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/GCObject.json5",
brief: "provide AGCObject interface for DListType",
using_doxygen: true,
repr: "DListType",
doc: [ "implement AGCObject for DListType" ],
}

View file

@ -1,16 +0,0 @@
{
mode: "implementation",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "typevar",
includes: [
],
local_types: [ ],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/GCObject.json5",
brief: "provide AGCObject interface for DTypeVar",
using_doxygen: true,
repr: "DTypeVar",
doc: [ "implement AGCObject for DTypeVar" ],
}

View file

@ -1,16 +0,0 @@
{
mode: "implementation",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "typevar",
includes: [
],
local_types: [ ],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/GCObject.json5",
brief: "provide AGCObject interface for DTypeVarRef",
using_doxygen: true,
repr: "DTypeVarRef",
doc: [ "implement AGCObject for DTypeVarRef" ],
}

View file

@ -1,16 +0,0 @@
{
mode: "implementation",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "array",
includes: [],
local_types: [],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/Type.json5",
brief: "provide AType interface for DArrayType",
using_doxygen: true,
repr: "DArrayType",
doc: [ "implement AType for DArrayType" ],
}

View file

@ -1,16 +0,0 @@
{
mode: "implementation",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "atomic",
includes: [],
local_types: [],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/Type.json5",
brief: "provide AType interface for DAtomicType",
using_doxygen: true,
repr: "DAtomicType",
doc: [ "implement AType for DAtomicType" ],
}

View file

@ -1,16 +0,0 @@
{
mode: "implementation",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "function",
includes: [],
local_types: [],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/Type.json5",
brief: "provide AType interface for DFunctionType",
using_doxygen: true,
repr: "DFunctionType",
doc: [ "implement AType for DFunctionType" ],
}

View file

@ -1,16 +0,0 @@
{
mode: "implementation",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "list",
includes: [],
local_types: [],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/Type.json5",
brief: "provide AType interface for DListType",
using_doxygen: true,
repr: "DListType",
doc: [ "implement AType for DListType" ],
}

View file

@ -1,16 +0,0 @@
{
mode: "implementation",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "typevar",
includes: [],
local_types: [],
namespace1: "xo",
namespace2: "scm",
facet_idl: "idl/Type.json5",
brief: "provide AType interface for DTypeVarRef",
using_doxygen: true,
repr: "DTypeVarRef",
doc: [ "implement AType for DTypeVarRef" ],
}

View file

@ -1,76 +0,0 @@
{
mode: "facet",
output_cpp_dir: "src/type",
output_hpp_dir: "include/xo/type",
output_impl_subdir: "type",
includes: [
"<xo/type/Metatype.hpp>",
"<xo/reflect/TypeDescr.hpp>",
],
user_hpp_includes: [
],
namespace1: "xo",
namespace2: "scm", // TODO: change to project namespace if different
pretext: [
"// pretext if any"
],
facet: "Type",
detail_subdir: "type",
brief: "Representation for a Schematika type",
using_doxygen: true,
doc: [
"1. Ability to compare types as members of partial order",
"2. ..."
],
types: [
{
name: "obj_AType",
doc: [],
definition: "xo::facet::obj<AType>",
},
{
name: "TypeDescr",
doc: [],
definition: "xo::reflect::TypeDescr",
}
],
const_methods: [
{
name: "metatype",
doc: ["category for this type"],
return_type: "Metatype",
args: [],
const: true,
noexcept: true,
},
{
name: "repr_td",
doc: ["reflected representation for instances of this type"],
return_type: "TypeDescr",
args: [],
const: true,
noexcept: true,
},
{
name: "is_equal_to",
doc: ["true iff this type is equal to y"],
return_type: "bool",
args: [
{type: "const obj_AType &", name: "y"},
],
const: true,
},
{
name: "is_subtype_of",
doc: ["true iff this is a subtype of y"],
return_type: "bool",
args: [
{type: "const obj_AType &", name: "y"},
],
const: true,
},
],
nonconst_methods: [],
router_facet_explicit_content: [
],
}

View file

@ -1,12 +0,0 @@
/** @file ArrayType.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include "DArrayType.hpp"
#include "array/IType_DArrayType.hpp"
#include "array/IGCObject_DArrayType.hpp"
/* end ArrayType.hpp */

View file

@ -1,12 +0,0 @@
/** @file AtomicType.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include "DAtomicType.hpp"
#include "atomic/IType_DAtomicType.hpp"
#include "atomic/IGCObject_DAtomicType.hpp"
/* end AtomicType.hpp */

View file

@ -1,62 +0,0 @@
/** @file DArrayType.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include "Type.hpp"
#include "Metatype.hpp"
#include <xo/alloc2/Allocator.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp>
namespace xo {
namespace scm {
/** @brief A parameterized array type: array(T)
*
* Represents a fixed-size homogeneous collection.
**/
class DArrayType {
public:
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
public:
/** @defgroup xo-scm-arraytype-ctors **/
///@{
explicit DArrayType(obj<AType> elt);
/** create instance using memory from @p mm with element type @p elt_type **/
static DArrayType * _make(obj<AAllocator> mm, obj<AType> elt_type);
///@}
/** @defgroup xo-scm-arraytype-type-facet **/
///@{
Metatype metatype() const noexcept { return Metatype::t_array(); }
TypeDescr repr_td() const noexcept;
bool is_equal_to(const obj<AType> & y) const noexcept;
bool is_subtype_of(const obj<AType> & y) const noexcept;
///@}
/** @defgroup xo-scm-arraytype-gcobject-facet **/
///@{
DArrayType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:
/** @defgroup xo-scm-arraytype-member-vars **/
///@{
/** all array elements satisfy @ref elt_type_ **/
obj<AType> elt_type_;
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end DArrayType.hpp */

View file

@ -1,57 +0,0 @@
/** @file DAtomicType.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include "Type.hpp"
#include "Metatype.hpp"
#include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/alloc2/Allocator.hpp>
namespace xo {
namespace scm {
/** @brief An atomic schematika type
*
* Types that are not parameterized by types or values.
* For example
* unit, bool, i64, f64
* are atomic in this sense.
**/
class DAtomicType {
public:
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
public:
explicit DAtomicType(Metatype m) : metatype_{m} {}
/** create instance using memory from @p mm with metatype @p mtype **/
static DAtomicType * _make(obj<AAllocator> mm, Metatype mtype);
/** create instance **/
static obj<AType,DAtomicType> make(obj<AAllocator> mm, Metatype mtype);
/** @defgroup xo-scm-atomictype-type-facet **/
///@{
Metatype metatype() const noexcept { return metatype_; }
TypeDescr repr_td() const noexcept;
bool is_equal_to(const obj<AType> & y) const noexcept;
bool is_subtype_of(const obj<AType> & y) const noexcept;
///@}
/** @defgroup xo-scm-atomictype-gcobject-facet **/
///@{
DAtomicType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:
Metatype metatype_;
};
} /*namespace scm*/
} /*namespace xo*/
/* end DAtomicType.hpp */

View file

@ -1,116 +0,0 @@
/** @file DFunctionType.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include "Type.hpp"
#include "Metatype.hpp"
#include <xo/object2/Array.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/alloc2/Allocator.hpp>
namespace xo {
namespace scm {
/** @brief A parameterized array type: array(T)
*
* Represents a fixed-size homogeneous collection.
**/
class DFunctionType {
public:
using AGCObject = xo::mm::AGCObject;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
public:
/** @defgroup xo-scm-arraytype-ctors **/
///@{
/** create instance using memory from @p mm,
* for a function with return type @p ret_type and arguments @p args
**/
template <typename... Args>
requires (std::convertible_to<Args, obj<AType>> && ...)
explicit DFunctionType(obj<AAllocator> mm, obj<AType> ret_type, Args... args);
/** create instance using memory from @p mm,
* for a function with return type @p ret_type and arguments @p args
**/
template <typename... Args>
requires (std::convertible_to<Args, obj<AType>> && ...)
static DFunctionType * _make(obj<AAllocator> mm,
obj<AType> ret_type, Args... args);
#ifdef NOT_USING
/** create instance using memory from @p mm
* for function with return type @p ret_type and arguments @p args
**/
template <typename... Args>
requires (std::same_as<Args, obj<AType>> && ...)
static obj<AType,DFunctionType> make(obj<AAllocator> mm,
obj<AType> ret_type, Args... args);
#endif
///@}
/** @defgroup xo-scm-arraytype-type-facet **/
///@{
Metatype metatype() const noexcept { return Metatype::t_array(); }
TypeDescr repr_td() const noexcept;
bool is_equal_to(obj<AType> y) const noexcept;
bool is_subtype_of(const obj<AType> & y) const noexcept;
///@}
/** @defgroup xo-scm-arraytype-gcobject-facet **/
///@{
DFunctionType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:
/** @defgroup xo-scm-arraytype-member-vars **/
///@{
/** function return type **/
obj<AType> return_type_;
/** argument types **/
DArray * arg_types_ = nullptr;
///@}
};
template <typename... Args>
requires (std::convertible_to<Args, obj<AType>> && ...)
DFunctionType::DFunctionType(obj<AAllocator> mm, obj<AType> return_type, Args... args)
: return_type_{return_type},
arg_types_{DArray::array(mm, args.template to_facet<AGCObject>()...)}
{}
template <typename... Args>
requires (std::convertible_to<Args, obj<AType>> && ...)
DFunctionType *
DFunctionType::_make(obj<AAllocator> mm, obj<AType> ret_type, Args... args)
{
void * mem = mm.alloc_for<DFunctionType>();
return new (mem) DFunctionType(mm, ret_type, args...);
}
#ifdef NOT_USING
template <typename... Args>
requires (std::same_as<Args, obj<AType>> && ...)
obj<AType,DFunctionType>
DFunctionType::make(obj<AAllocator> mm, obj<AType> ret_type, Args... args)
{
void * mem = mm.alloc_for<DFunctionType>();
return obj<AType,DFunctionType>(_make(mm, ret_type, args...));
}
#endif
} /*namespace scm*/
} /*namespace xo*/
/* end DFunctionType.hpp */

View file

@ -1,70 +0,0 @@
/** @file DListType.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include "Type.hpp"
#include "Metatype.hpp"
#include <xo/reflect/TypeDescr.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/alloc2/Allocator.hpp>
namespace xo {
namespace scm {
/** @brief An atomic schematika type
*
* Types that are not parameterized by types or values.
* For example
* unit, bool, i64, f64
* are atomic in this sense.
**/
class DListType {
public:
using TypeDescr = xo::reflect::TypeDescr;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
public:
/** @defgroup xo-scm-listtype-ctors **/
///@{
explicit DListType(obj<AType> elt);
/** create instance using memory from @p mm with element type @p elt_type **/
static DListType * _make(obj<AAllocator> mm,
obj<AType> elt_type);
/** create fop to new instance using memory from @p mm with element type @p elt_type **/
static obj<AType,DListType> make(obj<AAllocator> mm,
obj<AType> elt_type);
///@}
/** @defgroup xo-scm-listtype-type-facet **/
///@{
Metatype metatype() const noexcept { return Metatype::t_list(); }
TypeDescr repr_td() const noexcept;
bool is_equal_to(const obj<AType> & y) const noexcept;
bool is_subtype_of(const obj<AType> & y) const noexcept;
///@}
/** @defgroup xo-scm-listtype-gcobject-facet **/
///@{
DListType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:
/** @defgroup xo-scm-listtype-member-vars **/
///@{
/** all list elements satisfy @ref elt_type_ **/
obj<AType> elt_type_;
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end DListType.hpp */

View file

@ -1,12 +0,0 @@
/** @file FunctionType.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include "DFunctionType.hpp"
#include "function/IType_DFunctionType.hpp"
#include "function/IGCObject_DFunctionType.hpp"
/* end FunctionType.hpp */

View file

@ -1,12 +0,0 @@
/** @file ListType.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include "DListType.hpp"
#include "list/IType_DListType.hpp"
#include "list/IGCObject_DListType.hpp"
/* end ListType.hpp */

View file

@ -1,120 +0,0 @@
/** @file Metatype.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include <iostream>
namespace xo {
namespace scm {
class Metatype {
public:
enum class code {
/* void */
t_unit,
t_bool,
t_str,
/* int16_t */
t_i16,
/* int32_t */
t_i32,
/* int64_t */
t_i64,
/* float */
t_f32,
/* double */
t_f64,
/* discriminated union */
t_sum,
/* list<T> */
t_list,
/* array<T> */
t_array,
/* function<T(U,V,...)> */
t_function,
/* struct<a:T,b:U,..> */
t_struct,
/* dicttionary: like struct, but w/ dynamic key/value pairs */
t_dict,
/** any integer type: i16|i32|i64 **/
t_integer,
/** any numeric type: i16|i32|i64|f32|f64 **/
t_numeric,
/** generalized boolean type: bool, function with bool codomain **/
t_booleic,
/** any callable type (e.g. all function types) **/
t_callable,
/* any type at all */
t_any,
};
public:
explicit Metatype(code x) : code_{x} {}
static Metatype t_unit() { return Metatype(code::t_unit); }
static Metatype t_bool() { return Metatype(code::t_bool); }
static Metatype t_str() { return Metatype(code::t_str); }
static Metatype t_i16() { return Metatype(code::t_i16); }
static Metatype t_i32() { return Metatype(code::t_i32); }
static Metatype t_i64() { return Metatype(code::t_i64); }
static Metatype t_f32() { return Metatype(code::t_f32); }
static Metatype t_f64() { return Metatype(code::t_f64); }
static Metatype t_sum() { return Metatype(code::t_sum); }
static Metatype t_list() { return Metatype(code::t_list); }
static Metatype t_array() { return Metatype(code::t_array); }
static Metatype t_function() { return Metatype(code::t_function); }
static Metatype t_struct() { return Metatype(code::t_struct); }
static Metatype t_dict() { return Metatype(code::t_dict); }
static Metatype t_integer() { return Metatype(code::t_integer); }
static Metatype t_numeric() { return Metatype(code::t_numeric); }
static Metatype t_booleic() { return Metatype(code::t_booleic); }
static Metatype t_callable() { return Metatype(code::t_callable); }
static Metatype t_any() { return Metatype(code::t_any); }
/** description string for this type category **/
const char * _descr() const noexcept;
code code() const noexcept { return code_; }
/** true iff this metatype is non-parametric:
* i.e. stands for a single type
**/
bool is_atomic() const noexcept;
private:
enum code code_;
};
inline bool
operator==(Metatype x, Metatype y) {
return (x.code() == y.code());
}
inline bool
operator!=(Metatype x, Metatype y) {
return (x.code() != y.code());
}
inline std::ostream &
operator<<(std::ostream & os, Metatype x) {
os << x._descr();
return os;
}
} /*namespace scm*/
} /*namespace xo*/
/* end Metatype.hpp */

View file

@ -1,25 +0,0 @@
/** @file SetupType.hpp
*
* @author Roland Conybeare, Jan 2026
**/
#pragma once
#include <xo/alloc2/Collector.hpp>
namespace xo {
namespace scm {
struct SetupType {
public:
using ACollector = xo::mm::ACollector;
public:
/** Register type (facet,impl) combinations with FacetRegistry **/
static bool register_facets();
/** Register type (facet,impl) combinations with FacetRegistry **/
static bool register_types(obj<ACollector> gc);
};
}
}
/* end SetupType.hpp */

View file

@ -1,22 +0,0 @@
/** @file Type.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/Type.json5]
* 2. jinja2 template for facet .hpp file:
* [facet.hpp.j2]
* 3. idl for facet methods
* [idl/Type.json5]
**/
#pragma once
#include "type/AType.hpp"
#include "type/IType_Any.hpp"
#include "type/IType_Xfer.hpp"
#include "type/RType.hpp"
/* end Type.hpp */

View file

@ -1,37 +0,0 @@
/** @file TypeOps.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "AtomicType.hpp"
#include "ListType.hpp"
#include "ArrayType.hpp"
#include <xo/alloc2/Allocator.hpp>
namespace xo {
namespace scm {
class TypeOps {
public:
using AAllocator = xo::mm::AAllocator;
template <typename AFacet = AType>
static obj<AFacet,DAtomicType> atomic_type(obj<AAllocator> mm, Metatype metatype) {
assert(metatype.is_atomic());
return obj<AFacet,DAtomicType>(DAtomicType::_make(mm, metatype));
}
template <typename AFacet = AType>
static obj<AFacet,DListType> list_type(obj<AAllocator> mm, obj<AType> elt_type) {
return obj<AFacet,DListType>(DListType::_make(mm, elt_type));
}
template <typename AFacet = AType>
static obj<AFacet,DArrayType> array_type(obj<AAllocator> mm, obj<AType> elt_type) {
return obj<AFacet,DArrayType>(DArrayType::_make(mm, elt_type));
}
};
} /*namespace scm*/
} /*namespace xo*/
/* end TypeOps.hpp */

View file

@ -1,12 +0,0 @@
/** @file TypeVarRef.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include "typevar/DTypeVarRef.hpp"
#include "typevar/IGCObject_DTypeVarRef.hpp"
#include "typevar/IType_DTypeVarRef.hpp"
/* end TypeVarRef.hpp */

View file

@ -1,67 +0,0 @@
/** @file IGCObject_DArrayType.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DArrayType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DArrayType.json5]
**/
#pragma once
#include "GCObject.hpp"
#include "DArrayType.hpp"
namespace xo { namespace scm { class IGCObject_DArrayType; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::mm::AGCObject,
xo::scm::DArrayType>
{
using ImplType = xo::mm::IGCObject_Xfer
<xo::scm::DArrayType,
xo::scm::IGCObject_DArrayType>;
};
}
}
namespace xo {
namespace scm {
/** @class IGCObject_DArrayType
**/
class IGCObject_DArrayType {
public:
/** @defgroup scm-gcobject-darraytype-type-traits **/
///@{
using size_type = xo::mm::AGCObject::size_type;
using AAllocator = xo::mm::AGCObject::AAllocator;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using VisitReason = xo::mm::AGCObject::VisitReason;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
/** @defgroup scm-gcobject-darraytype-methods **/
///@{
// const methods
// non-const methods
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DArrayType & self, obj<AGCObjectVisitor> gc) noexcept;
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
Context: provides address of data pointer so it can be updated in place
when @p fn invokes garbage collector reentry point **/
static void visit_gco_children(DArrayType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -1,66 +0,0 @@
/** @file IType_DArrayType.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IType_DArrayType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IType_DArrayType.json5]
**/
#pragma once
#include "Type.hpp"
#include "DArrayType.hpp"
namespace xo { namespace scm { class IType_DArrayType; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::scm::AType,
xo::scm::DArrayType>
{
using ImplType = xo::scm::IType_Xfer
<xo::scm::DArrayType,
xo::scm::IType_DArrayType>;
};
}
}
namespace xo {
namespace scm {
/** @class IType_DArrayType
**/
class IType_DArrayType {
public:
/** @defgroup scm-type-darraytype-type-traits **/
///@{
using obj_AType = xo::scm::AType::obj_AType;
using TypeDescr = xo::scm::AType::TypeDescr;
using Copaque = xo::scm::AType::Copaque;
using Opaque = xo::scm::AType::Opaque;
///@}
/** @defgroup scm-type-darraytype-methods **/
///@{
// const methods
/** category for this type **/
static Metatype metatype(const DArrayType & self) noexcept;
/** reflected representation for instances of this type **/
static TypeDescr repr_td(const DArrayType & self) noexcept;
/** true iff this type is equal to y **/
static bool is_equal_to(const DArrayType & self, const obj_AType & y);
/** true iff this is a subtype of y **/
static bool is_subtype_of(const DArrayType & self, const obj_AType & y);
// non-const methods
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -1,67 +0,0 @@
/** @file IGCObject_DAtomicType.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DAtomicType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DAtomicType.json5]
**/
#pragma once
#include "GCObject.hpp"
#include "DAtomicType.hpp"
namespace xo { namespace scm { class IGCObject_DAtomicType; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::mm::AGCObject,
xo::scm::DAtomicType>
{
using ImplType = xo::mm::IGCObject_Xfer
<xo::scm::DAtomicType,
xo::scm::IGCObject_DAtomicType>;
};
}
}
namespace xo {
namespace scm {
/** @class IGCObject_DAtomicType
**/
class IGCObject_DAtomicType {
public:
/** @defgroup scm-gcobject-datomictype-type-traits **/
///@{
using size_type = xo::mm::AGCObject::size_type;
using AAllocator = xo::mm::AGCObject::AAllocator;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using VisitReason = xo::mm::AGCObject::VisitReason;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
/** @defgroup scm-gcobject-datomictype-methods **/
///@{
// const methods
// non-const methods
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DAtomicType & self, obj<AGCObjectVisitor> gc) noexcept;
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
Context: provides address of data pointer so it can be updated in place
when @p fn invokes garbage collector reentry point **/
static void visit_gco_children(DAtomicType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -1,66 +0,0 @@
/** @file IType_DAtomicType.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IType_DAtomicType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IType_DAtomicType.json5]
**/
#pragma once
#include "Type.hpp"
#include "DAtomicType.hpp"
namespace xo { namespace scm { class IType_DAtomicType; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::scm::AType,
xo::scm::DAtomicType>
{
using ImplType = xo::scm::IType_Xfer
<xo::scm::DAtomicType,
xo::scm::IType_DAtomicType>;
};
}
}
namespace xo {
namespace scm {
/** @class IType_DAtomicType
**/
class IType_DAtomicType {
public:
/** @defgroup scm-type-datomictype-type-traits **/
///@{
using obj_AType = xo::scm::AType::obj_AType;
using TypeDescr = xo::scm::AType::TypeDescr;
using Copaque = xo::scm::AType::Copaque;
using Opaque = xo::scm::AType::Opaque;
///@}
/** @defgroup scm-type-datomictype-methods **/
///@{
// const methods
/** category for this type **/
static Metatype metatype(const DAtomicType & self) noexcept;
/** reflected representation for instances of this type **/
static TypeDescr repr_td(const DAtomicType & self) noexcept;
/** true iff this type is equal to y **/
static bool is_equal_to(const DAtomicType & self, const obj_AType & y);
/** true iff this is a subtype of y **/
static bool is_subtype_of(const DAtomicType & self, const obj_AType & y);
// non-const methods
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -1,67 +0,0 @@
/** @file IGCObject_DFunctionType.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DFunctionType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DFunctionType.json5]
**/
#pragma once
#include "GCObject.hpp"
#include "DFunctionType.hpp"
namespace xo { namespace scm { class IGCObject_DFunctionType; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::mm::AGCObject,
xo::scm::DFunctionType>
{
using ImplType = xo::mm::IGCObject_Xfer
<xo::scm::DFunctionType,
xo::scm::IGCObject_DFunctionType>;
};
}
}
namespace xo {
namespace scm {
/** @class IGCObject_DFunctionType
**/
class IGCObject_DFunctionType {
public:
/** @defgroup scm-gcobject-dfunctiontype-type-traits **/
///@{
using size_type = xo::mm::AGCObject::size_type;
using AAllocator = xo::mm::AGCObject::AAllocator;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using VisitReason = xo::mm::AGCObject::VisitReason;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
/** @defgroup scm-gcobject-dfunctiontype-methods **/
///@{
// const methods
// non-const methods
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DFunctionType & self, obj<AGCObjectVisitor> gc) noexcept;
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
Context: provides address of data pointer so it can be updated in place
when @p fn invokes garbage collector reentry point **/
static void visit_gco_children(DFunctionType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -1,66 +0,0 @@
/** @file IType_DFunctionType.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IType_DFunctionType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IType_DFunctionType.json5]
**/
#pragma once
#include "Type.hpp"
#include "DFunctionType.hpp"
namespace xo { namespace scm { class IType_DFunctionType; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::scm::AType,
xo::scm::DFunctionType>
{
using ImplType = xo::scm::IType_Xfer
<xo::scm::DFunctionType,
xo::scm::IType_DFunctionType>;
};
}
}
namespace xo {
namespace scm {
/** @class IType_DFunctionType
**/
class IType_DFunctionType {
public:
/** @defgroup scm-type-dfunctiontype-type-traits **/
///@{
using obj_AType = xo::scm::AType::obj_AType;
using TypeDescr = xo::scm::AType::TypeDescr;
using Copaque = xo::scm::AType::Copaque;
using Opaque = xo::scm::AType::Opaque;
///@}
/** @defgroup scm-type-dfunctiontype-methods **/
///@{
// const methods
/** category for this type **/
static Metatype metatype(const DFunctionType & self) noexcept;
/** reflected representation for instances of this type **/
static TypeDescr repr_td(const DFunctionType & self) noexcept;
/** true iff this type is equal to y **/
static bool is_equal_to(const DFunctionType & self, const obj_AType & y);
/** true iff this is a subtype of y **/
static bool is_subtype_of(const DFunctionType & self, const obj_AType & y);
// non-const methods
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -1,21 +0,0 @@
/** @file init_type.hpp
*
* @author Roland Conybeare, Jan 2026
**/
#pragma once
#include <xo/subsys/Subsystem.hpp>
namespace xo {
/* tag to represent the xo-expression2/ subsystem within ordered initialization */
enum S_type_tag {};
template <>
struct InitSubsys<S_type_tag> {
static void init();
static InitEvidence require();
};
} /*namespace xo*/
/* end init_type.hpp */

View file

@ -1,67 +0,0 @@
/** @file IGCObject_DListType.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DListType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DListType.json5]
**/
#pragma once
#include "GCObject.hpp"
#include "DListType.hpp"
namespace xo { namespace scm { class IGCObject_DListType; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::mm::AGCObject,
xo::scm::DListType>
{
using ImplType = xo::mm::IGCObject_Xfer
<xo::scm::DListType,
xo::scm::IGCObject_DListType>;
};
}
}
namespace xo {
namespace scm {
/** @class IGCObject_DListType
**/
class IGCObject_DListType {
public:
/** @defgroup scm-gcobject-dlisttype-type-traits **/
///@{
using size_type = xo::mm::AGCObject::size_type;
using AAllocator = xo::mm::AGCObject::AAllocator;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using VisitReason = xo::mm::AGCObject::VisitReason;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
/** @defgroup scm-gcobject-dlisttype-methods **/
///@{
// const methods
// non-const methods
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DListType & self, obj<AGCObjectVisitor> gc) noexcept;
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
Context: provides address of data pointer so it can be updated in place
when @p fn invokes garbage collector reentry point **/
static void visit_gco_children(DListType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -1,66 +0,0 @@
/** @file IType_DListType.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IType_DListType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IType_DListType.json5]
**/
#pragma once
#include "Type.hpp"
#include "DListType.hpp"
namespace xo { namespace scm { class IType_DListType; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::scm::AType,
xo::scm::DListType>
{
using ImplType = xo::scm::IType_Xfer
<xo::scm::DListType,
xo::scm::IType_DListType>;
};
}
}
namespace xo {
namespace scm {
/** @class IType_DListType
**/
class IType_DListType {
public:
/** @defgroup scm-type-dlisttype-type-traits **/
///@{
using obj_AType = xo::scm::AType::obj_AType;
using TypeDescr = xo::scm::AType::TypeDescr;
using Copaque = xo::scm::AType::Copaque;
using Opaque = xo::scm::AType::Opaque;
///@}
/** @defgroup scm-type-dlisttype-methods **/
///@{
// const methods
/** category for this type **/
static Metatype metatype(const DListType & self) noexcept;
/** reflected representation for instances of this type **/
static TypeDescr repr_td(const DListType & self) noexcept;
/** true iff this type is equal to y **/
static bool is_equal_to(const DListType & self, const obj_AType & y);
/** true iff this is a subtype of y **/
static bool is_subtype_of(const DListType & self, const obj_AType & y);
// non-const methods
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -1,91 +0,0 @@
/** @file AType.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/Type.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [abstract_facet.hpp.j2]
* 3. idl for facet methods
* [idl/Type.json5]
**/
#pragma once
// includes (via {facet_includes})
#include <xo/type/Metatype.hpp>
#include <xo/reflect/TypeDescr.hpp>
#include <xo/facet/obj.hpp>
#include <xo/facet/facet_implementation.hpp>
#include <xo/facet/typeseq.hpp>
// pretext if any
namespace xo {
namespace scm {
using Copaque = const void *;
using Opaque = void *;
/**
1. Ability to compare types as members of partial order
2. ...
**/
class AType {
public:
/** @defgroup scm-type-type-traits **/
///@{
// types
/** integer identifying a type **/
using typeseq = xo::facet::typeseq;
using Copaque = const void *;
using Opaque = void *;
/** **/
using obj_AType = xo::facet::obj<AType>;
/** **/
using TypeDescr = xo::reflect::TypeDescr;
///@}
/** @defgroup scm-type-methods **/
///@{
// const methods
/** An uninitialized AType instance will have zero vtable pointer (per {linux,osx} abi).
* Use case for this is narrow. We go to some lengths to avoid null vtable pointers. For example
* obj<AFacet> will have non-null vtable (via IFacet_Any) with all methods terminating.
**/
bool _has_null_vptr() const noexcept { return *reinterpret_cast<const void * const *>(this) == nullptr; }
/** RTTI: unique id# for actual runtime data representation **/
virtual typeseq _typeseq() const noexcept = 0;
/** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/
virtual void _drop(Opaque d) const noexcept = 0;
/** category for this type **/
virtual Metatype metatype(Copaque data) const noexcept = 0;
/** reflected representation for instances of this type **/
virtual TypeDescr repr_td(Copaque data) const noexcept = 0;
/** true iff this type is equal to y **/
virtual bool is_equal_to(Copaque data, const obj_AType & y) const = 0;
/** true iff this is a subtype of y **/
virtual bool is_subtype_of(Copaque data, const obj_AType & y) const = 0;
// nonconst methods
///@}
}; /*AType*/
/** Implementation IType_DRepr of AType for state DRepr
* should provide a specialization:
*
* template <>
* struct xo::facet::FacetImplementation<AType, DRepr> {
* using Impltype = IType_DRepr;
* };
*
* then IType_ImplType<DRepr> --> IType_DRepr
**/
template <typename DRepr>
using IType_ImplType = xo::facet::FacetImplType<AType, DRepr>;
} /*namespace scm*/
} /*namespace xo*/
/* AType.hpp */

View file

@ -1,93 +0,0 @@
/** @file IType_Any.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/Type.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/Type.json5]
**/
#pragma once
#include "AType.hpp"
#include <xo/facet/obj.hpp>
namespace xo { namespace scm { class IType_Any; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::scm::AType,
DVariantPlaceholder>
{
using ImplType = xo::scm::IType_Any;
};
}
}
namespace xo {
namespace scm {
/** @class IType_Any
* @brief AType implementation for empty variant instance
**/
class IType_Any : public AType {
public:
/** @defgroup scm-type-any-type-traits **/
///@{
/** integer identifying a type **/
using typeseq = xo::facet::typeseq;
using obj_AType = AType::obj_AType;
using TypeDescr = AType::TypeDescr;
///@}
/** @defgroup scm-type-any-methods **/
///@{
const AType * iface() const { return std::launder(this); }
// from AType
// builtin methods
typeseq _typeseq() const noexcept override { return s_typeseq; }
[[noreturn]] void _drop(Opaque) const noexcept override { _fatal(); }
// const methods
[[noreturn]] Metatype metatype(Copaque) const noexcept override { _fatal(); }
[[noreturn]] TypeDescr repr_td(Copaque) const noexcept override { _fatal(); }
[[noreturn]] bool is_equal_to(Copaque, const obj_AType &) const override { _fatal(); }
[[noreturn]] bool is_subtype_of(Copaque, const obj_AType &) const override { _fatal(); }
// nonconst methods
///@}
private:
/** @defgraoup scm-type-any-private-methods **/
///@{
[[noreturn]] static void _fatal();
///@}
public:
/** @defgroup scm-type-any-member-vars **/
///@{
static typeseq s_typeseq;
static bool _valid;
///@}
};
} /*namespace scm */
} /*namespace xo */
/* IType_Any.hpp */

View file

@ -1,103 +0,0 @@
/** @file IType_Xfer.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/Type.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/Type.json5]
*
* variables:
* {facet_hpp_fname} -> Type.hpp
* {impl_hpp_subdir} -> type
* {facet_ns1} -> xo
* {facet_detail_subdir} -> type
* {abstract_facet_fname} -> AType.hpp
**/
#pragma once
#include "AType.hpp"
#include <xo/type/Metatype.hpp>
#include <xo/reflect/TypeDescr.hpp>
namespace xo {
namespace scm {
/** @class IType_Xfer
**/
template <typename DRepr, typename IType_DRepr>
class IType_Xfer : public AType {
public:
/** @defgroup scm-type-xfer-type-traits **/
///@{
/** actual implementation (not generated; often delegates to DRepr) **/
using Impl = IType_DRepr;
/** integer identifying a type **/
using typeseq = AType::typeseq;
using obj_AType = AType::obj_AType;
using TypeDescr = AType::TypeDescr;
///@}
/** @defgroup scm-type-xfer-methods **/
///@{
static const DRepr & _dcast(Copaque d) { return *(const DRepr *)d; }
static DRepr & _dcast(Opaque d) { return *(DRepr *)d; }
// from AType
// builtin methods
typeseq _typeseq() const noexcept override { return s_typeseq; }
void _drop(Opaque d) const noexcept override { _dcast(d).~DRepr(); }
// const methods
Metatype metatype(Copaque data) const noexcept override {
return I::metatype(_dcast(data));
}
TypeDescr repr_td(Copaque data) const noexcept override {
return I::repr_td(_dcast(data));
}
bool is_equal_to(Copaque data, const obj_AType & y) const override {
return I::is_equal_to(_dcast(data), y);
}
bool is_subtype_of(Copaque data, const obj_AType & y) const override {
return I::is_subtype_of(_dcast(data), y);
}
// non-const methods
///@}
private:
using I = Impl;
public:
/** @defgroup scm-type-xfer-member-vars **/
///@{
/** typeseq for template parameter DRepr **/
static typeseq s_typeseq;
/** true iff satisfies facet implementation **/
static bool _valid;
///@}
};
template <typename DRepr, typename IType_DRepr>
xo::facet::typeseq
IType_Xfer<DRepr, IType_DRepr>::s_typeseq
= xo::facet::typeseq::id<DRepr>();
template <typename DRepr, typename IType_DRepr>
bool
IType_Xfer<DRepr, IType_DRepr>::_valid
= xo::facet::valid_facet_implementation<AType,
IType_Xfer>();
} /*namespace scm */
} /*namespace xo*/
/* end IType_Xfer.hpp */

View file

@ -1,95 +0,0 @@
/** @file RType.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/Type.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/Type.json5]
**/
#pragma once
#include "AType.hpp"
namespace xo {
namespace scm {
/** @class RType
**/
template <typename Object>
class RType : public Object {
private:
using O = Object;
public:
/** @defgroup scm-type-router-type-traits **/
///@{
using ObjectType = Object;
using DataPtr = Object::DataPtr;
using typeseq = xo::reflect::typeseq;
using obj_AType = AType::obj_AType;
using TypeDescr = AType::TypeDescr;
///@}
/** @defgroup scm-type-router-ctors **/
///@{
RType() {}
RType(Object::DataPtr data) : Object{std::move(data)} {}
RType(const AType * iface, void * data)
requires std::is_same_v<typename Object::DataType, xo::facet::DVariantPlaceholder>
: Object(iface, data) {}
///@}
/** @defgroup scm-type-router-methods **/
///@{
// explicit injected content
// builtin methods
typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); }
void _drop() const noexcept { O::iface()->_drop(O::data()); }
// const methods
Metatype metatype() const noexcept {
return O::iface()->metatype(O::data());
}
TypeDescr repr_td() const noexcept {
return O::iface()->repr_td(O::data());
}
bool is_equal_to(const obj_AType & y) const {
return O::iface()->is_equal_to(O::data(), y);
}
bool is_subtype_of(const obj_AType & y) const {
return O::iface()->is_subtype_of(O::data(), y);
}
// non-const methods (still const in router!)
///@}
/** @defgroup scm-type-member-vars **/
///@{
static bool _valid;
///@}
};
template <typename Object>
bool
RType<Object>::_valid = xo::facet::valid_object_router<Object>();
} /*namespace scm*/
} /*namespace xo*/
namespace xo { namespace facet {
template <typename Object>
struct RoutingFor<xo::scm::AType, Object> {
using RoutingType = xo::scm::RType<Object>;
};
} }
/* end RType.hpp */

View file

@ -1,71 +0,0 @@
/** @file DTypeVarRef.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include "Type.hpp"
#include "Metatype.hpp"
#include <xo/alloc2/Allocator.hpp>
#include <xo/stringtable2/UniqueString.hpp>
namespace xo {
namespace scm {
/** @brief An atomic schematika type
*
* Types that are not parameterized by types or values.
* For example
* unit, bool, i64, f64
* are atomic in this sense.
**/
class DTypeVarRef {
public:
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
public:
/** @defgroup xo-scm-typevarref-ctors constructors **/
///@{
explicit DTypeVarRef(const DUniqueString * name) : name_{name} {}
/** create instance using memory from @p mm with metatype @p mtype **/
static DTypeVarRef * _make(obj<AAllocator> mm, const DUniqueString * name);
/** create instance **/
static obj<AType,DTypeVarRef> make(obj<AAllocator> mm, const DUniqueString * name);
///@}
/** @defgroup xo-scm-typevarref-general-methods general methods **/
///@{
const DUniqueString * name() const noexcept { return name_; }
///@}
/** @defgroup xo-scm-atomictype-type-facet **/
///@{
Metatype metatype() const noexcept;
TypeDescr repr_td() const noexcept;
bool is_equal_to(const obj<AType> & y) const noexcept;
bool is_subtype_of(const obj<AType> & y) const noexcept;
///@}
/** @defgroup xo-scm-atomictype-gcobject-facet **/
///@{
DTypeVarRef * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:
/** unique type-variable name **/
const DUniqueString * name_ = nullptr;
/** resolved type (if/when established) **/
obj<AType> type_;
};
} /*namespace scm*/
} /*namespace xo*/
/* end DTypeVarRef.hpp */

View file

@ -1,67 +0,0 @@
/** @file IGCObject_DTypeVarRef.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DTypeVarRef.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DTypeVarRef.json5]
**/
#pragma once
#include "GCObject.hpp"
#include "DTypeVarRef.hpp"
namespace xo { namespace scm { class IGCObject_DTypeVarRef; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::mm::AGCObject,
xo::scm::DTypeVarRef>
{
using ImplType = xo::mm::IGCObject_Xfer
<xo::scm::DTypeVarRef,
xo::scm::IGCObject_DTypeVarRef>;
};
}
}
namespace xo {
namespace scm {
/** @class IGCObject_DTypeVarRef
**/
class IGCObject_DTypeVarRef {
public:
/** @defgroup scm-gcobject-dtypevarref-type-traits **/
///@{
using size_type = xo::mm::AGCObject::size_type;
using AAllocator = xo::mm::AGCObject::AAllocator;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using VisitReason = xo::mm::AGCObject::VisitReason;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
/** @defgroup scm-gcobject-dtypevarref-methods **/
///@{
// const methods
// non-const methods
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DTypeVarRef & self, obj<AGCObjectVisitor> gc) noexcept;
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
Context: provides address of data pointer so it can be updated in place
when @p fn invokes garbage collector reentry point **/
static void visit_gco_children(DTypeVarRef & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -1,66 +0,0 @@
/** @file IType_DTypeVarRef.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IType_DTypeVarRef.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IType_DTypeVarRef.json5]
**/
#pragma once
#include "Type.hpp"
#include "DTypeVarRef.hpp"
namespace xo { namespace scm { class IType_DTypeVarRef; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::scm::AType,
xo::scm::DTypeVarRef>
{
using ImplType = xo::scm::IType_Xfer
<xo::scm::DTypeVarRef,
xo::scm::IType_DTypeVarRef>;
};
}
}
namespace xo {
namespace scm {
/** @class IType_DTypeVarRef
**/
class IType_DTypeVarRef {
public:
/** @defgroup scm-type-dtypevarref-type-traits **/
///@{
using obj_AType = xo::scm::AType::obj_AType;
using TypeDescr = xo::scm::AType::TypeDescr;
using Copaque = xo::scm::AType::Copaque;
using Opaque = xo::scm::AType::Opaque;
///@}
/** @defgroup scm-type-dtypevarref-methods **/
///@{
// const methods
/** category for this type **/
static Metatype metatype(const DTypeVarRef & self) noexcept;
/** reflected representation for instances of this type **/
static TypeDescr repr_td(const DTypeVarRef & self) noexcept;
/** true iff this type is equal to y **/
static bool is_equal_to(const DTypeVarRef & self, const obj_AType & y);
/** true iff this is a subtype of y **/
static bool is_subtype_of(const DTypeVarRef & self, const obj_AType & y);
// non-const methods
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */

View file

@ -1,41 +0,0 @@
# xo-type/src/type/CMakeLists.txt
set(SELF_LIB xo_type)
set(SELF_SRCS
init_type.cpp
SetupType.cpp
TypeOps.cpp
Metatype.cpp
DAtomicType.cpp
DListType.cpp
DArrayType.cpp
DFunctionType.cpp
DTypeVarRef.cpp
IType_Any.cpp
IType_DAtomicType.cpp
IType_DListType.cpp
IType_DArrayType.cpp
IType_DFunctionType.cpp
IType_DTypeVarRef.cpp
IGCObject_DAtomicType.cpp
IGCObject_DListType.cpp
IGCObject_DArrayType.cpp
IGCObject_DFunctionType.cpp
IGCObject_DTypeVarRef.cpp
)
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
# ----------------------------------------------------------------
# input dependencies
#
# NOTE: dependency set here must be kept consistent with
# xo-type/cmake/xo_typeConfig.cmake.in
xo_dependency(${SELF_LIB} xo_object2)
xo_dependency(${SELF_LIB} reflect)
xo_dependency(${SELF_LIB} xo_alloc2)
xo_dependency(${SELF_LIB} xo_facet)
xo_dependency(${SELF_LIB} subsys)
# end src/type/CMakeLists.txt

View file

@ -1,92 +0,0 @@
/** @file DArrayType.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "Type.hpp"
#include "ArrayType.hpp"
#include "TypeDescr.hpp"
#include <xo/reflect/Reflect.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <xo/facet/FacetRegistry.hpp>
namespace xo {
using xo::reflect::Reflect;
using xo::reflect::TypeDescr;
using xo::mm::AGCObject;
using xo::mm::AAllocator;
using xo::facet::FacetRegistry;
namespace scm {
DArrayType::DArrayType(obj<AType> elt)
: elt_type_{elt}
{}
DArrayType *
DArrayType::_make(obj<AAllocator> mm,
obj<AType> elt_type)
{
void * mem = mm.alloc_for<DArrayType>();
return new (mem) DArrayType(elt_type);
}
// ----- type facet -----
TypeDescr
DArrayType::repr_td() const noexcept
{
return Reflect::require<void *>();
}
bool
DArrayType::is_equal_to(const obj<AType> & y_arg) const noexcept
{
Metatype y_mtype = y_arg.metatype();
if (y_mtype != Metatype::t_array())
return false;
auto y = obj<AType,DArrayType>::from(y_arg);
obj<AType> e = elt_type_;
return (e.is_equal_to(y->elt_type_));
}
bool
DArrayType::is_subtype_of(const obj<AType> & y_arg) const noexcept
{
Metatype y_mtype = y_arg.metatype();
if (y_mtype == Metatype::t_any())
return true;
if (y_mtype != Metatype::t_array())
return false;
auto y = obj<AType,DArrayType>::from(y_arg);
obj<AType> e = elt_type_;
return (e.is_subtype_of(y->elt_type_));
}
// ----- gcobject facet -----
DArrayType *
DArrayType::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}
void
DArrayType::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_poly_child(reason, &elt_type_);
}
}
}
/* end DArrayType.cpp */

View file

@ -1,72 +0,0 @@
/** @file DAtomicType.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "AtomicType.hpp"
#include <xo/reflect/Reflect.hpp>
namespace xo {
using xo::reflect::Reflect;
using xo::reflect::TypeDescr;
namespace scm {
DAtomicType *
DAtomicType::_make(obj<AAllocator> mm, Metatype mtype)
{
void * mem = mm.alloc_for<DAtomicType>();
return new (mem) DAtomicType(mtype);
}
obj<AType,DAtomicType>
DAtomicType::make(obj<AAllocator> mm, Metatype mtype)
{
return obj<AType,DAtomicType>(_make(mm, mtype));
}
// ----- Type facet -----
TypeDescr
DAtomicType::repr_td() const noexcept
{
return Reflect::require<void *>();
}
bool
DAtomicType::is_equal_to(const obj<AType> & y) const noexcept
{
return (metatype_.code() == y.metatype().code());
}
bool
DAtomicType::is_subtype_of(const obj<AType> & y) const noexcept
{
Metatype x_mtype = metatype_;
Metatype y_mtype = y.metatype();
if (y_mtype.code() == Metatype::code::t_any)
return true;
return (x_mtype.code() == y_mtype.code());
}
// ----- GCObject facet -----
DAtomicType *
DAtomicType::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}
void
DAtomicType::visit_gco_children(VisitReason, obj<AGCObjectVisitor>) noexcept
{
// no-op. no children
}
} /*namespace scm*/
} /*namespace xo*/
/* end DAtomicType.cpp */

View file

@ -1,106 +0,0 @@
/** @file DFunctionType.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "FunctionType.hpp"
#include <xo/reflect/Reflect.hpp>
#include <xo/facet/FacetRegistry.hpp>
namespace xo {
using xo::reflect::Reflect;
using xo::reflect::TypeDescr;
using xo::facet::FacetRegistry;
namespace scm {
// ----- type facet -----
TypeDescr
DFunctionType::repr_td() const noexcept
{
return Reflect::require<void *>();
}
bool
DFunctionType::is_equal_to(obj<AType> y_arg) const noexcept
{
Metatype y_mtype = y_arg.metatype();
if (y_mtype != Metatype::t_function())
return false;
auto y = obj<AType,DFunctionType>::from(y_arg);
assert(y);
if (arg_types_->size() != y->arg_types_->size())
return false;
if (obj<AType>(return_type_).is_equal_to(y->return_type_))
return false;
for (size_t i = 0, n = arg_types_->size(); i < n; ++i) {
auto argtype1
= FacetRegistry::instance().variant<AType,AGCObject>((*arg_types_)[i]);
auto argtype2
= FacetRegistry::instance().variant<AType,AGCObject>((*(y->arg_types_))[i]);
if (argtype1.is_equal_to(argtype2))
return false;
}
return true;
}
bool
DFunctionType::is_subtype_of(const obj<AType> & y_arg) const noexcept
{
Metatype y_mtype = y_arg.metatype();
if (y_mtype == Metatype::t_any())
return true;
if (y_mtype != Metatype::t_function())
return false;
auto y = obj<AType,DFunctionType>::from(y_arg);
assert(y);
if (arg_types_->size() != y->arg_types_->size())
return false;
if (!obj<AType>(return_type_).is_subtype_of(y->return_type_))
return false;
for (size_t i = 0, n = arg_types_->size(); i < n; ++i) {
auto x_argtype
= FacetRegistry::instance().variant<AType,AGCObject>((*arg_types_)[i]);
auto y_argtype
= FacetRegistry::instance().variant<AType,AGCObject>((*(y->arg_types_))[i]);
if (!y_argtype.is_subtype_of(x_argtype))
return false;
}
return true;
}
// ----- gcobject facet -----
DFunctionType *
DFunctionType::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}
void
DFunctionType::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_poly_child(reason, &return_type_);
gc.visit_child(reason, &arg_types_);
}
} /*namespace scm*/
} /*namespace xo*/
/* end DFunctionType.cpp */

View file

@ -1,103 +0,0 @@
/** @file DListType.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "Type.hpp"
#include "ListType.hpp"
#include "TypeDescr.hpp"
#include <xo/reflect/Reflect.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <xo/facet/FacetRegistry.hpp>
namespace xo {
using xo::reflect::Reflect;
using xo::reflect::TypeDescr;
using xo::mm::AGCObject;
using xo::mm::AAllocator;
using xo::facet::FacetRegistry;
namespace scm {
DListType::DListType(obj<AType> elt) : elt_type_{elt} {}
DListType *
DListType::_make(obj<AAllocator> mm,
obj<AType> elt_type)
{
void * mem = mm.alloc_for<DListType>();
return new (mem) DListType(elt_type);
}
obj<AType, DListType>
DListType::make(obj<AAllocator> mm,
obj<AType> elt_type)
{
return obj<AType, DListType>(_make(mm, elt_type));
}
// ----- type facet -----
TypeDescr
DListType::repr_td() const noexcept
{
return Reflect::require<void *>();
}
bool
DListType::is_equal_to(const obj<AType> & y_arg) const noexcept
{
Metatype y_mtype = y_arg.metatype();
if (y_mtype != Metatype::t_list())
return false;
auto y = obj<AType,DListType>::from(y_arg);
obj<AType> e = elt_type_;
return (e.is_equal_to(y->elt_type_));
}
bool
DListType::is_subtype_of(const obj<AType> & y_arg) const noexcept
{
Metatype y_mtype = y_arg.metatype();
if (y_mtype == Metatype::t_any())
return true;
if (y_mtype != Metatype::t_list())
return false;
auto y = obj<AType,DListType>::from(y_arg);
obj<AType> e = elt_type_;
return (e.is_subtype_of(y->elt_type_));
}
// ----- gcobject facet -----
DListType *
DListType::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}
void
DListType::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_poly_child(reason, &elt_type_);
//{
// auto e = FacetRegistry::instance().variant<AGCObject,AType>(elt_type_);
// gc.forward_inplace(e.iface(), (void **)&(elt_type_.data_));
//}
}
}
}
/* end DListType.cpp */

View file

@ -1,99 +0,0 @@
/** @file DTypeVarRef.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "Metatype.hpp"
#include "TypeVarRef.hpp"
#include <xo/reflect/Reflect.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/facet/FacetRegistry.hpp>
namespace xo {
using xo::mm::AGCObject;
using xo::reflect::Reflect;
using xo::reflect::TypeDescr;
using xo::facet::FacetRegistry;
namespace scm {
DTypeVarRef *
DTypeVarRef::_make(obj<AAllocator> mm, const DUniqueString * name)
{
void * mem = mm.alloc_for<DTypeVarRef>();
return new (mem) DTypeVarRef(name);
}
obj<AType,DTypeVarRef>
DTypeVarRef::make(obj<AAllocator> mm, const DUniqueString * name)
{
return obj<AType,DTypeVarRef>(_make(mm, name));
}
// ----- Type facet -----
Metatype
DTypeVarRef::metatype() const noexcept
{
if (type_) {
// resolved typevar reference
return type_.metatype();
} else {
// type var reference, not yet resolved
return Metatype::t_any();
}
}
TypeDescr
DTypeVarRef::repr_td() const noexcept
{
return Reflect::require<void *>();
}
bool
DTypeVarRef::is_equal_to(const obj<AType> & y) const noexcept
{
// not really well-defined until types are resolved
return (this->metatype().code() == y.metatype().code());
}
bool
DTypeVarRef::is_subtype_of(const obj<AType> & y) const noexcept
{
Metatype x_mtype = this->metatype();
Metatype y_mtype = y.metatype();
if (y_mtype.code() == Metatype::code::t_any)
return true;
return (x_mtype.code() == y_mtype.code());
}
// ----- GCObject facet -----
DTypeVarRef *
DTypeVarRef::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}
void
DTypeVarRef::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_poly_child(reason, &type_);
//{
// auto e = FacetRegistry::instance().variant<AGCObject,AType>(type_);
// gc.forward_inplace(e.iface(), (void **)&type_.data_);
//}
}
} /*namespace scm*/
} /*namespace xo*/
/* end DTypeVarRef.cpp */

View file

@ -1,32 +0,0 @@
/** @file IGCObject_DArrayType.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DArrayType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DArrayType.json5]
**/
#include "array/IGCObject_DArrayType.hpp"
namespace xo {
namespace scm {
auto
IGCObject_DArrayType::gco_shallow_move(DArrayType & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.gco_shallow_move(gc);
}
auto
IGCObject_DArrayType::visit_gco_children(DArrayType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
{
self.visit_gco_children(reason, fn);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IGCObject_DArrayType.cpp */

View file

@ -1,32 +0,0 @@
/** @file IGCObject_DAtomicType.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DAtomicType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DAtomicType.json5]
**/
#include "atomic/IGCObject_DAtomicType.hpp"
namespace xo {
namespace scm {
auto
IGCObject_DAtomicType::gco_shallow_move(DAtomicType & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.gco_shallow_move(gc);
}
auto
IGCObject_DAtomicType::visit_gco_children(DAtomicType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
{
self.visit_gco_children(reason, fn);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IGCObject_DAtomicType.cpp */

View file

@ -1,32 +0,0 @@
/** @file IGCObject_DFunctionType.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DFunctionType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DFunctionType.json5]
**/
#include "function/IGCObject_DFunctionType.hpp"
namespace xo {
namespace scm {
auto
IGCObject_DFunctionType::gco_shallow_move(DFunctionType & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.gco_shallow_move(gc);
}
auto
IGCObject_DFunctionType::visit_gco_children(DFunctionType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
{
self.visit_gco_children(reason, fn);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IGCObject_DFunctionType.cpp */

View file

@ -1,32 +0,0 @@
/** @file IGCObject_DListType.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DListType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DListType.json5]
**/
#include "list/IGCObject_DListType.hpp"
namespace xo {
namespace scm {
auto
IGCObject_DListType::gco_shallow_move(DListType & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.gco_shallow_move(gc);
}
auto
IGCObject_DListType::visit_gco_children(DListType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
{
self.visit_gco_children(reason, fn);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IGCObject_DListType.cpp */

View file

@ -1,39 +0,0 @@
/** @file IGCObject_DTypeVar.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DTypeVar.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DTypeVar.json5]
**/
#include "typevar/IGCObject_DTypeVar.hpp"
namespace xo {
namespace scm {
auto
IGCObject_DTypeVar::shallow_size(const DTypeVar & self) noexcept -> size_type
{
return self.shallow_size();
}
auto
IGCObject_DTypeVar::shallow_copy(const DTypeVar & self, obj<AAllocator> mm) noexcept -> Opaque
{
return self.shallow_copy(mm);
}
auto
IGCObject_DTypeVar::forward_children(DTypeVar & self, obj<ACollector> gc) noexcept -> size_type
{
return self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IGCObject_DTypeVar.cpp */

View file

@ -1,32 +0,0 @@
/** @file IGCObject_DTypeVarRef.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DTypeVarRef.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DTypeVarRef.json5]
**/
#include "typevar/IGCObject_DTypeVarRef.hpp"
namespace xo {
namespace scm {
auto
IGCObject_DTypeVarRef::gco_shallow_move(DTypeVarRef & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{
return self.gco_shallow_move(gc);
}
auto
IGCObject_DTypeVarRef::visit_gco_children(DTypeVarRef & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
{
self.visit_gco_children(reason, fn);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IGCObject_DTypeVarRef.cpp */

View file

@ -1,42 +0,0 @@
/** @file IType_Any.cpp
*
**/
#include "type/IType_Any.hpp"
#include <iostream>
#include <exception>
namespace xo {
namespace scm {
using xo::facet::DVariantPlaceholder;
using xo::facet::typeseq;
using xo::facet::valid_facet_implementation;
void
IType_Any::_fatal()
{
/* control here on uninitialized IAllocator_Any.
* Initialized instance will have specific implementation type
*/
std::cerr << "fatal"
<< ": attempt to call uninitialized"
<< " IType_Any method"
<< std::endl;
std::terminate();
}
typeseq
IType_Any::s_typeseq = typeseq::id<DVariantPlaceholder>();
bool
IType_Any::_valid
= valid_facet_implementation<AType, IType_Any>();
// nonconst methods
} /*namespace scm*/
} /*namespace xo*/
/* end IType_Any.cpp */

View file

@ -1,46 +0,0 @@
/** @file IType_DArrayType.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IType_DArrayType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IType_DArrayType.json5]
**/
#include "array/IType_DArrayType.hpp"
namespace xo {
namespace scm {
auto
IType_DArrayType::metatype(const DArrayType & self) noexcept -> Metatype
{
return self.metatype();
}
auto
IType_DArrayType::repr_td(const DArrayType & self) noexcept -> TypeDescr
{
return self.repr_td();
}
auto
IType_DArrayType::is_equal_to(const DArrayType & self, const obj_AType & y) -> bool
{
return self.is_equal_to(y);
}
auto
IType_DArrayType::is_subtype_of(const DArrayType & self, const obj_AType & y) -> bool
{
return self.is_subtype_of(y);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IType_DArrayType.cpp */

View file

@ -1,46 +0,0 @@
/** @file IType_DAtomicType.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IType_DAtomicType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IType_DAtomicType.json5]
**/
#include "atomic/IType_DAtomicType.hpp"
namespace xo {
namespace scm {
auto
IType_DAtomicType::metatype(const DAtomicType & self) noexcept -> Metatype
{
return self.metatype();
}
auto
IType_DAtomicType::repr_td(const DAtomicType & self) noexcept -> TypeDescr
{
return self.repr_td();
}
auto
IType_DAtomicType::is_equal_to(const DAtomicType & self, const obj_AType & y) -> bool
{
return self.is_equal_to(y);
}
auto
IType_DAtomicType::is_subtype_of(const DAtomicType & self, const obj_AType & y) -> bool
{
return self.is_subtype_of(y);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IType_DAtomicType.cpp */

View file

@ -1,46 +0,0 @@
/** @file IType_DFunctionType.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IType_DFunctionType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IType_DFunctionType.json5]
**/
#include "function/IType_DFunctionType.hpp"
namespace xo {
namespace scm {
auto
IType_DFunctionType::metatype(const DFunctionType & self) noexcept -> Metatype
{
return self.metatype();
}
auto
IType_DFunctionType::repr_td(const DFunctionType & self) noexcept -> TypeDescr
{
return self.repr_td();
}
auto
IType_DFunctionType::is_equal_to(const DFunctionType & self, const obj_AType & y) -> bool
{
return self.is_equal_to(y);
}
auto
IType_DFunctionType::is_subtype_of(const DFunctionType & self, const obj_AType & y) -> bool
{
return self.is_subtype_of(y);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IType_DFunctionType.cpp */

View file

@ -1,46 +0,0 @@
/** @file IType_DListType.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IType_DListType.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IType_DListType.json5]
**/
#include "list/IType_DListType.hpp"
namespace xo {
namespace scm {
auto
IType_DListType::metatype(const DListType & self) noexcept -> Metatype
{
return self.metatype();
}
auto
IType_DListType::repr_td(const DListType & self) noexcept -> TypeDescr
{
return self.repr_td();
}
auto
IType_DListType::is_equal_to(const DListType & self, const obj_AType & y) -> bool
{
return self.is_equal_to(y);
}
auto
IType_DListType::is_subtype_of(const DListType & self, const obj_AType & y) -> bool
{
return self.is_subtype_of(y);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IType_DListType.cpp */

View file

@ -1,46 +0,0 @@
/** @file IType_DTypeVar.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IType_DTypeVar.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IType_DTypeVar.json5]
**/
#include "typevar/IType_DTypeVar.hpp"
namespace xo {
namespace scm {
auto
IType_DTypeVar::metatype(const DTypeVar & self) noexcept -> Metatype
{
return self.metatype();
}
auto
IType_DTypeVar::repr_td(const DTypeVar & self) noexcept -> TypeDescr
{
return self.repr_td();
}
auto
IType_DTypeVar::is_equal_to(const DTypeVar & self, const obj_AType & y) -> bool
{
return self.is_equal_to(y);
}
auto
IType_DTypeVar::is_subtype_of(const DTypeVar & self, const obj_AType & y) -> bool
{
return self.is_subtype_of(y);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IType_DTypeVar.cpp */

View file

@ -1,46 +0,0 @@
/** @file IType_DTypeVarRef.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IType_DTypeVarRef.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IType_DTypeVarRef.json5]
**/
#include "typevar/IType_DTypeVarRef.hpp"
namespace xo {
namespace scm {
auto
IType_DTypeVarRef::metatype(const DTypeVarRef & self) noexcept -> Metatype
{
return self.metatype();
}
auto
IType_DTypeVarRef::repr_td(const DTypeVarRef & self) noexcept -> TypeDescr
{
return self.repr_td();
}
auto
IType_DTypeVarRef::is_equal_to(const DTypeVarRef & self, const obj_AType & y) -> bool
{
return self.is_equal_to(y);
}
auto
IType_DTypeVarRef::is_subtype_of(const DTypeVarRef & self, const obj_AType & y) -> bool
{
return self.is_subtype_of(y);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IType_DTypeVarRef.cpp */

View file

@ -1,101 +0,0 @@
/** @file Metatype.cpp
*
* @author Roland Conybeare, Nar 2026
**/
#include "Metatype.hpp"
#include <cassert>
namespace xo {
namespace scm {
const char *
Metatype::_descr() const noexcept
{
switch (code_) {
case code::t_unit: return "unit";
case code::t_bool: return "bool";
case code::t_str: return "str";
case code::t_i16: return "i16";
case code::t_i32: return "i32";
case code::t_i64: return "i64";
case code::t_f32: return "f32";
case code::t_f64: return "f64";
case code::t_sum: return "sum";
case code::t_list: return "list";
case code::t_array: return "array";
case code::t_function: return "function";
case code::t_struct: return "struct";
case code::t_dict: return "dict";
case code::t_integer: return "integer";
case code::t_booleic: return "booleic";
case code::t_numeric: return "numeric";
case code::t_callable: return "callable";
case code::t_any: return "any";
}
assert(false);
return "?metatype";
}
bool
Metatype::is_atomic() const noexcept
{
switch (code_) {
case code::t_unit:
return false;
case code::t_bool:
return true;
case code::t_str:
return true;
case code::t_i16:
return true;
case code::t_i32:
return true;
case code::t_i64:
return true;
case code::t_f32:
return true;
case code::t_f64:
return true;
case code::t_sum:
return false;
case code::t_list:
return false;
case code::t_array:
return false;
case code::t_function:
return false;
case code::t_struct:
return false;
case code::t_dict:
return true;
case code::t_integer:
return true;
case code::t_booleic:
return true;
case code::t_numeric:
return true;
case code::t_callable:
return true;
case code::t_any:
return true;
}
assert(false);
return false;
}
} /*namespace scm*/
} /*namespace xo*/
/* end Metatype.cpp */

View file

@ -1,71 +0,0 @@
/** @file SetupType.cpp
*
* @author Roland Conybeare, Feb 2026
**/
#include "SetupType.hpp"
#include "AtomicType.hpp"
#include "ListType.hpp"
#include "ArrayType.hpp"
#include "FunctionType.hpp"
#include "TypeVarRef.hpp"
#include <xo/facet/FacetRegistry.hpp>
#include <xo/indentlog/scope.hpp>
namespace xo {
using xo::mm::AGCObject;
using xo::facet::FacetRegistry;
using xo::facet::impl_for;
using xo::reflect::typeseq;
namespace scm {
bool
SetupType::register_facets()
{
scope log(XO_DEBUG(true));
FacetRegistry::register_impl<AType, DAtomicType>();
FacetRegistry::register_impl<AGCObject, DAtomicType>();
FacetRegistry::register_impl<AType, DListType>();
FacetRegistry::register_impl<AGCObject, DListType>();
FacetRegistry::register_impl<AType, DArrayType>();
FacetRegistry::register_impl<AGCObject, DArrayType>();
FacetRegistry::register_impl<AType, DFunctionType>();
FacetRegistry::register_impl<AGCObject, DFunctionType>();
FacetRegistry::register_impl<AType, DTypeVarRef>();
FacetRegistry::register_impl<AGCObject, DTypeVarRef>();
log && log(xtag("DAtomicType.tseq", typeseq::id<DAtomicType>()));
log && log(xtag("DListType.tseq", typeseq::id<DListType>()));
log && log(xtag("DArrayType.tseq", typeseq::id<DArrayType>()));
log && log(xtag("DFunctionType.tseq", typeseq::id<DFunctionType>()));
log && log(xtag("DTypeVarRef.tseq", typeseq::id<DTypeVarRef>()));
return true;
}
bool
SetupType::register_types(obj<ACollector> gc)
{
scope log(XO_DEBUG(true));
bool ok = true;
ok &= gc.install_type(impl_for<AGCObject, DAtomicType>());
ok &= gc.install_type(impl_for<AGCObject, DListType>());
ok &= gc.install_type(impl_for<AGCObject, DArrayType>());
ok &= gc.install_type(impl_for<AGCObject, DFunctionType>());
ok &= gc.install_type(impl_for<AGCObject, DTypeVarRef>());
return ok;
}
} /*namespace scm*/
} /*namespace xo*/
/* end SetupType.cpp */

View file

@ -1,15 +0,0 @@
/** @file TypeOps.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "TypeOps.hpp"
namespace xo {
namespace scm {
} /*namespace scm*/
} /*namespace xo*/
/* end TypeOps.cpp */

View file

@ -1,38 +0,0 @@
/** @file init_type.cpp
*
* @author Roland Conybeare, Jan 2026
**/
#include "init_type.hpp"
#include "SetupType.hpp"
#include <xo/alloc2/CollectorTypeRegistry.hpp>
#include <xo/alloc2/init_alloc2.hpp>
namespace xo {
using xo::scm::SetupType;
using xo::mm::CollectorTypeRegistry;
void
InitSubsys<S_type_tag>::init()
{
SetupType::register_facets();
CollectorTypeRegistry::instance().register_types(&SetupType::register_types);
}
InitEvidence
InitSubsys<S_type_tag>::require()
{
InitEvidence retval;
/* direct subsystem deps for xo-type/ */
retval ^= InitSubsys<S_alloc2_tag>::require();
/* xo-type/'s own initialization code */
retval ^= Subsystem::provide<S_type_tag>("type", &init);
return retval;
}
} /*namespace xo*/
/* end init_type.cpp */

View file

@ -1,18 +0,0 @@
# built unittest xo-type/utest
set(UTEST_EXE utest.type)
set(UTEST_SRCS
type_utest_main.cpp
DAtomicType.test.cpp
DListType.test.cpp
DArrayType.test.cpp
# DString.test.cpp
# StringOps.test.cpp
# X1Collector.test.cpp
# Printable.test.cpp
)
xo_add_utest_executable(${UTEST_EXE} ${UTEST_SRCS})
xo_self_dependency(${UTEST_EXE} xo_type)
#xo_dependency(${UTEST_EXE} xo_alloc2)
xo_external_target_dependency(${UTEST_EXE} Catch2 Catch2::Catch2)

View file

@ -1,70 +0,0 @@
/** @file DArrayType.test.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "init_type.hpp"
#include "TypeOps.hpp"
#include "ArrayType.hpp"
#include "ListType.hpp"
#include "AtomicType.hpp"
#include <xo/alloc2/Allocator.hpp>
#include <xo/alloc2/Arena.hpp>
#include <xo/facet/obj.hpp>
#include <catch2/catch.hpp>
namespace xo {
using xo::scm::TypeOps;
using xo::scm::AType;
using xo::scm::Metatype;
using xo::mm::AAllocator;
using xo::mm::DArena;
using xo::mm::ArenaConfig;
namespace ut {
static InitEvidence s_init = (InitSubsys<S_type_tag>::require());
TEST_CASE("DArrayType-make", "[type][DArrayType]")
{
ArenaConfig cfg { .name_ = "testarena",
.size_ = 4*1024 };
DArena arena = DArena::map(cfg);
auto alloc = obj<AAllocator,DArena>(&arena);
auto i64_type = TypeOps::atomic_type(alloc, Metatype::t_i64());
auto array_i64_type = TypeOps::array_type(alloc, i64_type);
REQUIRE(array_i64_type);
REQUIRE(array_i64_type.is_equal_to(array_i64_type));
auto bool_type = TypeOps::atomic_type(alloc, Metatype::t_bool());
auto array_bool_type = TypeOps::array_type(alloc, bool_type);
REQUIRE(array_bool_type);
REQUIRE(array_bool_type.is_equal_to(array_bool_type));
auto any_type = TypeOps::atomic_type(alloc, Metatype::t_any());
auto array_any_type = TypeOps::array_type(alloc, any_type);
REQUIRE(array_any_type);
REQUIRE(array_any_type.is_equal_to(array_any_type));
REQUIRE(array_bool_type.is_subtype_of(array_any_type));
REQUIRE(array_i64_type.is_subtype_of(array_any_type));
REQUIRE(!array_i64_type.is_subtype_of(array_bool_type));
REQUIRE(!array_any_type.is_subtype_of(array_bool_type));
REQUIRE(!array_bool_type.is_subtype_of(array_i64_type));
REQUIRE(!array_any_type.is_subtype_of(array_i64_type));
// array and list are unrelated
auto list_i64_type = TypeOps::list_type(alloc, i64_type);
REQUIRE(!array_i64_type.is_equal_to(list_i64_type));
REQUIRE(!array_i64_type.is_subtype_of(list_i64_type));
REQUIRE(!list_i64_type.is_subtype_of(array_i64_type));
}
}
}
/* end DArrayType.test.cpp */

View file

@ -1,106 +0,0 @@
/** @file DAtomicType.test.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "init_type.hpp"
#include "AtomicType.hpp"
#include <xo/alloc2/Allocator.hpp>
#include <xo/alloc2/Arena.hpp>
#include <xo/facet/obj.hpp>
#include <catch2/catch.hpp>
namespace xo {
using xo::scm::AType;
using xo::scm::DAtomicType;
using xo::scm::Metatype;
using xo::mm::AAllocator;
using xo::mm::DArena;
using xo::mm::ArenaConfig;
namespace ut {
static InitEvidence s_init = (InitSubsys<S_type_tag>::require());
TEST_CASE("DAtomicType-make", "[type][DAtomicType]")
{
ArenaConfig cfg { .name_ = "testarena",
.size_ = 4*1024 };
DArena arena = DArena::map(cfg);
auto alloc = obj<AAllocator,DArena>(&arena);
auto unit_type = obj<AType,DAtomicType>(DAtomicType::_make(alloc, Metatype::t_unit()));
auto i64_type = obj<AType,DAtomicType>(DAtomicType::_make(alloc, Metatype::t_i64()));
auto f64_type = obj<AType,DAtomicType>(DAtomicType::_make(alloc, Metatype::t_f64()));
auto str_type = obj<AType,DAtomicType>(DAtomicType::_make(alloc, Metatype::t_str()));
auto any_type = obj<AType,DAtomicType>(DAtomicType::_make(alloc, Metatype::t_any()));
{
REQUIRE(unit_type);
REQUIRE(unit_type.metatype().code() == Metatype::t_unit().code());
REQUIRE(unit_type.is_equal_to(unit_type));
REQUIRE(unit_type.is_subtype_of(unit_type));
}
{
REQUIRE(i64_type);
REQUIRE(i64_type.metatype().code() == Metatype::t_i64().code());
REQUIRE(i64_type.is_equal_to(i64_type));
REQUIRE(i64_type.is_subtype_of(i64_type));
REQUIRE(!i64_type.is_subtype_of(unit_type));
REQUIRE(!unit_type.is_subtype_of(i64_type));
}
{
REQUIRE(f64_type);
REQUIRE(f64_type.metatype().code() == Metatype::t_f64().code());
REQUIRE(f64_type.is_equal_to(f64_type));
REQUIRE(f64_type.is_subtype_of(f64_type));
REQUIRE(!f64_type.is_subtype_of(unit_type));
REQUIRE(!f64_type.is_subtype_of(i64_type));
REQUIRE(!unit_type.is_subtype_of(f64_type));
REQUIRE(!i64_type.is_subtype_of(f64_type));
}
{
REQUIRE(str_type);
REQUIRE(str_type.metatype().code() == Metatype::t_str().code());
REQUIRE(str_type.is_equal_to(str_type));
REQUIRE(str_type.is_subtype_of(str_type));
REQUIRE(!str_type.is_subtype_of(unit_type));
REQUIRE(!str_type.is_subtype_of(i64_type));
REQUIRE(!str_type.is_subtype_of(f64_type));
REQUIRE(!unit_type.is_subtype_of(str_type));
REQUIRE(!i64_type.is_subtype_of(str_type));
REQUIRE(!f64_type.is_subtype_of(str_type));
}
{
REQUIRE(any_type);
REQUIRE(any_type.metatype().code() == Metatype::t_any().code());
REQUIRE(any_type.is_equal_to(any_type));
REQUIRE(any_type.is_subtype_of(any_type));
REQUIRE(!any_type.is_subtype_of(unit_type));
REQUIRE(!any_type.is_subtype_of(i64_type));
REQUIRE(!any_type.is_subtype_of(f64_type));
REQUIRE(!any_type.is_subtype_of(str_type));
REQUIRE(unit_type.is_subtype_of(any_type));
REQUIRE(i64_type.is_subtype_of(any_type));
REQUIRE(f64_type.is_subtype_of(any_type));
REQUIRE(str_type.is_subtype_of(any_type));
}
}
} /*namespace ut*/
} /*namespace xo*/
/* end DAtomicType.test.cpp */

View file

@ -1,65 +0,0 @@
/** @file DListType.test.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "init_type.hpp"
#include "TypeOps.hpp"
#include "ListType.hpp"
#include "AtomicType.hpp"
#include <xo/alloc2/Allocator.hpp>
#include <xo/alloc2/Arena.hpp>
#include <xo/facet/obj.hpp>
#include <catch2/catch.hpp>
namespace xo {
using xo::scm::TypeOps;
using xo::scm::AType;
//using xo::scm::DListType;
//using xo::scm::DAtomicType;
using xo::scm::Metatype;
using xo::mm::AAllocator;
using xo::mm::DArena;
using xo::mm::ArenaConfig;
namespace ut {
static InitEvidence s_init = (InitSubsys<S_type_tag>::require());
TEST_CASE("DListType-make", "[type][DListType]")
{
ArenaConfig cfg { .name_ = "testarena",
.size_ = 4*1024 };
DArena arena = DArena::map(cfg);
auto alloc = obj<AAllocator,DArena>(&arena);
auto i64_type = TypeOps::atomic_type(alloc, Metatype::t_i64());
auto list_i64_type = TypeOps::list_type(alloc, i64_type);
REQUIRE(list_i64_type);
REQUIRE(list_i64_type.is_equal_to(list_i64_type));
auto bool_type = TypeOps::atomic_type(alloc, Metatype::t_bool());
auto list_bool_type = TypeOps::list_type(alloc, bool_type);
REQUIRE(list_bool_type);
REQUIRE(list_bool_type.is_equal_to(list_bool_type));
auto any_type = TypeOps::atomic_type(alloc, Metatype::t_any());
auto list_any_type = TypeOps::list_type(alloc, any_type);
REQUIRE(list_any_type);
REQUIRE(list_any_type.is_equal_to(list_any_type));
REQUIRE(list_bool_type.is_subtype_of(list_any_type));
REQUIRE(list_i64_type.is_subtype_of(list_any_type));
REQUIRE(!list_i64_type.is_subtype_of(list_bool_type));
REQUIRE(!list_any_type.is_subtype_of(list_bool_type));
REQUIRE(!list_bool_type.is_subtype_of(list_i64_type));
REQUIRE(!list_any_type.is_subtype_of(list_i64_type));
}
}
}
/* end DListType.cpp */

View file

@ -1,24 +0,0 @@
/* file type_utest_main.cpp */
#include <xo/subsys/Subsystem.hpp>
#define CATCH_CONFIG_RUNNER
#include "catch2/catch.hpp"
int
main(int argc, char* argv[])
{
using xo::Subsystem;
// Your custom initialization code here
Subsystem::initialize_all();
// Run Catch2's test session
int result = Catch::Session().run(argc, argv);
// cleanup here, if any
return result;
}
/* end type_utest_main.cpp */