1
0
Fork 0

Merge Include as subdirectory

This commit is contained in:
Tim Moore 2009-09-14 13:47:00 +02:00
commit 5d9bf14ba6
13 changed files with 1606 additions and 0 deletions

14
Include/Makefile.am Normal file
View file

@ -0,0 +1,14 @@
EXTRA_DIST = \
auto_ptr.hxx \
config.h.in \
cmdargs.h \
compiler.h \
fg_callback.hxx \
fg_constants.h \
fg_memory.h \
fg_traits.hxx \
fg_typedefs.h \
fg_stl_config.h \
fg_zlib.h \
general.hxx \
keys.h

121
Include/auto_ptr.hxx Normal file
View file

@ -0,0 +1,121 @@
/**************************************************************************
* auto_ptr.hxx -- A simple auto_ptr definition.
*
* 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$
* (Log is kept at end of this file)
**************************************************************************/
#ifndef _AUTO_PTR_HXX
#define _AUTO_PTR_HXX
#include "fg_stl_config.h"
//-----------------------------------------------------------------------------
//
// auto_ptr is initialised with a pointer obtained via new and deletes that
// object when it itself is destroyed (such as when leaving block scope).
// auto_ptr can be used in any way that a normal pointer can be.
//
// This class is only required when the STL doesn't supply one.
//
template <class X> class auto_ptr {
private:
X* ptr;
mutable bool owns;
public:
typedef X element_type;
explicit auto_ptr(X* p = 0) : ptr(p), owns(p) {}
auto_ptr(const auto_ptr& a) : ptr(a.ptr), owns(a.owns) {
a.owns = 0;
}
#ifdef _FG_MEMBER_TEMPLATES
template <class T> auto_ptr(const auto_ptr<T>& a)
: ptr(a.ptr), owns(a.owns) {
a.owns = 0;
}
#endif
auto_ptr& operator = (const auto_ptr& a) {
if (&a != this) {
if (owns)
delete ptr;
owns = a.owns;
ptr = a.ptr;
a.owns = 0;
}
}
#ifdef _FG_MEMBER_TEMPLATES
template <class T> auto_ptr& operator = (const auto_ptr<T>& a) {
if (&a != this) {
if (owns)
delete ptr;
owns = a.owns;
ptr = a.ptr;
a.owns = 0;
}
}
#endif
~auto_ptr() {
if (owns)
delete ptr;
}
X& operator*() const { return *ptr; }
X* operator->() const { return ptr; }
X* get() const { return ptr; }
X* release() const { owns = false; return ptr; }
};
#endif /* _AUTO_PTR_HXX */
// $Log$
// Revision 1.2 1998/09/10 19:07:03 curt
// /Simulator/Objects/fragment.hxx
// Nested fgFACE inside fgFRAGMENT since its not used anywhere else.
//
// ./Simulator/Objects/material.cxx
// ./Simulator/Objects/material.hxx
// Made fgMATERIAL and fgMATERIAL_MGR bona fide classes with private
// data members - that should keep the rabble happy :)
//
// ./Simulator/Scenery/tilemgr.cxx
// In viewable() delay evaluation of eye[0] and eye[1] in until they're
// actually needed.
// Change to fgTileMgrRender() to call fgMATERIAL_MGR::render_fragments()
// method.
//
// ./Include/fg_stl_config.h
// ./Include/auto_ptr.hxx
// Added support for g++ 2.7.
// Further changes to other files are forthcoming.
//
// Brief summary of changes required for g++ 2.7.
// operator->() not supported by iterators: use (*i).x instead of i->x
// default template arguments not supported,
// <functional> doesn't have mem_fun_ref() needed by callbacks.
// some std include files have different names.
// template member functions not supported.
//
// Revision 1.1 1998/08/30 14:12:45 curt
// Initial revision. Contributed by Bernie Bright.
//

50
Include/cmdargs.h Normal file
View file

