Kore
Loading...
Searching...
No Matches
global.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <stdbool.h>
8#include <stdint.h>
9
10#if defined(KINC_PPC)
11#define KINC_BIG_ENDIAN
12#else
13#define KINC_LITTLE_ENDIAN
14#endif
15
16#if defined(KINC_PPC)
17#define KINC_BIG_ENDIAN
18#else
19#define KINC_LITTLE_ENDIAN
20#endif
21
22#ifdef _MSC_VER
23#define KINC_INLINE static __forceinline
24#else
25#define KINC_INLINE static __attribute__((always_inline)) inline
26#endif
27
28#ifdef _MSC_VER
29#define KINC_MICROSOFT
30#define KINC_MICROSOFT
31#endif
32
33#if defined(_WIN32)
34
35#if defined(KINC_WINDOWSAPP)
36
37#define KINC_WINDOWSAPP
38
39#else
40
41#ifndef KINC_CONSOLE
42#define KINC_WINDOWS
43#endif
44
45#endif
46
47#elif defined(__APPLE__)
48
49#include <TargetConditionals.h>
50
51#if TARGET_OS_IPHONE
52
53#if !defined(KINC_TVOS)
54#define KINC_IOS
55#endif
56
57#define KINC_APPLE_SOC
58
59#else
60
61#define KINC_MACOS
62
63#if defined(__arm64__)
64#define KINC_APPLE_SOC
65#endif
66
67#endif
68
69#define KINC_POSIX
70
71#elif defined(__linux__)
72
73#if !defined(KINC_ANDROID)
74#define KINC_LINUX
75#endif
76
77#define KINC_POSIX
78
79#endif
80
81#ifdef KINC_WINDOWS
82#if defined(KINC_DYNAMIC)
83#define KINC_FUNC __declspec(dllimport)
84#elif defined(KINC_DYNAMIC_COMPILE)
85#define KINC_FUNC __declspec(dllexport)
86#else
87#define KINC_FUNC
88#endif
89#else
90#define KINC_FUNC
91#endif
92
93#if defined(__LP64__) || defined(_LP64) || defined(_WIN64)
94#define KINC_64
95#endif
96
97#ifdef __cplusplus
98
99namespace Kore {
100 typedef unsigned char u8; // 1 Byte
101 typedef unsigned short u16; // 2 Byte
102 typedef unsigned int u32; // 4 Byte
103
104#ifdef KINC_WINDOWS
105 typedef unsigned __int64 u64; // 8 Byte
106#else
107 typedef unsigned long long u64;
108#endif
109 typedef char s8; // 1 Byte
110 typedef short s16; // 2 Byte
111 typedef int s32; // 4 Byte
112#ifdef KINC_WINDOWS
113 typedef __int64 s64; // 8 Byte
114#else
115 typedef long long s64;
116#endif
117
118 typedef u32 uint; // 4 Byte
119 typedef s32 sint; // 4 Byte
120
121#ifdef KINC_64
122 typedef s64 spint;
123 typedef u64 upint;
124#else
125 typedef s32 spint;
126 typedef u32 upint;
127#endif
128}
129
130// pseudo C++11
131#if !defined(_MSC_VER) && __cplusplus <= 199711L
132#define nullptr 0
133#define override
134#endif
135
136#define Noexcept throw()
137
138#endif
139
140#ifdef __cplusplus
141extern "C" {
142#endif
143int kickstart(int argc, char **argv);
144#ifdef __cplusplus
145}
146#endif