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

View File

@@ -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
/**

View File

@@ -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 \

View File

@@ -3,6 +3,7 @@
#define __SG_IOSTREAM 1
# include <iostream.h>
# include <fstream.h>
#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

View File

@@ -2,10 +2,14 @@
#ifndef __SG_ISTREAM
#define __SG_ISTREAM 1
# include <iostream>
#if defined(sgi) && !defined(__GNUC__)
# include <stream.h>
# include <iostream>
# include <string>
using std::getline;
#endif

View File

@@ -2,27 +2,36 @@
#ifndef __SG_STREAMBUF
#define __SG_STREAMBUF 1
#if defined(sgi) && !defined(__GNUC__)
# include <char_traits.h>
# 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 char_traits<char>::int_type int_type;
typedef std::char_traits<char> traits_type;
typedef std::char_traits<char>::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

View File

@@ -28,11 +28,6 @@
#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
# include <streambuf>
# include <iostream>
@@ -43,15 +38,11 @@
#include <simgear/debug/debug_types.h>
#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:

View File

@@ -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

View File

@@ -3,12 +3,10 @@
#include <unistd.h>
#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 ) {

View File

@@ -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 ";

View File

@@ -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 {

View File

@@ -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 ) {

View File

@@ -11,9 +11,6 @@
#include "sg_socket.hxx"
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS
using std::cout;
#endif
class TcpClient
{

View File

@@ -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
{

View File

@@ -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;

View File

@@ -27,9 +27,7 @@
#include "localconsts.hxx"
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS
SG_USING_STD(cout);
#endif
#define DOMAIN_ERR_DEBUG 1

View File

@@ -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 ) :

View File

@@ -8,11 +8,9 @@
#include "MetarStation.h"
#include <algorithm>
#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 )

View File

@@ -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

View File

@@ -12,21 +12,15 @@
#include "props_io.hxx"
#include STL_IOSTREAM
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
# include <fstream>
#else
# include <fstream.h>
#endif
#include STL_FSTREAM
#include STL_STRING
#include <vector>
#include <map>
#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);

View File

@@ -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.

View File

@@ -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

View File

@@ -36,8 +36,6 @@
#if defined( SG_HAVE_STD_INCLUDES )
# include <istream>
#elif defined ( SG_HAVE_NATIVE_SGI_COMPILERS )
# include <CC/stream.h>
#elif defined ( __BORLANDC__ )
# include <iostream>
#else
@@ -49,10 +47,7 @@
#include <simgear/misc/zfstream.hxx>
SG_USING_STD(string);
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS
SG_USING_STD(istream);
#endif
/**

View File

@@ -32,12 +32,6 @@
#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
# include <streambuf>
@@ -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:

View File

@@ -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;

View File

@@ -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");

View File

@@ -30,10 +30,8 @@
#include <plib/sg.h>
#include <plib/ssg.h>
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(cout);
SG_USING_STD(endl);
#endif
// return a sphere object as an ssgBranch

View File

@@ -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

View File

@@ -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)

View File

@@ -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;

View File

@@ -9,9 +9,7 @@
#include STL_FSTREAM
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(ifstream);
#endif

View File

@@ -16,9 +16,7 @@
#include STL_STRING
#include <vector>
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(istream);
#endif
SG_USING_STD(string);
SG_USING_STD(vector);