- Added More Documentation

- Added some more notes to the planning doc regarding shared libraries
 - Started adding unit tests for the C++ lang library.
This commit is contained in:
2025-06-19 15:16:29 -04:00
parent 909be55ed3
commit 4d8466851c
21 changed files with 400 additions and 176 deletions

View File

@@ -0,0 +1,29 @@
// =====================================================================================================================
// fennec, a free and open source game engine
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
#ifndef FENNEC_LANG_ASSERT_H
#define FENNEC_LANG_ASSERT_H
using assert_handler = void (*)(const char *, const char *, int , const char *);
extern void set_assert_handler(assert_handler handler);
extern void __assert_impl(const char* expression, const char* file, int line, const char* function);
#define assert(expression) if(not(expression)) { __assert_impl(#expression, __FILE__, __LINE__, __PRETTY_FUNCTION__); }
#endif // FENNEC_LANG_ASSERT_H

View File

@@ -73,7 +73,6 @@ namespace fennec
// fennec::conditional =================================================================================================
///
///
/// \brief select between two types based on a condition
///

View File

@@ -18,7 +18,7 @@
///
/// \file lang.h
/// \brief fennec C++ Language Library
/// \brief \ref fennec_lang
///
///
/// \details
@@ -31,6 +31,12 @@
#ifndef FENNEC_LANG_H
#define FENNEC_LANG_H
#include <fennec/lang/bits.h>
#include <fennec/lang/intrinsics.h>
#include <fennec/lang/limits.h>
#include <fennec/lang/types.h>
#include <fennec/lang/utility.h>
///
/// \page fennec_lang C++ Language Library
///
@@ -45,21 +51,4 @@
///
///
///
/// \page fennec_lang_metaprogramming Metaprogramming
///
/// Metaprogramming is a method of obtaining information about the structure of the code at compile time.
/// This includes getting traits of types, such as with \ref fennec::numeric_limits. You may even
/// \ref fennec_lang_conditional_types "programmatically enable" functions based on the info of the types that the function uses.
///
/// - \subpage fennec_lang_constants
/// - \subpage fennec_lang_conditional_types
/// - \subpage fennec_lang_numeric_transforms
/// - \subpage fennec_lang_sequences
/// - \subpage fennec_lang_type_sequences
/// - \subpage fennec_lang_type_traits
/// - \subpage fennec_lang_type_transforms
///
///
#endif // FENNEC_LANG_H

View File

@@ -0,0 +1,52 @@
// =====================================================================================================================
// fennec, a free and open source game engine
// Copyright © 2025 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
///
/// \file metaprogramming.h
/// \brief \ref fennec_lang
///
///
/// \details
/// \author Medusa Slockbower
///
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
///
#ifndef FENNEC_LANG_METAPROGRAMMING_H
#define FENNEC_LANG_METAPROGRAMMING_H
///
/// \page fennec_lang_metaprogramming Metaprogramming Library
///
/// This is a sub-library of the fennec \ref fennec_lang. Metaprogramming is a method of obtaining information about the
/// structure of the code and changing its behaviour at compile time. This includes getting traits of types, such as with
/// \ref fennec::is_signed. You may even \ref fennec_lang_conditional_types "programmatically enable" functions
/// based on the info of the types that the function uses.
///
/// - \subpage fennec_lang_constants
/// - \subpage fennec_lang_conditional_types
/// - \subpage fennec_lang_numeric_transforms
/// - \subpage fennec_lang_sequences
/// - \subpage fennec_lang_type_sequences
/// - \subpage fennec_lang_type_traits
/// - \subpage fennec_lang_type_transforms
///
///
#endif // FENNEC_LANG_METAPROGRAMMING_H

View File

