1
0
Fork 0

Various SGI portability tweaks.

This commit is contained in:
curt 1999-10-07 23:08:48 +00:00
parent f7af6787a0
commit f00b1f8b83
8 changed files with 42 additions and 19 deletions

View file

@ -168,7 +168,7 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string f
while (!aircraftfile.fail()) { while (!aircraftfile.fail()) {
holding_string.erase(); holding_string.erase();
aircraftfile >> holding_string; aircraftfile >> holding_string;
#ifdef __BORLANDC__ #if defined(__BORLANDC__) || defined(FG_HAVE_NATIVE_SGI_COMPILERS)
if (holding_string.compare(0, 2, "//") != 0) { if (holding_string.compare(0, 2, "//") != 0) {
#else #else
if (holding_string.compare("//",0,2) != 0) { if (holding_string.compare("//",0,2) != 0) {
@ -273,8 +273,8 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string f
aircraftfile >> tag; aircraftfile >> tag;
gpos = aircraftfile.tellg(); gpos = aircraftfile.tellg();
aircraftfile >> tag; aircraftfile >> tag;
if (tag != "}" ) { if ( !(tag == "}") ) {
while (tag != "}") { while ( !(tag == "}") ) {
aircraftfile.seekg(gpos); aircraftfile.seekg(gpos);
Coeff[axis][coeff_ctr[axis]] = new FGCoefficient(FDMExec, aircraftfile); Coeff[axis][coeff_ctr[axis]] = new FGCoefficient(FDMExec, aircraftfile);
coeff_ctr[axis]++; coeff_ctr[axis]++;
@ -321,6 +321,7 @@ void FGAircraft::MassChange()
{ {
float Xt, Xw, Yt, Yw, Zt, Zw, Tw; float Xt, Xw, Yt, Yw, Zt, Zw, Tw;
float IXXt, IYYt, IZZt, IXZt; float IXXt, IYYt, IZZt, IXZt;
int t;
// UPDATE TANK CONTENTS // UPDATE TANK CONTENTS
// //
@ -335,7 +336,7 @@ void FGAircraft::MassChange()
for (int e=0; e<numEngines; e++) { for (int e=0; e<numEngines; e++) {
Fshortage = Oshortage = 0.0; Fshortage = Oshortage = 0.0;
for (int t=0; t<numTanks; t++) { for (t=0; t<numTanks; t++) {
switch(Engine[e]->GetType()) { switch(Engine[e]->GetType()) {
case FGEngine::etRocket: case FGEngine::etRocket:
@ -371,7 +372,7 @@ void FGAircraft::MassChange()
} }
Weight = EmptyWeight; Weight = EmptyWeight;
for (int t=0; t<numTanks; t++) for (t=0; t<numTanks; t++)
Weight += Tank[t]->GetContents(); Weight += Tank[t]->GetContents();
Mass = Weight / GRAVITY; Mass = Weight / GRAVITY;
@ -380,7 +381,7 @@ void FGAircraft::MassChange()
Xt = Yt = Zt = 0; Xt = Yt = Zt = 0;
Xw = Yw = Zw = 0; Xw = Yw = Zw = 0;
for (int t=0; t<numTanks; t++) { for (t=0; t<numTanks; t++) {
Xt += Tank[t]->GetX()*Tank[t]->GetContents(); Xt += Tank[t]->GetX()*Tank[t]->GetContents();
Yt += Tank[t]->GetY()*Tank[t]->GetContents(); Yt += Tank[t]->GetY()*Tank[t]->GetContents();
Zt += Tank[t]->GetZ()*Tank[t]->GetContents(); Zt += Tank[t]->GetZ()*Tank[t]->GetContents();
@ -395,7 +396,7 @@ void FGAircraft::MassChange()
// Calculate new moments of inertia here // Calculate new moments of inertia here
IXXt = IYYt = IZZt = IXZt = 0.0; IXXt = IYYt = IZZt = IXZt = 0.0;
for (int t=0; t<numTanks; t++) { for (t=0; t<numTanks; t++) {
IXXt += ((Tank[t]->GetX()-Xcg)/12.0)*((Tank[t]->GetX() - Xcg)/12.0)*Tank[t]->GetContents()/GRAVITY; IXXt += ((Tank[t]->GetX()-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; 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; IZZt += ((Tank[t]->GetZ()-Zcg)/12.0)*((Tank[t]->GetZ() - Zcg)/12.0)*Tank[t]->GetContents()/GRAVITY;

View file

@ -42,7 +42,9 @@ INCLUDES
DEFINES DEFINES
*******************************************************************************/ *******************************************************************************/
#ifndef FGFS
using namespace std; using namespace std;
#endif
/******************************************************************************* /*******************************************************************************
CLASS DECLARATION CLASS DECLARATION

View file

@ -75,8 +75,18 @@ INCLUDES
#include "FGAuxiliary.h" #include "FGAuxiliary.h"
#include "FGOutput.h" #include "FGOutput.h"
#ifdef FGFS
#include <Include/compiler.h>
#include STL_IOSTREAM
# ifdef FG_HAVE_STD_INCLUDES
# include <ctime>
# else
# include <time.h>
# endif
#else
#include <iostream> #include <iostream>
#include <ctime> #include <ctime>
#endif
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
@ -114,6 +124,8 @@ int main(int argc, char** argv)
return 0; return 0;
} }
#ifndef FGFS
WinMain() WinMain()
{ {
} }
#endif

View file

@ -57,6 +57,7 @@
# define STL_FUNCTIONAL <functional> # define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip.h> # define STL_IOMANIP <iomanip.h>
# define STL_IOSTREAM <iostream.h> # define STL_IOSTREAM <iostream.h>
# define STL_FSTREAM <fstream.h>
# define STL_STDEXCEPT <stdexcept> # define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string> # define STL_STRING <string>
# define STL_STRSTREAM <strstream.h> # define STL_STRSTREAM <strstream.h>
@ -81,6 +82,7 @@
# define STL_FUNCTIONAL <functional> # define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip> # define STL_IOMANIP <iomanip>
# define STL_IOSTREAM <iostream> # define STL_IOSTREAM <iostream>
# define STL_FSTREAM <fstream>
# define STL_STDEXCEPT <stdexcept> # define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string> # define STL_STRING <string>
# define STL_STRSTREAM <strstream> # define STL_STRSTREAM <strstream>
@ -107,6 +109,7 @@
# define STL_FUNCTIONAL <functional> # define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip> # define STL_IOMANIP <iomanip>
# define STL_IOSTREAM <iostream> # define STL_IOSTREAM <iostream>
# define STL_FSTREAM <fstream>
# define STL_STDEXCEPT <stdexcept> # define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string> # define STL_STRING <string>
@ -134,6 +137,7 @@
# define STL_FUNCTIONAL <functional> # define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip> # define STL_IOMANIP <iomanip>
# define STL_IOSTREAM <iostream> # define STL_IOSTREAM <iostream>
# define STL_FSTREAM <fstream>
# define STL_STDEXCEPT <stdexcept> # define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string> # define STL_STRING <string>
# define STL_STRSTREAM <strstream> # define STL_STRSTREAM <strstream>
@ -172,6 +176,7 @@
# endif // HAVE_SGI_STL_PORT # endif // HAVE_SGI_STL_PORT
# define STL_IOSTREAM <iostream> # define STL_IOSTREAM <iostream>
# define STL_FSTREAM <fstream>
# define STL_STRING <string> # define STL_STRING <string>
# define FG_NO_DEFAULT_TEMPLATE_ARGS # define FG_NO_DEFAULT_TEMPLATE_ARGS
# define FG_NAMESPACES # define FG_NAMESPACES
@ -195,8 +200,9 @@
# define STL_ALGORITHM <algorithm> # define STL_ALGORITHM <algorithm>
# define STL_FUNCTIONAL <functional> # define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip> # define STL_IOMANIP <iomanip.h>
# define STL_IOSTREAM <iostream.h> # define STL_IOSTREAM <iostream.h>
# define STL_FSTREAM <fstream.h>
# define STL_STDEXCEPT <stdexcept> # define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string> # define STL_STRING <string>
# define STL_STRSTREAM <strstream> # define STL_STRSTREAM <strstream>

View file

@ -38,12 +38,12 @@ bool global_fullscreen = true;
#include STL_STRING #include STL_STRING
#include <Debug/logstream.hxx>
#include <Misc/fgstream.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Include/general.hxx> #include <Include/general.hxx>
#include <Cockpit/cockpit.hxx> #include <Cockpit/cockpit.hxx>
#include <Debug/logstream.hxx>
#include <FDM/flight.hxx> #include <FDM/flight.hxx>
#include <Misc/fgstream.hxx>
#ifdef FG_NETWORK_OLK #ifdef FG_NETWORK_OLK
# include <Network/network.h> # include <Network/network.h>
#endif #endif

View file

@ -32,17 +32,17 @@
#ifndef _GEOCOORD_H_ #ifndef _GEOCOORD_H_
#define _GEOCOORD_H_ #define _GEOCOORD_H_
//#include <stl.h> #include <Include/compiler.h>
#include <math.h> #include <math.h>
#include <string> #include <string>
#include <iostream> #include STL_IOSTREAM
//#include <streambuf> // looks like streambuf does not exist on linux. //#include <streambuf> // looks like streambuf does not exist on linux.
// But it looks like it isn't used anyways -:) // But it looks like it isn't used anyways -:)
#include <vector> #include <vector>
using namespace std; FG_USING_NAMESPACE(std);
#include "mymath.h" #include "mymath.h"

View file

@ -51,9 +51,8 @@
#endif #endif
//#include <Astro/orbits.hxx>
#include <Astro/solarsystem.hxx>
#include <Debug/logstream.hxx> #include <Debug/logstream.hxx>
#include <Astro/solarsystem.hxx>
#include <Include/fg_constants.h> #include <Include/fg_constants.h>
#include <Main/views.hxx> #include <Main/views.hxx>
#include <Math/fg_geodesy.hxx> #include <Math/fg_geodesy.hxx>

View file

@ -36,11 +36,14 @@
#ifndef _MY_MATH_H_ #ifndef _MY_MATH_H_
#define _MY_MATH_H__ #define _MY_MATH_H__
#include <math.h>
#include <fstream>
#include <iomanip>
using namespace std; #include <Include/compiler.h>
#include <math.h>
#include STL_FSTREAM
#include STL_IOMANIP
// FG_USING_NAMESPACE(std);
#include <fg_constants.h> #include <fg_constants.h>
extern const double PiOver180; extern const double PiOver180;