summaryrefslogtreecommitdiffhomepage
path: root/dev/libSystem/SystemKit/Macros.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-30 14:42:35 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-05-30 14:42:35 +0200
commit86b89793dcaf290206faeb7fe3100dd0a5f71d1d (patch)
tree7ebb5128173f7b48b1e8629f6be031e62b6a5427 /dev/libSystem/SystemKit/Macros.h
parent0e92d4841f0d1b6a5f2e1b093d9d0b6864dfac93 (diff)
global: architectural changes, see commit details.
refactor: Refactor libSystem, user frameworks, and preparing for OpenMSG. feat: Jail info client structure (libSystem) feat: Document what the RTime is doing starting from line 504. feat: use `int 50` instead of `syscall` for now. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/libSystem/SystemKit/Macros.h')
-rw-r--r--dev/libSystem/SystemKit/Macros.h126
1 files changed, 126 insertions, 0 deletions
diff --git a/dev/libSystem/SystemKit/Macros.h b/dev/libSystem/SystemKit/Macros.h
new file mode 100644
index 00000000..48c586cc
--- /dev/null
+++ b/dev/libSystem/SystemKit/Macros.h
@@ -0,0 +1,126 @@
+/* -------------------------------------------
+
+Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+
+File: Macros.h
+Purpose: libsci Macros header.
+
+------------------------------------------- */
+
+#pragma once
+
+/***********************************************************************************/
+/// @file libSystem/Macros.h
+/// @brief Macros and Core types of the SCI (System Call Interface).
+/***********************************************************************************/
+
+#include <hint/CompilerHint.h>
+
+#define ATTRIBUTE(X) __attribute__((X))
+
+#define IMPORT_CXX extern "C++"
+#define IMPORT_C extern "C"
+
+#define DEPRECATED ATTRIBUTE(deprecated)
+
+#define EXIT_SUCCESS (0)
+#define EXIT_FAILURE (1)
+
+#define FILE_MAX_LEN (256)
+
+#ifndef BOOL
+#define BOOL bool
+#endif
+
+typedef bool Bool;
+typedef bool Boolean;
+typedef void Void;
+
+#ifndef __cplusplus
+#define true (1)
+#define false (0)
+#endif
+
+#define YES true
+#define NO false
+
+typedef __UINT64_TYPE__ UInt64;
+typedef __UINT32_TYPE__ UInt32;
+typedef __UINT16_TYPE__ UInt16;
+typedef __UINT8_TYPE__ UInt8;
+
+typedef __SIZE_TYPE__ SizeT;
+
+typedef __INT64_TYPE__ SInt64;
+typedef __INT32_TYPE__ SInt32;
+typedef __INT16_TYPE__ SInt16;
+typedef __INT8_TYPE__ SInt8;
+
+typedef void* VoidPtr;
+typedef __UINTPTR_TYPE__ UIntPtr;
+typedef char Char;
+
+#ifdef __cplusplus
+typedef decltype(nullptr) nullPtr;
+typedef nullPtr NullPtr;
+
+#define LIBSYS_COPY_DELETE(KLASS) \
+ KLASS& operator=(const KLASS&) = delete; \
+ KLASS(const KLASS&) = delete;
+
+#define LIBSYS_COPY_DEFAULT(KLASS) \
+ KLASS& operator=(const KLASS&) = default; \
+ KLASS(const KLASS&) = default;
+
+#define LIBSYS_MOVE_DELETE(KLASS) \
+ KLASS& operator=(KLASS&&) = delete; \
+ KLASS(KLASS&&) = delete;
+
+#define LIBSYS_MOVE_DEFAULT(KLASS) \
+ KLASS& operator=(KLASS&&) = default; \
+ KLASS(KLASS&&) = default;
+
+#endif
+
+#define MUST_PASS(X) _rtl_assert(X, __FILE__)
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(X) \
+ (((sizeof(X) / sizeof(*(X))) / (static_cast<SizeT>(!(sizeof(X) % sizeof(*(X)))))))
+#endif
+
+#ifndef KIB
+#define KIB(X) (UInt64)((X) / 1024)
+#endif
+
+#ifndef kib_cast
+#define kib_cast(X) (UInt64)((X) *1024)
+#endif
+
+#ifndef MIB
+#define MIB(X) (UInt64)((UInt64) KIB(X) / 1024)
+#endif
+
+#ifndef mib_cast
+#define mib_cast(X) (UInt64)((UInt64) kib_cast(X) * 1024)
+#endif
+
+#ifndef GIB
+#define GIB(X) (UInt64)((UInt64) MIB(X) / 1024)
+#endif
+
+#ifndef gib_cast
+#define gib_cast(X) (UInt64)((UInt64) mib_cast(X) * 1024)
+#endif
+
+#ifndef TIB
+#define TIB(X) (UInt64)((UInt64) GIB(X) / 1024)
+#endif
+
+#ifndef tib_cast
+#define tib_cast(X) ((UInt64) gib_cast(X) * 1024)
+#endif
+
+#define LIBSYS_UNUSED(X) ((void) X)
+
+IMPORT_C void _rtl_assert(Bool expr, const Char* origin);