@@ -219,179 +219,182 @@
namespace fennec
{
// Basic Types =========================================================================================================
// Basic Types =========================================================================================================
///
/// \name Basic Types
/// @{
///
/// \name Basic Types
/// @{
///
/// \brief A conditional type
using bool_t = bool;
///
/// \brief A conditional type
using bool_t = bool;
///
/// \brief A type capable of holding an ascii value
using char_t = char;
///
/// \brief A type capable of holding an ascii value
using char_t = char;
///
/// \brief A type with the size of a char, capable of holding a signed 8-bit integer
using schar_t = signed char;
///
/// \brief A type with the size of a char, capable of holding a signed 8-bit integer
using schar_t = signed char;
///
/// \brief A type with the size of a char, capable of holding an unsigned 8-bit integer
using uchar_t = unsigned char;
///
/// \brief A type with the size of a char, capable of holding an unsigned 8-bit integer
using uchar_t = unsigned char;
///
/// \brief A signed short type, capable of holding signed 16-bit integer
using short_t = signed short;
///
/// \brief A signed short type, capable of holding signed 16-bit integer
using short_t = signed short;
///
/// \brief An unsigned short type, capable of holding an unsigned signed 16-bit integer
using ushort_t = unsigned short;
///
/// \brief An unsigned short type, capable of holding an unsigned signed 16-bit integer
using ushort_t = unsigned short;
///
/// \brief A signed integer type, size varies by implementation, but typically 32-bit
using int_t = signed int;
///
/// \brief A signed integer type, size varies by implementation, but typically 32-bit
using int_t = signed int;
///
/// \brief An unsigned integer type, size varies by implementation, but typically 32-bit
using uint_t = unsigned int;
///
/// \brief An unsigned integer type, size varies by implementation, but typically 32-bit
using uint_t = unsigned int;
///
/// \brief A signed integer type, with a size of at least 32-bits
using long_t = signed long;
///
/// \brief A signed integer type, with a size of at least 32-bits
using long_t = signed long;
///
/// \brief An unsigned integer type, with a size of at least 32-bits
using ulong_t = unsigned long;
///
/// \brief An unsigned integer type, with a size of at least 32-bits
using ulong_t = unsigned long;
///
/// \brief A signed integer type, with a size of 64-bits
using llong_t = signed long long;
///
/// \brief A signed integer type, with a size of 64-bits
using llong_t = signed long long;
///
/// \brief An unsigned integer type, with a size of 64-bits
using ullong_t = unsigned long long;
///
/// \brief An unsigned integer type, with a size of 64-bits
using ullong_t = unsigned long long;
///
/// \brief A single-precision floating-point type, typically with a size of 32-bits
using float_t = float;
///
/// \brief A single-precision floating-point type, typically with a size of 32-bits
using float_t = float;
///
/// \brief A double-point type, typically with a size of 64-bits
using double_t = double;
/// @}
///
/// \brief A double-point type, typically with a size of 64-bits
using double_t = double;
/// @}
// Sized Arithmetic Types ==============================================================================================
///
/// \name Special Types
/// @{
///
/// \name Sized Integer Types
/// @{
///
/// \brief Null Pointer Type
using nullptr_t = decltype(nullptr);
///
/// \brief Signed 8-bit integer
using int8_t = schar_t;
///
/// \brief Signed Integer Capable of Holding a Pointer to void
using intptr_t = intptr_t;
///
/// \brief Signed 16-bit integer
using int16_t = short_t;
///
/// \brief Unsigned Integer Capable of Holding a Pointer to void
using uintptr_t = uintptr_t;
///
/// \brief Signed 32-bit integer
using int32_t = long_t;
///
/// \brief Maximum Width Signed Integer Type
using intmax_t = __INTMAX_TYPE__;
///
/// \brief Signed signed 64-bit integer
using int64_t = llong_t;
///
/// \brief Maximum Width Unsigned Integer Type
using uintmax_t = __UINTMAX_TYPE__;
/// @}
///
/// \brief Unsigned Integer Type Returned By `sizeof`, `sizeof...`, and `alignof`
using size_t = __SIZE_TYPE__;
///
/// \brief Signed Integer Type Returned by the Subtraction of two Pointers
using ptrdiff_t = __PTRDIFF_TYPE__;
///
/// \brief undefined class for SFINAE
class undefined_t;
///
/// \brief Void type used for SFINAE
template<typename...>
using void_t = void;
/// @}
}
#include <fennec/lang/conditional_types.h>
namespace fennec
{
// Sized Arithmetic Types ==============================================================================================
///
/// \name Sized Integer Types
/// @{
///
/// \brief Signed 8-bit integer
using int8_t = schar_t;
///
/// \brief Signed 16-bit integer
using int16_t = short_t;
///
/// \brief Signed 32-bit integer
using int32_t = conditional_t<sizeof(int_t) == 4, int_t, long_t>;
///
/// \brief Signed signed 64-bit integer
using int64_t = llong_t;
/// @}
///
/// \name Sized Unsigned Integer Types
/// @{
///
/// \name Sized Unsigned Integer Types
/// @{
///
/// \brief Unsigned 8-bit integer
using uint8_t = uchar_t;
///
/// \brief Unsigned 8-bit integer
using uint8_t = uchar_t;
///
/// \brief Unsigned 16-bit integer
using uint16_t = ushort_t;
///
/// \brief Unsigned 16-bit integer
using uint16_t = ushort_t;
///
/// \brief Unsigned 32-bit integer
using uint32_t = ulong_t;
///
/// \brief Unsigned 32-bit integer
using uint32_t = conditional_t<sizeof(uint_t) == 4, uint_t, ulong_t>;
///
/// \brief Unsigned 64-bit integer
using uint64_t = ullong_t;
///
/// \brief Unsigned 64-bit integer
using uint64_t = ullong_t;
/// @}
/// @}
///
/// \name Sized Floating-Point Types
/// @{
///
/// \name Sized Floating-Point Types
/// @{
///
/// \brief A single-precision floating-point scalar
using float32_t = float_t;
///
/// \brief A single-precision floating-point scalar
using float32_t = float_t;
///
/// \brief A double-precision floating-point scalar
using float64_t = double_t;
/// @}
///
/// \name Special Types
/// @{
///
/// \brief Null Pointer Type
using nullptr_t = decltype(nullptr);
///
/// \brief Signed Integer Capable of Holding a Pointer to void
using intptr_t = intptr_t;
///
/// \brief Unsigned Integer Capable of Holding a Pointer to void
using uintptr_t = uintptr_t;
///
/// \brief Maximum Width Signed Integer Type
using intmax_t = __INTMAX_TYPE__;
///
/// \brief Maximum Width Unsigned Integer Type
using uintmax_t = __UINTMAX_TYPE__;
///
/// \brief Unsigned Integer Type Returned By `sizeof`, `sizeof...`, and `alignof`
using size_t = __SIZE_TYPE__;
///
/// \brief Signed Integer Type Returned by the Subtraction of two Pointers
using ptrdiff_t = __PTRDIFF_TYPE__;
///
/// \brief undefined class for SFINAE
class undefined_t;
///
/// \brief Void type used for SFINAE
template<typename...>
using void_t = void;
/// @}
///
/// \brief A double-precision floating-point scalar
using float64_t = double_t;
/// @}
}