feat(furdb): add continue and next commands

This commit is contained in:
2026-08-17 11:35:36 +02:00
parent dd96f95d77
commit 26efd110f1
3 changed files with 26 additions and 0 deletions
+10
View File
@@ -36,6 +36,16 @@ public:
void execute(context& ctx, const command_info& info) override; void execute(context& ctx, const command_info& info) override;
}; };
class continue_command final : public command {
public:
void execute(context& ctx, const command_info& info) override;
};
class next_command final : public command {
public:
void execute(context& ctx, const command_info& info) override;
};
class break_command final : public command { class break_command final : public command {
public: public:
void execute(context& ctx, const command_info& info) override; void execute(context& ctx, const command_info& info) override;
+14
View File
@@ -71,6 +71,20 @@ void run_command::execute(context& ctx, const command_info& info) {
ctx.run(); ctx.run();
} }
void continue_command::execute(context& ctx, const command_info& info) {
ctx.run();
}
void next_command::execute(context& ctx, const command_info& info) {
if (ctx.executor->done()) {
std::cout << "No program's currently running\n";
return;
}
ctx.executor->unsuspend();
ctx.executor->step();
ctx.print_instruction();
}
static void print_type(const furvm::thing_type& type) { static void print_type(const furvm::thing_type& type) {
switch (type.type) { switch (type.type) {
case furvm::thing_type::S8: std::cout << "s8"; break; case furvm::thing_type::S8: std::cout << "s8"; break;
+2
View File
@@ -45,6 +45,8 @@ int main(int argc, char** argv) {
static std::unordered_map<std::string_view, command*> s_commands; static std::unordered_map<std::string_view, command*> s_commands;
s_commands["exit"] = s_commands["quit"] = s_commands["q"] = new quit_command(); s_commands["exit"] = s_commands["quit"] = s_commands["q"] = new quit_command();
s_commands["run"] = s_commands["r"] = new run_command(); s_commands["run"] = s_commands["r"] = new run_command();
s_commands["continue"] = s_commands["c"] = new continue_command();
s_commands["next"] = s_commands["n"] = new next_command();
s_commands["break"] = s_commands["b"] = new break_command(); s_commands["break"] = s_commands["b"] = new break_command();
s_commands["info"] = s_commands["i"] = new info_command(); s_commands["info"] = s_commands["i"] = new info_command();