- Added More Documentation
This commit is contained in:
@@ -4,7 +4,8 @@ project(fennec-metaprogramming)
|
||||
set(CMAKE_CXX_STANDARD 26)
|
||||
|
||||
add_executable(fennec-metaprogramming main.cpp
|
||||
float.h)
|
||||
float.h
|
||||
integer.h)
|
||||
add_custom_command(
|
||||
OUTPUT .metaprogramming
|
||||
COMMAND fennec-metaprogramming
|
||||
|
||||
@@ -9,115 +9,115 @@
|
||||
|
||||
inline void float_h()
|
||||
{
|
||||
std::ofstream flt("float.h");
|
||||
std::ofstream out("float.h");
|
||||
|
||||
flt << "// =====================================================================================================================" << std::endl;
|
||||
flt << "// fennec, a free and open source game engine" << std::endl;
|
||||
flt << "// Copyright © 2025 Medusa Slockbower" << std::endl;
|
||||
flt << "//" << std::endl;
|
||||
flt << "// This program is free software: you can redistribute it and/or modify" << std::endl;
|
||||
flt << "// it under the terms of the GNU General Public License as published by" << std::endl;
|
||||
flt << "// the Free Software Foundation, either version 3 of the License, or" << std::endl;
|
||||
flt << "// (at your option) any later version." << std::endl;
|
||||
flt << "//" << std::endl;
|
||||
flt << "// This program is distributed in the hope that it will be useful," << std::endl;
|
||||
flt << "// but WITHOUT ANY WARRANTY; without even the implied warranty of" << std::endl;
|
||||
flt << "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << std::endl;
|
||||
flt << "// GNU General Public License for more details." << std::endl;
|
||||
flt << "//" << std::endl;
|
||||
flt << "// You should have received a copy of the GNU General Public License" << std::endl;
|
||||
flt << "// along with this program. If not, see <https://www.gnu.org/licenses/>." << std::endl;
|
||||
flt << "// =====================================================================================================================" << std::endl;
|
||||
out << "// =====================================================================================================================" << std::endl;
|
||||
out << "// fennec, a free and open source game engine" << std::endl;
|
||||
out << "// Copyright © 2025 Medusa Slockbower" << std::endl;
|
||||
out << "//" << std::endl;
|
||||
out << "// This program is free software: you can redistribute it and/or modify" << std::endl;
|
||||
out << "// it under the terms of the GNU General Public License as published by" << std::endl;
|
||||
out << "// the Free Software Foundation, either version 3 of the License, or" << std::endl;
|
||||
out << "// (at your option) any later version." << std::endl;
|
||||
out << "//" << std::endl;
|
||||
out << "// This program is distributed in the hope that it will be useful," << std::endl;
|
||||
out << "// but WITHOUT ANY WARRANTY; without even the implied warranty of" << std::endl;
|
||||
out << "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << std::endl;
|
||||
out << "// GNU General Public License for more details." << std::endl;
|
||||
out << "//" << std::endl;
|
||||
out << "// You should have received a copy of the GNU General Public License" << std::endl;
|
||||
out << "// along with this program. If not, see <https://www.gnu.org/licenses/>." << std::endl;
|
||||
out << "// =====================================================================================================================" << std::endl;
|
||||
|
||||
flt << "" << std::endl;
|
||||
out << "" << std::endl;
|
||||
|
||||
flt << "///" << std::endl;
|
||||
flt << "/// \\file float.h" << std::endl;
|
||||
flt << "/// \\brief metaprogramming floating point type info" << std::endl;
|
||||
flt << "///" << std::endl;
|
||||
flt << "///" << std::endl;
|
||||
flt << "/// \\details this file is automatically generated for the current build environment" << std::endl;
|
||||
flt << "///" << std::endl;
|
||||
flt << "/// \\copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))" << std::endl;
|
||||
flt << "///" << std::endl;
|
||||
flt << "///" << std::endl;
|
||||
out << "///" << std::endl;
|
||||
out << "/// \\file float.h" << std::endl;
|
||||
out << "/// \\brief metaprogramming floating point type info" << std::endl;
|
||||
out << "///" << std::endl;
|
||||
out << "///" << std::endl;
|
||||
out << "/// \\details this file is automatically generated for the current build environment" << std::endl;
|
||||
out << "///" << std::endl;
|
||||
out << "/// \\copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))" << std::endl;
|
||||
out << "///" << std::endl;
|
||||
out << "///" << std::endl;
|
||||
|
||||
flt << "" << std::endl;
|
||||
out << "" << std::endl;
|
||||
|
||||
flt << "#ifndef FENNEC_LANG_FLOAT_H" << std::endl;
|
||||
flt << "#define FENNEC_LANG_FLOAT_H" << std::endl;
|
||||
out << "#ifndef FENNEC_LANG_FLOAT_H" << std::endl;
|
||||
out << "#define FENNEC_LANG_FLOAT_H" << std::endl;
|
||||
|
||||
flt << "" << std::endl;
|
||||
out << "" << std::endl;
|
||||
|
||||
flt << "#include <fennec/lang/bits.h>" << std::endl;
|
||||
out << "#include <fennec/lang/bits.h>" << std::endl;
|
||||
|
||||
flt << "" << std::endl;
|
||||
out << "" << std::endl;
|
||||
|
||||
// TODO: Fix this to generate info without using the c++stdlib for platforms without this available.
|
||||
|
||||
flt << "#define FLT_HAS_INFINITY " << std::dec << std::numeric_limits<float>::has_infinity << std::endl;
|
||||
flt << "#define FLT_HAS_QUIET_NAN " << std::dec << std::numeric_limits<float>::has_quiet_NaN << std::endl;
|
||||
flt << "#define FLT_HAS_SIGNALING_NAN " << std::dec << std::numeric_limits<float>::has_signaling_NaN << std::endl;
|
||||
flt << "#define FLT_HAS_DENORM " << std::dec << std::numeric_limits<float>::has_denorm << std::endl;
|
||||
flt << "#define FLT_HAS_DENORM_LOSS " << std::dec << std::numeric_limits<float>::has_denorm_loss << std::endl;
|
||||
flt << "#define FLT_ROUNDS " << std::dec << std::numeric_limits<float>::round_style << std::endl;
|
||||
flt << "#define FLT_IS_IEC559 " << std::dec << std::numeric_limits<float>::is_iec559 << std::endl;
|
||||
flt << "#define FLT_MANT_DIG " << std::dec << std::numeric_limits<float>::digits << std::endl;
|
||||
flt << "#define FLT_DIG " << std::dec << std::numeric_limits<float>::digits10 << std::endl;
|
||||
flt << "#define FLT_DECIMAL_DIG " << std::dec << std::numeric_limits<float>::max_digits10 << std::endl;
|
||||
flt << "#define FLT_RADIX " << std::dec << std::numeric_limits<float>::radix << std::endl;
|
||||
flt << "#define FLT_MIN_EXP " << std::dec << std::numeric_limits<float>::min_exponent << std::endl;
|
||||
flt << "#define FLT_MAX_EXP " << std::dec << std::numeric_limits<float>::max_exponent << std::endl;
|
||||
flt << "#define FLT_MIN_10_EXP " << std::dec << std::numeric_limits<float>::min_exponent10 << std::endl;
|
||||
flt << "#define FLT_MAX_10_EXP " << std::dec << std::numeric_limits<float>::max_exponent10 << std::endl;
|
||||
flt << "#define FLT_TRAPS " << std::dec << std::numeric_limits<float>::traps << std::endl;
|
||||
flt << "#define FLT_TINYNESS_BEFORE " << std::dec << std::numeric_limits<float>::tinyness_before << std::endl;
|
||||
out << "#define FLT_HAS_INFINITY " << std::dec << std::numeric_limits<float>::has_infinity << std::endl;
|
||||
out << "#define FLT_HAS_QUIET_NAN " << std::dec << std::numeric_limits<float>::has_quiet_NaN << std::endl;
|
||||
out << "#define FLT_HAS_SIGNALING_NAN " << std::dec << std::numeric_limits<float>::has_signaling_NaN << std::endl;
|
||||
out << "#define FLT_HAS_DENORM " << std::dec << std::numeric_limits<float>::has_denorm << std::endl;
|
||||
out << "#define FLT_HAS_DENORM_LOSS " << std::dec << std::numeric_limits<float>::has_denorm_loss << std::endl;
|
||||
out << "#define FLT_ROUNDS " << std::dec << std::numeric_limits<float>::round_style << std::endl;
|
||||
out << "#define FLT_IS_IEC559 " << std::dec << std::numeric_limits<float>::is_iec559 << std::endl;
|
||||
out << "#define FLT_MANT_DIG " << std::dec << std::numeric_limits<float>::digits << std::endl;
|
||||
out << "#define FLT_DIG " << std::dec << std::numeric_limits<float>::digits10 << std::endl;
|
||||
out << "#define FLT_DECIMAL_DIG " << std::dec << std::numeric_limits<float>::max_digits10 << std::endl;
|
||||
out << "#define FLT_RADIX " << std::dec << std::numeric_limits<float>::radix << std::endl;
|
||||
out << "#define FLT_MIN_EXP " << std::dec << std::numeric_limits<float>::min_exponent << std::endl;
|
||||
out << "#define FLT_MAX_EXP " << std::dec << std::numeric_limits<float>::max_exponent << std::endl;
|
||||
out << "#define FLT_MIN_10_EXP " << std::dec << std::numeric_limits<float>::min_exponent10 << std::endl;
|
||||
out << "#define FLT_MAX_10_EXP " << std::dec << std::numeric_limits<float>::max_exponent10 << std::endl;
|
||||
out << "#define FLT_TRAPS " << std::dec << std::numeric_limits<float>::traps << std::endl;
|
||||
out << "#define FLT_TINYNESS_BEFORE " << std::dec << std::numeric_limits<float>::tinyness_before << std::endl;
|
||||
|
||||
flt << "#define FLT_MIN " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::min() ) << ")" << std::endl;
|
||||
flt << "#define FLT_MAX " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::max() ) << ")" << std::endl;
|
||||
flt << "#define FLT_EPSILON " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::epsilon() ) << ")" << std::endl;
|
||||
flt << "#define FLT_INF " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::infinity() ) << ")" << std::endl;
|
||||
flt << "#define FLT_QUIET_NAN " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::quiet_NaN() ) << ")" << std::endl;
|
||||
flt << "#define FLT_SIGNALING_NAN " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::signaling_NaN()) << ")" << std::endl;
|
||||
flt << "#define FLT_DENORM_MIN " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::denorm_min() ) << ")" << std::endl;
|
||||
flt << "#define FLT_ROUND_ERR " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::round_error() ) << ")" << std::endl;
|
||||
out << "#define FLT_MIN " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::min() ) << ")" << std::endl;
|
||||
out << "#define FLT_MAX " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::max() ) << ")" << std::endl;
|
||||
out << "#define FLT_EPSILON " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::epsilon() ) << ")" << std::endl;
|
||||
out << "#define FLT_INF " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::infinity() ) << ")" << std::endl;
|
||||
out << "#define FLT_QUIET_NAN " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::quiet_NaN() ) << ")" << std::endl;
|
||||
out << "#define FLT_SIGNALING_NAN " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::signaling_NaN()) << ")" << std::endl;
|
||||
out << "#define FLT_DENORM_MIN " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::denorm_min() ) << ")" << std::endl;
|
||||
out << "#define FLT_ROUND_ERR " << "fennec::bit_cast<float>(0x" << std::hex << std::bit_cast<int>(std::numeric_limits<float>::round_error() ) << ")" << std::endl;
|
||||
|
||||
flt << "" << std::endl;
|
||||
out << "" << std::endl;
|
||||
|
||||
flt << "#define DBL_HAS_INFINITY " << std::dec << std::numeric_limits<double>::has_infinity << std::endl;
|
||||
flt << "#define DBL_HAS_QUIET_NAN " << std::dec << std::numeric_limits<double>::has_quiet_NaN << std::endl;
|
||||
flt << "#define DBL_HAS_SIGNALING_NAN " << std::dec << std::numeric_limits<double>::has_signaling_NaN << std::endl;
|
||||
flt << "#define DBL_HAS_DENORM " << std::dec << std::numeric_limits<double>::has_denorm << std::endl;
|
||||
flt << "#define DBL_HAS_DENORM_LOSS " << std::dec << std::numeric_limits<double>::has_denorm_loss << std::endl;
|
||||
flt << "#define DBL_ROUNDS " << std::dec << std::numeric_limits<double>::round_style << std::endl;
|
||||
flt << "#define DBL_IS_IEC559 " << std::dec << std::numeric_limits<double>::is_iec559 << std::endl;
|
||||
flt << "#define DBL_MANT_DIG " << std::dec << std::numeric_limits<double>::digits << std::endl;
|
||||
flt << "#define DBL_DIG " << std::dec << std::numeric_limits<double>::digits10 << std::endl;
|
||||
flt << "#define DBL_DECIMAL_DIG " << std::dec << std::numeric_limits<double>::max_digits10 << std::endl;
|
||||
flt << "#define DBL_RADIX " << std::dec << std::numeric_limits<double>::radix << std::endl;
|
||||
flt << "#define DBL_MIN_EXP " << std::dec << std::numeric_limits<double>::min_exponent << std::endl;
|
||||
flt << "#define DBL_MAX_EXP " << std::dec << std::numeric_limits<double>::max_exponent << std::endl;
|
||||
flt << "#define DBL_MIN_10_EXP " << std::dec << std::numeric_limits<double>::min_exponent10 << std::endl;
|
||||
flt << "#define DBL_MAX_10_EXP " << std::dec << std::numeric_limits<double>::max_exponent10 << std::endl;
|
||||
flt << "#define DBL_TRAPS " << std::dec << std::numeric_limits<double>::traps << std::endl;
|
||||
flt << "#define DBL_TINYNESS_BEFORE " << std::dec << std::numeric_limits<double>::tinyness_before << std::endl;
|
||||
out << "#define DBL_HAS_INFINITY " << std::dec << std::numeric_limits<double>::has_infinity << std::endl;
|
||||
out << "#define DBL_HAS_QUIET_NAN " << std::dec << std::numeric_limits<double>::has_quiet_NaN << std::endl;
|
||||
out << "#define DBL_HAS_SIGNALING_NAN " << std::dec << std::numeric_limits<double>::has_signaling_NaN << std::endl;
|
||||
out << "#define DBL_HAS_DENORM " << std::dec << std::numeric_limits<double>::has_denorm << std::endl;
|
||||
out << "#define DBL_HAS_DENORM_LOSS " << std::dec << std::numeric_limits<double>::has_denorm_loss << std::endl;
|
||||
out << "#define DBL_ROUNDS " << std::dec << std::numeric_limits<double>::round_style << std::endl;
|
||||
out << "#define DBL_IS_IEC559 " << std::dec << std::numeric_limits<double>::is_iec559 << std::endl;
|
||||
out << "#define DBL_MANT_DIG " << std::dec << std::numeric_limits<double>::digits << std::endl;
|
||||
out << "#define DBL_DIG " << std::dec << std::numeric_limits<double>::digits10 << std::endl;
|
||||
out << "#define DBL_DECIMAL_DIG " << std::dec << std::numeric_limits<double>::max_digits10 << std::endl;
|
||||
out << "#define DBL_RADIX " << std::dec << std::numeric_limits<double>::radix << std::endl;
|
||||
out << "#define DBL_MIN_EXP " << std::dec << std::numeric_limits<double>::min_exponent << std::endl;
|
||||
out << "#define DBL_MAX_EXP " << std::dec << std::numeric_limits<double>::max_exponent << std::endl;
|
||||
out << "#define DBL_MIN_10_EXP " << std::dec << std::numeric_limits<double>::min_exponent10 << std::endl;
|
||||
out << "#define DBL_MAX_10_EXP " << std::dec << std::numeric_limits<double>::max_exponent10 << std::endl;
|
||||
out << "#define DBL_TRAPS " << std::dec << std::numeric_limits<double>::traps << std::endl;
|
||||
out << "#define DBL_TINYNESS_BEFORE " << std::dec << std::numeric_limits<double>::tinyness_before << std::endl;
|
||||
|
||||
flt << "#define DBL_MIN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::min() ) << "l)" << std::endl;
|
||||
flt << "#define DBL_MAX " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::max() ) << "l)" << std::endl;
|
||||
flt << "#define DBL_EPSILON " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::epsilon() ) << "l)" << std::endl;
|
||||
flt << "#define DBL_INF " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::infinity() ) << "l)" << std::endl;
|
||||
flt << "#define DBL_QUIET_NAN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::quiet_NaN() ) << "l)" << std::endl;
|
||||
flt << "#define DBL_SIGNALING_NAN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::signaling_NaN()) << "l)" << std::endl;
|
||||
flt << "#define DBL_DENORM_MIN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::denorm_min() ) << "l)" << std::endl;
|
||||
flt << "#define DBL_ROUND_ERR " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::round_error() ) << "l)" << std::endl;
|
||||
out << "#define DBL_MIN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::min() ) << "l)" << std::endl;
|
||||
out << "#define DBL_MAX " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::max() ) << "l)" << std::endl;
|
||||
out << "#define DBL_EPSILON " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::epsilon() ) << "l)" << std::endl;
|
||||
out << "#define DBL_INF " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::infinity() ) << "l)" << std::endl;
|
||||
out << "#define DBL_QUIET_NAN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::quiet_NaN() ) << "l)" << std::endl;
|
||||
out << "#define DBL_SIGNALING_NAN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::signaling_NaN()) << "l)" << std::endl;
|
||||
out << "#define DBL_DENORM_MIN " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::denorm_min() ) << "l)" << std::endl;
|
||||
out << "#define DBL_ROUND_ERR " << "fennec::bit_cast<double>(0x" << std::hex << std::bit_cast<long long>(std::numeric_limits<double>::round_error() ) << "l)" << std::endl;
|
||||
|
||||
flt << "" << std::endl;
|
||||
out << "" << std::endl;
|
||||
|
||||
flt << "#endif // FENNEC_LANG_FLOAT_H" << std::endl;
|
||||
out << "#endif // FENNEC_LANG_FLOAT_H" << std::endl;
|
||||
|
||||
flt.close();
|
||||
out.close();
|
||||
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
#endif //FLOAT_H
|
||||
|
||||
253
metaprogramming/integer.h
Normal file
253
metaprogramming/integer.h
Normal file
@@ -0,0 +1,253 @@
|
||||
// =====================================================================================================================
|
||||
// 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_METAPROGRAMMING_INTEGER_H
|
||||
#define FENNEC_METAPROGRAMMING_INTEGER_H
|
||||
|
||||
#include <fstream>
|
||||
|
||||
inline void integer_h()
|
||||
{
|
||||
|
||||
std::ofstream out("integer.h");
|
||||
|
||||
out << "// =====================================================================================================================" << std::endl;
|
||||
out << "// fennec, a free and open source game engine" << std::endl;
|
||||
out << "// Copyright © 2025 Medusa Slockbower" << std::endl;
|
||||
out << "//" << std::endl;
|
||||
out << "// This program is free software: you can redistribute it and/or modify" << std::endl;
|
||||
out << "// it under the terms of the GNU General Public License as published by" << std::endl;
|
||||
out << "// the Free Software Foundation, either version 3 of the License, or" << std::endl;
|
||||
out << "// (at your option) any later version." << std::endl;
|
||||
out << "//" << std::endl;
|
||||
out << "// This program is distributed in the hope that it will be useful," << std::endl;
|
||||
out << "// but WITHOUT ANY WARRANTY; without even the implied warranty of" << std::endl;
|
||||
out << "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << std::endl;
|
||||
out << "// GNU General Public License for more details." << std::endl;
|
||||
out << "//" << std::endl;
|
||||
out << "// You should have received a copy of the GNU General Public License" << std::endl;
|
||||
out << "// along with this program. If not, see <https://www.gnu.org/licenses/>." << std::endl;
|
||||
out << "// =====================================================================================================================" << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "///" << std::endl;
|
||||
out << "/// \\file integer.h" << std::endl;
|
||||
out << "/// \\brief metaprogramming integer type info" << std::endl;
|
||||
out << "///" << std::endl;
|
||||
out << "///" << std::endl;
|
||||
out << "/// \\details this file is automatically generated for the current build environment" << std::endl;
|
||||
out << "///" << std::endl;
|
||||
out << "/// \\copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))" << std::endl;
|
||||
out << "///" << std::endl;
|
||||
out << "///" << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#ifndef FENNEC_LANG_INTEGER_H" << std::endl;
|
||||
out << "#define FENNEC_LANG_INTEGER_H" << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#undef WCHAR_MIN" << std::endl;
|
||||
out << "#undef WCHAR_MAX" << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
// TODO: Fix this to generate info without using the c++stdlib for platforms without this available.
|
||||
|
||||
out << "#define CHAR_IS_SIGNED " << std::boolalpha << std::numeric_limits<char>::is_signed << std::endl;
|
||||
if(std::numeric_limits<char>::is_signed) {
|
||||
out << "#define CHAR_ROUNDS " << "0x" << std::hex << (int)std::numeric_limits<char>::round_style << std::endl;
|
||||
out << "#define CHAR_RADIX_DIG " << "0x" << std::hex << (int)std::numeric_limits<char>::digits << std::endl;
|
||||
out << "#define CHAR_DIG " << "0x" << std::hex << (int)std::numeric_limits<char>::digits10 << std::endl;
|
||||
out << "#define CHAR_DECIMAL_DIG " << "0x" << std::hex << (int)std::numeric_limits<char>::max_digits10 << std::endl;
|
||||
out << "#define CHAR_RADIX " << "0x" << std::hex << (int)std::numeric_limits<char>::radix << std::endl;
|
||||
out << "#define CHAR_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<char>::traps << std::endl;
|
||||
|
||||
out << "#define CHAR_MIN " << "0x" << std::hex << (int)std::numeric_limits<char>::min() << std::endl;
|
||||
out << "#define CHAR_MAX " << "0x" << std::hex << (int)std::numeric_limits<char>::max() << std::endl;
|
||||
}
|
||||
else {
|
||||
out << "#define CHAR_ROUNDS " << "0x" << std::hex << (unsigned int)std::numeric_limits<char>::round_style << std::endl;
|
||||
out << "#define CHAR_RADIX_DIG " << "0x" << std::hex << (unsigned int)std::numeric_limits<char>::digits << std::endl;
|
||||
out << "#define CHAR_DIG " << "0x" << std::hex << (unsigned int)std::numeric_limits<char>::digits10 << std::endl;
|
||||
out << "#define CHAR_DECIMAL_DIG " << "0x" << std::hex << (unsigned int)std::numeric_limits<char>::max_digits10 << std::endl;
|
||||
out << "#define CHAR_RADIX " << "0x" << std::hex << (unsigned int)std::numeric_limits<char>::radix << std::endl;
|
||||
out << "#define CHAR_TRAPS " << "0x" << std::boolalpha << (unsigned int)std::numeric_limits<char>::traps << std::endl;
|
||||
|
||||
out << "#define CHAR_MIN " << "0x" << std::hex << (unsigned int)std::numeric_limits<char>::min() << std::endl;
|
||||
out << "#define CHAR_MAX " << "0x" << std::hex << (unsigned int)std::numeric_limits<char>::max() << std::endl;
|
||||
}
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#define WCHAR_IS_SIGNED " << std::boolalpha << std::numeric_limits<wchar_t>::is_signed << std::endl;
|
||||
if(std::numeric_limits<wchar_t>::is_signed) {
|
||||
out << "#define WCHAR_ROUNDS " << "0x" << std::hex << (int)std::numeric_limits<wchar_t>::round_style << std::endl;
|
||||
out << "#define WCHAR_RADIX_DIG " << "0x" << std::hex << (int)std::numeric_limits<wchar_t>::digits << std::endl;
|
||||
out << "#define WCHAR_DIG " << "0x" << std::hex << (int)std::numeric_limits<wchar_t>::digits10 << std::endl;
|
||||
out << "#define WCHAR_DECIMAL_DIG " << "0x" << std::hex << (int)std::numeric_limits<wchar_t>::max_digits10 << std::endl;
|
||||
out << "#define WCHAR_RADIX " << "0x" << std::hex << (int)std::numeric_limits<wchar_t>::radix << std::endl;
|
||||
out << "#define WCHAR_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<wchar_t>::traps << std::endl;
|
||||
|
||||
out << "#define WCHAR_MIN " << "0x" << std::hex << (int)std::numeric_limits<wchar_t>::min() << std::endl;
|
||||
out << "#define WCHAR_MAX " << "0x" << std::hex << (int)std::numeric_limits<wchar_t>::max() << std::endl;
|
||||
}
|
||||
else {
|
||||
out << "#define WCHAR_ROUNDS " << "0x" << std::hex << (unsigned int)std::numeric_limits<wchar_t>::round_style << std::endl;
|
||||
out << "#define WCHAR_RADIX_DIG " << "0x" << std::hex << (unsigned int)std::numeric_limits<wchar_t>::digits << std::endl;
|
||||
out << "#define WCHAR_DIG " << "0x" << std::hex << (unsigned int)std::numeric_limits<wchar_t>::digits10 << std::endl;
|
||||
out << "#define WCHAR_DECIMAL_DIG " << "0x" << std::hex << (unsigned int)std::numeric_limits<wchar_t>::max_digits10 << std::endl;
|
||||
out << "#define WCHAR_RADIX " << "0x" << std::hex << (unsigned int)std::numeric_limits<wchar_t>::radix << std::endl;
|
||||
out << "#define WCHAR_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<wchar_t>::traps << std::endl;
|
||||
|
||||
out << "#define WCHAR_MIN " << "0x" << std::hex << (unsigned int)std::numeric_limits<wchar_t>::min() << std::endl;
|
||||
out << "#define WCHAR_MAX " << "0x" << std::hex << (unsigned int)std::numeric_limits<wchar_t>::max() << std::endl;
|
||||
}
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#define SCHAR_ROUNDS " << "0x" << std::hex << (int)std::numeric_limits<signed char>::round_style << std::endl;
|
||||
out << "#define SCHAR_RADIX_DIG " << "0x" << std::hex << (int)std::numeric_limits<signed char>::digits << std::endl;
|
||||
out << "#define SCHAR_DIG " << "0x" << std::hex << (int)std::numeric_limits<signed char>::digits10 << std::endl;
|
||||
out << "#define SCHAR_DECIMAL_DIG " << "0x" << std::hex << (int)std::numeric_limits<signed char>::max_digits10 << std::endl;
|
||||
out << "#define SCHAR_RADIX " << "0x" << std::hex << (int)std::numeric_limits<signed char>::radix << std::endl;
|
||||
out << "#define SCHAR_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<signed char>::traps << std::endl;
|
||||
|
||||
out << "#define SCHAR_MIN " << "0x" << std::hex << (int)std::numeric_limits<signed char>::min() << std::endl;
|
||||
out << "#define SCHAR_MAX " << "0x" << std::hex << (int)std::numeric_limits<signed char>::max() << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#define UCHAR_ROUNDS " << "0x" << std::hex << (unsigned int)std::numeric_limits<unsigned char>::round_style << std::endl;
|
||||
out << "#define UCHAR_RADIX_DIG " << "0x" << std::hex << (unsigned int)std::numeric_limits<unsigned char>::digits << std::endl;
|
||||
out << "#define UCHAR_DIG " << "0x" << std::hex << (unsigned int)std::numeric_limits<unsigned char>::digits10 << std::endl;
|
||||
out << "#define UCHAR_DECIMAL_DIG " << "0x" << std::hex << (unsigned int)std::numeric_limits<unsigned char>::max_digits10 << std::endl;
|
||||
out << "#define UCHAR_RADIX " << "0x" << std::hex << (unsigned int)std::numeric_limits<unsigned char>::radix << std::endl;
|
||||
out << "#define UCHAR_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<unsigned char>::traps << std::endl;
|
||||
|
||||
out << "#define UCHAR_MIN " << "0x" << std::hex << (unsigned int)std::numeric_limits<unsigned char>::min() << std::endl;
|
||||
out << "#define UCHAR_MAX " << "0x" << std::hex << (unsigned int)std::numeric_limits<unsigned char>::max() << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#define SHORT_ROUNDS " << "0x" << std::hex << std::numeric_limits<short>::round_style << std::endl;
|
||||
out << "#define SHORT_RADIX_DIG " << "0x" << std::hex << std::numeric_limits<short>::digits << std::endl;
|
||||
out << "#define SHORT_DIG " << "0x" << std::hex << std::numeric_limits<short>::digits10 << std::endl;
|
||||
out << "#define SHORT_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits<short>::max_digits10 << std::endl;
|
||||
out << "#define SHORT_RADIX " << "0x" << std::hex << std::numeric_limits<short>::radix << std::endl;
|
||||
out << "#define SHORT_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<short>::traps << std::endl;
|
||||
|
||||
out << "#define SHORT_MIN " << "0x" << std::hex << std::numeric_limits<short>::min() << std::endl;
|
||||
out << "#define SHORT_MAX " << "0x" << std::hex << std::numeric_limits<short>::max() << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#define USHORT_ROUNDS " << "0x" << std::hex << std::numeric_limits<unsigned short>::round_style << std::endl;
|
||||
out << "#define USHORT_RADIX_DIG " << "0x" << std::hex << std::numeric_limits<unsigned short>::digits << std::endl;
|
||||
out << "#define USHORT_DIG " << "0x" << std::hex << std::numeric_limits<unsigned short>::digits10 << std::endl;
|
||||
out << "#define USHORT_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits<unsigned short>::max_digits10 << std::endl;
|
||||
out << "#define USHORT_RADIX " << "0x" << std::hex << std::numeric_limits<unsigned short>::radix << std::endl;
|
||||
out << "#define USHORT_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<unsigned short>::traps << std::endl;
|
||||
|
||||
out << "#define USHORT_MIN " << "0x" << std::hex << std::numeric_limits<unsigned short>::min() << std::endl;
|
||||
out << "#define USHORT_MAX " << "0x" << std::hex << std::numeric_limits<unsigned short>::max() << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#define INT_ROUNDS " << "0x" << std::hex << std::numeric_limits<int>::round_style << std::endl;
|
||||
out << "#define INT_RADIX_DIG " << "0x" << std::hex << std::numeric_limits<int>::digits << std::endl;
|
||||
out << "#define INT_DIG " << "0x" << std::hex << std::numeric_limits<int>::digits10 << std::endl;
|
||||
out << "#define INT_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits<int>::max_digits10 << std::endl;
|
||||
out << "#define INT_RADIX " << "0x" << std::hex << std::numeric_limits<int>::radix << std::endl;
|
||||
out << "#define INT_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<int>::traps << std::endl;
|
||||
|
||||
out << "#define INT_MIN " << "0x" << std::hex << std::numeric_limits<int>::min() << std::endl;
|
||||
out << "#define INT_MAX " << "0x" << std::hex << std::numeric_limits<int>::max() << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#define UINT_ROUNDS " << "0x" << std::hex << std::numeric_limits<unsigned int>::round_style << std::endl;
|
||||
out << "#define UINT_RADIX_DIG " << "0x" << std::hex << std::numeric_limits<unsigned int>::digits << std::endl;
|
||||
out << "#define UINT_DIG " << "0x" << std::hex << std::numeric_limits<unsigned int>::digits10 << std::endl;
|
||||
out << "#define UINT_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits<unsigned int>::max_digits10 << std::endl;
|
||||
out << "#define UINT_RADIX " << "0x" << std::hex << std::numeric_limits<unsigned int>::radix << std::endl;
|
||||
out << "#define UINT_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<unsigned int>::traps << std::endl;
|
||||
|
||||
out << "#define UINT_MIN " << "0x" << std::hex << std::numeric_limits<unsigned int>::min() << std::endl;
|
||||
out << "#define UINT_MAX " << "0x" << std::hex << std::numeric_limits<unsigned int>::max() << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#define LONG_ROUNDS " << "0x" << std::hex << std::numeric_limits<long int>::round_style << std::endl;
|
||||
out << "#define LONG_RADIX_DIG " << "0x" << std::hex << std::numeric_limits<long int>::digits << std::endl;
|
||||
out << "#define LONG_DIG " << "0x" << std::hex << std::numeric_limits<long int>::digits10 << std::endl;
|
||||
out << "#define LONG_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits<long int>::max_digits10 << std::endl;
|
||||
out << "#define LONG_RADIX " << "0x" << std::hex << std::numeric_limits<long int>::radix << std::endl;
|
||||
out << "#define LONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<long int>::traps << std::endl;
|
||||
|
||||
out << "#define LONG_MIN " << "0x" << std::hex << std::numeric_limits<long int>::min() << std::endl;
|
||||
out << "#define LONG_MAX " << "0x" << std::hex << std::numeric_limits<long int>::max() << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#define ULONG_ROUNDS " << "0x" << std::hex << std::numeric_limits<unsigned long int>::round_style << std::endl;
|
||||
out << "#define ULONG_RADIX_DIG " << "0x" << std::hex << std::numeric_limits<unsigned long int>::digits << std::endl;
|
||||
out << "#define ULONG_DIG " << "0x" << std::hex << std::numeric_limits<unsigned long int>::digits10 << std::endl;
|
||||
out << "#define ULONG_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits<unsigned long int>::max_digits10 << std::endl;
|
||||
out << "#define ULONG_RADIX " << "0x" << std::hex << std::numeric_limits<unsigned long int>::radix << std::endl;
|
||||
out << "#define ULONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<unsigned long int>::traps << std::endl;
|
||||
|
||||
out << "#define ULONG_MIN " << "0x" << std::hex << std::numeric_limits<unsigned long int>::min() << std::endl;
|
||||
out << "#define ULONG_MAX " << "0x" << std::hex << std::numeric_limits<unsigned long int>::max() << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#define LLONG_ROUNDS " << "0x" << std::hex << std::numeric_limits<long long>::round_style << std::endl;
|
||||
out << "#define LLONG_RADIX_DIG " << "0x" << std::hex << std::numeric_limits<long long>::digits << std::endl;
|
||||
out << "#define LLONG_DIG " << "0x" << std::hex << std::numeric_limits<long long>::digits10 << std::endl;
|
||||
out << "#define LLONG_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits<long long>::max_digits10 << std::endl;
|
||||
out << "#define LLONG_RADIX " << "0x" << std::hex << std::numeric_limits<long long>::radix << std::endl;
|
||||
out << "#define LLONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<long long>::traps << std::endl;
|
||||
|
||||
out << "#define LLONG_MIN " << "0x" << std::hex << std::numeric_limits<long long>::min() << std::endl;
|
||||
out << "#define LLONG_MAX " << "0x" << std::hex << std::numeric_limits<long long>::max() << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#define ULLONG_ROUNDS " << "0x" << std::hex << std::numeric_limits<unsigned long long>::round_style << std::endl;
|
||||
out << "#define ULLONG_RADIX_DIG " << "0x" << std::hex << std::numeric_limits<unsigned long long>::digits << std::endl;
|
||||
out << "#define ULLONG_DIG " << "0x" << std::hex << std::numeric_limits<unsigned long long>::digits10 << std::endl;
|
||||
out << "#define ULLONG_DECIMAL_DIG " << "0x" << std::hex << std::numeric_limits<unsigned long long>::max_digits10 << std::endl;
|
||||
out << "#define ULLONG_RADIX " << "0x" << std::hex << std::numeric_limits<unsigned long long>::radix << std::endl;
|
||||
out << "#define ULLONG_TRAPS " << "0x" << std::boolalpha << std::numeric_limits<unsigned long long>::traps << std::endl;
|
||||
|
||||
out << "#define ULLONG_MIN " << "0x" << std::hex << std::numeric_limits<unsigned long long>::min() << std::endl;
|
||||
out << "#define ULLONG_MAX " << "0x" << std::hex << std::numeric_limits<unsigned long long>::max() << std::endl;
|
||||
|
||||
out << "" << std::endl;
|
||||
|
||||
out << "#endif // FENNEC_LANG_INTEGER_H" << std::endl;
|
||||
|
||||
out.close();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // FENNEC_METAPROGRAMMING_INTEGER_H
|
||||
@@ -19,6 +19,11 @@
|
||||
#include <fstream>
|
||||
#include <cmath>
|
||||
|
||||
#include "float.h"
|
||||
#include "integer.h"
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
float_h();
|
||||
integer_h();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user