diff options
| author | Stefan Boberg <[email protected]> | 2023-05-02 10:01:47 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-02 10:01:47 +0200 |
| commit | 075d17f8ada47e990fe94606c3d21df409223465 (patch) | |
| tree | e50549b766a2f3c354798a54ff73404217b4c9af /zencore/zencore.cpp | |
| parent | fix: bundle shouldn't append content zip to zen (diff) | |
| download | zen-075d17f8ada47e990fe94606c3d21df409223465.tar.xz zen-075d17f8ada47e990fe94606c3d21df409223465.zip | |
moved source directories into `/src` (#264)
* moved source directories into `/src`
* updated bundle.lua for new `src` path
* moved some docs, icon
* removed old test trees
Diffstat (limited to 'zencore/zencore.cpp')
| -rw-r--r-- | zencore/zencore.cpp | 175 |
1 files changed, 0 insertions, 175 deletions
diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp deleted file mode 100644 index 2a7c5755e..000000000 --- a/zencore/zencore.cpp +++ /dev/null @@ -1,175 +0,0 @@ -// 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/crypto.h> -#include <zencore/filesystem.h> -#include <zencore/intmath.h> -#include <zencore/iobuffer.h> -#include <zencore/memory.h> -#include <zencore/mpscqueue.h> -#include <zencore/refcount.h> -#include <zencore/sha1.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> - -namespace zen { - -AssertImpl AssertImpl::DefaultAssertImpl; -AssertImpl* AssertImpl::CurrentAssertImpl = &AssertImpl::DefaultAssertImpl; - -////////////////////////////////////////////////////////////////////////// - -bool -IsDebuggerPresent() -{ -#if ZEN_PLATFORM_WINDOWS - return ::IsDebuggerPresent(); -#else - return false; -#endif -} - -std::optional<bool> InteractiveSessionFlag; - -void -SetIsInteractiveSession(bool Value) -{ - InteractiveSessionFlag = Value; -} - -bool -IsInteractiveSession() -{ - if (!InteractiveSessionFlag.has_value()) - { -#if ZEN_PLATFORM_WINDOWS - DWORD dwSessionId = 0; - if (ProcessIdToSessionId(GetCurrentProcessId(), &dwSessionId)) - { - InteractiveSessionFlag = (dwSessionId != 0); - } - else - { - InteractiveSessionFlag = false; - } -#else - // TODO: figure out what actually makes sense here - InteractiveSessionFlag = true; -#endif - } - - return InteractiveSessionFlag.value(); -} - -////////////////////////////////////////////////////////////////////////// - -static int s_ApplicationExitCode = 0; -static bool s_ApplicationExitRequested; - -bool -IsApplicationExitRequested() -{ - return s_ApplicationExitRequested; -} - -void -RequestApplicationExit(int ExitCode) -{ - s_ApplicationExitCode = ExitCode; - s_ApplicationExitRequested = true; -} - -#if ZEN_WITH_TESTS -void -zencore_forcelinktests() -{ - zen::blake3_forcelink(); - zen::compositebuffer_forcelink(); - zen::compress_forcelink(); - zen::filesystem_forcelink(); - zen::intmath_forcelink(); - zen::iobuffer_forcelink(); - zen::memory_forcelink(); - zen::mpscqueue_forcelink(); - zen::refcount_forcelink(); - zen::sha1_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(); - zen::crypto_forcelink(); -} -} // namespace zen - -# include <zencore/testing.h> - -namespace zen { - -TEST_CASE("Assert.Default") -{ - bool A = true; - bool B = false; - CHECK_THROWS_WITH(ZEN_ASSERT(A == B), "A == B"); -} - -TEST_CASE("Assert.Custom") -{ - struct MyAssertImpl : AssertImpl - { - ZEN_FORCENOINLINE ZEN_DEBUG_SECTION MyAssertImpl() : PrevAssertImpl(CurrentAssertImpl) { CurrentAssertImpl = this; } - virtual ZEN_FORCENOINLINE ZEN_DEBUG_SECTION ~MyAssertImpl() { CurrentAssertImpl = PrevAssertImpl; } - virtual void ZEN_FORCENOINLINE ZEN_DEBUG_SECTION OnAssert(const char* Filename, - int LineNumber, - const char* FunctionName, - const char* Msg) - { - AssertFileName = Filename; - Line = LineNumber; - FuncName = FunctionName; - Message = Msg; - } - AssertImpl* PrevAssertImpl; - - const char* AssertFileName = nullptr; - int Line = -1; - const char* FuncName = nullptr; - const char* Message = nullptr; - }; - - MyAssertImpl MyAssert; - bool A = true; - bool B = false; - CHECK_THROWS_WITH(ZEN_ASSERT(A == B), "A == B"); - CHECK(MyAssert.AssertFileName != nullptr); - CHECK(MyAssert.Line != -1); - CHECK(MyAssert.FuncName != nullptr); - CHECK(strcmp(MyAssert.Message, "A == B") == 0); -} - -#endif - -} // namespace zen |