]> git.mxchange.org Git - flightgear.git/commitdiff
Added initial support for native SGI compilers.
authorcurt <curt>
Fri, 26 Feb 1999 22:09:10 +0000 (22:09 +0000)
committercurt <curt>
Fri, 26 Feb 1999 22:09:10 +0000 (22:09 +0000)
Integrated Jon's next version of JSBsim.

27 files changed:
FDM/JSBsim.cxx
FDM/Makefile.am
FDM/flight.cxx
JSBsim/FGAircraft.cpp
JSBsim/FGAircraft.h
JSBsim/FGAtmosphere.cpp
JSBsim/FGAuxiliary.cpp
JSBsim/FGCoefficient.cpp
JSBsim/FGCoefficient.h
JSBsim/FGEngine.cpp
JSBsim/FGEngine.h
JSBsim/FGFCS.cpp
JSBsim/FGFDMExec.cpp
JSBsim/FGMain.cpp
JSBsim/FGModel.h
JSBsim/FGOutput.cpp
JSBsim/FGPosition.cpp
JSBsim/FGRotation.cpp
JSBsim/FGRotation.h
JSBsim/FGState.cpp
JSBsim/FGState.h
JSBsim/FGTank.cpp
JSBsim/FGTank.h
JSBsim/FGTranslation.cpp
JSBsim/FGTranslation.h
JSBsim/FGUtility.cpp
JSBsim/Makefile.am

index d1b5d001ff5767d4611395bb0c30cc39a61ceaa9..4872c6b9dbcbc2463625c2dbedaa6186f843ed8f 100644 (file)
 // (Log is kept at end of this file)
 
 
+#include <Include/compiler.h>
+
+#include STL_STRING
+
+#include <Aircraft/aircraft.hxx>
+#include <Controls/controls.hxx>
+#include <Debug/logstream.hxx>
+#include <Include/fg_constants.h>
+#include <Main/options.hxx>
+#include <Math/fg_geodesy.hxx>
+
 #include <FDM/JSBsim/FGFDMExec.h>
 #include <FDM/JSBsim/FGAircraft.h>
 #include <FDM/JSBsim/FGFCS.h>
 
 #include "JSBsim.hxx"
 
-#include <Aircraft/aircraft.hxx>
-#include <Controls/controls.hxx>
-#include <Debug/logstream.hxx>
-#include <Include/fg_constants.h>
-#include <Math/fg_geodesy.hxx>
-
 
 // The default aircraft
 FGFDMExec FDMExec;
