From: david Date: Sun, 2 Mar 2003 14:52:05 +0000 (+0000) Subject: Patches from Erik Hofman (for Irix? I've lost the original message). X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7379d8a54d2df3c041b42eb4002426b7834ba8b6;p=simgear.git Patches from Erik Hofman (for Irix? I've lost the original message). --- diff --git a/simgear/io/sg_binobj.cxx b/simgear/io/sg_binobj.cxx index 3c1f976f..b07bc525 100644 --- a/simgear/io/sg_binobj.cxx +++ b/simgear/io/sg_binobj.cxx @@ -27,6 +27,7 @@ #endif #include +#include #include #include @@ -42,8 +43,6 @@ SG_USING_STD( string ); SG_USING_STD( vector ); -SG_USING_STD( cout ); -SG_USING_STD( endl ); enum { @@ -90,7 +89,7 @@ public: while ( size < s ) { size *= 2; } - cout << "Creating a new buffer of size = " << size << endl; + SG_LOG(SG_EVENT, SG_DEBUG, "Creating a new buffer of size = " << size); ptr = new char[size]; } @@ -108,7 +107,7 @@ public: while ( size < s ) { size *= 2; } - cout << "resizing buffer to size = " << size << endl; + SG_LOG(SG_EVENT, SG_DEBUG, "resizing buffer to size = " << size); ptr = new char[size]; } } @@ -322,8 +321,8 @@ bool SGBinObject::read_bin( const string& file ) { if ( (fp = gzopen( file.c_str(), "rb" )) == NULL ) { string filegz = file + ".gz"; if ( (fp = gzopen( filegz.c_str(), "rb" )) == NULL ) { - cout << "ERROR: opening " << file << " or " << filegz - << "for reading!" << endl; + SG_LOG( SG_EVENT, SG_ALERT, + "ERROR: opening " << file << " or " << filegz << "for reading!"); return false; } @@ -361,7 +360,7 @@ bool SGBinObject::read_bin( const string& file ) { local_tm = localtime( &calendar_time ); char time_str[256]; strftime( time_str, 256, "%a %b %d %H:%M:%S %Z %Y", local_tm); - cout << "File created on " << time_str << endl; + SG_LOG( SG_EVENT, SG_DEBUG, "File created on " << time_str); #endif // read number of top level objects diff --git a/simgear/math/linintp2.inl b/simgear/math/linintp2.inl index 1fd489d1..46e0049e 100644 --- a/simgear/math/linintp2.inl +++ b/simgear/math/linintp2.inl @@ -48,7 +48,7 @@ mgcLinInterp2D::mgcLinInterp2D (int _numPoints, double* x, double* y, return; } - cout << "[ 20%] allocating memory \r"; + // cout << "[ 20%] allocating memory \r"; point = new double*[numPoints]; tmppoint = new double*[numPoints+3]; @@ -66,7 +66,7 @@ mgcLinInterp2D::mgcLinInterp2D (int _numPoints, double* x, double* y, f[i] = _f[i]; } - cout << "[ 30%] creating delaunay diagram \r"; + // cout << "[ 30%] creating delaunay diagram \r"; Delaunay2D(); } @@ -279,7 +279,7 @@ int mgcLinInterp2D::Delaunay2D () nts = 1; // number of triangles i4 = 1; - cout << "[ 40%] create triangulation \r"; + // cout << "[ 40%] create triangulation \r"; // compute triangulation for (i0 = 0; i0 < numPoints; i0++) @@ -372,7 +372,7 @@ Corner3:; } // count the number of triangles - cout << "[ 50%] count the number of triangles \r"; + // cout << "[ 50%] count the number of triangles \r"; numTriangles = 0; i0 = -1; @@ -394,7 +394,7 @@ Corner3:; } // create the triangles - cout << "[ 60%] create the triangles \r"; + // cout << "[ 60%] create the triangles \r"; triangle = new Triangle[numTriangles]; @@ -428,7 +428,7 @@ Corner3:; } // build edge table - cout << "[ 70%] build the edge table \r"; + // cout << "[ 70%] build the edge table \r"; numEdges = 0; edge = new Edge[3*numTriangles]; @@ -436,8 +436,8 @@ Corner3:; int j, j0, j1; for (i = 0; i < numTriangles; i++) { - if ( (i%500) == 0) - cout << "[ 7" << 10*i/numTriangles << "%] build the edge table \r"; + // if ( (i%500) == 0) + // cout << "[ 7" << 10*i/numTriangles << "%] build the edge table \r"; Triangle& t = triangle[i]; @@ -470,7 +470,7 @@ Corner3:; } // establish links between adjacent triangles - cout << "[ 80%] establishing links between adjacent triangles \r"; + // cout << "[ 80%] establishing links between adjacent triangles \r"; for (i = 0; i < numEdges; i++) { @@ -494,7 +494,7 @@ ExitDelaunay:; delete[] ccr[0]; delete[] ccr; - cout << "[ 90%] finsishes delauney triangulation \r"; + // cout << "[ 90%] finsishes delauney triangulation \r"; return result; } diff --git a/simgear/math/sphrintp.inl b/simgear/math/sphrintp.inl index cd31122a..da44af7d 100644 --- a/simgear/math/sphrintp.inl +++ b/simgear/math/sphrintp.inl @@ -45,8 +45,8 @@ SphereInterpolate::SphereInterpolate (int n, const double* x, // For complete spherical coverage, include the two antipodal points // (0,0,1,f(0,0,1)) and (0,0,-1,f(0,0,-1)) in the data set. - cout << "Initialising spherical interpolator.\n"; - cout << "[ 0%] Allocating memory \r"; + // cout << "Initialising spherical interpolator.\n"; + // cout << "[ 0%] Allocating memory \r"; theta = new double[3*n]; phi = new double[3*n]; @@ -63,7 +63,7 @@ SphereInterpolate::SphereInterpolate (int n, const double* x, } // use periodicity to get wrap-around in the Delaunay triangulation - cout << "[ 10%] copying vertices for wrap-around\r"; + // cout << "[ 10%] copying vertices for wrap-around\r"; int j, k; for (i = 0, j = n, k = 2*n; i < n; i++, j++, k++) { @@ -77,7 +77,7 @@ SphereInterpolate::SphereInterpolate (int n, const double* x, pInterp = new mgcLinInterp2D(3*n,theta,phi,func); - cout << "[100%] Finished initialising spherical interpolator. \n"; + // cout << "[100%] Finished initialising spherical interpolator. \n"; } template @@ -86,15 +86,15 @@ SphereInterpolate::SphereInterpolate (int n, const sgVec2* p, const T* f) // Assumes (x[i],y[i],z[i]) is unit length for all 0 <= i < n. // For complete spherical coverage, include the two antipodal points // (0,0,1,f(0,0,1)) and (0,0,-1,f(0,0,-1)) in the data set. - cout << "Initialising spherical interpolator.\n"; - cout << "[ 0%] Allocating memory \r"; + // cout << "Initialising spherical interpolator.\n"; + // cout << "[ 0%] Allocating memory \r"; theta = new double[3*n]; phi = new double[3*n]; func = new T[3*n]; // convert data to spherical coordinates - cout << "[ 10%] copying vertices for wrap-around \r"; + // cout << "[ 10%] copying vertices for wrap-around \r"; int i, j, k; for (i = 0, j = n, k = 2*n; i < n; i++, j++, k++) @@ -114,7 +114,7 @@ SphereInterpolate::SphereInterpolate (int n, const sgVec2* p, const T* f) pInterp = new mgcLinInterp2D(3*n,theta,phi,func); - cout << "[100%] Finished initialising spherical interpolator. \n"; + // cout << "[100%] Finished initialising spherical interpolator. \n"; } //--------------------------------------------------------------------------- template diff --git a/simgear/misc/Makefile.am b/simgear/misc/Makefile.am index d27727f5..d691930d 100644 --- a/simgear/misc/Makefile.am +++ b/simgear/misc/Makefile.am @@ -33,6 +33,6 @@ props_test_SOURCES = props_test.cxx props_test_LDADD = libsgmisc.a ../xml/libsgxml.a ../debug/libsgdebug.a tabbed_value_test_SOURCES = tabbed_values_test.cxx -tabbed_value_test_LDADD = libsgmisc.a ../debug/libsgdebug.a +tabbed_value_test_LDADD = libsgmisc.a ../xml/libsgxml.a ../debug/libsgdebug.a INCLUDES = -I$(top_srcdir) diff --git a/simgear/misc/tabbed_values_test.cxx b/simgear/misc/tabbed_values_test.cxx index 0a5dfee0..90825009 100644 --- a/simgear/misc/tabbed_values_test.cxx +++ b/simgear/misc/tabbed_values_test.cxx @@ -18,17 +18,17 @@ int main (int ac, char ** av) SGTabbedValues tv(string1); - if (tv[0] != "Hello") { + if (tv[0] != string("Hello")) { cerr << "failed to read string at index 0" << endl; return 1; } - if (tv[1] != "World") { + if (tv[1] != string("World")) { cerr << "failed to read string at index 1" << endl; return 1; } - if (tv[2] != "34") { + if (tv[2] != string("34")) { cerr << "failed to read string at index 2" << endl; return 1; } @@ -61,7 +61,7 @@ int main (int ac, char ** av) return 3; } - if (tv[5] != "There Is No Spoon") { + if (tv[5] != string("There Is No Spoon")) { cerr << "failed to read string at index 5 (got [" << tv[5] << "]" << endl; return 1; } diff --git a/simgear/scene/sky/oursun.cxx b/simgear/scene/sky/oursun.cxx index 3ffd6538..70dca1cc 100644 --- a/simgear/scene/sky/oursun.cxx +++ b/simgear/scene/sky/oursun.cxx @@ -149,7 +149,8 @@ static GLuint makeHalo( GLubyte *sun_texbuf, int width ) { texSize = width * width; if ( !sun_texbuf ) { - cout << "ouch ..." << endl; + SG_LOG( SG_EVENT, SG_ALERT, + "Could not allocate memroy for the sun texture"); exit(-1); // Ugly! } diff --git a/simgear/scene/sky/sphere.cxx b/simgear/scene/sky/sphere.cxx index 9ca29218..d464f891 100644 --- a/simgear/scene/sky/sphere.cxx +++ b/simgear/scene/sky/sphere.cxx @@ -24,15 +24,13 @@ #include +#include #include STL_IOSTREAM #include #include -SG_USING_STD(cout); -SG_USING_STD(endl); - // return a sphere object as an ssgBranch ssgBranch *ssgMakeSphere( ssgSimpleState *state, ssgColourArray *cl, @@ -112,11 +110,11 @@ ssgBranch *ssgMakeSphere( ssgSimpleState *state, ssgColourArray *cl, new ssgVtxTable ( GL_TRIANGLE_STRIP, vl, nl, tl, cl ); if ( vl->getNum() != nl->getNum() ) { - cout << "bad sphere1" << endl; + SG_LOG( SG_EVENT, SG_ALERT, "bad sphere1"); exit(-1); } if ( vl->getNum() != tl->getNum() ) { - cout << "bad sphere2" << endl; + SG_LOG( SG_EVENT, SG_ALERT, "bad sphere2"); exit(-1); } slice->setState( state ); diff --git a/simgear/scene/sky/stars.cxx b/simgear/scene/sky/stars.cxx index 55602b2f..023b6baa 100644 --- a/simgear/scene/sky/stars.cxx +++ b/simgear/scene/sky/stars.cxx @@ -26,6 +26,7 @@ #include +#include #include #include STL_IOSTREAM @@ -35,9 +36,6 @@ #include "stars.hxx" -SG_USING_STD(cout); -SG_USING_STD(endl); - // Set up star rendering call backs static int sgStarPreDraw( ssgEntity *e ) { @@ -85,9 +83,9 @@ SGStars::~SGStars( void ) { ssgBranch * SGStars::build( int num, sgdVec3 *star_data, double star_dist ) { sgVec4 color; - if ( star_data == NULL ) { - cout << "WARNING: null star data passed to SGStars::build()" << endl; - } + if ( star_data == NULL ) + SG_LOG( SG_EVENT, SG_WARN, "null star data passed to SGStars::build()"); + // set up the orb state state = new ssgSimpleState(); @@ -137,7 +135,7 @@ ssgBranch * SGStars::build( int num, sgdVec3 *star_data, double star_dist ) { stars_transform->addKid( stars_obj ); - cout << "stars = " << stars_transform << endl; + SG_LOG( SG_EVENT, SG_INFO, "stars = " << stars_transform); return stars_transform; } diff --git a/simgear/serial/serial.cxx b/simgear/serial/serial.cxx index 1035f8dd..8c31a602 100644 --- a/simgear/serial/serial.cxx +++ b/simgear/serial/serial.cxx @@ -46,9 +46,6 @@ #include "serial.hxx" -SG_USING_STD(cout); -SG_USING_STD(endl); - FGSerialPort::FGSerialPort() : dev_open(false) { @@ -108,7 +105,7 @@ bool FGSerialPort::open_port(const string& device) { struct termios config; fd = open(device.c_str(), O_RDWR | O_NONBLOCK); - cout << "Serial fd created = " << fd << endl; + SG_LOG( SG_EVENT, SG_DEBUG, "Serial fd created = " << fd); if ( fd == -1 ) { SG_LOG( SG_IO, SG_ALERT, "Cannot open " << device diff --git a/simgear/timing/sg_time.cxx b/simgear/timing/sg_time.cxx index e38fbff8..37dc3454 100644 --- a/simgear/timing/sg_time.cxx +++ b/simgear/timing/sg_time.cxx @@ -83,10 +83,10 @@ void SGTime::init( double lon, double lat, cur_time = time(NULL); } - cout << "Current greenwich mean time = " << asctime(gmtime(&cur_time)) - << endl; - cout << "Current local time = " - << asctime(localtime(&cur_time)) << endl; + SG_LOG( SG_EVENT, SG_INFO, + "Current greenwich mean time = " << asctime(gmtime(&cur_time))); + SG_LOG( SG_EVENT, SG_INFO, + "Current local time = " << asctime(localtime(&cur_time))); if ( !root.empty()) { SGPath zone( root );