Changes for the native Irix CC compiler contributed by Erik Hofman.

This commit is contained in:
curt 2001-03-02 22:52:04 +00:00
parent a37d9a2d8e
commit e07af68018
21 changed files with 421 additions and 152 deletions

View File

@ -538,6 +538,175 @@ SOURCE=.\simgear\math\vector.cxx
!ENDIF
# End Source File
# End Group
# Begin Group "Lib_sgmetar"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\simgear\metar\Antoi.cpp
!IF "$(CFG)" == "SimGear - Win32 Release"
# PROP Intermediate_Dir "Release\Lib_sgmetar"
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\Lib_sgmetar"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\simgear\metar\Charcmp.cpp
!IF "$(CFG)" == "SimGear - Win32 Release"
# PROP Intermediate_Dir "Release\Lib_sgmetar"
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\Lib_sgmetar"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\simgear\metar\Dcdmetar.cpp
!IF "$(CFG)" == "SimGear - Win32 Release"
# PROP Intermediate_Dir "Release\Lib_sgmetar"
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\Lib_sgmetar"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\simgear\metar\Dcdmtrmk.cpp
!IF "$(CFG)" == "SimGear - Win32 Release"
# PROP Intermediate_Dir "Release\Lib_sgmetar"
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\Lib_sgmetar"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\simgear\metar\Drvmetar.c
!IF "$(CFG)" == "SimGear - Win32 Release"
# PROP Intermediate_Dir "Release\Lib_sgmetar"
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\Lib_sgmetar"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\simgear\metar\Fracpart.cpp
!IF "$(CFG)" == "SimGear - Win32 Release"
# PROP Intermediate_Dir "Release\Lib_sgmetar"
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\Lib_sgmetar"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\simgear\metar\MetarReport.cpp
!IF "$(CFG)" == "SimGear - Win32 Release"
# PROP Intermediate_Dir "Release\Lib_sgmetar"
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\Lib_sgmetar"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\simgear\metar\MetarStation.cpp
!IF "$(CFG)" == "SimGear - Win32 Release"
# PROP Intermediate_Dir "Release\Lib_sgmetar"
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\Lib_sgmetar"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\simgear\metar\Prtdmetr.cpp
!IF "$(CFG)" == "SimGear - Win32 Release"
# PROP Intermediate_Dir "Release\Lib_sgmetar"
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\Lib_sgmetar"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\simgear\metar\Stspack2.cpp
!IF "$(CFG)" == "SimGear - Win32 Release"
# PROP Intermediate_Dir "Release\Lib_sgmetar"
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\Lib_sgmetar"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\simgear\metar\Stspack3.cpp
!IF "$(CFG)" == "SimGear - Win32 Release"
# PROP Intermediate_Dir "Release\Lib_sgmetar"
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
# PROP Intermediate_Dir "Debug\Lib_sgmetar"
!ENDIF
# End Source File
# End Group
# Begin Group "Lib_sgmisc"

View File

