blob: b349387f1c99a14e65c2f3c7a4c006638251c0dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/nekernel-org/nekernel
#ifndef SYSTEMKIT_MACROS_H
#define SYSTEMKIT_MACROS_H
/***********************************************************************************/
/// @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);
#endif
|