@ -0,0 +1,50 @@
//
// CMDLINE Argument External Definitions. A hack to make command line
// argument values visible to affected program locations.
//
// When implementing this feature my design intent was that program
// options should be set according to the following rules of
// option hierarchy.
//
// 1. Command line options have top priority.
// 2. Environmental options over ride default options.
// 3. All options must have a meaningful state. On a given platform,
// some option setting is most likely to be desired by that community.
//
// CHotchkiss 10 Feb 98
//
// $Id$
// (Log is kept at end of this file)
#ifndef _CMDARGS_H
#define _CMDARGS_H
// buffers here are all MAXPATH in length. IS THIS DEFINE UNIVERSAL?
extern char acArgbuf[];
extern int debugArgValue;
extern int priorityArgValue;
extern char rootArgbuf[];
extern int viewArg;
extern char logArgbuf[];
// These are used by initialization and RE initialization routines
// (none right now) to set up for running (or from warm reset.)
extern const char *DefaultRootDir;
extern const char *DefaultAircraft;
extern const char *DefaultDebuglog;
extern const int DefaultViewMode;
#endif
// end of cmdargs.h
// $Log$
// Revision 1.2 1998/02/16 16:17:36 curt
// Minor tweaks.
//
// Revision 1.1 1998/02/13 00:18:46 curt
// Initial revision.
//

365
Include/compiler.h Normal file
View file

@ -0,0 +1,365 @@
/**************************************************************************
* 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$
* (Log is kept at end of this file)
**************************************************************************/
#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 <streambuf> of <streambuf.h> are present.
// (16) Define FG_MATH_EXCEPTION_CLASH if math.h defines an exception class
// that clashes with the one defined in <stdexcept>.
#ifdef __GNUC__
# if __GNUC__ == 2
# if __GNUC_MINOR__ < 8
// g++-2.7.x
# define STL_ALGORITHM <algorithm>
# define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip.h>
# define STL_IOSTREAM <iostream.h>
# define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string>
# define STL_STRSTREAM <strstream.h>
# 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 <algorithm>
# define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip>
# define STL_IOSTREAM <iostream>
# define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string>
# define STL_STRSTREAM <strstream>
# endif
# else
# error Time to upgrade. GNU compilers < 2.7 not supported
# endif
#endif
//
// Metrowerks
//
#if defined(__MWERKS__)
/*
CodeWarrior compiler from Metrowerks, Inc.
*/
# if (__MWERKS__ < 0x0900) //|| macintosh
# define FG_HAVE_TRAITS
# define FG_HAVE_STD_INCLUDES
# define FG_HAVE_STD
# define FG_NAMESPACES
# define STL_ALGORITHM <algorithm>
# define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip>
# define STL_IOSTREAM <iostream>
# define STL_STDEXCEPT <stdexcept>
# define STL_STRING <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)
# elif (__MWERKS__ >= 0x0900) && __INTEL__
# error still to be supported...
# else
# error unknown Metrowerks compiler
# endif
#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 <algorithm>
# define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip>
# define STL_IOSTREAM <iostream>
# define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string>
# define STL_STRSTREAM <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 <algorithm>
# define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip>
# define STL_IOSTREAM <iostream>
# define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string>
# define STL_STRSTREAM <strstream>
# define FG_INCOMPLETE_FUNCTIONAL
# endif // HAVE_SGI_STL_PORT
# 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 <algorithm>
# define STL_FUNCTIONAL <functional>
# define STL_IOMANIP <iomanip>
# define STL_IOSTREAM <iostream.h>
# define STL_STDEXCEPT <stdexcept>
# define STL_STRING <string>
# define STL_STRSTREAM <strstream>
#endif // Native SGI compilers
#if defined ( sun )
# include <memory.h>
# 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 <functional> implementation from SGI STL 3.11
// Adapter function objects: pointers to member functions
#ifdef FG_INCOMPLETE_FUNCTIONAL
template <class _Ret, class _Tp>
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 <class _Ret, class _Tp>
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
// $Log$
// Revision 1.9 1999/03/02 00:36:31 curt
// Tweaks for native SGI compilers.
//
// Revision 1.8 1999/02/26 22:07:10 curt
// Added initial support for native SGI compilers.
//
// Revision 1.7 1999/02/05 21:27:41 curt
// Tweaks for the solaris platform.
//
// Revision 1.6 1999/01/27 04:45:17 curt
// Tweak for solaris.
//
// Revision 1.5 1999/01/19 20:41:25 curt
// Added support for MacOS (Metrowerks)
//
// Revision 1.4 1999/01/06 21:47:37 curt
// renamed general.h to general.hxx
// More portability enhancements to compiler.h
//
// Revision 1.3 1998/11/06 14:04:09 curt
// More portability improvements by Bernie Bright.
//
// Revision 1.2 1998/11/02 18:28:08 curt
// Portability updates from Bernie Bright
//
// Revision 1.1 1998/10/16 00:49:04 curt
// fg_stl_config.h -> compiler.h, fg_stl_config.h maintained for backwards
// compatibility.
//
// Revision 1.3 1998/09/29 02:00:16 curt
// Start of some borland c support
//
// Revision 1.2 1998/09/10 19:07:04 curt
// /Simulator/Objects/fragment.hxx
// Nested fgFACE inside fgFRAGMENT since its not used anywhere else.
//
// ./Simulator/Objects/material.cxx
// ./Simulator/Objects/material.hxx
// Made fgMATERIAL and fgMATERIAL_MGR bona fide classes with private
// data members - that should keep the rabble happy :)
//
// ./Simulator/Scenery/tilemgr.cxx
// In viewable() delay evaluation of eye[0] and eye[1] in until they're
// actually needed.
// Change to fgTileMgrRender() to call fgMATERIAL_MGR::render_fragments()
// method.
//
// ./Include/fg_stl_config.h
// ./Include/auto_ptr.hxx
// Added support for g++ 2.7.
// Further changes to other files are forthcoming.
//
// Brief summary of changes required for g++ 2.7.
// operator->() not supported by iterators: use (*i).x instead of i->x
// default template arguments not supported,
// <functional> doesn't have mem_fun_ref() needed by callbacks.
// some std include files have different names.
// template member functions not supported.
//
// Revision 1.1 1998/08/30 14:13:49 curt
// Initial revision. Contributed by Bernie Bright.
//

