Remove using namespace std from the header files ..

This commit is contained in:
Ian Curtis 2018-01-21 15:09:11 +00:00
parent 8266eecabb
commit 571d1060ee
21 changed files with 2986 additions and 2982 deletions

View file

@ -31,7 +31,6 @@
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
using namespace std;
#define TABLE_WIDTH 16 #define TABLE_WIDTH 16
#define TABLE_SIZE (1 << TABLE_WIDTH) #define TABLE_SIZE (1 << TABLE_WIDTH)

View file

@ -32,6 +32,8 @@
#include <cctype> #include <cctype>
#include <string> #include <string>
using namespace std;
namespace Debugger namespace Debugger
{ {
CCPUDebug::CCPUDebug(const char *cpuType, const char *cpuName, CCPUDebug::CCPUDebug(const char *cpuType, const char *cpuName,

View file

@ -30,10 +30,8 @@
#include <stdio.h> #include <stdio.h>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
using namespace std;
#include "Types.h" #include "Types.h"
#include "CodeAnalyser.h" #include "CodeAnalyser.h"
#include "AddressTable.h" #include "AddressTable.h"
#include "Breakpoint.h" #include "Breakpoint.h"
@ -220,18 +218,18 @@ namespace Debugger
UINT32 pc; UINT32 pc;
UINT32 opcode; UINT32 opcode;
vector<CRegister*> regs; std::vector<CRegister*> regs;
vector<CException*> exceps; std::vector<CException*> exceps;
vector<CInterrupt*> inters; std::vector<CInterrupt*> inters;
vector<CIO*> ios; std::vector<CIO*> ios;
// TODO - should use map<UINT32,T*> for T=CRegion,CLabel&CComment so that look-ups via address are faster // TODO - should use map<UINT32,T*> for T=CRegion,CLabel&CComment so that look-ups via address are faster
vector<CRegion*> regions; std::vector<CRegion*> regions;
vector<CLabel*> labels; std::vector<CLabel*> labels;
vector<CComment*> comments; std::vector<CComment*> comments;
vector<CWatch*> memWatches; std::vector<CWatch*> memWatches;
vector<CWatch*> ioWatches; std::vector<CWatch*> ioWatches;
vector<CBreakpoint*> bps; std::vector<CBreakpoint*> bps;
vector<CRegMonitor*> regMons; std::vector<CRegMonitor*> regMons;
virtual ~CCPUDebug(); virtual ~CCPUDebug();
@ -489,7 +487,7 @@ namespace Debugger
CCountWatch *AddCountMemWatch(UINT32 addr, UINT32 size, bool trigRead, bool trigWrite, unsigned count); CCountWatch *AddCountMemWatch(UINT32 addr, UINT32 size, bool trigRead, bool trigWrite, unsigned count);
CMatchWatch *AddMatchMemWatch(UINT32 addr, UINT32 size, bool trigRead, bool trigWrite, vector<UINT64> &dataSeq); CMatchWatch *AddMatchMemWatch(UINT32 addr, UINT32 size, bool trigRead, bool trigWrite, std::vector<UINT64> &dataSeq);
CPrintWatch *AddPrintMemWatch(UINT32 addr, UINT32 size, bool trigRead, bool trigWrite); CPrintWatch *AddPrintMemWatch(UINT32 addr, UINT32 size, bool trigRead, bool trigWrite);

View file

@ -32,6 +32,8 @@
#include <cctype> #include <cctype>
#include <string> #include <string>
using namespace std;
namespace Debugger namespace Debugger
{ {
CEntryPoint::CEntryPoint(const CEntryPoint &other) : addr(other.addr), autoFlag(other.autoFlag) CEntryPoint::CEntryPoint(const CEntryPoint &other) : addr(other.addr), autoFlag(other.autoFlag)

View file

@ -32,10 +32,8 @@
#include <map> #include <map>
#include <set> #include <set>
#include <algorithm> #include <algorithm>
using namespace std;
#include "Types.h" #include "Types.h"
#include "Debugger.h" #include "Debugger.h"
#include "AddressTable.h" #include "AddressTable.h"
@ -136,26 +134,26 @@ namespace Debugger
friend class CCodeAnalyser; friend class CCodeAnalyser;
private: private:
vector<CEntryPoint> m_entryPoints; std::vector<CEntryPoint> m_entryPoints;
vector<UINT32> m_unseenEntryAddrs; std::vector<UINT32> m_unseenEntryAddrs;
vector<bool> m_seenIndices; std::vector<bool> m_seenIndices;
vector<bool> m_validIndices; std::vector<bool> m_validIndices;
map<UINT32,CAutoLabel*> m_autoLabelsMap; std::map<UINT32,CAutoLabel*> m_autoLabelsMap;
unsigned m_acquired; unsigned m_acquired;
CCodeAnalysis(CCodeAnalyser *aAnalyser); CCodeAnalysis(CCodeAnalyser *aAnalyser);
CCodeAnalysis(CCodeAnalyser *aAnalyser, unsigned aTotalIndices, vector<CEntryPoint> &entryPoints, vector<UINT32> &m_unseenEntryAddrs); CCodeAnalysis(CCodeAnalyser *aAnalyser, unsigned aTotalIndices, std::vector<CEntryPoint> &entryPoints, std::vector<UINT32> &m_unseenEntryAddrs);
CCodeAnalysis(CCodeAnalysis *oldAnalysis, vector<CEntryPoint> &entryPoints, vector<UINT32> &m_unseenEntryAddrs); CCodeAnalysis(CCodeAnalysis *oldAnalysis, std::vector<CEntryPoint> &entryPoints, std::vector<UINT32> &m_unseenEntryAddrs);
void FinishAnalysis(); void FinishAnalysis();
public: public:
CCodeAnalyser *analyser; CCodeAnalyser *analyser;
set<unsigned> validIndexSet; std::set<unsigned> validIndexSet;
vector<CAutoLabel*> autoLabels; std::vector<CAutoLabel*> autoLabels;
~CCodeAnalysis(); ~CCodeAnalysis();
@ -179,7 +177,7 @@ namespace Debugger
CAutoLabel *GetAutoLabel(const char *subLabel); CAutoLabel *GetAutoLabel(const char *subLabel);
vector<CAutoLabel*> GetAutoLabels(ELabelFlags flag); std::vector<CAutoLabel*> GetAutoLabels(ELabelFlags flag);
}; };
/* /*
@ -194,23 +192,23 @@ namespace Debugger
class CCodeAnalyser class CCodeAnalyser
{ {
private: private:
vector<CRegion*> m_codeRegions; std::vector<CRegion*> m_codeRegions;
vector<unsigned> m_indexBounds; std::vector<unsigned> m_indexBounds;
vector<UINT32> m_customEntryAddrs; std::vector<UINT32> m_customEntryAddrs;
bool m_abortAnalysis; bool m_abortAnalysis;
void CheckEntryPoints(vector<CEntryPoint> &entryPoints, vector<UINT32> &unseenEntryAddrs, vector<CEntryPoint> &prevPoints, void CheckEntryPoints(std::vector<CEntryPoint> &entryPoints, std::vector<UINT32> &unseenEntryAddrs, std::vector<CEntryPoint> &prevPoints,
bool &needsAnalysis, bool &reanalyse); bool &needsAnalysis, bool &reanalyse);
void GatherEntryPoints(vector<CEntryPoint> &entryPoints, vector<UINT32> &unseenEntryAddrs, bool &reanalyse); void GatherEntryPoints(std::vector<CEntryPoint> &entryPoints, std::vector<UINT32> &unseenEntryAddrs, bool &reanalyse);
void AddEntryPoint(vector<CEntryPoint> &entryPoints, UINT32 addr, ELabelFlags autoFlag, const char *autoLabel); void AddEntryPoint(std::vector<CEntryPoint> &entryPoints, UINT32 addr, ELabelFlags autoFlag, const char *autoLabel);
void AnalyseCode(vector<bool> &seenIndices, vector<bool> &validIndices, set<unsigned> &validIndexSet, map<UINT32,CAutoLabel*> &autoLabelsMap, UINT32 addr); void AnalyseCode(std::vector<bool> &seenIndices, std::vector<bool> &validIndices, std::set<unsigned> &validIndexSet, std::map<UINT32, CAutoLabel*> &autoLabelsMap, UINT32 addr);
void AddFlagToAddr(map<UINT32,CAutoLabel*> &autoLabelsMap, UINT32 addr, ELabelFlags autoFlag, const char *autoLabel); void AddFlagToAddr(std::map<UINT32, CAutoLabel*> &autoLabelsMap, UINT32 addr, ELabelFlags autoFlag, const char *autoLabel);
public: public:
CCPUDebug *cpu; CCPUDebug *cpu;

View file

@ -33,6 +33,8 @@
#include <cctype> #include <cctype>
#include <string> #include <string>
using namespace std;
namespace Debugger namespace Debugger
{ {
CConsoleDebugger::CConsoleDebugger() : CDebugger(), CConsoleDebugger::CConsoleDebugger() : CDebugger(),
@ -1605,7 +1607,7 @@ namespace Debugger
Print("General:\n"); Print("General:\n");
Print(fmt, "p", "print[.<size>=v]", "<expr> [(h)ex|hexdo(l)lar|hex(p)osth|(d)ecimal|(b)inary]"); Print(fmt, "p", "print[.<size>=v]", "<expr> [(h)ex|hexdo(l)lar|hex(p)osth|(d)ecimal|(b)inary]");
Print(fmt, "cfg", "configure", "<options...>"); Print(fmt, "cfg", "configure", "<options...>");
Print(fmt, "ls", "loststate", "<filename>"); Print(fmt, "ls", "loadstate", "<filename>");
Print(fmt, "ss", "savestate", "<filename>"); Print(fmt, "ss", "savestate", "<filename>");
Print(fmt, "h", "help", ""); Print(fmt, "h", "help", "");
Print(fmt, "x", "exit", ""); Print(fmt, "x", "exit", "");
@ -1680,7 +1682,9 @@ namespace Debugger
else else
{ {
pos++; pos++;
if (pos == '\0') // BEGIN
if (*pos == '\0')
// END
return false; return false;
strncpy(modifier, pos, modSize); strncpy(modifier, pos, modSize);
modifier[modSize] = '\0'; modifier[modSize] = '\0';
@ -2441,7 +2445,7 @@ namespace Debugger
// In the absence of code analyser, try to align code with current PC address // In the absence of code analyser, try to align code with current PC address
if (m_cpu->instrCount > 0 && pc >= start && pc <= end) if (m_cpu->instrCount > 0 && pc >= start && pc <= end)
{ {
unsigned count = m_cpu->instrCount; UINT64 count = m_cpu->instrCount;
while (start < end && count-- > 0) while (start < end && count-- > 0)
{ {
bool okay = false; bool okay = false;

View file

@ -130,13 +130,13 @@ namespace Debugger
void ListLabels(bool customLabels, ELabelFlags autoLabelFlags); void ListLabels(bool customLabels, ELabelFlags autoLabelFlags);
void GetAllMemWatches(vector<CWatch*> &watches); void GetAllMemWatches(std::vector<CWatch*> &watches);
int GetIndexOfMemWatch(CWatch *watch); int GetIndexOfMemWatch(CWatch *watch);
void ListMemWatches(); void ListMemWatches();
void GetAllPortWatches(vector<CWatch*> &watches); void GetAllPortWatches(std::vector<CWatch*> &watches);
int GetIndexOfPortWatch(CWatch *watch); int GetIndexOfPortWatch(CWatch *watch);

View file

@ -31,6 +31,8 @@
#include <cctype> #include <cctype>
#include <string> #include <string>
using namespace std;
namespace Debugger namespace Debugger
{ {
unsigned CDebugger::GetDataSize(UINT64 data) unsigned CDebugger::GetDataSize(UINT64 data)

View file

@ -31,7 +31,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
using namespace std;
#include "Types.h" #include "Types.h"
@ -160,7 +159,7 @@ namespace Debugger
virtual void Log(CCPUDebug *cpu, const char *typeStr, const char *fmtStr, va_list vl) = 0; virtual void Log(CCPUDebug *cpu, const char *typeStr, const char *fmtStr, va_list vl) = 0;
public: public:
vector<CCPUDebug*> cpus; std::vector<CCPUDebug*> cpus;
UINT64 frameCount; UINT64 frameCount;

View file

@ -70,7 +70,7 @@ namespace Debugger
return cWatch; return cWatch;
} }
CMatchWatch *CIO::AddMatchWatch(bool trigInput, bool trigOutput, vector<UINT64> &dataSeq) CMatchWatch *CIO::AddMatchWatch(bool trigInput, bool trigOutput, std::vector<UINT64> &dataSeq)
{ {
CMatchWatch *mWatch = new CMatchWatch(cpu, this, trigInput, trigOutput, dataSeq); CMatchWatch *mWatch = new CMatchWatch(cpu, this, trigInput, trigOutput, dataSeq);
cpu->AddWatch(mWatch); cpu->AddWatch(mWatch);

View file

@ -78,7 +78,7 @@ namespace Debugger
CCountWatch *AddCountWatch(bool trigInput, bool trigOutput, unsigned count); CCountWatch *AddCountWatch(bool trigInput, bool trigOutput, unsigned count);
CMatchWatch *AddMatchWatch(bool trigInput, bool trigOutput, vector<UINT64> &dataSeq); CMatchWatch *AddMatchWatch(bool trigInput, bool trigOutput, std::vector<UINT64> &dataSeq);
CPrintWatch *AddPrintWatch(bool trigInput, bool trigOutput); CPrintWatch *AddPrintWatch(bool trigInput, bool trigOutput);

View file

@ -297,7 +297,7 @@ namespace Debugger
{ {
if (index >= dataWidth) if (index >= dataWidth)
exit(1); exit(1);
numBits = max<unsigned>(numBits, index); numBits = std::max<unsigned>(numBits, index);
return m_bitChrs[index]; return m_bitChrs[index];
} }

View file

@ -599,11 +599,11 @@ namespace Debugger
if (!InputIsValid(input)) if (!InputIsValid(input))
continue; continue;
idAndLabelWidth = max<size_t>(idAndLabelWidth, strlen(input->id) + strlen(input->label) + 3); idAndLabelWidth = std::max<size_t>(idAndLabelWidth, strlen(input->id) + strlen(input->label) + 3);
if (!input->IsVirtual()) if (!input->IsVirtual())
mappingWidth = max<size_t>(mappingWidth, strlen(input->GetMapping())); mappingWidth = std::max<size_t>(mappingWidth, strlen(input->GetMapping()));
} }
mappingWidth = min<size_t>(mappingWidth, 20); mappingWidth = std::min<size_t>(mappingWidth, 20);
// Print labels, mappings and values for each input // Print labels, mappings and values for each input
const char *groupLabel = NULL; const char *groupLabel = NULL;

View file

@ -29,9 +29,10 @@
#include "Debugger.h" #include "Debugger.h"
#include "IO.h" #include "IO.h"
#include "Watch.h" #include "Watch.h"
#include <string> #include <string>
using namespace std;
namespace Debugger namespace Debugger
{ {
UINT32 CWatch::GetIOAddress(CIO *io) UINT32 CWatch::GetIOAddress(CIO *io)

View file

@ -31,7 +31,6 @@
#include "Types.h" #include "Types.h"
#include <vector> #include <vector>
using namespace std;
namespace Debugger namespace Debugger
{ {
@ -128,9 +127,9 @@ namespace Debugger
unsigned m_counter; unsigned m_counter;
public: public:
CMatchWatch(CCPUDebug *wCPU, UINT32 wAddr, unsigned wSize, bool wTrigRead, bool wTrigWrite, vector<UINT64> &dataSeq); CMatchWatch(CCPUDebug *wCPU, UINT32 wAddr, unsigned wSize, bool wTrigRead, bool wTrigWrite, std::vector<UINT64> &dataSeq);
CMatchWatch(CCPUDebug *wCPU, CIO *wIO, bool wTrigInput, bool wTrigOutput, vector<UINT64> &dataSeq); CMatchWatch(CCPUDebug *wCPU, CIO *wIO, bool wTrigInput, bool wTrigOutput, std::vector<UINT64> &dataSeq);
~CMatchWatch(); ~CMatchWatch();