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 <algorithm>
using namespace std;
#define TABLE_WIDTH 16
#define TABLE_SIZE (1 << TABLE_WIDTH)

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* Breakpoint.h
/*
* Breakpoint.h
*/
#ifdef SUPERMODEL_DEBUGGER

View file

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

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* CPUDebug.h
/*
* CPUDebug.h
*/
#ifdef SUPERMODEL_DEBUGGER
@ -30,10 +30,8 @@
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
#include "Types.h"
#include "CodeAnalyser.h"
#include "AddressTable.h"
#include "Breakpoint.h"
@ -220,18 +218,18 @@ namespace Debugger
UINT32 pc;
UINT32 opcode;
vector<CRegister*> regs;
vector<CException*> exceps;
vector<CInterrupt*> inters;
vector<CIO*> ios;
std::vector<CRegister*> regs;
std::vector<CException*> exceps;
std::vector<CInterrupt*> inters;
std::vector<CIO*> ios;
// TODO - should use map<UINT32,T*> for T=CRegion,CLabel&CComment so that look-ups via address are faster
vector<CRegion*> regions;
vector<CLabel*> labels;
vector<CComment*> comments;
vector<CWatch*> memWatches;
vector<CWatch*> ioWatches;
vector<CBreakpoint*> bps;
vector<CRegMonitor*> regMons;
std::vector<CRegion*> regions;
std::vector<CLabel*> labels;
std::vector<CComment*> comments;
std::vector<CWatch*> memWatches;
std::vector<CWatch*> ioWatches;
std::vector<CBreakpoint*> bps;
std::vector<CRegMonitor*> regMons;
virtual ~CCPUDebug();
@ -489,7 +487,7 @@ namespace Debugger
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);

View file

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

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* CodeAnalyser.h
/*
* CodeAnalyser.h
*/
#ifdef SUPERMODEL_DEBUGGER
@ -32,10 +32,8 @@
#include <map>
#include <set>
#include <algorithm>
using namespace std;
#include "Types.h"
#include "Debugger.h"
#include "AddressTable.h"
@ -136,26 +134,26 @@ namespace Debugger
friend class CCodeAnalyser;
private:
vector<CEntryPoint> m_entryPoints;
vector<UINT32> m_unseenEntryAddrs;
vector<bool> m_seenIndices;
vector<bool> m_validIndices;
map<UINT32,CAutoLabel*> m_autoLabelsMap;
std::vector<CEntryPoint> m_entryPoints;
std::vector<UINT32> m_unseenEntryAddrs;
std::vector<bool> m_seenIndices;
std::vector<bool> m_validIndices;
std::map<UINT32,CAutoLabel*> m_autoLabelsMap;
unsigned m_acquired;
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();
public:
CCodeAnalyser *analyser;
set<unsigned> validIndexSet;
vector<CAutoLabel*> autoLabels;
std::set<unsigned> validIndexSet;
std::vector<CAutoLabel*> autoLabels;
~CCodeAnalysis();
@ -179,7 +177,7 @@ namespace Debugger
CAutoLabel *GetAutoLabel(const char *subLabel);
vector<CAutoLabel*> GetAutoLabels(ELabelFlags flag);
std::vector<CAutoLabel*> GetAutoLabels(ELabelFlags flag);
};
/*
@ -194,23 +192,23 @@ namespace Debugger
class CCodeAnalyser
{
private:
vector<CRegion*> m_codeRegions;
vector<unsigned> m_indexBounds;
std::vector<CRegion*> m_codeRegions;
std::vector<unsigned> m_indexBounds;
vector<UINT32> m_customEntryAddrs;
std::vector<UINT32> m_customEntryAddrs;
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);
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:
CCPUDebug *cpu;

File diff suppressed because it is too large Load diff

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* ConsoleDebugger.h
/*
* ConsoleDebugger.h
*/
#ifdef SUPERMODEL_DEBUGGER
@ -130,13 +130,13 @@ namespace Debugger
void ListLabels(bool customLabels, ELabelFlags autoLabelFlags);
void GetAllMemWatches(vector<CWatch*> &watches);
void GetAllMemWatches(std::vector<CWatch*> &watches);
int GetIndexOfMemWatch(CWatch *watch);
void ListMemWatches();
void GetAllPortWatches(vector<CWatch*> &watches);
void GetAllPortWatches(std::vector<CWatch*> &watches);
int GetIndexOfPortWatch(CWatch *watch);

