From 408f8a5bf7934e7a5aa113fd3a55899db70dd73a Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Wed, 10 Apr 2024 09:48:59 +0200 Subject: C++ migration: luaG_inter_copy_* now return an enum class instead of an anonymous int --- src/tools.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/tools.h') diff --git a/src/tools.h b/src/tools.h index f0de7ec..dce7378 100644 --- a/src/tools.h +++ b/src/tools.h @@ -1,8 +1,6 @@ #pragma once -#include "threading.h" #include "deep.h" - #include "macros_and_utils.h" // forwards @@ -11,13 +9,13 @@ class Universe; // ################################################################################################ #ifdef _DEBUG -void luaG_dump( lua_State* L); +void luaG_dump(lua_State* L); #endif // _DEBUG // ################################################################################################ -void push_registry_subtable_mode( lua_State* L, UniqueKey key_, const char* mode_); -void push_registry_subtable( lua_State* L, UniqueKey key_); +void push_registry_subtable_mode(lua_State* L, UniqueKey key_, const char* mode_); +void push_registry_subtable(lua_State* L, UniqueKey key_); enum class VT { @@ -25,14 +23,21 @@ enum class VT KEY, METATABLE }; + +enum class InterCopyResult +{ + Success, + NotEnoughValues, + Error +}; + [[nodiscard]] bool inter_copy_one(Universe* U, Dest L2, int L2_cache_i, Source L, int i, VT vt_, LookupMode mode_, char const* upName_); // ################################################################################################ -[[nodiscard]] int luaG_inter_copy_package(Universe* U, Source L, Dest L2, int package_idx_, LookupMode mode_); - -[[nodiscard]] int luaG_inter_copy(Universe* U, Source L, Dest L2, int n, LookupMode mode_); -[[nodiscard]] int luaG_inter_move(Universe* U, Source L, Dest L2, int n, LookupMode mode_); +[[nodiscard]] InterCopyResult luaG_inter_copy_package(Universe* U, Source L, Dest L2, int package_idx_, LookupMode mode_); +[[nodiscard]] InterCopyResult luaG_inter_copy(Universe* U, Source L, Dest L2, int n, LookupMode mode_); +[[nodiscard]] InterCopyResult luaG_inter_move(Universe* U, Source L, Dest L2, int n, LookupMode mode_); [[nodiscard]] int luaG_nameof(lua_State* L); -- cgit v1.2.3-55-g6feb