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.
// 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;
static void fgIdleFunction ( void ) {
fgGENERAL *g;
-
g = &general;
// printf("idle state == %d\n", idle_state);
// $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.
//
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
// $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.
//
#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 )
{
// 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;
}
// $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.
//
// Dump scheduling stats
-void
+int
fgEVENT::PrintStats() const
{
printf(" %-30s int=%.2fs cum=%ld min=%ld max=%ld count=%ld ave=%.2f\n",
interval / 1000.0,
cum_time, min_time, max_time, count,
cum_time / (double)count);
+ return 0;
}
-
// Constructor
fgEVENT_MGR::fgEVENT_MGR( void ) {
}
void fgEVENT_MGR::Resume( void ) {
}
-
// Dump scheduling stats
void
fgEVENT_MGR::PrintStats()
// $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
FG_EVENT_QUEUED = 2
};
- fgEVENT(); // Required by deque<>.
+ fgEVENT() {} // Required by deque<>.
fgEVENT( const string& desc,
const fgCallback& cb,
void run();
- void PrintStats() const;
+// void PrintStats() const;
+ int PrintStats() const;
public:
// $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.
//