From ba926bc4f67426a14cfd95ab088ac9bdd32b6a4f Mon Sep 17 00:00:00 2001 From: stephena Date: Sat, 25 Oct 2014 20:14:09 +0000 Subject: [PATCH] Made some more methods const. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3015 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/debugger/CpuDebug.hxx | 30 ++++++++++++++---------------- src/debugger/TIADebug.cxx | 10 +++++----- src/debugger/TIADebug.hxx | 16 ++++++++-------- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/src/debugger/CpuDebug.hxx b/src/debugger/CpuDebug.hxx index 441f3d25c..46e0eae6e 100644 --- a/src/debugger/CpuDebug.hxx +++ b/src/debugger/CpuDebug.hxx @@ -20,15 +20,13 @@ #ifndef CPU_DEBUG_HXX #define CPU_DEBUG_HXX -class EquateList; - #include "Array.hxx" #include "M6502.hxx" #include "System.hxx" #include "DebuggerSystem.hxx" // pointer types for CpuDebug instance methods -typedef int (CpuDebug::*CPUDEBUG_INT_METHOD)(); +typedef int (CpuDebug::*CPUDEBUG_INT_METHOD)() const; // call the pointed-to method on the (global) CPU debugger object. #define CALL_CPUDEBUG_METHOD(method) ( ( Debugger::debugger().cpuDebug().*method)() ) @@ -50,25 +48,25 @@ class CpuDebug : public DebuggerSystem const DebuggerState& getOldState() { return myOldState; } void saveOldState(); - string toString() { return ""; } // Not needed, since CPU stuff is always visible + string toString() { return EmptyString; } // Not needed, since CPU stuff is always visible // I know, we ain't supposed to do this... M6502& m6502() const { return mySystem.m6502(); } - int pc() { return mySystem.m6502().PC; } - int sp() { return mySystem.m6502().SP; } - int a() { return mySystem.m6502().A; } - int x() { return mySystem.m6502().X; } - int y() { return mySystem.m6502().Y; } + int pc() const { return mySystem.m6502().PC; } + int sp() const { return mySystem.m6502().SP; } + int a() const { return mySystem.m6502().A; } + int x() const { return mySystem.m6502().X; } + int y() const { return mySystem.m6502().Y; } // These return int, not boolean! - int n() { return mySystem.m6502().N; } - int v() { return mySystem.m6502().V; } - int b() { return mySystem.m6502().B; } - int d() { return mySystem.m6502().D; } - int i() { return mySystem.m6502().I; } - int z() { return !mySystem.m6502().notZ; } - int c() { return mySystem.m6502().C; } + int n() const { return mySystem.m6502().N; } + int v() const { return mySystem.m6502().V; } + int b() const { return mySystem.m6502().B; } + int d() const { return mySystem.m6502().D; } + int i() const { return mySystem.m6502().I; } + int z() const { return !mySystem.m6502().notZ; } + int c() const { return mySystem.m6502().C; } void setPC(int pc); void setSP(int sp); diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index 6817d6223..3c1b0ff0b 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -657,31 +657,31 @@ uInt8 TIADebug::hmBL(int newVal) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int TIADebug::frameCount() +int TIADebug::frameCount() const { return myTIA.myFrameCounter; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int TIADebug::scanlines() +int TIADebug::scanlines() const { return myTIA.scanlines(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int TIADebug::clocksThisLine() +int TIADebug::clocksThisLine() const { return myTIA.clocksThisLine(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool TIADebug::vsync() +bool TIADebug::vsync() const { return (myTIA.myVSYNC & 2) == 2; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool TIADebug::vblank() +bool TIADebug::vblank() const { return (myTIA.myVBLANK & 2) == 2; } diff --git a/src/debugger/TIADebug.hxx b/src/debugger/TIADebug.hxx index 9466631b7..4647c833e 100644 --- a/src/debugger/TIADebug.hxx +++ b/src/debugger/TIADebug.hxx @@ -30,7 +30,7 @@ class TIA; // pointer types for TIADebug instance methods // (used by TiaMethodExpression) class TIADebug; -typedef int (TIADebug::*TIADEBUG_INT_METHOD)(); +typedef int (TIADebug::*TIADEBUG_INT_METHOD)() const; // call the pointed-to method on the (global) debugger object. #define CALL_TIADEBUG_METHOD(method) ( ( Debugger::debugger().tiaDebug().*method)() ) @@ -155,13 +155,13 @@ class TIADebug : public DebuggerSystem void strobeCxclr() { mySystem.poke(CXCLR, 0); } // Read-only internal TIA state - int scanlines(); - int frameCount(); - int clocksThisLine(); - bool vsync(); - bool vblank(); - int vsyncAsInt() { return int(vsync()); } // so we can use _vsync pseudo-register - int vblankAsInt() { return int(vblank()); } // so we can use _vblank pseudo-register + int scanlines() const; + int frameCount() const; + int clocksThisLine() const; + bool vsync() const; + bool vblank() const; + int vsyncAsInt() const { return int(vsync()); } // so we can use _vsync pseudo-register + int vblankAsInt() const { return int(vblank()); } // so we can use _vblank pseudo-register private: /** Display a color patch for color at given index in the palette */