#include "simple.hxx"
+FG_USING_NAMESPACE(std);
FGAirports::FGAirports( const string& file ) {
dbf = gdbm_open( (char *)file.c_str(), 0, GDBM_READER, 0, NULL );
GDBM_FILE dbf;
-#if !defined( MACOS )
+#if defined( MACOS ) || defined( _MSC_VER )
+ dbf = gdbm_open( (char *)file.c_str(), 0, GDBM_NEWDB | GDBM_FAST,
+ NULL, NULL );
+#else
dbf = gdbm_open( (char *)file.c_str(), 0, GDBM_NEWDB | GDBM_FAST,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH,
NULL );
-#else
- dbf = gdbm_open( (char *)file.c_str(), 0, GDBM_NEWDB | GDBM_FAST,
- NULL, NULL );
#endif
if ( dbf == NULL ) {
#include "ls_types.h"
#include "ls_generic.h"
#include "ls_cockpit.h"
+#include "ls_constants.h"
Cz = Cz0 + Cza*Alpha + Czat*(Alpha_dot*c/2.0/V) + Czq*(q*c/2.0/V) + Czde * elevator;
Cm = Cm0 + Cma*Alpha + Cmat*(Alpha_dot*c/2.0/V) + Cmq*(q*c/2.0/V) + Cmde * elevator;
- Cx = Cx0 - (Cza*Alpha)*(Cza*Alpha)/(M_PI*5.71*0.6);
+ Cx = Cx0 - (Cza*Alpha)*(Cza*Alpha)/(PI*5.71*0.6);
Cl = Clb*Beta + Clp*(p*b/2.0/V) + Clr*(r*b/2.0/V) + Clda * aileron;
Cy = Cyb*Beta + Cyr*(r*b/2.0/V);
$Header$
$Log$
+Revision 1.3 2000/05/24 04:10:01 curt
+MSVC5 portability changes contributed by Bruce Finney.
+
Revision 1.2 2000/04/10 18:09:41 curt
David Megginson made a few (mostly minor) mods to the LaRCsim files, and
it's now possible to choose the LaRCsim model at runtime, as in
#define FACILITY_NAME_STRING "init"
#define CURRENT_VERSION 10
+void cherokee_init( void );
+void c172_init( void );
+
typedef struct
{
symbol_rec Symbol;
if (error) Discrete_States[i].Symbol.Addr = NIL_POINTER;
}
*/
+
}
+/* not all system have strcasecmp */
+#ifdef _MSC_VER
+# define strcasecmp stricmp
+#endif
void ls_init( char * aircraft ) {
/* int i; */
T* object;
Method0v method0v;
- typedef void * (fgMethodCallback::*DoPtr)( void ** );
+ // typedef void * (fgMethodCallback::*DoPtr)( void ** );
+ typedef void * (fgMethodCallback<T>::*DoPtr)( void ** );
DoPtr doPtr;
};
class FGFixList {
- typedef map < string, FGFix, less<string> > fix_map_type;
+ // typedef map < string, FGFix, less<string> > fix_map_type;
+ typedef map < string, FGFix > fix_map_type;
typedef fix_map_type::iterator fix_map_iterator;
typedef fix_map_type::const_iterator fix_map_const_iterator;
typedef ils_list_type::iterator ils_list_iterator;
typedef ils_list_type::const_iterator ils_list_const_iterator;
- typedef map < int, ils_list_type, less<int> > ils_map_type;
+ // typedef map < int, ils_list_type, less<int> > ils_map_type;
+ typedef map < int, ils_list_type > ils_map_type;
typedef ils_map_type::iterator ils_map_iterator;
typedef ils_map_type::const_iterator ils_map_const_iterator;
typedef nav_list_type::iterator nav_list_iterator;
typedef nav_list_type::const_iterator nav_list_const_iterator;
- typedef map < int, nav_list_type, less<int> > nav_map_type;
+ // typedef map < int, nav_list_type, less<int> > nav_map_type;
+ typedef map < int, nav_list_type > nav_map_type;
typedef nav_map_type::iterator nav_map_iterator;
typedef nav_map_type::const_iterator nav_map_const_iterator;
#include STL_STRING
+#ifdef _MSC_VER
+# include <io.h>
+#endif
+
#include <simgear/debug/logstream.hxx>
#include "fg_file.hxx"
// open the file based on specified direction
bool FGFile::open( FGProtocol::fgProtocolDir dir ) {
if ( dir == FGProtocol::out ) {
+#ifdef _MSC_VER
+ fp = _open( file_name.c_str(), O_WRONLY | O_CREAT | O_TRUNC,
+ 00666 );
+#else
fp = std::open( file_name.c_str(), O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP |
S_IROTH | S_IWOTH );
+#endif
} else if ( dir == FGProtocol::in ) {
+#ifdef _MSC_VER
+ fp = _open( file_name.c_str(), O_RDONLY );
+#else
fp = std::open( file_name.c_str(), O_RDONLY );
+#endif
} else {
FG_LOG( FG_IO, FG_ALERT,
"Error: bidirection mode not available for files." );
// read a block of data of specified size
int FGFile::read( char *buf, int length ) {
// read a chunk
+#ifdef _MSC_VER
+ int result = _read( fp, buf, length );
+#else
int result = std::read( fp, buf, length );
+#endif
return result;
}
int pos = lseek( fp, 0, SEEK_CUR );
// read a chunk
+#ifdef _MSC_VER
+ int result = _read( fp, buf, length );
+#else
int result = std::read( fp, buf, length );
+#endif
// find the end of line and reset position
int i;
// write data to a file
int FGFile::write( char *buf, int length ) {
+#ifdef _MSC_VER
+ int result = _write( fp, buf, length );
+#else
int result = std::write( fp, buf, length );
+#endif
if ( result != length ) {
FG_LOG( FG_IO, FG_ALERT, "Error writing data: " << file_name );
}
// close the port
bool FGFile::close() {
+#ifdef _MSC_VER
+ if ( _close( fp ) == -1 ) {
+#else
if ( std::close( fp ) == -1 ) {
+#endif
return false;
}
if ( connect(sock, (struct sockaddr *) &name,
sizeof(struct sockaddr_in)) < 0 )
{
+#ifdef _MSC_VER
+ _close(sock);
+#else
std::close(sock);
+#endif
FG_LOG( FG_IO, FG_ALERT,
"Error: connect() failed in make_client_socket()" );
return -1;
select(32, &ready, 0, 0, &tv);
if ( FD_ISSET(sock, &ready) ) {
+#ifdef _MSC_VER
+ result = _read( sock, buf, length );
+#else
result = std::read( sock, buf, length );
+#endif
if ( result != length ) {
FG_LOG( FG_IO, FG_INFO,
"Warning: read() not enough bytes." );
// requested amount read
char *buf_ptr = save_buf + save_len;
+#ifdef _MSC_VER
+ result = _read( sock, buf_ptr, FG_MAX_MSG_SIZE - save_len );
+#else
result = std::read( sock, buf_ptr, FG_MAX_MSG_SIZE - save_len );
+#endif
save_len += result;
// cout << "current read = " << buf_ptr << endl;
// cout << "current save_buf = " << save_buf << endl;
// std::read( msgsock, junk, FG_MAX_MSG_SIZE );
// write the interesting data to the socket
+#ifdef _MSC_VER
+ if ( _write(msgsock, buf, length) < 0 ) {
+#else
if ( std::write(msgsock, buf, length) < 0 ) {
+#endif
FG_LOG( FG_IO, FG_ALERT, "Error writing to socket: " << port );
error_condition = true;
} else {
bool FGSocket::close() {
for ( int i = 0; i < (int)client_connections.size(); ++i ) {
int msgsock = client_connections[i];
+#ifdef _MSC_VER
+ _close( msgsock );
+#else
std::close( msgsock );
+#endif
}
+#ifdef _MSC_VER
+ _close( sock );
+#else
std::close( sock );
-
+#endif
return true;
}
#include <plib/ssg.h> // plib include
#include "material.hxx"
+#include "fragment.hxx"
FG_USING_STD(string);
FG_USING_STD(map);
#include "tilecache.hxx"
#include "tileentry.hxx"
+FG_USING_NAMESPACE(std);
// a cheesy hack (to be fixed later)
extern ssgBranch *terrain;
while ( ! in.eof() ) {
in >> token;
in >> name;
-#ifdef MACOS
+#if defined ( MACOS ) || defined ( _MSC_VER )
in >> ::skipws;
#else
in >> skipws;
FG_LOG( FG_TERRAIN, FG_ALERT, "WHOOPS!!! Dying in next_avail()" );
exit( -1 );
}
+
+ // avoid a potential compiler warning
+ return -1;
}
#define KPHTOFPS 0.9113 //km/hr to ft/s
#define MSTOFPS 3.2808 //m/s to ft/s
current_aircraft.fdm_state->set_Velocities_Local_Airmass(my_value.Wind[1]*KPHTOFPS,
- my_value.Wind[0]*KPHTOFPS,
- my_value.Wind[2]*KPHTOFPS);
+ my_value.Wind[0]*KPHTOFPS,
+ my_value.Wind[2]*KPHTOFPS);
}