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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
/* -------------------------------------------
Copyright Mahrouss Logic
------------------------------------------- */
#pragma once
#ifdef CA_MUST_PASS
#undef CA_MUST_PASS
#endif
#ifdef _DEBUG
#define CA_MUST_PASS(e) { if (!e) { DlgMsgBox("Sorry, an assertion failed.\nFile: %s\nLine: %i", __FILE__, __LINE__) __assert_chk_fail() } }
#else
#define CA_MUST_PASS(e) CA_UNREFERENCED_PARAMETER(e)
#endif
#ifdef __cplusplus
#define CA_EXTERN_C extern "C"
#else
#define CA_EXTERN_C extern
#endif
CA_EXTERN_C void __assert_chk_fail(void);
#define CA_STDCALL __attribute__((stdcall))
#define CA_CDECL __attribute__((cdecl))
#define CA_MSCALL __attribute__((ms_abi))
#define PACKED __attribute__((packed))
#define CA_PASCAL CA_STDCALL
typedef __UINT8_TYPE__ ByteType;
typedef __UINT16_TYPE__ WordType;
typedef __UINT32_TYPE__ DWordType;
typedef __UINT64_TYPE__ QWordType;
typedef __SIZE_TYPE__ SizeType;
typedef char CharacterTypeUTF8;
typedef CharacterTypeUTF8* PtrCharacterType;
typedef void* PtrVoidType;
typedef void VoidType;
typedef __UINTPTR_TYPE__ UIntPtrType;
typedef __INTPTR_TYPE__ IntPtrType;
typedef __UINT64_TYPE__ UInt64Type;
typedef __INT64_TYPE__ Int64Type;
typedef __UINT32_TYPE__ UInt32Type;
typedef __INT32_TYPE__ Int32Type;
typedef CharacterTypeUTF8 BooleanType;
#define CA_COPY_DELETE(KLASS) \
KLASS &operator=(const KLASS &) = delete; \
KLASS(const KLASS &) = delete;
#define CA_COPY_DEFAULT(KLASS) \
KLASS &operator=(const KLASS &) = default; \
KLASS(const KLASS &) = default;
#define CA_MOVE_DELETE(KLASS) \
KLASS &operator=(KLASS &&) = delete; \
KLASS(KLASS &&) = delete;
#define CA_MOVE_DEFAULT(KLASS) \
KLASS &operator=(KLASS &&) = default; \
KLASS(KLASS &&) = default;
#define Yes 1
#define No 0
#define CA_PTR *
#define CA_UNREFERENCED_PARAMETER(e) ((VoidType)(e))
#ifdef __x86_64__
# define CA_FAR __far
# define CA_NEAR __near
# define _M_AMD64 2
#else
# define CA_FAR
# define CA_NEAR
#endif
#ifdef __aarch64__
# define _M_AARCH64 3
#endif
#ifdef __powerpc64__
# define _M_PPC64 4
#endif
#ifdef __64x0__
# define _M_64000 5
#endif
#ifdef __riscv__
# define _M_RISCV 6
#endif
#define CA_STATIC static
#define CA_INLINE inline
#define CA_CONST const
#ifdef __cplusplus
#define CA_CONSTEXPR constexpr
#else
#define CA_CONSTEXPR
#endif // __cplusplus
enum RtProcessCall {
kCallAllocPtr = 1,
kCallFreePtr,
kCallSizePtr,
kCallCheckPtr,
kCallAllocStack,
/// @brief Open a specific handle (can be used as sel to call methods related to it.)
kCallOpenFile,
kCallCloseFile,
kCallCreateWindow,
kCallCloseWindow,
kCallCreateMenu,
kCallCloseMenu,
kCallGetArgsCount,
kCallGetArgsPtr,
/// @brief Number of process calls.
kCallsCount,
};
#include <System.Core/Headers/Hint.h>
#include <System.Core/Headers/Dialog.h>
#define kObjectGlobalNamespace ":\\"
enum {
kObjectTypeGeneric,
kObjectTypeFile,
kObjectTypeDevice,
kObjectTypeNetwork,
kObjectTypeInvalid,
kObjectTypeCount = 5,
};
/**
* @brief GUID type, something you can also find in CFKit.
* @author Amlal El Mahrouss
*/
typedef struct GUID {
DWordType Data1;
WordType Data2;
WordType Data3;
ByteType Data4[8];
} GUIDType, *PtrGUIDType;
/// \brief Object handle.
/// \author Amlal El Mahrouss
typedef struct Object {
CharacterTypeUTF8 Name[255];
DWordType Kind;
DWordType Flags;
VoidType(*Release)(struct Object* Self);
IntPtrType(*Invoke)(struct Object* Self, DWordType Sel, ...);
VoidType(*Query)(struct Object* Self, PtrVoidType* Dst, SizeType SzDst, struct GUID* GuidOf);
} *ObjectRef;
#ifdef __cplusplus
#define object_cast reinterpret_cast<ObjectRef>
template <SizeType N>
using StrType = CharacterTypeUTF8[N];
#else
#define object_cast (ObjectRef)
#endif // ifdef C++
CA_EXTERN_C ObjectRef RtGetAppObject(VoidType);
CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType);
CA_EXTERN_C CharacterTypeUTF8* RtGetAppArgumentsPtr(VoidType);
CA_EXTERN_C ObjectRef kApplicationObject;
typedef CharacterTypeUTF8 Str255Type[255];
#define True 1
#define False 0
#define Bool BooleanType
#define NULL ((PtrVoidType)0)
|