|
| 1 | + |
| 2 | +//=================================================== |
| 3 | +// Oodle2 Base header |
| 4 | +// (C) Copyright 1994-2024 Epic Games Tools LLC |
| 5 | +//=================================================== |
| 6 | + |
| 7 | +#ifndef __OODLE2BASE_H_INCLUDED__ |
| 8 | +#define __OODLE2BASE_H_INCLUDED__ |
| 9 | + |
| 10 | +#ifndef OODLE2BASE_PUBLIC_HEADER |
| 11 | +#define OODLE2BASE_PUBLIC_HEADER 1 |
| 12 | +#endif |
| 13 | + |
| 14 | +#ifdef _MSC_VER |
| 15 | +#pragma pack(push, Oodle, 8) |
| 16 | + |
| 17 | +#pragma warning(push) |
| 18 | +#pragma warning(disable : 4127) // conditional is constant |
| 19 | +#endif |
| 20 | + |
| 21 | +#ifndef OODLE_BASE_TYPES_H |
| 22 | +#define OODLE_BASE_TYPES_H |
| 23 | + |
| 24 | +#include <stdint.h> |
| 25 | + |
| 26 | +#define OOCOPYRIGHT "Copyright (C) 1994-2024, Epic Games Tools LLC" |
| 27 | + |
| 28 | +// Typedefs |
| 29 | +typedef int8_t OO_S8; |
| 30 | +typedef uint8_t OO_U8; |
| 31 | +typedef int16_t OO_S16; |
| 32 | +typedef uint16_t OO_U16; |
| 33 | +typedef int32_t OO_S32; |
| 34 | +typedef uint32_t OO_U32; |
| 35 | +typedef int64_t OO_S64; |
| 36 | +typedef uint64_t OO_U64; |
| 37 | +typedef float OO_F32; |
| 38 | +typedef double OO_F64; |
| 39 | +typedef intptr_t OO_SINTa; |
| 40 | +typedef uintptr_t OO_UINTa; |
| 41 | +typedef int32_t OO_BOOL; |
| 42 | + |
| 43 | +// Struct packing handling and inlining |
| 44 | +#if defined(__GNUC__) || defined(__clang__) |
| 45 | + #define OOSTRUCT struct __attribute__((__packed__)) |
| 46 | + #define OOINLINEFUNC inline |
| 47 | +#elif defined(_MSC_VER) |
| 48 | + // on VC++, we use pragmas for the struct packing |
| 49 | + #define OOSTRUCT struct |
| 50 | + #define OOINLINEFUNC __inline |
| 51 | +#endif |
| 52 | + |
| 53 | +// Linkage stuff |
| 54 | +#if defined(_WIN32) |
| 55 | + #define OOLINK __stdcall |
| 56 | + #define OOEXPLINK __stdcall |
| 57 | +#else |
| 58 | + #define OOLINK |
| 59 | + #define OOEXPLINK |
| 60 | +#endif |
| 61 | + |
| 62 | +// C++ name demangaling |
| 63 | +#ifdef __cplusplus |
| 64 | + #define OODEFFUNC extern "C" |
| 65 | + #define OODEFSTART extern "C" { |
| 66 | + #define OODEFEND } |
| 67 | + #define OODEFAULT( val ) =val |
| 68 | +#else |
| 69 | + #define OODEFFUNC |
| 70 | + #define OODEFSTART |
| 71 | + #define OODEFEND |
| 72 | + #define OODEFAULT( val ) |
| 73 | +#endif |
| 74 | + |
| 75 | +// ======================================================== |
| 76 | +// Exported function declarations |
| 77 | +#define OOEXPFUNC OODEFFUNC |
| 78 | + |
| 79 | +//=========================================================================== |
| 80 | +// OO_STRING_JOIN joins strings in the preprocessor and works with LINESTRING |
| 81 | +#define OO_STRING_JOIN(arg1, arg2) OO_STRING_JOIN_DELAY(arg1, arg2) |
| 82 | +#define OO_STRING_JOIN_DELAY(arg1, arg2) OO_STRING_JOIN_IMMEDIATE(arg1, arg2) |
| 83 | +#define OO_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1 ## arg2 |
| 84 | + |
| 85 | +//=========================================================================== |
| 86 | +// OO_NUMBERNAME is a macro to make a name unique, so that you can use it to declare |
| 87 | +// variable names and they won't conflict with each other |
| 88 | +// using __LINE__ is broken in MSVC with /ZI , but __COUNTER__ is an MSVC extension that works |
| 89 | + |
| 90 | +#ifdef _MSC_VER |
| 91 | + #define OO_NUMBERNAME(name) OO_STRING_JOIN(name,__COUNTER__) |
| 92 | +#else |
| 93 | + #define OO_NUMBERNAME(name) OO_STRING_JOIN(name,__LINE__) |
| 94 | +#endif |
| 95 | + |
| 96 | +//=================================================================== |
| 97 | +// simple compiler assert |
| 98 | +// this happens at declaration time, so if it's inside a function in a C file, drop {} around it |
| 99 | +#ifndef OO_COMPILER_ASSERT |
| 100 | + #if (defined(__cplusplus) && __cplusplus >= 201103L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) |
| 101 | + #define OO_COMPILER_ASSERT(exp) static_assert(exp, "Assert " #exp) |
| 102 | + #else |
| 103 | + #if defined(__clang__) |
| 104 | + #define OO_COMPILER_ASSERT_UNUSED __attribute__((unused)) // hides warnings when compiler_asserts are in a local scope |
| 105 | + #else |
| 106 | + #define OO_COMPILER_ASSERT_UNUSED |
| 107 | + #endif |
| 108 | + |
| 109 | + #define OO_COMPILER_ASSERT(exp) typedef char OO_NUMBERNAME(_dummy_array) [ (exp) ? 1 : -1 ] OO_COMPILER_ASSERT_UNUSED |
| 110 | + #endif |
| 111 | +#endif |
| 112 | + |
| 113 | + |
| 114 | +#endif |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | +// Oodle2 base header |
| 119 | + |
| 120 | +#ifndef OODLE2_PUBLIC_CORE_DEFINES |
| 121 | +#define OODLE2_PUBLIC_CORE_DEFINES 1 |
| 122 | + |
| 123 | +#define OOFUNC1 OOEXPFUNC |
| 124 | +#define OOFUNC2 OOEXPLINK |
| 125 | +#define OOFUNCSTART |
| 126 | +#define OODLE_CALLBACK OOLINK |
| 127 | + |
| 128 | +// Check build flags |
| 129 | + #if defined(OODLE_BUILDING_LIB) || defined(OODLE_BUILDING_DLL) |
| 130 | + #error Should not see OODLE_BUILDING set for users of oodle.h |
| 131 | + #endif |
| 132 | + |
| 133 | +#ifndef NULL |
| 134 | +#define NULL (0) |
| 135 | +#endif |
| 136 | + |
| 137 | +// OODLE_MALLOC_MINIMUM_ALIGNMENT is 8 in 32-bit, 16 in 64-bit |
| 138 | +#define OODLE_MALLOC_MINIMUM_ALIGNMENT ((OO_SINTa)(2*sizeof(void *))) |
| 139 | + |
| 140 | +typedef void (OODLE_CALLBACK t_OodleFPVoidVoid)(void); |
| 141 | +/* void-void callback func pointer |
| 142 | + takes void, returns void |
| 143 | +*/ |
| 144 | + |
| 145 | +typedef void (OODLE_CALLBACK t_OodleFPVoidVoidStar)(void *); |
| 146 | +/* void-void-star callback func pointer |
| 147 | + takes void pointer, returns void |
| 148 | +*/ |
| 149 | + |
| 150 | +#define OODLE_JOB_MAX_DEPENDENCIES (4) /* Maximum number of dependencies Oodle will ever pass to a RunJob callback |
| 151 | +*/ |
| 152 | + |
| 153 | +#define OODLE_JOB_NULL_HANDLE (0) /* Value 0 of Jobify handles is reserved to mean none |
| 154 | +* Wait(OODLE_JOB_NULL_HANDLE) is a nop |
| 155 | +* if RunJob returns OODLE_JOB_NULL_HANDLE it means the job |
| 156 | +* was run synchronously and no wait is required |
| 157 | +*/ |
| 158 | + |
| 159 | +#define t_fp_Oodle_Job t_OodleFPVoidVoidStar /* Job function pointer for Plugin Jobify system |
| 160 | +
|
| 161 | + takes void pointer returns void |
| 162 | +*/ |
| 163 | + |
| 164 | +#endif // OODLE2_PUBLIC_CORE_DEFINES |
| 165 | + |
| 166 | +#ifdef _MSC_VER |
| 167 | +#pragma warning(pop) |
| 168 | +#pragma pack(pop, Oodle) |
| 169 | +#endif |
| 170 | + |
| 171 | +#endif // __OODLE2BASE_H_INCLUDED__ |
0 commit comments