From 042055968ab0c48faec607889814e38c50c09efa Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Fri, 4 Jul 2025 13:50:53 +0200 Subject: Changed lua wrapper prefixes from luaG_ to luaW_ (w as in wrapper!) --- src/deep.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/deep.cpp') diff --git a/src/deep.cpp b/src/deep.cpp index 82f1214..acd93a6 100644 --- a/src/deep.cpp +++ b/src/deep.cpp @@ -75,7 +75,7 @@ namespace { lua_rawget(L_, -2); // L_: {} b } lua_remove(L_, -2); // L_: a|b - LuaType const _type{ luaG_type(L_, kIdxTop) }; + LuaType const _type{ luaW_type(L_, kIdxTop) }; if (_type != LuaType::NIL && _type != expectedType_) { raise_luaL_error(L_, "INTERNAL ERROR: Unexpected value."); } @@ -103,7 +103,7 @@ namespace { [[nodiscard]] int DeepFactory::DeepGC(lua_State* const L_) { - DeepPrelude* const* const _proxy{ luaG_tofulluserdata(L_, StackIndex{ 1 }) }; + DeepPrelude* const* const _proxy{ luaW_tofulluserdata(L_, StackIndex{ 1 }) }; DeepPrelude* const _p{ *_proxy }; // can work without a universe if creating a deep userdata from some external C module when Lanes isn't loaded @@ -150,7 +150,7 @@ DeepFactory* DeepFactory::LookupFactory(lua_State* const L_, StackIndex const in { // when looking inside a keeper, we are 100% sure the object is a deep userdata if (mode_ == LookupMode::FromKeeper) { - DeepPrelude* const _proxy{ *luaG_tofulluserdata(L_, index_) }; + DeepPrelude* const _proxy{ *luaW_tofulluserdata(L_, index_) }; // we can (and must) cast and fetch the internally stored factory return &_proxy->factory; } else { @@ -167,7 +167,7 @@ DeepFactory* DeepFactory::LookupFactory(lua_State* const L_, StackIndex const in // replace metatable with the factory pointer, if it is actually a deep userdata LookupDeep(L_, LuaType::LIGHTUSERDATA); // L_: deep ... factory|nil - DeepFactory* const _ret{ luaG_tolightuserdata(L_, kIdxTop) }; // nullptr if not a userdata + DeepFactory* const _ret{ luaW_tolightuserdata(L_, kIdxTop) }; // nullptr if not a userdata lua_pop(L_, 1); STACK_CHECK(L_, 0); return _ret; @@ -190,7 +190,7 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_, // Check if a proxy already exists lua_pushlightuserdata(L_, prelude_); // L_: DPC deep - if (luaG_rawget(L_, StackIndex{ -2 }) != LuaType::NIL) { // L_: DPC proxy + if (luaW_rawget(L_, StackIndex{ -2 }) != LuaType::NIL) { // L_: DPC proxy lua_remove(L_, -2); // L_: proxy STACK_CHECK(L_, 1); return; @@ -202,7 +202,7 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_, STACK_GROW(L_, 7); // a new full userdata, fitted with the specified number of uservalue slots (always 1 for Lua < 5.4) - DeepPrelude** const _proxy{ luaG_newuserdatauv(L_, nuv_) }; // L_: DPC proxy + DeepPrelude** const _proxy{ luaW_newuserdatauv(L_, nuv_) }; // L_: DPC proxy LUA_ASSERT(L_, _proxy); *_proxy = prelude_; prelude_->refcount.fetch_add(1, std::memory_order_relaxed); // one more proxy pointing to this deep data @@ -223,7 +223,7 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_, raise_luaL_error(errL_, "Bad DeepFactory::createMetatable overload: unexpected pushed value"); } // if the metatable contains a __gc, we will call it from our own - std::ignore = luaG_rawgetfield(L_, kIdxTop, "__gc"); // L_: DPC proxy metatable __gc + std::ignore = luaW_rawgetfield(L_, kIdxTop, "__gc"); // L_: DPC proxy metatable __gc } else { // keepers need a minimal metatable that only contains our own __gc lua_createtable(L_, 0, 1); // L_: DPC proxy metatable @@ -251,8 +251,8 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_, raise_luaL_error(errL_, "lanes receiving deep userdata should register the 'package' library"); } - luaG_pushstring(L_, _modname); // L_: DPC proxy metatable require() "module" - if (luaG_getfield(L_, kIdxRegistry, LUA_LOADED_TABLE) != LuaType::TABLE) { // L_: DPC proxy metatable require() "module" _R._LOADED + luaW_pushstring(L_, _modname); // L_: DPC proxy metatable require() "module" + if (luaW_getfield(L_, kIdxRegistry, LUA_LOADED_TABLE) != LuaType::TABLE) { // L_: DPC proxy metatable require() "module" _R._LOADED // no L.registry._LOADED; can this ever happen? lua_pop(L_, 6); // L_: raise_luaL_error(errL_, "unexpected error while requiring a module identified by DeepFactory::moduleName"); @@ -270,7 +270,7 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_, LuaError const _require_result{ lua_pcall(L_, 1, 0, 0) }; // L_: DPC proxy metatable error? if (_require_result != LuaError::OK) { // failed, raise the error in the proper state - raise_luaL_error(errL_, luaG_tostring(L_, kIdxTop)); + raise_luaL_error(errL_, luaW_tostring(L_, kIdxTop)); } } } else { // already loaded, we are happy @@ -279,7 +279,7 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_, } } STACK_CHECK(L_, 3); // L_: DPC proxy metatable - LUA_ASSERT(L_, luaG_type(L_, StackIndex{ -2 }) == LuaType::USERDATA); + LUA_ASSERT(L_, luaW_type(L_, StackIndex{ -2 }) == LuaType::USERDATA); LUA_ASSERT(L_, lua_istable(L_, -1)); lua_setmetatable(L_, -2); // L_: DPC proxy @@ -288,7 +288,7 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_, lua_pushvalue(L_, -2); // L_: DPC proxy deep proxy lua_rawset(L_, -4); // L_: DPC proxy lua_remove(L_, -2); // L_: proxy - LUA_ASSERT(L_, luaG_type(L_, kIdxTop) == LuaType::USERDATA); + LUA_ASSERT(L_, luaW_type(L_, kIdxTop) == LuaType::USERDATA); STACK_CHECK(L_, 1); } @@ -305,7 +305,7 @@ void DeepFactory::PushDeepProxy(DestState const L_, DeepPrelude* const prelude_, * Reference counting and true userdata proxying are taken care of for the actual data type. * * Types using the deep userdata system (and only those!) can be passed between - * separate Lua states via 'luaG_inter_move()'. + * separate Lua states via 'luaW_inter_move()'. * * Returns: 'proxy' userdata for accessing the deep data via 'DeepFactory::toDeep()' */ @@ -382,7 +382,7 @@ DeepPrelude* DeepFactory::toDeep(lua_State* const L_, StackIndex const index_) c } STACK_CHECK(L_, 0); - DeepPrelude** const _proxy{ luaG_tofulluserdata(L_, index_) }; + DeepPrelude** const _proxy{ luaW_tofulluserdata(L_, index_) }; return *_proxy; } -- cgit v1.2.3-55-g6feb