From 687e883e0a5924a1f32cafa204f1034064ffe9f9 Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 5 Jun 1999 12:45:40 +0000 Subject: [PATCH] The next round of MacOS changes contributed by Darrell Walisser. Starting work on fixing tringle slivers in scenery generation tools. --- Lib/Bucket/newbucket.hxx | 7 +++++ Lib/Debug/logstream.hxx | 2 ++ Lib/Math/fg_geodesy.cxx | 5 ++-- Lib/Math/point3d.hxx | 7 +++++ Lib/Misc/fgstream.cxx | 15 ++++++++-- Simulator/Airports/genapt.cxx | 4 +-- Simulator/Astro/sky.cxx | 5 ++++ Simulator/GUI/gui.cxx | 10 ++++--- Simulator/Joystick/joystick.cxx | 4 +++ Simulator/Main/options.cxx | 2 +- Simulator/Scenery/tilecache.cxx | 3 +- Thanks | 5 ++-- Tools/Construct/Triangulate/polygon.cxx | 39 +++++++++++++++++++++++++ Tools/Construct/Triangulate/polygon.hxx | 19 ++++++++++++ 14 files changed, 112 insertions(+), 15 deletions(-) diff --git a/Lib/Bucket/newbucket.hxx b/Lib/Bucket/newbucket.hxx index c037f9dc0..c4f32e549 100644 --- a/Lib/Bucket/newbucket.hxx +++ b/Lib/Bucket/newbucket.hxx @@ -38,6 +38,13 @@ # include #endif +// I don't understand ... or should be included +// already depending on how you defined FG_HAVE_STD_INCLUDES, but I +// can go ahead and add this -- CLO +#ifdef __MWERKS__ +# include // needed fabs() +#endif + #include STL_STRING FG_USING_STD(string); diff --git a/Lib/Debug/logstream.hxx b/Lib/Debug/logstream.hxx index 5d3983f52..c49e1ebaa 100644 --- a/Lib/Debug/logstream.hxx +++ b/Lib/Debug/logstream.hxx @@ -48,6 +48,8 @@ FG_USING_STD(endl); #endif #ifdef __MWERKS__ +# define cerr std::cerr and +# define endl std::endl FG_USING_STD(iostream); #endif diff --git a/Lib/Math/fg_geodesy.cxx b/Lib/Math/fg_geodesy.cxx index 53d94ebfc..2b426502c 100644 --- a/Lib/Math/fg_geodesy.cxx +++ b/Lib/Math/fg_geodesy.cxx @@ -16,6 +16,7 @@ # include #endif +#include #include #include #include @@ -67,7 +68,7 @@ void fgGeocToGeod( double lat_geoc, double radius, double // check for domain error if ( errno == EDOM ) { - cout << "Domain ERROR in fgGeocToGeod!!!!\n"; + FG_LOG( FG_GENERAL, FG_ALERT, "Domain ERROR in fgGeocToGeod!!!!" ); *alt = 0.0; } @@ -83,7 +84,7 @@ void fgGeocToGeod( double lat_geoc, double radius, double // check for domain error if ( errno == EDOM ) { - cout << "Domain ERROR in fgGeocToGeod!!!!\n"; + FG_LOG( FG_GENERAL, FG_ALERT, "Domain ERROR in fgGeocToGeod!!!!" ); *sea_level_r = 0.0; } } diff --git a/Lib/Math/point3d.hxx b/Lib/Math/point3d.hxx index 5e419a803..d92638026 100644 --- a/Lib/Math/point3d.hxx +++ b/Lib/Math/point3d.hxx @@ -45,6 +45,13 @@ # include #endif +// I don't understand ... or should be included +// already depending on how you defined FG_HAVE_STD_INCLUDES, but I +// can go ahead and add this -- CLO +#ifdef __MWERKS__ +# include // needed fabs() +#endif + #ifndef FG_HAVE_NATIVE_SGI_COMPILERS FG_USING_STD(ostream); FG_USING_STD(istream); diff --git a/Lib/Misc/fgstream.cxx b/Lib/Misc/fgstream.cxx index 01b2c230b..3d5a09339 100644 --- a/Lib/Misc/fgstream.cxx +++ b/Lib/Misc/fgstream.cxx @@ -99,6 +99,14 @@ skipeol( istream& in ) if ( (c == '\n') || (c == '\r') ) { break; } + +#ifdef __MWERKS__ + // also break on '\0' + if ( c == '\0' ) { + break; + } +#endif + } return in; @@ -108,13 +116,14 @@ istream& skipws( istream& in ) { char c; while ( in.get(c) ) { + +#ifdef __MWERKS__ // -dw- for unix file compatibility // -clo- this causes problems for unix - #ifdef __MWERKS__ - if ( (c == '\n') || (c == '\r') ) { + if ( (c == '\n') || (c == '\r') || (c == '\0') ) { break; } - #endif +#endif if ( ! isspace( c ) ) { // put pack the non-space character diff --git a/Simulator/Airports/genapt.cxx b/Simulator/Airports/genapt.cxx index 48647631f..9dee13a8e 100644 --- a/Simulator/Airports/genapt.cxx +++ b/Simulator/Airports/genapt.cxx @@ -221,8 +221,8 @@ fgAptGenerate(const string& path, fgTILE *tile) // gpc_vertex_list perimeter_2d; fg_gzifstream in( path ); - if ( !in ) { - // exit immediately assuming an airport file for this tile + if ( !in.is_open() ) { + // return immediately assuming an airport file for this tile // doesn't exist. return 0; } diff --git a/Simulator/Astro/sky.cxx b/Simulator/Astro/sky.cxx index 1758117ad..28e5abe11 100644 --- a/Simulator/Astro/sky.cxx +++ b/Simulator/Astro/sky.cxx @@ -46,6 +46,11 @@ #include "sky.hxx" +#ifdef __MWERKS__ +# pragma global_optimizer off +#endif + + // in meters of course #define CENTER_ELEV 25000.0 diff --git a/Simulator/GUI/gui.cxx b/Simulator/GUI/gui.cxx index 303e1ac3c..7bbd73b81 100644 --- a/Simulator/GUI/gui.cxx +++ b/Simulator/GUI/gui.cxx @@ -57,6 +57,7 @@ #include
#include
#include
+#include #include