From 484431e7f86371b205692cffc353b42c6de40250 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 5 Jun 2015 00:04:52 +0800 Subject: [PATCH] add aliases for common interactive functions Rather than using one letter commands everywhere, add support for "run" and "quit" and "help" as aliases to "r" and "q" and "h" respectively. This makes it a little inconsistent when some commands are one letters but others are full words. --- riscv/interactive.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/riscv/interactive.cc b/riscv/interactive.cc index b18a6fa..8e58411 100644 --- a/riscv/interactive.cc +++ b/riscv/interactive.cc @@ -51,7 +51,8 @@ void sim_t::interactive() typedef void (sim_t::*interactive_func)(const std::string&, const std::vector&); std::map funcs; - funcs["r"] = &sim_t::interactive_run_noisy; + funcs["run"] = &sim_t::interactive_run_noisy; + funcs["r"] = funcs["run"]; funcs["rs"] = &sim_t::interactive_run_silent; funcs["reg"] = &sim_t::interactive_reg; funcs["fregs"] = &sim_t::interactive_fregs; @@ -60,8 +61,10 @@ void sim_t::interactive() funcs["str"] = &sim_t::interactive_str; funcs["until"] = &sim_t::interactive_until; funcs["while"] = &sim_t::interactive_until; - funcs["q"] = &sim_t::interactive_quit; - funcs["h"] = &sim_t::interactive_help; + funcs["quit"] = &sim_t::interactive_quit; + funcs["q"] = funcs["quit"]; + funcs["help"] = &sim_t::interactive_help; + funcs["h"] = funcs["help"]; while (!htif->done()) { @@ -107,10 +110,13 @@ void sim_t::interactive_help(const std::string& cmd, const std::vector # Run while in is \n" "while pc # Run while PC in is \n" "while mem # Run while memory is \n" - "r [count] # Resume noisy execution (until CTRL+C, or [count] insns)\n" + "run [count] # Resume noisy execution (until CTRL+C, or [count] insns)\n" + "r [count] Alias for run\n" "rs [count] # Resume silent execution (until CTRL+C, or [count] insns)\n" - "q # End the simulation\n" - "h # This screen!\n" + "quit # End the simulation\n" + "q Alias for quit\n" + "help # This screen!\n" + "h Alias for help\n" "Note: Hitting enter is the same as: run 1\n" << std::flush; } -- 2.30.2