diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-27 17:24:21 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-27 17:24:21 +0100 |
| commit | b8f7ef086d1d1b1cd686fff04d0a587f8fd39d81 (patch) | |
| tree | b6c2eb3ca2c51dc87ddd81b6170d5f63eabb9090 /dev/user/Macros.h | |
| parent | eb86df50ec5afb392998e2e171de54e1f26d8e7a (diff) | |
add: new driver device kit API. (DDK)
refactor: rename SCIKit -> user (then libuser.dylib)
boot/modules/netboot: fixed compilation for amd64.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/user/Macros.h')
| -rw-r--r-- | dev/user/Macros.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/dev/user/Macros.h b/dev/user/Macros.h new file mode 100644 index 00000000..e2759258 --- /dev/null +++ b/dev/user/Macros.h @@ -0,0 +1,93 @@ +/* ------------------------------------------- + +Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. + +File: Macros.h +Purpose: libsci Macros header. + +------------------------------------------- */ + +#pragma once + +/***********************************************************************************/ +/// @file user/Macros.h +/// @brief Macros and Core types of the SCI (System Call Interface). +/***********************************************************************************/ + +#include <HintKit/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 SCI_COPY_DELETE(KLASS) \ + KLASS& operator=(const KLASS&) = delete; \ + KLASS(const KLASS&) = delete; + +#define SCI_COPY_DEFAULT(KLASS) \ + KLASS& operator=(const KLASS&) = default; \ + KLASS(const KLASS&) = default; + +#define SCI_MOVE_DELETE(KLASS) \ + KLASS& operator=(KLASS&&) = delete; \ + KLASS(KLASS&&) = delete; + +#define SCI_MOVE_DEFAULT(KLASS) \ + KLASS& operator=(KLASS&&) = default; \ + KLASS(KLASS&&) = default; + +#endif + +IMPORT_C void _rtl_assert(Bool expr, const Char* origin); + +#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
\ No newline at end of file |
