diff options
| author | uruk | 2014-05-30 11:14:47 +0200 |
|---|---|---|
| committer | uruk | 2014-05-30 11:14:47 +0200 |
| commit | bb2f8dd68e1d6b2b30b07f60c0cd4e125b47ea4d (patch) | |
| tree | 9a1e28cfb1eb1a322225c05adc0962a2f96ea521 /gui/debugger.h | |
| parent | 5ad4e157e5398347651a0da0db07f9daf01bf373 (diff) | |
| parent | 0a46d67baea121bed0511ce45bfdd8438a43d35d (diff) | |
| download | scummvm-rg350-bb2f8dd68e1d6b2b30b07f60c0cd4e125b47ea4d.tar.gz scummvm-rg350-bb2f8dd68e1d6b2b30b07f60c0cd4e125b47ea4d.tar.bz2 scummvm-rg350-bb2f8dd68e1d6b2b30b07f60c0cd4e125b47ea4d.zip | |
Merge branch 'master' of https://github.com/scummvm/scummvm into cge2
Diffstat (limited to 'gui/debugger.h')
| -rw-r--r-- | gui/debugger.h | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/gui/debugger.h b/gui/debugger.h index 4ce5481fbb..8c7481b61f 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -40,7 +40,7 @@ public: Debugger(); virtual ~Debugger(); - int DebugPrintf(const char *format, ...) GCC_PRINTF(2, 3); + int debugPrintf(const char *format, ...) GCC_PRINTF(2, 3); /** * The onFrame() method should be invoked by the engine at regular @@ -74,8 +74,8 @@ protected: * Convenience macro that makes it easier to register a method * of a debugger subclass as a command. * Usage example: - * DCmd_Register("COMMAND", WRAP_METHOD(MyDebugger, MyCmd)); - * would register the method MyDebugger::MyCmd(int, const char **) + * registerCmd("COMMAND", WRAP_METHOD(MyDebugger, myCmd)); + * would register the method MyDebugger::myCmd(int, const char **) * under the command name "COMMAND". */ #define WRAP_METHOD(cls, method) \ @@ -89,14 +89,14 @@ protected: DVAR_STRING }; - struct DVar { + struct Var { Common::String name; void *variable; VarType type; int arraySize; }; - +private: /** * Register a variable with the debugger. This allows the user to read and modify * this variable. @@ -104,11 +104,31 @@ protected: * @param variable pointer to the actual storage of the variable * @param type the type of the variable (byte, int, bool, ...) * @paral arraySize for type DVAR_INTARRAY this specifies the size of the array - * - * @todo replace this single method by type safe variants. */ - void DVar_Register(const Common::String &varname, void *variable, VarType type, int arraySize); - void DCmd_Register(const Common::String &cmdname, Debuglet *debuglet); + void registerVar(const Common::String &varname, void *variable, VarType type, int arraySize); + +protected: + void registerVar(const Common::String &varname, byte *variable) { + registerVar(varname, variable, DVAR_BYTE, 0); + } + + void registerVar(const Common::String &varname, int *variable) { + registerVar(varname, variable, DVAR_INT, 0); + } + + void registerVar(const Common::String &varname, bool *variable) { + registerVar(varname, variable, DVAR_BOOL, 0); + } + + void registerVar(const Common::String &varname, int32 **variable, int arraySize) { + registerVar(varname, variable, DVAR_INTARRAY, arraySize); + } + + void registerVar(const Common::String &varname, Common::String *variable) { + registerVar(varname, variable, DVAR_STRING, 0); + } + + void registerCmd(const Common::String &cmdname, Debuglet *debuglet); private: @@ -125,7 +145,7 @@ private: */ uint _frameCountdown; - Common::Array<DVar> _dvars; + Common::Array<Var> _vars; typedef Common::HashMap<Common::String, Common::SharedPtr<Debuglet>, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> CommandsMap; CommandsMap _cmds; @@ -168,7 +188,7 @@ protected: virtual void postEnter(); /** - * Subclasses should invoke the detach() method in their Cmd_FOO methods + * Subclasses should invoke the detach() method in their cmdFOO methods * if that command will resume execution of the program (as opposed to * executing, say, a "single step through code" command). * @@ -190,12 +210,13 @@ private: virtual bool handleCommand(int argc, const char **argv, bool &keepRunning); protected: - bool Cmd_Exit(int argc, const char **argv); - bool Cmd_Help(int argc, const char **argv); - bool Cmd_OpenLog(int argc, const char **argv); - bool Cmd_DebugFlagsList(int argc, const char **argv); - bool Cmd_DebugFlagEnable(int argc, const char **argv); - bool Cmd_DebugFlagDisable(int argc, const char **argv); + bool cmdExit(int argc, const char **argv); + bool cmdHelp(int argc, const char **argv); + bool cmdOpenLog(int argc, const char **argv); + bool cmdDebugLevel(int argc, const char **argv); + bool cmdDebugFlagsList(int argc, const char **argv); + bool cmdDebugFlagEnable(int argc, const char **argv); + bool cmdDebugFlagDisable(int argc, const char **argv); #ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER private: |
