From 0d757e1dcf3cf1518ae2fce9e8864dcc55d14d3a Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Mon, 28 Oct 2024 18:13:13 +0100 Subject: Renamed debugspew.h → debugspew.hpp, lindafactory.h → lindafactory.hpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cancel.cpp | 2 +- src/debugspew.h | 60 ------------------------------------------------ src/debugspew.hpp | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ src/intercopycontext.cpp | 2 +- src/lane.cpp | 2 +- src/linda.cpp | 2 +- src/lindafactory.cpp | 2 +- src/lindafactory.h | 26 --------------------- src/lindafactory.hpp | 26 +++++++++++++++++++++ src/state.h | 2 +- src/tools.cpp | 2 +- 11 files changed, 93 insertions(+), 93 deletions(-) delete mode 100644 src/debugspew.h create mode 100644 src/debugspew.hpp delete mode 100644 src/lindafactory.h create mode 100644 src/lindafactory.hpp (limited to 'src') diff --git a/src/cancel.cpp b/src/cancel.cpp index 40f03f8..8991684 100644 --- a/src/cancel.cpp +++ b/src/cancel.cpp @@ -35,7 +35,7 @@ THE SOFTWARE. #include "_pch.hpp" #include "cancel.hpp" -#include "debugspew.h" +#include "debugspew.hpp" #include "lane.hpp" // ################################################################################################# diff --git a/src/debugspew.h b/src/debugspew.h deleted file mode 100644 index 1eb5556..0000000 --- a/src/debugspew.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once - -#include "lanesconf.h" -#include "universe.hpp" - -// ################################################################################################# - -#if USE_DEBUG_SPEW() - -class DebugSpewIndentScope -{ - private: - Universe* const U{}; - - public: - static std::string_view const debugspew_indent; - - DebugSpewIndentScope(Universe* U_) - : U{ U_ } - { - if (U) { - U->debugspewIndentDepth.fetch_add(1, std::memory_order_relaxed); - } - } - - ~DebugSpewIndentScope() - { - if (U) { - U->debugspewIndentDepth.fetch_sub(1, std::memory_order_relaxed); - } - } -}; - -// ################################################################################################# - -inline std::string_view DebugSpewIndent(Universe const* const U_) -{ - return DebugSpewIndentScope::debugspew_indent.substr(0, static_cast(U_->debugspewIndentDepth.load(std::memory_order_relaxed))); -} - -inline auto& DebugSpew(Universe const* const U_) -{ - if (!U_) { - return std::cerr; - } - return std::cerr << DebugSpewIndent(U_) << " "; -} -#define DEBUGSPEW_CODE(_code) _code -#define DEBUGSPEW_OR_NOT(a_, b_) a_ -#define DEBUGSPEW_PARAM_COMMA(param_) param_, -#define DEBUGSPEW_COMMA_PARAM(param_) , param_ - -#else // USE_DEBUG_SPEW() - -#define DEBUGSPEW_CODE(_code) -#define DEBUGSPEW_OR_NOT(a_, b_) b_ -#define DEBUGSPEW_PARAM_COMMA(param_) -#define DEBUGSPEW_COMMA_PARAM(param_) - -#endif // USE_DEBUG_SPEW() diff --git a/src/debugspew.hpp b/src/debugspew.hpp new file mode 100644 index 0000000..1eb5556 --- /dev/null +++ b/src/debugspew.hpp @@ -0,0 +1,60 @@ +#pragma once + +#include "lanesconf.h" +#include "universe.hpp" + +// ################################################################################################# + +#if USE_DEBUG_SPEW() + +class DebugSpewIndentScope +{ + private: + Universe* const U{}; + + public: + static std::string_view const debugspew_indent; + + DebugSpewIndentScope(Universe* U_) + : U{ U_ } + { + if (U) { + U->debugspewIndentDepth.fetch_add(1, std::memory_order_relaxed); + } + } + + ~DebugSpewIndentScope() + { + if (U) { + U->debugspewIndentDepth.fetch_sub(1, std::memory_order_relaxed); + } + } +}; + +// ################################################################################################# + +inline std::string_view DebugSpewIndent(Universe const* const U_) +{ + return DebugSpewIndentScope::debugspew_indent.substr(0, static_cast(U_->debugspewIndentDepth.load(std::memory_order_relaxed))); +} + +inline auto& DebugSpew(Universe const* const U_) +{ + if (!U_) { + return std::cerr; + } + return std::cerr << DebugSpewIndent(U_) << " "; +} +#define DEBUGSPEW_CODE(_code) _code +#define DEBUGSPEW_OR_NOT(a_, b_) a_ +#define DEBUGSPEW_PARAM_COMMA(param_) param_, +#define DEBUGSPEW_COMMA_PARAM(param_) , param_ + +#else // USE_DEBUG_SPEW() + +#define DEBUGSPEW_CODE(_code) +#define DEBUGSPEW_OR_NOT(a_, b_) b_ +#define DEBUGSPEW_PARAM_COMMA(param_) +#define DEBUGSPEW_COMMA_PARAM(param_) + +#endif // USE_DEBUG_SPEW() diff --git a/src/intercopycontext.cpp b/src/intercopycontext.cpp index ff03e3c..3470fe4 100644 --- a/src/intercopycontext.cpp +++ b/src/intercopycontext.cpp @@ -26,7 +26,7 @@ THE SOFTWARE. #include "_pch.hpp" #include "intercopycontext.h" -#include "debugspew.h" +#include "debugspew.hpp" #include "deep.hpp" #include "keeper.hpp" #include "lane.hpp" diff --git a/src/lane.cpp b/src/lane.cpp index fbd47b6..0b86e99 100644 --- a/src/lane.cpp +++ b/src/lane.cpp @@ -26,7 +26,7 @@ THE SOFTWARE. #include "_pch.hpp" #include "lane.hpp" -#include "debugspew.h" +#include "debugspew.hpp" #include "intercopycontext.h" #include "threading.hpp" #include "tools.hpp" diff --git a/src/linda.cpp b/src/linda.cpp index 1910a99..9658e38 100644 --- a/src/linda.cpp +++ b/src/linda.cpp @@ -34,7 +34,7 @@ THE SOFTWARE. #include "linda.hpp" #include "lane.hpp" -#include "lindafactory.h" +#include "lindafactory.hpp" #include "tools.hpp" // ################################################################################################# diff --git a/src/lindafactory.cpp b/src/lindafactory.cpp index ae5f2f6..6e3f759 100644 --- a/src/lindafactory.cpp +++ b/src/lindafactory.cpp @@ -31,7 +31,7 @@ THE SOFTWARE. */ #include "_pch.hpp" -#include "lindafactory.h" +#include "lindafactory.hpp" #include "linda.hpp" diff --git a/src/lindafactory.h b/src/lindafactory.h deleted file mode 100644 index ac42c10..0000000 --- a/src/lindafactory.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once - -#include "deep.hpp" - -// ################################################################################################# - -class LindaFactory -: public DeepFactory -{ - public: - // I'm not totally happy with having a 'global' variable. Maybe it should be dynamically created and stored somewhere in the universe? - static LindaFactory Instance; - - LindaFactory(luaL_Reg const lindaMT_[]) - : mLindaMT{ lindaMT_ } - { - } - - private: - luaL_Reg const* const mLindaMT{ nullptr }; - - void createMetatable(lua_State* L_) const override; - void deleteDeepObjectInternal(lua_State* L_, DeepPrelude* o_) const override; - [[nodiscard]] std::string_view moduleName() const override; - [[nodiscard]] DeepPrelude* newDeepObjectInternal(lua_State* L_) const override; -}; diff --git a/src/lindafactory.hpp b/src/lindafactory.hpp new file mode 100644 index 0000000..ac42c10 --- /dev/null +++ b/src/lindafactory.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include "deep.hpp" + +// ################################################################################################# + +class LindaFactory +: public DeepFactory +{ + public: + // I'm not totally happy with having a 'global' variable. Maybe it should be dynamically created and stored somewhere in the universe? + static LindaFactory Instance; + + LindaFactory(luaL_Reg const lindaMT_[]) + : mLindaMT{ lindaMT_ } + { + } + + private: + luaL_Reg const* const mLindaMT{ nullptr }; + + void createMetatable(lua_State* L_) const override; + void deleteDeepObjectInternal(lua_State* L_, DeepPrelude* o_) const override; + [[nodiscard]] std::string_view moduleName() const override; + [[nodiscard]] DeepPrelude* newDeepObjectInternal(lua_State* L_) const override; +}; diff --git a/src/state.h b/src/state.h index ecf1ce8..7401fe9 100644 --- a/src/state.h +++ b/src/state.h @@ -1,6 +1,6 @@ #pragma once -#include "debugspew.h" +#include "debugspew.hpp" #include "macros_and_utils.hpp" // forwards diff --git a/src/tools.cpp b/src/tools.cpp index 923d323..e9134f1 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -35,7 +35,7 @@ THE SOFTWARE. #include "tools.hpp" -#include "debugspew.h" +#include "debugspew.hpp" #include "universe.hpp" DEBUGSPEW_CODE(std::string_view const DebugSpewIndentScope::debugspew_indent{ "----+----!----+----!----+----!----+----!----+----!----+----!----+----!----+" }); -- cgit v1.2.3-55-g6feb