blob: f179880e45e911c456620e8b0c4525dd3fe70fcc (
plain) (
blame)
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
|
// Copyright Epic Games, Inc. All Rights Reserved.
#include <zencore/zencore.h>
#if ZEN_PLATFORM_WINDOWS
# include <zencore/windows.h>
#endif
#if ZEN_PLATFORM_LINUX
# include <pthread.h>
#endif
#include <zencore/blake3.h>
#include <zencore/compactbinary.h>
#include <zencore/compactbinarybuilder.h>
#include <zencore/compactbinarypackage.h>
#include <zencore/compositebuffer.h>
#include <zencore/compress.h>
#include <zencore/iobuffer.h>
#include <zencore/memory.h>
#include <zencore/refcount.h>
#include <zencore/sha1.h>
#include <zencore/snapshot_manifest.h>
#include <zencore/stats.h>
#include <zencore/stream.h>
#include <zencore/string.h>
#include <zencore/thread.h>
#include <zencore/timer.h>
#include <zencore/uid.h>
bool
IsPointerToStack(const void* ptr)
{
#if ZEN_PLATFORM_WINDOWS
ULONG_PTR low, high;
GetCurrentThreadStackLimits(&low, &high);
const uintptr_t intPtr = reinterpret_cast<uintptr_t>(ptr);
return (intPtr - low) < (high - low);
#elif ZEN_PLATFORM_LINUX
pthread_t self = pthread_self();
pthread_attr_t attr;
pthread_getattr_np(self, &attr);
void* low;
size_t size;
pthread_attr_getstack(&attr, &low, &size);
return (uintptr_t(ptr) - uintptr_t(low)) < uintptr_t(size);
#elif 0
#endif
}
zen::AssertException::AssertException(const char* Msg) : m_Msg(Msg)
{
}
zen::AssertException::~AssertException()
{
}
//////////////////////////////////////////////////////////////////////////
static int s_ApplicationExitCode = 0;
static bool s_ApplicationExitRequested;
bool
IsApplicationExitRequested()
{
return s_ApplicationExitRequested;
}
void
RequestApplicationExit(int ExitCode)
{
s_ApplicationExitCode = ExitCode;
s_ApplicationExitRequested = true;
}
void
zencore_forcelinktests()
{
zen::blake3_forcelink();
zen::compositebuffer_forcelink();
zen::compress_forcelink();
zen::intmath_forcelink();
zen::iobuffer_forcelink();
zen::memory_forcelink();
zen::refcount_forcelink();
zen::sha1_forcelink();
zen::snapshotmanifest_forcelink();
zen::stats_forcelink();
zen::stream_forcelink();
zen::string_forcelink();
zen::thread_forcelink();
zen::timer_forcelink();
zen::uid_forcelink();
zen::uson_forcelink();
zen::usonbuilder_forcelink();
zen::usonpackage_forcelink();
}
|