197
Include/config.h.in Normal file
View file

@ -0,0 +1,197 @@
/* 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. */
#undef HAVE_VPRINTF
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define if your <sys/time.h> 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 if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define to package name */
#undef PACKAGE
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define to version number */
#undef VERSION
/* 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. */
#undef HAVE_BCOPY
/* Define if you have the ftime function. */
#undef HAVE_FTIME
/* Define if you have the getitimer function. */
#undef HAVE_GETITIMER
/* Define if you have the getrusage function. */
#undef HAVE_GETRUSAGE
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the memcpy function. */
#undef HAVE_MEMCPY
/* Define if you have the mktime function. */
#undef HAVE_MKTIME
/* Define if you have the rand function. */
#undef HAVE_RAND
/* Define if you have the random function. */
#undef HAVE_RANDOM
/* Define if you have the rint function. */
#undef HAVE_RINT
/* Define if you have the setitimer function. */
#undef HAVE_SETITIMER
/* Define if you have the signal function. */
#undef HAVE_SIGNAL
/* Define if you have the strstr function. */
#undef HAVE_STRSTR
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define if you have the <gfc/gdbf.h> header file. */
#undef HAVE_GFC_GDBF_H
/* Define if you have the <gpc.h> header file. */
#undef HAVE_GPC_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/timeb.h> header file. */
#undef HAVE_SYS_TIMEB_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <values.h> header file. */
#undef HAVE_VALUES_H
/* Define if you have the <winbase.h> header file. */
#undef HAVE_WINBASE_H
/* Define if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
/* Define if you have the GL library (-lGL). */
#undef HAVE_LIBGL
/* 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). */
#undef HAVE_LIBICE
/* Define if you have the MesaGL library (-lMesaGL). */
#undef HAVE_LIBMESAGL
/* Define if you have the MesaGLU library (-lMesaGLU). */
#undef HAVE_LIBMESAGLU
/* Define if you have the SM library (-lSM). */
#undef HAVE_LIBSM
/* Define if you have the X11 library (-lX11). */
#undef HAVE_LIBX11
/* Define if you have the Xext library (-lXext). */
#undef HAVE_LIBXEXT
/* Define if you have the Xi library (-lXi). */
#undef HAVE_LIBXI
/* Define if you have the Xmu library (-lXmu). */
#undef HAVE_LIBXMU
/* Define if you have the Xt library (-lXt). */
#undef HAVE_LIBXT
/* Define if you have the glut library (-lglut). */
#undef HAVE_LIBGLUT
/* Define if you have the m library (-lm). */
#undef HAVE_LIBM
/* Define if you have the socket library (-lsocket). */
#undef HAVE_LIBSOCKET

