[Scummvm-cvs-logs] CVS: scummvm/scumm debugger.cpp,1.35,1.36 debugger.h,1.19,1.20
Max Horn
fingolfin at users.sourceforge.net
Tue May 13 17:09:04 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.85,1.86 costume.cpp,1.39,1.40 debug.cpp,1.14,1.15 debugger.cpp,1.34,1.35 gfx.cpp,2.95,2.96 object.cpp,1.91,1.92 resource.cpp,1.76,1.77 saveload.cpp,1.66,1.67 script_v2.cpp,2.61,2.62 script_v5.cpp,1.76,1.77 script_v6.cpp,1.110,1.111 script_v8.cpp,2.153,2.154 scumm.h,1.186,1.187 scummvm.cpp,2.141,2.142
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm debug.cpp,1.15,1.16 debugger.cpp,1.36,1.37 debugger.h,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv25556
Modified Files:
debugger.cpp debugger.h
Log Message:
make it possible to use stdio for the debugger, instead of the console dialog (useful because the console is very narrow, which is annoying when using e.g. the 'box' command
Index: debugger.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- debugger.cpp 13 May 2003 23:42:39 -0000 1.35
+++ debugger.cpp 13 May 2003 23:56:30 -0000 1.36
@@ -26,12 +26,7 @@
#include "common/util.h"
#include "common/file.h"
-// The new debugger doesn't actually have the guts for text console coded yet ;)
-
-#define USE_CONSOLE
-
-// Choose between text console or ScummConsole
-#ifdef USE_CONSOLE
+#if USE_CONSOLE
#include "gui/console.h"
#define Debug_Printf _s->_debuggerDialog->printf
#else
@@ -107,7 +102,7 @@
}
void ScummDebugger::detach() {
-#ifdef USE_CONSOLE
+#if USE_CONSOLE
if (_s->_debuggerDialog) {
_s->_debuggerDialog->setInputeCallback(0, 0);
_s->_debuggerDialog->setCompletionCallback(0, 0);
@@ -141,7 +136,7 @@
}
// Console handler
-#ifdef USE_CONSOLE
+#if USE_CONSOLE
bool ScummDebugger::debuggerInputCallback(ConsoleDialog *console, const char *input, void *refCon) {
ScummDebugger *debugger = (ScummDebugger *)refCon;
@@ -181,7 +176,7 @@
// Main Debugger Loop
void ScummDebugger::enter() {
-#ifdef USE_CONSOLE
+#if USE_CONSOLE
if (!_s->_debuggerDialog) {
_s->_debuggerDialog = new ConsoleDialog(_s->_newgui, _s->_screenWidth);
@@ -199,10 +194,34 @@
this);
_s->_debuggerDialog->runModal();
#else
+ // TODO: compared to the console input, this here is very bare bone.
+ // For example, no support for tab completion and no history. At least
+ // we should re-add (optional) support for the readline library.
+ // Or maybe instead of choosing between a console dialog and stdio,
+ // we should move that choice into the ConsoleDialog class - that is,
+ // the console dialog code could be #ifdef'ed to not print to the dialog
+ // but rather to stdio. This way, we could also reuse the command history
+ // and tab completion of the console. It would still require a lot of
+ // work, but at least no dependency on a 3rd party library...
+
printf("Debugger entered, please switch to this console for input.\n");
-// while(1) {
-// ;
-// }
+
+ int i;
+ char buf[256];
+
+ do {
+ printf("debug> ");
+ if (!fgets(buf, sizeof(buf), stdin))
+ continue;
+
+ i = strlen(buf);
+ while (i > 0 && buf[i - 1] == '\n')
+ buf[--i] = 0;
+
+ if (i == 0)
+ continue;
+ } while(RunCommand(buf));
+
#endif
}
Index: debugger.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- debugger.h 3 May 2003 21:49:19 -0000 1.19
+++ debugger.h 13 May 2003 23:56:30 -0000 1.20
@@ -21,7 +21,8 @@
#ifndef DEBUG_H
#define DEBUG_H
-#define USE_CONSOLE
+// Choose between text console or ScummConsole
+#define USE_CONSOLE 1
class Scumm;
class ScummDebugger;
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.85,1.86 costume.cpp,1.39,1.40 debug.cpp,1.14,1.15 debugger.cpp,1.34,1.35 gfx.cpp,2.95,2.96 object.cpp,1.91,1.92 resource.cpp,1.76,1.77 saveload.cpp,1.66,1.67 script_v2.cpp,2.61,2.62 script_v5.cpp,1.76,1.77 script_v6.cpp,1.110,1.111 script_v8.cpp,2.153,2.154 scumm.h,1.186,1.187 scummvm.cpp,2.141,2.142
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm debug.cpp,1.15,1.16 debugger.cpp,1.36,1.37 debugger.h,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list