Patches from Erik Hofman (for Irix? I've lost the original message).

This commit is contained in:
david
2003-03-02 14:52:05 +00:00
parent b63464d239
commit 7379d8a54d
10 changed files with 44 additions and 51 deletions

View File

@@ -27,6 +27,7 @@
#endif
#include <simgear/compiler.h>
#include <simgear/debug/logstream.hxx>
#include <stdio.h>
#include <time.h>
@@ -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

View File

@@ -48,7 +48,7 @@ mgcLinInterp2D<T>::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<T>::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<T>::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;
}

View File

@@ -45,8 +45,8 @@ SphereInterpolate<T>::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<T>::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<T>::SphereInterpolate (int n, const double* x,
pInterp = new mgcLinInterp2D<T>(3*n,theta,phi,func);
cout << "[100%] Finished initialising spherical interpolator. \n";
// cout << "[100%] Finished initialising spherical interpolator. \n";
}
template<class T>
@@ -86,15 +86,15 @@ SphereInterpolate<T>::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<T>::SphereInterpolate (int n, const sgVec2* p, const T* f)
pInterp = new mgcLinInterp2D<T>(3*n,theta,phi,func);
cout << "[100%] Finished initialising spherical interpolator. \n";
// cout << "[100%] Finished initialising spherical interpolator. \n";
}
//---------------------------------------------------------------------------
template<class T>

View File

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

View File

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

View File

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

View File

@@ -24,15 +24,13 @@
#include <simgear/compiler.h>
#include <simgear/debug/logstream.hxx>
#include STL_IOSTREAM
#include <plib/sg.h>
#include <plib/ssg.h>
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 );

View File

@@ -26,6 +26,7 @@
#include <simgear/compiler.h>
#include <simgear/debug/logstream.hxx>
#include <stdio.h>
#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;
}

View File

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

View File

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