// ===================================================================================================================== // fennec, a free and open source game engine // Copyright © 2025 - 2026 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 . // ===================================================================================================================== #ifndef FENNEC_METAPROGRAMMING_INTEGER_H #define FENNEC_METAPROGRAMMING_INTEGER_H #include inline void integer_h() { std::ofstream out("fennec/lang/integer.h"); out << "// =====================================================================================================================" << '\n'; out << "// fennec, a free and open source game engine" << '\n'; out << "// Copyright © 2025 - 2026 Medusa Slockbower" << '\n'; out << "//" << '\n'; out << "// This program is free software: you can redistribute it and/or modify" << '\n'; out << "// it under the terms of the GNU General Public License as published by" << '\n'; out << "// the Free Software Foundation, either version 3 of the License, or" << '\n'; out << "// (at your option) any later version." << '\n'; out << "//" << '\n'; out << "// This program is distributed in the hope that it will be useful," << '\n'; out << "// but WITHOUT ANY WARRANTY; without even the implied warranty of" << '\n'; out << "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << '\n'; out << "// GNU General Public License for more details." << '\n'; out << "//" << '\n'; out << "// You should have received a copy of the GNU General Public License" << '\n'; out << "// along with this program. If not, see ." << '\n'; out << "// =====================================================================================================================" << '\n'; out << "" << '\n'; out << "///" << '\n'; out << "/// \\file fennec/lang/integer.h" << '\n'; out << "/// \\brief metaprogramming integer type info" << '\n'; out << "///" << '\n'; out << "///" << '\n'; out << "/// \\details This file is automatically generated for the current build environment." << '\n'; out << "///" << '\n'; out << "/// Environment for this build: " FENNEC_LONG_COMPILER_NAME << '\n'; out << "///" << '\n'; out << "/// \\copyright Copyright © 2025 - 2026 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))" << '\n'; out << "///" << '\n'; out << "///" << '\n'; out << "" << '\n'; out << "#ifndef FENNEC_LANG_INTEGER_H" << '\n'; out << "#define FENNEC_LANG_INTEGER_H" << '\n'; out << "" << '\n'; out << "#undef CHAR_MIN" << '\n'; out << "#undef CHAR_MAX" << '\n'; out << "#undef WCHAR_MIN" << '\n'; out << "#undef WCHAR_MAX" << '\n'; out << "#undef SCHAR_MIN" << '\n'; out << "#undef SCHAR_MAX" << '\n'; out << "#undef UCHAR_MIN" << '\n'; out << "#undef UCHAR_MAX" << '\n'; out << "#undef INT_MIN" << '\n'; out << "#undef INT_MAX" << '\n'; out << "#undef UINT_MIN" << '\n'; out << "#undef UINT_MAX" << '\n'; out << "#undef LONG_MIN" << '\n'; out << "#undef LONG_MAX" << '\n'; out << "#undef ULONG_MIN" << '\n'; out << "#undef ULONG_MAX" << '\n'; out << "#undef LLONG_MIN" << '\n'; out << "#undef LLONG_MAX" << '\n'; out << "#undef ULLONG_MIN" << '\n'; out << "#undef ULLONG_MAX" << '\n'; out << "" << '\n'; // TODO: Fix this to generate info without using the c++stdlib for platforms without this available. out << R"(/// \brief Is \f$char\f$ signed?)" << '\n'; out << "#define CHAR_IS_SIGNED " << std::boolalpha << std::numeric_limits::is_signed << '\n'; out << R"(/// \brief Rounding style of type \f$char\f$.)" << '\n'; out << "#define CHAR_ROUNDS " << "0x" << std::hex << (int)std::numeric_limits::round_style << '\n'; out << R"(/// \brief Number of radix digits represented by \f$char\f$.)" << '\n'; out << "#define CHAR_RADIX_DIG " << "0x" << std::hex << (int)std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$char\f$.)" << '\n'; out << "#define CHAR_DIG " << "0x" << std::hex << (int)std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$char\f$.)" << '\n'; out << "#define CHAR_DECIMAL_DIG " << "0x" << std::hex << (int)std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief The radix, or integer base, used to represent a \f$char\f$.)" << '\n'; out << "#define CHAR_RADIX " << "0x" << std::hex << (int)std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$char\f$ trap?)" << '\n'; out << "#define CHAR_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$char\f$.)" << '\n'; out << "#define CHAR_MIN " << "0x" << std::hex << (0xFF & +std::numeric_limits::min()) << '\n'; out << R"(/// \brief Largest finite value of \f$char\f$.)" << '\n'; out << "#define CHAR_MAX " << "0x" << std::hex << (0xFF & +std::numeric_limits::max()) << '\n'; out << "" << '\n'; out << R"(/// \brief Is \f$wchar_t\f$ signed?)" << '\n'; out << "#define WCHAR_IS_SIGNED " << std::boolalpha << std::numeric_limits::is_signed << '\n'; out << R"(/// \brief Rounding style of type \f$wchar_t\f$.)" << '\n'; out << "#define WCHAR_ROUNDS " << "0x" << std::hex << std::numeric_limits::round_style << '\n'; out << R"(/// \brief Number of radix digits represented by \f$wchar_t\f$.)" << '\n'; out << "#define WCHAR_RADIX_DIG " << "0x" << std::hex << std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$wchar_t\f$.)" << '\n'; out << "#define WCHAR_DIG " << "0x" << std::hex << std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$wchar_t\f$.)" << '\n'; out << "#define WCHAR_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief The radix, or integer base, used to represent a \f$wchar_t\f$.)" << '\n'; out << "#define WCHAR_RADIX " << "0x" << std::hex << std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$wchar_t\f$ trap?)" << '\n'; out << "#define WCHAR_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$wchar_t\f$.)" << '\n'; out << "#define WCHAR_MIN " << "0x" << std::hex << +std::numeric_limits::min() << '\n'; out << R"(/// \brief Largest finite value of \f$wchar_t\f$.)" << '\n'; out << "#define WCHAR_MAX " << "0x" << std::hex << +std::numeric_limits::max() << '\n'; out << "" << '\n'; out << R"(/// \brief Is \f$signed char\f$ signed?)" << '\n'; out << "#define SCHAR_ROUNDS " << "0x" << std::hex << (int)std::numeric_limits::round_style << '\n'; out << R"(/// \brief Rounding style of type \f$signed char\f$.)" << '\n'; out << "#define SCHAR_RADIX_DIG " << "0x" << std::hex << (int)std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of radix digits represented by \f$signed char\f$.)" << '\n'; out << "#define SCHAR_DIG " << "0x" << std::hex << (int)std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$signed char\f$.)" << '\n'; out << "#define SCHAR_DECIMAL_DIG " << "0x" << std::hex << (int)std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$signed char\f$.)" << '\n'; out << "#define SCHAR_RADIX " << "0x" << std::hex << (int)std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$signed char\f$ trap?)" << '\n'; out << "#define SCHAR_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$signed char\f$.)" << '\n'; out << "#define SCHAR_MIN " << "0x" << std::hex << (0xFF & +std::numeric_limits::min()) << '\n'; out << R"(/// \brief Largest finite value of \f$signed char\f$.)" << '\n'; out << "#define SCHAR_MAX " << "0x" << std::hex << (0xFF & +std::numeric_limits::max()) << '\n'; out << "" << '\n'; out << R"(/// \brief Is \f$unsigned char\f$ unsigned?)" << '\n'; out << "#define UCHAR_ROUNDS " << "0x" << std::hex << (int)std::numeric_limits::round_style << '\n'; out << R"(/// \brief Rounding style of type \f$unsigned char\f$.)" << '\n'; out << "#define UCHAR_RADIX_DIG " << "0x" << std::hex << (int)std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of radix digits represented by \f$unsigned char\f$.)" << '\n'; out << "#define UCHAR_DIG " << "0x" << std::hex << (int)std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$unsigned char\f$.)" << '\n'; out << "#define UCHAR_DECIMAL_DIG " << "0x" << std::hex << (int)std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$unsigned char\f$.)" << '\n'; out << "#define UCHAR_RADIX " << "0x" << std::hex << (int)std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$unsigned char\f$ trap?)" << '\n'; out << "#define UCHAR_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$unsigned char\f$.)" << '\n'; out << "#define UCHAR_MIN " << "0x" << std::hex << (0xFF & +std::numeric_limits::min()) << '\n'; out << R"(/// \brief Largest finite value of \f$unsigned char\f$.)" << '\n'; out << "#define UCHAR_MAX " << "0x" << std::hex << (0xFF & +std::numeric_limits::max()) << '\n'; out << "" << '\n'; out << R"(/// \brief Rounding style of type \f$short\f$.)" << '\n'; out << "#define SHORT_ROUNDS " << "0x" << std::hex << std::numeric_limits::round_style << '\n'; out << R"(/// \brief Number of radix digits represented by \f$short\f$.)" << '\n'; out << "#define SHORT_RADIX_DIG " << "0x" << std::hex << std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$short\f$.)" << '\n'; out << "#define SHORT_DIG " << "0x" << std::hex << std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$short\f$.)" << '\n'; out << "#define SHORT_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief The radix, or integer base, used to represent a \f$short\f$.)" << '\n'; out << "#define SHORT_RADIX " << "0x" << std::hex << std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$short\f$ trap?)" << '\n'; out << "#define SHORT_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$short\f$.)" << '\n'; out << "#define SHORT_MIN " << "0x" << std::hex << +std::numeric_limits::min() << '\n'; out << R"(/// \brief Largest finite value of \f$short\f$.)" << '\n'; out << "#define SHORT_MAX " << "0x" << std::hex << +std::numeric_limits::max() << '\n'; out << "" << '\n'; out << R"(/// \brief Rounding style of type \f$unsigned short\f$.)" << '\n'; out << "#define USHORT_ROUNDS " << "0x" << std::hex << std::numeric_limits::round_style << '\n'; out << R"(/// \brief Number of radix digits represented by \f$unsigned short\f$.)" << '\n'; out << "#define USHORT_RADIX_DIG " << "0x" << std::hex << std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$unsigned short\f$.)" << '\n'; out << "#define USHORT_DIG " << "0x" << std::hex << std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$unsigned short\f$.)" << '\n'; out << "#define USHORT_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief The radix, or integer base, used to represent a \f$unsigned short\f$.)" << '\n'; out << "#define USHORT_RADIX " << "0x" << std::hex << std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$unsigned short\f$ trap?)" << '\n'; out << "#define USHORT_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$unsigned short\f$.)" << '\n'; out << "#define USHORT_MIN " << "0x" << std::hex << +std::numeric_limits::min() << '\n'; out << R"(/// \brief Largest finite value of \f$unsigned short\f$.)" << '\n'; out << "#define USHORT_MAX " << "0x" << std::hex << +std::numeric_limits::max() << '\n'; out << "" << '\n'; out << R"(/// \brief Rounding style of type \f$int\f$.)" << '\n'; out << "#define INT_ROUNDS " << "0x" << std::hex << std::numeric_limits::round_style << '\n'; out << R"(/// \brief Number of radix digits represented by \f$int\f$.)" << '\n'; out << "#define INT_RADIX_DIG " << "0x" << std::hex << std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$int\f$.)" << '\n'; out << "#define INT_DIG " << "0x" << std::hex << std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$int\f$.)" << '\n'; out << "#define INT_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief The radix, or integer base, used to represent a \f$int\f$.)" << '\n'; out << "#define INT_RADIX " << "0x" << std::hex << std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$int\f$ trap?)" << '\n'; out << "#define INT_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$int\f$.)" << '\n'; out << "#define INT_MIN " << "0x" << std::hex << +std::numeric_limits::min() << '\n'; out << R"(/// \brief Largest finite value of \f$int\f$.)" << '\n'; out << "#define INT_MAX " << "0x" << std::hex << +std::numeric_limits::max() << '\n'; out << "" << '\n'; out << R"(/// \brief Rounding style of type \f$unsigned int\f$.)" << '\n'; out << "#define UINT_ROUNDS " << "0x" << std::hex << std::numeric_limits::round_style << '\n'; out << R"(/// \brief Number of radix digits represented by \f$unsigned int\f$.)" << '\n'; out << "#define UINT_RADIX_DIG " << "0x" << std::hex << std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$unsigned int\f$.)" << '\n'; out << "#define UINT_DIG " << "0x" << std::hex << std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$unsigned int\f$.)" << '\n'; out << "#define UINT_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief The radix, or unsigned integer base, used to represent a \f$unsigned int\f$.)" << '\n'; out << "#define UINT_RADIX " << "0x" << std::hex << std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$unsigned int\f$ trap?)" << '\n'; out << "#define UINT_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$unsigned int\f$.)" << '\n'; out << "#define UINT_MIN " << "0x" << std::hex << +std::numeric_limits::min() << '\n'; out << R"(/// \brief Largest finite value of \f$unsigned int\f$.)" << '\n'; out << "#define UINT_MAX " << "0x" << std::hex << +std::numeric_limits::max() << '\n'; out << "" << '\n'; out << R"(/// \brief Rounding style of type \f$long int\f$.)" << '\n'; out << "#define LONG_ROUNDS " << "0x" << std::hex << std::numeric_limits::round_style << '\n'; out << R"(/// \brief Number of radix digits represented by \f$long int\f$.)" << '\n'; out << "#define LONG_RADIX_DIG " << "0x" << std::hex << std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$long int\f$.)" << '\n'; out << "#define LONG_DIG " << "0x" << std::hex << std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$long int\f$.)" << '\n'; out << "#define LONG_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief The radix, or long integer base, used to represent a \f$long int\f$.)" << '\n'; out << "#define LONG_RADIX " << "0x" << std::hex << std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$long int\f$ trap?)" << '\n'; out << "#define LONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$long int\f$.)" << '\n'; out << "#define LONG_MIN " << "0x" << std::hex << +std::numeric_limits::min() << '\n'; out << R"(/// \brief Largest finite value of \f$long int\f$.)" << '\n'; out << "#define LONG_MAX " << "0x" << std::hex << +std::numeric_limits::max() << '\n'; out << "" << '\n'; out << R"(/// \brief Rounding style of type \f$unsigned long int\f$.)" << '\n'; out << "#define ULONG_ROUNDS " << "0x" << std::hex << std::numeric_limits::round_style << '\n'; out << R"(/// \brief Number of radix digits represented by \f$unsigned long int\f$.)" << '\n'; out << "#define ULONG_RADIX_DIG " << "0x" << std::hex << std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$unsigned long int\f$.)" << '\n'; out << "#define ULONG_DIG " << "0x" << std::hex << std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$unsigned long int\f$.)" << '\n'; out << "#define ULONG_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief The radix, or unsigned long integer base, used to represent a \f$unsigned long int\f$.)" << '\n'; out << "#define ULONG_RADIX " << "0x" << std::hex << std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$unsigned long int\f$ trap?)" << '\n'; out << "#define ULONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$unsigned long int\f$.)" << '\n'; out << "#define ULONG_MIN " << "0x" << std::hex << +std::numeric_limits::min() << '\n'; out << R"(/// \brief Largest finite value of \f$unsigned long int\f$.)" << '\n'; out << "#define ULONG_MAX " << "0x" << std::hex << +std::numeric_limits::max() << '\n'; out << "" << '\n'; out << R"(/// \brief Rounding style of type \f$long long\f$.)" << '\n'; out << "#define LLONG_ROUNDS " << "0x" << std::hex << std::numeric_limits::round_style << '\n'; out << R"(/// \brief Number of radix digits represented by \f$long long\f$.)" << '\n'; out << "#define LLONG_RADIX_DIG " << "0x" << std::hex << std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$long long\f$.)" << '\n'; out << "#define LLONG_DIG " << "0x" << std::hex << std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$long long\f$.)" << '\n'; out << "#define LLONG_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief The radix, or long longeger base, used to represent a \f$long long\f$.)" << '\n'; out << "#define LLONG_RADIX " << "0x" << std::hex << std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$long long\f$ trap?)" << '\n'; out << "#define LLONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$long long\f$.)" << '\n'; out << "#define LLONG_MIN " << "0x" << std::hex << +std::numeric_limits::min() << '\n'; out << R"(/// \brief Largest finite value of \f$long long\f$.)" << '\n'; out << "#define LLONG_MAX " << "0x" << std::hex << +std::numeric_limits::max() << '\n'; out << "" << '\n'; out << R"(/// \brief Rounding style of type \f$unsigned long long\f$.)" << '\n'; out << "#define ULLONG_ROUNDS " << "0x" << std::hex << std::numeric_limits::round_style << '\n'; out << R"(/// \brief Number of radix digits represented by \f$unsigned long long\f$.)" << '\n'; out << "#define ULLONG_RADIX_DIG " << "0x" << std::hex << std::numeric_limits::digits << '\n'; out << R"(/// \brief Number of decimal digits represented by \f$unsigned long long\f$.)" << '\n'; out << "#define ULLONG_DIG " << "0x" << std::hex << std::numeric_limits::digits10 << '\n'; out << R"(/// \brief Number of decimal digits necessary to differentiate all values of type \f$unsigned long long\f$.)" << '\n'; out << "#define ULLONG_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits::max_digits10 << '\n'; out << R"(/// \brief The radix, or unsigned long longeger base, used to represent a \f$unsigned long long\f$.)" << '\n'; out << "#define ULLONG_RADIX " << "0x" << std::hex << std::numeric_limits::radix << '\n'; out << R"(/// \brief Do arithmetics operations with \f$unsigned long long\f$ trap?)" << '\n'; out << "#define ULLONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits::traps << '\n'; out << R"(/// \brief Smallest finite value of \f$unsigned long long\f$.)" << '\n'; out << "#define ULLONG_MIN " << "0x" << std::hex << +std::numeric_limits::min() << '\n'; out << R"(/// \brief Largest finite value of \f$unsigned long long\f$.)" << '\n'; out << "#define ULLONG_MAX " << "0x" << std::hex << +std::numeric_limits::max() << '\n'; out << "" << '\n'; out << "#endif // FENNEC_LANG_INTEGER_H" << '\n'; out.close(); return; } #endif // FENNEC_METAPROGRAMMING_INTEGER_H