diff options
Diffstat (limited to 'src/lanes.cpp')
-rw-r--r-- | src/lanes.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lanes.cpp b/src/lanes.cpp index 880c150..d549449 100644 --- a/src/lanes.cpp +++ b/src/lanes.cpp | |||
@@ -1001,7 +1001,7 @@ LUAG_FUNC(lane_new) | |||
1001 | DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "lane_new: setup\n" INDENT_END)); | 1001 | DEBUGSPEW_CODE( fprintf( stderr, INDENT_BEGIN "lane_new: setup\n" INDENT_END)); |
1002 | 1002 | ||
1003 | // populate with selected libraries at the same time | 1003 | // populate with selected libraries at the same time |
1004 | lua_State* const L2{ luaG_newstate(U, Source{ L }, libs_str) }; // L // L2 | 1004 | lua_State* const L2{ luaG_newstate(U, SourceState{ L }, libs_str) }; // L // L2 |
1005 | 1005 | ||
1006 | // 'lane' is allocated from heap, not Lua, since its life span may surpass the handle's (if free running thread) | 1006 | // 'lane' is allocated from heap, not Lua, since its life span may surpass the handle's (if free running thread) |
1007 | Lane* const lane{ new (U) Lane{ U, L2 } }; | 1007 | Lane* const lane{ new (U) Lane{ U, L2 } }; |
@@ -1111,7 +1111,7 @@ LUAG_FUNC(lane_new) | |||
1111 | { | 1111 | { |
1112 | DEBUGSPEW_CODE(fprintf(stderr, INDENT_BEGIN "lane_new: update 'package'\n" INDENT_END)); | 1112 | DEBUGSPEW_CODE(fprintf(stderr, INDENT_BEGIN "lane_new: update 'package'\n" INDENT_END)); |
1113 | // when copying with mode LookupMode::LaneBody, should raise an error in case of problem, not leave it one the stack | 1113 | // when copying with mode LookupMode::LaneBody, should raise an error in case of problem, not leave it one the stack |
1114 | InterCopyContext c{ U, Dest{ L2 }, Source{ L }, {}, SourceIndex{ package_idx }, {}, {}, {} }; | 1114 | InterCopyContext c{ U, DestState{ L2 }, SourceState{ L }, {}, SourceIndex{ package_idx }, {}, {}, {} }; |
1115 | [[maybe_unused]] InterCopyResult const ret{ c.inter_copy_package() }; | 1115 | [[maybe_unused]] InterCopyResult const ret{ c.inter_copy_package() }; |
1116 | LUA_ASSERT(L, ret == InterCopyResult::Success); // either all went well, or we should not even get here | 1116 | LUA_ASSERT(L, ret == InterCopyResult::Success); // either all went well, or we should not even get here |
1117 | } | 1117 | } |
@@ -1155,7 +1155,7 @@ LUAG_FUNC(lane_new) | |||
1155 | if (lua_pcall( L2, 1, 1, 0) != LUA_OK) // ret/errcode | 1155 | if (lua_pcall( L2, 1, 1, 0) != LUA_OK) // ret/errcode |
1156 | { | 1156 | { |
1157 | // propagate error to main state if any | 1157 | // propagate error to main state if any |
1158 | InterCopyContext c{ U, Dest{ L }, Source{ L2 }, {}, {}, {}, {}, {} }; | 1158 | InterCopyContext c{ U, DestState{ L }, SourceState{ L2 }, {}, {}, {}, {}, {} }; |
1159 | std::ignore = c.inter_move(1); // func libs priority globals package required gc_cb [... args ...] n "modname" error | 1159 | std::ignore = c.inter_move(1); // func libs priority globals package required gc_cb [... args ...] n "modname" error |
1160 | raise_lua_error(L); | 1160 | raise_lua_error(L); |
1161 | } | 1161 | } |
@@ -1185,7 +1185,7 @@ LUAG_FUNC(lane_new) | |||
1185 | DEBUGSPEW_CODE(DebugSpewIndentScope scope{ U }); | 1185 | DEBUGSPEW_CODE(DebugSpewIndentScope scope{ U }); |
1186 | lua_pushnil(L); // func libs priority globals package required gc_cb [... args ...] nil | 1186 | lua_pushnil(L); // func libs priority globals package required gc_cb [... args ...] nil |
1187 | // Lua 5.2 wants us to push the globals table on the stack | 1187 | // Lua 5.2 wants us to push the globals table on the stack |
1188 | InterCopyContext c{ U, Dest{ L2 }, Source{ L }, {}, {}, {}, {}, {} }; | 1188 | InterCopyContext c{ U, DestState{ L2 }, SourceState{ L }, {}, {}, {}, {}, {} }; |
1189 | lua_pushglobaltable(L2); // _G | 1189 | lua_pushglobaltable(L2); // _G |
1190 | while( lua_next(L, globals_idx)) // func libs priority globals package required gc_cb [... args ...] k v | 1190 | while( lua_next(L, globals_idx)) // func libs priority globals package required gc_cb [... args ...] k v |
1191 | { | 1191 | { |
@@ -1206,7 +1206,7 @@ LUAG_FUNC(lane_new) | |||
1206 | DEBUGSPEW_CODE(fprintf( stderr, INDENT_BEGIN "lane_new: transfer lane body\n" INDENT_END)); | 1206 | DEBUGSPEW_CODE(fprintf( stderr, INDENT_BEGIN "lane_new: transfer lane body\n" INDENT_END)); |
1207 | DEBUGSPEW_CODE(DebugSpewIndentScope scope{ U }); | 1207 | DEBUGSPEW_CODE(DebugSpewIndentScope scope{ U }); |
1208 | lua_pushvalue(L, 1); // func libs priority globals package required gc_cb [... args ...] func | 1208 | lua_pushvalue(L, 1); // func libs priority globals package required gc_cb [... args ...] func |
1209 | InterCopyContext c{ U, Dest{ L2 }, Source{ L }, {}, {}, {}, {}, {} }; | 1209 | InterCopyContext c{ U, DestState{ L2 }, SourceState{ L }, {}, {}, {}, {}, {} }; |
1210 | InterCopyResult const res{ c.inter_move(1) }; // func libs priority globals package required gc_cb [... args ...] // func | 1210 | InterCopyResult const res{ c.inter_move(1) }; // func libs priority globals package required gc_cb [... args ...] // func |
1211 | if (res != InterCopyResult::Success) | 1211 | if (res != InterCopyResult::Success) |
1212 | { | 1212 | { |
@@ -1235,7 +1235,7 @@ LUAG_FUNC(lane_new) | |||
1235 | { | 1235 | { |
1236 | DEBUGSPEW_CODE(fprintf( stderr, INDENT_BEGIN "lane_new: transfer lane arguments\n" INDENT_END)); | 1236 | DEBUGSPEW_CODE(fprintf( stderr, INDENT_BEGIN "lane_new: transfer lane arguments\n" INDENT_END)); |
1237 | DEBUGSPEW_CODE(DebugSpewIndentScope scope{ U }); | 1237 | DEBUGSPEW_CODE(DebugSpewIndentScope scope{ U }); |
1238 | InterCopyContext c{ U, Dest{ L2 }, Source{ L }, {}, {}, {}, {}, {} }; | 1238 | InterCopyContext c{ U, DestState{ L2 }, SourceState{ L }, {}, {}, {}, {}, {} }; |
1239 | InterCopyResult const res{ c.inter_move(nargs) }; // func libs priority globals package required gc_cb // func [... args ...] | 1239 | InterCopyResult const res{ c.inter_move(nargs) }; // func libs priority globals package required gc_cb // func [... args ...] |
1240 | if (res != InterCopyResult::Success) | 1240 | if (res != InterCopyResult::Success) |
1241 | { | 1241 | { |
@@ -1402,7 +1402,7 @@ LUAG_FUNC(thread_join) | |||
1402 | int const n{ lua_gettop(L2) }; // whole L2 stack | 1402 | int const n{ lua_gettop(L2) }; // whole L2 stack |
1403 | if ( | 1403 | if ( |
1404 | (n > 0) && | 1404 | (n > 0) && |
1405 | (InterCopyContext{ U, Dest{ L }, Source{ L2 }, {}, {}, {}, {}, {} }.inter_move(n) != InterCopyResult::Success) | 1405 | (InterCopyContext{ U, DestState{ L }, SourceState{ L2 }, {}, {}, {}, {}, {} }.inter_move(n) != InterCopyResult::Success) |
1406 | ) | 1406 | ) |
1407 | { | 1407 | { |
1408 | luaL_error(L, "tried to copy unsupported types"); // doesn't return | 1408 | luaL_error(L, "tried to copy unsupported types"); // doesn't return |
@@ -1417,7 +1417,7 @@ LUAG_FUNC(thread_join) | |||
1417 | STACK_GROW(L, 3); | 1417 | STACK_GROW(L, 3); |
1418 | lua_pushnil(L); | 1418 | lua_pushnil(L); |
1419 | // even when ERROR_FULL_STACK, if the error is not LUA_ERRRUN, the handler wasn't called, and we only have 1 error message on the stack ... | 1419 | // even when ERROR_FULL_STACK, if the error is not LUA_ERRRUN, the handler wasn't called, and we only have 1 error message on the stack ... |
1420 | InterCopyContext c{ U, Dest{ L }, Source{ L2 }, {}, {}, {}, {}, {} }; | 1420 | InterCopyContext c{ U, DestState{ L }, SourceState{ L2 }, {}, {}, {}, {}, {} }; |
1421 | if (c.inter_move(n) != InterCopyResult::Success) // nil "err" [trace] | 1421 | if (c.inter_move(n) != InterCopyResult::Success) // nil "err" [trace] |
1422 | { | 1422 | { |
1423 | luaL_error(L, "tried to copy unsupported types: %s", lua_tostring(L, -n)); // doesn't return | 1423 | luaL_error(L, "tried to copy unsupported types: %s", lua_tostring(L, -n)); // doesn't return |
@@ -1815,7 +1815,7 @@ LUAG_FUNC(configure) | |||
1815 | STACK_CHECK(L, 2); | 1815 | STACK_CHECK(L, 2); |
1816 | 1816 | ||
1817 | { | 1817 | { |
1818 | char const* errmsg{ DeepFactory::PushDeepProxy(Dest{ L }, U->timer_deep, 0, LookupMode::LaneBody) }; // settings M timer_deep | 1818 | char const* errmsg{ DeepFactory::PushDeepProxy(DestState{ L }, U->timer_deep, 0, LookupMode::LaneBody) }; // settings M timer_deep |
1819 | if (errmsg != nullptr) | 1819 | if (errmsg != nullptr) |
1820 | { | 1820 | { |
1821 | return luaL_error(L, errmsg); | 1821 | return luaL_error(L, errmsg); |