From b5adf16a96b9cbb80c74cf30404ed5bcff03ac34 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 22 Nov 2025 09:59:41 +0100 Subject: chore: DebuggerKit cleanup. Signed-off-by: Amlal El Mahrouss --- dev/LibC++/__abi.h | 8 +++++++- dev/LibC++/base_math.h | 17 +++++++++++++++-- dev/LibC++/base_process.h | 16 ++++++++++------ dev/LibC++/defines.h | 10 +++------- 4 files changed, 35 insertions(+), 16 deletions(-) (limited to 'dev/LibC++') diff --git a/dev/LibC++/__abi.h b/dev/LibC++/__abi.h index d46a9ee..70afae5 100644 --- a/dev/LibC++/__abi.h +++ b/dev/LibC++/__abi.h @@ -6,4 +6,10 @@ #pragma once -extern "C" void __compilerkit_unreachable(void); +#include + +__init_decl() + +extern void __compilerkit_unreachable(void); + +__fini_decl() \ No newline at end of file diff --git a/dev/LibC++/base_math.h b/dev/LibC++/base_math.h index 73cb174..60b260e 100644 --- a/dev/LibC++/base_math.h +++ b/dev/LibC++/base_math.h @@ -8,10 +8,14 @@ #include +#ifndef NAN +#define NAN (__builtin_nanf("")) +#endif // !NAN + /// @file Math.h /// @brief Math functions. -#ifdef __NE_USE_DOUBLE__ +#ifdef __LIBCXX_USE_DOUBLE__ typedef double real_type; #else typedef float real_type; @@ -20,7 +24,9 @@ typedef float real_type; namespace std::base_math { inline constexpr static auto not_a_number = NAN; +/// =========================================================== /// /// @brief Power function, with Repeat argument. +/// =========================================================== /// template inline real_type pow(real_type in) { if (Exponent == 0) return 1; // Any number to the power of 0 is 1. @@ -36,6 +42,9 @@ inline real_type pow(real_type in) { return result; } +/// =========================================================== /// +/// @brief Square root function. +/// =========================================================== /// inline real_type sqrt(real_type in) { if (in == 0) return 0; if (in == not_a_number) return not_a_number; @@ -51,8 +60,10 @@ inline real_type sqrt(real_type in) { return x; } +/// =========================================================== /// /// @brief Square of function, with Base template argument. -/// @param of Base argument to find sqquare of +/// @param of Base argument to find the square of. +/// =========================================================== /// template inline real_type surd(real_type in) { if (in == 0) return 0; @@ -64,10 +75,12 @@ inline real_type surd(real_type in) { return not_a_number; } +/// =========================================================== /// /// @brief Linear interpolation equation solver. /// @param from where? /// @param to to? /// @param Updated diff value according to difference. +/// =========================================================== /// inline real_type lerp(real_type to, real_type from, real_type stat) { real_type diff = (to - from); return from + (diff * stat); diff --git a/dev/LibC++/base_process.h b/dev/LibC++/base_process.h index abcbf08..f9b0596 100644 --- a/dev/LibC++/base_process.h +++ b/dev/LibC++/base_process.h @@ -8,14 +8,22 @@ #include +__init_decl() + /// @brief CRT exit, with exit code (!!! exits all threads. !!!) /// @param code the exit code. /// @return the return > 0 for non successful. -extern "C" int exit_(int code); +extern int exit_(int code); /// @brief CRT signal handler. /// @param code the signal code. -extern "C" void signal_(int code); +extern void signal_(int code); + +extern void (*__atexit_cdecl_ptr)(void); +extern void (**__atexit_lst_ptr)(void); +extern size_t __atexit_lst_cnt; + +__fini_decl() /// @brief Standard C++ namespace namespace std::base_process { @@ -24,10 +32,6 @@ inline int signal(int code) { return -1; } -extern "C" void (*__atexit_cdecl_ptr)(void); -extern "C" void (**__atexit_lst_ptr)(void); -extern "C" size_t __atexit_lst_cnt; - inline int32_t exit(const int32_t& code) { for (auto idx = 0UL; idx < __atexit_lst_cnt; ++idx) { __atexit_lst_ptr[idx](); diff --git a/dev/LibC++/defines.h b/dev/LibC++/defines.h index e263d9c..b8ef10c 100644 --- a/dev/LibC++/defines.h +++ b/dev/LibC++/defines.h @@ -7,20 +7,16 @@ #ifndef __NECTI_DEFINES_H__ #define __NECTI_DEFINES_H__ -extern "C" { -#include -#include -} - #define __ATTRIBUTE(X) __attribute__((X)) typedef __SIZE_TYPE__ size_t; -typedef __SSIZE_TYPE__ ssize_t; +typedef __INT64_TYPE__ ssize_t; +typedef __INT32_TYPE__ int32_t; typedef void* ptr_type; typedef __SIZE_TYPE__ size_type; -typedef size_t ptrdiff_t; +typedef __INT64_TYPE__ ptrdiff_t; typedef size_t uintptr_t; typedef void* voidptr_t; typedef void* any_t; -- cgit v1.2.3