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]
This commit is contained in:
david
2002-12-31 14:47:34 +00:00
parent f8a49c41ef
commit 78411d29a7
31 changed files with 80 additions and 99 deletions
-3
View File
@@ -54,10 +54,7 @@ SG_USING_STD(fabs);
#include STL_STRING #include STL_STRING
SG_USING_STD(string); SG_USING_STD(string);
#if ! defined( SG_HAVE_NATIVE_SGI_COMPILERS )
SG_USING_STD(ostream); SG_USING_STD(ostream);
#endif
/** /**
+29
View File
@@ -2,6 +2,35 @@ includedir = @includedir@/compatibility
EXTRA_DIST = README 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 = \ include_HEADERS = \
cfloat \ cfloat \
csetjmp \ csetjmp \
+8
View File
@@ -3,6 +3,7 @@
#define __SG_IOSTREAM 1 #define __SG_IOSTREAM 1
# include <iostream.h> # include <iostream.h>
# include <fstream.h>
#if defined(sgi) && !defined(__GNUC__) #if defined(sgi) && !defined(__GNUC__)
@@ -20,7 +21,14 @@
using ::cout; using ::cout;
using ::cerr; using ::cerr;
using ::clog; using ::clog;
using ::endl;
using ::ios_base; using ::ios_base;
using ::istream;
using ::ostream;
using ::ifstream;
using ::ofstream;
}; };
#endif #endif
+5 -1
View File
@@ -2,10 +2,14 @@
#ifndef __SG_ISTREAM #ifndef __SG_ISTREAM
#define __SG_ISTREAM 1 #define __SG_ISTREAM 1
# include <iostream>
#if defined(sgi) && !defined(__GNUC__) #if defined(sgi) && !defined(__GNUC__)
# include <stream.h> # include <stream.h>
# include <iostream> # include <string>
using std::getline;
#endif #endif
+17 -8
View File
@@ -2,27 +2,36 @@
#ifndef __SG_STREAMBUF #ifndef __SG_STREAMBUF
#define __SG_STREAMBUF 1 #define __SG_STREAMBUF 1
#if defined(sgi) && !defined(__GNUC__)
# include <char_traits.h>
# include <iostream> # include <iostream>
# include <char_traits.h>
# 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<char> traits_type; typedef std::char_traits<char> traits_type;
typedef char_traits<char>::int_type int_type; typedef std::char_traits<char>::int_type int_type;
typedef streampos pos_type; typedef streampos pos_type;
typedef streamoff off_type; typedef streamoff off_type;
};
#if defined(sgi) && !defined(__GNUC__)
# define pubsync sync
namespace std { namespace std {
using ::streambuf; using ::streambuf;
using ::streampos; using ::streampos;
using ::streamoff; using ::streamoff;
}; };
#endif #endif
#endif // !__SG_STREAMBUF #endif // !__SG_STREAMBUF
+4 -9
View File
@@ -28,11 +28,6 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
// At least Irix needs this
#ifdef SG_HAVE_NATIVE_SGI_COMPILERS
#include <char_traits.h>
#endif
#ifdef SG_HAVE_STD_INCLUDES #ifdef SG_HAVE_STD_INCLUDES
# include <streambuf> # include <streambuf>
# include <iostream> # include <iostream>
@@ -43,15 +38,11 @@
#include <simgear/debug/debug_types.h> #include <simgear/debug/debug_types.h>
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS
SG_USING_STD(streambuf); SG_USING_STD(streambuf);
SG_USING_STD(ostream); SG_USING_STD(ostream);
SG_USING_STD(cout); SG_USING_STD(cout);
SG_USING_STD(cerr); SG_USING_STD(cerr);
SG_USING_STD(endl); SG_USING_STD(endl);
#else
SG_USING_STD(char_traits);
#endif
#ifdef __MWERKS__ #ifdef __MWERKS__
SG_USING_STD(iostream); SG_USING_STD(iostream);
@@ -70,7 +61,11 @@ SG_USING_STD(iostream);
* messages at runtime. Only messages with priority >= logbuf::logPriority * messages at runtime. Only messages with priority >= logbuf::logPriority
* and debugClass == logbuf::logClass are output. * and debugClass == logbuf::logClass are output.
*/ */
#ifdef SG_NEED_STREAMBUF_HACK
class logbuf : public __streambuf
#else
class logbuf : public streambuf class logbuf : public streambuf
#endif
{ {
public: public:
+1 -1
View File
@@ -27,7 +27,7 @@
#include "stardata.hxx" #include "stardata.hxx"
#if defined (_MSC_VER) || defined (SG_HAVE_NATIVE_SGI_COMPILERS) #if defined (_MSC_VER)
SG_USING_STD(getline); SG_USING_STD(getline);
#endif #endif
+2 -4
View File
@@ -3,12 +3,10 @@
#include <unistd.h> #include <unistd.h>
#include STL_IOSTREAM #include STL_IOSTREAM
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) #include "sg_binobj.hxx"
SG_USING_STD(cout); SG_USING_STD(cout);
SG_USING_STD(endl); SG_USING_STD(endl);
#endif
#include "sg_binobj.hxx"
int main( int argc, char **argv ) { int main( int argc, char **argv ) {
+3 -5
View File
@@ -3,16 +3,14 @@
#include STL_IOSTREAM #include STL_IOSTREAM
#include "lowlevel.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; static const int sgEndianTest = 1;
#define sgIsLittleEndian (*((char *) &sgEndianTest ) != 0) #define sgIsLittleEndian (*((char *) &sgEndianTest ) != 0)
#define sgIsBigEndian (*((char *) &sgEndianTest ) == 0) #define sgIsBigEndian (*((char *) &sgEndianTest ) == 0)
SG_USING_STD(cout);
SG_USING_STD(endl);
int main() { int main() {
cout << "This machine is "; cout << "This machine is ";
-3
View File
@@ -42,11 +42,8 @@
SG_USING_STD( string ); SG_USING_STD( string );
SG_USING_STD( vector ); SG_USING_STD( vector );
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD( cout ); SG_USING_STD( cout );
SG_USING_STD( endl ); SG_USING_STD( endl );
#endif
enum { enum {
+4 -5
View File
@@ -6,15 +6,14 @@
#include "sg_socket.hxx" #include "sg_socket.hxx"
#include "lowlevel.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; static const int sgEndianTest = 1;
#define sgIsLittleEndian (*((char *) &sgEndianTest ) != 0) #define sgIsLittleEndian (*((char *) &sgEndianTest ) != 0)
#define sgIsBigEndian (*((char *) &sgEndianTest ) == 0) #define sgIsBigEndian (*((char *) &sgEndianTest ) == 0)
SG_USING_STD(cout);
SG_USING_STD(endl);
int main() { int main() {
if ( sgIsLittleEndian ) { if ( sgIsLittleEndian ) {
-3
View File
@@ -11,9 +11,6 @@
#include "sg_socket.hxx" #include "sg_socket.hxx"
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS
using std::cout;
#endif
class TcpClient class TcpClient
{ {
+2 -4
View File
@@ -5,10 +5,8 @@
#include "sg_socket.hxx" #include "sg_socket.hxx"
using std::string; SG_USING_STD(string);
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS SG_USING_STD(cout);
using std::cout;
#endif
class TcpServer class TcpServer
{ {
-2
View File
@@ -61,10 +61,8 @@
SG_USING_NAMESPACE(std); SG_USING_NAMESPACE(std);
#endif #endif
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS
SG_USING_STD(ostream); SG_USING_STD(ostream);
SG_USING_STD(istream); SG_USING_STD(istream);
#endif
const double fgPoint3_Epsilon = 0.0000001; const double fgPoint3_Epsilon = 0.0000001;
-2
View File
@@ -27,9 +27,7 @@
#include "localconsts.hxx" #include "localconsts.hxx"
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS
SG_USING_STD(cout); SG_USING_STD(cout);
#endif
#define DOMAIN_ERR_DEBUG 1 #define DOMAIN_ERR_DEBUG 1
-2
View File
@@ -7,10 +7,8 @@
#include "MetarReport.h" #include "MetarReport.h"
#include "Metar.h" #include "Metar.h"
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(endl); SG_USING_STD(endl);
SG_USING_STD(ostream); SG_USING_STD(ostream);
#endif
CMetarReport::CMetarReport( CMetarReport::CMetarReport(
char *s ) : char *s ) :
-2
View File
@@ -8,11 +8,9 @@
#include "MetarStation.h" #include "MetarStation.h"
#include <algorithm> #include <algorithm>
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(ostream); SG_USING_STD(ostream);
SG_USING_STD(cout); SG_USING_STD(cout);
SG_USING_STD(endl); SG_USING_STD(endl);
#endif
double CMetarStation::decodeDMS( char *b ) double CMetarStation::decodeDMS( char *b )
-2
View File
@@ -36,10 +36,8 @@ using std::ostream;
#include STL_IOSTREAM #include STL_IOSTREAM
SG_USING_STD(string); SG_USING_STD(string);
SG_USING_STD(vector); SG_USING_STD(vector);
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(istream); SG_USING_STD(istream);
SG_USING_STD(ostream); SG_USING_STD(ostream);
#endif
#endif #endif
+1 -7
View File
@@ -12,21 +12,15 @@
#include "props_io.hxx" #include "props_io.hxx"
#include STL_IOSTREAM #include STL_IOSTREAM
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) #include STL_FSTREAM
# include <fstream>
#else
# include <fstream.h>
#endif
#include STL_STRING #include STL_STRING
#include <vector> #include <vector>
#include <map> #include <map>
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(istream); SG_USING_STD(istream);
SG_USING_STD(ifstream); SG_USING_STD(ifstream);
SG_USING_STD(ostream); SG_USING_STD(ostream);
SG_USING_STD(ofstream); SG_USING_STD(ofstream);
#endif
SG_USING_STD(string); SG_USING_STD(string);
SG_USING_STD(vector); SG_USING_STD(vector);
SG_USING_STD(map); SG_USING_STD(map);
-2
View File
@@ -25,10 +25,8 @@
SG_USING_STD(string); SG_USING_STD(string);
SG_USING_STD(vector); SG_USING_STD(vector);
SG_USING_STD(map); SG_USING_STD(map);
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(istream); SG_USING_STD(istream);
SG_USING_STD(ostream); SG_USING_STD(ostream);
#endif
/** /**
* Read properties from an XML input stream. * Read properties from an XML input stream.
-2
View File
@@ -9,11 +9,9 @@
#include "props.hxx" #include "props.hxx"
#include "props_io.hxx" #include "props_io.hxx"
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(cout); SG_USING_STD(cout);
SG_USING_STD(cerr); SG_USING_STD(cerr);
SG_USING_STD(endl); SG_USING_STD(endl);
#endif
-5
View File
@@ -36,8 +36,6 @@
#if defined( SG_HAVE_STD_INCLUDES ) #if defined( SG_HAVE_STD_INCLUDES )
# include <istream> # include <istream>
#elif defined ( SG_HAVE_NATIVE_SGI_COMPILERS )
# include <CC/stream.h>
#elif defined ( __BORLANDC__ ) #elif defined ( __BORLANDC__ )
# include <iostream> # include <iostream>
#else #else
@@ -49,10 +47,7 @@
#include <simgear/misc/zfstream.hxx> #include <simgear/misc/zfstream.hxx>
SG_USING_STD(string); SG_USING_STD(string);
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS
SG_USING_STD(istream); SG_USING_STD(istream);
#endif
/** /**
+4 -8
View File
@@ -32,12 +32,6 @@
#include <zlib.h> #include <zlib.h>
// At least Irix needs this
#ifdef SG_HAVE_NATIVE_SGI_COMPILERS
#include <char_traits.h>
SG_USING_STD(char_traits);
#endif
#ifdef SG_HAVE_STD_INCLUDES #ifdef SG_HAVE_STD_INCLUDES
# include <streambuf> # include <streambuf>
@@ -76,8 +70,6 @@ SG_USING_STD(streamoff);
#if defined(__GNUC__) && __GNUC_MINOR__ < 8 #if defined(__GNUC__) && __GNUC_MINOR__ < 8
# define ios_binary ios::bin # define ios_binary ios::bin
#elif defined( SG_HAVE_NATIVE_SGI_COMPILERS )
# define ios_binary 0
#else #else
# define ios_binary ios::binary # define ios_binary ios::binary
#endif #endif
@@ -94,7 +86,11 @@ SG_USING_STD(streamoff);
/** /**
* A C++ I/O streams interface to the zlib gz* functions. * 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 class gzfilebuf : public streambuf
#endif
{ {
public: public:
-2
View File
@@ -6,10 +6,8 @@
#include "route.hxx" #include "route.hxx"
#include "waypoint.hxx" #include "waypoint.hxx"
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(cout); SG_USING_STD(cout);
SG_USING_STD(endl); SG_USING_STD(endl);
#endif
int main() { int main() {
SGRoute route; SGRoute route;
-3
View File
@@ -5,11 +5,8 @@
#include "waypoint.hxx" #include "waypoint.hxx"
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(cout); SG_USING_STD(cout);
SG_USING_STD(endl); SG_USING_STD(endl);
#endif
int main() { int main() {
SGWayPoint a1(-93.216923, 44.880547, 0.0, SGWayPoint::WGS84, "KMSP"); SGWayPoint a1(-93.216923, 44.880547, 0.0, SGWayPoint::WGS84, "KMSP");
-2
View File
@@ -30,10 +30,8 @@
#include <plib/sg.h> #include <plib/sg.h>
#include <plib/ssg.h> #include <plib/ssg.h>
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(cout); SG_USING_STD(cout);
SG_USING_STD(endl); SG_USING_STD(endl);
#endif
// return a sphere object as an ssgBranch // return a sphere object as an ssgBranch
-2
View File
@@ -35,10 +35,8 @@
#include "stars.hxx" #include "stars.hxx"
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(cout); SG_USING_STD(cout);
SG_USING_STD(endl); SG_USING_STD(endl);
#endif
// Set up star rendering call backs // Set up star rendering call backs
-3
View File
@@ -46,11 +46,8 @@
#include "serial.hxx" #include "serial.hxx"
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(cout); SG_USING_STD(cout);
SG_USING_STD(endl); SG_USING_STD(endl);
#endif
FGSerialPort::FGSerialPort() FGSerialPort::FGSerialPort()
: dev_open(false) : dev_open(false)
-3
View File
@@ -7,11 +7,8 @@
#include "serial.hxx" #include "serial.hxx"
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(cout); SG_USING_STD(cout);
SG_USING_STD(endl); SG_USING_STD(endl);
#endif
int main () { int main () {
FGSerialPort port; FGSerialPort port;
-2
View File
@@ -9,9 +9,7 @@
#include STL_FSTREAM #include STL_FSTREAM
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(ifstream); SG_USING_STD(ifstream);
#endif
-2
View File
@@ -16,9 +16,7 @@
#include STL_STRING #include STL_STRING
#include <vector> #include <vector>
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(istream); SG_USING_STD(istream);
#endif
SG_USING_STD(string); SG_USING_STD(string);
SG_USING_STD(vector); SG_USING_STD(vector);