-
Notifications
You must be signed in to change notification settings - Fork 16
/
oodle2base.h
171 lines (134 loc) · 4.82 KB
/
oodle2base.h
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
//===================================================
// Oodle2 Base header
// (C) Copyright 1994-2024 Epic Games Tools LLC
//===================================================
#ifndef __OODLE2BASE_H_INCLUDED__
#define __OODLE2BASE_H_INCLUDED__
#ifndef OODLE2BASE_PUBLIC_HEADER
#define OODLE2BASE_PUBLIC_HEADER 1
#endif
#ifdef _MSC_VER
#pragma pack(push, Oodle, 8)
#pragma warning(push)
#pragma warning(disable : 4127) // conditional is constant
#endif
#ifndef OODLE_BASE_TYPES_H
#define OODLE_BASE_TYPES_H
#include <stdint.h>
#define OOCOPYRIGHT "Copyright (C) 1994-2024, Epic Games Tools LLC"
// Typedefs
typedef int8_t OO_S8;
typedef uint8_t OO_U8;
typedef int16_t OO_S16;
typedef uint16_t OO_U16;
typedef int32_t OO_S32;
typedef uint32_t OO_U32;
typedef int64_t OO_S64;
typedef uint64_t OO_U64;
typedef float OO_F32;
typedef double OO_F64;
typedef intptr_t OO_SINTa;
typedef uintptr_t OO_UINTa;
typedef int32_t OO_BOOL;
// Struct packing handling and inlining
#if defined(__GNUC__) || defined(__clang__)
#define OOSTRUCT struct __attribute__((__packed__))
#define OOINLINEFUNC inline
#elif defined(_MSC_VER)
// on VC++, we use pragmas for the struct packing
#define OOSTRUCT struct
#define OOINLINEFUNC __inline
#endif
// Linkage stuff
#if defined(_WIN32)
#define OOLINK __stdcall
#define OOEXPLINK __stdcall
#else
#define OOLINK
#define OOEXPLINK
#endif
// C++ name demangaling
#ifdef __cplusplus
#define OODEFFUNC extern "C"
#define OODEFSTART extern "C" {
#define OODEFEND }
#define OODEFAULT( val ) =val
#else
#define OODEFFUNC
#define OODEFSTART
#define OODEFEND
#define OODEFAULT( val )
#endif
// ========================================================
// Exported function declarations
#define OOEXPFUNC OODEFFUNC
//===========================================================================
// OO_STRING_JOIN joins strings in the preprocessor and works with LINESTRING
#define OO_STRING_JOIN(arg1, arg2) OO_STRING_JOIN_DELAY(arg1, arg2)
#define OO_STRING_JOIN_DELAY(arg1, arg2) OO_STRING_JOIN_IMMEDIATE(arg1, arg2)
#define OO_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1 ## arg2
//===========================================================================
// OO_NUMBERNAME is a macro to make a name unique, so that you can use it to declare
// variable names and they won't conflict with each other
// using __LINE__ is broken in MSVC with /ZI , but __COUNTER__ is an MSVC extension that works
#ifdef _MSC_VER
#define OO_NUMBERNAME(name) OO_STRING_JOIN(name,__COUNTER__)
#else
#define OO_NUMBERNAME(name) OO_STRING_JOIN(name,__LINE__)
#endif
//===================================================================
// simple compiler assert
// this happens at declaration time, so if it's inside a function in a C file, drop {} around it
#ifndef OO_COMPILER_ASSERT
#if (defined(__cplusplus) && __cplusplus >= 201103L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
#define OO_COMPILER_ASSERT(exp) static_assert(exp, "Assert " #exp)
#else
#if defined(__clang__)
#define OO_COMPILER_ASSERT_UNUSED __attribute__((unused)) // hides warnings when compiler_asserts are in a local scope
#else
#define OO_COMPILER_ASSERT_UNUSED
#endif
#define OO_COMPILER_ASSERT(exp) typedef char OO_NUMBERNAME(_dummy_array) [ (exp) ? 1 : -1 ] OO_COMPILER_ASSERT_UNUSED
#endif
#endif
#endif
// Oodle2 base header
#ifndef OODLE2_PUBLIC_CORE_DEFINES
#define OODLE2_PUBLIC_CORE_DEFINES 1
#define OOFUNC1 OOEXPFUNC
#define OOFUNC2 OOEXPLINK
#define OOFUNCSTART
#define OODLE_CALLBACK OOLINK
// Check build flags
#if defined(OODLE_BUILDING_LIB) || defined(OODLE_BUILDING_DLL)
#error Should not see OODLE_BUILDING set for users of oodle.h
#endif
#ifndef NULL
#define NULL (0)
#endif
// OODLE_MALLOC_MINIMUM_ALIGNMENT is 8 in 32-bit, 16 in 64-bit
#define OODLE_MALLOC_MINIMUM_ALIGNMENT ((OO_SINTa)(2*sizeof(void *)))
typedef void (OODLE_CALLBACK t_OodleFPVoidVoid)(void);
/* void-void callback func pointer
takes void, returns void
*/
typedef void (OODLE_CALLBACK t_OodleFPVoidVoidStar)(void *);
/* void-void-star callback func pointer
takes void pointer, returns void
*/
#define OODLE_JOB_MAX_DEPENDENCIES (4) /* Maximum number of dependencies Oodle will ever pass to a RunJob callback
*/
#define OODLE_JOB_NULL_HANDLE (0) /* Value 0 of Jobify handles is reserved to mean none
* Wait(OODLE_JOB_NULL_HANDLE) is a nop
* if RunJob returns OODLE_JOB_NULL_HANDLE it means the job
* was run synchronously and no wait is required
*/
#define t_fp_Oodle_Job t_OodleFPVoidVoidStar /* Job function pointer for Plugin Jobify system
takes void pointer returns void
*/
#endif // OODLE2_PUBLIC_CORE_DEFINES
#ifdef _MSC_VER
#pragma warning(pop)
#pragma pack(pop, Oodle)
#endif
#endif // __OODLE2BASE_H_INCLUDED__