Remove the two old FSMs ahead of the inheritance-based rewrite

Deletes the compile-time Void::StateMachine and the builder-based runtime
Void::Fsm (Definition/Machine/Event/PluginBehavior + their standalone
tests, the FSM behaviour plugins, and the FSM x Plugin integration test
and its CMake wiring). The general-purpose Plugin module and its stateful
hot-reload tests are untouched.

Both are being replaced by a single inheritance + coroutine workflow FSM
(next phase). 936 tests green (51 old FSM/StateMachine tests removed).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Fable 5 committed 2026-06-14 00:26:30 +03:00
1 parent 6b5f61f00a
commit 04cf1998bd
20 files changed
+3 -3793

No files matched your search

-70
View File
@@ -1,70 +0,0 @@
#include <Void/Fsm/Definition.hpp>
#include <Void/Fsm/PluginBehavior.hpp>
#include <Void/Plugin/Plugin.hpp>
#include <atomic>
#include <string_view>
// FSM behaviour plugin, v1. Defines a 3-state cycle (idle -> busy -> done
// -> idle) and counts how many times its action ran. v2 keeps the same
// state/event names so the host can swap_definition seamlessly.
namespace
{
std::atomic<int> g_action_runs{0};
class FsmPlugin final : public Void::Plugin::IPlugin,
public Void::Fsm::IFsmBehaviorPack
{
public:
[[nodiscard]] std::string_view name() const noexcept override
{
return "FsmPlugin";
}
void register_into(Void::Fsm::Builder& b) override
{
using namespace Void::Fsm;
auto idle = b.state("idle");
auto busy = b.state("busy");
auto done = b.state("done");
b.initial(idle);
const auto start = b.event("start");
const auto finish = b.event("finish");
const auto reset = b.event("reset");
b.transition(idle, start, busy)
.action(SyncAction{[](Machine&, const Event&) {
g_action_runs.fetch_add(1, std::memory_order_relaxed);
}});
b.transition(busy, finish, done);
b.transition(done, reset, idle);
}
};
} // namespace
extern "C" {
void* void_plugin_create() { return new FsmPlugin; }
void void_plugin_destroy(void* p) { delete static_cast<FsmPlugin*>(p); }
Void::Plugin::PluginInfo void_plugin_info()
{
return {
.abi_version = Void::Plugin::ABI_VERSION,
.name = "FsmPlugin",
.plugin_version = "1.0.0",
.description = "FSM behaviour plugin (v1)",
};
}
// Stateless factory: returns a fresh pack the host uses only during
// definition build. It does not need to be the IPlugin instance.
Void::Fsm::IFsmBehaviorPack* void_plugin_fsm_behaviors()
{
static FsmPlugin pack;
return &pack;
}
} // extern "C"
-71
View File
@@ -1,71 +0,0 @@
#include <Void/Fsm/Definition.hpp>
#include <Void/Fsm/PluginBehavior.hpp>
#include <Void/Plugin/Plugin.hpp>
#include <atomic>
#include <string_view>
// FSM behaviour plugin, v2. Same state/event names as v1 (so the host
// adopts the active configuration seamlessly on swap_definition) plus a
// new "skip" transition idle -> done that proves the reloaded behaviour
// is live.
namespace
{
std::atomic<int> g_action_runs{0};
class FsmPlugin final : public Void::Plugin::IPlugin,
public Void::Fsm::IFsmBehaviorPack
{
public:
[[nodiscard]] std::string_view name() const noexcept override
{
return "FsmPlugin";
}
void register_into(Void::Fsm::Builder& b) override
{
using namespace Void::Fsm;
auto idle = b.state("idle");
auto busy = b.state("busy");
auto done = b.state("done");
b.initial(idle);
const auto start = b.event("start");
const auto finish = b.event("finish");
const auto reset = b.event("reset");
const auto skip = b.event("skip"); // new in v2
b.transition(idle, start, busy)
.action(SyncAction{[](Machine&, const Event&) {
g_action_runs.fetch_add(1, std::memory_order_relaxed);
}});
b.transition(busy, finish, done);
b.transition(done, reset, idle);
b.transition(idle, skip, done); // new behaviour
}
};
} // namespace
extern "C" {
void* void_plugin_create() { return new FsmPlugin; }
void void_plugin_destroy(void* p) { delete static_cast<FsmPlugin*>(p); }
Void::Plugin::PluginInfo void_plugin_info()
{
return {
.abi_version = Void::Plugin::ABI_VERSION,
.name = "FsmPlugin",
.plugin_version = "2.0.0",
.description = "FSM behaviour plugin (v2)",
};
}
Void::Fsm::IFsmBehaviorPack* void_plugin_fsm_behaviors()
{
static FsmPlugin pack;
return &pack;
}
} // extern "C"