diff options
| author | Amlal <amlal@nekernel.org> | 2025-04-25 13:14:01 +0200 |
|---|---|---|
| committer | Amlal <amlal@nekernel.org> | 2025-04-25 13:14:01 +0200 |
| commit | 20042235d1f53ae428aa154e64afdbae5d8d91ad (patch) | |
| tree | 6ea42d1b30505a57301f8ff2916c78ce94ff6eaf /dev/LibCompiler/Defines.h | |
| parent | 0561a8d0a6ae7588309a6e3513bbfeeef5f0aa15 (diff) | |
meta: update .clang-format, format codebase.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/LibCompiler/Defines.h')
| -rw-r--r-- | dev/LibCompiler/Defines.h | 134 |
1 files changed, 63 insertions, 71 deletions
diff --git a/dev/LibCompiler/Defines.h b/dev/LibCompiler/Defines.h index 07f3b33..eacf9c0 100644 --- a/dev/LibCompiler/Defines.h +++ b/dev/LibCompiler/Defines.h @@ -1,6 +1,6 @@ /* ------------------------------------------- - Copyright (C) 2024-2025 Amlal EL Mahrous, all rights reserved + Copyright (C) 2024-2025 Amlal EL Mahrous, all rights reserved ------------------------------------------- */ @@ -9,23 +9,23 @@ #ifndef Yes #define Yes true -#endif // ifndef Yes +#endif // ifndef Yes #ifndef No #define No false -#endif // ifndef No +#endif // ifndef No #ifndef YES #define YES true -#endif // ifndef YES +#endif // ifndef YES #ifndef NO #define NO false -#endif // ifndef NO +#endif // ifndef NO #ifndef BOOL #define BOOL bool -#endif // ifndef BOOL +#endif // ifndef BOOL #define SizeType size_t @@ -34,37 +34,36 @@ #define UIntPtr uintptr_t -#define Int64 int64_t +#define Int64 int64_t #define UInt64 uint64_t -#define Int32 int +#define Int32 int #define UInt32 unsigned #define Bool bool -#define Int16 int16_t +#define Int16 int16_t #define UInt16 uint16_t -#define Int8 int8_t +#define Int8 int8_t #define UInt8 uint8_t #define CharType char -#define Boolean bool +#define Boolean bool -#include <filesystem> -#include <cstdint> #include <cassert> -#include <cstring> -#include <iostream> -#include <utility> #include <cctype> +#include <cstdint> #include <cstdio> +#include <cstring> +#include <filesystem> #include <fstream> +#include <iostream> #include <memory> +#include <new> #include <string> +#include <utility> #include <vector> -#include <vector> -#include <new> #define nullPtr std::nullptr_t @@ -82,76 +81,71 @@ #define rt_copy_memory(dst, src, len) memcpy(dst, src, len) #endif -#define LIBCOMPILER_COPY_DELETE(KLASS) \ - KLASS& operator=(const KLASS&) = delete; \ - KLASS(const KLASS&) = delete; +#define LIBCOMPILER_COPY_DELETE(KLASS) \ + KLASS& operator=(const KLASS&) = delete; \ + KLASS(const KLASS&) = delete; -#define LIBCOMPILER_COPY_DEFAULT(KLASS) \ - KLASS& operator=(const KLASS&) = default; \ - KLASS(const KLASS&) = default; +#define LIBCOMPILER_COPY_DEFAULT(KLASS) \ + KLASS& operator=(const KLASS&) = default; \ + KLASS(const KLASS&) = default; -#define LIBCOMPILER_MOVE_DELETE(KLASS) \ - KLASS& operator=(KLASS&&) = delete; \ - KLASS(KLASS&&) = delete; +#define LIBCOMPILER_MOVE_DELETE(KLASS) \ + KLASS& operator=(KLASS&&) = delete; \ + KLASS(KLASS&&) = delete; -#define LIBCOMPILER_MOVE_DEFAULT(KLASS) \ - KLASS& operator=(KLASS&&) = default; \ - KLASS(KLASS&&) = default; +#define LIBCOMPILER_MOVE_DEFAULT(KLASS) \ + KLASS& operator=(KLASS&&) = default; \ + KLASS(KLASS&&) = default; #define LC_IMPORT_C extern "C" -#define LC_IMPORT extern +#define LC_IMPORT extern #include <ctime> #include <fstream> #include <string> #include <vector> -namespace LibCompiler -{ - inline constexpr int kBaseYear = 1900; +namespace LibCompiler { +inline constexpr int kBaseYear = 1900; - typedef std::string String; +typedef std::string String; - inline String current_date() noexcept - { - auto time_data = time(nullptr); - auto time_struct = gmtime(&time_data); +inline String current_date() noexcept { + auto time_data = time(nullptr); + auto time_struct = gmtime(&time_data); - String fmt = std::to_string(kBaseYear + time_struct->tm_year); + String fmt = std::to_string(kBaseYear + time_struct->tm_year); - fmt += "-"; - fmt += std::to_string(time_struct->tm_mon + 1); - fmt += "-"; - fmt += std::to_string(time_struct->tm_mday); + fmt += "-"; + fmt += std::to_string(time_struct->tm_mon + 1); + fmt += "-"; + fmt += std::to_string(time_struct->tm_mday); - return fmt; - } + return fmt; +} - inline bool to_str(CharType* str, Int32 limit, Int32 base) noexcept - { - if (limit == 0) - return false; +inline bool to_str(CharType* str, Int32 limit, Int32 base) noexcept { + if (limit == 0) return false; - Int32 copy_limit = limit; - Int32 cnt = 0; - Int32 ret = base; + Int32 copy_limit = limit; + Int32 cnt = 0; + Int32 ret = base; - while (limit != 1) - { - ret = ret % 10; - str[cnt] = ret; + while (limit != 1) { + ret = ret % 10; + str[cnt] = ret; - ++cnt; - --limit; - --ret; - } + ++cnt; + --limit; + --ret; + } - str[copy_limit] = '\0'; - return true; - } + str[copy_limit] = '\0'; + return true; +} - using String = std::basic_string<CharType>; -} // namespace LibCompiler +using String = std::basic_string<CharType>; +} // namespace LibCompiler #define PACKED __attribute__((packed)) @@ -160,10 +154,8 @@ typedef char char_type; #define kObjectFileExt ".obj" #define kBinaryFileExt ".bin" -#define kAsmFileExts \ - { \ - ".64x", ".32x", ".masm", ".s", ".S", ".asm", ".x64" \ - } +#define kAsmFileExts \ + { ".64x", ".32x", ".masm", ".s", ".S", ".asm", ".x64" } #define kAsmFileExtsMax 7 @@ -171,6 +163,6 @@ typedef char char_type; #ifdef MSVC #pragma scalar_storage_order big - endian -#endif // ifdef MSVC +#endif // ifdef MSVC #endif /* ifndef __LIBCOMPILER_DEFINES_H__ */ |
