feat(furdb): add continue and next commands
This commit is contained in:
@@ -36,6 +36,16 @@ public:
|
||||
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 {
|
||||
public:
|
||||
void execute(context& ctx, const command_info& info) override;
|
||||
|
||||
@@ -71,6 +71,20 @@ void run_command::execute(context& ctx, const command_info& info) {
|
||||
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) {
|
||||
switch (type.type) {
|
||||
case furvm::thing_type::S8: std::cout << "s8"; break;
|
||||
|
||||
@@ -45,6 +45,8 @@ int main(int argc, char** argv) {
|
||||
static std::unordered_map<std::string_view, command*> s_commands;
|
||||
s_commands["exit"] = s_commands["quit"] = s_commands["q"] = new quit_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["info"] = s_commands["i"] = new info_command();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user