@@ -50,10 +55,13 @@ int fgJSBsimInit(double dt) {
 
     FG_LOG( FG_FLIGHT, FG_INFO, "  created FDMExec" );
 
-    FDMExec.GetAircraft()->LoadAircraft("X15");
+    string aircraft_path = current_options.get_fg_root() + "/Aircraft";
+    string engine_path = current_options.get_fg_root() + "/Engine";
+
+    FDMExec.GetAircraft()->LoadAircraft(aircraft_path, engine_path, "X15");
     FG_LOG( FG_FLIGHT, FG_INFO, "  loaded aircraft" );
 
-    FDMExec.GetState()->Reset("reset00");
+    FDMExec.GetState()->Reset(aircraft_path, "Reset00");
     FG_LOG( FG_FLIGHT, FG_INFO, "  loaded initial conditions" );
 
     FDMExec.GetState()->Setdt(dt);
@@ -98,7 +106,10 @@ int fgJSBsimUpdate(FGInterface& f, int multiloop) {
 
     /* FDMExec.GetState()->Setsim_time(State->Getsim_time() 
                                    + State->Getdt() * multiloop); */
-    FDMExec.Run();
+
+    for ( int i = 0; i < multiloop; i++ ) {
+       FDMExec.Run();
+    }
 
     // printf("%d FG_Altitude = %.2f\n", i, FG_Altitude * 0.3048);
     // printf("%d Altitude = %.2f\n", i, Altitude * 0.3048);
@@ -162,19 +173,24 @@ int fgJSBsim_2_FGInterface (FGInterface& f) {
     // ***FIXME*** f.set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
 
     // Positions
-    double lat = FDMExec.GetState()->Getlatitude();
+    double lat_geoc = FDMExec.GetState()->Getlatitude();
     double lon = FDMExec.GetState()->Getlongitude();
     double alt = FDMExec.GetState()->Geth();
-    double lat_geoc, sl_radius;
-    fgGeodToGeoc( lat, alt * FEET_TO_METER, &sl_radius, &lat_geoc );
+    double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc;
+    fgGeocToGeod( lat_geoc, EQUATORIAL_RADIUS_M + alt * FEET_TO_METER,
+                 &lat_geod, &tmp_alt, &sl_radius1 );
+    fgGeodToGeoc( lat_geod, alt * FEET_TO_METER, &sl_radius2, &tmp_lat_geoc );
 
-    FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << lon << " lat = " << lat 
+    FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << lon << " lat_geod = " << lat_geod
            << " lat_geoc = " << lat_geoc
-           << " alt = " << alt 
-           << " sl_radius = " << sl_radius * METER_TO_FEET);
+           << " alt = " << alt << " tmp_alt = " << tmp_alt * METER_TO_FEET
+           << " sl_radius1 = " << sl_radius1 * METER_TO_FEET
+           << " sl_radius2 = " << sl_radius2 * METER_TO_FEET
+           << " Equator = " << EQUATORIAL_RADIUS_FT );
            
-    f.set_Geocentric_Position( lat_geoc, lon, sl_radius * METER_TO_FEET + alt );
-    f.set_Geodetic_Position( lat, lon, alt );
+    f.set_Geocentric_Position( lat_geoc, lon, 
+                              sl_radius2 * METER_TO_FEET + alt );
+    f.set_Geodetic_Position( lat_geod, lon, alt );
     f.set_Euler_Angles( FDMExec.GetRotation()->Getphi(), 
                        FDMExec.GetRotation()->Gettht(),
                        FDMExec.GetRotation()->Getpsi() );
@@ -217,7 +233,7 @@ int fgJSBsim_2_FGInterface (FGInterface& f) {
     // f.set_Static_temperature( Static_temperature );
     // f.set_Total_temperature( Total_temperature );
 
-    /* **FIXME*** */ f.set_Sea_level_radius( sl_radius * METER_TO_FEET );
+    /* **FIXME*** */ f.set_Sea_level_radius( sl_radius2 * METER_TO_FEET );
     /* **FIXME*** */ f.set_Earth_position_angle( 0.0 );
 
     /* ***FIXME*** */ f.set_Runway_altitude( 0.0 );
@@ -238,6 +254,10 @@ int fgJSBsim_2_FGInterface (FGInterface& f) {
 
 
 // $Log$
+// Revision 1.3  1999/02/26 22:09:10  curt
+// Added initial support for native SGI compilers.
+// Integrated Jon's next version of JSBsim.
+//
 // Revision 1.2  1999/02/11 21:09:40  curt
 // Interface with Jon's submitted JSBsim changes.
 //
index e44cd5bd812d22e4ca689903ee91e84c7826c283..c876188badf9a33f5b155b9d577211c832629be5 100644 (file)
@@ -7,3 +7,5 @@ libFlight_a_SOURCES = flight.cxx flight.hxx \
        LaRCsim.cxx LaRCsim.hxx
 
 INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator
+
+DEFS += -DFGFS
index 75ab5f208fbc0a82af91f873929f98c049fc95e3..734d250fcae1e2c10449e1fac4e56ba4d5561c59 100644 (file)
 
 #include <stdio.h>
 
-#include "flight.hxx"
-#include "JSBsim.hxx"
-#include "LaRCsim.hxx"
-
 #include <Debug/logstream.hxx>
 #include <FDM/External/external.hxx>
 #include <FDM/LaRCsim/ls_interface.h>
 #include <Math/fg_geodesy.hxx>
 #include <Time/timestamp.hxx>
 
+#include "flight.hxx"
+#include "JSBsim.hxx"
+#include "LaRCsim.hxx"
+
 
 // base_fdm_state is the internal state that is updated in integer
 // multiples of "dt".  This leads to "jitter" with respect to the real
@@ -195,6 +195,10 @@ void fgFDMSetGroundElevation(int model, double ground_meters) {
 
 
 // $Log$
+// Revision 1.16  1999/02/26 22:09:12  curt
+// Added initial support for native SGI compilers.
+// Integrated Jon's next version of JSBsim.
+//
 // Revision 1.15  1999/02/05 21:29:01  curt
 // Modifications to incorporate Jon S. Berndts flight model code.
 //
index 813543b44f1b942848e956f59e57a2a950c101e9..3a0ad8ae8c919d06a135b3ab7d96d6a16a2c6450 100644 (file)
@@ -1,4 +1,4 @@
-/** *****************************************************************************
+/*******************************************************************************
 
  Module:       FGAircraft.cpp
  Author:       Jon S. Berndt
@@ -131,11 +131,20 @@ stability derivatives for the aircraft.
 ********************************************************************************
 INCLUDES
 *******************************************************************************/
-#include <stdlib.h>
 #include <dirent.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <math.h>
+
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <cmath>
+#  else
+#    include <math.h>
+#  endif
+#else
+#  include <cmath>
+#endif
 
 #include "FGAircraft.h"
 #include "FGTranslation.h"
@@ -156,17 +165,16 @@ FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex)
 {
   int i;
 
-  strcpy(Name,"FGAircraft");
+  Name = "FGAircraft";
 
-  for (i=0;i<6;i++) Axis[i] = (char*)malloc(7);
   for (i=0;i<6;i++) coeff_ctr[i] = 0;
 
-  strcpy(Axis[LiftCoeff],"CLIFT");
-  strcpy(Axis[DragCoeff],"CDRAG");
-  strcpy(Axis[SideCoeff],"CSIDE");
-  strcpy(Axis[RollCoeff],"CROLL");
-  strcpy(Axis[PitchCoeff],"CPITCH");
-  strcpy(Axis[YawCoeff],"CYAW");
+  Axis[LiftCoeff]  = "CLIFT";
+  Axis[DragCoeff]  = "CDRAG";
+  Axis[SideCoeff]  = "CSIDE";
+  Axis[RollCoeff]  = "CROLL";
+  Axis[PitchCoeff] = "CPITCH";
+  Axis[YawCoeff]   = "CYAW";
 }
 
 
@@ -175,13 +183,14 @@ FGAircraft::~FGAircraft(void)
 }
 
 
-bool FGAircraft::LoadAircraft(char* fname)
+bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, 
+                             string fname)
 {
-  char path[256];
-  char fullpath[256];
-  char filename[256];
-  char aircraftDef[256];
-  char tag[256];
+  string path;
+  string fullpath;
+  string filename;
+  string aircraftDef;
+  string tag;
   DIR* dir;
   DIR* coeffdir;
   struct dirent* dirEntry;
@@ -190,8 +199,8 @@ bool FGAircraft::LoadAircraft(char* fname)
   struct stat st2;
   ifstream coeffInFile;
 
-  sprintf(aircraftDef, "/h/curt/projects/FlightGear/Simulator/FDM/JSBsim/aircraft/%s/%s.dat", fname, fname);
-  ifstream aircraftfile(aircraftDef);
+  aircraftDef = aircraft_path + "/" + fname + "/" + fname + ".dat";
+  ifstream aircraftfile(aircraftDef.c_str());
 
   if (aircraftfile) {
     aircraftfile >> AircraftName;   // String with no embedded spaces
@@ -209,29 +218,30 @@ bool FGAircraft::LoadAircraft(char* fname)
     numTanks = numEngines = 0;
     numSelectedOxiTanks = numSelectedFuelTanks = 0;
 
-    while (strstr(tag,"EOF") == 0) {
-      if (strstr(tag,"CGLOC")) {
+    while ( !(tag == "EOF") ) {
+      if (tag == "CGLOC") {
         aircraftfile >> Xcg;        // inches
         aircraftfile >> Ycg;        // inches
         aircraftfile >> Zcg;        // inches
-      } else if (strstr(tag,"EYEPOINTLOC")) {
+      } else if (tag == "EYEPOINTLOC") {
         aircraftfile >> Xep;        // inches
         aircraftfile >> Yep;        // inches
         aircraftfile >> Zep;        // inches
-      } else if (strstr(tag,"TANK")) {
+      } else if (tag == "TANK") {
         Tank[numTanks] = new FGTank(aircraftfile);
         switch(Tank[numTanks]->GetType()) {
-        case 0:
-          numSelectedOxiTanks++;
-          break;
-        case 1:
+        case FGTank::ttFUEL:
           numSelectedFuelTanks++;
           break;
+        case FGTank::ttOXIDIZER:
+          numSelectedOxiTanks++;
+          break;
         }
         numTanks++;
-      } else if (strstr(tag,"ENGINE")) {
+      } else if (tag == "ENGINE") {
         aircraftfile >> tag;
-        Engine[numEngines] = new FGEngine(FDMExec, tag, numEngines);
+        Engine[numEngines] = new FGEngine(FDMExec, engine_path, tag, 
+                                         numEngines);
         numEngines++;
       }
       aircraftfile >> tag;
@@ -257,20 +267,20 @@ bool FGAircraft::LoadAircraft(char* fname)
     //       track of the number of coefficients registered for each of the
     //       previously mentioned axis.
 
-    sprintf(path,"/h/curt/projects/FlightGear/Simulator/FDM/JSBsim/aircraft/%s/",AircraftName);
-    if (dir = opendir(path)) {
+    path = aircraft_path + "/" + AircraftName + "/";
+    if (dir = opendir(path.c_str())) {
 
       while (dirEntry = readdir(dir)) {
-        sprintf(fullpath,"%s%s",path,dirEntry->d_name);
-        stat(fullpath,&st);
+        fullpath = path + dirEntry->d_name;
+        stat(fullpath.c_str(),&st);
         if ((st.st_mode & S_IFMT) == S_IFDIR) {
           for (int axis_ctr=0; axis_ctr < 6; axis_ctr++) {
-            if (strstr(dirEntry->d_name,Axis[axis_ctr])) {
-              if (coeffdir = opendir(fullpath)) {
+            if (dirEntry->d_name == Axis[axis_ctr]) {
+              if (coeffdir = opendir(fullpath.c_str())) {
                 while (coeffdirEntry = readdir(coeffdir)) {
                   if (coeffdirEntry->d_name[0] != '.') {
-                    sprintf(filename,"%s%s/%s",path,Axis[axis_ctr],coeffdirEntry->d_name);
-                    stat(filename,&st2);
+                    filename = path + Axis[axis_ctr] + "/" + coeffdirEntry->d_name;
+                    stat(filename.c_str(),&st2);
                     if (st2.st_size > 6) {
                       Coeff[axis_ctr][coeff_ctr[axis_ctr]] = new FGCoefficient(FDMExec, filename);
                       coeff_ctr[axis_ctr]++;
@@ -331,15 +341,16 @@ void FGAircraft::MassChange()
     Fshortage = Oshortage = 0.0;
     for (int t=0; t<numTanks; t++) {
       switch(Engine[e]->GetType()) {
-      case 0: // Rocket
+      case FGEngine::etRocket:
+
         switch(Tank[t]->GetType()) {
-        case 0: // Fuel
+        case FGTank::ttFUEL:
           if (Tank[t]->GetSelected()) {
             Fshortage = Tank[t]->Reduce((Engine[e]->CalcFuelNeed()/
                                    numSelectedFuelTanks)*(dt*rate) + Fshortage);
           }
           break;
-        case 1: // Oxidizer
+        case FGTank::ttOXIDIZER:
           if (Tank[t]->GetSelected()) {
             Oshortage = Tank[t]->Reduce((Engine[e]->CalcOxidizerNeed()/
                                     numSelectedOxiTanks)*(dt*rate) + Oshortage);
@@ -347,7 +358,11 @@ void FGAircraft::MassChange()
           break;
         }
         break;
-      default: // piston, turbojet, turbofan, etc.
+
+      case FGEngine::etPiston:
+      case FGEngine::etTurboJet:
+      case FGEngine::etTurboProp:
+
         if (Tank[t]->GetSelected()) {
           Fshortage = Tank[t]->Reduce((Engine[e]->CalcFuelNeed()/
                                    numSelectedFuelTanks)*(dt*rate) + Fshortage);
index fc01f5023fa9cb5293c01a4a24b27f5c12a73d11..9d403177d17c246f7f407850fa11489a33bbe1e1 100644 (file)
@@ -36,22 +36,11 @@ SENTRY
 
 /*******************************************************************************
 COMMENTS, REFERENCES,  and NOTES
-********************************************************************************
-[1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
-        Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
-        School, January 1994
-[2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
-        JSC 12960, July 1977
-[3] Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
-        NASA-Ames", NASA CR-2497, January 1975
-[4] Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
-        Wiley & Sons, 1979 ISBN 0-471-03032-5
-[5] Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
-        1982 ISBN 0-471-08936-2
-
-The aerodynamic coefficients used in this model are:
-
-Longitudinal
+*******************************************************************************/
+/**
+The aerodynamic coefficients used in this model typically are:
+<PRE>
+<b>Longitudinal</b>
   CL0 - Reference lift at zero alpha
   CD0 - Reference drag at zero alpha
   CDM - Drag due to Mach
@@ -61,13 +50,13 @@ Longitudinal
   CLM - Lift due to Mach
   CLadt - Lift due to alpha rate
 
-  Cmadt - Moment due to alpha rate
-  Cm0 - Reference moment at zero alpha
+  Cmadt - Pitching Moment due to alpha rate
+  Cm0 - Reference Pitching moment at zero alpha
   Cma - Pitching moment slope (w.r.t. alpha)
   Cmq - Pitch damping (pitch moment due to pitch rate)
-  CmM - Moment due to Mach
+  CmM - Pitch Moment due to Mach
 
-Lateral
+<b>Lateral</b>
   Cyb - Side force due to sideslip
   Cyr - Side force due to yaw rate
 
@@ -78,9 +67,9 @@ Lateral
   Cnp - Rudder adverse yaw (yaw moment due to roll rate)
   Cnr - Yaw damping (yaw moment due to yaw rate)
 
-Control
-  ClDe - Lift due to elevator
-  CdDe - Drag due to elevator
+<b>Control</b>
+  CLDe - Lift due to elevator
+  CDDe - Drag due to elevator
   CyDr - Side force due to rudder
   CyDa - Side force due to aileron
 
@@ -89,13 +78,75 @@ Control
   ClDr - Roll moment due to rudder
   CnDr - Yaw moment due to rudder
   CnDa - Yaw moment due to aileron
+</PRE>
+This class expects to be run in a directory which contains the subdirectory
+structure shown below (where example aircraft X-15 is shown):
+
+<PRE>
+aircraft/
+  X-15/
+    X-15.dat reset00 reset01 reset02 ...
+      CDRAG/
+        a0 a M De
+      CSIDE/
+        b r Dr Da
+      CLIFT/
+        a0 a M adt De
+      CROLL/
+        b p r Da Dr
+      CPITCH/
+        a0 a adt q M De
+      CYAW/
+        b p r Dr Da
+  F-16/
+    F-16.dat reset00 reset01 ...
+      CDRAG/
+        a0 a M De
+      ...
+</PRE>
+
+The General Idea
+
+The file structure is arranged so that various modeled aircraft are stored in
+their own subdirectory. Each aircraft subdirectory is named after the aircraft.
+There should be a file present in the specific aircraft subdirectory (e.g.
+aircraft/X-15) with the same name as the directory with a .dat appended. This
+file contains mass properties information, name of aircraft, etc. for the
+aircraft. In that same directory are reset files numbered starting from 0 (two
+digit numbers), e.g. reset03. Within each reset file are values for important
+state variables for specific flight conditions (altitude, airspeed, etc.). Also
+within this directory are the directories containing lookup tables for the
+stability derivatives for the aircraft.
+@author Jon S. Berndt
+@memo  Encompasses all aircraft functionality and objects
+@see <ll>
+<li>[1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
+        Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
+        School, January 1994</li>
+<li>[2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
+        JSC 12960, July 1977</li>
+<li>[3] Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
+        NASA-Ames", NASA CR-2497, January 1975</li>
+<li>[4] Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
+        Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
+<li>[5] Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
+        1982 ISBN 0-471-08936-2</li>
+</ll>
+*/
 
-********************************************************************************
+/*******************************************************************************
 INCLUDES
 *******************************************************************************/
-
-#include <stdio.h>
-#include <fstream.h>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <fstream>
+#  else
+#    include <fstream.h>
+#  endif
+#else
+#  include <fstream>
+#endif
 
 #include "FGModel.h"
 #include "FGCoefficient.h"
@@ -110,84 +161,318 @@ DEFINITIONS
 CLASS DECLARATION
 *******************************************************************************/
 
-
 class FGAircraft : public FGModel
 {
 public:
+  // ***************************************************************************
+  /** @memo Constructor
+      @param FGFDMExec* - a pointer to the "owning" FDM Executive
+  */
   FGAircraft(FGFDMExec*);
+  
+  // ***************************************************************************
+  /** Destructor */
   ~FGAircraft(void);
 
+  // ***************************************************************************
+  /** This must be called for each dt to execute the model algorithm */
   bool Run(void);
 
-  bool LoadAircraft(char*);
-  
-  inline char* GetAircraftName(void) {return AircraftName;}
-
+  // ***************************************************************************
+  /** This function must be called with the name of an aircraft which
+      has an associated .dat file in the appropriate subdirectory. The
+      appropriate subdirectory is underneath the main fgfs binary directory
+      called "aircraft/{<i>aircraft</i>}/, where {<i>aircraft</i>} is the name of
+      specific aircraft you want to simulate.
+      @memo Loads the given aircraft.
+      @param string Path to the Aircraft files
+      @param string Path to the Engine files
+      @param string The name of the aircraft to be loaded, e.g. "X15".
+      @return True - if successful
+  */
+  bool LoadAircraft(string, string, string);
+
+  // ***************************************************************************
+  /** @memo Gets the aircraft name as defined in the aircraft config file.
+      @param
+      @return string Aircraft name.
+  */
+  inline string GetAircraftName(void) {return AircraftName;}
+
+  // ***************************************************************************
+  /** @memo Sets the GearUp flag
+      @param boolean true or false
+      @return
+  */
   inline void SetGearUp(bool tt) {GearUp = tt;}
+
+  // ***************************************************************************
+  /** @memo Returns the state of the GearUp flag
+      @param
+      @return boolean true or false
+  */
   inline bool GetGearUp(void) {return GearUp;}
+
+  // ***************************************************************************
+  /** @memo Returns the area of the wing
+      @param
+      @return float wing area S, in square feet
+  */
   inline float GetWingArea(void) {return WingArea;}
+
+  // ***************************************************************************
+  /** @memo Returns the wing span
+      @param
+      @return float wing span in feet
+  */
   inline float GetWingSpan(void) {return WingSpan;}
+
+  // ***************************************************************************
+  /** @memo Returns the average wing chord
+      @param
+      @return float wing chord in feet
+  */
   inline float Getcbar(void) {return cbar;}
+
+  // ***************************************************************************
+  /** @memo Returns an engine object
+      @param int The engine number
+      @return FGEengine* The pointer to the requested engine object.
+  */
   inline FGEngine* GetEngine(int tt) {return Engine[tt];}
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline FGTank* GetTank(int tt) {return Tank[tt];}
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetWeight(void) {return Weight;}
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetMass(void) {return Mass;}
 
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetL(void) {return Moments[0];}
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetM(void) {return Moments[1];}
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetN(void) {return Moments[2];}
 
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetFx(void) {return Forces[0];}
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetFy(void) {return Forces[1];}
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetFz(void) {return Forces[2];}
 
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetIxx(void) {return Ixx;}
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetIyy(void) {return Iyy;}
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetIzz(void) {return Izz;}
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   inline float GetIxz(void) {return Ixz;}
 
 private:
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   void GetState(void);
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   void PutState(void);
 
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   void FAero(void);
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   void FGear(void);
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   void FMass(void);
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   void FProp(void);
 
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   void MAero(void);
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   void MGear(void);
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   void MMass(void);
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   void MProp(void);
 
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   void MassChange(void);
 
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   float Moments[3];
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   float Forces[3];
 
-  char AircraftName[50];
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
+  string AircraftName;
+
+  // ***************************************************************************
+  ///
   float Ixx, Iyy, Izz, Ixz, EmptyMass, Mass;
+  ///
   float Xcg, Ycg, Zcg;
+  ///
   float Xep, Yep, Zep;
+  ///
   float rho, qbar, Vt;
+  ///
   float alpha, beta;
+  ///
   float WingArea, WingSpan, cbar;
+  ///
   float phi, tht, psi;
+  ///
   float Weight, EmptyWeight;
+  ///
   float dt;
 
+  ///
   int numTanks;
+  ///
   int numEngines;
+  ///
   int numSelectedOxiTanks;
+  ///
   int numSelectedFuelTanks;
+  ///
   FGTank* Tank[MAX_TANKS];
+  ///
   FGEngine *Engine[MAX_ENGINES];
 
+  ///
   FGCoefficient *Coeff[6][10];
+  ///
   int coeff_ctr[6];
 
+  ///
   bool GearUp;
 
+  ///
   enum Param {LiftCoeff,
               DragCoeff,
               SideCoeff,
@@ -196,7 +481,8 @@ private:
               YawCoeff,
               numCoeffs};
 
-  char* Axis[6];
+  ///
+  string Axis[6];
 
 protected:
 
index 713282e30a37e7608e99fb786abb3cd5417de15b..a066b30469d80283cb08c1d7ebc8ce2a9ae11fba 100644 (file)
@@ -55,7 +55,7 @@ INCLUDES
 
 FGAtmosphere::FGAtmosphere(FGFDMExec* fdmex) : FGModel(fdmex)
 {
-  strcpy(Name,"FGAtmosphere");
+  Name = "FGAtmosphere";
 }
 
 
index d1b272458c513d1f92b4bc8623054b11a405fc9f..232e05f09fcbc94c7fcb74db04056a54d9a4ecda 100644 (file)
@@ -55,7 +55,7 @@ INCLUDES
 
 FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex)
 {
-  strcpy(Name, "FGAuxiliary");
+  Name = "FGAuxiliary";
 }
 
 
index f0115909d80d08a220b83ea933d1244ca2f4c6b1..15b457c3c6222cb86f63f3fc8cf961847c4d385d 100644 (file)
@@ -107,10 +107,7 @@ HISTORY
 INCLUDES
 *******************************************************************************/
 
-#include <stdio.h>
-#include <stdlib.h>
 #include "FGCoefficient.h"
-
 #include "FGAtmosphere.h"
 #include "FGState.h"
 #include "FGFDMExec.h"
@@ -143,7 +140,7 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex)
 }
 
 
-FGCoefficient::FGCoefficient(FGFDMExec* fdex, char* fname)
+FGCoefficient::FGCoefficient(FGFDMExec* fdex, string fname)
 {
   int r, c;
   float ftrashcan;
@@ -159,7 +156,7 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, char* fname)
   Auxiliary   = FDMExec->GetAuxiliary();
   Output      = FDMExec->GetOutput();
 
-  ifstream coeffDefFile(fname);
+  ifstream coeffDefFile(fname.c_str());
 
   if (coeffDefFile) {
     if (!coeffDefFile.fail()) {
@@ -167,11 +164,11 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, char* fname)
       coeffDefFile >> description;
       coeffDefFile >> method;
 
-      if (strcmp(method,"EQUATION") == 0) type = 4;
-      else if (strcmp(method,"TABLE") == 0) type = 3;
-      else if (strcmp(method,"VECTOR") == 0) type = 2;
-      else if (strcmp(method,"VALUE") == 0) type = 1;
-      else type = 0;
+      if      (method == "EQUATION") type = 4;
+      else if (method == "TABLE")    type = 3;
+      else if (method == "VECTOR")   type = 2;
+      else if (method == "VALUE")    type = 1;
+      else                           type = 0;
 
       if (type == 2 || type == 3) {
         coeffDefFile >> rows;
index 97fcdc18053129568d9287b9c3c587d9e36265f3..b5995692dbe1d8162493d1b0b14ea98de326e5ae 100644 (file)
@@ -37,7 +37,22 @@ SENTRY
 /*******************************************************************************
 INCLUDES
 *******************************************************************************/
-#include <fstream.h>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  include STL_STRING
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <fstream>
+#  else
+#    include <fstream.h>
+#  endif
+   FG_USING_STD(string);
+#  ifdef FG_HAVE_NATIVE_SGI_COMPILERS
+     FG_USING_NAMESPACE(std);
+#  endif
+#else
+#  include <string>
+#  include <fstream>
+#endif
 
 /*******************************************************************************
 DEFINES
@@ -80,7 +95,7 @@ public:
   FGCoefficient(FGFDMExec*);
   FGCoefficient(FGFDMExec*, int, int);
   FGCoefficient(FGFDMExec*, int);
-  FGCoefficient(FGFDMExec*, char*);
+  FGCoefficient(FGFDMExec*, string);
   ~FGCoefficient(void);
 
   bool Allocate(int);
@@ -93,19 +108,19 @@ public:
 protected:
 
 private:
+  string filename;
+  string description;
+  string name;
+  string method;
   float StaticValue;
   float *Table2D;
   float **Table3D;
+  float LookupR, LookupC;
+  long int mult_idx[10];
   int rows, columns;
-  char filename[50];
-  char description[50];
-  char name[10];
   int type;
-  char method[15];
   int multipliers;
-  long int mult_idx[10];
   int mult_count;
-  float LookupR, LookupC;
 
   float GetCoeffVal(int);
 
index dcc2f89f37d87cd551cbce9ecc30deb14e740df1..c14149d28fac354fa01a983d2fee92acaad3bce4 100644 (file)
@@ -30,7 +30,6 @@ See header file.
 
 HISTORY
 --------------------------------------------------------------------------------
-
 01/21/99   JSB   Created
 
 ********************************************************************************
@@ -38,9 +37,6 @@ INCLUDES
 *******************************************************************************/
 
 #include <fstream.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 #include "FGEngine.h"
 #include "FGState.h"
@@ -59,10 +55,11 @@ INCLUDES
 *******************************************************************************/
 
 
-FGEngine::FGEngine(FGFDMExec* fdex, char *engineName, int num)
+FGEngine::FGEngine(FGFDMExec* fdex, string enginePath, string engineName, 
+                  int num)
 {
-  char fullpath[256];
-  char tag[256];
+  string fullpath;
+  string tag;
 
   FDMExec = fdex;
 
@@ -76,17 +73,19 @@ FGEngine::FGEngine(FGFDMExec* fdex, char *engineName, int num)
   Auxiliary   = FDMExec->GetAuxiliary();
   Output      = FDMExec->GetOutput();
 
-  strcpy(Name, engineName);
-  sprintf(fullpath,"/h/curt/projects/FlightGear/Simulator/FDM/JSBsim/engine/%s.dat", engineName);
-  ifstream enginefile(fullpath);
+  Name = engineName;
+  fullpath = enginePath + "/" + engineName + ".dat";
+  ifstream enginefile(fullpath.c_str());
 
   if (enginefile) {
     enginefile >> tag;
-    if (strstr(tag,"ROCKET")) Type = 0;
-    else if (strstr(tag,"PISTON")) Type = 1;
-    else if (strstr(tag,"TURBOPROP")) Type = 2;
-    else if (strstr(tag,"TURBOJET")) Type = 3;
-    else Type = 0;
+
+    if      (tag == "ROCKET")    Type = etRocket;
+    else if (tag == "PISTON")    Type = etPiston;
+    else if (tag == "TURBOPROP") Type = etTurboProp;
+    else if (tag == "TURBOJET")  Type = etTurboJet;
+    else                         Type = etUnknown;
+
     enginefile >> X;
     enginefile >> Y;
     enginefile >> Z;
@@ -95,7 +94,7 @@ FGEngine::FGEngine(FGFDMExec* fdex, char *engineName, int num)
     enginefile >> MaxThrottle;
     enginefile >> MinThrottle;
     enginefile >> SLFuelFlowMax;
-    if (Type == 0)
+    if (Type == 1)
       enginefile >> SLOxiFlowMax;
     enginefile.close();
   } else {
@@ -130,7 +129,7 @@ float FGEngine::CalcRocketThrust(void)
     Flameout = false;
   }
 
-  Thrust +=    0.8*(Thrust - lastThrust); // actual thrust
+  Thrust += 0.8*(Thrust - lastThrust); // actual thrust
 
   return Thrust;
 }
@@ -145,10 +144,10 @@ float FGEngine::CalcPistonThrust(void)
 float FGEngine::CalcThrust(void)
 {
   switch(Type) {
-  case 0: // Rocket
+  case etRocket:
     return CalcRocketThrust();
     // break;
-  case 1: // Piston
+  case etPiston:
     return CalcPistonThrust();
     // break;
   default:
index bafc38ebcab6bc7f33f6a92b4435266806b01305..05e6406df2e10904cb622efd588574618892e832 100644 (file)
@@ -44,6 +44,17 @@ SENTRY
 INCLUDES
 *******************************************************************************/
 
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  include STL_STRING
+   FG_USING_STD(string);
+#  ifdef FG_HAVE_NATIVE_SGI_COMPILERS
+     FG_USING_NAMESPACE(std);
+#  endif
+#else
+#  include <string>
+#endif
+
 /*******************************************************************************
 DEFINES
 *******************************************************************************/
@@ -66,28 +77,29 @@ class FGOutput;
 class FGEngine
 {
 public:
-  FGEngine(FGFDMExec*, char*, int);
+  FGEngine(FGFDMExec*, string, string, int);
   ~FGEngine(void);
 
-  float GetThrust(void) {return Thrust;}
-  bool  GetStarved(void) {return Starved;}
-  bool  GetFlameout(void) {return Flameout;}
-  float GetThrottle(void) {return Throttle;}
-  char* GetName() {return Name;}
+  enum EngineType {etUnknown, etRocket, etPiston, etTurboProp, etTurboJet};
+
+  float  GetThrottle(void) {return Throttle;}
+  float  GetThrust(void) {return Thrust;}
+  bool   GetStarved(void) {return Starved;}
+  bool   GetFlameout(void) {return Flameout;}
+  int    GetType(void) {return Type;}
+  string GetName() {return Name;}
 
   void SetStarved(bool tt) {Starved = tt;}
   void SetStarved(void) {Starved = true;}
 
-  int GetType(void) {return Type;}
-
   float CalcThrust(void);
   float CalcFuelNeed(void);
   float CalcOxidizerNeed(void);
 
 private:
-  char  Name[30];
+  string Name;
+  EngineType Type;
   float X, Y, Z;
-  int   Type;
   float SLThrustMax;
   float VacThrustMax;
   float SLFuelFlowMax;
@@ -113,7 +125,7 @@ private:
   FGPosition*     Position;
   FGAuxiliary*    Auxiliary;
   FGOutput*       Output;
-  
+
 protected:
   float CalcRocketThrust(void);
   float CalcPistonThrust(void);
@@ -121,4 +133,4 @@ protected:
 };
 
 /******************************************************************************/
-#endif
\ No newline at end of file
+#endif
index 124af108223709dfa90f8c386467bc30f020887b..04bfb388035b327636af0248083333f8c83a30a9 100644 (file)
@@ -55,7 +55,7 @@ INCLUDES
 
 FGFCS::FGFCS(FGFDMExec* fdmex) : FGModel(fdmex)
 {
-  strcpy(Name, "FGFCS");
+  Name = "FGFCS";
 }
 
 
index 6f2cc1b9dab3cbf2ee0a7230bfea0f45edd95d8b..9f4adfa80eaabe15242519689b812d81b70220d7 100644 (file)
@@ -38,14 +38,22 @@ HISTORY
 INCLUDES
 *******************************************************************************/
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <iostream.h>
-#include <time.h>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <iostream>
+#    include <ctime>
+#  else
+#    include <iostream.h>
+#    include <time.h>
+#  endif
+#else
+#  include <iostream>
+#  include <ctime>
+#endif
 
 #include "FGFDMExec.h"
 #include "FGState.h"
-
 #include "FGAtmosphere.h"
 #include "FGFCS.h"
 #include "FGAircraft.h"
index 02484a1a179654b2944b418d004d2d3614b2b18d..fc0c4e6d4c53ddf335c0716152df8e56143617cf 100644 (file)
@@ -9,11 +9,13 @@
 #include "FGAuxiliary.h"
 #include "FGOutput.h"
 
-#include <iostream.h>
-#include <time.h>
+#include <iostream>
+#include <ctime>
 
 void main(int argc, char** argv)
 {
+       FGFDMExec* FDMExec;
+       
   struct timespec short_wait = {0,100000000};
   struct timespec no_wait    = {0,100000000};
 
@@ -26,8 +28,8 @@ void main(int argc, char** argv)
 
   FDMExec = new FGFDMExec();
 
-  FDMExec->GetAircraft()->LoadAircraft(argv[1]);
-  FDMExec->GetState()->Reset(argv[2]);
+  FDMExec->GetAircraft()->LoadAircraft(string(argv[1]));
+  FDMExec->GetState()->Reset(string(argv[2]));
 
   while (FDMExec->GetState()->Getsim_time() <= 25.0)
   {
index 7ea0f0d27811102d05a07fbc9166b0dc10d9e220..47c07fb44a77109d0efdca22dbdefe65da8af04e 100644 (file)
@@ -39,9 +39,27 @@ INCLUDES
 *******************************************************************************/
 
 #include "FGDefs.h"
-#include <stdio.h>
-#include <string.h>
-#include <iostream.h>
+
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  include STL_STRING
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <cstring>
+#    include <iostream>
+#  else
+#    include <string.h>
+#    include <iostream.h>
+#  endif
+   FG_USING_STD(string);
+#  ifdef FG_HAVE_NATIVE_SGI_COMPILERS
+     FG_USING_NAMESPACE(std);
+#  endif
+#else
+#  include <string>
+#  include <cstring>
+#  include <iostream>
+#endif
+
 
 /*******************************************************************************
 DEFINES
@@ -69,7 +87,7 @@ public:
   ~FGModel(void);
 
   FGModel* NextModel;
-  char Name[30];
+  string Name;
   virtual bool Run(void);
   virtual bool InitModel(void);
   void SetRate(int tt) {rate = tt;};
index 8bd4f11bcc985a7a72ccc78a9943244d5117c5ec..e5e2f7624f71c348e66dfd4ee9adb5e3a40d712d 100644 (file)
@@ -39,11 +39,18 @@ HISTORY
 INCLUDES
 *******************************************************************************/
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <iostream.h>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <iostream>
+#  else
+#    include <iostream.h>
+#  endif
+#else
+#  include <iostream>
+#endif
 #ifdef HAVE_CURSES
-  #include <ncurses.h>
+#  include <ncurses.h>
 #endif
 
 #include "FGOutput.h"
@@ -63,7 +70,7 @@ INCLUDES
 
 FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
 {
-  strcpy(Name, "FGOutput");
+  Name = "FGOutput";
   FirstPass = true;
 #ifdef HAVE_CURSES
   initscr();
@@ -92,7 +99,7 @@ bool FGOutput::Run(void)
 void FGOutput::ConsoleOutput(void)
 {
 #ifdef HAVE_CURSES
-  char buffer[20];
+  string buffer;
 
   clear();
   move(1,1);  insstr("Quaternions");
@@ -101,10 +108,10 @@ void FGOutput::ConsoleOutput(void)
   move(2,27); insstr("Q2");
   move(2,38); insstr("Q3");
 
-  move(3,1);  sprintf(buffer,"%4.4f",Rotation->GetQ0()); insstr(buffer);
-  move(3,12); sprintf(buffer,"%4.4f",Rotation->GetQ1()); insstr(buffer);
-  move(3,23); sprintf(buffer,"%4.4f",Rotation->GetQ2()); insstr(buffer);
-  move(3,34); sprintf(buffer,"%4.4f",Rotation->GetQ3()); insstr(buffer);
+  move(3,1);  buffer = Rotation->GetQ0(); insstr(buffer.c_str());
+  move(3,12); buffer = Rotation->GetQ1(); insstr(buffer.c_str());
+  move(3,23); buffer = Rotation->GetQ2(); insstr(buffer.c_str());
+  move(3,34); buffer = Rotation->GetQ3(); insstr(buffer.c_str());
 
   move(0,0); insstr("Time: ");
   move(0,6); insstr(gcvt(State->Getsim_time(),6,buffer));
@@ -113,41 +120,41 @@ void FGOutput::ConsoleOutput(void)
   move(2,55); insstr("Tht");
   move(2,64); insstr("Psi");
 
-  move(3,45); sprintf(buffer,"%3.3f",Rotation->Getphi()); insstr(buffer);
-  move(3,54); sprintf(buffer,"%3.3f",Rotation->Gettht()); insstr(buffer);
-  move(3,63); sprintf(buffer,"%3.3f",Rotation->Getpsi()); insstr(buffer);
+  move(3,45); buffer = Rotation->Getphi(); insstr(buffer.c_str());
+  move(3,54); buffer = Rotation->Gettht(); insstr(buffer.c_str());
+  move(3,63); buffer = Rotation->Getpsi(); insstr(buffer.c_str());
 
   move(5,47); insstr("U");
   move(5,56); insstr("V");
   move(5,65); insstr("W");
 
-  move(6,45); sprintf(buffer,"%5.2f",Translation->GetU()); insstr(buffer);
-  move(6,54); sprintf(buffer,"%5.2f",Translation->GetV()); insstr(buffer);
-  move(6,63); sprintf(buffer,"%5.2f",Translation->GetW()); insstr(buffer);
+  move(6,45); buffer = Translation->GetU(); insstr(buffer.c_str());
+  move(6,54); buffer = Translation->GetV(); insstr(buffer.c_str());
+  move(6,63); buffer = Translation->GetW(); insstr(buffer.c_str());
 
   move(8,47); insstr("Fx");
   move(8,56); insstr("Fy");
   move(8,65); insstr("Fz");
 
-  move(9,45); sprintf(buffer,"%5.2f",Aircraft->GetFx()); insstr(buffer);
-  move(9,54); sprintf(buffer,"%5.2f",Aircraft->GetFy()); insstr(buffer);
-  move(9,63); sprintf(buffer,"%5.2f",Aircraft->GetFz()); insstr(buffer);
+  move(9,45); buffer = Aircraft->GetFx(); insstr(buffer.c_str());
+  move(9,54); buffer = Aircraft->GetFy(); insstr(buffer.c_str());
+  move(9,63); buffer = Aircraft->GetFz(); insstr(buffer.c_str());
 
   move(11,47); insstr("Fn");
   move(11,56); insstr("Fe");
   move(11,65); insstr("Fd");
 
-  move(12,45); sprintf(buffer,"%5.2f",Position->GetFn()); insstr(buffer);
-  move(12,54); sprintf(buffer,"%5.2f",Position->GetFe()); insstr(buffer);
-  move(12,63); sprintf(buffer,"%5.2f",Position->GetFd()); insstr(buffer);
+  move(12,45); buffer = Position->GetFn(); insstr(buffer.c_str());
+  move(12,54); buffer = Position->GetFe(); insstr(buffer.c_str());
+  move(12,63); buffer = Position->GetFd(); insstr(buffer.c_str());
 
   move(14,47); insstr("Latitude");
   move(14,57); insstr("Longitude");
   move(14,67); insstr("Altitude");
 
-  move(15,47); sprintf(buffer,"%5.2f",State->Getlatitude()); insstr(buffer);
-  move(15,57); sprintf(buffer,"%5.2f",State->Getlongitude()); insstr(buffer);
-  move(15,67); sprintf(buffer,"%5.2f",State->Geth()); insstr(buffer);
+  move(15,47); buffer = State->Getlatitude(); insstr(buffer.c_str());
+  move(15,57); buffer = State->Getlongitude(); insstr(buffer.c_str());
+  move(15,67); buffer = State->Geth(); insstr(buffer.c_str());
 
   refresh();
 
index 51b49c459dc88ace28508623bdeb73fd07f32a9f..8c7ee85ffc5ee5151812ddcc081b69fd0554576a 100644 (file)
@@ -53,7 +53,16 @@ COMMENTS, REFERENCES,  and NOTES
 INCLUDES
 *******************************************************************************/
 
-#include <math.h>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <cmath>
+#  else
+#    include <math.h>
+#  endif
+#else
+#  include <cmath>
+#endif
 #include "FGPosition.h"
 #include "FGAtmosphere.h"
 #include "FGState.h"
@@ -72,7 +81,7 @@ INCLUDES
 
 FGPosition::FGPosition(FGFDMExec* fdmex) : FGModel(fdmex)
 {
-  strcpy(Name, "FGPosition");
+  Name = "FGPosition";
   AccelN = AccelE = AccelD = 0.0;
   LongitudeDot = LatitudeDot = RadiusDot = 0.0;
 }
index 715c0a76f76bf5b569cb5561852162db05ca5f92..494d9da663e6b8aac80d487fc2123cb111d82fd1 100644 (file)
@@ -73,7 +73,7 @@ INCLUDES
 
 FGRotation::FGRotation(FGFDMExec* fdmex) : FGModel(fdmex)
 {
-  strcpy(Name, "FGRotation");
+  Name = "FGRotation";
   Q0dot = Q1dot = Q2dot = Q3dot = 0.0;
   Pdot = Qdot = Rdot = 0.0;
 }
index 66999e7af095100f84727731d650917a795fcf0d..e0b40894bed7cd8ff7792ea68eb11325ed6e8c26 100644 (file)
@@ -56,7 +56,17 @@ SENTRY
 INCLUDES
 *******************************************************************************/
 
-#include <math.h>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <cmath>
+#  else
+#    include <math.h>
+#  endif
+#else
+#  include <cmath>
+#endif
+
 #include "FGModel.h"
 
 /*******************************************************************************
index 532c200471ce6315394f1b16193ec75a52f4d9b6..6309b55d647ce3fb2f5f0bc09cfbc7363172e857 100644 (file)
@@ -36,9 +36,16 @@ HISTORY
 INCLUDES
 *******************************************************************************/
 
-#include <math.h>
-
-#include <string>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <cmath>
+#  else
+#    include <math.h>
+#  endif
+#else
+#  include <cmath>
+#endif
 
 #include "FGState.h"
 #include "FGFDMExec.h"
@@ -75,7 +82,7 @@ FGState::~FGState(void)
 }
 
 
-bool FGState::Reset(const string& path, const string& fname)
+bool FGState::Reset(string path, string fname)
 {
   string resetDef;
   float U, V, W;
@@ -84,12 +91,10 @@ bool FGState::Reset(const string& path, const string& fname)
   float Q0, Q1, Q2, Q3;
   float T[4][4];
 
-  resetDef = path;
-  resetDef += "/";
-  resetDef += FDMExec->GetAircraft()->GetAircraftName();
-  resetDef += "/" + fname;
+  resetDef = path + "/" + FDMExec->GetAircraft()->GetAircraftName() + 
+      "/" + fname;
 
-  ifstream resetfile( resetDef.c_str() );
+  ifstream resetfile(resetDef.c_str());
 
   if (resetfile) {
     resetfile >> U;
@@ -157,9 +162,9 @@ bool FGState::Reset(const string& path, const string& fname)
 }
 
 
-bool FGState::StoreData(char* fname)
+bool FGState::StoreData(string fname)
 {
-  ofstream datafile(fname);
+  ofstream datafile(fname.c_str());
 
   if (datafile) {
     datafile << FDMExec->GetTranslation()->GetU();
@@ -180,9 +185,9 @@ bool FGState::StoreData(char* fname)
 }
 
 
-bool FGState::DumpData(char* fname)
+bool FGState::DumpData(string fname)
 {
-  ofstream datafile(fname);
+  ofstream datafile(fname.c_str());
 
   if (datafile) {
     datafile << "U: " << FDMExec->GetTranslation()->GetU() << endl;
index d78f427c7b49790a199593bf1925019f9eea1352..3324281d842ce1e4f4b7e0699ddbaeb171373050 100644 (file)
@@ -44,9 +44,23 @@ SENTRY
 INCLUDES
 *******************************************************************************/
 
-#include <stdio.h>
-#include <fstream.h>
-#include <string>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  include STL_STRING
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <fstream>
+#  else
+#    include <fstream.h>
+#  endif
+   FG_USING_STD(string);
+#  ifdef FG_HAVE_NATIVE_SGI_COMPILERS
+     FG_USING_NAMESPACE(std);
+#  endif
+#else
+#  include <string>
+#  include <fstream>
+#endif
+
 #include "FGDefs.h"
 
 /*******************************************************************************
@@ -64,9 +78,9 @@ public:
    FGState(FGFDMExec*);
   ~FGState(void);
 
-  bool FGState::Reset(const string& path, const string& fname);
-  bool StoreData(char*);
-  bool DumpData(char*);
+  bool Reset(string, string);
+  bool StoreData(string);
+  bool DumpData(string);
   bool DisplayData(void);
 
   inline float GetVt(void) {return Vt;}
index 991959b43826fb77f279f679754e83541d9b210a..ce5d448c63fa76ea5bdbdb532728f41350be781b 100644 (file)
@@ -35,10 +35,18 @@ HISTORY
 ********************************************************************************
 INCLUDES
 *******************************************************************************/
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <fstream>
+#  else
+#    include <fstream.h>
+#  endif
+#else
+#  include <fstream>
+#endif
 
 #include "FGTank.h"
-#include <fstream.h>
-#include <string.h>
 
 /*******************************************************************************
 ************************************ CODE **************************************
@@ -47,12 +55,12 @@ INCLUDES
 
 FGTank::FGTank(ifstream& acfile)
 {
-  char type[20];
+  string type;
 
-  acfile >> type;                              // Type = 0: rocket, 1: piston
-  if (strstr(type,"FUEL")) Type = 0;
-  else if (strstr(type,"OXIDIZER")) Type = 1;
-  else Type = -1;
+  acfile >> type;                              // Type = 0: fuel, 1: oxidizer
+  if (type == "FUEL") Type = ttFUEL;
+  else if (type == "OXIDIZER") Type = ttOXIDIZER;
+  else Type = ttUNKNOWN;
   acfile >> X;                                 // inches
   acfile >> Y;                                 // "
   acfile >> Z;                                 // "
index afb3020ea9375b743680dd05ae3eb4649f677f60..390f14de096f97824f259123e0298547cb3e73cc 100644 (file)
@@ -43,8 +43,22 @@ SENTRY
 /*******************************************************************************
 INCLUDES
 *******************************************************************************/
-
-#include <fstream.h>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  include STL_STRING
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <fstream>
+#  else
+#    include <fstream.h>
+#  endif
+   FG_USING_STD(string);
+#  ifdef FG_HAVE_NATIVE_SGI_COMPILERS
+     FG_USING_NAMESPACE(std);
+#  endif
+#else
+#  include <string>
+#  include <fstream>
+#endif
 
 /*******************************************************************************
 DEFINES
@@ -65,11 +79,13 @@ public:
   bool GetSelected(void) {return Selected;}
   float GetPctFull(void) {return PctFull;}
   float GetContents(void) {return Contents;}
+
+  enum TankType {ttUNKNOWN, ttFUEL, ttOXIDIZER};
   
 private:
+  TankType Type;
   float X, Y, Z;
   float Capacity;
-  int   Type;
   float Radius;
   float PctFull;
   float Contents;
@@ -79,4 +95,4 @@ protected:
 };
 
 /******************************************************************************/
-#endif
\ No newline at end of file
+#endif
index 05adbbf8dcc65f0ffc05a1dfd1811820ea7bd2ab..63db8801f32b84febddbb528007a06c0abd173e2 100644 (file)
@@ -73,7 +73,7 @@ INCLUDES
 
 FGTranslation::FGTranslation(FGFDMExec* fdmex) : FGModel(fdmex)
 {
-  strcpy(Name, "FGTranslation");
+  Name = "FGTranslation";
   Udot = Vdot = Wdot = 0.0;
 }
 
index 423f7ab0310f9a2fd9d9d71f4c3f2407dc0c23d2..bbc3dc297c5c6b8c4d938615131bbd6b5b72edb3 100644 (file)
@@ -56,7 +56,17 @@ SENTRY
 INCLUDES
 *******************************************************************************/
 
-#include <math.h>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <cmath>
+#  else
+#    include <math.h>
+#  endif
+#else
+#  include <cmath>
+#endif
+
 #include "FGModel.h"
 
 /*******************************************************************************
index afc3d6573fecc3cdddf231ab3beef271a24bbc4b..f7e7d1de342d42b723d796087f740e3830199dbb 100644 (file)
@@ -42,10 +42,20 @@ DEFINES
 INCLUDES
 *******************************************************************************/
 
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <cmath>
+#  else
+#    include <math.h>
+#  endif
+#else
+#  include <cmath>
+#endif
+
 #include "FGUtility.h"
 #include "FGState.h"
 #include "FGFDMExec.h"
-#include <math.h>
 
 /*******************************************************************************
 ************************************ CODE **************************************
index cc754847718bda3540f52fcc9b2f4f9e74875852..bc540a476bf7714828207ceb7b520136a5333381 100644 (file)
@@ -4,6 +4,7 @@ libJSBsim_a_SOURCES = FGAircraft.cpp FGAircraft.h \
        FGAtmosphere.cpp FGAtmosphere.h \
        FGAuxiliary.cpp FGAuxiliary.h \
        FGCoefficient.cpp FGCoefficient.h \
+       FGDefs.h \
        FGFCS.cpp FGFCS.h \
        FGFDMExec.cpp FGFDMExec.h \
        FGModel.cpp FGModel.h \
@@ -15,3 +16,7 @@ libJSBsim_a_SOURCES = FGAircraft.cpp FGAircraft.h \
        FGUtility.cpp FGUtility.h \
        FGEngine.cpp FGEngine.h \
        FGTank.cpp FGTank.h 
+
+INCLUDES += -I$(top_builddir)
+
+DEFS += -DFGFS