@ -273,6 +273,7 @@ AC_OUTPUT( \
simgear/io/Makefile \
simgear/magvar/Makefile \
simgear/math/Makefile \
simgear/metar/Makefile \
simgear/misc/Makefile \
simgear/route/Makefile \
simgear/screen/Makefile \

View File

@ -16,8 +16,8 @@ else
ZLIB_DIRS = zlib
endif
METAR_DIRS =
# METAR_DIRS = metar
# METAR_DIRS =
METAR_DIRS = metar
EXTRA_DIST = version.h.in

View File

@ -27,7 +27,7 @@
#include "stardata.hxx"
#ifdef _MSC_VER
#if defined (_MSC_VER) || defined (FG_HAVE_NATIVE_SGI_COMPILERS)
FG_USING_STD(getline);
#endif

View File

@ -42,8 +42,11 @@
FG_USING_STD( string );
FG_USING_STD( vector );
#if !defined (FG_HAVE_NATIVE_SGI_COMPILERS)
FG_USING_STD( cout );
FG_USING_STD( endl );
#endif
enum {

View File

@ -2,11 +2,13 @@ includedir = @includedir@/metar
lib_LIBRARIES = libsgmetar.a
include_HEADERS = MetarReport.h MetarStation.h
libsgmetar_a_SOURCES = \
Antoi.cpp Charcmp.cpp Dcdmetar.cpp Dcdmtrmk.cpp Drvmetar.c \
Fracpart.cpp Local.h Metar.h \
MetarReport.cpp MetarReport.h \
MetarStation.cpp MetarStation.h \
MetarReport.cpp \
MetarStation.cpp \
Prtdmetr.cpp Stspack2.cpp Stspack3.cpp
INCLUDES += -I$(top_srcdir)

View File

@ -45,6 +45,21 @@ char *CMetarReport::StationID()
return ((Decoded_METAR *)m_DecodedReport)->stnid;
}
int CMetarReport::Day()
{
return ((Decoded_METAR*)m_DecodedReport)->ob_date;
}
int CMetarReport::Hour()
{
return ((Decoded_METAR*)m_DecodedReport)->ob_hour;
}
int CMetarReport::Minutes()
{
return ((Decoded_METAR*)m_DecodedReport)->ob_minute;
}
int CMetarReport::WindDirection()
{
return ((Decoded_METAR *)m_DecodedReport)->winData.windDir;
@ -253,7 +268,29 @@ operator << ( ostream& out, CMetarReport& p )
}
double CMetarReport::AirPressure()
{
return ((Decoded_METAR *)m_DecodedReport)->inches_altstng;
}
void CMetarReport::dump()
{
prtDMETR( (Decoded_METAR *)m_DecodedReport );
}
double CMetarReport::PrevailVisibility() {
//Values from each visibility field converted to meters.
double smiles;
double km;
double meters;
smiles = ((Decoded_METAR*) m_DecodedReport)->prevail_vsbySM * 621 ;
km = ((Decoded_METAR*) m_DecodedReport)->prevail_vsbyKM * 1000;
meters = ((Decoded_METAR*) m_DecodedReport)->prevail_vsbyM;
/* Return the smallest one. If the field is specified it should have been
set to MAX_INT */
if(smiles < km && smiles < meters)
return smiles;
else
return km < meters ? km : meters;
}

View File

@ -38,6 +38,10 @@ public:
char *StationID();
int Day(); // The day of month on which the report was issued.
int Hour(); // The hour of the day the report was issued.
int Minutes(); //Minutes past the hour of the report issue time.
// Directions in degrees
// Speed in knots
// Altitude in meters
@ -94,6 +98,8 @@ public:
int SnowDepthInches();
double AirPressure(); //Return the air pressure in InchesHg.
double PrevailVisibility(); // Prevailing Visibility in meters.
void dump();
private:

View File

@ -4,21 +4,10 @@
#include "MetarStation.h"
#include <algorithm>
#define TESTPROG
#ifndef TESTPROG
// options is too tightly integrated into FlightGear to use in a test program
#include <Main/options.hxx>
#endif
#include <simgear/misc/fgpath.hxx>
std::vector< CMetarStation *> METAR_Stations;
int CMetarStation::initialized( CMetarStation::initialize() );
std::string CMetarStation::tempName;
double CMetarStation::decodeDMS( char *b )
{
double r = 0;
@ -53,6 +42,9 @@ double CMetarStation::decodeDMS( char *b )
return r * DEG_TO_RAD;
}
// Constructor
// Decodes METAR station string of this format:
// KPUB;72;464;Pueblo, Pueblo Memorial Airport;CO;United States;4;38-17-24N;104-29-54W;38-17-03N;104-29-43W;1440;1420;P
CMetarStation::CMetarStation(
char *s )
@ -82,6 +74,7 @@ CMetarStation::CMetarStation(
double ulongitude = decodeDMS( s );
s = t; t = strchr( s, ';' ); *t = 0; t++;
double altitude = atoi( s ) * FEET_TO_METER;
m_altitude = altitude;
s = t; t = strchr( s, ';' ); *t = 0; t++;
double ualtitude = atoi( s ) * FEET_TO_METER;
Point3D p( longitude, latitude, altitude+EQUATORIAL_RADIUS_M );
@ -93,96 +86,8 @@ CMetarStation::CMetarStation(
s = t;
m_pFlag = s[0];
}
// Constructor
// Decodes METAR station string of this format:
// KPUB;72;464;Pueblo, Pueblo Memorial Airport;CO;United States;4;38-17-24N;104-29-54W;38-17-03N;104-29-43W;1440;1420;P
int CMetarStation::initialize()
{
// Read the list of metar stations, decoding and adding to global list.
CMetarStation *m;
char buf[256];
// Goto the Flight Gear installation directory
#ifdef TESTPROG
//FGPath weatherPath( "/mkv/Build/FlightGear" );
FGPath weatherPath( ":Data" );
#else
FGPath weatherPath( current_options.get_fg_root() );
#endif
weatherPath.append( "Weather" );
weatherPath.append( "MetarStations" );
// Open the metar station list
FILE *f = fopen( weatherPath.c_str(), "r" );
if ( f != NULL ) {
// Read each line, create an instance of a station, and add it to the vector
while ( fgets( buf, 256, f) != NULL && feof( f ) == 0 ) {
//std::cout << buf << std::endl;
m = new CMetarStation( buf );
//m->dump();
METAR_Stations.push_back( m );
}
// Close the list
fclose( f );
// std::cout << METAR_Stations.size() << " Metar stations" << std::endl;
return 1;
} else {
// std::cout << "Could not open MetarStations file " << std::endl;
return 0;
}
}
int CMetarStation::sameName( CMetarStation *m )
{
return m->m_ID == tempName;
}
CMetarStation *CMetarStation::find( std::string stationID )
{
tempName = stationID;
CMetarStation **m = std::find_if( METAR_Stations.begin(), METAR_Stations.end(), sameName );
if ( m != METAR_Stations.end() ) return *m;
return 0;
}
double bestDist;
CMetarStation *bestStation;
Point3D curLocation;
void findHelper( CMetarStation *s )
{
double dist = s->locationCart().distance3Dsquared( curLocation );
if (dist < bestDist )
{
bestDist = dist;
bestStation = s;
}
}
CMetarStation *CMetarStation::find( Point3D locationCart )
{
bestDist = 99999999;
bestStation = 0;
curLocation = locationCart;
for_each( findHelper );
return bestStation;
}
void CMetarStation::for_each( void f( CMetarStation *s ) )
{
std::for_each( METAR_Stations.begin(), METAR_Stations.end(), f );
}
void CMetarStation::dump()
{
@ -210,6 +115,83 @@ void CMetarStation::dump()
std::cout << std::endl;
}
CMetarStationDB::CMetarStationDB(const char * dbPath)
{
// Read the list of metar stations, decoding and adding to global list.
CMetarStation *m;
char buf[256];
// Open the metar station list
FILE *f = fopen( dbPath, "r" );
if ( f != NULL ) {
// Read each line, create an instance of a station, and add it to the vector
while ( fgets( buf, 256, f) != NULL && feof( f ) == 0 ) {
//std::cout << buf << std::endl;
m = new CMetarStation( buf );
//m->dump();
METAR_Stations[m->ID()]=( m );
}
// Close the list
fclose( f );
// std::cout << METAR_Stations.size() << " Metar stations" << std::endl;
} else {
// std::cout << "Could not open MetarStations file " << std::endl;
}
}
CMetarStation * CMetarStationDB::find( std::string stationID )
{
std::map<std::string,CMetarStation*>::iterator target;
target = METAR_Stations.find(stationID);
if(target!= METAR_Stations.end() )
return target->second;
else
return NULL;
}
CMetarStation * CMetarStationDB::find( Point3D locationCart )
{
std::map<std::string,CMetarStation*>::iterator itr;
double bestDist = 99999999;
CMetarStation * bestStation;
Point3D curLocation = locationCart;
itr = METAR_Stations.begin();
while(itr != METAR_Stations.end())
{
double dist = itr->second->locationCart().distance3Dsquared( curLocation );
if (dist < bestDist )
{
bestDist = dist;
bestStation = itr->second;
}
itr++;
}
return bestStation;
}
CMetarStationDB::~CMetarStationDB() {
std::map<std::string,CMetarStation*>::iterator itr;
for(itr = METAR_Stations.begin(); itr != METAR_Stations.end(); itr++)
{
delete itr->second;
}
}
std::ostream&
operator << ( ostream& out, const CMetarStation& p )
{

View File

@ -3,7 +3,7 @@
// METAR station information is kept in this file:
// http://www.nws.noaa.gov/pub/stninfo/nsd_cccc.gz
// http://www.nws.noaa.gov/pub/stninfo/nsd_cccc.txt
// This class looks for the file FG_ROOT/Weather/MetarStations instread of nsd_cccc.
#ifndef _MetarStation_
#define _MetarStation_
@ -11,10 +11,13 @@
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
//using namespace std;
class CMetarStationDB;
class CMetarStation
{
// Attributes
@ -33,13 +36,11 @@ private:
int m_upperAltitude;
char m_pFlag;
static int initialized;
static std::string tempName;
// Operations
private:
double decodeDMS( char *b );
static int sameName( CMetarStation *m );
CMetarStation(
char *s );
@ -57,6 +58,8 @@ public:
std::string &state() { return m_state; }
std::string &country() { return m_country; }
int region() { return m_region; }
unsigned int Altitude() { //Returns the stations height above MSL in M.
return m_altitude;}
Point3D &locationPolar() { return m_locationPolar; }
Point3D &upperLocationPolar() { return m_upperLocationPolar; }
Point3D &locationCart() { return m_locationCart; }
@ -67,9 +70,8 @@ public:
friend std::ostream& operator << ( std::ostream&, const CMetarStation& );
void dump();
static CMetarStation *find( std::string stationID );
static CMetarStation *find( Point3D locationCart );
static void for_each( void f( CMetarStation *s ) );
private:
CMetarStation(
@ -80,8 +82,23 @@ private:
const CMetarStation &rObj );
// Assignment operator. Not implemented.
static int initialize();
friend CMetarStationDB;
};
class CMetarStationDB
{
private:
std::string databasePath; //The path of the database file.
std::map<std::string , CMetarStation *> METAR_Stations;
CMetarStation * bestStation;
public:
CMetarStation *find( std::string stationID );
CMetarStation * find( Point3D locationCart );
CMetarStationDB(const char * dbFile);
~CMetarStationDB();
};
#endif

View File

@ -6,15 +6,23 @@
//
// $Id$
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <simgear/compiler.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include STL_IOSTREAM
#include <algorithm>
#include "props.hxx"
using std::cerr;
using std::endl;
using std::sort;
#if !defined(FG_HAVE_NATIVE_SGI_COMPILERS)
FG_USING_STD(cerr);
FG_USING_STD(endl);
#endif
FG_USING_STD(sort);

View File

@ -9,16 +9,24 @@
#ifndef __PROPS_HXX
#define __PROPS_HXX
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <simgear/compiler.h>
#include <stdio.h>
#include <string>
#include STL_STRING
#include <vector>
#include <iostream>
#include STL_IOSTREAM
using std::string;
using std::vector;
using std::istream;
using std::ostream;
FG_USING_STD(string);
FG_USING_STD(vector);
#if !defined(FG_HAVE_NATIVE_SGI_COMPILERS)
FG_USING_STD(istream);
FG_USING_STD(ostream);
#endif
#ifdef UNKNOWN
#pragma warn A sloppy coder has defined UNKNOWN as a macro!

View File

@ -3,6 +3,8 @@
# include <config.h>
#endif
#include <simgear/compiler.h>
#include <stdlib.h> // atof() atoi()
#include <simgear/debug/logstream.hxx>
@ -10,17 +12,23 @@
#include "props.hxx"
#include <iostream>
#include STL_IOSTREAM
#if !defined(FG_HAVE_NATIVE_SGI_COMPILERS)
# include <fstream>
#include <string>
#else
# include <fstream.h>
#endif
#include STL_STRING
#include <vector>
using std::istream;
using std::ifstream;
using std::ostream;
using std::ofstream;
using std::string;
using std::vector;
#if !defined(FG_HAVE_NATIVE_SGI_COMPILERS)
FG_USING_STD(istream);
FG_USING_STD(ifstream);
FG_USING_STD(ostream);
FG_USING_STD(ofstream);
#endif
FG_USING_STD(string);
FG_USING_STD(vector);

View File

@ -3,11 +3,19 @@
// Test harness.
////////////////////////////////////////////////////////////////////////
#include <iostream>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <simgear/compiler.h>
#include STL_IOSTREAM
#include "props.hxx"
using std::cout;
using std::endl;
#if !defined(FG_HAVE_NATIVE_SGI_COMPILERS)
FG_USING_STD(cout);
FG_USING_STD(endl);
#endif

View File

@ -20,8 +20,10 @@
# include <config.h>
#endif
#include <simgear/compiler.h>
#include <stdio.h>
#include <iostream>
#include STL_IOSTREAM
#include <plib/sg.h>
#include <plib/ssg.h>

View File

@ -32,7 +32,7 @@
#include <simgear/compiler.h>
#include <stdio.h>
#include <iostream>
#include STL_IOSTREAM
#include <plib/sg.h>
#include <plib/ssg.h>

View File

@ -29,8 +29,10 @@
# include <config.h>
#endif
#include <simgear/compiler.h>
#include <stdio.h>
#include <iostream>
#include STL_IOSTREAM
#include <plib/sg.h>
#include <plib/ssg.h>

View File

@ -34,7 +34,11 @@
#include <plib/sg.h>
#include <plib/ssg.h>
FG_USING_NAMESPACE(std);
#if !defined (FG_HAVE_NATIVE_SGI_COMPILERS)
FG_USING_STD(cout);
FG_USING_STD(endl);
#endif
// return a sphere object as an ssgBranch
ssgBranch *ssgMakeSphere( ssgSimpleState *state, ssgColourArray *cl,
@ -114,11 +118,11 @@ ssgBranch *ssgMakeSphere( ssgSimpleState *state, ssgColourArray *cl,
new ssgVtxTable ( GL_TRIANGLE_STRIP, vl, nl, tl, cl );
if ( vl->getNum() != nl->getNum() ) {
std::cout << "bad sphere1\n";
cout << "bad sphere1" << endl;
exit(-1);
}
if ( vl->getNum() != tl->getNum() ) {
std::cout << "bad sphere2\n";
cout << "bad sphere2" << endl;
exit(-1);
}
slice->setState( state );

View File

@ -29,8 +29,10 @@
# include <config.h>
#endif
#include <simgear/compiler.h>
#include <stdio.h>
#include <iostream>
#include STL_IOSTREAM
#include <plib/sg.h>
#include <plib/ssg.h>
@ -39,8 +41,10 @@
#include "stars.hxx"
#if !defined (FG_HAVE_NATIVE_SGI_COMPILERS)
FG_USING_STD(cout);
FG_USING_STD(endl);
#endif
// Set up star rendering call backs

View File

@ -80,7 +80,7 @@ SGTime::SGTime( double lon, double lat, const string& root )
// cout << "Current local time = "
// << asctime(localtime(&cur_time)) << endl;
if ( root != "" ) {
if ( root != (string)"" ) {
FGPath zone( root );
zone.append( "zone.tab" );
FG_LOG( FG_EVENT, FG_DEBUG, "Reading timezone info from: "

View File

@ -1,13 +1,21 @@
#ifndef __EASYXML_HXX
#define __EASYXML_HXX
#include <iostream>
#include <string>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <simgear/compiler.h>
#include STL_IOSTREAM
#include STL_STRING
#include <vector>
using std::istream;
using std::string;
using std::vector;
#if !defined(FG_HAVE_NATIVE_SGI_COMPILERS)
FG_USING_STD(istream);
#endif
FG_USING_STD(string);
FG_USING_STD(vector);
/**