Improve consistency of naming in 'invoke/access' pipeline.

This commit is contained in:
2025-06-13 21:03:13 -04:00
parent 676b5bd119
commit f150b14d30
13 changed files with 71 additions and 71 deletions

View File

@@ -215,7 +215,7 @@ enum DrvAction {
PLAY_NOTIFY_CLOSE,
PLAY_NOTIFY_ACCEPT,
PLAY_UPDATE,
PLAY_CALL_FUNCTION,
PLAY_ACCESS,
PLAY_RELEASE,
};
@@ -228,7 +228,7 @@ inline static const char *action_string(DrvAction act) {
case PLAY_NOTIFY_CLOSE: return "PLAY_NOTIFY_CLOSE";
case PLAY_NOTIFY_ACCEPT: return "PLAY_NOTIFY_ACCEPT";
case PLAY_UPDATE: return "PLAY_UPDATE";
case PLAY_CALL_FUNCTION: return "PLAY_CALL_FUNCTION";
case PLAY_ACCESS: return "PLAY_ACCESS";
case PLAY_RELEASE: return "PLAY_RELEASE";
default: return "unknown";
}
@@ -475,11 +475,11 @@ void DrivenEngine::drv_update(double clock) {
event_update();
}
void DrivenEngine::drv_call_function(InvocationKind kind, int64_t place, uint32_t datapklen, const char *datapk, uint32_t *retpklen, const char **retpk) {
void DrivenEngine::drv_access(AccessKind kind, int64_t place, uint32_t datapklen, const char *datapk, uint32_t *retpklen, const char **retpk) {
// This next line is a hack, because the DrivenEngine is not supposed to care about 'kind'.
if (kind == InvocationKind::LUA_SOURCE) rescan_lua_source_ = false;
if (kind == AccessKind::INVOKE_LUA_SOURCE) rescan_lua_source_ = false;
call_function_retpk_.clear();
event_call_function(kind, place, std::string_view(datapk, datapklen), &call_function_retpk_);
event_access(kind, place, std::string_view(datapk, datapklen), &call_function_retpk_);
if (retpklen != nullptr) {
std::string_view view = call_function_retpk_.view();
*retpklen = view.size();
@@ -811,28 +811,28 @@ static void replay_update(EngineWrapper *w) {
////////////////////////
void play_call_function(EngineWrapper *w, InvocationKind kind, int64_t place, uint32_t datapklen, const char *datapk, uint32_t *retpklen, const char **retpk) {
void play_access(EngineWrapper *w, AccessKind kind, int64_t place, uint32_t datapklen, const char *datapk, uint32_t *retpklen, const char **retpk) {
assert(w->rlog == nullptr);
if (w->wlog != nullptr) {
w->wlog->write_cmd_hash(PLAY_CALL_FUNCTION, eng::memhash());
w->wlog->write_cmd_hash(PLAY_ACCESS, eng::memhash());
w->wlog->write_uint8(int64_t(kind));
w->wlog->write_int64(place);
w->wlog->write_string(std::string_view(datapk, datapklen));
w->wlog->flush();
}
w->engine->drv_call_function(kind, place, datapklen, datapk, retpklen, retpk);
w->engine->drv_access(kind, place, datapklen, datapk, retpklen, retpk);
}
void replay_call_function(EngineWrapper *w) {
InvocationKind kind = InvocationKind(w->rlog->read_uint8());
void replay_access(EngineWrapper *w) {
AccessKind kind = AccessKind(w->rlog->read_uint8());
int64_t place = w->rlog->read_int64();
std::string srcpack = w->rlog->read_string();
if (!w->rlog->good()) {
return reset_wrapper(w, "replay log corrupt in replay_call_function_lua_call");
return reset_wrapper(w, "replay log corrupt in replay_access");
}
w->engine->drv_call_function(kind, place, srcpack.size(), srcpack.c_str(), nullptr, nullptr);
w->engine->drv_access(kind, place, srcpack.size(), srcpack.c_str(), nullptr, nullptr);
}
@@ -903,7 +903,7 @@ static void replaycore_step(EngineWrapper *w) {
case PLAY_NOTIFY_CLOSE: replay_notify_close(w); return;
case PLAY_NOTIFY_ACCEPT: replay_notify_accept(w); return;
case PLAY_UPDATE: replay_update(w); return;
case PLAY_CALL_FUNCTION: replay_call_function(w); return;
case PLAY_ACCESS: replay_access(w); return;
case PLAY_RELEASE: release(w); return;
default: return reset_wrapper(w, "Replay log corrupt in command dispatcher");
}
@@ -958,7 +958,7 @@ static void init_engine_wrapper_helper(EngineWrapper *w) {
w->play_notify_close = play_notify_close;
w->play_notify_accept = play_notify_accept;
w->play_update = play_update;
w->play_call_function = play_call_function;
w->play_access = play_access;
w->replay_initialize = replaycore_initialize;
w->replay_step = replaycore_step;