summaryrefslogtreecommitdiffhomepage
path: root/Private/NewKit/RuntimeCheck.hpp
diff options
context:
space:
mode:
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); \
+ }