From c74350c4fe126328ced5e080a4d262d0bcba5369 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 6 Nov 1998 21:17:31 +0000 Subject: [PATCH] Converted to new logstream debugging facility. This allows release builds with no messages at all (and no performance impact) by using the -DFG_NDEBUG flag. --- Aircraft/aircraft.cxx | 37 +++++++++------- Airports/genapt.cxx | 13 ++++-- Airports/simple.cxx | 14 ++++-- Astro/celestialBody.cxx | 6 +-- Astro/moon.cxx | 17 ++++---- Astro/moon.hxx | 1 - Astro/sky.cxx | 15 ++++--- Astro/solarsystem.cxx | 5 ++- Astro/stars.cxx | 27 +++++++----- Autopilot/autopilot.cxx | 45 ++++++++----------- Cockpit/cockpit.cxx | 21 +++++---- Cockpit/hud.cxx | 11 +++-- Cockpit/hud_card.cxx | 1 - Cockpit/hud_dnst.cxx | 1 - Cockpit/hud_guag.cxx | 1 - Cockpit/hud_inst.cxx | 1 - Cockpit/hud_labl.cxx | 1 - Cockpit/hud_ladr.cxx | 1 - Cockpit/hud_scal.cxx | 1 - Cockpit/hud_tbi.cxx | 1 - Cockpit/panel.cxx | 9 +++- FDM/flight.cxx | 19 ++++++--- Joystick/joystick.cxx | 23 ++++++---- Main/GLUTkey.cxx | 60 ++++++++++++++------------ Main/GLUTmain.cxx | 74 ++++++++++++++++++-------------- Main/fg_init.cxx | 87 ++++++++++++++++++++++--------------- Main/options.cxx | 38 +++++++++-------- Main/splash.cxx | 15 ++++--- Main/views.cxx | 19 ++++++--- Objects/material.cxx | 31 ++++++++------ Objects/obj.cxx | 35 +++++++++------ Scenery/scenery.cxx | 9 +++- Scenery/tilecache.cxx | 45 ++++++++++--------- Scenery/tilemgr.cxx | 64 +++++++++++++++------------ Time/event.cxx | 19 ++++++--- Time/fg_time.cxx | 95 ++++++++++++++++++++++------------------- Time/light.cxx | 23 ++++++---- Weather/weather.cxx | 13 +++--- 38 files changed, 517 insertions(+), 381 deletions(-) diff --git a/Aircraft/aircraft.cxx b/Aircraft/aircraft.cxx index 21c9a3518..61b217f8f 100644 --- a/Aircraft/aircraft.cxx +++ b/Aircraft/aircraft.cxx @@ -25,7 +25,7 @@ #include #include "aircraft.hxx" -#include +#include #include // This is a record containing all the info for the aircraft currently @@ -35,7 +35,7 @@ fgAIRCRAFT current_aircraft; // Initialize an Aircraft structure void fgAircraftInit( void ) { - fgPrintf( FG_AIRCRAFT, FG_INFO, "Initializing Aircraft structure\n" ); + FG_LOG( FG_AIRCRAFT, FG_INFO, "Initializing Aircraft structure" ); current_aircraft.flight = &cur_flight_params; current_aircraft.controls = &controls; @@ -48,24 +48,29 @@ void fgAircraftOutputCurrent(fgAIRCRAFT *a) { f = a->flight; - fgPrintf( FG_FLIGHT, FG_DEBUG, - "Pos = (%.2f,%.2f,%.2f) (Phi,Theta,Psi)=(%.2f,%.2f,%.2f)\n", - FG_Longitude * 3600.0 * RAD_TO_DEG, - FG_Latitude * 3600.0 * RAD_TO_DEG, - FG_Altitude, FG_Phi, FG_Theta, FG_Psi); - - double elevator = controls.get_elevator(); - double aileron = controls.get_aileron(); - double rudder = controls.get_rudder(); - double throttle = controls.get_throttle( 0 ); - - fgPrintf( FG_FLIGHT, FG_DEBUG, - "Kts = %.0f Elev = %.2f, Aileron = %.2f, Rudder = %.2f Power = %.2f\n", - FG_V_equiv_kts, elevator, aileron,rudder, throttle ); + FG_LOG( FG_FLIGHT, FG_DEBUG, + "Pos = (" + << (FG_Longitude * 3600.0 * RAD_TO_DEG) << "," + << (FG_Latitude * 3600.0 * RAD_TO_DEG) << "," + << FG_Altitude + << ") (Phi,Theta,Psi)=(" + << FG_Phi << "," << FG_Theta << "," << FG_Psi << ")" ); + + FG_LOG( FG_FLIGHT, FG_DEBUG, + "Kts = " << FG_V_equiv_kts + << " Elev = " << controls.get_elevator() + << " Aileron = " << controls.get_aileron() + << " Rudder = " << controls.get_rudder() + << " Power = " << controls.get_throttle( 0 ) ); } // $Log$ +// Revision 1.4 1998/11/06 21:17:31 curt +// Converted to new logstream debugging facility. This allows release +// builds with no messages at all (and no performance impact) by using +// the -DFG_NDEBUG flag. +// // Revision 1.3 1998/10/25 14:08:37 curt // Turned "struct fgCONTROLS" into a class, with inlined accessor functions. // diff --git a/Airports/genapt.cxx b/Airports/genapt.cxx index dd604a93f..b65c5fa7a 100644 --- a/Airports/genapt.cxx +++ b/Airports/genapt.cxx @@ -31,7 +31,7 @@ using namespace std; #endif -#include +#include // #include #include #include @@ -97,9 +97,9 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t) // find airport base material in the properties list if ( ! material_mgr.find( APT_BASE_MATERIAL, fragment.material_ptr )) { - fgPrintf( FG_TERRAIN, FG_ALERT, - "Ack! unknown material name = %s in fgAptGenerat()\n", - APT_BASE_MATERIAL ); + FG_LOG( FG_TERRAIN, FG_ALERT, + "Ack! unknown material name = " << APT_BASE_MATERIAL + << " in fgAptGenerat()" ); } printf(" tile center = %.2f %.2f %.2f\n", @@ -281,6 +281,11 @@ fgAptGenerate(const string& path, fgTILE *tile) // $Log$ +// Revision 1.9 1998/11/06 21:17:32 curt +// Converted to new logstream debugging facility. This allows release +// builds with no messages at all (and no performance impact) by using +// the -DFG_NDEBUG flag. +// // Revision 1.8 1998/11/06 14:46:59 curt // Changes to track Bernie's updates to fgstream. // diff --git a/Airports/simple.cxx b/Airports/simple.cxx index 978b45cd3..bbe93f4c5 100644 --- a/Airports/simple.cxx +++ b/Airports/simple.cxx @@ -27,7 +27,7 @@ #include -#include +#include #include
#include @@ -52,9 +52,10 @@ int fgAIRPORTS::load( const string& file ) { airports.erase( airports.begin(), airports.end() ); fg_gzifstream in( path ); - if ( !in ) - fgPrintf( FG_GENERAL, FG_EXIT, "Cannot open file: %s\n", - path.c_str()); + if ( !in ) { + FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << path ); + exit(-1); + } /* // We can use the STL copy algorithm because the input @@ -109,6 +110,11 @@ fgAIRPORTS::~fgAIRPORTS( void ) { // $Log$ +// Revision 1.9 1998/11/06 21:17:34 curt +// Converted to new logstream debugging facility. This allows release +// builds with no messages at all (and no performance impact) by using +// the -DFG_NDEBUG flag. +// // Revision 1.8 1998/11/06 14:47:01 curt // Changes to track Bernie's updates to fgstream. // diff --git a/Astro/celestialBody.cxx b/Astro/celestialBody.cxx index ede620fe1..baa0646c9 100644 --- a/Astro/celestialBody.cxx +++ b/Astro/celestialBody.cxx @@ -25,7 +25,7 @@ #include "celestialBody.hxx" #include "star.hxx" -#include +#include /************************************************************************** * void CelestialBody::updatePosition(fgTIME *t, Star *ourSun) @@ -78,8 +78,8 @@ void CelestialBody::updatePosition(fgTIME *t, Star *ourSun) ze = yg * sin(ecl) + zg * cos(ecl); rightAscension = atan2(ye, xe); declination = atan2(ze, sqrt(xe*xe + ye*ye)); - fgPrintf(FG_GENERAL, FG_INFO, "Planet found at : %f (ra), %f (dec)\n", - rightAscension, declination); + FG_LOG(FG_GENERAL, FG_INFO, "Planet found at : " + << rightAscension << " (ra), " << declination << " (dec)" ); //calculate some variables specific to calculating the magnitude //of the planet diff --git a/Astro/moon.cxx b/Astro/moon.cxx index bc7425ce4..445774cd6 100644 --- a/Astro/moon.cxx +++ b/Astro/moon.cxx @@ -26,7 +26,7 @@ #include #include "moon.hxx" -#include +#include #include static GLuint moon_texid; @@ -51,7 +51,7 @@ Moon::Moon(fgTIME *t) : string tpath, fg_tpath; int width, height; - fgPrintf( FG_GENERAL, FG_INFO, "Initializing Moon Texture\n"); + FG_LOG( FG_GENERAL, FG_INFO, "Initializing Moon Texture"); #ifdef GL_VERSION_1_1 xglGenTextures(1, &moon_texid); xglBindTexture(GL_TEXTURE_2D, moon_texid); @@ -77,9 +77,9 @@ Moon::Moon(fgTIME *t) : if ( (moon_texbuf = read_rgb_texture(fg_tpath.c_str(), &width, &height)) == NULL ) { - fgPrintf( FG_GENERAL, FG_EXIT, - "Error in loading moon texture %s\n", tpath.c_str() ); - exit(1); + FG_LOG( FG_GENERAL, FG_ALERT, + "Error in loading moon texture " << tpath ); + exit(-1); } } @@ -162,7 +162,7 @@ void Moon::updatePosition(fgTIME *t, Star *ourSun) r += (-0.58 * cos(M - 2*D) -0.46 * cos(2*D) ); - fgPrintf(FG_GENERAL, FG_INFO, "Running moon update\n"); + FG_LOG(FG_GENERAL, FG_INFO, "Running moon update"); xg = r * cos(lonecl) * cos(latecl); yg = r * sin(lonecl) * cos(latecl); zg = r * sin(latecl); @@ -213,8 +213,9 @@ void Moon::newImage(float ra, float dec) xglRotatef(((RAD_TO_DEG * ra)- 90.0), 0.0, 0.0, 1.0); xglRotatef((RAD_TO_DEG * dec), 1.0, 0.0, 0.0); - fgPrintf( FG_GENERAL, FG_INFO, - "Ra = (%f), Dec= (%f)", (RAD_TO_DEG *ra), (RAD_TO_DEG *dec) ); + FG_LOG( FG_GENERAL, FG_INFO, + "Ra = (" << (RAD_TO_DEG *ra) + << "), Dec= (" << (RAD_TO_DEG *dec) << ")" ); xglTranslatef(0.0, 58600.0, 0.0); Object = gluNewQuadric(); gluQuadricTexture( Object, GL_TRUE ); diff --git a/Astro/moon.hxx b/Astro/moon.hxx index 677dcfca1..ac1fb2f23 100644 --- a/Astro/moon.hxx +++ b/Astro/moon.hxx @@ -26,7 +26,6 @@ #define _MOON_HXX_ #include -#include #include #include #include
diff --git a/Astro/sky.cxx b/Astro/sky.cxx index 83001c858..f2c8c58ca 100644 --- a/Astro/sky.cxx +++ b/Astro/sky.cxx @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include #include
@@ -78,7 +78,7 @@ void fgSkyVerticesInit( void ) { float theta; int i; - fgPrintf(FG_ASTRO, FG_INFO, " Generating the sky dome vertices.\n"); + FG_LOG(FG_ASTRO, FG_INFO, " Generating the sky dome vertices."); for ( i = 0; i < 12; i++ ) { theta = (i * 30.0) * DEG_TO_RAD; @@ -115,8 +115,8 @@ void fgSkyColorsInit( void ) { l = &cur_light_params; - fgPrintf( FG_ASTRO, FG_INFO, - " Generating the sky colors for each vertex.\n" ); + FG_LOG( FG_ASTRO, FG_INFO, + " Generating the sky colors for each vertex." ); // setup for the possibility of sunset effects sun_angle = l->sun_angle * RAD_TO_DEG; @@ -243,7 +243,7 @@ void fgSkyColorsInit( void ) { // Initialize the sky structure and colors void fgSkyInit( void ) { - fgPrintf(FG_ASTRO, FG_INFO, "Initializing the sky\n"); + FG_LOG( FG_ASTRO, FG_INFO, "Initializing the sky" ); fgSkyVerticesInit(); @@ -365,6 +365,11 @@ void fgSkyRender( void ) { // $Log$ +// Revision 1.14 1998/11/06 21:17:39 curt +// Converted to new logstream debugging facility. This allows release +// builds with no messages at all (and no performance impact) by using +// the -DFG_NDEBUG flag. +// // Revision 1.13 1998/10/20 18:28:30 curt // Tweaked sunset/sunrise colors. // diff --git a/Astro/solarsystem.cxx b/Astro/solarsystem.cxx index c059cf3a2..c3995f48e 100644 --- a/Astro/solarsystem.cxx +++ b/Astro/solarsystem.cxx @@ -33,7 +33,7 @@ #include #include -#include +#include #include