mirror of https://github.com/stella-emu/stella.git
Moved DebuggerParser instance variable to Debugger class, since it *belongs*
to the Debugger and only *talks* to the PromptDialog. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@476 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
f37ab61597
commit
90ed128060
|
@ -1,3 +1,20 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: DCmdQuit.cxx,v 1.2 2005-06-09 15:08:21 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "DCmdQuit.hxx"
|
#include "DCmdQuit.hxx"
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: DCmdQuit.hxx,v 1.2 2005-06-09 15:08:21 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DCMDQUIT_HXX
|
#ifndef DCMDQUIT_HXX
|
||||||
#define DCMDQUIT_HXX
|
#define DCMDQUIT_HXX
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: DebuggerCommand.cxx,v 1.2 2005-06-09 15:08:22 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "DebuggerCommand.hxx"
|
#include "DebuggerCommand.hxx"
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: DebuggerCommand.hxx,v 1.2 2005-06-09 15:08:22 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DEBUGGER_COMMAND_HXX
|
#ifndef DEBUGGER_COMMAND_HXX
|
||||||
#define DEBUGGER_COMMAND_HXX
|
#define DEBUGGER_COMMAND_HXX
|
||||||
|
|
|
@ -1,14 +1,37 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: DebuggerParser.cxx,v 1.2 2005-06-09 15:08:22 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "DebuggerParser.hxx"
|
#include "DebuggerParser.hxx"
|
||||||
#include "DebuggerCommand.hxx"
|
#include "DebuggerCommand.hxx"
|
||||||
#include "DCmdQuit.hxx"
|
#include "DCmdQuit.hxx"
|
||||||
|
|
||||||
DebuggerParser::DebuggerParser() {
|
DebuggerParser::DebuggerParser()
|
||||||
|
: quitCmd(NULL)
|
||||||
|
{
|
||||||
done = false;
|
done = false;
|
||||||
quitCmd = new DCmdQuit(this);
|
quitCmd = new DCmdQuit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebuggerParser::~DebuggerParser() {
|
||||||
|
delete quitCmd;
|
||||||
|
}
|
||||||
|
|
||||||
string DebuggerParser::currentAddress() {
|
string DebuggerParser::currentAddress() {
|
||||||
return "currentAddress()";
|
return "currentAddress()";
|
||||||
}
|
}
|
||||||
|
@ -17,7 +40,7 @@ void DebuggerParser::setDone() {
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
string DebuggerParser::run(string command) {
|
string DebuggerParser::run(const string& command) {
|
||||||
if(command == "quit") {
|
if(command == "quit") {
|
||||||
// TODO: use lookup table to determine which DebuggerCommand to run
|
// TODO: use lookup table to determine which DebuggerCommand to run
|
||||||
return quitCmd->execute();
|
return quitCmd->execute();
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: DebuggerParser.hxx,v 1.2 2005-06-09 15:08:22 stephena Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DEBUGGER_PARSER_HXX
|
#ifndef DEBUGGER_PARSER_HXX
|
||||||
#define DEBUGGER_PARSER_HXX
|
#define DEBUGGER_PARSER_HXX
|
||||||
|
@ -9,9 +26,11 @@ class DebuggerParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DebuggerParser();
|
DebuggerParser();
|
||||||
|
~DebuggerParser();
|
||||||
|
|
||||||
string currentAddress();
|
string currentAddress();
|
||||||
void setDone();
|
void setDone();
|
||||||
string run(string command);
|
string run(const string& command);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DebuggerCommand *quitCmd;
|
DebuggerCommand *quitCmd;
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
// SS SS tt ee ll ll aa aa
|
// SS SS tt ee ll ll aa aa
|
||||||
// SSSS ttt eeeee llll llll aaaaa
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
//
|
//
|
||||||
// Copyright (c) 1995-2004 by Bradford W. Mott
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||||
//
|
//
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Console.hxx,v 1.31 2005-05-12 18:45:20 stephena Exp $
|
// $Id: Console.hxx,v 1.32 2005-06-09 15:08:22 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef CONSOLE_HXX
|
#ifndef CONSOLE_HXX
|
||||||
|
@ -35,7 +35,7 @@ class System;
|
||||||
This class represents the entire game console.
|
This class represents the entire game console.
|
||||||
|
|
||||||
@author Bradford W. Mott
|
@author Bradford W. Mott
|
||||||
@version $Id: Console.hxx,v 1.31 2005-05-12 18:45:20 stephena Exp $
|
@version $Id: Console.hxx,v 1.32 2005-06-09 15:08:22 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class Console
|
class Console
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,26 +13,32 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Debugger.cxx,v 1.2 2005-06-03 17:52:06 stephena Exp $
|
// $Id: Debugger.cxx,v 1.3 2005-06-09 15:08:23 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include "bspf.hxx"
|
||||||
|
|
||||||
#include "Version.hxx"
|
#include "Version.hxx"
|
||||||
#include "OSystem.hxx"
|
#include "OSystem.hxx"
|
||||||
#include "FrameBuffer.hxx"
|
#include "FrameBuffer.hxx"
|
||||||
#include "DebuggerDialog.hxx"
|
#include "DebuggerDialog.hxx"
|
||||||
#include "bspf.hxx"
|
#include "DebuggerParser.hxx"
|
||||||
#include "Debugger.hxx"
|
#include "Debugger.hxx"
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Debugger::Debugger(OSystem* osystem)
|
Debugger::Debugger(OSystem* osystem)
|
||||||
: DialogContainer(osystem),
|
: DialogContainer(osystem),
|
||||||
myConsole(NULL)
|
myConsole(NULL),
|
||||||
|
myParser(NULL)
|
||||||
{
|
{
|
||||||
|
// Init parser
|
||||||
|
myParser = new DebuggerParser();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Debugger::~Debugger()
|
Debugger::~Debugger()
|
||||||
{
|
{
|
||||||
|
delete myParser;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -53,3 +59,9 @@ void Debugger::initializeVideo()
|
||||||
string title = string("Stella version ") + STELLA_VERSION + ": Debugger mode";
|
string title = string("Stella version ") + STELLA_VERSION + ": Debugger mode";
|
||||||
myOSystem->frameBuffer().initialize(title, kDebuggerWidth, kDebuggerHeight, false);
|
myOSystem->frameBuffer().initialize(title, kDebuggerWidth, kDebuggerHeight, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
const string Debugger::run(const string& command)
|
||||||
|
{
|
||||||
|
return myParser->run(command);
|
||||||
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Debugger.hxx,v 1.2 2005-06-03 17:52:06 stephena Exp $
|
// $Id: Debugger.hxx,v 1.3 2005-06-09 15:08:23 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DEBUGGER_HXX
|
#ifndef DEBUGGER_HXX
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
class OSystem;
|
class OSystem;
|
||||||
class Console;
|
class Console;
|
||||||
|
class DebuggerParser;
|
||||||
|
|
||||||
#include "DialogContainer.hxx"
|
#include "DialogContainer.hxx"
|
||||||
|
|
||||||
|
@ -30,10 +31,11 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The base dialog for the ROM launcher in Stella.
|
The base dialog for the ROM launcher in Stella. Also acts as the parent
|
||||||
|
for all debugging operations in Stella (parser, etc).
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: Debugger.hxx,v 1.2 2005-06-03 17:52:06 stephena Exp $
|
@version $Id: Debugger.hxx,v 1.3 2005-06-09 15:08:23 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class Debugger : public DialogContainer
|
class Debugger : public DialogContainer
|
||||||
{
|
{
|
||||||
|
@ -59,10 +61,16 @@ class Debugger : public DialogContainer
|
||||||
*/
|
*/
|
||||||
void initializeVideo();
|
void initializeVideo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Run the debugger command and return the result.
|
||||||
|
*/
|
||||||
|
const string run(const string& command);
|
||||||
|
|
||||||
void setConsole(Console* console) { myConsole = console; }
|
void setConsole(Console* console) { myConsole = console; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Console* myConsole;
|
Console* myConsole;
|
||||||
|
DebuggerParser* myParser;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: PromptDialog.cxx,v 1.6 2005-06-09 04:31:45 urchlay Exp $
|
// $Id: PromptDialog.cxx,v 1.7 2005-06-09 15:08:23 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
#include "FrameBuffer.hxx"
|
#include "FrameBuffer.hxx"
|
||||||
#include "EventHandler.hxx"
|
#include "EventHandler.hxx"
|
||||||
#include "Version.hxx"
|
#include "Version.hxx"
|
||||||
|
#include "Debugger.hxx"
|
||||||
|
|
||||||
#include "PromptDialog.hxx"
|
#include "PromptDialog.hxx"
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
PromptDialog::PromptDialog(OSystem* osystem, DialogContainer* parent,
|
PromptDialog::PromptDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
int x, int y, int w, int h)
|
int x, int y, int w, int h)
|
||||||
: Dialog(osystem, parent, x, y, w, h)
|
: Dialog(osystem, parent, x, y, w, h)
|
||||||
{
|
{
|
||||||
_kConsoleCharWidth = instance()->consoleFont().getMaxCharWidth();
|
_kConsoleCharWidth = instance()->consoleFont().getMaxCharWidth();
|
||||||
_kConsoleLineHeight = instance()->consoleFont().getFontHeight() + 2;
|
_kConsoleLineHeight = instance()->consoleFont().getFontHeight() + 2;
|
||||||
|
@ -59,10 +60,6 @@ PromptDialog::PromptDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
_scrollBar = new ScrollBarWidget(this, _w - kScrollBarWidth - 1, 0, kScrollBarWidth, _h);
|
_scrollBar = new ScrollBarWidget(this, _w - kScrollBarWidth - 1, 0, kScrollBarWidth, _h);
|
||||||
_scrollBar->setTarget(this);
|
_scrollBar->setTarget(this);
|
||||||
|
|
||||||
// Init callback
|
|
||||||
_callbackProc = 0;
|
|
||||||
_callbackRefCon = 0;
|
|
||||||
|
|
||||||
// Init History
|
// Init History
|
||||||
_historyIndex = 0;
|
_historyIndex = 0;
|
||||||
_historyLine = 0;
|
_historyLine = 0;
|
||||||
|
@ -72,10 +69,6 @@ PromptDialog::PromptDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
|
|
||||||
_promptStartPos = _promptEndPos = -1;
|
_promptStartPos = _promptEndPos = -1;
|
||||||
|
|
||||||
// Init parser (FIXME: should the parser be a class variable,
|
|
||||||
// instead of an instance variable?
|
|
||||||
parser = new DebuggerParser();
|
|
||||||
|
|
||||||
// Display greetings & prompt
|
// Display greetings & prompt
|
||||||
string version = string("Stella version ") + STELLA_VERSION + "\n";
|
string version = string("Stella version ") + STELLA_VERSION + "\n";
|
||||||
print(version.c_str());
|
print(version.c_str());
|
||||||
|
@ -152,7 +145,6 @@ void PromptDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
|
|
||||||
assert(_promptEndPos >= _promptStartPos);
|
assert(_promptEndPos >= _promptStartPos);
|
||||||
int len = _promptEndPos - _promptStartPos;
|
int len = _promptEndPos - _promptStartPos;
|
||||||
bool keepRunning = true;
|
|
||||||
|
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
|
@ -168,11 +160,8 @@ void PromptDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
// Add the input to the history
|
// Add the input to the history
|
||||||
addToHistory(str);
|
addToHistory(str);
|
||||||
|
|
||||||
// Pass it to the input callback, if any
|
// Pass the command to the debugger, and print the result
|
||||||
if (_callbackProc)
|
print( instance()->debugger().run(str) + "\n" );
|
||||||
keepRunning = (*_callbackProc)(this, str, _callbackRefCon);
|
|
||||||
|
|
||||||
print( parser->run(str) + "\n" );
|
|
||||||
|
|
||||||
// Get rid of the string buffer
|
// Get rid of the string buffer
|
||||||
delete [] str;
|
delete [] str;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: PromptDialog.hxx,v 1.4 2005-06-09 04:31:45 urchlay Exp $
|
// $Id: PromptDialog.hxx,v 1.5 2005-06-09 15:08:23 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -25,10 +25,10 @@
|
||||||
class CommandSender;
|
class CommandSender;
|
||||||
class DialogContainer;
|
class DialogContainer;
|
||||||
class ScrollBarWidget;
|
class ScrollBarWidget;
|
||||||
|
class DebuggerParser;
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "Dialog.hxx"
|
#include "Dialog.hxx"
|
||||||
#include "DebuggerParser.hxx"
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kBufferSize = 32768,
|
kBufferSize = 32768,
|
||||||
|
@ -49,18 +49,6 @@ class PromptDialog : public Dialog
|
||||||
int vprintf(const char *format, va_list argptr);
|
int vprintf(const char *format, va_list argptr);
|
||||||
#undef putchar
|
#undef putchar
|
||||||
void putchar(int c);
|
void putchar(int c);
|
||||||
|
|
||||||
typedef bool (*InputCallbackProc)(PromptDialog *console, const char *input, void *refCon);
|
|
||||||
typedef bool (*CompletionCallbackProc)(PromptDialog* console, const char *input, char*& completion, void *refCon);
|
|
||||||
|
|
||||||
void setInputCallback(InputCallbackProc proc, void *refCon) {
|
|
||||||
_callbackProc = proc;
|
|
||||||
_callbackRefCon = refCon;
|
|
||||||
}
|
|
||||||
void setCompletionCallback(CompletionCallbackProc proc, void *refCon) {
|
|
||||||
_completionCallbackProc = proc;
|
|
||||||
_completionCallbackRefCon = refCon;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline char &buffer(int idx) { return _buffer[idx % kBufferSize]; }
|
inline char &buffer(int idx) { return _buffer[idx % kBufferSize]; }
|
||||||
|
@ -106,16 +94,6 @@ class PromptDialog : public Dialog
|
||||||
int _promptEndPos;
|
int _promptEndPos;
|
||||||
|
|
||||||
ScrollBarWidget* _scrollBar;
|
ScrollBarWidget* _scrollBar;
|
||||||
DebuggerParser* parser;
|
|
||||||
|
|
||||||
// The _callbackProc is called whenver a data line is entered
|
|
||||||
//
|
|
||||||
InputCallbackProc _callbackProc;
|
|
||||||
void *_callbackRefCon;
|
|
||||||
|
|
||||||
// _completionCallbackProc is called when tab is pressed
|
|
||||||
CompletionCallbackProc _completionCallbackProc;
|
|
||||||
void *_completionCallbackRefCon;
|
|
||||||
|
|
||||||
char _history[kHistorySize][kLineBufferSize];
|
char _history[kHistorySize][kLineBufferSize];
|
||||||
int _historySize;
|
int _historySize;
|
||||||
|
|
Loading…
Reference in New Issue