1
0
Fork 0

MACos fixes.

This commit is contained in:
curt 1999-09-11 14:35:28 +00:00
parent 2eaa10e1d0
commit b7a07affa5
8 changed files with 59 additions and 67 deletions

View file

@ -98,33 +98,26 @@
/*
CodeWarrior compiler from Metrowerks, Inc.
*/
# if (__MWERKS__ < 0x0900) //|| macintosh
# define FG_HAVE_TRAITS
# define FG_HAVE_STD_INCLUDES
# define FG_HAVE_STD
# define FG_NAMESPACES
# define FG_HAVE_TRAITS
# define FG_HAVE_STD_INCLUDES
# define FG_HAVE_STD
# define FG_NAMESPACES
# define STL_ALGORITHM <algorithm>
# define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip>
# define STL_IOSTREAM <iostream>
# define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string>
# define STL_ALGORITHM <algorithm>
# define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip>
# define STL_IOSTREAM <iostream>
# define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string>
// Temp:
# define bcopy(from, to, n) memcpy(to, from, n)
# define bcopy(from, to, n) memcpy(to, from, n)
// -rp- please use FG_MEM_COPY everywhere !
# define FG_MEM_COPY(to,from,n) memcpy(to, from, n)
# define FG_MEM_COPY(to,from,n) memcpy(to, from, n)
// -dw- currently used glut has no game mode stuff
# define GLUT_WRONG_VERSION
# elif (__MWERKS__ >= 0x0900) && __INTEL__
# error still to be supported...
# else
# error unknown Metrowerks compiler
# endif
# define GLUT_WRONG_VERSION
#endif
//

View file

@ -48,7 +48,7 @@ FG_USING_STD(endl);
#endif
#ifdef __MWERKS__
# define cerr std::cerr and
# define cerr std::cerr
# define endl std::endl
FG_USING_STD(iostream);
#endif

View file

@ -49,7 +49,7 @@
// already depending on how you defined FG_HAVE_STD_INCLUDES, but I
// can go ahead and add this -- CLO
#ifdef __MWERKS__
# include <math.h> // needed fabs()
FG_USING_NAMESPACE(std);
#endif
#ifndef FG_HAVE_NATIVE_SGI_COMPILERS
@ -57,11 +57,6 @@ FG_USING_STD(ostream);
FG_USING_STD(istream);
#endif
// -dw- someone seems to have forgotten this...
#ifdef __MWERKS__
FG_USING_STD(std);
#endif
const double fgPoint3_Epsilon = 0.0000001;

View file

@ -93,20 +93,17 @@ fg_gzifstream::attach( int fd, ios_openmode io_mode )
istream&
skipeol( istream& in )
{
char c = 0;
char c = '\0';
// skip to end of line.
while ( in.get(c) ) {
#ifdef __MWERKS__
while ( in.get(c) && c != '\0' ) {
#else
while ( in.get(c) ) {
#endif
if ( (c == '\n') || (c == '\r') ) {
break;
}
#ifdef __MWERKS__
// also break on '\0'
if ( c == '\0' ) {
break;
}
#endif
}
return in;
@ -115,32 +112,21 @@ skipeol( istream& in )
istream&
skipws( istream& in ) {
char c;
while ( in.get(c) ) {
#ifdef __MWERKS__
// -dw- for unix file compatibility
// -clo- this causes problems for unix
if ( (c == '\n') || (c == '\r') || (c == '\0') ) {
break;
}
if ( ! isspace( c ) && c != '\n' ) {
// put pack the non-space character
in.putback(c);
break;
}
while ( in.get(c) && c != '\0' ) {
#else
if ( ! isspace( c ) ) {
// put pack the non-space character
in.putback(c);
break;
}
while ( in.get(c) ) {
#endif
#ifdef __MWERKS__
if ( ! isspace( c ) && c != '\n' ) {
#else
if ( ! isspace( c ) ) {
#endif
// put pack the non-space character
in.putback(c);
break;
}
}
return in;
}

View file

@ -694,13 +694,19 @@ int fgOPTIONS::parse_command_line( int argc, char **argv ) {
// Parse config file options
int fgOPTIONS::parse_config_file( const string& path ) {
fg_gzifstream in( path );
if ( !in )
if ( !in.is_open() )
return(FG_OPTIONS_ERROR);
FG_LOG( FG_GENERAL, FG_INFO, "Processing config file: " << path );
in >> skipcomment;
while ( !in.eof() ) {
#ifndef __MWERKS__
while ( ! in.eof() ) {
#else
char c = '\0';
while ( in.get(c) && c != '\0' ) {
in.putback(c);
#endif
string line;
#ifdef GETLINE_NEEDS_TERMINATOR

View file

@ -134,12 +134,18 @@ fgMATERIAL_MGR::load_lib ( void )
mpath.append( "materials" );
fg_gzifstream in( mpath.str() );
if ( ! in ) {
if ( ! in.is_open() ) {
FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << mpath.str() );
exit(-1);
}
#ifndef __MWERKS__
while ( ! in.eof() ) {
#else
char c = '\0';
while ( in.get(c) && c != '\0' ) {
in.putback(c);
#endif
// printf("%s", line);
// strip leading white space and comments

View file

@ -168,13 +168,19 @@ int fgObjLoad( const string& path, FGTileEntry *t) {
// ignore initial comments and blank lines. (priming the pump)
// in >> skipcomment;
string line;
// string line;
string token;
char c;
#ifdef __MWERKS__
while ( in.get(c) && c != '\0' ) {
in.putback(c);
#else
while ( ! in.eof() ) {
string token;
char c;
#endif
#if defined( MACOS )
#ifdef __MWERKS__
in >> ::skipws;
#else
in >> skipws;

2
Thanks
View file

@ -136,7 +136,7 @@ Bob Kuehne <rpk@sgi.com>
Redid the Makefile system so it is simpler and more robust.
Vasily Lewis <vlewis@woodsoup.org> http://www.woodsoup.org
WoodSoup Project http://www.woodsoup.org
Provided computing resources and services so that the Flight Gear
project could have real home. This includes, web services, ftp services
shell accounts, email lists, dns services, etc.