195
Include/fg_callback.hxx Normal file
View file

@ -0,0 +1,195 @@
/**************************************************************************
* fg_callback.hxx -- Wrapper classes to treat function and method pointers
* as objects.
*
* 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$
* (Log is kept at end of this file)
**************************************************************************/
#ifndef _FG_CALLBACK_HXX
#define _FG_CALLBACK_HXX
//-----------------------------------------------------------------------------
//
// Abstract base class for all FlightGear callbacks.
//
class fgCallback
{
public:
virtual ~fgCallback() {}
virtual fgCallback* clone() const = 0;
virtual void* call( void** ) = 0;
size_t params() const { return n_params; }
protected:
fgCallback( size_t params )
: n_params(params) {}
protected:
// The number of parameters to pass to the callback routine.
size_t n_params;
private:
};
//-----------------------------------------------------------------------------
//
// Callback for invoking a file scope function.
//
class fgFunctionCallback : public fgCallback
{
public:
// Pointer to function taking no arguments and returning void.
typedef void (*Proc0v)();
// A callback instance to invoke the function 'p'
fgFunctionCallback( Proc0v p );
// Create a clone on the heap.
virtual fgCallback* clone() const;
private:
void* call( void** in );
inline void* call0v( void** );
private:
// Not defined.
fgFunctionCallback();
private:
typedef void* (fgFunctionCallback::*DoPtr)( void** );
DoPtr doPtr;
Proc0v proc0v;
};
inline
fgFunctionCallback::fgFunctionCallback( Proc0v p )
: fgCallback(0),
doPtr(&fgFunctionCallback::call0v),
proc0v(p)
{
// empty
}
inline fgCallback*
fgFunctionCallback::clone() const
{
return new fgFunctionCallback( *this );
}
inline void*
fgFunctionCallback::call( void** in )
{
return (this->*doPtr)( in );
}
inline void*
fgFunctionCallback::call0v( void** )
{
(*proc0v)();
return (void*) NULL;
}
//-----------------------------------------------------------------------------
//
// Callback for invoking an object method.
//
template< class T >
class fgMethodCallback : public fgCallback
{
public:
// Pointer to method taking no arguments and returning void.
typedef void (T::*Method0v)();
// A callback instance to invoke method 'm' of object 'o'
fgMethodCallback( T* o, Method0v m )
: fgCallback(0),
object(o),
method0v(m),
doPtr(&fgMethodCallback<T>::call0v) {}
// Create a clone on the heap.
fgCallback* clone() const;
private:
//
void* call( void** in );
//
void* call0v( void** );
private:
// Not defined.
fgMethodCallback();
private:
T* object;
Method0v method0v;
typedef void * (fgMethodCallback::*DoPtr)( void ** );
DoPtr doPtr;
};
template< class T > inline fgCallback*
fgMethodCallback<T>::clone() const
{
return new fgMethodCallback( *this );
}
template< class T > inline void*
fgMethodCallback<T>::call( void** in )
{
return (this->*doPtr)( in );
}
template< class T > inline void*
fgMethodCallback<T>::call0v( void** )
{
(object->*method0v)();
return (void*) NULL;
}
#endif // _FG_CALLBACK_HXX
// $Log$
// Revision 1.2 1998/09/15 02:09:04 curt
// Include/fg_callback.hxx
// Moved code inline to stop g++ 2.7 from complaining.
//
// Simulator/Time/event.[ch]xx
// Changed return type of fgEVENT::printStat(). void caused g++ 2.7 to
// complain bitterly.
//
// Minor bugfix and changes.
//
// Simulator/Main/GLUTmain.cxx
// Added missing type to idle_state definition - eliminates a warning.
//
// Simulator/Main/fg_init.cxx
// Changes to airport lookup.
//
// Simulator/Main/options.cxx
// Uses fg_gzifstream when loading config file.
//
// Revision 1.1 1998/08/30 14:13:48 curt
// Initial revision. Contributed by Bernie Bright.
//

262
Include/fg_constants.h Normal file
View file

