]> git.mxchange.org Git - flightgear.git/commitdiff
Include/fg_callback.hxx
authorcurt <curt>
Tue, 15 Sep 1998 02:09:24 +0000 (02:09 +0000)
committercurt <curt>
Tue, 15 Sep 1998 02:09:24 +0000 (02:09 +0000)
  Moved code inline to stop g++ 2.7 from complaining.

Simulator/Time/event.[ch]xx
  Changed return type of fgEVENT::printStat().  void caused g++ 2.7 to
  complain bitterly.

Minor bugfix and changes.

Simulator/Main/GLUTmain.cxx
  Added missing type to idle_state definition - eliminates a warning.

Simulator/Main/fg_init.cxx
  Changes to airport lookup.

Simulator/Main/options.cxx
  Uses fg_gzifstream when loading config file.

Main/GLUTmain.cxx
Main/fg_init.cxx
Main/options.cxx
Time/event.cxx
Time/event.hxx

index 1f00dc5faf0d81c70ed8ccea183af538993d7cc5..b53080a2e9cb010e8046020acb07a786cb8b92e5 100644 (file)
@@ -93,7 +93,7 @@ fgGENERAL general;
 // Specify our current idle function state.  This is used to run all
 // our initializations out of the glutIdleLoop() so that we can get a
 // splash screen up and running right away.
-static idle_state = 0;
+static int idle_state = 0;
 
 // Another hack
 int use_signals = 0;