View file

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

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* Debugger.h
/*
* Debugger.h
*/
#ifdef SUPERMODEL_DEBUGGER
@ -31,7 +31,6 @@
#include <stdarg.h>
#include <vector>
#include <algorithm>
using namespace std;
#include "Types.h"
@ -160,7 +159,7 @@ namespace Debugger
virtual void Log(CCPUDebug *cpu, const char *typeStr, const char *fmtStr, va_list vl) = 0;
public:
vector<CCPUDebug*> cpus;
std::vector<CCPUDebug*> cpus;
UINT64 frameCount;

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* Exception.h
/*
* Exception.h
*/
#ifdef SUPERMODEL_DEBUGGER

View file

@ -70,7 +70,7 @@ namespace Debugger
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);
cpu->AddWatch(mWatch);

View file

@ -1,165 +1,165 @@
/**
** Supermodel
** A Sega Model 3 Arcade Emulator.
** Copyright 2011 Bart Trzynadlowski, Nik Henson
**
** This file is part of Supermodel.
**
** Supermodel is free software: you can redistribute it and/or modify it under
** the terms of the GNU General Public License as published by the Free
** Software Foundation, either version 3 of the License, or (at your option)
** any later version.
**
** Supermodel is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
** more details.
**
** You should have received a copy of the GNU General Public License along
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/**
** Supermodel
** A Sega Model 3 Arcade Emulator.
** Copyright 2011 Bart Trzynadlowski, Nik Henson
**
** This file is part of Supermodel.
**
** Supermodel is free software: you can redistribute it and/or modify it under
** the terms of the GNU General Public License as published by the Free
** Software Foundation, either version 3 of the License, or (at your option)
** any later version.
**
** Supermodel is distributed in the hope that it will be useful, but WITHOUT
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
** more details.
**
** You should have received a copy of the GNU General Public License along
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* IO.h
*/
#ifdef SUPERMODEL_DEBUGGER
#ifndef INCLUDED_IO_H
#define INCLUDED_IO_H
#include "Types.h"
#define MAX_LABEL_LENGTH 255
namespace Debugger
{
class CCPUDebug;
class CWatch;
class CSimpleWatch;
class CCountWatch;
class CMatchWatch;
class CPrintWatch;
class CCaptureWatch;
/*
* Base class that represents CPU input/output.
*/
class CIO
{
public:
CCPUDebug *cpu;
const char *name;
const char *group;
unsigned dataSize;
CWatch *watch;
unsigned inCount;
unsigned outCount;
UINT64 lastIn;
UINT64 lastOut;
UINT64 *last;
CIO(CCPUDebug *ioCPU, const char *ioName, const char *ioGroup, unsigned ioDataSize);
void RecordInput(UINT64 data);
void RecordOutput(UINT64 data);
bool CheckInput(UINT64 data);
bool CheckOutput(UINT64 data);
virtual void AddLabel(const char *name) = 0;
virtual void RemoveLabel() = 0;
CSimpleWatch *AddSimpleWatch(bool trigInput, bool trigOutput);
CCountWatch *AddCountWatch(bool trigInput, bool trigOutput, unsigned count);
CMatchWatch *AddMatchWatch(bool trigInput, bool trigOutput, vector<UINT64> &dataSeq);
CPrintWatch *AddPrintWatch(bool trigInput, bool trigOutput);
CCaptureWatch *AddCaptureWatch(bool trigInput, bool trigOutput, unsigned maxLen);
bool RemoveWatch();
virtual void GetLocation(char *str) = 0;
virtual UINT64 Read() = 0;
virtual bool Write(UINT64 data) = 0;
};
/*
* Class that represents a CPU input/ouput port.
*/
class CPortIO : public CIO
{
private:
char labelStr[MAX_LABEL_LENGTH + 1];
public:
const UINT16 portNum;
const char *label;
CPortIO(CCPUDebug *ioCPU, const char *ioName, const char *ioGroup, unsigned ioDataSize, UINT16 ioPortNum);
void AddLabel(const char *pLabel);
void RemoveLabel();
void GetLocation(char *str);
UINT64 Read();
bool Write(UINT64 data);
};
/*
* Class that represents CPU input/output that is mapped to a memory location.
*/
class CMappedIO : public CIO, public CAddressRef
{
public:
CMappedIO(CCPUDebug *ioCPU, const char *ioName, const char *ioGroup, unsigned ioDataSize, UINT32 ioAddr);
bool CheckInput(UINT32 cAddr, unsigned cDataSize, UINT64 data);
bool CheckOutput(UINT32 cAddr, unsigned cDataSize, UINT64 data);
void AddLabel(const char *name);
void RemoveLabel();
void GetLocation(char *str);
UINT64 Read();
bool Write(UINT64 data);
};
//
// Inlined methods
//
inline void CIO::RecordInput(UINT64 data)
{
// Keep track of data coming in
lastIn = data;
last = &lastIn;
}
inline void CIO::RecordOutput(UINT64 data)
{
// Keep track of data going out
lastOut = data;
last = &lastOut;
}
}
#endif // INCLUDED_IO_H
*/
#ifdef SUPERMODEL_DEBUGGER
#ifndef INCLUDED_IO_H
#define INCLUDED_IO_H
#include "Types.h"
#define MAX_LABEL_LENGTH 255
namespace Debugger
{
class CCPUDebug;
class CWatch;
class CSimpleWatch;
class CCountWatch;
class CMatchWatch;
class CPrintWatch;
class CCaptureWatch;
/*
* Base class that represents CPU input/output.
*/
class CIO
{
public:
CCPUDebug *cpu;
const char *name;
const char *group;
unsigned dataSize;
CWatch *watch;
unsigned inCount;
unsigned outCount;
UINT64 lastIn;
UINT64 lastOut;
UINT64 *last;
CIO(CCPUDebug *ioCPU, const char *ioName, const char *ioGroup, unsigned ioDataSize);
void RecordInput(UINT64 data);
void RecordOutput(UINT64 data);
bool CheckInput(UINT64 data);
bool CheckOutput(UINT64 data);
virtual void AddLabel(const char *name) = 0;
virtual void RemoveLabel() = 0;
CSimpleWatch *AddSimpleWatch(bool trigInput, bool trigOutput);
CCountWatch *AddCountWatch(bool trigInput, bool trigOutput, unsigned count);
CMatchWatch *AddMatchWatch(bool trigInput, bool trigOutput, std::vector<UINT64> &dataSeq);
CPrintWatch *AddPrintWatch(bool trigInput, bool trigOutput);
CCaptureWatch *AddCaptureWatch(bool trigInput, bool trigOutput, unsigned maxLen);
bool RemoveWatch();
virtual void GetLocation(char *str) = 0;
virtual UINT64 Read() = 0;
virtual bool Write(UINT64 data) = 0;
};
/*
* Class that represents a CPU input/ouput port.
*/
class CPortIO : public CIO
{
private:
char labelStr[MAX_LABEL_LENGTH + 1];
public:
const UINT16 portNum;
const char *label;
CPortIO(CCPUDebug *ioCPU, const char *ioName, const char *ioGroup, unsigned ioDataSize, UINT16 ioPortNum);
void AddLabel(const char *pLabel);
void RemoveLabel();
void GetLocation(char *str);
UINT64 Read();
bool Write(UINT64 data);
};
/*
* Class that represents CPU input/output that is mapped to a memory location.
*/
class CMappedIO : public CIO, public CAddressRef
{
public:
CMappedIO(CCPUDebug *ioCPU, const char *ioName, const char *ioGroup, unsigned ioDataSize, UINT32 ioAddr);
bool CheckInput(UINT32 cAddr, unsigned cDataSize, UINT64 data);
bool CheckOutput(UINT32 cAddr, unsigned cDataSize, UINT64 data);
void AddLabel(const char *name);
void RemoveLabel();
void GetLocation(char *str);
UINT64 Read();
bool Write(UINT64 data);
};
//
// Inlined methods
//
inline void CIO::RecordInput(UINT64 data)
{
// Keep track of data coming in
lastIn = data;
last = &lastIn;
}
inline void CIO::RecordOutput(UINT64 data)
{
// Keep track of data going out
lastOut = data;
last = &lastOut;
}
}
#endif // INCLUDED_IO_H
#endif // SUPERMODEL_DEBUGGER

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* Interrupt.h
/*
* Interrupt.h
*/
#ifdef SUPERMODEL_DEBUGGER

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* Label.h
/*
* Label.h
*/
#ifdef SUPERMODEL_DEBUGGER

View file

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

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* Register.h
/*
* Register.h
*/
#ifdef SUPERMODEL_DEBUGGER

View file

@ -599,11 +599,11 @@ namespace Debugger
if (!InputIsValid(input))
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())
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
const char *groupLabel = NULL;

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* SupermodelDebugger.h
/*
* SupermodelDebugger.h
*/
#ifdef SUPERMODEL_DEBUGGER

View file

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

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* Watch.h
/*
* Watch.h
*/
#ifdef SUPERMODEL_DEBUGGER
@ -31,7 +31,6 @@
#include "Types.h"
#include <vector>
using namespace std;
namespace Debugger
{
@ -128,9 +127,9 @@ namespace Debugger
unsigned m_counter;
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();