MacOS portability improvements.
This commit is contained in:
parent
489b562232
commit
f8dde93e05
@ -6,6 +6,8 @@ bin_PROGRAMS = testbucket
|
|||||||
|
|
||||||
testbucket_SOURCES = testbucket.cxx
|
testbucket_SOURCES = testbucket.cxx
|
||||||
|
|
||||||
testbucket_LDADD = $(top_builddir)/Lib/Bucket/libBucket.a
|
testbucket_LDADD = \
|
||||||
|
$(top_builddir)/Lib/Bucket/libBucket.a \
|
||||||
|
$(top_builddir)/Lib/Misc/libMisc.a
|
||||||
|
|
||||||
INCLUDES += -I$(top_builddir)
|
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <Misc/fgpath.hxx>
|
||||||
|
|
||||||
#include "newbucket.hxx"
|
#include "newbucket.hxx"
|
||||||
|
|
||||||
|
|
||||||
@ -36,11 +38,7 @@ string FGBucket::gen_base_path() const {
|
|||||||
// long int index;
|
// long int index;
|
||||||
int top_lon, top_lat, main_lon, main_lat;
|
int top_lon, top_lat, main_lon, main_lat;
|
||||||
char hem, pole;
|
char hem, pole;
|
||||||
char path[256];
|
char raw_path[256];
|
||||||
|
|
||||||
// index = gen_index();
|
|
||||||
|
|
||||||
path[0] = '\0';
|
|
||||||
|
|
||||||
top_lon = lon / 10;
|
top_lon = lon / 10;
|
||||||
main_lon = lon;
|
main_lon = lon;
|
||||||
@ -74,11 +72,13 @@ string FGBucket::gen_base_path() const {
|
|||||||
main_lat *= -1;
|
main_lat *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(path, "%c%03d%c%02d/%c%03d%c%02d",
|
sprintf(raw_path, "%c%03d%c%02d/%c%03d%c%02d",
|
||||||
hem, top_lon, pole, top_lat,
|
hem, top_lon, pole, top_lat,
|
||||||
hem, main_lon, pole, main_lat);
|
hem, main_lon, pole, main_lat);
|
||||||
|
|
||||||
return path;
|
FGPath path( raw_path );
|
||||||
|
|
||||||
|
return path.get_path();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,6 +44,11 @@ FG_USING_STD(string);
|
|||||||
FG_USING_STD(ostream);
|
FG_USING_STD(ostream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <Include/fg_constants.h>
|
#include <Include/fg_constants.h>
|
||||||
|
|
||||||
|
|
||||||
@ -81,6 +86,7 @@ public:
|
|||||||
|
|
||||||
// Set the bucket params for the specified lat and lon
|
// Set the bucket params for the specified lat and lon
|
||||||
void set_bucket( double dlon, double dlat );
|
void set_bucket( double dlon, double dlat );
|
||||||
|
void make_bad ( void );
|
||||||
|
|
||||||
// Generate the unique scenery tile index for this bucket
|
// Generate the unique scenery tile index for this bucket
|
||||||
long int gen_index();
|
long int gen_index();
|
||||||
@ -209,6 +215,7 @@ inline FGBucket::FGBucket(const double dlon, const double dlat) {
|
|||||||
set_bucket(dlon, dlat);
|
set_bucket(dlon, dlat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// create an impossible bucket if false
|
// create an impossible bucket if false
|
||||||
inline FGBucket::FGBucket(const bool is_good) {
|
inline FGBucket::FGBucket(const bool is_good) {
|
||||||
set_bucket(0.0, 0.0);
|
set_bucket(0.0, 0.0);
|
||||||
@ -296,6 +303,13 @@ inline double FGBucket::get_height() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create an impossible bucket
|
||||||
|
inline void FGBucket::make_bad( void ) {
|
||||||
|
set_bucket(0.0, 0.0);
|
||||||
|
lon = -1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// offset a bucket struct by the specified tile units in the X & Y
|
// offset a bucket struct by the specified tile units in the X & Y
|
||||||
// direction
|
// direction
|
||||||
FGBucket fgBucketOffset( double dlon, double dlat, int x, int y );
|
FGBucket fgBucketOffset( double dlon, double dlat, int x, int y );
|
||||||
|
@ -47,6 +47,10 @@ FG_USING_STD(cerr);
|
|||||||
FG_USING_STD(endl);
|
FG_USING_STD(endl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
FG_USING_STD(iostream);
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO:
|
// TODO:
|
||||||
//
|
//
|
||||||
@ -204,6 +208,8 @@ fglog()
|
|||||||
|
|
||||||
#ifdef FG_NDEBUG
|
#ifdef FG_NDEBUG
|
||||||
# define FG_LOG(C,P,M)
|
# define FG_LOG(C,P,M)
|
||||||
|
#elif defined( __MWERKS__ )
|
||||||
|
# define FG_LOG(C,P,M) ::fglog() << ::loglevel(C,P) << M << std::endl
|
||||||
#else
|
#else
|
||||||
# define FG_LOG(C,P,M) fglog() << loglevel(C,P) << M << endl
|
# define FG_LOG(C,P,M) fglog() << loglevel(C,P) << M << endl
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
|
|
||||||
#include <Include/compiler.h>
|
#include <Include/compiler.h>
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
#include <stdlib.h> // for exit()
|
||||||
|
#endif
|
||||||
|
|
||||||
#include STL_STRING
|
#include STL_STRING
|
||||||
|
|
||||||
#include <Debug/logstream.hxx>
|
#include <Debug/logstream.hxx>
|
||||||
@ -47,7 +51,7 @@ fgINTERPTABLE::fgINTERPTABLE( const string& file ) {
|
|||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
in >> skipcomment;
|
in >> skipcomment;
|
||||||
while ( ! in.eof() ){
|
while ( in ) {
|
||||||
if ( size < MAX_TABLE_SIZE ) {
|
if ( size < MAX_TABLE_SIZE ) {
|
||||||
in >> table[size][0] >> table[size][1];
|
in >> table[size][0] >> table[size][1];
|
||||||
size++;
|
size++;
|
||||||
|
@ -37,16 +37,6 @@ extern "C" {
|
|||||||
|
|
||||||
#define USE_XTRA_MAT3_INLINES
|
#define USE_XTRA_MAT3_INLINES
|
||||||
|
|
||||||
/* ------------------------------ Types --------------------------------- */
|
|
||||||
|
|
||||||
typedef double MAT3mat[4][4]; /* 4x4 matrix */
|
|
||||||
typedef double MAT3vec[3]; /* Vector */
|
|
||||||
typedef double MAT3hvec[4]; /* Vector with homogeneous coord */
|
|
||||||
|
|
||||||
/* ------------------------------ Macros -------------------------------- */
|
|
||||||
|
|
||||||
extern MAT3mat identityMatrix;
|
|
||||||
|
|
||||||
#if defined(i386)
|
#if defined(i386)
|
||||||
#define USE_X86_ASM
|
#define USE_X86_ASM
|
||||||
#endif
|
#endif
|
||||||
@ -69,9 +59,18 @@ static __inline int FloatToInt(float f)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define FloatToInt(F) ((int) (F))
|
#define FloatToInt(F) ((int) ((F) < 0.0f ? (F)-0.5f : (F)+0.5f))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* ------------------------------ Types --------------------------------- */
|
||||||
|
|
||||||
|
typedef double MAT3mat[4][4]; /* 4x4 matrix */
|
||||||
|
typedef double MAT3vec[3]; /* Vector */
|
||||||
|
typedef double MAT3hvec[4]; /* Vector with homogeneous coord */
|
||||||
|
|
||||||
|
/* ------------------------------ Macros -------------------------------- */
|
||||||
|
|
||||||
|
extern MAT3mat identityMatrix;
|
||||||
|
|
||||||
/* Tests if a number is within EPSILON of zero */
|
/* Tests if a number is within EPSILON of zero */
|
||||||
#define MAT3_IS_ZERO(N) ((N) < MAT3_EPSILON && (N) > -MAT3_EPSILON)
|
#define MAT3_IS_ZERO(N) ((N) < MAT3_EPSILON && (N) > -MAT3_EPSILON)
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
# error This library requires C++
|
# error This library requires C++
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Include/compiler.h"
|
#include <Include/compiler.h>
|
||||||
|
|
||||||
#ifdef FG_MATH_EXCEPTION_CLASH
|
#ifdef FG_MATH_EXCEPTION_CLASH
|
||||||
# define exception c_exception
|
# define exception c_exception
|
||||||
@ -50,11 +50,12 @@ FG_USING_STD(ostream);
|
|||||||
FG_USING_STD(istream);
|
FG_USING_STD(istream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -rp- assert.h is buggy under MWCWP3, as multiple #include undef assert !
|
// -dw- someone seems to have forgotten this...
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
# define assert(x)
|
FG_USING_STD(std);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
const double fgPoint3_Epsilon = 0.0000001;
|
const double fgPoint3_Epsilon = 0.0000001;
|
||||||
|
|
||||||
enum {PX, PY, PZ}; // axes
|
enum {PX, PY, PZ}; // axes
|
||||||
|
Loading…
Reference in New Issue
Block a user