From bb04aa1a32794019d18c0fff321fb97edd4c5e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 10 Apr 2011 10:19:15 +0200 Subject: [PATCH] Linux header cleanups. Windows side will follow. --- library/ContextShared.cpp | 8 ++- library/DFContext.cpp | 5 ++ library/DFContextManager.cpp | 5 ++ library/DFProcess-SHM.cpp | 6 ++ library/DFProcess-linux-SHM.cpp | 10 ++- library/DFProcess-linux-base.cpp | 7 +++ library/DFProcess-linux-wine.cpp | 17 ++++- library/DFProcess-linux.cpp | 10 +++ library/DFProcessEnumerator.cpp | 21 ++++--- library/MicrosoftSTL.cpp | 8 ++- library/VersionInfo.cpp | 10 ++- library/VersionInfoFactory.cpp | 10 ++- library/include/dfhack/DFTypes.h | 6 +- library/modules/Buildings.cpp | 6 ++ library/modules/Constructions.cpp | 6 ++ library/modules/Creatures.cpp | 7 +++ library/modules/Engravings.cpp | 6 ++ library/modules/Gui.cpp | 7 ++- library/modules/Items.cpp | 7 +++ library/modules/Maps.cpp | 9 ++- library/modules/Materials.cpp | 7 +++ library/modules/Translation.cpp | 8 ++- library/modules/Vegetation.cpp | 7 ++- library/modules/WindowIO-linux.cpp | 6 ++ library/modules/World.cpp | 6 ++ library/private/Internal.h | 95 ---------------------------- library/private/PlatformInternal.h | 99 ++++++++++++++++++++++++++++++ tools/supported/position.cpp | 4 +- 28 files changed, 280 insertions(+), 123 deletions(-) create mode 100644 library/private/PlatformInternal.h diff --git a/library/ContextShared.cpp b/library/ContextShared.cpp index 6696dc29b..0dd099b3c 100644 --- a/library/ContextShared.cpp +++ b/library/ContextShared.cpp @@ -1,9 +1,15 @@ #include "Internal.h" + +#include +#include +#include +#include +using namespace std; + #include "private/ContextShared.h" #include "dfhack/VersionInfo.h" #include "dfhack/DFProcess.h" #include "dfhack/DFModule.h" - using namespace DFHack; DFContextShared::DFContextShared() diff --git a/library/DFContext.cpp b/library/DFContext.cpp index 3dc6df74a..03542aad1 100644 --- a/library/DFContext.cpp +++ b/library/DFContext.cpp @@ -24,6 +24,11 @@ distribution. #include "Internal.h" +#include +#include +#include +using namespace std; + #include "dfhack/DFProcess.h" #include "dfhack/DFProcessEnumerator.h" #include "dfhack/DFContext.h" diff --git a/library/DFContextManager.cpp b/library/DFContextManager.cpp index 1bac79794..5ee5e3904 100644 --- a/library/DFContextManager.cpp +++ b/library/DFContextManager.cpp @@ -24,6 +24,11 @@ distribution. #include "Internal.h" +#include +#include +#include +using namespace std; + #include "dfhack/VersionInfoFactory.h" #include "dfhack/DFProcess.h" #include "dfhack/DFProcessEnumerator.h" diff --git a/library/DFProcess-SHM.cpp b/library/DFProcess-SHM.cpp index 65bf43c8d..dd5a92910 100644 --- a/library/DFProcess-SHM.cpp +++ b/library/DFProcess-SHM.cpp @@ -22,6 +22,12 @@ must not be misrepresented as being the original software. distribution. */ #include "Internal.h" +#include +#include +#include +#include +using namespace std; + #include "SHMProcess.h" #include "ProcessFactory.h" #include "dfhack/VersionInfo.h" diff --git a/library/DFProcess-linux-SHM.cpp b/library/DFProcess-linux-SHM.cpp index 09de87439..73addd2c5 100644 --- a/library/DFProcess-linux-SHM.cpp +++ b/library/DFProcess-linux-SHM.cpp @@ -22,6 +22,14 @@ must not be misrepresented as being the original software. distribution. */ #include "Internal.h" +#include "PlatformInternal.h" + +#include +#include +#include +#include +using namespace std; + #include "SHMProcess.h" #include "dfhack/VersionInfo.h" #include "dfhack/DFError.h" @@ -36,7 +44,7 @@ distribution. #include #include #include - +#include using namespace DFHack; SHMProcess::Private::Private(SHMProcess * self_) diff --git a/library/DFProcess-linux-base.cpp b/library/DFProcess-linux-base.cpp index dfa50777e..2fe712379 100644 --- a/library/DFProcess-linux-base.cpp +++ b/library/DFProcess-linux-base.cpp @@ -22,6 +22,13 @@ must not be misrepresented as being the original software. distribution. */ #include "Internal.h" + +#include +#include +#include +#include +using namespace std; + #include "LinuxProcess.h" #include "dfhack/VersionInfo.h" #include "dfhack/DFError.h" diff --git a/library/DFProcess-linux-wine.cpp b/library/DFProcess-linux-wine.cpp index ea5c1bcc4..de4e14e63 100644 --- a/library/DFProcess-linux-wine.cpp +++ b/library/DFProcess-linux-wine.cpp @@ -22,15 +22,28 @@ must not be misrepresented as being the original software. distribution. */ #include "Internal.h" +#include "PlatformInternal.h" + +#include +#include +#include +#include +#include +#include +using namespace std; + #include "LinuxProcess.h" #include "ProcessFactory.h" #include "MicrosoftSTL.h" #include "dfhack/VersionInfo.h" #include "dfhack/DFError.h" +using namespace DFHack; + #include #include -#include -using namespace DFHack; + +#include + namespace { class WineProcess : public LinuxProcessBase diff --git a/library/DFProcess-linux.cpp b/library/DFProcess-linux.cpp index bd4515008..6d91b162d 100644 --- a/library/DFProcess-linux.cpp +++ b/library/DFProcess-linux.cpp @@ -22,12 +22,22 @@ must not be misrepresented as being the original software. distribution. */ #include "Internal.h" +#include "PlatformInternal.h" + +#include +#include +#include +#include +#include +using namespace std; + #include "LinuxProcess.h" #include "ProcessFactory.h" #include "dfhack/VersionInfo.h" #include "dfhack/DFError.h" #include #include +#include using namespace DFHack; namespace { diff --git a/library/DFProcessEnumerator.cpp b/library/DFProcessEnumerator.cpp index 8f2c16583..028eaa1e3 100644 --- a/library/DFProcessEnumerator.cpp +++ b/library/DFProcessEnumerator.cpp @@ -23,6 +23,17 @@ distribution. */ #include "Internal.h" +#include "PlatformInternal.h" + +#include +#include +#include +#include +#include +#include +#include +using namespace std; + #include "ProcessFactory.h" #include "dfhack/VersionInfoFactory.h" @@ -119,24 +130,14 @@ Process * BadProcesses::operator[](uint32_t index) //FIXME: wasteful Process *ProcessEnumerator::Private::GetProcessObject(ProcessID ID) { -/* - Process *p1 = createSHMProcess(ID.pid, meminfo); - if(p1->isIdentified()) - return p1; - else - delete p1; -*/ Process *p2 = createNormalProcess(ID.pid, meminfo); if(p2->isIdentified()) { - //cout << "IS OK" << endl; return p2; } else { - //cout << "ABOUT TO DELETE" << endl; delete p2; - //cout << "AFTER DELETE" << endl; } #ifdef LINUX_BUILD Process *p3 = createWineProcess(ID.pid, meminfo); diff --git a/library/MicrosoftSTL.cpp b/library/MicrosoftSTL.cpp index 9d619600e..227ef7aca 100644 --- a/library/MicrosoftSTL.cpp +++ b/library/MicrosoftSTL.cpp @@ -23,10 +23,16 @@ distribution. */ #include "Internal.h" + +#include +#include +#include +using namespace std; + #include "MicrosoftSTL.h" #include "dfhack/DFProcess.h" #include "dfhack/VersionInfo.h" -#include + using namespace DFHack; void MicrosoftSTL::init(Process* self) diff --git a/library/VersionInfo.cpp b/library/VersionInfo.cpp index 2326da388..2e88be602 100644 --- a/library/VersionInfo.cpp +++ b/library/VersionInfo.cpp @@ -23,15 +23,21 @@ distribution. */ #include "Internal.h" + +#include +#include +#include +#include +using namespace std; + #include "dfhack/VersionInfo.h" #include "dfhack/DFError.h" #include "dfhack/DFProcess.h" -#include +using namespace DFHack; //Inital amount of space in levels vector (since we usually know the number, efficient!) #define NUM_RESERVE_LVLS 20 #define NUM_RESERVE_MOODS 6 -using namespace DFHack; //FIXME: put those in some shared file template