From: curt Date: Mon, 27 Mar 2000 20:36:26 +0000 (+0000) Subject: Added simgear/magvar which impliments WMM 2000 world magnetic variance model. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4c79263dcff9072897089540be9876d6f21b794c;p=simgear.git Added simgear/magvar which impliments WMM 2000 world magnetic variance model. contributed by Ed Williams. Some additional internal rearrangement of code. --- diff --git a/configure.in b/configure.in index a788d3fc..6796522e 100644 --- a/configure.in +++ b/configure.in @@ -223,15 +223,15 @@ AC_FUNC_VPRINTF AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \ random setitimer getitimer signal GetLocalTime rint getrusage ) -AM_CONFIG_HEADER(simgear/include/config.h) +AM_CONFIG_HEADER(simgear/config.h) AC_OUTPUT( \ Makefile \ simgear/Makefile \ - simgear/include/Makefile \ - simgear/include/version.h \ + simgear/version.h \ simgear/bucket/Makefile \ simgear/debug/Makefile \ + simgear/magvar/Makefile \ simgear/math/Makefile \ simgear/misc/Makefile \ simgear/screen/Makefile \ diff --git a/simgear/Makefile.am b/simgear/Makefile.am index b36ab91e..4bfc91ff 100644 --- a/simgear/Makefile.am +++ b/simgear/Makefile.am @@ -13,10 +13,14 @@ endif METAR_DIRS = # METAR_DIRS = metar +EXTRA_DIST = version.h.in + +include_HEADERS = compiler.h constants.h fg_traits.hxx fg_zlib.h version.h + SUBDIRS = \ - include \ bucket \ debug \ + magvar \ math \ $(METAR_DIRS) \ misc \ diff --git a/simgear/bucket/Makefile.am b/simgear/bucket/Makefile.am index 8ebce7bf..7d64da0e 100644 --- a/simgear/bucket/Makefile.am +++ b/simgear/bucket/Makefile.am @@ -14,4 +14,4 @@ libsgbucket_a_SOURCES = newbucket.cxx # $(top_builddir)/bucket/libsgbucket.a \ # $(top_builddir)/misc/libsgmisc.a -# INCLUDES += -I$(top_builddir)/src +INCLUDES += -I$(top_builddir) diff --git a/simgear/compiler.h b/simgear/compiler.h new file mode 100644 index 00000000..a6d0b88f --- /dev/null +++ b/simgear/compiler.h @@ -0,0 +1,303 @@ +/************************************************************************** + * compiler.h -- C++ Compiler Portability Macros + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id$ + **************************************************************************/ + +#ifndef _COMPILER_H +#define _COMPILER_H + +// What this file does. +// (1) Defines macros for some STL includes which may be affected +// by file name length limitations. +// (2) Defines macros for some features not supported by all C++ compilers. +// (3) Defines 'explicit' as a null macro if the compiler doesn't support +// the explicit keyword. +// (4) Defines 'typename' as a null macro if the compiler doesn't support +// the typename keyword. +// (5) Defines bool, true and false if the compiler doesn't do so. +// (6) Defines FG_EXPLICIT_FUNCTION_TMPL_ARGS if the compiler +// supports calling a function template by providing its template +// arguments explicitly. +// (7) Defines FG_NEED_AUTO_PTR if STL doesn't provide auto_ptr<>. +// (8) Defines FG_NO_ARROW_OPERATOR if the compiler is unable +// to support operator->() for iterators. +// (9) Defines FG_USE_EXCEPTIONS if the compiler supports exceptions. +// Note: no FlightGear code uses exceptions. +// (10) Define FG_NAMESPACES if the compiler supports namespaces. +// (11) FG_MATH_FN_IN_NAMESPACE_STD -- not used?? +// (12) Define FG_HAVE_STD if std namespace is supported. +// (13) Defines FG_CLASS_PARTIAL_SPECIALIZATION if the compiler +// supports partial specialization of class templates. +// (14) Defines FG_HAVE_STD_INCLUDES to use ISO C++ Standard headers. +// (15) Defines FG_HAVE_STREAMBUF if of are present. +// (16) Define FG_MATH_EXCEPTION_CLASH if math.h defines an exception class +// that clashes with the one defined in . + +#ifdef __GNUC__ +# if __GNUC__ == 2 +# if __GNUC_MINOR__ < 8 + + // g++-2.7.x +# define STL_ALGORITHM +# define STL_FUNCTIONAL +# define STL_IOMANIP +# define STL_IOSTREAM +# define STL_FSTREAM +# define STL_STDEXCEPT +# define STL_STRING +# define STL_STRSTREAM + +# define FG_NEED_AUTO_PTR +# define FG_NO_DEFAULT_TEMPLATE_ARGS +# define FG_INCOMPLETE_FUNCTIONAL +# define FG_NO_ARROW_OPERATOR + +# elif __GNUC_MINOR__ >= 8 + + // g++-2.8.x and egcs-1.x +# define FG_EXPLICIT_FUNCTION_TMPL_ARGS +# define FG_NEED_AUTO_PTR +# define FG_MEMBER_TEMPLATES +# define FG_NAMESPACES +# define FG_HAVE_STD +# define FG_HAVE_STREAMBUF +# define FG_CLASS_PARTIAL_SPECIALIZATION + +# define STL_ALGORITHM +# define STL_FUNCTIONAL +# define STL_IOMANIP +# define STL_IOSTREAM +# define STL_FSTREAM +# define STL_STDEXCEPT +# define STL_STRING +# define STL_STRSTREAM + +# endif +# else +# error Time to upgrade. GNU compilers < 2.7 not supported +# endif +#endif + +// +// Metrowerks +// +#if defined(__MWERKS__) +/* + CodeWarrior compiler from Metrowerks, Inc. +*/ +# define FG_HAVE_TRAITS +# define FG_HAVE_STD_INCLUDES +# define FG_HAVE_STD +# define FG_NAMESPACES + +# define STL_ALGORITHM +# define STL_FUNCTIONAL +# define STL_IOMANIP +# define STL_IOSTREAM +# define STL_FSTREAM +# define STL_STDEXCEPT +# define STL_STRING + +// Temp: +# define bcopy(from, to, n) memcpy(to, from, n) + +// -rp- please use FG_MEM_COPY everywhere ! +# define FG_MEM_COPY(to,from,n) memcpy(to, from, n) + +// -dw- currently used glut has no game mode stuff +# define GLUT_WRONG_VERSION +#endif + +// +// Microsoft compilers. +// +#ifdef _MSC_VER +# if _MSC_VER == 1200 // msvc++ 6.0 +# define FG_NAMESPACES +# define FG_HAVE_STD +# define FG_HAVE_STD_INCLUDES +# define FG_HAVE_STREAMBUF + +# define STL_ALGORITHM +# define STL_FUNCTIONAL +# define STL_IOMANIP +# define STL_IOSTREAM +# define STL_FSTREAM +# define STL_STDEXCEPT +# define STL_STRING +# define STL_STRSTREAM + +# pragma warning(disable: 4786) // identifier was truncated to '255' characters +# pragma warning(disable: 4244) // conversion from double to float +# pragma warning(disable: 4305) // + +# elif _MSC_VER == 1100 // msvc++ 5.0 +# error MSVC++ 5.0 still to be supported... +# else +# error What version of MSVC++ is this? +# endif +#endif + +#ifdef __BORLANDC__ +# if defined(HAVE_SGI_STL_PORT) + +// Use quotes around long file names to get around Borland's include hackery + +# define STL_ALGORITHM "algorithm" +# define STL_FUNCTIONAL "functional" + +# define FG_MATH_EXCEPTION_CLASH + +# else + +# define STL_ALGORITHM +# define STL_FUNCTIONAL +# define STL_IOMANIP +# define STL_STDEXCEPT +# define STL_STRSTREAM + +# define FG_INCOMPLETE_FUNCTIONAL + +# endif // HAVE_SGI_STL_PORT + +# define STL_IOSTREAM +# define STL_FSTREAM +# define STL_STRING +# define FG_NO_DEFAULT_TEMPLATE_ARGS +# define FG_NAMESPACES +// # define FG_HAVE_STD + +#endif // __BORLANDC__ + +// +// Native SGI compilers +// + +#if defined ( sgi ) && !defined( __GNUC__ ) +# define FG_HAVE_NATIVE_SGI_COMPILERS + +# define FG_EXPLICIT_FUNCTION_TMPL_ARGS +# define FG_NEED_AUTO_PTR +# define FG_MEMBER_TEMPLATES +# define FG_NAMESPACES +# define FG_HAVE_STD +# define FG_CLASS_PARTIAL_SPECIALIZATION + +# define STL_ALGORITHM +# define STL_FUNCTIONAL +# define STL_IOMANIP +# define STL_IOSTREAM +# define STL_FSTREAM +# define STL_STDEXCEPT +# define STL_STRING +# define STL_STRSTREAM + +#endif // Native SGI compilers + + +#if defined ( sun ) +# include +# include +# if defined ( __cplusplus ) + // typedef unsigned int size_t; + extern "C" { + extern void *memmove(void *, const void *, size_t); + } +# else + extern void *memmove(void *, const void *, size_t); +# endif // __cplusplus +#endif // sun + +// +// No user modifiable definitions beyond here. +// + +#ifdef FG_NEED_EXPLICIT +# define explicit +#endif + +#ifdef FG_NEED_TYPENAME +# define typename +#endif + +#ifdef FG_NEED_MUTABLE +# define mutable +#endif + +#ifdef FG_NEED_BOOL + typedef int bool; +# define true 1 +# define false 0 +#endif + +#ifdef FG_EXPLICIT_FUNCTION_TMPL_ARGS +# define FG_NULL_TMPL_ARGS <> +#else +# define FG_NULL_TMPL_ARGS +#endif + +#ifdef FG_CLASS_PARTIAL_SPECIALIZATION +# define FG_TEMPLATE_NULL template<> +#else +# define FG_TEMPLATE_NULL +#endif + +// FG_NO_NAMESPACES is a hook so that users can disable namespaces +// without having to edit library headers. +#if defined(FG_NAMESPACES) && !defined(FG_NO_NAMESPACES) +# define FG_NAMESPACE(X) namespace X { +# define FG_NAMESPACE_END } +# define FG_USING_NAMESPACE(X) using namespace X +# else +# define FG_NAMESPACE(X) +# define FG_NAMESPACE_END +# define FG_USING_NAMESPACE(X) +#endif + +# ifdef FG_HAVE_STD +# define FG_USING_STD(X) using std::X +# define STD std +# else +# define FG_USING_STD(X) +# define STD +# endif + +// Additional implementation from SGI STL 3.11 +// Adapter function objects: pointers to member functions +#ifdef FG_INCOMPLETE_FUNCTIONAL + +template +class const_mem_fun_ref_t +#ifndef __BORLANDC__ + : public unary_function<_Tp,_Ret> +#endif // __BORLANDC__ +{ +public: + explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) {} + _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); } +private: + _Ret (_Tp::*_M_f)() const; +}; + +template +inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const) + { return const_mem_fun_ref_t<_Ret,_Tp>(__f); } + +#endif // FG_INCOMPLETE_FUNCTIONAL + +#endif // _COMPILER_H diff --git a/simgear/config.h b/simgear/config.h new file mode 100644 index 00000000..84b22bd4 --- /dev/null +++ b/simgear/config.h @@ -0,0 +1,209 @@ +/* simgear/config.h. Generated automatically by configure. */ +/* simgear/include/config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + +/* Define if you don't have vprintf but do have _doprnt. */ +/* #undef HAVE_DOPRNT */ + +/* Define if you have the vprintf function. */ +#define HAVE_VPRINTF 1 + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if your declares struct tm. */ +/* #undef TM_IN_SYS_TIME */ + +/* Define if the X Window System is missing or not being used. */ +/* #undef X_DISPLAY_MISSING */ + +/* Define to empty if the keyword does not work. */ +/* #undef const */ + + +/* Define to eliminate all trace of debugging messages such as for a + release build */ +/* #undef FG_NDEBUG */ + + +/* Define to enable 3dfx/glide render in a window hack under unix. + This probably won't work under windows. */ +/* #undef XMESA */ +/* #undef FX */ + +/* Define if you don't have vprintf but do have _doprnt. */ +/* #undef HAVE_DOPRNT */ + +/* Define if you have the vprintf function. */ +#define HAVE_VPRINTF 1 + +/* Define if you have zlib installed system wide. */ +/* #undef HAVE_ZLIB */ + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define to `unsigned' if doesn't define. */ +/* #undef size_t */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define if your declares struct tm. */ +/* #undef TM_IN_SYS_TIME */ + +/* Define if compiling on a Winbloze (95, NT, etc.) platform */ +/* #undef WIN32 */ + +/* Define if the X Window System is missing or not being used. */ +/* #undef X_DISPLAY_MISSING */ + +/* Define if you have the GetLocalTime function. */ +/* #undef HAVE_GETLOCALTIME */ + +/* Define if you have the bcopy function. */ +#define HAVE_BCOPY 1 + +/* Define if you have the ftime function. */ +#define HAVE_FTIME 1 + +/* Define if you have the getitimer function. */ +#define HAVE_GETITIMER 1 + +/* Define if you have the getrusage function. */ +#define HAVE_GETRUSAGE 1 + +/* Define if you have the gettimeofday function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define if you have the memcpy function. */ +#define HAVE_MEMCPY 1 + +/* Define if you have the mktime function. */ +#define HAVE_MKTIME 1 + +/* Define if you have the rand function. */ +#define HAVE_RAND 1 + +/* Define if you have the random function. */ +#define HAVE_RANDOM 1 + +/* Define if you have the rint function. */ +#define HAVE_RINT 1 + +/* Define if you have the setitimer function. */ +#define HAVE_SETITIMER 1 + +/* Define if you have the signal function. */ +#define HAVE_SIGNAL 1 + +/* Define if you have the strstr function. */ +#define HAVE_STRSTR 1 + +/* Define if you have the timegm function. */ +#define HAVE_TIMEGM 1 + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +#define HAVE_GETOPT_H 1 + +/* Define if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_TIMEB_H 1 + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the header file. */ +#define HAVE_VALUES_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_WINBASE_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define if you have the GL library (-lGL). */ +#define HAVE_LIBGL 1 + +/* Define if you have the GLU library (-lGLU). */ +/* #undef HAVE_LIBGLU */ + +/* Define if you have the GLcore library (-lGLcore). */ +/* #undef HAVE_LIBGLCORE */ + +/* Define if you have the ICE library (-lICE). */ +#define HAVE_LIBICE 1 + +/* Define if you have the MesaGL library (-lMesaGL). */ +/* #undef HAVE_LIBMESAGL */ + +/* Define if you have the MesaGLU library (-lMesaGLU). */ +#define HAVE_LIBMESAGLU 1 + +/* Define if you have the SM library (-lSM). */ +#define HAVE_LIBSM 1 + +/* Define if you have the X11 library (-lX11). */ +#define HAVE_LIBX11 1 + +/* Define if you have the Xext library (-lXext). */ +#define HAVE_LIBXEXT 1 + +/* Define if you have the Xi library (-lXi). */ +#define HAVE_LIBXI 1 + +/* Define if you have the Xmu library (-lXmu). */ +#define HAVE_LIBXMU 1 + +/* Define if you have the Xt library (-lXt). */ +#define HAVE_LIBXT 1 + +/* Define if you have the glut library (-lglut). */ +#define HAVE_LIBGLUT 1 + +/* Define if you have the m library (-lm). */ +#define HAVE_LIBM 1 + +/* Define if you have the socket library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ + +/* Name of package */ +#define PACKAGE "SimGear" + +/* Version number of package */ +#define VERSION "0.0.6" + diff --git a/simgear/constants.h b/simgear/constants.h new file mode 100644 index 00000000..f4d40d2a --- /dev/null +++ b/simgear/constants.h @@ -0,0 +1,143 @@ +// constants.h -- various constant definitions +// +// Written by Curtis Olson, started February 2000. +// +// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ + + +#ifndef _SUPPORTGEAR_CONSTANTS_H +#define _SUPPORTGEAR_CONSTANTS_H + + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#ifdef FG_HAVE_STD_INCLUDES +# include +#else +# ifdef FG_MATH_EXCEPTION_CLASH +# define exception C_exception +# endif +# include +#endif + + +// Make sure PI is defined in its various forms + +// PI, only PI, and nothing but PI +#ifdef M_PI +# define FG_PI M_PI +#else +# define FG_PI 3.14159265358979323846 +#endif + +// 2 * PI +#define FG_2PI 6.28318530717958647692 + +// PI / 2 +#ifdef M_PI_2 +# define FG_PI_2 M_PI_2 +#else +# define FG_PI_2 1.57079632679489661923 +#endif + +// PI / 4 +#define FG_PI_4 0.78539816339744830961 + +#ifndef M_E +# define M_E 2.7182818284590452354 +#endif + +// ONE_SECOND is pi/180/60/60, or about 100 feet at earths' equator +#define ONE_SECOND 4.848136811E-6 + + +// Radius of Earth in kilometers at the equator. Another source had +// 6378.165 but this is probably close enough +#define EARTH_RAD 6378.155 + + +// Earth parameters for WGS 84, taken from LaRCsim/ls_constants.h + +// Value of earth radius from [8] +#define EQUATORIAL_RADIUS_FT 20925650. // ft +#define EQUATORIAL_RADIUS_M 6378138.12 // meter +// Radius squared +#define RESQ_FT 437882827922500. // ft +#define RESQ_M 40680645877797.1344 // meter + +// Value of earth flattening parameter from ref [8] +// +// Note: FP = f +// E = 1-f +// EPS = sqrt(1-(1-f)^2) +// + +#define FP 0.003352813178 +#define E 0.996647186 +#define EPS 0.081819221 +#define INVG 0.031080997 + +// Time Related Parameters + +#define MJD0 2415020.0 +#define J2000 (2451545.0 - MJD0) +#define SIDRATE .9972695677 + + +// Conversions + +// Degrees to Radians +#define DEG_TO_RAD 0.017453292 // deg*pi/180 = rad + +// Radians to Degrees +#define RAD_TO_DEG 57.29577951 // rad*180/pi = deg + +// Arc seconds to radians // (arcsec*pi)/(3600*180) = rad +#define ARCSEC_TO_RAD 4.84813681109535993589e-06 + +// Radians to arc seconds // (rad*3600*180)/pi = arcsec +#define RAD_TO_ARCSEC 206264.806247096355156 + +// Feet to Meters +#define FEET_TO_METER 0.3048 + +// Meters to Feet +#define METER_TO_FEET 3.28083989501312335958 + +// Meters to Nautical Miles, 1 nm = 6076.11549 feet +#define METER_TO_NM 0.00053995680 + +// Nautical Miles to Meters +#define NM_TO_METER 1852.0000 + +// Radians to Nautical Miles, 1 nm = 1/60 of a degree +#define NM_TO_RAD 0.00029088820866572159 + +// Nautical Miles to Radians +#define RAD_TO_NM 3437.7467707849392526 + +// For divide by zero avoidance, this will be close enough to zero +#define FG_EPSILON 0.0000001 + + +#endif // _SUPPORTGEAR_CONSTANTS_H diff --git a/simgear/debug/Makefile.am b/simgear/debug/Makefile.am index fcf0bcd4..98942835 100644 --- a/simgear/debug/Makefile.am +++ b/simgear/debug/Makefile.am @@ -8,4 +8,4 @@ include_HEADERS = debug_types.h logstream.hxx libsgdebug_a_SOURCES = logstream.cxx -# INCLUDES += -I$(top_builddir)/src +INCLUDES += -I$(top_builddir) diff --git a/simgear/fg_traits.hxx b/simgear/fg_traits.hxx new file mode 100644 index 00000000..ad1084bf --- /dev/null +++ b/simgear/fg_traits.hxx @@ -0,0 +1,23 @@ +#ifndef _FG_TRAITS_HXX +#define _FG_TRAITS_HXX + +#include + +#ifndef FG_HAVE_TRAITS + +// Dummy up some char traits for now. +template struct char_traits{}; + +FG_TEMPLATE_NULL +struct char_traits +{ + typedef char char_type; + typedef int int_type; + typedef streampos pos_type; + typedef streamoff off_type; + + static int_type eof() { return EOF; } +}; +#endif // FG_HAVE_TRAITS + +#endif // _FG_TRAITS_HXX diff --git a/simgear/fg_zlib.h b/simgear/fg_zlib.h new file mode 100644 index 00000000..1c02290a --- /dev/null +++ b/simgear/fg_zlib.h @@ -0,0 +1,86 @@ +/************************************************************************** + * fg_zlib.h -- a zlib wrapper to replace zlib calls with normal uncompressed + * calls for systems that have problems building zlib. + * + * Written by Curtis Olson, started April 1998. + * + * Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id$ + **************************************************************************/ + + +#ifndef _FG_ZLIB_H +#define _FG_ZLIB_H + + +#ifdef HAVE_CONFIG_H +# include +#endif + + +#ifdef AVOID_USING_ZLIB + + #include + + #define fgFile FILE * + + /* fgFile fgopen(char *filename, const char *flags) */ + #define fgopen(P, F) (fopen((P), (F))) + + /* int fgseek(fgFile *file, long offset, int whence) */ + #define fgseek(F, O, W) (fseek((F), (O), (W))) + + /* fgread(fgFile file, void *buf, int size); */ + #define fgread(F, B, S) (fread((B), (S), 1, (F))) + + /* int fggets(fgFile fd, char *buffer, int len) */ + #define fggets(F, B, L) (fgets((B), (L), (F))) + + /* int fgclose(fgFile fd) */ + #define fgclose(F) (fclose((F))) +#else + +#ifdef HAVE_ZLIB + #include +#else + #include +#endif + + #define fgFile gzFile + + /* fgFile fgopen(char *filename, const char *flags) */ + #define fgopen(P, F) (gzopen((P), (F))) + + /* int fgseek(fgFile *file, long offset, int whence) */ + #define fgseek(F, O, W) (gzseek((F), (O), (W))) + + /* fgread(fgFile file, void *buf, int size); */ + #define fgread(F, B, S) (gzread((F), (B), (S))) + + /* int fggets(fgFile fd, char *buffer, int len) */ + #define fggets(F, B, L) (gzgets((F), (B), (L))) + + /* int fgclose(fgFile fd) */ + #define fgclose(F) (gzclose((F))) + +#endif /* #ifdef AVOID_USING_ZLIB #else #endif */ + + +#endif /* _FG_ZLIB_H */ + + diff --git a/simgear/magvar/Makefile.am b/simgear/magvar/Makefile.am new file mode 100644 index 00000000..0c28e79a --- /dev/null +++ b/simgear/magvar/Makefile.am @@ -0,0 +1,15 @@ +includedir = @includedir@/magvar + +lib_LIBRARIES = libsgmagvar.a + +include_HEADERS = magvar.hxx + +libsgmagvar_a_SOURCES = magvar.cxx + +noinst_PROGRAMS = testmagvar + +testmagvar_SOURCES = testmagvar.cxx + +testmagvar_LDADD = $(top_builddir)/simgear/magvar/libsgmagvar.a + +INCLUDES += -I$(top_builddir) diff --git a/simgear/magvar/magvar.cxx b/simgear/magvar/magvar.cxx new file mode 100644 index 00000000..827ad04a --- /dev/null +++ b/simgear/magvar/magvar.cxx @@ -0,0 +1,277 @@ +// magvar.cxx -- compute local magnetic variation given position, +// altitude, and date +// +// This is an implimentation of the NIMA WMM 2000 +// +// http://www.nima.mil/GandG/ngdc-wmm2000.html +// +// Copyright (C) 2000 Edward A Williams +// +// Adapted from Excel 3.0 version 3/27/94 EAW +// Recoded in C++ by Starry Chan +// WMM95 added and rearranged in ANSI-C EAW 7/9/95 +// Put shell around program and made Borland & GCC compatible EAW 11/22/95 +// IGRF95 added 2/96 EAW +// WMM2000 IGR2000 added 2/00 EAW +// Released under GPL 3/26/00 EAW +// Adaptions and modifications for the SimGear project 3/27/2000 CLO +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ + + +#include +#include +#include + +#include "magvar.hxx" + + +#define max(a,b) (((a) > (b)) ? (a) : (b)) + +static const double pi = 3.14159265358979; +static const double a = 6378.16; /* major radius (km) IAU66 ellipsoid */ +static const double f = 1.0 / 298.25; /* inverse flattening IAU66 ellipsoid */ +static const double b = 6378.16 * (1.0 -1.0 / 298.25 ); +/* minor radius b=a*(1-f) */ +static const double r_0 = 6371.2; /* "mean radius" for spherical harmonic expansion */ + +static double gnm_wmm2000[13][13] = +{ + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {-29616.0, -1722.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {-2266.7, 3070.2, 1677.6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {1322.4, -2291.5, 1255.9, 724.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {932.1, 786.3, 250.6, -401.5, 106.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {-211.9, 351.6, 220.8, -134.5, -168.8, -13.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {73.8, 68.2, 74.1, -163.5, -3.8, 17.1, -85.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {77.4, -73.9, 2.2, 35.7, 7.3, 5.2, 8.4, -1.5, 0.0, 0.0, 0.0, 0.0, 0.0}, + {23.3, 7.3, -8.5, -6.6, -16.9, 8.6, 4.9, -7.8, -7.6, 0.0, 0.0, 0.0, 0.0}, + {5.7, 8.5, 2.0, -9.8, 7.6, -7.0, -2.0, 9.2, -2.2, -6.6, 0.0, 0.0, 0.0}, + {-2.2, -5.7, 1.6, -3.7, -0.6, 4.1, 2.2, 2.2, 4.6, 2.3, 0.1, 0.0, 0.0}, + {3.3, -1.1, -2.4, 2.6, -1.3, -1.7, -0.6, 0.4, 0.7, -0.3, 2.3, 4.2, 0.0}, + {-1.5, -0.2, -0.3, 0.5, 0.2, 0.9, -1.4, 0.6, -0.6, -1.0, -0.3, 0.3, 0.4}, +}; + +static double hnm_wmm2000[13][13]= +{ + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 5194.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, -2484.8, -467.9, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, -224.7, 293.0, -486.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 273.3, -227.9, 120.9, -302.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 42.0, 173.8, -135.0, -38.6, 105.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, -17.4, 61.2, 63.2, -62.9, 0.2, 43.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, -62.3, -24.5, 8.9, 23.4, 15.0, -27.6, -7.8, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 12.4, -20.8, 8.4, -21.2, 15.5, 9.1, -15.5, -5.4, 0.0, 0.0, 0.0, 0.0}, + {0.0, -20.4, 13.9, 12.0, -6.2, -8.6, 9.4, 5.0, -8.4, 3.2, 0.0, 0.0, 0.0}, + {0.0, 0.9, -0.7, 3.9, 4.8, -5.3, -1.0, -2.4, 1.3, -2.3, -6.4, 0.0, 0.0}, + {0.0, -1.5, 0.7, -1.1, -2.3, 1.3, -0.6, -2.8, -1.6, -0.1, -1.9, 1.4, 0.0}, + {0.0, -1.0, 0.7, 2.2, -2.5, -0.2, 0.0, -0.2, 0.0, 0.2, -0.9, -0.2, 1.0}, +}; + +static double gtnm_wmm2000[13][13]= +{ + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {14.7, 11.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {-13.6, -0.7, -1.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.3, -4.3, 0.9, -8.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {-1.6, 0.9, -7.6, 2.2, -3.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {-0.9, -0.2, -2.5, -2.7, -0.9, 1.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {1.2, 0.2, 1.7, 1.6, -0.1, -0.3, 0.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {-0.4, -0.8, -0.2, 1.1, 0.4, 0.0, -0.2, -0.2, 0.0, 0.0, 0.0, 0.0, 0.0}, + {-0.3, 0.6, -0.8, 0.3, -0.2, 0.5, 0.0, -0.6, 0.1, 0.0, 0.0, 0.0, 0.0}, + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, +}; + +static double htnm_wmm2000[13][13]= +{ + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, -20.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, -21.5, -9.6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 6.4, -1.3, -13.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 2.3, 0.7, 3.7, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 0.0, 2.1, 2.3, 3.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, -0.3, -1.7, -0.9, -1.0, -0.1, 1.9, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 1.4, 0.2, 0.7, 0.4, -0.3, -0.8, -0.1, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, -0.5, 0.1, -0.2, 0.0, 0.1, -0.1, 0.3, 0.2, 0.0, 0.0, 0.0, 0.0}, + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, + {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, +}; + +static const int nmax = 12; + +static double P[13][13]; +static double DP[13][13]; +static double gnm[13][13]; +static double hnm[13][13]; +static double sm[13]; +static double cm[13]; + + +/* Convert date to Julian day 1950-2049 */ +unsigned long int yymmdd_to_julian_days( int yy, int mm, int dd ) +{ + unsigned long jd; + + yy = (yy < 50) ? (2000 + yy) : (1900 + yy); + jd = dd - 32075L + 1461L * (yy + 4800L + (mm - 14) / 12 ) / 4; + jd = jd + 367L * (mm - 2 - (mm - 14) / 12*12) / 12; + jd = jd - 3 * ((yy + 4900L + (mm - 14) / 12) / 100) / 4; + + /* printf("julian date = %d\n", jd ); */ + return jd; +} + + +/* Convert degrees to radians */ +double deg_to_rad( double deg ) +{ + return deg*pi/180.; +} + + +/* Convert radians to degrees */ +double rad_to_deg( double rad ) +{ + return rad*180./pi; +} + + +/* return variation (in degrees) given geodetic latitude (radians), longitude +(radians) ,height (km) and (Julian) date +N and E lat and long are positive, S and W negative +*/ + +double SGMagVar( double lat, double lon, double h, long dat, double* field ) +{ + /* output field B_r,B_th,B_phi,B_x,B_y,B_z */ + int n,m; + /* reference dates */ + long date0_wmm2000 = yymmdd_to_julian_days(0,1,1); + + double yearfrac,sr,r,theta,c,s,psi,fn,B_r,B_theta,B_phi,X,Y,Z; + + /* convert to geocentric coords: */ + sr = sqrt(pow(a*cos(lat),2.0)+pow(b*sin(lat),2.0)); + /* sr is effective radius */ + theta = atan2(cos(lat) * (h * sr + a * a), + sin(lat) * (h * sr + b * b)); + /* theta is geocentric co-latitude */ + + r = h * h + 2.0*h * sr + + (pow(a,4.0) - (pow(a,4.0) - pow(b,4.0)) * pow(sin(lat),2.0)) / + (a * a - (a * a - b * b) * pow(sin(lat),2.0)); + + r = sqrt(r); + + /* r is geocentric radial distance */ + c = cos(theta); + s = sin(theta); + + /*zero out arrays */ + for ( n = 0; n <= nmax; n++ ) { + for ( m = 0; m <= n; m++ ) { + P[n][m] = 0; + DP[n][m] = 0; + } + } + + /* diagonal elements */ + P[0][0] = 1; + P[1][1] = s; + DP[0][0] = 0; + DP[1][1] = c; + P[1][0] = c ; + DP[1][0] = -s; + + for ( n = 2; n <= nmax; n++ ) { + P[n][n] = P[n-1][n-1] * s * sqrt((2.0*n-1) / (2.0*n)); + DP[n][n] = (DP[n-1][n-1] * s + P[n-1][n-1] * c) * + sqrt((2.0*n-1) / (2.0*n)); + } + + /* lower triangle */ + for ( m = 0; m <= nmax; m++ ) { + for ( n = max(m + 1, 2); n <= nmax; n++ ) { + P[n][m] = (P[n-1][m] * c * (2.0*n-1) - P[n-2][m] * + sqrt(1.0*(n-1)*(n-1) - m * m)) / + sqrt(1.0* n * n - m * m); + DP[n][m] = ((DP[n-1][m] * c - P[n-1][m] * s) * + (2.0*n-1) - DP[n-2][m] * + sqrt(1.0*(n-1) * (n-1) - m * m)) / + sqrt(1.0* n * n - m * m); + } + } + + /* compute gnm, hnm at dat */ + /* WMM2000 */ + yearfrac = (dat - date0_wmm2000) / 365.25; + for ( n = 1; n <= nmax; n++ ) { + for ( m = 0; m <= nmax; m++ ) { + gnm[n][m] = gnm_wmm2000[n][m] + yearfrac * gtnm_wmm2000[n][m]; + hnm[n][m] = hnm_wmm2000[n][m] + yearfrac * htnm_wmm2000[n][m]; + } + } + + /* compute sm (sin(m lon) and cm (cos(m lon)) */ + for ( m = 0; m <= nmax; m++ ) { + sm[m] = sin(m * lon); + cm[m] = cos(m * lon); + } + + /* compute B fields */ + B_r = 0.0; + B_theta = 0.0; + B_phi = 0.0; + + for ( n = 1; n <= nmax; n++ ) { + double c1_n=0; + double c2_n=0; + double c3_n=0; + for ( m = 0; m <= n; m++ ) { + c1_n=c1_n + (gnm[n][m] * cm[m] + hnm[n][m] * sm[m]) * P[n][m]; + c2_n=c2_n + (gnm[n][m] * cm[m] + hnm[n][m] * sm[m]) * DP[n][m]; + c3_n=c3_n + m * (gnm[n][m] * sm[m] - hnm[n][m] * cm[m]) * P[n][m]; + } + fn=pow(r_0/r,n+2.0); + B_r = B_r + (n + 1) * c1_n * fn; + B_theta = B_theta - c2_n * fn; + B_phi = B_phi + c3_n * fn / s; + } + + /* Find geodetic field components: */ + psi = theta - (pi / 2.0 - lat); + X = -B_theta * cos(psi) - B_r * sin(psi); + Y = B_phi; + Z = B_theta * sin(psi) - B_r * cos(psi); + + field[0]=B_r; + field[1]=B_theta; + field[2]=B_phi; + field[3]=X; + field[4]=Y; + field[5]=Z; /* output fields */ + + /* find variation, convert to degrees! */ + return rad_to_deg(atan2(Y, X)); /* E is positive */ +} + diff --git a/simgear/magvar/magvar.hxx b/simgear/magvar/magvar.hxx new file mode 100644 index 00000000..f08b5840 --- /dev/null +++ b/simgear/magvar/magvar.hxx @@ -0,0 +1,56 @@ +// magvar.hxx -- compute local magnetic variation given position, +// altitude, and date +// +// This is an implimentation of the NIMA WMM 2000 +// +// http://www.nima.mil/GandG/ngdc-wmm2000.html +// +// Copyright (C) 2000 Edward A Williams +// +// Adapted from Excel 3.0 version 3/27/94 EAW +// Recoded in C++ by Starry Chan +// WMM95 added and rearranged in ANSI-C EAW 7/9/95 +// Put shell around program and made Borland & GCC compatible EAW 11/22/95 +// IGRF95 added 2/96 EAW +// WMM2000 IGR2000 added 2/00 EAW +// Released under GPL 3/26/00 EAW +// Adaptions and modifications for the SimGear project 3/27/2000 CLO +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ + + +#ifndef SG_MAGVAR_HXX +#define SG_MAGVAR_HXX + + +/* Convert date to Julian day 1950-2049 */ +unsigned long int yymmdd_to_julian_days( int yy, int mm, int dd ); + +/* Convert degrees to radians */ +double deg_to_rad( double deg ); + +/* Convert radians to degrees */ +double rad_to_deg( double rad ); + +/* return variation (in degrees) given geodetic latitude (radians), longitude +(radians) ,height (km) and (Julian) date +N and E lat and long are positive, S and W negative +*/ +double SGMagVar( double lat, double lon, double h, long dat, double* field ); + + +#endif // SG_MAGVAR_HXX diff --git a/simgear/magvar/testmagvar.cxx b/simgear/magvar/testmagvar.cxx new file mode 100644 index 00000000..8f18b6d0 --- /dev/null +++ b/simgear/magvar/testmagvar.cxx @@ -0,0 +1,53 @@ +/* 2/14/00 fixed help message- dip angle (down positive), variation (E positive) */ + +#include +#include +#include + +#include "magvar.hxx" + + +int main(int argc, char *argv[]) +{ + /* args are double lat_deg, double lon_deg, double h, + int mm, int dd, int yy,int model */ + /* output N, E, down components of B (nTesla) + dip angle (down positive), variation (E positive) */ +double lat_deg,lon_deg,h,var; +int model,yy,mm,dd; +double field[6]; + +if ((argc != 8) && (argc !=7)) { +fprintf(stdout,"Usage: mag lat_deg lon_deg h mm dd yy [model]\n"); +fprintf(stdout,"N latitudes, E longitudes positive degrees, h in km, mm dd yy is date\n"); +fprintf(stdout,"model 1,2,3,4,5,6,7 <=> IGRF90,WMM85,WMM90,WMM95,IGRF95,WMM2000,IGRF2000\n"); +fprintf(stdout,"Default model is IGRF2000, valid 1/1/00 - 12/31/05\n"); +fprintf(stdout,"Output Bx (N) By (E) Bz (down) (in nTesla) dip (degrees down positive)\n"); +fprintf(stdout,"variation (degrees E positive)\n"); +exit(1); +} + +lat_deg=strtod(argv[1],NULL); +lon_deg=strtod(argv[2],NULL); +h= strtod(argv[3],NULL); +mm= (int)strtol(argv[4],NULL,10); +dd= (int)strtol(argv[5],NULL,10); +yy= (int)strtol(argv[6],NULL,10); +if (argc == 8){ + model= (int)strtol(argv[7],NULL,10); +}else{ + model=7; +} + + +var = SGMagVar( deg_to_rad(lat_deg), deg_to_rad(lon_deg), h, + yymmdd_to_julian_days(yy,mm,dd), field ); + +fprintf(stdout,"%6.0lf %6.0lf %6.0lf %4.2lf %4.2lf \n", + field[3],field[4],field[5], + rad_to_deg(atan(field[5]/pow(field[3]*field[3]+field[4]*field[4],0.5))),var); +exit(0); +} + + + diff --git a/simgear/math/Makefile.am b/simgear/math/Makefile.am index 765e64e8..4e016998 100644 --- a/simgear/math/Makefile.am +++ b/simgear/math/Makefile.am @@ -29,5 +29,4 @@ libsgmath_a_SOURCES = \ polar3d.cxx \ vector.cxx -# INCLUDES += -I$(top_builddir)/src $(ZLIB_INCL) -INCLUDES += $(ZLIB_INCL) +INCLUDES += -I$(top_builddir) $(ZLIB_INCL) diff --git a/simgear/metar/Makefile.am b/simgear/metar/Makefile.am index c0457eb1..cbe88c79 100644 --- a/simgear/metar/Makefile.am +++ b/simgear/metar/Makefile.am @@ -9,4 +9,4 @@ libsgmetar_a_SOURCES = \ MetarStation.cpp MetarStation.h \ Prtdmetr.cpp Stspack2.cpp Stspack3.cpp -# INCLUDES += -I$(top_builddir) +INCLUDES += -I$(top_builddir) diff --git a/simgear/misc/Makefile.am b/simgear/misc/Makefile.am index 8c0d900c..ee556730 100644 --- a/simgear/misc/Makefile.am +++ b/simgear/misc/Makefile.am @@ -23,5 +23,4 @@ libsgmisc_a_SOURCES = \ texcoord.cxx \ zfstream.cxx -# INCLUDES += -I$(top_builddir)/src $(ZLIB_INCL) -INCLUDES += $(ZLIB_INCL) +INCLUDES += -I$(top_builddir) $(ZLIB_INCL) diff --git a/simgear/screen/Makefile.am b/simgear/screen/Makefile.am index 9bd749b1..f645ccfd 100644 --- a/simgear/screen/Makefile.am +++ b/simgear/screen/Makefile.am @@ -9,4 +9,4 @@ libsgscreen_a_SOURCES = \ screen-dump.cxx \ win32-printer.h -# INCLUDES += -I$(top_builddir)/src +INCLUDES += -I$(top_builddir) diff --git a/simgear/serial/Makefile.am b/simgear/serial/Makefile.am index 177dc6c4..05975bc2 100644 --- a/simgear/serial/Makefile.am +++ b/simgear/serial/Makefile.am @@ -14,4 +14,4 @@ testserial_LDADD = \ $(top_builddir)/simgear/serial/libsgserial.a \ $(top_builddir)/simgear/debug/libsgdebug.a -# INCLUDES += -I$(top_builddir)/simgear +INCLUDES += -I$(top_builddir) diff --git a/simgear/version.h b/simgear/version.h new file mode 100644 index 00000000..902fd30e --- /dev/null +++ b/simgear/version.h @@ -0,0 +1,31 @@ +// version.h -- SimGear version +// +// Written by Curtis Olson, started February 2000. +// +// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ + + +#ifndef _SIMGEAR_VERSION_H +#define _SIMGEAR_VERSION_H + + +#define SIMGEAR_VERSION 0.0.6 + + +#endif // _SIMGEAR_VERSION_H diff --git a/simgear/version.h.in b/simgear/version.h.in new file mode 100644 index 00000000..359f341c --- /dev/null +++ b/simgear/version.h.in @@ -0,0 +1,31 @@ +// version.h -- SimGear version +// +// Written by Curtis Olson, started February 2000. +// +// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ + + +#ifndef _SIMGEAR_VERSION_H +#define _SIMGEAR_VERSION_H + + +#define SIMGEAR_VERSION @VERSION@ + + +#endif // _SIMGEAR_VERSION_H diff --git a/simgear/xgl/Makefile.am b/simgear/xgl/Makefile.am index f0a2dda0..3b976153 100644 --- a/simgear/xgl/Makefile.am +++ b/simgear/xgl/Makefile.am @@ -6,4 +6,4 @@ include_HEADERS = xgl.h libsgxgl_a_SOURCES = xgl.c xglUtils.c -# INCLUDES += -I$(top_builddir) +INCLUDES += -I$(top_builddir)