From bc7af1de19e249c2928dd8df9da6250334a9b652 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 10 May 2014 17:08:34 +0100 Subject: GUI: Add "debuglevel" command to Debugger base class. This allows the debug level to be changed at runtime from the debug console. --- gui/debugger.h | 1 + 1 file changed, 1 insertion(+) (limited to 'gui/debugger.h') diff --git a/gui/debugger.h b/gui/debugger.h index 4ce5481fbb..7481f89df2 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -193,6 +193,7 @@ 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_DebugLevel(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); -- cgit v1.2.3 From daa8d57a866e2866369e432cf1d624179edc8875 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 02:04:07 +0200 Subject: ALL: Rename Debugger::DebugPrintf to Debugger::debugPrintf. --- gui/debugger.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui/debugger.h') diff --git a/gui/debugger.h b/gui/debugger.h index 7481f89df2..a2a7aa2d86 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 -- cgit v1.2.3 From 0adca2c579c29274f3c76bfe88b80b8ba9df26da Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 02:04:07 +0200 Subject: ALL: Rename Debugger::DVar_Register to Debugger::registerVar. --- gui/debugger.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui/debugger.h') diff --git a/gui/debugger.h b/gui/debugger.h index a2a7aa2d86..6ccc77b129 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -107,7 +107,7 @@ protected: * * @todo replace this single method by type safe variants. */ - void DVar_Register(const Common::String &varname, void *variable, VarType type, int arraySize); + void registerVar(const Common::String &varname, void *variable, VarType type, int arraySize); void DCmd_Register(const Common::String &cmdname, Debuglet *debuglet); -- cgit v1.2.3 From ae4ffe01f0e4354938714c546034cd0f9806bfc3 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 02:04:08 +0200 Subject: ALL: Rename Debugger::DCmd_Register to Debugger::registerCmd. --- gui/debugger.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gui/debugger.h') diff --git a/gui/debugger.h b/gui/debugger.h index 6ccc77b129..9dbc4084e8 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -74,7 +74,7 @@ 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)); + * registerCmd("COMMAND", WRAP_METHOD(MyDebugger, MyCmd)); * would register the method MyDebugger::MyCmd(int, const char **) * under the command name "COMMAND". */ @@ -108,7 +108,7 @@ protected: * @todo replace this single method by type safe variants. */ void registerVar(const Common::String &varname, void *variable, VarType type, int arraySize); - void DCmd_Register(const Common::String &cmdname, Debuglet *debuglet); + void registerCmd(const Common::String &cmdname, Debuglet *debuglet); private: -- cgit v1.2.3 From 07c9fea9cbde6ca260e5e8be99f976a51752b4d7 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 02:04:08 +0200 Subject: GUI: Slight naming cleanup in Debugger. --- gui/debugger.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gui/debugger.h') diff --git a/gui/debugger.h b/gui/debugger.h index 9dbc4084e8..f764623e90 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -89,7 +89,7 @@ protected: DVAR_STRING }; - struct DVar { + struct Var { Common::String name; void *variable; VarType type; @@ -125,7 +125,7 @@ private: */ uint _frameCountdown; - Common::Array _dvars; + Common::Array _vars; typedef Common::HashMap, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> CommandsMap; CommandsMap _cmds; -- cgit v1.2.3 From 30d64edac449cde1f1c387b817ec33446ddd4698 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 02:04:08 +0200 Subject: ALL: Make Debugger command function names conform to our guidelines. --- gui/debugger.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'gui/debugger.h') diff --git a/gui/debugger.h b/gui/debugger.h index f764623e90..dc81fcb891 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -168,7 +168,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,13 +190,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_DebugLevel(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: -- cgit v1.2.3 From 75a78c89fac67b9b2efffc2c47e3d8daf3eb8022 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 02:04:08 +0200 Subject: GUI: Don't endorse function naming against our guidelines in docu. --- gui/debugger.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gui/debugger.h') diff --git a/gui/debugger.h b/gui/debugger.h index dc81fcb891..319fa68dae 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -74,8 +74,8 @@ protected: * Convenience macro that makes it easier to register a method * of a debugger subclass as a command. * Usage example: - * registerCmd("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) \ -- cgit v1.2.3 From 8b7672b64cc179660a4e1706db114b3b6b7073f7 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 02:04:08 +0200 Subject: ALL: Introduce typesafe Debugger::registerVar functions. This also adds a FIXME to SCI which registered an enum type as int... --- gui/debugger.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'gui/debugger.h') diff --git a/gui/debugger.h b/gui/debugger.h index 319fa68dae..8c7481b61f 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -96,7 +96,7 @@ protected: int arraySize; }; - +private: /** * Register a variable with the debugger. This allows the user to read and modify * this variable. @@ -104,10 +104,30 @@ 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 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); -- cgit v1.2.3