[Scummvm-cvs-logs] CVS: scummvm/scumm debugger.cpp,1.2,1.3 debugger.h,1.2,1.3
Max Horn
fingolfin at users.sourceforge.net
Mon Dec 16 14:47:05 CET 2002
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv21398
Modified Files:
debugger.cpp debugger.h
Log Message:
indentation fixes; added a constructor (after all the debugger is a global var which is not allocated by new, hence we can't relay on memory being zeroed). And no I am not actually gonna use force against Endy, I just was frustrated :-)
Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- debugger.cpp 16 Dec 2002 21:38:27 -0000 1.2
+++ debugger.cpp 16 Dec 2002 22:46:15 -0000 1.3
@@ -17,6 +17,15 @@
#define Debug_Printf printf
#endif
+ScummDebugger::ScummDebugger()
+{
+ _s = 0;
+ _frame_countdown = 0;
+ _dvar_count = 0;
+ _dcmd_count = 0;
+ _detach_now = false;
+}
+
// Initialisation Functions
void ScummDebugger::attach(Scumm *s)
{
@@ -77,7 +86,7 @@
_s->_sound->pauseSounds(old_soundsPaused); // Resume previous sound state
if (_detach_now) // Detach if we're finished with the debugger
- detach();
+ detach();
}
}
@@ -95,7 +104,8 @@
// Now the fun stuff:
// Command/Variable registration functions
-void ScummDebugger::DVar_Register(char *varname, void *pointer, int type, int optional) {
+void ScummDebugger::DVar_Register(const char *varname, void *pointer, int type, int optional) {
+ assert(_dvar_count < (int)sizeof(_dvars));
strcpy(_dvars[_dvar_count].name, varname);
_dvars[_dvar_count].type = type;
_dvars[_dvar_count].variable = pointer;
@@ -104,7 +114,8 @@
_dvar_count++;
}
-void ScummDebugger::DCmd_Register(char *cmdname, DebugProc pointer) {
+void ScummDebugger::DCmd_Register(const char *cmdname, DebugProc pointer) {
+ assert(_dcmd_count < (int)sizeof(_dcmds));
strcpy(_dcmds[_dcmd_count].name, cmdname);
_dcmds[_dcmd_count].function = pointer;
Index: debugger.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- debugger.h 16 Dec 2002 06:38:29 -0000 1.2
+++ debugger.h 16 Dec 2002 22:46:17 -0000 1.3
@@ -20,8 +20,12 @@
#ifndef DEBUG_H
#define DEBUG_H
+
#define USE_CONSOLE
+
class Scumm;
+class ScummDebugger;
+
typedef bool (ScummDebugger::*DebugProc)();
enum {
@@ -44,21 +48,23 @@
class ScummDebugger {
public:
+ ScummDebugger();
+
void on_frame();
void attach(Scumm *s);
protected:
Scumm *_s;
- int _frame_countdown, _dvar_count, _dcmd_count;
- DVar _dvars[255];
- DCmd _dcmds[255];
+ int _frame_countdown, _dvar_count, _dcmd_count;
+ DVar _dvars[256];
+ DCmd _dcmds[256];
bool _detach_now;
void enter();
- void detach();
+ void detach();
- void DVar_Register(char *varname, void *pointer, int type, int optional);
- void DCmd_Register(char *cmdname, DebugProc pointer);
+ void DVar_Register(const char *varname, void *pointer, int type, int optional);
+ void DCmd_Register(const char *cmdname, DebugProc pointer);
bool RunCommand(char *input);
// Commands
More information about the Scummvm-git-logs
mailing list