@ -0,0 +1,262 @@
// fg_constants.h -- various constant definitions
//
// Written by Curtis Olson, started July 1997.
//
// Copyright (C) 1997 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$
// (Log is kept at end of this file)
#ifndef _FG_CONSTANTS_H
#define _FG_CONSTANTS_H
/*
#ifndef __cplusplus
# error This library requires C++
#endif
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Include/compiler.h"
#ifdef FG_MATCH_EXCEPTION_CLASH
# define exception C_exception
#endif
#ifdef FG_HAVE_STD_INCLUDES
# include <cmath>
#else
# include <math.h>
#endif
// This should be defined via autoconf in configure.in
#ifndef VERSION
#define VERSION "\"not defined\""
#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
// Timing constants for Flight Model updates
#define DEFAULT_TIMER_HZ 20
#define DEFAULT_MULTILOOP 6
#define DEFAULT_MODEL_HZ (DEFAULT_TIMER_HZ * DEFAULT_MULTILOOP)
// Field of view limits
#define FG_FOV_MIN 0.1
#define FG_FOV_MAX 179.9
// Maximum nodes per tile
#define MAX_NODES 2000
#endif // _FG_CONSTANTS_H
// $Log$
// Revision 1.13 1999/04/05 02:12:59 curt
// Define maximum nodes for a tile here.
//
// Revision 1.12 1999/03/01 15:33:43 curt
// Truth in advertising.
//
// Revision 1.11 1999/02/01 21:14:10 curt
// Converted to C++ style comments.
//
// Revision 1.10 1999/01/27 04:45:19 curt
// Tweak for solaris.
//
// Revision 1.9 1998/08/24 20:02:35 curt
// Added ONE_SECOND (in radians)
//
// Revision 1.8 1998/07/12 03:07:13 curt
// Added #ifdef HAVE_CONFIG_H ...
//
// Revision 1.7 1998/07/08 14:36:29 curt
// Changed name of EQUATORIAL_RADIUS_KM and RESQ_KM to "M" since they were
// in meters anyways.
//
// Unified fgCartesianPoint3d and fgPolarPoint3d in a single struct called
// fgPoint3d.
//
// Revision 1.6 1998/07/03 14:36:11 curt
// Added conversion constants to fg_constants.h to assist with converting
// between various world units and coordinate systems.
// Added gl vendor/renderer/version info to general structure. Initialized
// in fg_init.cxx
//
// Revision 1.5 1998/05/17 16:56:47 curt
// Re-organized PI related constants.
//
// Revision 1.4 1998/05/16 13:03:10 curt
// Defined field of view max/min limits.
//
// Revision 1.3 1998/04/08 23:35:32 curt
// Tweaks to Gnu automake/autoconf system.
//
// Revision 1.2 1998/03/23 21:18:37 curt
// Made FG_EPSILON smaller.
//
// Revision 1.1 1998/01/27 00:46:50 curt
// prepended "fg_" on the front of these to avoid potential conflicts with
// system include files.
//
// Revision 1.3 1998/01/22 02:59:35 curt
// Changed #ifdef FILE_H to #ifdef _FILE_H
//
// Revision 1.2 1998/01/07 03:31:26 curt
// Miscellaneous tweaks.
//
// Revision 1.1 1997/12/15 21:02:15 curt
// Moved to .../FlightGear/Src/Include/
//
// Revision 1.10 1997/09/13 01:59:45 curt
// Mostly working on stars and generating sidereal time for accurate star
// placement.
//
// Revision 1.9 1997/08/22 21:34:32 curt
// Doing a bit of reorganizing and house cleaning.
//
// Revision 1.8 1997/07/31 22:52:22 curt
// Working on redoing internal coordinate systems & scenery transformations.
//
// Revision 1.7 1997/07/23 21:52:10 curt
// Put comments around the text after an #endif for increased portability.
//
// Revision 1.6 1997/07/21 14:45:01 curt
// Minor tweaks.
//
// Revision 1.5 1997/07/19 23:04:46 curt
// Added an initial weather section.
//
// Revision 1.4 1997/07/19 22:37:03 curt
// Added various PI definitions.
//
// Revision 1.3 1997/07/14 16:26:03 curt
// Testing/playing -- placed objects randomly across the entire terrain.
//
// Revision 1.2 1997/07/08 18:20:11 curt
// Working on establishing a hard ground.
//
// Revision 1.1 1997/07/07 21:02:36 curt
// Initial revision.

67
Include/fg_memory.h Normal file
View file

@ -0,0 +1,67 @@
// fg_memory.h -- memcpy/bcopy portability declarations
//
// 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$
// (Log is kept at end of this file)
#ifndef _FG_MEMORY_H
#define _FG_MEMORY_H
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_MEMCPY
# ifdef HAVE_MEMORY_H
# include <memory.h>
# endif
# define fgmemcmp memcmp
# define fgmemcpy memcpy
# define fgmemzero(dest,len) memset(dest,0,len)
#elif defined(HAVE_BCOPY)
# define fgmemcmp bcmp
# define fgmemcpy(dest,src,n) bcopy(src,dest,n)
# define fgmemzero bzero
#else
/*
* Neither memcpy() or bcopy() available.
* Use substitutes provided be zlib.
*/
# include <zlib/zutil.h>
# define fgmemcmp zmemcmp
# define fgmemcpy zmemcpy
# define fgmemzero zmemzero
#endif
#endif // _FG_MEMORY_H
// $Log$
// Revision 1.2 1998/12/09 18:47:39 curt
// Use C++ style comments.
//
// Revision 1.1 1998/12/07 21:07:25 curt
// Memory related portability improvements.
//

