diff options
author | Max Horn | 2003-05-13 23:56:30 +0000 |
---|---|---|
committer | Max Horn | 2003-05-13 23:56:30 +0000 |
commit | f618744799ee9147019b349d7a51a3c21f2aa066 (patch) | |
tree | add5892467a9e5102e2e2abc4592bd1ddea4c953 /scumm | |
parent | 08f7ec192ea6694e2fc0ab0efb6bec5ef5a4b5d2 (diff) | |
download | scummvm-rg350-f618744799ee9147019b349d7a51a3c21f2aa066.tar.gz scummvm-rg350-f618744799ee9147019b349d7a51a3c21f2aa066.tar.bz2 scummvm-rg350-f618744799ee9147019b349d7a51a3c21f2aa066.zip |
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
svn-id: r7490
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/debugger.cpp | 43 | ||||
-rw-r--r-- | scumm/debugger.h | 3 |
2 files changed, 33 insertions, 13 deletions
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index 29470bd4e1..6282bbcd96 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -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::attach(Scumm *s, char *entry) { } 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 @@ void ScummDebugger::on_frame() { } // 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 @@ void ScummDebugger::DCmd_Register(const char *cmdname, DebugProc pointer) { // 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 @@ void ScummDebugger::enter() { 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 } diff --git a/scumm/debugger.h b/scumm/debugger.h index 07a4ec63ec..8aa0eefda3 100644 --- a/scumm/debugger.h +++ b/scumm/debugger.h @@ -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; |