summaryrefslogtreecommitdiffhomepage
path: root/Private/CompilerKit/Defines.hpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 13:25:42 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 13:26:33 +0100
commitbe73d82eff113e6a6723d6fb4bd80f56f0ef88ef (patch)
tree93425f2d183c3ea7e5e1b50374ee6548c383ab78 /Private/CompilerKit/Defines.hpp
parent7c8afc0e15e54ae9e0f1a393bb52eed804d34edc (diff)
Compiler: Breaking changes, will work on C++ compiler from now on.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/CompilerKit/Defines.hpp')
-rw-r--r--Private/CompilerKit/Defines.hpp128
1 files changed, 59 insertions, 69 deletions
diff --git a/Private/CompilerKit/Defines.hpp b/Private/CompilerKit/Defines.hpp
index 568e024..42c7d2a 100644
--- a/Private/CompilerKit/Defines.hpp
+++ b/Private/CompilerKit/Defines.hpp
@@ -12,17 +12,17 @@
#ifndef Yes
#define Yes true
-#endif // ifndef Yes
+#endif // ifndef Yes
#ifndef No
#define No false
-#endif // ifndef No
+#endif // ifndef No
#include <stdint.h>
#define SizeType size_t
-#define VoidPtr void*
+#define VoidPtr void *
#define voidPtr VoidPtr
#define UIntPtr uintptr_t
@@ -44,103 +44,93 @@
#define CharType char
#define Boolean bool
-#include <new>
-#include <cstring>
#include <cassert>
+#include <cstring>
+#include <new>
#define nullPtr std::nullptr_t
#define MUST_PASS(E) assert(E)
#ifndef __FORCE_STRLEN
-# define __FORCE_STRLEN 1
+#define __FORCE_STRLEN 1
-# define string_length(len) strlen(len)
+#define string_length(len) strlen(len)
#endif
#ifndef __FORCE_MEMCPY
-# define __FORCE_MEMCPY 1
+#define __FORCE_MEMCPY 1
-# define rt_copy_memory(dst, src, len) memcpy(dst, src, len)
+#define rt_copy_memory(dst, src, len) memcpy(dst, src, len)
#endif
-#define CXXKIT_COPY_DELETE(KLASS) \
- KLASS &operator=(const KLASS &) = delete; \
- KLASS(const KLASS &) = delete;
+#define CXXKIT_COPY_DELETE(KLASS) \
+ KLASS &operator=(const KLASS &) = delete; \
+ KLASS(const KLASS &) = delete;
+#define CXXKIT_COPY_DEFAULT(KLASS) \
+ KLASS &operator=(const KLASS &) = default; \
+ KLASS(const KLASS &) = default;
-#define CXXKIT_COPY_DEFAULT(KLASS) \
- KLASS &operator=(const KLASS &) = default; \
- KLASS(const KLASS &) = default;
+#define CXXKIT_MOVE_DELETE(KLASS) \
+ KLASS &operator=(KLASS &&) = delete; \
+ KLASS(KLASS &&) = delete;
+#define CXXKIT_MOVE_DEFAULT(KLASS) \
+ KLASS &operator=(KLASS &&) = default; \
+ KLASS(KLASS &&) = default;
-#define CXXKIT_MOVE_DELETE(KLASS) \
- KLASS &operator=(KLASS &&) = delete; \
- KLASS(KLASS &&) = delete;
+#include <ctime>
+#include <fstream>
+#include <string>
+namespace CompilerKit {
+inline constexpr int BASE_YEAR = 1900;
-#define CXXKIT_MOVE_DEFAULT(KLASS) \
- KLASS &operator=(KLASS &&) = default; \
- KLASS(KLASS &&) = default;
+inline std::string current_date() {
+ auto time_data = time(nullptr);
+ auto time_struct = gmtime(&time_data);
+ std::string fmt = std::to_string(BASE_YEAR + time_struct->tm_year);
+ fmt += "-";
+ fmt += std::to_string(time_struct->tm_mon + 1);
+ fmt += "-";
+ fmt += std::to_string(time_struct->tm_mday);
+ return fmt;
+}
-#include <ctime>
-#include <string>
-#include <fstream>
+inline bool to_str(CharType *str, Int32 limit, Int32 base) {
+ if (limit == 0) return false;
+
+ Int32 copy_limit = limit;
+ Int32 cnt = 0;
+ Int32 ret = base;
-namespace CompilerKit
-{
- inline constexpr int BASE_YEAR = 1900;
-
- inline std::string current_date()
- {
- auto time_data = time(nullptr);
- auto time_struct = gmtime(&time_data);
-
- std::string fmt = std::to_string(BASE_YEAR + time_struct->tm_year);
- fmt += "-";
- fmt += std::to_string(time_struct->tm_mon + 1);
- fmt += "-";
- fmt += std::to_string(time_struct->tm_mday);
-
- return fmt;
- }
-
- inline bool to_str(CharType *str, Int32 limit, Int32 base)
- {
- if (limit == 0)
- return false;
-
- Int32 copy_limit = limit;
- Int32 cnt = 0;
- Int32 ret = base;
-
- while (limit != 1)
- {
- ret = ret % 10;
- str[cnt] = ret;
-
- ++cnt;
- --limit;
- --ret;
- }
-
- str[copy_limit] = '\0';
- return true;
- }
+ while (limit != 1) {
+ ret = ret % 10;
+ str[cnt] = ret;
+
+ ++cnt;
+ --limit;
+ --ret;
+ }
+
+ str[copy_limit] = '\0';
+ return true;
}
+} // namespace CompilerKit
typedef char char_type;
-#define kObjectFileExt ".o"
-#define kAsmFileExts { ".64x", ".32x", ".masm", ".s", ".S" }
+#define kObjectFileExt ".o"
+#define kAsmFileExts \
+ { ".64x", ".32x", ".masm", ".s", ".S" }
#ifdef __MODULE_NEED__
-# define MPCC_MODULE(name) int name(int argc, char** argv)
+#define MPCC_MODULE(name) int name(int argc, char **argv)
#else
-# define MPCC_MODULE(name) int main(int argc, char** argv)
+#define MPCC_MODULE(name) int main(int argc, char **argv)
#endif /* ifdef __MODULE_NEED__ */
#endif /* ifndef __CXXKIT_DEFINES_HPP__ */
-