summaryrefslogtreecommitdiffhomepage
path: root/Private/NewKit/RuntimeCheck.hpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 08:46:09 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-30 08:46:09 +0100
commitd7112cd6909640afd7609b3a142bc6ecf921ee25 (patch)
tree55033ad28d58d536c4b3bad715d8635f00773bfd /Private/NewKit/RuntimeCheck.hpp
parentf22e69b8837b84548f79e0b8ca7bef24605c6611 (diff)
Kernel: Breaking changes, see source code.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/NewKit/RuntimeCheck.hpp')
-rw-r--r--Private/NewKit/RuntimeCheck.hpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/Private/NewKit/RuntimeCheck.hpp b/Private/NewKit/RuntimeCheck.hpp
new file mode 100644
index 00000000..62cca2c1
--- /dev/null
+++ b/Private/NewKit/RuntimeCheck.hpp
@@ -0,0 +1,66 @@
+
+/*
+ * ========================================================
+ *
+ * HCore
+ * Copyright 2024 Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#pragma once
+
+#include <NewKit/Defines.hpp>
+
+namespace HCore
+{
+void runtime_check(bool bExpression, const char *file, const char *line);
+}
+
+#define MUST_PASS_COMPILER(EXPR, MSG) static_assert(EXPR, MSG)
+#define MUST_PASS(EXPR) HCore::runtime_check(EXPR, __FILE__, " %d -> ")
+#define assert(EXPR) MUST_PASS(EXPR, RUNTIME_CHECK_EXPRESSION)
+
+enum RUNTIME_CHECK
+{
+ RUNTIME_CHECK_FAILED = -1,
+ RUNTIME_CHECK_POINTER = 0,
+ RUNTIME_CHECK_EXPRESSION,
+ RUNTIME_CHECK_FILE,
+ RUNTIME_CHECK_IPC,
+ RUNTIME_CHECK_TLS,
+ RUNTIME_CHECK_LD,
+ RUNTIME_CHECK_HANDSHAKE,
+ RUNTIME_CHECK_ACPI,
+ RUNTIME_CHECK_INVALID_PRIVILEGE,
+ RUNTIME_CHECK_PROCESS,
+ RUNTIME_CHECK_BAD_BEHAVIOR,
+ RUNTIME_CHECK_COUNT,
+ RUNTIME_CHECK_BOOTSTRAP,
+};
+
+namespace HCore
+{
+class DumpManager final
+{
+ public:
+ static void Dump(void)
+ {
+ // TODO:
+ }
+};
+
+void ke_stop(const Int &id);
+} // namespace HCore
+
+#ifdef TRY
+#undef TRY
+#endif
+
+#define INIT(OBJ, TYPE, ...) TYPE OBJ = TYPE(__VA_ARGS__)
+
+#define TRY(FN) \
+ if (!FN()) \
+ { \
+ MUST_PASS(false); \
+ }