#include "../obfuscator.hpp" #include #define STATE(Name) struct Name {}; #define EVENT(Name) struct Name {}; STATE(Final); EVENT(Trigger); STATE(state1); STATE(state2); STATE(state3); STATE(state4); STATE(state5); EVENT(event1); EVENT(event2); EVENT(event3); EVENT(event4); EVENT(event5); struct Action { static bool trigged; static void action() { trigged = true; std::cout << "Trigged" << std::endl; } }; bool Action::trigged = true; struct Dummy { static int dummy; static void dummy1() { dummy += 10; std::cout << "Dummy1" << std::endl; } static void dummy2() { dummy *= 20; std::cout << "Dummy2" << std::endl; } static void dummy3() { std::exit(1); } }; int Dummy::dummy = 0; int main() { using namespace obfs; using machine = StateMachine< Stage, Next>, Stage>, Stage>, Stage, Next>, Stage>>; auto next1 = machine::run(state1{}, event5{}); auto next2 = machine::run(next1, event2{}); auto next3 = machine::run(next2, event3{}); auto next4 = machine::run(next3, Trigger{}); return 0; }