1
Include/fg_stl_config.h Normal file
View file

@ -0,0 +1 @@
#include <Include/compiler.h>

23
Include/fg_traits.hxx Normal file
View file

@ -0,0 +1,23 @@
#ifndef _FG_TRAITS_HXX
#define _FG_TRAITS_HXX
#include "Include/compiler.h"
#ifndef FG_HAVE_TRAITS
// Dummy up some char traits for now.
template<class charT> struct char_traits{};
FG_TEMPLATE_NULL
struct char_traits<char>
{
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

110
Include/fg_typedefs.h Normal file
View file

@ -0,0 +1,110 @@
/*
// Alterations: Copyright C. Hotchkiss 1996
//
// $Log$
// Revision 1.2 1998/05/13 18:23:46 curt
// fg_typedefs.h: updated version by Charlie Hotchkiss
// general.h: moved fg_root info to fgOPTIONS structure.
//
// Revision 1.1 1998/05/11 18:26:12 curt
// Initial revision.
//
// Rev 1.4 11 Nov 1997 15:34:28 CHOTCHKISS
// Expanded definitions.
//
// Rev 1.3 20 Jan 1997 9:21:26 CHOTCHKISS
// Minor additions.
//
// Rev 1.2 12 Nov 1996 15:06:52 CHOTCHKISS
// Dropped PC Write print format control lines.
//
// Rev 1.1 20 Nov 1995 15:59:02 CHOTCHKISS
// Additions and improvements. Memcheck compatibilities.
//
// Rev 1.0 06 Apr 1995 14:00:32 CHOTCHKISS
// Initial revision.

*/
/*
// TYPEDEFS.H - General purpose definition file
// Copyright (C) 1992 Paradigm Systems. All rights reserved.
//
// Function
// ========
// This file contains the general purpose definitions common to the
// all Paradigm applications. By defining synonyms for the physical
// data types to be manipulated, portability between memory models
// and machines is maximized.
//
// Note that this file follows the system include files and before
// any application include files.
*/
#if !defined(_TYPEDEFS)
#define _TYPEDEFS
//
// Define the types to be used to manipulate 8-, 16-, and 32-bit
// data.
//
typedef unsigned int BIT ; // Use for defining Borland bit fields
typedef char CHAR ; // 8-bit signed data
typedef const char COCHAR;
typedef unsigned char UCHAR ; // 8-bit unsigned data
typedef unsigned char BYTE;
typedef int INT ; // 16-bit signed data
typedef unsigned int UINT ; // 16-bit unsigned data
typedef const int COINT; // 16=bit constant int
typedef const UINT COUINT;
typedef long LONG ; // 32-bit signed data
typedef unsigned long ULONG ; // 32-bit unsigned data
typedef unsigned short UWORD; // Unsigned 16 bit quantity (WIN=SHORT)
#if !defined(WIN32)
typedef signed short WORD; // Signed 16 bit quantity
#endif
typedef BYTE UBYTE; // Used in some 3rd party code
#ifndef WIN32
typedef int BOOLEAN; //
#endif
typedef float FLOAT ; // 32-bit floating point data
typedef double DOUBLE ; // 64-bit floating point data
typedef long double LDOUBLE ; // 80-bit floating point data
#ifndef __cplusplus
typedef int bool;
typedef int BOOL;
typedef int Bool;
#else
#ifndef WIN32
#define BOOL int
#endif
#endif
#define Bool int
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#ifndef true // C++ defines bool, true and false.
#define true TRUE
#define false FALSE
#endif
#ifndef EOF
#define EOF (-1)
#endif
typedef void(*VFNPTR) ( void );
typedef void(*VFNINTPTR)( int );
typedef int (*FNPTR) ( void );
typedef int (*FNINTPTR) ( int );
typedef int (*FNUIPTR) ( UINT );
typedef double( *DBLFNPTR)( void );
#endif
/* !defined(_TYPEDEFS) */

88
Include/fg_zlib.h Normal file
View file

@ -0,0 +1,88 @@
/**************************************************************************
* 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$
* (Log is kept at end of this file)
**************************************************************************/
#ifndef _FG_ZLIB_H
#define _FG_ZLIB_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef AVOID_USING_ZLIB
#include <stdio.h>
#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
#include <zlib/zlib.h>
#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 */
/* $Log$
/* Revision 1.1 1998/04/28 21:41:39 curt
/* Initial revision of fg_zlib.h
/*
*/

113
Include/general.hxx Normal file
View file

@ -0,0 +1,113 @@
// general.hxx -- a general house keeping data structure definition for
// various info that might need to be accessible from all
// parts of the sim.
//
// Written by Curtis Olson, started July 1997.
//
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
//
// 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$
// (Log is kept at end of this file)
#ifndef _GENERAL_HXX
#define _GENERAL_HXX
#ifndef __cplusplus
# error This library requires C++
#endif
// #define FG_FRAME_RATE_HISTORY 10
// the general house keeping structure definition
class FGGeneral {
// Info about OpenGL
char *glVendor;
char *glRenderer;
char *glVersion;
// Last frame rate measurement
int frame_rate;
// double frames[FG_FRAME_RATE_HISTORY];
public:
inline void set_glVendor( char *str ) { glVendor = str; }
inline char* get_glRenderer() const { return glRenderer; }
inline void set_glRenderer( char *str ) { glRenderer = str; }
inline void set_glVersion( char *str ) { glVersion = str; }
inline double get_frame_rate() const { return frame_rate; }
inline void set_frame_rate( int rate ) { frame_rate = rate; }
};
// general contains all the general house keeping parameters.
extern FGGeneral general;
#endif // _GENERAL_HXX
// $Log$
// Revision 1.1 1999/01/06 21:47:39 curt
// renamed general.h to general.hxx
// More portability enhancements to compiler.h
//
// Revision 1.9 1998/12/18 23:34:42 curt
// Converted to a simpler frame rate calculation method.
//
// Revision 1.8 1998/08/20 15:09:46 curt
// Added a status flat for instrument panel use.
//
// Revision 1.7 1998/07/03 14:36:11 curt
// Added conversion constants to fg_constants.h to assist with converting
// between various world units and coordinate systems.
// Added gl vendor/renderer/version info to general structure. Initialized
// in fg_init.cxx
//
// Revision 1.6 1998/05/13 18:23:46 curt
// fg_typedefs.h: updated version by Charlie Hotchkiss
// general.h: moved fg_root info to fgOPTIONS structure.
//
// Revision 1.5 1998/05/07 23:03:17 curt
// Lowered size of frame rate history buffer.
//
// Revision 1.4 1998/05/06 03:14:30 curt
// Added a shared frame rate counter.
//
// Revision 1.3 1998/03/14 00:27:58 curt
// Promoted fgGENERAL to a "type" of struct.
//
// Revision 1.2 1998/01/22 02:59:35 curt
// Changed #ifdef FILE_H to #ifdef _FILE_H
//
// Revision 1.1 1997/12/15 21:02:16 curt
// Moved to .../FlightGear/Src/Include/
//
// Revision 1.3 1997/12/10 22:37:34 curt
// Prepended "fg" on the name of all global structures that didn't have it yet.
// i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
//
// Revision 1.2 1997/08/27 03:29:38 curt
// Changed naming scheme of basic shared structures.
//
// Revision 1.1 1997/08/23 11:37:12 curt
// Initial revision.
//