From: curt Date: Tue, 15 May 2001 19:26:22 +0000 (+0000) Subject: Attempt to resolve ambiguity between #include for simgear vs. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e2b4c0787a4398199ef2d35e05963acd58b7a04c;p=simgear.git Attempt to resolve ambiguity between #include for simgear vs. flightgear, especially when this occurs in a simgear .hxx file. This is now expressly forbidden, and will cause problems anyways because we now changed the name to which isn't installed, so you can't include it in an installed header file. --- diff --git a/configure.in b/configure.in index df240e4a..ab539c21 100644 --- a/configure.in +++ b/configure.in @@ -286,7 +286,7 @@ 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/config.h) +AM_CONFIG_HEADER(simgear/simgear_config.h) AC_OUTPUT( \ Makefile \ diff --git a/simgear/bucket/newbucket.cxx b/simgear/bucket/newbucket.cxx index f3c0bee0..08ec934a 100644 --- a/simgear/bucket/newbucket.cxx +++ b/simgear/bucket/newbucket.cxx @@ -24,11 +24,6 @@ **************************************************************************/ -#ifdef HAVE_CONFIG_H -# include -#endif - - #include #include diff --git a/simgear/constants.h b/simgear/constants.h index da6986e0..f0a09435 100644 --- a/simgear/constants.h +++ b/simgear/constants.h @@ -30,10 +30,6 @@ #define _SG_CONSTANTS_H -#ifdef HAVE_CONFIG_H -# include -#endif - #include #ifdef SG_HAVE_STD_INCLUDES diff --git a/simgear/debug/logstream.hxx b/simgear/debug/logstream.hxx index 63d3ed10..6d89620f 100644 --- a/simgear/debug/logstream.hxx +++ b/simgear/debug/logstream.hxx @@ -26,10 +26,6 @@ #ifndef _LOGSTREAM_H #define _LOGSTREAM_H -#ifdef HAVE_CONFIG_H -# include -#endif - #include // At least Irix needs this diff --git a/simgear/ephemeris/ephemeris.hxx b/simgear/ephemeris/ephemeris.hxx index cb677c3b..46029601 100644 --- a/simgear/ephemeris/ephemeris.hxx +++ b/simgear/ephemeris/ephemeris.hxx @@ -31,10 +31,6 @@ #define _EPHEMERIS_HXX -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/simgear/io/lowtest.cxx b/simgear/io/lowtest.cxx index a808915c..e588f2c3 100644 --- a/simgear/io/lowtest.cxx +++ b/simgear/io/lowtest.cxx @@ -1,7 +1,3 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - #include #include STL_IOSTREAM diff --git a/simgear/io/sg_binobj.cxx b/simgear/io/sg_binobj.cxx index 54ffe7dd..474a2f21 100644 --- a/simgear/io/sg_binobj.cxx +++ b/simgear/io/sg_binobj.cxx @@ -22,10 +22,6 @@ // -#ifdef HAVE_CONFIG_H -#include -#endif - #include #include diff --git a/simgear/io/sg_binobj.hxx b/simgear/io/sg_binobj.hxx index 5809cf08..9ba98970 100644 --- a/simgear/io/sg_binobj.hxx +++ b/simgear/io/sg_binobj.hxx @@ -28,10 +28,6 @@ #define _SG_BINOBJ_HXX -#ifdef HAVE_CONFIG_H -#include -#endif - #include #include diff --git a/simgear/magvar/magvar.cxx b/simgear/magvar/magvar.cxx index 41dca19b..4a78ce34 100644 --- a/simgear/magvar/magvar.cxx +++ b/simgear/magvar/magvar.cxx @@ -21,10 +21,6 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/simgear/magvar/magvar.hxx b/simgear/magvar/magvar.hxx index 4180c961..6e46dd24 100644 --- a/simgear/magvar/magvar.hxx +++ b/simgear/magvar/magvar.hxx @@ -33,10 +33,6 @@ #endif -#ifdef HAVE_CONFIG_H -# include -#endif - /** * Magnetic variation wrapper class. * diff --git a/simgear/math/sg_random.c b/simgear/math/sg_random.c index 31297e19..2e9ceb9c 100644 --- a/simgear/math/sg_random.c +++ b/simgear/math/sg_random.c @@ -22,10 +22,6 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include // for random(), srandom() #include // for time() to seed srandom() diff --git a/simgear/math/vector.hxx b/simgear/math/vector.hxx index 75893c18..872643a6 100644 --- a/simgear/math/vector.hxx +++ b/simgear/math/vector.hxx @@ -33,10 +33,6 @@ # error This library requires C++ #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/simgear/metar/Antoi.cpp b/simgear/metar/Antoi.cpp index fabb31c2..783548e5 100644 --- a/simgear/metar/Antoi.cpp +++ b/simgear/metar/Antoi.cpp @@ -37,10 +37,6 @@ /* */ /********************************************************************/ -#ifdef HAVE_CONFIG_H -# include -#endif - #ifdef HAVE_STDINT_H # include #endif diff --git a/simgear/misc/props.cxx b/simgear/misc/props.cxx index 1fbfb311..42ce347d 100644 --- a/simgear/misc/props.cxx +++ b/simgear/misc/props.cxx @@ -6,10 +6,6 @@ // // $Id$ -#ifdef HAVE_CONFIG_H -#include -#endif - #include #include diff --git a/simgear/misc/props.hxx b/simgear/misc/props.hxx index ad9e9e01..b95c5296 100644 --- a/simgear/misc/props.hxx +++ b/simgear/misc/props.hxx @@ -12,10 +12,6 @@ #ifndef __PROPS_HXX #define __PROPS_HXX -#ifdef HAVE_CONFIG_H -#include -#endif - #include #include diff --git a/simgear/misc/props_io.cxx b/simgear/misc/props_io.cxx index d88376e8..d7be4950 100644 --- a/simgear/misc/props_io.cxx +++ b/simgear/misc/props_io.cxx @@ -1,8 +1,4 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include // atof() atoi() diff --git a/simgear/misc/props_test.cxx b/simgear/misc/props_test.cxx index 3ee2552d..17f82c7e 100644 --- a/simgear/misc/props_test.cxx +++ b/simgear/misc/props_test.cxx @@ -3,10 +3,6 @@ // Test harness. //////////////////////////////////////////////////////////////////////// -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include STL_IOSTREAM diff --git a/simgear/misc/sg_path.hxx b/simgear/misc/sg_path.hxx index 8fd5c3ec..3bc67224 100644 --- a/simgear/misc/sg_path.hxx +++ b/simgear/misc/sg_path.hxx @@ -30,10 +30,6 @@ #define _SG_PATH_HXX -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include STL_STRING diff --git a/simgear/misc/sgstream.hxx b/simgear/misc/sgstream.hxx index 7473ee87..373ebc79 100644 --- a/simgear/misc/sgstream.hxx +++ b/simgear/misc/sgstream.hxx @@ -32,10 +32,6 @@ # error This library requires C++ #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #if defined( SG_HAVE_STD_INCLUDES ) diff --git a/simgear/misc/strutils.cxx b/simgear/misc/strutils.cxx index a08f19c8..2e7afbeb 100644 --- a/simgear/misc/strutils.cxx +++ b/simgear/misc/strutils.cxx @@ -21,10 +21,6 @@ // // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "strutils.hxx" const string whitespace = " \n\r\t"; diff --git a/simgear/misc/zfstream.hxx b/simgear/misc/zfstream.hxx index cfd7731a..1dd3669e 100644 --- a/simgear/misc/zfstream.hxx +++ b/simgear/misc/zfstream.hxx @@ -28,10 +28,6 @@ #ifndef _zfstream_hxx #define _zfstream_hxx -#ifdef HAVE_CONFIG_H -# include -#endif - #include #ifdef HAVE_ZLIB diff --git a/simgear/route/route.hxx b/simgear/route/route.hxx index 326ca883..cffeffd7 100644 --- a/simgear/route/route.hxx +++ b/simgear/route/route.hxx @@ -33,10 +33,6 @@ #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include STL_STRING diff --git a/simgear/route/waypoint.hxx b/simgear/route/waypoint.hxx index a02b6e31..aa6d8ed4 100644 --- a/simgear/route/waypoint.hxx +++ b/simgear/route/waypoint.hxx @@ -33,10 +33,6 @@ #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include STL_STRING diff --git a/simgear/screen/GLBitmaps.cxx b/simgear/screen/GLBitmaps.cxx index 0edadf41..0e9544ce 100755 --- a/simgear/screen/GLBitmaps.cxx +++ b/simgear/screen/GLBitmaps.cxx @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -# include +# include #endif #ifdef HAVE_WINDOWS_H diff --git a/simgear/screen/screen-dump.cxx b/simgear/screen/screen-dump.cxx index 8a9da20f..47a40f22 100644 --- a/simgear/screen/screen-dump.cxx +++ b/simgear/screen/screen-dump.cxx @@ -21,7 +21,7 @@ #ifdef HAVE_CONFIG_H -# include +# include #endif #ifdef HAVE_WINDOWS_H diff --git a/simgear/serial/serial.cxx b/simgear/serial/serial.cxx index 2c707b18..3fa85bdc 100644 --- a/simgear/serial/serial.cxx +++ b/simgear/serial/serial.cxx @@ -22,10 +22,6 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #ifdef SG_HAVE_STD_INCLUDE diff --git a/simgear/serial/serial.hxx b/simgear/serial/serial.hxx index 7534372c..e98c3163 100644 --- a/simgear/serial/serial.hxx +++ b/simgear/serial/serial.hxx @@ -33,10 +33,6 @@ # error This library requires C++ #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ ) # include #endif diff --git a/simgear/sky/cloud.cxx b/simgear/sky/cloud.cxx index 31997dd6..8a69e315 100644 --- a/simgear/sky/cloud.cxx +++ b/simgear/sky/cloud.cxx @@ -16,10 +16,6 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/simgear/sky/cloud.hxx b/simgear/sky/cloud.hxx index ee1b12f2..5f7258e7 100644 --- a/simgear/sky/cloud.hxx +++ b/simgear/sky/cloud.hxx @@ -25,10 +25,6 @@ #ifndef _SG_CLOUD_HXX_ #define _SG_CLOUD_HXX_ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/simgear/sky/dome.cxx b/simgear/sky/dome.cxx index 98961fac..22897294 100644 --- a/simgear/sky/dome.cxx +++ b/simgear/sky/dome.cxx @@ -24,7 +24,7 @@ #ifdef HAVE_CONFIG_H -# include +# include #endif #ifdef HAVE_WINDOWS_H diff --git a/simgear/sky/moon.cxx b/simgear/sky/moon.cxx index 513cdf4f..00ce42a4 100644 --- a/simgear/sky/moon.cxx +++ b/simgear/sky/moon.cxx @@ -25,10 +25,6 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/simgear/sky/oursun.cxx b/simgear/sky/oursun.cxx index 6dffc90c..e423db02 100644 --- a/simgear/sky/oursun.cxx +++ b/simgear/sky/oursun.cxx @@ -25,10 +25,6 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/simgear/sky/sky.cxx b/simgear/sky/sky.cxx index fee1b601..69bd8b28 100644 --- a/simgear/sky/sky.cxx +++ b/simgear/sky/sky.cxx @@ -23,10 +23,6 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/simgear/sky/sphere.cxx b/simgear/sky/sphere.cxx index 877489fc..428d966b 100644 --- a/simgear/sky/sphere.cxx +++ b/simgear/sky/sphere.cxx @@ -23,10 +23,6 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include STL_IOSTREAM diff --git a/simgear/sky/stars.cxx b/simgear/sky/stars.cxx index b2bf7c00..3ee2ce31 100644 --- a/simgear/sky/stars.cxx +++ b/simgear/sky/stars.cxx @@ -25,10 +25,6 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/simgear/threads/SGThread.cxx b/simgear/threads/SGThread.cxx index b3bb8ab2..ac3ee933 100644 --- a/simgear/threads/SGThread.cxx +++ b/simgear/threads/SGThread.cxx @@ -1,7 +1,3 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/simgear/timing/Makefile.am b/simgear/timing/Makefile.am index ffe602fe..c90b9367 100644 --- a/simgear/timing/Makefile.am +++ b/simgear/timing/Makefile.am @@ -13,6 +13,7 @@ libsgtiming_a_SOURCES = \ geocoord.cxx \ lowleveltime.cxx \ sg_time.cxx \ + timestamp.cxx \ timezone.cxx INCLUDES += -I$(top_srcdir) diff --git a/simgear/timing/sg_time.cxx b/simgear/timing/sg_time.cxx index 91a2d8ef..2db16af8 100644 --- a/simgear/timing/sg_time.cxx +++ b/simgear/timing/sg_time.cxx @@ -22,10 +22,6 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include // for errno diff --git a/simgear/timing/sg_time.hxx b/simgear/timing/sg_time.hxx index 6d617db7..8997ffa0 100644 --- a/simgear/timing/sg_time.hxx +++ b/simgear/timing/sg_time.hxx @@ -34,10 +34,6 @@ #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #ifdef SG_HAVE_STD_INCLUDES diff --git a/simgear/timing/timestamp.cxx b/simgear/timing/timestamp.cxx new file mode 100644 index 00000000..7c8cffa9 --- /dev/null +++ b/simgear/timing/timestamp.cxx @@ -0,0 +1,124 @@ +/** + * \file timestamp.cxx + * Provides a class for managing a timestamp (seconds & milliseconds.) + */ + +// Written by Curtis Olson, started December 1998. +// +// Copyright (C) 1998 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$ + + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_WINDOWS_H +# include +#endif + +#include + +#ifdef SG_HAVE_STD_INCLUDES +# include +#else +# include +#endif + +#ifdef HAVE_SYS_TIMEB_H +# include // for ftime() and struct timeb +#endif +#ifdef HAVE_UNISTD_H +# include // for gettimeofday() +#endif +#ifdef HAVE_SYS_TIME_H +# include // for get/setitimer, gettimeofday, struct timeval +#endif + +// -dw- want to use metrowerks time.h +#ifdef macintosh +# include +# include +#endif + +#ifdef WIN32 +# include +# if defined( __CYGWIN__ ) || defined( __CYGWIN32__ ) +# define NEAR /* */ +# define FAR /* */ +# endif +# include +#endif + +#include "timestamp.hxx" + + +void SGTimeStamp::stamp() { +#if defined( WIN32 ) + unsigned int t; + t = timeGetTime(); + seconds = 0; + usec = t * 1000; +#elif defined( HAVE_GETTIMEOFDAY ) + struct timeval current; + struct timezone tz; + // sg_timestamp currtime; + gettimeofday(¤t, &tz); + seconds = current.tv_sec; + usec = current.tv_usec; +#elif defined( HAVE_GETLOCALTIME ) + SYSTEMTIME current; + GetLocalTime(¤t); + seconds = current.wSecond; + usec = current.wMilliseconds * 1000; +#elif defined( HAVE_FTIME ) + struct timeb current; + ftime(¤t); + seconds = current.time; + usec = current.millitm * 1000; +// -dw- uses time manager +#elif defined( macintosh ) + UnsignedWide ms; + Microseconds(&ms); + + seconds = ms.lo / 1000000; + usec = ms.lo - ( seconds * 1000000 ); +#else +# error Port me +#endif +} + +// increment the time stamp by the number of microseconds (usec) +SGTimeStamp operator + (const SGTimeStamp& t, const long& m) { +#ifdef WIN32 + return SGTimeStamp( 0, t.usec + m ); +#else + return SGTimeStamp( t.seconds + ( t.usec + m ) / 1000000, + ( t.usec + m ) % 1000000 ); +#endif +} + +// difference between time stamps in microseconds (usec) +long operator - (const SGTimeStamp& a, const SGTimeStamp& b) +{ +#if defined( WIN32 ) + return a.usec - b.usec; +#else + return 1000000 * (a.seconds - b.seconds) + (a.usec - b.usec); +#endif +} diff --git a/simgear/timing/timestamp.hxx b/simgear/timing/timestamp.hxx index 82aa0be0..3a31ba58 100644 --- a/simgear/timing/timestamp.hxx +++ b/simgear/timing/timestamp.hxx @@ -33,46 +33,8 @@ #endif -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef HAVE_WINDOWS_H -# include -#endif - #include -#ifdef SG_HAVE_STD_INCLUDES -# include -#else -# include -#endif - -#ifdef HAVE_SYS_TIMEB_H -# include // for ftime() and struct timeb -#endif -#ifdef HAVE_UNISTD_H -# include // for gettimeofday() -#endif -#ifdef HAVE_SYS_TIME_H -# include // for get/setitimer, gettimeofday, struct timeval -#endif - -// -dw- want to use metrowerks time.h -#ifdef macintosh -# include -# include -#endif - -#ifdef WIN32 -# include -# if defined( __CYGWIN__ ) || defined( __CYGWIN32__ ) -# define NEAR /* */ -# define FAR /* */ -# endif -# include -#endif // MSVC++ 6.0 kuldge - Need forward declaration of friends. class SGTimeStamp; @@ -158,61 +120,6 @@ inline SGTimeStamp& SGTimeStamp::operator = (const SGTimeStamp& t) return *this; } -inline void SGTimeStamp::stamp() { -#if defined( WIN32 ) - unsigned int t; - t = timeGetTime(); - seconds = 0; - usec = t * 1000; -#elif defined( HAVE_GETTIMEOFDAY ) - struct timeval current; - struct timezone tz; - // sg_timestamp currtime; - gettimeofday(¤t, &tz); - seconds = current.tv_sec; - usec = current.tv_usec; -#elif defined( HAVE_GETLOCALTIME ) - SYSTEMTIME current; - GetLocalTime(¤t); - seconds = current.wSecond; - usec = current.wMilliseconds * 1000; -#elif defined( HAVE_FTIME ) - struct timeb current; - ftime(¤t); - seconds = current.time; - usec = current.millitm * 1000; -// -dw- uses time manager -#elif defined( macintosh ) - UnsignedWide ms; - Microseconds(&ms); - - seconds = ms.lo / 1000000; - usec = ms.lo - ( seconds * 1000000 ); -#else -# error Port me -#endif -} - -// increment the time stamp by the number of microseconds (usec) -inline SGTimeStamp operator + (const SGTimeStamp& t, const long& m) { -#ifdef WIN32 - return SGTimeStamp( 0, t.usec + m ); -#else - return SGTimeStamp( t.seconds + ( t.usec + m ) / 1000000, - ( t.usec + m ) % 1000000 ); -#endif -} - -// difference between time stamps in microseconds (usec) -inline long operator - (const SGTimeStamp& a, const SGTimeStamp& b) -{ -#if defined( WIN32 ) - return a.usec - b.usec; -#else - return 1000000 * (a.seconds - b.seconds) + (a.usec - b.usec); -#endif -} - #endif // _TIMESTAMP_HXX diff --git a/simgear/xgl/xgl.c b/simgear/xgl/xgl.c index 65380524..a3db64bb 100644 --- a/simgear/xgl/xgl.c +++ b/simgear/xgl/xgl.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -# include +# include #endif #ifdef HAVE_WINDOWS_H diff --git a/simgear/xgl/xgl.h b/simgear/xgl/xgl.h index 434ab09d..366cf479 100644 --- a/simgear/xgl/xgl.h +++ b/simgear/xgl/xgl.h @@ -2,6 +2,10 @@ #define _XGL_H +#ifdef HAVE_CONFIG_H +# include +#endif + #ifdef HAVE_WINDOWS_H # include #endif diff --git a/simgear/xgl/xglUtils.c b/simgear/xgl/xglUtils.c index d781fa23..073a286d 100644 --- a/simgear/xgl/xglUtils.c +++ b/simgear/xgl/xglUtils.c @@ -1,8 +1,4 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include diff --git a/simgear/xml/easyxml.cxx b/simgear/xml/easyxml.cxx index ab97d218..a7aea3da 100644 --- a/simgear/xml/easyxml.cxx +++ b/simgear/xml/easyxml.cxx @@ -1,9 +1,5 @@ // easyxml.cxx - implementation of EasyXML interfaces. -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include // strcmp() diff --git a/simgear/xml/easyxml.hxx b/simgear/xml/easyxml.hxx index 1eee84eb..dc7297be 100644 --- a/simgear/xml/easyxml.hxx +++ b/simgear/xml/easyxml.hxx @@ -8,10 +8,6 @@ #ifndef __EASYXML_HXX #define __EASYXML_HXX -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include STL_IOSTREAM