@@ -609,7 +609,6 @@ static void fgMainLoop( void ) {
 
 static void fgIdleFunction ( void ) {
     fgGENERAL *g;
-
     g = &general;
 
     // printf("idle state == %d\n", idle_state);
@@ -889,6 +888,25 @@ int main( int argc, char **argv ) {
 
 
 // $Log$
+// Revision 1.50  1998/09/15 02:09:24  curt
+// Include/fg_callback.hxx
+//   Moved code inline to stop g++ 2.7 from complaining.
+//
+// Simulator/Time/event.[ch]xx
+//   Changed return type of fgEVENT::printStat().  void caused g++ 2.7 to
+//   complain bitterly.
+//
+// Minor bugfix and changes.
+//
+// Simulator/Main/GLUTmain.cxx
+//   Added missing type to idle_state definition - eliminates a warning.
+//
+// Simulator/Main/fg_init.cxx
+//   Changes to airport lookup.
+//
+// Simulator/Main/options.cxx
+//   Uses fg_gzifstream when loading config file.
+//
 // Revision 1.49  1998/09/09 16:25:39  curt
 // Only use GLUT_STENCIL if the instument panel has been requested.
 //
index ec3dea84eb9e608eb05143ec72ce028e54a079b7..5f02eee73ec9bdb6a48cc6253cab876bf7c67a18 100644 (file)
@@ -91,15 +91,12 @@ int fgInitPosition( void ) {
                  id.c_str() );
 
        airports.load("apt_simple");
-       a = airports.search( (char *)id.c_str() );
-       if ( (fabs(a.longitude) < FG_EPSILON) &&
-            (fabs(a.latitude) < FG_EPSILON) &&
-            (fabs(a.elevation) < FG_EPSILON) ) {
+       if ( ! airports.search( id, &a ) ) {
            fgPrintf( FG_GENERAL, FG_EXIT, 
                      "Failed to find %s in database.\n", id.c_str() );
        } else {
-           FG_Longitude = ( a.longitude ) * DEG_TO_RAD;
-           FG_Latitude  = ( a.latitude ) * DEG_TO_RAD;
+           FG_Longitude = a.longitude * DEG_TO_RAD;
+           FG_Latitude  = a.latitude * DEG_TO_RAD;
        }
     } else {
        // set initial position from default or command line coordinates
@@ -392,6 +389,25 @@ int fgInitSubsystems( void )
 
 
 // $Log$
+// Revision 1.37  1998/09/15 02:09:26  curt
+// Include/fg_callback.hxx
+//   Moved code inline to stop g++ 2.7 from complaining.
+//
+// Simulator/Time/event.[ch]xx
+//   Changed return type of fgEVENT::printStat().  void caused g++ 2.7 to
+//   complain bitterly.
+//
+// Minor bugfix and changes.
+//
+// Simulator/Main/GLUTmain.cxx
+//   Added missing type to idle_state definition - eliminates a warning.
+//
+// Simulator/Main/fg_init.cxx
+//   Changes to airport lookup.
+//
+// Simulator/Main/options.cxx
+//   Uses fg_gzifstream when loading config file.
+//
 // Revision 1.36  1998/09/08 21:40:08  curt
 // Fixes by Charlie Hotchkiss.
 //
index 8ad3b419c233b929ee39b43c756d66865bb03459..f13ee95bdcfd776175e46c89bb25c1593493fc1a 100644 (file)
 #include <Debug/fg_debug.h>
 #include <Flight/flight.h>
 #include <Include/fg_constants.h>
-#include <Include/fg_zlib.h>
+#include <Misc/fgstream.hxx>
 
 #include "options.hxx"
 
+const int fgOPTIONS::FG_RADIUS_MIN;
+const int fgOPTIONS::FG_RADIUS_MAX;
+
 inline double
 atof( const string& str )
 {
@@ -462,43 +465,27 @@ int fgOPTIONS::parse_command_line( int argc, char **argv ) {
 
 // Parse config file options
 int fgOPTIONS::parse_config_file( const string& path ) {
-    char line[256];
-    fgFile f;
-    int len;
-    string fgpath = path + ".gz";
-
-    // first try "path.gz"
-    if ( (f = fgopen(fgpath.c_str(), "rb")) == NULL ) {
-       // next try "path"
-        if ( (f = fgopen(path.c_str(), "rb")) == NULL ) {
-           return(FG_OPTIONS_ERROR);
-       }
-    }
+    fg_gzifstream in( path );
+    if ( !in )
+       return(FG_OPTIONS_ERROR);
 
     fgPrintf( FG_GENERAL, FG_INFO, "Processing config file: %s\n",
              path.c_str() );
 
-    while ( fggets(f, line, 250) != NULL ) {
-       // strip trailing newline if it exists
-       len = strlen(line);
-       if ( line[len-1] == '\n' ) {
-           line[len-1] = '\0';
-       }
-
-        // strip dos ^M if it exists
-       len = strlen(line);
-       if ( line[len-1] == '\r' ) {
-           line[len-1] = '\0';
-       }
+    in.eat_comments();
+    while ( !in.eof() )
+    {
+       string line;
+       getline( in.stream(), line );
 
-       if (  parse_option( line ) == FG_OPTIONS_ERROR ) {
+       if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
            fgPrintf( FG_GENERAL, FG_EXIT, 
                      "Config file parse error: %s '%s'\n",
-                     path.c_str(), line );
+                     path.c_str(), line.c_str() );
        }
+       in.eat_comments();
     }
 
-    fgclose(f);
     return FG_OPTIONS_OK;
 }
 
@@ -579,6 +566,25 @@ fgOPTIONS::~fgOPTIONS( void ) {
 
 
 // $Log$
+// Revision 1.25  1998/09/15 02:09:27  curt
+// Include/fg_callback.hxx
+//   Moved code inline to stop g++ 2.7 from complaining.
+//
+// Simulator/Time/event.[ch]xx
+//   Changed return type of fgEVENT::printStat().  void caused g++ 2.7 to
+//   complain bitterly.
+//
+// Minor bugfix and changes.
+//
+// Simulator/Main/GLUTmain.cxx
+//   Added missing type to idle_state definition - eliminates a warning.
+//
+// Simulator/Main/fg_init.cxx
+//   Changes to airport lookup.
+//
+// Simulator/Main/options.cxx
+//   Uses fg_gzifstream when loading config file.
+//
 // Revision 1.24  1998/09/08 15:04:33  curt
 // Optimizations by Norman Vine.
 //
index 4dd2d32635e6f430b5fde993d2724ac380019a5e..54f077cd13f35a7297f1b2e0a3ac3381fb6e4ebd 100644 (file)
@@ -128,7 +128,7 @@ fgEVENT::run()
 
 
 // Dump scheduling stats
-void
+int
 fgEVENT::PrintStats() const
 {
     printf("  %-30s int=%.2fs cum=%ld min=%ld max=%ld count=%ld ave=%.2f\n",
@@ -136,9 +136,9 @@ fgEVENT::PrintStats() const
           interval / 1000.0,
           cum_time, min_time, max_time, count, 
           cum_time / (double)count);
+    return 0;
 }
 
-
 // Constructor
 fgEVENT_MGR::fgEVENT_MGR( void ) {
 }
@@ -191,7 +191,6 @@ void fgEVENT_MGR::Suspend( void ) {
 void fgEVENT_MGR::Resume( void ) {
 }
 
-
 // Dump scheduling stats
 void
 fgEVENT_MGR::PrintStats()
@@ -259,6 +258,25 @@ fgEVENT_MGR::~fgEVENT_MGR( void ) {
 
 
 // $Log$
+// Revision 1.8  1998/09/15 02:09:29  curt
+// Include/fg_callback.hxx
+//   Moved code inline to stop g++ 2.7 from complaining.
+//
+// Simulator/Time/event.[ch]xx
+//   Changed return type of fgEVENT::printStat().  void caused g++ 2.7 to
+//   complain bitterly.
+//
+// Minor bugfix and changes.
+//
+// Simulator/Main/GLUTmain.cxx
+//   Added missing type to idle_state definition - eliminates a warning.
+//
+// Simulator/Main/fg_init.cxx
+//   Changes to airport lookup.
+//
+// Simulator/Main/options.cxx
+//   Uses fg_gzifstream when loading config file.
+//
 // Revision 1.7  1998/08/29 13:11:31  curt
 // Bernie Bright writes:
 //   I've created some new classes to enable pointers-to-functions and
index a068a131075ffc05336a2072a46f34202acff5b7..1d7fb61c5cd9119c73caa2291a926de9a2b64f01 100644 (file)
@@ -68,7 +68,7 @@ public:
        FG_EVENT_QUEUED = 2
     };
 
-    fgEVENT(); // Required by deque<>.
+    fgEVENT() {} // Required by deque<>.
 
     fgEVENT( const string& desc,
             const fgCallback& cb,
@@ -81,7 +81,8 @@ public:
 
     void run();
 
-    void PrintStats() const;
+//     void PrintStats() const;
+    int PrintStats() const;
 
 public:
 
@@ -168,6 +169,25 @@ extern fgEVENT_MGR global_events;
 
 
 // $Log$
+// Revision 1.11  1998/09/15 02:09:30  curt
+// Include/fg_callback.hxx
+//   Moved code inline to stop g++ 2.7 from complaining.
+//
+// Simulator/Time/event.[ch]xx
+//   Changed return type of fgEVENT::printStat().  void caused g++ 2.7 to
+//   complain bitterly.
+//
+// Minor bugfix and changes.
+//
+// Simulator/Main/GLUTmain.cxx
+//   Added missing type to idle_state definition - eliminates a warning.
+//
+// Simulator/Main/fg_init.cxx
+//   Changes to airport lookup.
+//
+// Simulator/Main/options.cxx
+//   Uses fg_gzifstream when loading config file.
+//
 // Revision 1.10  1998/09/08 21:41:06  curt
 // Added constructor for fgEVENT.
 //