From 6da25650aa4bf87dcd5e3d612c615e0b8240015f Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 17 Sep 2021 09:54:50 +0200 Subject: Added namespace scopes to more includes for better consistency --- zencore/zencore.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'zencore/zencore.cpp') diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index f179880e4..5899f014d 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -28,6 +28,8 @@ #include #include +namespace zen { + bool IsPointerToStack(const void* ptr) { @@ -53,11 +55,11 @@ IsPointerToStack(const void* ptr) #endif } -zen::AssertException::AssertException(const char* Msg) : m_Msg(Msg) +AssertException::AssertException(const char* Msg) : m_Msg(Msg) { } -zen::AssertException::~AssertException() +AssertException::~AssertException() { } @@ -101,3 +103,5 @@ zencore_forcelinktests() zen::usonbuilder_forcelink(); zen::usonpackage_forcelink(); } + +} // namespace zen -- cgit v1.2.3 From 68897f04bd60624fb57d1bd5add4ca7aed1d5e50 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 17 Sep 2021 15:39:49 +0200 Subject: Added IsDebuggerPresent() query function to query whether a debugger is currently attached to the running process --- zencore/zencore.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'zencore/zencore.cpp') diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index 5899f014d..bb457ed0a 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -30,6 +30,8 @@ namespace zen { +////////////////////////////////////////////////////////////////////////// + bool IsPointerToStack(const void* ptr) { @@ -55,6 +57,18 @@ IsPointerToStack(const void* ptr) #endif } +bool +IsDebuggerPresent() +{ +#if ZEN_PLATFORM_WINDOWS + return ::IsDebuggerPresent(); +#else + return false; +#endif +} + +////////////////////////////////////////////////////////////////////////// + AssertException::AssertException(const char* Msg) : m_Msg(Msg) { } -- cgit v1.2.3 From feb3e97f486e474f0c5775a4c407ef6db540df49 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 17 Sep 2021 19:09:10 +0200 Subject: Assert improvements --- zencore/zencore.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'zencore/zencore.cpp') diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index bb457ed0a..d0b1135dc 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -69,16 +69,6 @@ IsDebuggerPresent() ////////////////////////////////////////////////////////////////////////// -AssertException::AssertException(const char* Msg) : m_Msg(Msg) -{ -} - -AssertException::~AssertException() -{ -} - -////////////////////////////////////////////////////////////////////////// - static int s_ApplicationExitCode = 0; static bool s_ApplicationExitRequested; -- cgit v1.2.3 From 91c305d98ab2a0482114c2d52d23ef787f08190d Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 17 Sep 2021 23:16:34 +0200 Subject: Added IsInteractiveSession() query to help identify if the process is running as a daemon or as an interactive process --- zencore/zencore.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'zencore/zencore.cpp') diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index d0b1135dc..122719d90 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -67,6 +67,23 @@ IsDebuggerPresent() #endif } +bool +IsInteractiveSession() +{ +#if ZEN_PLATFORM_WINDOWS + DWORD dwSessionId = 0; + if (ProcessIdToSessionId(GetCurrentProcessId(), &dwSessionId)) + { + return (dwSessionId != 0); + } + + return false; +#else + // TODO: figure out what makes sense here + return true; +#endif +} + ////////////////////////////////////////////////////////////////////////// static int s_ApplicationExitCode = 0; -- cgit v1.2.3 From 8d3024a7e09246e44bf6d9ea14a36e6b03032e85 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Mon, 20 Sep 2021 10:15:12 +0200 Subject: It's not possible to compile out tests Tests are now compiled in if `ZEN_WITH_TESTS=1`, and compiled out if not. Compiling tests out reduces the footprint of the resulting executables quite significantly. --- zencore/zencore.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'zencore/zencore.cpp') diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index 122719d90..185b191f4 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -102,6 +102,7 @@ RequestApplicationExit(int ExitCode) s_ApplicationExitRequested = true; } +#if ZEN_WITH_TESTS void zencore_forcelinktests() { @@ -124,5 +125,6 @@ zencore_forcelinktests() zen::usonbuilder_forcelink(); zen::usonpackage_forcelink(); } +#endif } // namespace zen -- cgit v1.2.3 From 782351959f697fca6b0804c134467b7d9c29da1a Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Mon, 20 Sep 2021 12:08:44 +0200 Subject: Moved more code into zen namespace, for consistency Also removed snapshot_manifest (remnants of vfs prototype) --- zencore/zencore.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'zencore/zencore.cpp') diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index 185b191f4..b025f5b5c 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -114,7 +113,6 @@ zencore_forcelinktests() zen::memory_forcelink(); zen::refcount_forcelink(); zen::sha1_forcelink(); - zen::snapshotmanifest_forcelink(); zen::stats_forcelink(); zen::stream_forcelink(); zen::string_forcelink(); -- cgit v1.2.3 From 853f6f371d5eae5692c9bae615aba8964a4781ed Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Mon, 20 Sep 2021 14:07:55 +0200 Subject: Added mpscqueue (for future use) --- zencore/zencore.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'zencore/zencore.cpp') diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index b025f5b5c..1ea8ceb37 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -111,6 +112,7 @@ zencore_forcelinktests() zen::intmath_forcelink(); zen::iobuffer_forcelink(); zen::memory_forcelink(); + zen::mpscqueue_forcelink(); zen::refcount_forcelink(); zen::sha1_forcelink(); zen::stats_forcelink(); -- cgit v1.2.3