diff --git a/stella/src/debugger/ConstExpression.cxx b/stella/src/debugger/ConstExpression.cxx new file mode 100644 index 000000000..c99d5e858 --- /dev/null +++ b/stella/src/debugger/ConstExpression.cxx @@ -0,0 +1,27 @@ +//============================================================================ +// +// 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: ConstExpression.cxx,v 1.1 2005-07-12 17:02:35 stephena Exp $ +//============================================================================ + +#include "Expression.hxx" +#include "ConstExpression.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +ConstExpression::ConstExpression(const int value) + : Expression(0, 0), + myValue(value) +{ +} diff --git a/stella/src/debugger/ConstExpression.hxx b/stella/src/debugger/ConstExpression.hxx new file mode 100644 index 000000000..d0fc8ce99 --- /dev/null +++ b/stella/src/debugger/ConstExpression.hxx @@ -0,0 +1,41 @@ +//============================================================================ +// +// 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: ConstExpression.hxx,v 1.1 2005-07-12 17:02:35 stephena Exp $ +//============================================================================ + +#ifndef CONST_EXPRESSION_HXX +#define CONST_EXPRESSION_HXX + +#include "Expression.hxx" + +/** + This class provides an implementation of an constant expression; + that is, one that consists solely of a constant integer value. + + @author Stephen Anthony + @version $Id: ConstExpression.hxx,v 1.1 2005-07-12 17:02:35 stephena Exp $ +*/ +class ConstExpression : public Expression +{ + public: + ConstExpression(const int value); + int evaluate() { return myValue; } + + private: + int myValue; +}; + +#endif diff --git a/stella/src/debugger/Expression.cxx b/stella/src/debugger/Expression.cxx new file mode 100644 index 000000000..0dd136f3f --- /dev/null +++ b/stella/src/debugger/Expression.cxx @@ -0,0 +1,33 @@ +//============================================================================ +// +// 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: Expression.cxx,v 1.1 2005-07-12 17:02:35 stephena Exp $ +//============================================================================ + +#include "Expression.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Expression::Expression(Expression* lhs, Expression* rhs) + : myLHS(lhs), + myRHS(rhs) +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Expression::~Expression() +{ + delete myLHS; + delete myRHS; +} diff --git a/stella/src/debugger/Expression.hxx b/stella/src/debugger/Expression.hxx new file mode 100644 index 000000000..1c0cd5a1a --- /dev/null +++ b/stella/src/debugger/Expression.hxx @@ -0,0 +1,44 @@ +//============================================================================ +// +// 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: Expression.hxx,v 1.1 2005-07-12 17:02:35 stephena Exp $ +//============================================================================ + +#ifndef EXPRESSION_HXX +#define EXPRESSION_HXX + +/** + This class provides an implementation of an expression node, which + is a construct that is given two other expressions and evaluates and + returns the result. When placed in a tree, a collection of such nodes + can represent complex expression statements. + + @author Stephen Anthony + @version $Id: Expression.hxx,v 1.1 2005-07-12 17:02:35 stephena Exp $ +*/ +class Expression +{ + public: + Expression(Expression* lhs, Expression* rhs); + virtual ~Expression(); + + virtual int evaluate() = 0; + + protected: + Expression* myLHS; + Expression* myRHS; +}; + +#endif diff --git a/stella/src/debugger/module.mk b/stella/src/debugger/module.mk index 6b2ed169f..dde32993a 100644 --- a/stella/src/debugger/module.mk +++ b/stella/src/debugger/module.mk @@ -4,6 +4,8 @@ MODULE_OBJS := \ src/debugger/Debugger.o \ src/debugger/DebuggerParser.o \ src/debugger/EquateList.o \ + src/debugger/Expression.o \ + src/debugger/ConstExpression.o \ src/debugger/PackedBitArray.o \ src/debugger/CpuDebug.o \ src/debugger/RamDebug.o \