]> git.tdb.fi Git - gldbg.git/blobdiff - source/commandinterpreter.h
Make gldbg interactive
[gldbg.git] / source / commandinterpreter.h
diff --git a/source/commandinterpreter.h b/source/commandinterpreter.h
new file mode 100644 (file)
index 0000000..8ce59d0
--- /dev/null
@@ -0,0 +1,38 @@
+/* $Id$
+
+This file is part of gldbg
+Copyright © 2009  Mikko Rasa, Mikkosoft Productions
+Distributed under the GPL
+*/
+
+#ifndef COMMANDINTERPRETER_H_
+#define COMMANDINTERPRETER_H_
+
+#include <map>
+#include <string>
+
+class GlDbg;
+
+class CommandInterpreter
+{
+private:
+       typedef void (CommandInterpreter::*CommandFunc)(const std::string &);
+       typedef std::map<std::string, CommandFunc> CommandMap;
+
+       GlDbg &gldbg;
+       CommandMap commands;
+
+public:
+       CommandInterpreter(GlDbg &);
+       void execute(const std::string &);
+
+private:
+       void cmd_run(const std::string &);
+       void cmd_continue(const std::string &);
+       void cmd_signal(const std::string &);
+       void cmd_kill(const std::string &);
+       void cmd_exit(const std::string &);
+       void cmd_trace(const std::string &);
+};
+
+#endif