From f00b1f8b833301f57ed9b4152ebb431804cefdd5 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 7 Oct 1999 23:08:48 +0000 Subject: [PATCH] Various SGI portability tweaks. --- src/FDM/JSBSim/FGAircraft.cpp | 15 ++++++++------- src/FDM/JSBSim/FGUtility.h | 2 ++ src/FDM/JSBSim/JSBSim.cpp | 12 ++++++++++++ src/Include/compiler.h | 8 +++++++- src/Main/options.cxx | 4 ++-- src/Time/geocoord.h | 6 +++--- src/Time/moonpos.cxx | 3 +-- src/Time/mymath.h | 11 +++++++---- 8 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/FDM/JSBSim/FGAircraft.cpp b/src/FDM/JSBSim/FGAircraft.cpp index e165cbe0e..bdcd53c4b 100644 --- a/src/FDM/JSBSim/FGAircraft.cpp +++ b/src/FDM/JSBSim/FGAircraft.cpp @@ -168,7 +168,7 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string f while (!aircraftfile.fail()) { holding_string.erase(); aircraftfile >> holding_string; -#ifdef __BORLANDC__ +#if defined(__BORLANDC__) || defined(FG_HAVE_NATIVE_SGI_COMPILERS) if (holding_string.compare(0, 2, "//") != 0) { #else if (holding_string.compare("//",0,2) != 0) { @@ -273,8 +273,8 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string f aircraftfile >> tag; gpos = aircraftfile.tellg(); aircraftfile >> tag; - if (tag != "}" ) { - while (tag != "}") { + if ( !(tag == "}") ) { + while ( !(tag == "}") ) { aircraftfile.seekg(gpos); Coeff[axis][coeff_ctr[axis]] = new FGCoefficient(FDMExec, aircraftfile); coeff_ctr[axis]++; @@ -321,6 +321,7 @@ void FGAircraft::MassChange() { float Xt, Xw, Yt, Yw, Zt, Zw, Tw; float IXXt, IYYt, IZZt, IXZt; + int t; // UPDATE TANK CONTENTS // @@ -335,7 +336,7 @@ void FGAircraft::MassChange() for (int e=0; eGetType()) { case FGEngine::etRocket: @@ -371,7 +372,7 @@ void FGAircraft::MassChange() } Weight = EmptyWeight; - for (int t=0; tGetContents(); Mass = Weight / GRAVITY; @@ -380,7 +381,7 @@ void FGAircraft::MassChange() Xt = Yt = Zt = 0; Xw = Yw = Zw = 0; - for (int t=0; tGetX()*Tank[t]->GetContents(); Yt += Tank[t]->GetY()*Tank[t]->GetContents(); Zt += Tank[t]->GetZ()*Tank[t]->GetContents(); @@ -395,7 +396,7 @@ void FGAircraft::MassChange() // Calculate new moments of inertia here IXXt = IYYt = IZZt = IXZt = 0.0; - for (int t=0; tGetX()-Xcg)/12.0)*((Tank[t]->GetX() - Xcg)/12.0)*Tank[t]->GetContents()/GRAVITY; IYYt += ((Tank[t]->GetY()-Ycg)/12.0)*((Tank[t]->GetY() - Ycg)/12.0)*Tank[t]->GetContents()/GRAVITY; IZZt += ((Tank[t]->GetZ()-Zcg)/12.0)*((Tank[t]->GetZ() - Zcg)/12.0)*Tank[t]->GetContents()/GRAVITY; diff --git a/src/FDM/JSBSim/FGUtility.h b/src/FDM/JSBSim/FGUtility.h index 142e33d3f..6af87c2bb 100644 --- a/src/FDM/JSBSim/FGUtility.h +++ b/src/FDM/JSBSim/FGUtility.h @@ -42,7 +42,9 @@ INCLUDES DEFINES *******************************************************************************/ +#ifndef FGFS using namespace std; +#endif /******************************************************************************* CLASS DECLARATION diff --git a/src/FDM/JSBSim/JSBSim.cpp b/src/FDM/JSBSim/JSBSim.cpp index 3e38cab84..b8922d5e0 100644 --- a/src/FDM/JSBSim/JSBSim.cpp +++ b/src/FDM/JSBSim/JSBSim.cpp @@ -75,8 +75,18 @@ INCLUDES #include "FGAuxiliary.h" #include "FGOutput.h" +#ifdef FGFS +#include +#include STL_IOSTREAM +# ifdef FG_HAVE_STD_INCLUDES +# include +# else +# include +# endif +#else #include #include +#endif int main(int argc, char** argv) { @@ -114,6 +124,8 @@ int main(int argc, char** argv) return 0; } +#ifndef FGFS WinMain() { } +#endif diff --git a/src/Include/compiler.h b/src/Include/compiler.h index 95fd8afcb..6ffa15bcb 100644 --- a/src/Include/compiler.h +++ b/src/Include/compiler.h @@ -57,6 +57,7 @@ # define STL_FUNCTIONAL # define STL_IOMANIP # define STL_IOSTREAM +# define STL_FSTREAM # define STL_STDEXCEPT # define STL_STRING # define STL_STRSTREAM @@ -81,6 +82,7 @@ # define STL_FUNCTIONAL # define STL_IOMANIP # define STL_IOSTREAM +# define STL_FSTREAM # define STL_STDEXCEPT # define STL_STRING # define STL_STRSTREAM @@ -107,6 +109,7 @@ # define STL_FUNCTIONAL # define STL_IOMANIP # define STL_IOSTREAM +# define STL_FSTREAM # define STL_STDEXCEPT # define STL_STRING @@ -134,6 +137,7 @@ # define STL_FUNCTIONAL # define STL_IOMANIP # define STL_IOSTREAM +# define STL_FSTREAM # define STL_STDEXCEPT # define STL_STRING # define STL_STRSTREAM @@ -172,6 +176,7 @@ # endif // HAVE_SGI_STL_PORT # define STL_IOSTREAM +# define STL_FSTREAM # define STL_STRING # define FG_NO_DEFAULT_TEMPLATE_ARGS # define FG_NAMESPACES @@ -195,8 +200,9 @@ # define STL_ALGORITHM # define STL_FUNCTIONAL -# define STL_IOMANIP +# define STL_IOMANIP # define STL_IOSTREAM +# define STL_FSTREAM # define STL_STDEXCEPT # define STL_STRING # define STL_STRSTREAM diff --git a/src/Main/options.cxx b/src/Main/options.cxx index e904e2747..2ac9cb0ca 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -38,12 +38,12 @@ bool global_fullscreen = true; #include STL_STRING +#include +#include #include #include #include -#include #include -#include #ifdef FG_NETWORK_OLK # include #endif diff --git a/src/Time/geocoord.h b/src/Time/geocoord.h index 654980253..c38bab712 100644 --- a/src/Time/geocoord.h +++ b/src/Time/geocoord.h @@ -32,17 +32,17 @@ #ifndef _GEOCOORD_H_ #define _GEOCOORD_H_ -//#include +#include #include #include -#include +#include STL_IOSTREAM //#include // looks like streambuf does not exist on linux. // But it looks like it isn't used anyways -:) #include -using namespace std; +FG_USING_NAMESPACE(std); #include "mymath.h" diff --git a/src/Time/moonpos.cxx b/src/Time/moonpos.cxx index eb0fe7d57..e32df4ac1 100644 --- a/src/Time/moonpos.cxx +++ b/src/Time/moonpos.cxx @@ -51,9 +51,8 @@ #endif -//#include -#include #include +#include #include #include
#include diff --git a/src/Time/mymath.h b/src/Time/mymath.h index 8d1c5a9a4..f2bbbf876 100755 --- a/src/Time/mymath.h +++ b/src/Time/mymath.h @@ -36,11 +36,14 @@ #ifndef _MY_MATH_H_ #define _MY_MATH_H__ -#include -#include -#include -using namespace std; +#include + +#include +#include STL_FSTREAM +#include STL_IOMANIP + +// FG_USING_NAMESPACE(std); #include extern const double PiOver180;