From: david Date: Tue, 31 Dec 2002 14:47:34 +0000 (+0000) Subject: Patch from Erik Hofman: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=78411d29a7fdd606e50a81d03d6e8a08dcb15828;p=simgear.git Patch from Erik Hofman: This patch adds some more functionality to the header files and removes *all* dependencies on SG_HAVE_NATIVE_SGI_COMPILERS in the SimGear code! [dpm: I had to add some additional SG_USING_STD declarations to make it compile] --- diff --git a/simgear/bucket/newbucket.hxx b/simgear/bucket/newbucket.hxx index 0cc07294..9f4fb77a 100644 --- a/simgear/bucket/newbucket.hxx +++ b/simgear/bucket/newbucket.hxx @@ -54,10 +54,7 @@ SG_USING_STD(fabs); #include STL_STRING SG_USING_STD(string); - -#if ! defined( SG_HAVE_NATIVE_SGI_COMPILERS ) SG_USING_STD(ostream); -#endif /** diff --git a/simgear/compatibility/Makefile.am b/simgear/compatibility/Makefile.am index 8ab827c6..5d13d21b 100644 --- a/simgear/compatibility/Makefile.am +++ b/simgear/compatibility/Makefile.am @@ -2,6 +2,35 @@ includedir = @includedir@/compatibility EXTRA_DIST = README +include_HEADERS = \ + cfloat \ + csetjmp \ + cstdio \ + cwchar \ + iostream \ + strstream \ + cassert \ + climits \ + csignal \ + cstdlib \ + cwctype \ + istream \ + cctype \ + clocale \ + cstdarg \ + cstring \ + fstream \ + iterator \ + cerrno \ + cmath \ + cstddef \ + ctime \ + iomanip \ + streambuf +includedir = @includedir@/compatibility + +EXTRA_DIST = README + include_HEADERS = \ cfloat \ csetjmp \ diff --git a/simgear/compatibility/iostream b/simgear/compatibility/iostream index b03afdb3..36285efb 100644 --- a/simgear/compatibility/iostream +++ b/simgear/compatibility/iostream @@ -3,6 +3,7 @@ #define __SG_IOSTREAM 1 # include +# include #if defined(sgi) && !defined(__GNUC__) @@ -20,7 +21,14 @@ using ::cout; using ::cerr; using ::clog; + using ::endl; + using ::ios_base; + using ::istream; + using ::ostream; + + using ::ifstream; + using ::ofstream; }; #endif diff --git a/simgear/compatibility/istream b/simgear/compatibility/istream index 367c47f2..b8b5668c 100644 --- a/simgear/compatibility/istream +++ b/simgear/compatibility/istream @@ -2,10 +2,14 @@ #ifndef __SG_ISTREAM #define __SG_ISTREAM 1 +# include + #if defined(sgi) && !defined(__GNUC__) # include -# include +# include + + using std::getline; #endif diff --git a/simgear/compatibility/streambuf b/simgear/compatibility/streambuf index 49b95c0e..bee458f5 100644 --- a/simgear/compatibility/streambuf +++ b/simgear/compatibility/streambuf @@ -2,27 +2,36 @@ #ifndef __SG_STREAMBUF #define __SG_STREAMBUF 1 -#if defined(sgi) && !defined(__GNUC__) - -# include # include +# include -# define pubsync sync +// +// Until we find a good way to rename the original streambuf class +// and derive our own streambuf class from that, define this variable +// for now so the code can inherit our streambuf class instead. +// +# define SG_NEED_STREAMBUF_HACK 1 - using std::char_traits; +class __streambuf : virtual public streambuf { +public: - typedef char_traits traits_type; - typedef char_traits::int_type int_type; + typedef std::char_traits traits_type; + typedef std::char_traits::int_type int_type; typedef streampos pos_type; typedef streamoff off_type; +}; + + +#if defined(sgi) && !defined(__GNUC__) + +# define pubsync sync namespace std { using ::streambuf; using ::streampos; using ::streamoff; }; - #endif #endif // !__SG_STREAMBUF diff --git a/simgear/debug/logstream.hxx b/simgear/debug/logstream.hxx index f28ca610..12c2dfee 100644 --- a/simgear/debug/logstream.hxx +++ b/simgear/debug/logstream.hxx @@ -28,11 +28,6 @@ #include -// At least Irix needs this -#ifdef SG_HAVE_NATIVE_SGI_COMPILERS -#include -#endif - #ifdef SG_HAVE_STD_INCLUDES # include # include @@ -43,15 +38,11 @@ #include -#ifndef SG_HAVE_NATIVE_SGI_COMPILERS SG_USING_STD(streambuf); SG_USING_STD(ostream); SG_USING_STD(cout); SG_USING_STD(cerr); SG_USING_STD(endl); -#else -SG_USING_STD(char_traits); -#endif #ifdef __MWERKS__ SG_USING_STD(iostream); @@ -70,7 +61,11 @@ SG_USING_STD(iostream); * messages at runtime. Only messages with priority >= logbuf::logPriority * and debugClass == logbuf::logClass are output. */ +#ifdef SG_NEED_STREAMBUF_HACK +class logbuf : public __streambuf +#else class logbuf : public streambuf +#endif { public: diff --git a/simgear/ephemeris/stardata.cxx b/simgear/ephemeris/stardata.cxx index f3dffb17..f988d5bc 100644 --- a/simgear/ephemeris/stardata.cxx +++ b/simgear/ephemeris/stardata.cxx @@ -27,7 +27,7 @@ #include "stardata.hxx" -#if defined (_MSC_VER) || defined (SG_HAVE_NATIVE_SGI_COMPILERS) +#if defined (_MSC_VER) SG_USING_STD(getline); #endif diff --git a/simgear/io/decode_binobj.cxx b/simgear/io/decode_binobj.cxx index dbb1e1db..70a50f5e 100644 --- a/simgear/io/decode_binobj.cxx +++ b/simgear/io/decode_binobj.cxx @@ -3,12 +3,10 @@ #include #include STL_IOSTREAM -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) +#include "sg_binobj.hxx" + SG_USING_STD(cout); SG_USING_STD(endl); -#endif - -#include "sg_binobj.hxx" int main( int argc, char **argv ) { diff --git a/simgear/io/lowtest.cxx b/simgear/io/lowtest.cxx index 85620357..85ecf6b3 100644 --- a/simgear/io/lowtest.cxx +++ b/simgear/io/lowtest.cxx @@ -3,16 +3,14 @@ #include STL_IOSTREAM #include "lowlevel.hxx" -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) -SG_USING_STD(cout); -SG_USING_STD(endl); -#endif - static const int sgEndianTest = 1; #define sgIsLittleEndian (*((char *) &sgEndianTest ) != 0) #define sgIsBigEndian (*((char *) &sgEndianTest ) == 0) +SG_USING_STD(cout); +SG_USING_STD(endl); + int main() { cout << "This machine is "; diff --git a/simgear/io/sg_binobj.cxx b/simgear/io/sg_binobj.cxx index d2da18ef..3c1f976f 100644 --- a/simgear/io/sg_binobj.cxx +++ b/simgear/io/sg_binobj.cxx @@ -42,11 +42,8 @@ SG_USING_STD( string ); SG_USING_STD( vector ); - -#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD( cout ); SG_USING_STD( endl ); -#endif enum { diff --git a/simgear/io/socktest.cxx b/simgear/io/socktest.cxx index 358c32e0..2586b42c 100644 --- a/simgear/io/socktest.cxx +++ b/simgear/io/socktest.cxx @@ -6,15 +6,14 @@ #include "sg_socket.hxx" #include "lowlevel.hxx" -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) -SG_USING_STD(cout); -SG_USING_STD(endl); -#endif - static const int sgEndianTest = 1; #define sgIsLittleEndian (*((char *) &sgEndianTest ) != 0) #define sgIsBigEndian (*((char *) &sgEndianTest ) == 0) +SG_USING_STD(cout); +SG_USING_STD(endl); + + int main() { if ( sgIsLittleEndian ) { diff --git a/simgear/io/tcp_client.cxx b/simgear/io/tcp_client.cxx index a02e25d3..d1d7f8c7 100644 --- a/simgear/io/tcp_client.cxx +++ b/simgear/io/tcp_client.cxx @@ -11,9 +11,6 @@ #include "sg_socket.hxx" -#ifndef SG_HAVE_NATIVE_SGI_COMPILERS -using std::cout; -#endif class TcpClient { diff --git a/simgear/io/tcp_server.cxx b/simgear/io/tcp_server.cxx index cd9b8ea7..b0534937 100644 --- a/simgear/io/tcp_server.cxx +++ b/simgear/io/tcp_server.cxx @@ -5,10 +5,8 @@ #include "sg_socket.hxx" -using std::string; -#ifndef SG_HAVE_NATIVE_SGI_COMPILERS -using std::cout; -#endif +SG_USING_STD(string); +SG_USING_STD(cout); class TcpServer { diff --git a/simgear/math/point3d.hxx b/simgear/math/point3d.hxx index 3537d45c..11445ea0 100644 --- a/simgear/math/point3d.hxx +++ b/simgear/math/point3d.hxx @@ -61,10 +61,8 @@ SG_USING_NAMESPACE(std); #endif -#ifndef SG_HAVE_NATIVE_SGI_COMPILERS SG_USING_STD(ostream); SG_USING_STD(istream); -#endif const double fgPoint3_Epsilon = 0.0000001; diff --git a/simgear/math/sg_geodesy.cxx b/simgear/math/sg_geodesy.cxx index 4393778d..cc5ac15c 100644 --- a/simgear/math/sg_geodesy.cxx +++ b/simgear/math/sg_geodesy.cxx @@ -27,9 +27,7 @@ #include "localconsts.hxx" -#ifndef SG_HAVE_NATIVE_SGI_COMPILERS SG_USING_STD(cout); -#endif #define DOMAIN_ERR_DEBUG 1 diff --git a/simgear/metar/MetarReport.cpp b/simgear/metar/MetarReport.cpp index 2987feea..57107b5e 100644 --- a/simgear/metar/MetarReport.cpp +++ b/simgear/metar/MetarReport.cpp @@ -7,10 +7,8 @@ #include "MetarReport.h" #include "Metar.h" -#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(endl); SG_USING_STD(ostream); -#endif CMetarReport::CMetarReport( char *s ) : diff --git a/simgear/metar/MetarStation.cpp b/simgear/metar/MetarStation.cpp index 9000ae5c..d0ee7386 100644 --- a/simgear/metar/MetarStation.cpp +++ b/simgear/metar/MetarStation.cpp @@ -8,11 +8,9 @@ #include "MetarStation.h" #include -#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(ostream); SG_USING_STD(cout); SG_USING_STD(endl); -#endif double CMetarStation::decodeDMS( char *b ) diff --git a/simgear/misc/props.hxx b/simgear/misc/props.hxx index c22d3036..a042c61d 100644 --- a/simgear/misc/props.hxx +++ b/simgear/misc/props.hxx @@ -36,10 +36,8 @@ using std::ostream; #include STL_IOSTREAM SG_USING_STD(string); SG_USING_STD(vector); -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(istream); SG_USING_STD(ostream); -#endif #endif diff --git a/simgear/misc/props_io.cxx b/simgear/misc/props_io.cxx index 15c522be..36ea2b7e 100644 --- a/simgear/misc/props_io.cxx +++ b/simgear/misc/props_io.cxx @@ -12,21 +12,15 @@ #include "props_io.hxx" #include STL_IOSTREAM -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) -# include -#else -# include -#endif +#include STL_FSTREAM #include STL_STRING #include #include -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(istream); SG_USING_STD(ifstream); SG_USING_STD(ostream); SG_USING_STD(ofstream); -#endif SG_USING_STD(string); SG_USING_STD(vector); SG_USING_STD(map); diff --git a/simgear/misc/props_io.hxx b/simgear/misc/props_io.hxx index f5ed425f..83e84c5a 100644 --- a/simgear/misc/props_io.hxx +++ b/simgear/misc/props_io.hxx @@ -25,10 +25,8 @@ SG_USING_STD(string); SG_USING_STD(vector); SG_USING_STD(map); -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(istream); SG_USING_STD(ostream); -#endif /** * Read properties from an XML input stream. diff --git a/simgear/misc/props_test.cxx b/simgear/misc/props_test.cxx index b98e6e6b..ab29deee 100644 --- a/simgear/misc/props_test.cxx +++ b/simgear/misc/props_test.cxx @@ -9,11 +9,9 @@ #include "props.hxx" #include "props_io.hxx" -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(cout); SG_USING_STD(cerr); SG_USING_STD(endl); -#endif diff --git a/simgear/misc/sgstream.hxx b/simgear/misc/sgstream.hxx index 373ebc79..1131171b 100644 --- a/simgear/misc/sgstream.hxx +++ b/simgear/misc/sgstream.hxx @@ -36,8 +36,6 @@ #if defined( SG_HAVE_STD_INCLUDES ) # include -#elif defined ( SG_HAVE_NATIVE_SGI_COMPILERS ) -# include #elif defined ( __BORLANDC__ ) # include #else @@ -49,10 +47,7 @@ #include SG_USING_STD(string); - -#ifndef SG_HAVE_NATIVE_SGI_COMPILERS SG_USING_STD(istream); -#endif /** diff --git a/simgear/misc/zfstream.hxx b/simgear/misc/zfstream.hxx index bf9f1733..153c357e 100644 --- a/simgear/misc/zfstream.hxx +++ b/simgear/misc/zfstream.hxx @@ -32,12 +32,6 @@ #include -// At least Irix needs this -#ifdef SG_HAVE_NATIVE_SGI_COMPILERS -#include -SG_USING_STD(char_traits); -#endif - #ifdef SG_HAVE_STD_INCLUDES # include @@ -76,8 +70,6 @@ SG_USING_STD(streamoff); #if defined(__GNUC__) && __GNUC_MINOR__ < 8 # define ios_binary ios::bin -#elif defined( SG_HAVE_NATIVE_SGI_COMPILERS ) -# define ios_binary 0 #else # define ios_binary ios::binary #endif @@ -94,7 +86,11 @@ SG_USING_STD(streamoff); /** * A C++ I/O streams interface to the zlib gz* functions. */ +#ifdef SG_NEED_STREAMBUF_HACK +class gzfilebuf : public __streambuf +#else class gzfilebuf : public streambuf +#endif { public: diff --git a/simgear/route/routetest.cxx b/simgear/route/routetest.cxx index 313ed528..1d8be5af 100644 --- a/simgear/route/routetest.cxx +++ b/simgear/route/routetest.cxx @@ -6,10 +6,8 @@ #include "route.hxx" #include "waypoint.hxx" -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(cout); SG_USING_STD(endl); -#endif int main() { SGRoute route; diff --git a/simgear/route/waytest.cxx b/simgear/route/waytest.cxx index bc31b9c5..0d57bff8 100644 --- a/simgear/route/waytest.cxx +++ b/simgear/route/waytest.cxx @@ -5,11 +5,8 @@ #include "waypoint.hxx" -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(cout); SG_USING_STD(endl); -#endif - int main() { SGWayPoint a1(-93.216923, 44.880547, 0.0, SGWayPoint::WGS84, "KMSP"); diff --git a/simgear/scene/sky/sphere.cxx b/simgear/scene/sky/sphere.cxx index 428d966b..9ca29218 100644 --- a/simgear/scene/sky/sphere.cxx +++ b/simgear/scene/sky/sphere.cxx @@ -30,10 +30,8 @@ #include #include -#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(cout); SG_USING_STD(endl); -#endif // return a sphere object as an ssgBranch diff --git a/simgear/scene/sky/stars.cxx b/simgear/scene/sky/stars.cxx index 0ca2efb4..55602b2f 100644 --- a/simgear/scene/sky/stars.cxx +++ b/simgear/scene/sky/stars.cxx @@ -35,10 +35,8 @@ #include "stars.hxx" -#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(cout); SG_USING_STD(endl); -#endif // Set up star rendering call backs diff --git a/simgear/serial/serial.cxx b/simgear/serial/serial.cxx index 0859122d..1035f8dd 100644 --- a/simgear/serial/serial.cxx +++ b/simgear/serial/serial.cxx @@ -46,11 +46,8 @@ #include "serial.hxx" -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(cout); SG_USING_STD(endl); -#endif - FGSerialPort::FGSerialPort() : dev_open(false) diff --git a/simgear/serial/testserial.cxx b/simgear/serial/testserial.cxx index d005f32f..1a6bab6d 100644 --- a/simgear/serial/testserial.cxx +++ b/simgear/serial/testserial.cxx @@ -7,11 +7,8 @@ #include "serial.hxx" -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(cout); SG_USING_STD(endl); -#endif - int main () { FGSerialPort port; diff --git a/simgear/xml/easyxml.cxx b/simgear/xml/easyxml.cxx index c1aed185..181e646b 100644 --- a/simgear/xml/easyxml.cxx +++ b/simgear/xml/easyxml.cxx @@ -9,9 +9,7 @@ #include STL_FSTREAM -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(ifstream); -#endif diff --git a/simgear/xml/easyxml.hxx b/simgear/xml/easyxml.hxx index 1e5404d6..348151ef 100644 --- a/simgear/xml/easyxml.hxx +++ b/simgear/xml/easyxml.hxx @@ -16,9 +16,7 @@ #include STL_STRING #include -#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) SG_USING_STD(istream); -#endif SG_USING_STD(string); SG_USING_STD(vector);