From: curt Date: Wed, 9 Feb 2000 19:27:02 +0000 (+0000) Subject: Initial revision X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5173d709e090b953eaf800cbcd1bf897de332a12;p=simgear.git Initial revision --- 5173d709e090b953eaf800cbcd1bf897de332a12 diff --cc AUTHORS index 00000000,00000000..e69de29b new file mode 100644 --- /dev/null +++ b/AUTHORS diff --cc ChangeLog index 00000000,00000000..e69de29b new file mode 100644 --- /dev/null +++ b/ChangeLog diff --cc Makefile.am index 00000000,00000000..6311c946 new file mode 100644 --- /dev/null +++ b/Makefile.am @@@ -1,0 -1,0 +1,32 @@@ ++if ENABLE_UNIX_SERIAL ++SERIAL_DIRS = serial ++else ++SERIAL_DIRS = ++endif ++ ++if HAVE_ZLIB ++ZLIB_DIRS = ++else ++ZLIB_DIRS = zlib ++endif ++ ++METAR_DIRS = ++# METAR_DIRS = metar ++ ++EXTRA_DIST = mksymlinks.sh ++ ++dist-hook: ++ tar cf - metar | (cd $(distdir); tar xvf -) ++ ++SUBDIRS = \ ++ include \ ++ bucket \ ++ debug \ ++ math \ ++ $(METAR_DIRS) \ ++ misc \ ++ screen \ ++ $(SERIAL_DIRS) \ ++ xgl \ ++ $(ZLIB_DIRS) ++ diff --cc Makefile.in index 00000000,00000000..05b15cbc new file mode 100644 --- /dev/null +++ b/Makefile.in @@@ -1,0 -1,0 +1,322 @@@ ++# Makefile.in generated automatically by automake 1.3 from Makefile.am ++ ++# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++ ++SHELL = /bin/sh ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++prefix = @prefix@ ++exec_prefix = @exec_prefix@ ++ ++bindir = @bindir@ ++sbindir = @sbindir@ ++libexecdir = @libexecdir@ ++datadir = @datadir@ ++sysconfdir = @sysconfdir@ ++sharedstatedir = @sharedstatedir@ ++localstatedir = @localstatedir@ ++libdir = @libdir@ ++infodir = @infodir@ ++mandir = @mandir@ ++includedir = @includedir@ ++oldincludedir = /usr/include ++ ++DISTDIR = ++ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++ ++top_builddir = . ++ ++ACLOCAL = @ACLOCAL@ ++AUTOCONF = @AUTOCONF@ ++AUTOMAKE = @AUTOMAKE@ ++AUTOHEADER = @AUTOHEADER@ ++ ++INSTALL = @INSTALL@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++transform = @program_transform_name@ ++ ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++CC = @CC@ ++CXX = @CXX@ ++LN_S = @LN_S@ ++MAKEINFO = @MAKEINFO@ ++PACKAGE = @PACKAGE@ ++RANLIB = @RANLIB@ ++VERSION = @VERSION@ ++base_LIBS = @base_LIBS@ ++opengl_LIBS = @opengl_LIBS@ ++ ++@ENABLE_UNIX_SERIAL_TRUE@SERIAL_DIRS = serial ++@ENABLE_UNIX_SERIAL_FALSE@SERIAL_DIRS = ++ ++@HAVE_ZLIB_TRUE@ZLIB_DIRS = ++@HAVE_ZLIB_FALSE@ZLIB_DIRS = zlib ++ ++METAR_DIRS = ++# METAR_DIRS = metar ++ ++EXTRA_DIST = mksymlinks.sh ++ ++SUBDIRS = \ ++ include \ ++ bucket \ ++ debug \ ++ math \ ++ $(METAR_DIRS) \ ++ misc \ ++ screen \ ++ $(SERIAL_DIRS) \ ++ xgl \ ++ $(ZLIB_DIRS) ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = ./include/config.h ++CONFIG_CLEAN_FILES = VERSION ++DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ ++Makefile.in NEWS VERSION.in aclocal.m4 configure configure.in \ ++install-sh missing mkinstalldirs ++ ++ ++DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ++ ++TAR = tar ++GZIP = --best ++DIST_SUBDIRS = include bucket debug math misc screen serial xgl zlib ++all: all-recursive all-am ++ ++.SUFFIXES: ++$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile ++ ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++$(ACLOCAL_M4): configure.in ++ cd $(srcdir) && $(ACLOCAL) ++ ++config.status: $(srcdir)/configure ++ $(SHELL) ./config.status --recheck ++$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) ++ cd $(srcdir) && $(AUTOCONF) ++VERSION: $(top_builddir)/config.status VERSION.in ++ cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status ++ ++# This directory's subdirectories are mostly independent; you can cd ++# into them and run `make' without going through this Makefile. ++# To change the values of `make' variables: instead of editing Makefiles, ++# (1) if the variable is set in `config.status', edit `config.status' ++# (which will cause the Makefiles to be regenerated when you run `make'); ++# (2) otherwise, pass the desired values on the `make' command line. ++ ++@SET_MAKE@ ++ ++all-recursive install-data-recursive install-exec-recursive \ ++installdirs-recursive install-recursive uninstall-recursive \ ++check-recursive installcheck-recursive info-recursive dvi-recursive: ++ @set fnord $(MAKEFLAGS); amf=$$2; \ ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ target=`echo $@ | sed s/-recursive//`; \ ++ echo "Making $$target in $$subdir"; \ ++ (cd $$subdir && $(MAKE) $$target) \ ++ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ ++ done && test -z "$$fail" ++ ++mostlyclean-recursive clean-recursive distclean-recursive \ ++maintainer-clean-recursive: ++ @set fnord $(MAKEFLAGS); amf=$$2; \ ++ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ ++ rev="$$subdir $$rev"; \ ++ done; \ ++ for subdir in $$rev; do \ ++ target=`echo $@ | sed s/-recursive//`; \ ++ echo "Making $$target in $$subdir"; \ ++ (cd $$subdir && $(MAKE) $$target) \ ++ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ ++ done && test -z "$$fail" ++tags-recursive: ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ (cd $$subdir && $(MAKE) tags); \ ++ done ++ ++tags: TAGS ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) ++ here=`pwd` && cd $(srcdir) \ ++ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) ++ ++TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ ++ done; \ ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ ++ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ ++mostlyclean-tags: ++ ++clean-tags: ++ ++distclean-tags: ++ -rm -f TAGS ID ++ ++maintainer-clean-tags: ++ ++distdir = $(PACKAGE)-$(VERSION) ++top_distdir = $(distdir) ++ ++# This target untars the dist file and tries a VPATH configuration. Then ++# it guarantees that the distribution is self-contained by making another ++# tarfile. ++distcheck: dist ++ -rm -rf $(distdir) ++ GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz ++ mkdir $(distdir)/=build ++ mkdir $(distdir)/=inst ++ dc_install_base=`cd $(distdir)/=inst && pwd`; \ ++ cd $(distdir)/=build \ ++ && ../configure --srcdir=.. --prefix=$$dc_install_base \ ++ && $(MAKE) \ ++ && $(MAKE) dvi \ ++ && $(MAKE) check \ ++ && $(MAKE) install \ ++ && $(MAKE) installcheck \ ++ && $(MAKE) dist ++ -rm -rf $(distdir) ++ @echo "========================"; \ ++ echo "$(distdir).tar.gz is ready for distribution"; \ ++ echo "========================" ++dist: distdir ++ -chmod -R a+r $(distdir) ++ GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) ++ -rm -rf $(distdir) ++dist-all: distdir ++ -chmod -R a+r $(distdir) ++ GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) ++ -rm -rf $(distdir) ++distdir: $(DISTFILES) ++ -rm -rf $(distdir) ++ mkdir $(distdir) ++ -chmod 777 $(distdir) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile ++ @for file in $(DISTFILES); do \ ++ d=$(srcdir); \ ++ test -f $(distdir)/$$file \ ++ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ++ || cp -p $$d/$$file $(distdir)/$$file; \ ++ done ++ for subdir in $(DIST_SUBDIRS); do \ ++ test -d $(distdir)/$$subdir \ ++ || mkdir $(distdir)/$$subdir \ ++ || exit 1; \ ++ chmod 777 $(distdir)/$$subdir; \ ++ (cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ ++ || exit 1; \ ++ done ++ $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook ++info: info-recursive ++dvi: dvi-recursive ++check: all-am ++ $(MAKE) check-recursive ++installcheck: installcheck-recursive ++all-am: Makefile ++ ++install-exec: install-exec-recursive ++ @$(NORMAL_INSTALL) ++ ++install-data: install-data-recursive ++ @$(NORMAL_INSTALL) ++ ++install: install-recursive ++ @: ++ ++uninstall: uninstall-recursive ++ ++install-strip: ++ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install ++installdirs: installdirs-recursive ++ ++ ++mostlyclean-generic: ++ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f Makefile $(DISTCLEANFILES) ++ -rm -f config.cache config.log stamp-h stamp-h[0-9]* ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) ++ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) ++mostlyclean-am: mostlyclean-tags mostlyclean-generic ++ ++clean-am: clean-tags clean-generic mostlyclean-am ++ ++distclean-am: distclean-tags distclean-generic clean-am ++ ++maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ ++ distclean-am ++ ++mostlyclean: mostlyclean-recursive mostlyclean-am ++ ++clean: clean-recursive clean-am ++ ++distclean: distclean-recursive distclean-am ++ -rm -f config.status ++ ++maintainer-clean: maintainer-clean-recursive maintainer-clean-am ++ @echo "This command is intended for maintainers to use;" ++ @echo "it deletes files that may require special tools to rebuild." ++ -rm -f config.status ++ ++.PHONY: install-data-recursive uninstall-data-recursive \ ++install-exec-recursive uninstall-exec-recursive installdirs-recursive \ ++uninstalldirs-recursive all-recursive check-recursive \ ++installcheck-recursive info-recursive dvi-recursive \ ++mostlyclean-recursive distclean-recursive clean-recursive \ ++maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ ++distclean-tags clean-tags maintainer-clean-tags distdir info dvi \ ++installcheck all-am install-exec install-data install uninstall all \ ++installdirs mostlyclean-generic distclean-generic clean-generic \ ++maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++ ++ ++dist-hook: ++ tar cf - metar | (cd $(distdir); tar xvf -) ++ ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --cc NEWS index 00000000,00000000..e69de29b new file mode 100644 --- /dev/null +++ b/NEWS diff --cc README index 00000000,00000000..e69de29b new file mode 100644 --- /dev/null +++ b/README diff --cc VERSION.in index 00000000,00000000..d78bda93 new file mode 100644 --- /dev/null +++ b/VERSION.in @@@ -1,0 -1,0 +1,1 @@@ ++@VERSION@ diff --cc acconfig.h index 00000000,00000000..4e22afc2 new file mode 100644 --- /dev/null +++ b/acconfig.h @@@ -1,0 -1,0 +1,324 @@@ ++/* acconfig.h ++ This file is in the public domain. ++ ++ Descriptive text for the C preprocessor macros that ++ the distributed Autoconf macros can define. ++ No software package will use all of them; autoheader copies the ones ++ your configure.in uses into your configuration header file templates. ++ ++ The entries are in sort -df order: alphabetical, case insensitive, ++ ignoring punctuation (such as underscores). Although this order ++ can split up related entries, it makes it easier to check whether ++ a given entry is in the file. ++ ++ Leave the following blank line there!! Autoheader needs it. */ ++ ++ ++/* Define if on AIX 3. ++ System headers sometimes define this. ++ We just want to avoid a redefinition error message. */ ++#ifndef _ALL_SOURCE ++#undef _ALL_SOURCE ++#endif ++ ++/* Define if using alloca.c. */ ++#undef C_ALLOCA ++ ++/* Define if type char is unsigned and you are not using gcc. */ ++#ifndef __CHAR_UNSIGNED__ ++#undef __CHAR_UNSIGNED__ ++#endif ++ ++/* Define if the closedir function returns void instead of int. */ ++#undef CLOSEDIR_VOID ++ ++/* Define to empty if the keyword does not work. */ ++#undef const ++ ++/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. ++ This function is required for alloca.c support on those systems. */ ++#undef CRAY_STACKSEG_END ++ ++/* Define for DGUX with . */ ++#undef DGUX ++ ++/* Define if you have . */ ++#undef DIRENT ++ ++/* Define to enable audio support */ ++#undef ENABLE_AUDIO_SUPPORT ++ ++/* Define to enable GLUT joystick support (limited to 3 axes) */ ++#undef ENABLE_GLUT_JOYSTICK ++ ++/* Define to enable plib joystick support (recommended) */ ++#undef ENABLE_PLIB_JOYSTICK ++ ++/* Define to eliminate all trace of debugging messages such as for a ++ release build */ ++#undef FG_NDEBUG ++ ++/* Define to include Oliver's networking support */ ++#undef FG_NETWORK_OLK ++ ++/* Define to avoid Christian's new weather code */ ++#undef FG_OLD_WEATHER ++ ++/* Define if we are building FGFS (should always be defined) */ ++#undef FGFS ++ ++/* Define to enable 3dfx/glide render in a window hack under unix. ++ This probably won't work under windows. */ ++#undef XMESA ++#undef FX ++ ++/* Define to the type of elements in the array set by `getgroups'. ++ Usually this is either `int' or `gid_t'. */ ++#undef GETGROUPS_T ++ ++/* Define if the `getloadavg' function needs to be run setuid or setgid. */ ++#undef GETLOADAVG_PRIVILEGED ++ ++/* Define if the `getpgrp' function takes no argument. */ ++#undef GETPGRP_VOID ++ ++/* Define to `int' if doesn't define. */ ++#undef gid_t ++ ++/* Define if you have alloca, as a function or macro. */ ++#undef HAVE_ALLOCA ++ ++/* Define if you have and it should be used (not on Ultrix). */ ++#undef HAVE_ALLOCA_H ++ ++/* Define if you external variables daylight. */ ++#undef HAVE_DAYLIGHT ++ ++/* Define if you don't have vprintf but do have _doprnt. */ ++#undef HAVE_DOPRNT ++ ++/* Define if your system has a working fnmatch function. */ ++#undef HAVE_FNMATCH ++ ++/* Define if your system has its own `getloadavg' function. */ ++#undef HAVE_GETLOADAVG ++ ++/* Define if you have getrusage() */ ++#undef HAVE_GETRUSAGE ++ ++/* Define if you have the getmntent function. */ ++#undef HAVE_GETMNTENT ++ ++/* Define if you have the gpc library and headers installed. */ ++#undef HAVE_GPC_H ++ ++/* Define if the `long double' type works. */ ++#undef HAVE_LONG_DOUBLE ++ ++/* Define if you support file names longer than 14 characters. */ ++#undef HAVE_LONG_FILE_NAMES ++ ++/* Define if you have a working `mmap' system call. */ ++#undef HAVE_MMAP ++ ++/* Define if system calls automatically restart after interruption ++ by a signal. */ ++#undef HAVE_RESTARTABLE_SYSCALLS ++ ++/* Define if you have rint() which rounds to closest int but returns ++ result as a double data type. */ ++#undef HAVE_RINT ++ ++/* Define if your struct stat has st_blksize. */ ++#undef HAVE_ST_BLKSIZE ++ ++/* Define if your struct stat has st_blocks. */ ++#undef HAVE_ST_BLOCKS ++ ++/* Define if you have the strcoll function and it is properly defined. */ ++#undef HAVE_STRCOLL ++ ++/* Define if your struct stat has st_rdev. */ ++#undef HAVE_ST_RDEV ++ ++/* Define if you have the strftime function. */ ++#undef HAVE_STRFTIME ++ ++/* Define if you have */ ++#undef HAVE_SYS_PARAM_H ++ ++/* Define if you have that is POSIX.1 compatible. */ ++#undef HAVE_SYS_STAT_H ++ ++/* Define if you have that is POSIX.1 compatible. */ ++#undef HAVE_SYS_WAIT_H ++ ++/* Define if you have timegm() */ ++#undef HAVE_TIMEGM ++ ++/* Define if you external variables timezone. */ ++#undef HAVE_TIMEZONE ++ ++/* Define if your struct tm has tm_zone. */ ++#undef HAVE_TM_ZONE ++ ++/* Define if you don't have tm_zone but do have the external array ++ tzname. */ ++#undef HAVE_TZNAME ++ ++/* Define if you have . */ ++#undef HAVE_UNISTD_H ++ ++/* Define if utime(file, NULL) sets file's timestamp to the present. */ ++#undef HAVE_UTIME_NULL ++ ++/* Define if you have . */ ++#undef HAVE_VFORK_H ++ ++/* Define if you have the vprintf function. */ ++#undef HAVE_VPRINTF ++ ++/* Define if you have the wait3 system call. */ ++#undef HAVE_WAIT3 ++ ++/* Define as __inline if that's what the C compiler calls it. */ ++#undef inline ++ ++/* Define if int is 16 bits instead of 32. */ ++#undef INT_16_BITS ++ ++/* Define if long int is 64 bits. */ ++#undef LONG_64_BITS ++ ++/* Define if major, minor, and makedev are declared in . */ ++#undef MAJOR_IN_MKDEV ++ ++/* Define if major, minor, and makedev are declared in . */ ++#undef MAJOR_IN_SYSMACROS ++ ++/* Define if on MINIX. */ ++#undef _MINIX ++ ++/* Define to `int' if doesn't define. */ ++#undef mode_t ++ ++/* Define if you don't have , but have . */ ++#undef NDIR ++ ++/* Define if you have , and doesn't declare the ++ mem* functions. */ ++#undef NEED_MEMORY_H ++ ++/* Define if your struct nlist has an n_un member. */ ++#undef NLIST_NAME_UNION ++ ++/* Define if you have . */ ++#undef NLIST_STRUCT ++ ++/* Define if your C compiler doesn't accept -c and -o together. */ ++#undef NO_MINUS_C_MINUS_O ++ ++/* Define to `long' if doesn't define. */ ++#undef off_t ++ ++/* Define to package name */ ++#undef PACKAGE ++ ++/* Define to `int' if doesn't define. */ ++#undef pid_t ++ ++/* Define if the system does not provide POSIX.1 features except ++ with this defined. */ ++#undef _POSIX_1_SOURCE ++ ++/* Define if you need to in order for stat and other things to work. */ ++#undef _POSIX_SOURCE ++ ++/* Define as the return type of signal handlers (int or void). */ ++#undef RETSIGTYPE ++ ++/* Define if the `setpgrp' function takes no argument. */ ++#undef SETPGRP_VOID ++ ++/* Define if the setvbuf function takes the buffering type as its second ++ argument and the buffer pointer as the third, as on System V ++ before release 3. */ ++#undef SETVBUF_REVERSED ++ ++/* Define to `unsigned' if doesn't define. */ ++#undef size_t ++ ++/* If using the C implementation of alloca, define if you know the ++ direction of stack growth for your system; otherwise it will be ++ automatically deduced at run-time. ++ STACK_DIRECTION > 0 => grows toward higher addresses ++ STACK_DIRECTION < 0 => grows toward lower addresses ++ STACK_DIRECTION = 0 => direction of growth unknown ++ */ ++#undef STACK_DIRECTION ++ ++/* Define if the `S_IS*' macros in do not work properly. */ ++#undef STAT_MACROS_BROKEN ++ ++/* Define if you have the ANSI C header files. */ ++#undef STDC_HEADERS ++ ++/* Define on System V Release 4. */ ++#undef SVR4 ++ ++/* Define if you don't have , but have . */ ++#undef SYSDIR ++ ++/* Define if you don't have , but have . */ ++#undef SYSNDIR ++ ++/* Define if `sys_siglist' is declared by . */ ++#undef SYS_SIGLIST_DECLARED ++ ++/* Define if you can safely include both and . */ ++#undef TIME_WITH_SYS_TIME ++ ++/* Define if your declares struct tm. */ ++#undef TM_IN_SYS_TIME ++ ++/* Define to `int' if doesn't define. */ ++#undef uid_t ++ ++/* Define for Encore UMAX. */ ++#undef UMAX ++ ++/* Define for Encore UMAX 4.3 that has ++ instead of . */ ++#undef UMAX4_3 ++ ++/* Define if you do not have , index, bzero, etc.. */ ++#undef USG ++ ++/* Define to version number */ ++#undef VERSION ++ ++/* Define vfork as fork if vfork does not work. */ ++#undef vfork ++ ++/* Define if the closedir function returns void instead of int. */ ++#undef VOID_CLOSEDIR ++ ++/* Define if compiling on a Winbloze (95, NT, etc.) platform */ ++#undef WIN32 ++ ++/* Define if your processor stores words with the most significant ++ byte first (like Motorola and SPARC, unlike Intel and VAX). */ ++#undef WORDS_BIGENDIAN ++ ++/* Define if the X Window System is missing or not being used. */ ++#undef X_DISPLAY_MISSING ++ ++/* Define if lex declares yytext as a char * by default, not a char[]. */ ++#undef YYTEXT_POINTER ++ ++ ++/* Leave that blank line there!! Autoheader needs it. ++ If you're adding to this file, keep in mind: ++ The entries are in sort -df order: alphabetical, case insensitive, ++ ignoring punctuation (such as underscores). */ ++ diff --cc aclocal.m4 index 00000000,00000000..df0bfb9e new file mode 100644 --- /dev/null +++ b/aclocal.m4 @@@ -1,0 -1,0 +1,149 @@@ ++dnl aclocal.m4 generated automatically by aclocal 1.3 ++ ++dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ++dnl This Makefile.in is free software; the Free Software Foundation ++dnl gives unlimited permission to copy and/or distribute it, ++dnl with or without modifications, as long as this notice is preserved. ++ ++dnl This program is distributed in the hope that it will be useful, ++dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++dnl PARTICULAR PURPOSE. ++ ++# Do all the work for Automake. This macro actually does too much -- ++# some checks are only needed if your package does certain things. ++# But this isn't really a big deal. ++ ++# serial 1 ++ ++dnl Usage: ++dnl AM_INIT_AUTOMAKE(package,version, [no-define]) ++ ++AC_DEFUN(AM_INIT_AUTOMAKE, ++[AC_REQUIRE([AM_PROG_INSTALL]) ++PACKAGE=[$1] ++AC_SUBST(PACKAGE) ++VERSION=[$2] ++AC_SUBST(VERSION) ++dnl test to see if srcdir already configured ++if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then ++ AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) ++fi ++ifelse([$3],, ++AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") ++AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) ++AC_REQUIRE([AM_SANITY_CHECK]) ++AC_REQUIRE([AC_ARG_PROGRAM]) ++dnl FIXME This is truly gross. ++missing_dir=`cd $ac_aux_dir && pwd` ++AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) ++AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) ++AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) ++AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) ++AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) ++AC_REQUIRE([AC_PROG_MAKE_SET])]) ++ ++ ++# serial 1 ++ ++AC_DEFUN(AM_PROG_INSTALL, ++[AC_REQUIRE([AC_PROG_INSTALL]) ++test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' ++AC_SUBST(INSTALL_SCRIPT)dnl ++]) ++ ++# ++# Check to make sure that the build environment is sane. ++# ++ ++AC_DEFUN(AM_SANITY_CHECK, ++[AC_MSG_CHECKING([whether build environment is sane]) ++# Just in case ++sleep 1 ++echo timestamp > conftestfile ++# Do `set' in a subshell so we don't clobber the current shell's ++# arguments. Must try -L first in case configure is actually a ++# symlink; some systems play weird games with the mod time of symlinks ++# (eg FreeBSD returns the mod time of the symlink's containing ++# directory). ++if ( ++ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` ++ if test "[$]*" = "X"; then ++ # -L didn't work. ++ set X `ls -t $srcdir/configure conftestfile` ++ fi ++ if test "[$]*" != "X $srcdir/configure conftestfile" \ ++ && test "[$]*" != "X conftestfile $srcdir/configure"; then ++ ++ # If neither matched, then we have a broken ls. This can happen ++ # if, for instance, CONFIG_SHELL is bash and it inherits a ++ # broken ls alias from the environment. This has actually ++ # happened. Such a system could not be considered "sane". ++ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken ++alias in your environment]) ++ fi ++ ++ test "[$]2" = conftestfile ++ ) ++then ++ # Ok. ++ : ++else ++ AC_MSG_ERROR([newly created file is older than distributed files! ++Check your system clock]) ++fi ++rm -f conftest* ++AC_MSG_RESULT(yes)]) ++ ++dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) ++dnl The program must properly implement --version. ++AC_DEFUN(AM_MISSING_PROG, ++[AC_MSG_CHECKING(for working $2) ++# Run test in a subshell; some versions of sh will print an error if ++# an executable is not found, even if stderr is redirected. ++# Redirect stdin to placate older versions of autoconf. Sigh. ++if ($2 --version) < /dev/null > /dev/null 2>&1; then ++ $1=$2 ++ AC_MSG_RESULT(found) ++else ++ $1="$3/missing $2" ++ AC_MSG_RESULT(missing) ++fi ++AC_SUBST($1)]) ++ ++# Define a conditional. ++ ++AC_DEFUN(AM_CONDITIONAL, ++[AC_SUBST($1_TRUE) ++AC_SUBST($1_FALSE) ++if $2; then ++ $1_TRUE= ++ $1_FALSE='#' ++else ++ $1_TRUE='#' ++ $1_FALSE= ++fi]) ++ ++# Like AC_CONFIG_HEADER, but automatically create stamp file. ++ ++AC_DEFUN(AM_CONFIG_HEADER, ++[AC_PREREQ([2.12]) ++AC_CONFIG_HEADER([$1]) ++dnl When config.status generates a header, we must update the stamp-h file. ++dnl This file resides in the same directory as the config header ++dnl that is generated. We must strip everything past the first ":", ++dnl and everything past the last "/". ++AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl ++ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, ++<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, ++<>; do ++ case " <<$>>CONFIG_HEADERS " in ++ *" <<$>>am_file "*<<)>> ++ echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx ++ ;; ++ esac ++ am_indx=`expr "<<$>>am_indx" + 1` ++done<<>>dnl>>) ++changequote([,]))]) ++ diff --cc acsite.m4 index 00000000,00000000..3a0e116e new file mode 100644 --- /dev/null +++ b/acsite.m4 @@@ -1,0 -1,0 +1,394 @@@ ++dnl ++dnl originally from ncftp 2.3.0 ++dnl added wi_EXTRA_PDIR and wi_ANSI_C ++dnl $Id$ ++dnl ++AC_DEFUN(wi_EXTRA_IDIR, [ ++incdir="$1" ++if test -r $incdir ; then ++ case "$CPPFLAGS" in ++ *-I${incdir}*) ++ # echo " + already had $incdir" 1>&6 ++ ;; ++ *) ++ if test "$CPPFLAGS" = "" ; then ++ CPPFLAGS="-I$incdir" ++ else ++ CPPFLAGS="$CPPFLAGS -I$incdir" ++ fi ++ echo " + found $incdir" 1>&6 ++ ;; ++ esac ++fi ++]) ++dnl ++dnl ++dnl ++dnl ++AC_DEFUN(wi_EXTRA_LDIR, [ ++mylibdir="$1" ++if test -r $mylibdir ; then ++ case "$LDFLAGS" in ++ *-L${mylibdir}*) ++ # echo " + already had $mylibdir" 1>&6 ++ ;; ++ *) ++ if test "$LDFLAGS" = "" ; then ++ LDFLAGS="-L$mylibdir" ++ else ++ LDFLAGS="$LDFLAGS -L$mylibdir" ++ fi ++ echo " + found $mylibdir" 1>&6 ++ ;; ++ esac ++fi ++]) ++dnl ++dnl __FP__ ++dnl ++dnl ++AC_DEFUN(wi_EXTRA_PDIR, [ ++progdir="$1" ++if test -r $progdir ; then ++ case "$PATH" in ++ *:${progdir}*) ++ # echo " + already had $progdir" 1>&6 ++ ;; ++ *${progdir}:*) ++ # echo " + already had $progdir" 1>&6 ++ ;; ++ *) ++ if test "$PATH" = "" ; then ++ PATH="$progdir" ++ else ++ PATH="$PATH:$progdir" ++ fi ++ echo " + found $progdir" 1>&6 ++ ;; ++ esac ++fi ++]) ++dnl ++dnl ++dnl If you want to also look for include and lib subdirectories in the ++dnl $HOME tree, you supply "yes" as the first argument to this macro. ++dnl ++dnl If you want to look for subdirectories in include/lib directories, ++dnl you pass the names in argument 3, otherwise pass a dash. ++dnl ++AC_DEFUN(wi_EXTRA_DIRS, [echo "checking for extra include and lib directories..." 1>&6 ++ifelse([$1], yes, [dnl ++b1=`cd .. ; pwd` ++b2=`cd ../.. ; pwd` ++exdirs="$HOME $j $b1 $b2 $prefix $2" ++],[dnl ++exdirs="$prefix $2" ++]) ++subexdirs="$3" ++if test "$subexdirs" = "" ; then ++ subexdirs="-" ++fi ++for subexdir in $subexdirs ; do ++if test "$subexdir" = "-" ; then ++ subexdir="" ++else ++ subexdir="/$subexdir" ++fi ++for exdir in $exdirs ; do ++ if test "$exdir" != "/usr" || test "$subexdir" != ""; then ++ incdir="${exdir}/include${subexdir}" ++ wi_EXTRA_IDIR($incdir) ++ ++ mylibdir="${exdir}/lib${subexdir}" ++ wi_EXTRA_LDIR($mylibdir) ++ ++ progdir="${exdir}/bin${subexdirr}" ++ wi_EXTRA_PDIR($progdir) ++ fi ++done ++done ++]) ++dnl ++dnl ++dnl ++AC_DEFUN(wi_HPUX_CFLAGS, ++[AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed) ++AC_REQUIRE([AC_PROG_CC]) ++os=`uname -s | tr '[A-Z]' '[a-z]'` ++ac_cv_hpux_flags=no ++if test "$os" = hp-ux ; then ++ if test "$ac_cv_prog_gcc" = yes ; then ++ if test "$CFLAGS" != "" ; then ++ # Shouldn't be in there. ++ CFLAGS=`echo "$CFLAGS" | sed 's/-Aa//g'` ++ fi ++ else ++ # If you're not using gcc, then you better have a cc/c89 ++ # that is usable. If you have the barebones compiler, it ++ # won't work. The good compiler uses -Aa for the ANSI ++ # compatible stuff. ++ x=`echo $CFLAGS | grep 'Aa' 2>/dev/null` ++ if test "$x" = "" ; then ++ CFLAGS="$CFLAGS -Aa" ++ fi ++ ac_cv_hpux_flags=yes ++ fi ++ # Also add _HPUX_SOURCE to get the extended namespace. ++ x=`echo $CFLAGS | grep '_HPUX_SOURCE' 2>/dev/null` ++ if test "$x" = "" ; then ++ CFLAGS="$CFLAGS -D_HPUX_SOURCE" ++ fi ++fi ++AC_MSG_RESULT($ac_cv_hpux_flags) ++]) ++dnl ++dnl ++dnl ++AC_DEFUN(wi_CFLAGS, [AC_REQUIRE([AC_PROG_CC]) ++wi_HPUX_CFLAGS ++ if test "$CFLAGS" = "" ; then ++ CFLAGS="-O" ++ elif test "$ac_cv_prog_gcc" = "yes" ; then ++ case "$CFLAGS" in ++ *"-g -O"*) ++ #echo "using -g as default gcc CFLAGS" 1>&6 ++ CFLAGS=`echo $CFLAGS | sed 's/-g\ -O/-O/'` ++ ;; ++ *"-O -g"*) ++ # Leave the -g, but remove all -O options. ++ #echo "using -g as default gcc CFLAGS" 1>&6 ++ CFLAGS=`echo $CFLAGS | sed 's/-O\ -g/-O/'` ++ ;; ++ esac ++ fi ++]) ++dnl ++dnl ++dnl ++AC_DEFUN(wi_PROTOTYPES, [ ++AC_MSG_CHECKING(if the compiler supports function prototypes) ++AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes ++AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no) ++AC_MSG_RESULT($wi_cv_prototypes) ++]) ++dnl ++dnl ++dnl ++AC_DEFUN(wi_ANSI_C, [ ++AC_MSG_CHECKING(ANSI-style function definitions) ++AC_TRY_COMPILE(,[int blubb(int x) { return 0; }],[wi_cv_ansi_funcs=yes ++AC_DEFINE(ANSI_FUNCS)],wi_cv_ansi_funcs=no) ++AC_MSG_RESULT($wi_cv_ansi_funcs) ++]) ++dnl ++dnl ++dnl ++AC_DEFUN(wi_HEADER_SYS_SELECT_H, [ ++# See if is includable after ++if test "$ac_cv_header_sys_time_h" = no ; then ++AC_CHECK_HEADERS(sys/time.h sys/select.h) ++else ++AC_CHECK_HEADERS(sys/select.h) ++fi ++if test "$ac_cv_header_sys_select_h" = yes ; then ++ AC_MSG_CHECKING([if is compatible with ]) ++ selecth=yes ++ if test "$ac_cv_header_sys_time_h" = yes ; then ++ AC_TRY_COMPILE([#include ++ #include ],[ ++ fd_set a; ++ struct timeval tmval; ++ ++ tmval.tv_sec = 0;],selecth=yes,selecth=no) ++ ++ if test "$selecth" = yes ; then ++ AC_DEFINE(CAN_USE_SYS_SELECT_H) ++ fi ++ fi ++ AC_MSG_RESULT($selecth) ++fi ++]) ++dnl ++dnl ++dnl ++AC_DEFUN(wi_LIB_RESOLV, [ ++# See if we could access two well-known sites without help of any special ++# libraries, like resolv. ++ ++AC_TRY_RUN([ ++#include ++#include ++#include ++#include ++ ++main() ++{ ++ struct hostent *hp1, *hp2; ++ int result; ++ ++ hp1 = gethostbyname("gatekeeper.dec.com"); ++ hp2 = gethostbyname("ftp.ncsa.uiuc.edu"); ++ result = ((hp1 != (struct hostent *) 0) && (hp2 != (struct hostent *) 0)); ++ exit(! result); ++}],look_for_resolv=no,look_for_resolv=yes,look_for_resolv=yes) ++ ++AC_MSG_CHECKING([if we need to look for -lresolv]) ++AC_MSG_RESULT($look_for_resolv) ++if test "$look_for_resolv" = yes ; then ++AC_CHECK_LIB(resolv,main) ++else ++ ac_cv_lib_resolv=no ++fi ++]) ++dnl ++dnl ++dnl ++ ++AC_DEFUN(wi_LIB_NSL, [ ++AC_MSG_CHECKING(if we can use -lnsl) ++ac_save_LIBS="$LIBS"; ++LIBS="$LIBS -lnsl"; ++AC_CACHE_VAL(r_cv_use_libnsl, [ ++AC_TRY_RUN( ++main() { if (getpwuid(getuid())) exit(0); exit(-1); }, ++nc_cv_use_libnsl=yes, nc_cv_use_libnsl=no, nc_cv_use_libnsl=no) ++]) ++if test "$nc_cv_use_libnsl" = "no"; then LIBS="$ac_save_LIBS"; fi ++AC_MSG_RESULT($nc_cv_use_libnsl) ++])dnl ++ ++dnl ++dnl ++dnl ++ ++AC_DEFUN(nc_PATH_PROG_ZCAT, [ ++AC_PATH_PROG(GZCAT,gzcat) ++AC_PATH_PROG(ZCAT,zcat) ++if test "x$GZCAT" = x ; then ++ if test "x$ZCAT" != x ; then ++ # See if zcat is really gzcat. gzcat has a --version option, regular ++ # zcat does not. ++ AC_MSG_CHECKING(if zcat is really gzcat in disguise) ++ if $ZCAT --version 2> /dev/null ; then ++ AC_DEFINE_UNQUOTED(GZCAT, "$ZCAT") ++ AC_MSG_RESULT(yes) ++ else ++ AC_MSG_RESULT(no) ++ fi ++ fi ++else ++ AC_DEFINE_UNQUOTED(GZCAT, "$GZCAT") ++fi ++ ++if test "x$ZCAT" != x ; then ++ AC_DEFINE_UNQUOTED(ZCAT, "$ZCAT") ++fi ++]) ++dnl ++dnl ++dnl ++AC_DEFUN(wi_SYSV_EXTRA_DIRS, [ ++# Use System V because their curses extensions are required. This must ++# be done early so we use the -I and -L in the library checks also. ++# This is mostly a Solaris/SunOS hack. Note that doing this will also ++# use all of the other System V libraries and headers. ++ ++AC_MSG_CHECKING(for alternative System V libraries) ++if test -f /usr/5include/curses.h ; then ++ CPPFLAGS="$CPPFLAGS -I/usr/5include" ++ LDFLAGS="$LDFLAGS -L/usr/5lib" ++ AC_MSG_RESULT(yes) ++else ++ AC_MSG_RESULT(no) ++fi ++]) ++dnl ++dnl ++dnl ++AC_DEFUN(wi_DEFINE_UNAME, [ ++# Get first 127 chars of all uname information. Some folks have ++# way too much stuff there, so grab only the first 127. ++unam=`uname -a 2>/dev/null | cut -c1-127` ++if test "$unam" != "" ; then ++ AC_DEFINE_UNQUOTED(UNAME, "$unam") ++fi ++]) ++dnl ++dnl ++dnl ++AC_DEFUN(wi_READLINE_WITH_NCURSES, [ ++# Readline and Ncurses could both define "backspace". ++# Warn about this if we have both things in our definitions list. ++ ++if test "$ac_cv_lib_readline" = yes && test "$ac_cv_lib_ncurses" = yes ; then ++ ++AC_MSG_CHECKING(if readline and ncurses will link together) ++j="$LIBS" ++LIBS="-lreadline -lncurses" ++AC_TRY_LINK(,[ ++readline("prompt"); ++endwin(); ++],k=yes,k=no) ++if test "$k" = no ; then ++ AC_MSG_RESULT(no) ++ # Remove '-lreadline' from LIBS. ++ LIBS=`echo $j | sed s/-lreadline//g` ++ ac_cv_lib_readline=no ++ AC_WARN([The versions of GNU readline and ncurses you have installed on this system ++can't be used together, because they use the same symbol, backspace. If ++possible, recompile one of the libraries with -Dbackspace=back_space, then ++re-run configure.]) ++ ++else ++ AC_MSG_RESULT(yes) ++ LIBS="$j" ++fi ++ ++fi ++]) ++dnl ++dnl ++dnl ++ ++dnl AC_EXT_DAYLIGHT ++dnl Check for an external variable daylight. Stolen from w3c-libwww. ++AC_DEFUN(AC_EXT_DAYLIGHT, ++[ AC_MSG_CHECKING(int daylight variable) ++AC_TRY_COMPILE([#include ], [return daylight;], ++ have_daylight=yes, ++ have_daylight=no) ++AC_MSG_RESULT($have_daylight) ++])dnl ++ ++dnl AC_EXT_TIMEZONE ++dnl Check for an external variable timezone. Stolen from tcl-8.0. ++AC_DEFUN(AC_EXT_TIMEZONE, ++[ ++# ++# Its important to include time.h in this check, as some systems (like convex) ++# have timezone functions, etc. ++# ++have_timezone=no ++AC_MSG_CHECKING([long timezone variable]) ++AC_TRY_COMPILE([#include ], ++ [extern long timezone; ++ timezone += 1; ++ exit (0);], ++ [have_timezone=yes ++ AC_MSG_RESULT(yes)], ++ AC_MSG_RESULT(no)) ++ ++# ++# On some systems (eg IRIX 6.2), timezone is a time_t and not a long. ++# ++if test "$have_timezone" = no; then ++ AC_MSG_CHECKING([time_t timezone variable]) ++ AC_TRY_COMPILE([#include ], ++ [extern time_t timezone; ++ timezone += 1; ++ exit (0);], ++ [have_timezone=yes ++ AC_MSG_RESULT(yes)], ++ AC_MSG_RESULT(no)) ++fi ++])dnl diff --cc configure index 00000000,00000000..dd519b56 new file mode 100755 --- /dev/null +++ b/configure @@@ -1,0 -1,0 +1,4275 @@@ ++#! /bin/sh ++ ++# Guess values for system-dependent variables and create Makefiles. ++# Generated automatically using autoconf version 2.12 ++# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. ++# ++# This configure script is free software; the Free Software Foundation ++# gives unlimited permission to copy, distribute and modify it. ++ ++# Defaults: ++ac_help= ++ac_default_prefix=/usr/local ++# Any additions from configure.in: ++ac_help="$ac_help ++ --with-logging Include logging output (default)" ++ac_help="$ac_help ++ --with-efence Specify if we are building with "electric-fence"" ++ac_help="$ac_help ++ --with-x use the X Window System" ++ ++# Initialize some variables set by options. ++# The variables have the same names as the options, with ++# dashes changed to underlines. ++build=NONE ++cache_file=./config.cache ++exec_prefix=NONE ++host=NONE ++no_create= ++nonopt=NONE ++no_recursion= ++prefix=NONE ++program_prefix=NONE ++program_suffix=NONE ++program_transform_name=s,x,x, ++silent= ++site= ++srcdir= ++target=NONE ++verbose= ++x_includes=NONE ++x_libraries=NONE ++bindir='${exec_prefix}/bin' ++sbindir='${exec_prefix}/sbin' ++libexecdir='${exec_prefix}/libexec' ++datadir='${prefix}/share' ++sysconfdir='${prefix}/etc' ++sharedstatedir='${prefix}/com' ++localstatedir='${prefix}/var' ++libdir='${exec_prefix}/lib' ++includedir='${prefix}/include' ++oldincludedir='/usr/include' ++infodir='${prefix}/info' ++mandir='${prefix}/man' ++ ++# Initialize some other variables. ++subdirs= ++MFLAGS= MAKEFLAGS= ++# Maximum number of lines to put in a shell here document. ++ac_max_here_lines=12 ++ ++ac_prev= ++for ac_option ++do ++ ++ # If the previous option needs an argument, assign it. ++ if test -n "$ac_prev"; then ++ eval "$ac_prev=\$ac_option" ++ ac_prev= ++ continue ++ fi ++ ++ case "$ac_option" in ++ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; ++ *) ac_optarg= ;; ++ esac ++ ++ # Accept the important Cygnus configure options, so we can diagnose typos. ++ ++ case "$ac_option" in ++ ++ -bindir | --bindir | --bindi | --bind | --bin | --bi) ++ ac_prev=bindir ;; ++ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) ++ bindir="$ac_optarg" ;; ++ ++ -build | --build | --buil | --bui | --bu) ++ ac_prev=build ;; ++ -build=* | --build=* | --buil=* | --bui=* | --bu=*) ++ build="$ac_optarg" ;; ++ ++ -cache-file | --cache-file | --cache-fil | --cache-fi \ ++ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ++ ac_prev=cache_file ;; ++ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ ++ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) ++ cache_file="$ac_optarg" ;; ++ ++ -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ++ ac_prev=datadir ;; ++ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ ++ | --da=*) ++ datadir="$ac_optarg" ;; ++ ++ -disable-* | --disable-*) ++ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` ++ # Reject names that are not valid shell variable names. ++ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then ++ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } ++ fi ++ ac_feature=`echo $ac_feature| sed 's/-/_/g'` ++ eval "enable_${ac_feature}=no" ;; ++ ++ -enable-* | --enable-*) ++ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` ++ # Reject names that are not valid shell variable names. ++ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then ++ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } ++ fi ++ ac_feature=`echo $ac_feature| sed 's/-/_/g'` ++ case "$ac_option" in ++ *=*) ;; ++ *) ac_optarg=yes ;; ++ esac ++ eval "enable_${ac_feature}='$ac_optarg'" ;; ++ ++ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ ++ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ ++ | --exec | --exe | --ex) ++ ac_prev=exec_prefix ;; ++ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ ++ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ ++ | --exec=* | --exe=* | --ex=*) ++ exec_prefix="$ac_optarg" ;; ++ ++ -gas | --gas | --ga | --g) ++ # Obsolete; use --with-gas. ++ with_gas=yes ;; ++ ++ -help | --help | --hel | --he) ++ # Omit some internal or obsolete options to make the list less imposing. ++ # This message is too long to be a string in the A/UX 3.1 sh. ++ cat << EOF ++Usage: configure [options] [host] ++Options: [defaults in brackets after descriptions] ++Configuration: ++ --cache-file=FILE cache test results in FILE ++ --help print this message ++ --no-create do not create output files ++ --quiet, --silent do not print \`checking...' messages ++ --version print the version of autoconf that created configure ++Directory and file names: ++ --prefix=PREFIX install architecture-independent files in PREFIX ++ [$ac_default_prefix] ++ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX ++ [same as prefix] ++ --bindir=DIR user executables in DIR [EPREFIX/bin] ++ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] ++ --libexecdir=DIR program executables in DIR [EPREFIX/libexec] ++ --datadir=DIR read-only architecture-independent data in DIR ++ [PREFIX/share] ++ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] ++ --sharedstatedir=DIR modifiable architecture-independent data in DIR ++ [PREFIX/com] ++ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] ++ --libdir=DIR object code libraries in DIR [EPREFIX/lib] ++ --includedir=DIR C header files in DIR [PREFIX/include] ++ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] ++ --infodir=DIR info documentation in DIR [PREFIX/info] ++ --mandir=DIR man documentation in DIR [PREFIX/man] ++ --srcdir=DIR find the sources in DIR [configure dir or ..] ++ --program-prefix=PREFIX prepend PREFIX to installed program names ++ --program-suffix=SUFFIX append SUFFIX to installed program names ++ --program-transform-name=PROGRAM ++ run sed PROGRAM on installed program names ++EOF ++ cat << EOF ++Host type: ++ --build=BUILD configure for building on BUILD [BUILD=HOST] ++ --host=HOST configure for HOST [guessed] ++ --target=TARGET configure for TARGET [TARGET=HOST] ++Features and packages: ++ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) ++ --enable-FEATURE[=ARG] include FEATURE [ARG=yes] ++ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] ++ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) ++ --x-includes=DIR X include files are in DIR ++ --x-libraries=DIR X library files are in DIR ++EOF ++ if test -n "$ac_help"; then ++ echo "--enable and --with options recognized:$ac_help" ++ fi ++ exit 0 ;; ++ ++ -host | --host | --hos | --ho) ++ ac_prev=host ;; ++ -host=* | --host=* | --hos=* | --ho=*) ++ host="$ac_optarg" ;; ++ ++ -includedir | --includedir | --includedi | --included | --include \ ++ | --includ | --inclu | --incl | --inc) ++ ac_prev=includedir ;; ++ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ ++ | --includ=* | --inclu=* | --incl=* | --inc=*) ++ includedir="$ac_optarg" ;; ++ ++ -infodir | --infodir | --infodi | --infod | --info | --inf) ++ ac_prev=infodir ;; ++ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) ++ infodir="$ac_optarg" ;; ++ ++ -libdir | --libdir | --libdi | --libd) ++ ac_prev=libdir ;; ++ -libdir=* | --libdir=* | --libdi=* | --libd=*) ++ libdir="$ac_optarg" ;; ++ ++ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ ++ | --libexe | --libex | --libe) ++ ac_prev=libexecdir ;; ++ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ ++ | --libexe=* | --libex=* | --libe=*) ++ libexecdir="$ac_optarg" ;; ++ ++ -localstatedir | --localstatedir | --localstatedi | --localstated \ ++ | --localstate | --localstat | --localsta | --localst \ ++ | --locals | --local | --loca | --loc | --lo) ++ ac_prev=localstatedir ;; ++ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ ++ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ ++ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) ++ localstatedir="$ac_optarg" ;; ++ ++ -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ++ ac_prev=mandir ;; ++ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) ++ mandir="$ac_optarg" ;; ++ ++ -nfp | --nfp | --nf) ++ # Obsolete; use --without-fp. ++ with_fp=no ;; ++ ++ -no-create | --no-create | --no-creat | --no-crea | --no-cre \ ++ | --no-cr | --no-c) ++ no_create=yes ;; ++ ++ -no-recursion | --no-recursion | --no-recursio | --no-recursi \ ++ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ++ no_recursion=yes ;; ++ ++ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ ++ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ ++ | --oldin | --oldi | --old | --ol | --o) ++ ac_prev=oldincludedir ;; ++ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ ++ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ ++ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) ++ oldincludedir="$ac_optarg" ;; ++ ++ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ++ ac_prev=prefix ;; ++ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ++ prefix="$ac_optarg" ;; ++ ++ -program-prefix | --program-prefix | --program-prefi | --program-pref \ ++ | --program-pre | --program-pr | --program-p) ++ ac_prev=program_prefix ;; ++ -program-prefix=* | --program-prefix=* | --program-prefi=* \ ++ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) ++ program_prefix="$ac_optarg" ;; ++ ++ -program-suffix | --program-suffix | --program-suffi | --program-suff \ ++ | --program-suf | --program-su | --program-s) ++ ac_prev=program_suffix ;; ++ -program-suffix=* | --program-suffix=* | --program-suffi=* \ ++ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) ++ program_suffix="$ac_optarg" ;; ++ ++ -program-transform-name | --program-transform-name \ ++ | --program-transform-nam | --program-transform-na \ ++ | --program-transform-n | --program-transform- \ ++ | --program-transform | --program-transfor \ ++ | --program-transfo | --program-transf \ ++ | --program-trans | --program-tran \ ++ | --progr-tra | --program-tr | --program-t) ++ ac_prev=program_transform_name ;; ++ -program-transform-name=* | --program-transform-name=* \ ++ | --program-transform-nam=* | --program-transform-na=* \ ++ | --program-transform-n=* | --program-transform-=* \ ++ | --program-transform=* | --program-transfor=* \ ++ | --program-transfo=* | --program-transf=* \ ++ | --program-trans=* | --program-tran=* \ ++ | --progr-tra=* | --program-tr=* | --program-t=*) ++ program_transform_name="$ac_optarg" ;; ++ ++ -q | -quiet | --quiet | --quie | --qui | --qu | --q \ ++ | -silent | --silent | --silen | --sile | --sil) ++ silent=yes ;; ++ ++ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ++ ac_prev=sbindir ;; ++ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ ++ | --sbi=* | --sb=*) ++ sbindir="$ac_optarg" ;; ++ ++ -sharedstatedir | --sharedstatedir | --sharedstatedi \ ++ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ ++ | --sharedst | --shareds | --shared | --share | --shar \ ++ | --sha | --sh) ++ ac_prev=sharedstatedir ;; ++ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ ++ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ ++ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ ++ | --sha=* | --sh=*) ++ sharedstatedir="$ac_optarg" ;; ++ ++ -site | --site | --sit) ++ ac_prev=site ;; ++ -site=* | --site=* | --sit=*) ++ site="$ac_optarg" ;; ++ ++ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ++ ac_prev=srcdir ;; ++ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ++ srcdir="$ac_optarg" ;; ++ ++ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ ++ | --syscon | --sysco | --sysc | --sys | --sy) ++ ac_prev=sysconfdir ;; ++ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ ++ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) ++ sysconfdir="$ac_optarg" ;; ++ ++ -target | --target | --targe | --targ | --tar | --ta | --t) ++ ac_prev=target ;; ++ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) ++ target="$ac_optarg" ;; ++ ++ -v | -verbose | --verbose | --verbos | --verbo | --verb) ++ verbose=yes ;; ++ ++ -version | --version | --versio | --versi | --vers) ++ echo "configure generated by autoconf version 2.12" ++ exit 0 ;; ++ ++ -with-* | --with-*) ++ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` ++ # Reject names that are not valid shell variable names. ++ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then ++ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } ++ fi ++ ac_package=`echo $ac_package| sed 's/-/_/g'` ++ case "$ac_option" in ++ *=*) ;; ++ *) ac_optarg=yes ;; ++ esac ++ eval "with_${ac_package}='$ac_optarg'" ;; ++ ++ -without-* | --without-*) ++ ac_package=`echo $ac_option|sed -e 's/-*without-//'` ++ # Reject names that are not valid shell variable names. ++ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then ++ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } ++ fi ++ ac_package=`echo $ac_package| sed 's/-/_/g'` ++ eval "with_${ac_package}=no" ;; ++ ++ --x) ++ # Obsolete; use --with-x. ++ with_x=yes ;; ++ ++ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ ++ | --x-incl | --x-inc | --x-in | --x-i) ++ ac_prev=x_includes ;; ++ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ ++ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) ++ x_includes="$ac_optarg" ;; ++ ++ -x-libraries | --x-libraries | --x-librarie | --x-librari \ ++ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ++ ac_prev=x_libraries ;; ++ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ ++ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) ++ x_libraries="$ac_optarg" ;; ++ ++ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ++ ;; ++ ++ *) ++ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then ++ echo "configure: warning: $ac_option: invalid host type" 1>&2 ++ fi ++ if test "x$nonopt" != xNONE; then ++ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ++ fi ++ nonopt="$ac_option" ++ ;; ++ ++ esac ++done ++ ++if test -n "$ac_prev"; then ++ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } ++fi ++ ++trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 ++ ++# File descriptor usage: ++# 0 standard input ++# 1 file creation ++# 2 errors and warnings ++# 3 some systems may open it to /dev/tty ++# 4 used on the Kubota Titan ++# 6 checking for... messages and results ++# 5 compiler messages saved in config.log ++if test "$silent" = yes; then ++ exec 6>/dev/null ++else ++ exec 6>&1 ++fi ++exec 5>./config.log ++ ++echo "\ ++This file contains any messages produced by compilers while ++running configure, to aid debugging if configure makes a mistake. ++" 1>&5 ++ ++# Strip out --no-create and --no-recursion so they do not pile up. ++# Also quote any args containing shell metacharacters. ++ac_configure_args= ++for ac_arg ++do ++ case "$ac_arg" in ++ -no-create | --no-create | --no-creat | --no-crea | --no-cre \ ++ | --no-cr | --no-c) ;; ++ -no-recursion | --no-recursion | --no-recursio | --no-recursi \ ++ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; ++ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ++ ac_configure_args="$ac_configure_args '$ac_arg'" ;; ++ *) ac_configure_args="$ac_configure_args $ac_arg" ;; ++ esac ++done ++ ++# NLS nuisances. ++# Only set these to C if already set. These must not be set unconditionally ++# because not all systems understand e.g. LANG=C (notably SCO). ++# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! ++# Non-C LC_CTYPE values break the ctype check. ++if test "${LANG+set}" = set; then LANG=C; export LANG; fi ++if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi ++if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi ++if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi ++ ++# confdefs.h avoids OS command line length limits that DEFS can exceed. ++rm -rf conftest* confdefs.h ++# AIX cpp loses on an empty file, so make sure it contains at least a newline. ++echo > confdefs.h ++ ++# A filename unique to this package, relative to the directory that ++# configure is in, which we can look for to find out if srcdir is correct. ++ac_unique_file=bucket/newbucket.cxx ++ ++# Find the source files, if location was not specified. ++if test -z "$srcdir"; then ++ ac_srcdir_defaulted=yes ++ # Try the directory containing this script, then its parent. ++ ac_prog=$0 ++ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` ++ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. ++ srcdir=$ac_confdir ++ if test ! -r $srcdir/$ac_unique_file; then ++ srcdir=.. ++ fi ++else ++ ac_srcdir_defaulted=no ++fi ++if test ! -r $srcdir/$ac_unique_file; then ++ if test "$ac_srcdir_defaulted" = yes; then ++ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } ++ else ++ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } ++ fi ++fi ++srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` ++ ++# Prefer explicitly selected file to automatically selected ones. ++if test -z "$CONFIG_SITE"; then ++ if test "x$prefix" != xNONE; then ++ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" ++ else ++ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" ++ fi ++fi ++for ac_site_file in $CONFIG_SITE; do ++ if test -r "$ac_site_file"; then ++ echo "loading site script $ac_site_file" ++ . "$ac_site_file" ++ fi ++done ++ ++if test -r "$cache_file"; then ++ echo "loading cache $cache_file" ++ . $cache_file ++else ++ echo "creating cache $cache_file" ++ > $cache_file ++fi ++ ++ac_ext=c ++# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ++ac_cpp='$CPP $CPPFLAGS' ++ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ++ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' ++cross_compiling=$ac_cv_prog_cc_cross ++ ++if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then ++ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. ++ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ++ ac_n= ac_c=' ++' ac_t=' ' ++ else ++ ac_n=-n ac_c= ac_t= ++ fi ++else ++ ac_n= ac_c='\c' ac_t= ++fi ++ ++ ++ ++ac_aux_dir= ++for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do ++ if test -f $ac_dir/install-sh; then ++ ac_aux_dir=$ac_dir ++ ac_install_sh="$ac_aux_dir/install-sh -c" ++ break ++ elif test -f $ac_dir/install.sh; then ++ ac_aux_dir=$ac_dir ++ ac_install_sh="$ac_aux_dir/install.sh -c" ++ break ++ fi ++done ++if test -z "$ac_aux_dir"; then ++ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } ++fi ++ac_config_guess=$ac_aux_dir/config.guess ++ac_config_sub=$ac_aux_dir/config.sub ++ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. ++ ++# Find a good install program. We prefer a C program (faster), ++# so one script is as good as another. But avoid the broken or ++# incompatible versions: ++# SysV /etc/install, /usr/sbin/install ++# SunOS /usr/etc/install ++# IRIX /sbin/install ++# AIX /bin/install ++# AFS /usr/afsws/bin/install, which mishandles nonexistent args ++# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" ++# ./install, which can be erroneously created by make from ./install.sh. ++echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 ++echo "configure:559: checking for a BSD compatible install" >&5 ++if test -z "$INSTALL"; then ++if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" ++ for ac_dir in $PATH; do ++ # Account for people who put trailing slashes in PATH elements. ++ case "$ac_dir/" in ++ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; ++ *) ++ # OSF1 and SCO ODT 3.0 have their own names for install. ++ for ac_prog in ginstall installbsd scoinst install; do ++ if test -f $ac_dir/$ac_prog; then ++ if test $ac_prog = install && ++ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then ++ # AIX install. It has an incompatible calling convention. ++ # OSF/1 installbsd also uses dspmsg, but is usable. ++ : ++ else ++ ac_cv_path_install="$ac_dir/$ac_prog -c" ++ break 2 ++ fi ++ fi ++ done ++ ;; ++ esac ++ done ++ IFS="$ac_save_IFS" ++ ++fi ++ if test "${ac_cv_path_install+set}" = set; then ++ INSTALL="$ac_cv_path_install" ++ else ++ # As a last resort, use the slow shell script. We don't cache a ++ # path for INSTALL within a source directory, because that will ++ # break other packages using the cache if that directory is ++ # removed, or if the path is relative. ++ INSTALL="$ac_install_sh" ++ fi ++fi ++echo "$ac_t""$INSTALL" 1>&6 ++ ++# Use test -z because SunOS4 sh mishandles braces in ${var-val}. ++# It thinks the first close brace ends the variable substitution. ++test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' ++ ++test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' ++ ++ ++test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' ++ ++echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 ++echo "configure:612: checking whether build environment is sane" >&5 ++# Just in case ++sleep 1 ++echo timestamp > conftestfile ++# Do `set' in a subshell so we don't clobber the current shell's ++# arguments. Must try -L first in case configure is actually a ++# symlink; some systems play weird games with the mod time of symlinks ++# (eg FreeBSD returns the mod time of the symlink's containing ++# directory). ++if ( ++ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` ++ if test "$*" = "X"; then ++ # -L didn't work. ++ set X `ls -t $srcdir/configure conftestfile` ++ fi ++ if test "$*" != "X $srcdir/configure conftestfile" \ ++ && test "$*" != "X conftestfile $srcdir/configure"; then ++ ++ # If neither matched, then we have a broken ls. This can happen ++ # if, for instance, CONFIG_SHELL is bash and it inherits a ++ # broken ls alias from the environment. This has actually ++ # happened. Such a system could not be considered "sane". ++ { echo "configure: error: ls -t appears to fail. Make sure there is not a broken ++alias in your environment" 1>&2; exit 1; } ++ fi ++ ++ test "$2" = conftestfile ++ ) ++then ++ # Ok. ++ : ++else ++ { echo "configure: error: newly created file is older than distributed files! ++Check your system clock" 1>&2; exit 1; } ++fi ++rm -f conftest* ++echo "$ac_t""yes" 1>&6 ++if test "$program_transform_name" = s,x,x,; then ++ program_transform_name= ++else ++ # Double any \ or $. echo might interpret backslashes. ++ cat <<\EOF_SED > conftestsed ++s,\\,\\\\,g; s,\$,$$,g ++EOF_SED ++ program_transform_name="`echo $program_transform_name|sed -f conftestsed`" ++ rm -f conftestsed ++fi ++test "$program_prefix" != NONE && ++ program_transform_name="s,^,${program_prefix},; $program_transform_name" ++# Use a double $ so make ignores it. ++test "$program_suffix" != NONE && ++ program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" ++ ++# sed with no file args requires a program. ++test "$program_transform_name" = "" && program_transform_name="s,x,x," ++ ++echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 ++echo "configure:669: checking whether ${MAKE-make} sets \${MAKE}" >&5 ++set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftestmake <<\EOF ++all: ++ @echo 'ac_maketemp="${MAKE}"' ++EOF ++# GNU make sometimes prints "make[1]: Entering...", which would confuse us. ++eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` ++if test -n "$ac_maketemp"; then ++ eval ac_cv_prog_make_${ac_make}_set=yes ++else ++ eval ac_cv_prog_make_${ac_make}_set=no ++fi ++rm -f conftestmake ++fi ++if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ SET_MAKE= ++else ++ echo "$ac_t""no" 1>&6 ++ SET_MAKE="MAKE=${MAKE-make}" ++fi ++ ++ ++PACKAGE=SimGear ++ ++VERSION=0.0.0 ++ ++if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then ++ { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } ++fi ++cat >> confdefs.h <> confdefs.h <&6 ++echo "configure:715: checking for working aclocal" >&5 ++# Run test in a subshell; some versions of sh will print an error if ++# an executable is not found, even if stderr is redirected. ++# Redirect stdin to placate older versions of autoconf. Sigh. ++if (aclocal --version) < /dev/null > /dev/null 2>&1; then ++ ACLOCAL=aclocal ++ echo "$ac_t""found" 1>&6 ++else ++ ACLOCAL="$missing_dir/missing aclocal" ++ echo "$ac_t""missing" 1>&6 ++fi ++ ++echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 ++echo "configure:728: checking for working autoconf" >&5 ++# Run test in a subshell; some versions of sh will print an error if ++# an executable is not found, even if stderr is redirected. ++# Redirect stdin to placate older versions of autoconf. Sigh. ++if (autoconf --version) < /dev/null > /dev/null 2>&1; then ++ AUTOCONF=autoconf ++ echo "$ac_t""found" 1>&6 ++else ++ AUTOCONF="$missing_dir/missing autoconf" ++ echo "$ac_t""missing" 1>&6 ++fi ++ ++echo $ac_n "checking for working automake""... $ac_c" 1>&6 ++echo "configure:741: checking for working automake" >&5 ++# Run test in a subshell; some versions of sh will print an error if ++# an executable is not found, even if stderr is redirected. ++# Redirect stdin to placate older versions of autoconf. Sigh. ++if (automake --version) < /dev/null > /dev/null 2>&1; then ++ AUTOMAKE=automake ++ echo "$ac_t""found" 1>&6 ++else ++ AUTOMAKE="$missing_dir/missing automake" ++ echo "$ac_t""missing" 1>&6 ++fi ++ ++echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 ++echo "configure:754: checking for working autoheader" >&5 ++# Run test in a subshell; some versions of sh will print an error if ++# an executable is not found, even if stderr is redirected. ++# Redirect stdin to placate older versions of autoconf. Sigh. ++if (autoheader --version) < /dev/null > /dev/null 2>&1; then ++ AUTOHEADER=autoheader ++ echo "$ac_t""found" 1>&6 ++else ++ AUTOHEADER="$missing_dir/missing autoheader" ++ echo "$ac_t""missing" 1>&6 ++fi ++ ++echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 ++echo "configure:767: checking for working makeinfo" >&5 ++# Run test in a subshell; some versions of sh will print an error if ++# an executable is not found, even if stderr is redirected. ++# Redirect stdin to placate older versions of autoconf. Sigh. ++if (makeinfo --version) < /dev/null > /dev/null 2>&1; then ++ MAKEINFO=makeinfo ++ echo "$ac_t""found" 1>&6 ++else ++ MAKEINFO="$missing_dir/missing makeinfo" ++ echo "$ac_t""missing" 1>&6 ++fi ++ ++ ++ ++echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 ++echo "configure:782: checking whether ${MAKE-make} sets \${MAKE}" >&5 ++set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftestmake <<\EOF ++all: ++ @echo 'ac_maketemp="${MAKE}"' ++EOF ++# GNU make sometimes prints "make[1]: Entering...", which would confuse us. ++eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` ++if test -n "$ac_maketemp"; then ++ eval ac_cv_prog_make_${ac_make}_set=yes ++else ++ eval ac_cv_prog_make_${ac_make}_set=no ++fi ++rm -f conftestmake ++fi ++if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ SET_MAKE= ++else ++ echo "$ac_t""no" 1>&6 ++ SET_MAKE="MAKE=${MAKE-make}" ++fi ++ ++# Extract the first word of "gcc", so it can be a program name with args. ++set dummy gcc; ac_word=$2 ++echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ++echo "configure:811: checking for $ac_word" >&5 ++if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ if test -n "$CC"; then ++ ac_cv_prog_CC="$CC" # Let the user override the test. ++else ++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" ++ for ac_dir in $PATH; do ++ test -z "$ac_dir" && ac_dir=. ++ if test -f $ac_dir/$ac_word; then ++ ac_cv_prog_CC="gcc" ++ break ++ fi ++ done ++ IFS="$ac_save_ifs" ++fi ++fi ++CC="$ac_cv_prog_CC" ++if test -n "$CC"; then ++ echo "$ac_t""$CC" 1>&6 ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++if test -z "$CC"; then ++ # Extract the first word of "cc", so it can be a program name with args. ++set dummy cc; ac_word=$2 ++echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ++echo "configure:840: checking for $ac_word" >&5 ++if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ if test -n "$CC"; then ++ ac_cv_prog_CC="$CC" # Let the user override the test. ++else ++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" ++ ac_prog_rejected=no ++ for ac_dir in $PATH; do ++ test -z "$ac_dir" && ac_dir=. ++ if test -f $ac_dir/$ac_word; then ++ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ++ ac_prog_rejected=yes ++ continue ++ fi ++ ac_cv_prog_CC="cc" ++ break ++ fi ++ done ++ IFS="$ac_save_ifs" ++if test $ac_prog_rejected = yes; then ++ # We found a bogon in the path, so make sure we never use it. ++ set dummy $ac_cv_prog_CC ++ shift ++ if test $# -gt 0; then ++ # We chose a different compiler from the bogus one. ++ # However, it has the same basename, so the bogon will be chosen ++ # first if we set CC to just the basename; use the full file name. ++ shift ++ set dummy "$ac_dir/$ac_word" "$@" ++ shift ++ ac_cv_prog_CC="$@" ++ fi ++fi ++fi ++fi ++CC="$ac_cv_prog_CC" ++if test -n "$CC"; then ++ echo "$ac_t""$CC" 1>&6 ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } ++fi ++ ++echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 ++echo "configure:888: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ++ ++ac_ext=c ++# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ++ac_cpp='$CPP $CPPFLAGS' ++ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ++ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' ++cross_compiling=$ac_cv_prog_cc_cross ++ ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ ac_cv_prog_cc_works=yes ++ # If we can't run a trivial program, we are probably using a cross compiler. ++ if (./conftest; exit) 2>/dev/null; then ++ ac_cv_prog_cc_cross=no ++ else ++ ac_cv_prog_cc_cross=yes ++ fi ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ ac_cv_prog_cc_works=no ++fi ++rm -fr conftest* ++ ++echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 ++if test $ac_cv_prog_cc_works = no; then ++ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } ++fi ++echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 ++echo "configure:922: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 ++echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 ++cross_compiling=$ac_cv_prog_cc_cross ++ ++echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 ++echo "configure:927: checking whether we are using GNU C" >&5 ++if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ++ ac_cv_prog_gcc=yes ++else ++ ac_cv_prog_gcc=no ++fi ++fi ++ ++echo "$ac_t""$ac_cv_prog_gcc" 1>&6 ++ ++if test $ac_cv_prog_gcc = yes; then ++ GCC=yes ++ ac_test_CFLAGS="${CFLAGS+set}" ++ ac_save_CFLAGS="$CFLAGS" ++ CFLAGS= ++ echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 ++echo "configure:951: checking whether ${CC-cc} accepts -g" >&5 ++if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ echo 'void f(){}' > conftest.c ++if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ++ ac_cv_prog_cc_g=yes ++else ++ ac_cv_prog_cc_g=no ++fi ++rm -f conftest* ++ ++fi ++ ++echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 ++ if test "$ac_test_CFLAGS" = set; then ++ CFLAGS="$ac_save_CFLAGS" ++ elif test $ac_cv_prog_cc_g = yes; then ++ CFLAGS="-g -O2" ++ else ++ CFLAGS="-O2" ++ fi ++else ++ GCC= ++ test "${CFLAGS+set}" = set || CFLAGS="-g" ++fi ++ ++for ac_prog in $CCC c++ g++ gcc CC cxx cc++ ++do ++# Extract the first word of "$ac_prog", so it can be a program name with args. ++set dummy $ac_prog; ac_word=$2 ++echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ++echo "configure:983: checking for $ac_word" >&5 ++if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ if test -n "$CXX"; then ++ ac_cv_prog_CXX="$CXX" # Let the user override the test. ++else ++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" ++ for ac_dir in $PATH; do ++ test -z "$ac_dir" && ac_dir=. ++ if test -f $ac_dir/$ac_word; then ++ ac_cv_prog_CXX="$ac_prog" ++ break ++ fi ++ done ++ IFS="$ac_save_ifs" ++fi ++fi ++CXX="$ac_cv_prog_CXX" ++if test -n "$CXX"; then ++ echo "$ac_t""$CXX" 1>&6 ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++test -n "$CXX" && break ++done ++test -n "$CXX" || CXX="gcc" ++ ++ ++echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 ++echo "configure:1014: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ++ ++ac_ext=C ++# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ++ac_cpp='$CXXCPP $CPPFLAGS' ++ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ++ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' ++cross_compiling=$ac_cv_prog_cxx_cross ++ ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ ac_cv_prog_cxx_works=yes ++ # If we can't run a trivial program, we are probably using a cross compiler. ++ if (./conftest; exit) 2>/dev/null; then ++ ac_cv_prog_cxx_cross=no ++ else ++ ac_cv_prog_cxx_cross=yes ++ fi ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ ac_cv_prog_cxx_works=no ++fi ++rm -fr conftest* ++ac_ext=c ++# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ++ac_cpp='$CPP $CPPFLAGS' ++ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ++ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' ++cross_compiling=$ac_cv_prog_cc_cross ++ ++echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 ++if test $ac_cv_prog_cxx_works = no; then ++ { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } ++fi ++echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 ++echo "configure:1054: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 ++echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 ++cross_compiling=$ac_cv_prog_cxx_cross ++ ++echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 ++echo "configure:1059: checking whether we are using GNU C++" >&5 ++if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ++ ac_cv_prog_gxx=yes ++else ++ ac_cv_prog_gxx=no ++fi ++fi ++ ++echo "$ac_t""$ac_cv_prog_gxx" 1>&6 ++ ++if test $ac_cv_prog_gxx = yes; then ++ GXX=yes ++ ac_test_CXXFLAGS="${CXXFLAGS+set}" ++ ac_save_CXXFLAGS="$CXXFLAGS" ++ CXXFLAGS= ++ echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 ++echo "configure:1083: checking whether ${CXX-g++} accepts -g" >&5 ++if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ echo 'void f(){}' > conftest.cc ++if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then ++ ac_cv_prog_cxx_g=yes ++else ++ ac_cv_prog_cxx_g=no ++fi ++rm -f conftest* ++ ++fi ++ ++echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 ++ if test "$ac_test_CXXFLAGS" = set; then ++ CXXFLAGS="$ac_save_CXXFLAGS" ++ elif test $ac_cv_prog_cxx_g = yes; then ++ CXXFLAGS="-g -O2" ++ else ++ CXXFLAGS="-O2" ++ fi ++else ++ GXX= ++ test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" ++fi ++ ++# Extract the first word of "ranlib", so it can be a program name with args. ++set dummy ranlib; ac_word=$2 ++echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ++echo "configure:1113: checking for $ac_word" >&5 ++if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ if test -n "$RANLIB"; then ++ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. ++else ++ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" ++ for ac_dir in $PATH; do ++ test -z "$ac_dir" && ac_dir=. ++ if test -f $ac_dir/$ac_word; then ++ ac_cv_prog_RANLIB="ranlib" ++ break ++ fi ++ done ++ IFS="$ac_save_ifs" ++ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" ++fi ++fi ++RANLIB="$ac_cv_prog_RANLIB" ++if test -n "$RANLIB"; then ++ echo "$ac_t""$RANLIB" 1>&6 ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++# Find a good install program. We prefer a C program (faster), ++# so one script is as good as another. But avoid the broken or ++# incompatible versions: ++# SysV /etc/install, /usr/sbin/install ++# SunOS /usr/etc/install ++# IRIX /sbin/install ++# AIX /bin/install ++# AFS /usr/afsws/bin/install, which mishandles nonexistent args ++# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" ++# ./install, which can be erroneously created by make from ./install.sh. ++echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 ++echo "configure:1150: checking for a BSD compatible install" >&5 ++if test -z "$INSTALL"; then ++if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" ++ for ac_dir in $PATH; do ++ # Account for people who put trailing slashes in PATH elements. ++ case "$ac_dir/" in ++ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; ++ *) ++ # OSF1 and SCO ODT 3.0 have their own names for install. ++ for ac_prog in ginstall installbsd scoinst install; do ++ if test -f $ac_dir/$ac_prog; then ++ if test $ac_prog = install && ++ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then ++ # AIX install. It has an incompatible calling convention. ++ # OSF/1 installbsd also uses dspmsg, but is usable. ++ : ++ else ++ ac_cv_path_install="$ac_dir/$ac_prog -c" ++ break 2 ++ fi ++ fi ++ done ++ ;; ++ esac ++ done ++ IFS="$ac_save_IFS" ++ ++fi ++ if test "${ac_cv_path_install+set}" = set; then ++ INSTALL="$ac_cv_path_install" ++ else ++ # As a last resort, use the slow shell script. We don't cache a ++ # path for INSTALL within a source directory, because that will ++ # break other packages using the cache if that directory is ++ # removed, or if the path is relative. ++ INSTALL="$ac_install_sh" ++ fi ++fi ++echo "$ac_t""$INSTALL" 1>&6 ++ ++# Use test -z because SunOS4 sh mishandles braces in ${var-val}. ++# It thinks the first close brace ends the variable substitution. ++test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' ++ ++test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' ++ ++echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 ++echo "configure:1200: checking whether ln -s works" >&5 ++if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ rm -f conftestdata ++if ln -s X conftestdata 2>/dev/null ++then ++ rm -f conftestdata ++ ac_cv_prog_LN_S="ln -s" ++else ++ ac_cv_prog_LN_S=ln ++fi ++fi ++LN_S="$ac_cv_prog_LN_S" ++if test "$ac_cv_prog_LN_S" = "ln -s"; then ++ echo "$ac_t""yes" 1>&6 ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ ++if echo $includedir | egrep "simgear$" > /dev/null; then ++ echo "includedir is" $includedir "libdir is" $libdir ++else ++ includedir="${includedir}/simgear" ++ echo "includedir changed to" $includedir "libdir is" $libdir ++fi ++ ++ ++# set logging default value ++# with_logging=yes ++# Check whether --with-logging or --without-logging was given. ++if test "${with_logging+set}" = set; then ++ withval="$with_logging" ++ : ++fi ++ ++if test "x$with_logging" = "xno" ; then ++ cat >> confdefs.h <<\EOF ++#define FG_NDEBUG 1 ++EOF ++ ++fi ++ ++# Check whether --with-efence or --without-efence was given. ++if test "${with_efence+set}" = set; then ++ withval="$with_efence" ++ : ++fi ++ ++ ++if test "x$with_efence" = "xyes" ; then ++ echo "Building with efence" ++ LIBS= "$LIBS -lefence" ++fi ++ ++echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 ++echo "configure:1257: checking how to run the C preprocessor" >&5 ++# On Suns, sometimes $CPP names a directory. ++if test -n "$CPP" && test -d "$CPP"; then ++ CPP= ++fi ++if test -z "$CPP"; then ++if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ # This must be in double quotes, not single quotes, because CPP may get ++ # substituted into the Makefile and "${CC-cc}" will confuse make. ++ CPP="${CC-cc} -E" ++ # On the NeXT, cc -E runs the code through the compiler's parser, ++ # not just through cpp. ++ cat > conftest.$ac_ext < ++Syntax Error ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:1278: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out` ++if test -z "$ac_err"; then ++ : ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ CPP="${CC-cc} -E -traditional-cpp" ++ cat > conftest.$ac_ext < ++Syntax Error ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:1295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out` ++if test -z "$ac_err"; then ++ : ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ CPP=/lib/cpp ++fi ++rm -f conftest* ++fi ++rm -f conftest* ++ ac_cv_prog_CPP="$CPP" ++fi ++ CPP="$ac_cv_prog_CPP" ++else ++ ac_cv_prog_CPP="$CPP" ++fi ++echo "$ac_t""$CPP" 1>&6 ++ ++ac_safe=`echo "windows.h" | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for windows.h""... $ac_c" 1>&6 ++echo "configure:1319: checking for windows.h" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:1329: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=yes" ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=no" ++fi ++rm -f conftest* ++fi ++if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ : ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ ++EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6" ++ ++if test -d /opt/X11R6 ; then ++ EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6" ++fi ++ ++if test "x$ac_cv_header_windows_h" = "xyes" ; then ++ EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32" ++# elif test `uname -s` = "SunOS" ; then ++# EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS" ++fi ++echo "checking for extra include and lib directories..." 1>&6 ++exdirs="$prefix ${EXTRA_DIRS}" ++ ++subexdirs="" ++if test "$subexdirs" = "" ; then ++ subexdirs="-" ++fi ++for subexdir in $subexdirs ; do ++if test "$subexdir" = "-" ; then ++ subexdir="" ++else ++ subexdir="/$subexdir" ++fi ++for exdir in $exdirs ; do ++ if test "$exdir" != "/usr" || test "$subexdir" != ""; then ++ incdir="${exdir}/include${subexdir}" ++ ++incdir="$incdir" ++if test -r $incdir ; then ++ case "$CPPFLAGS" in ++ *-I${incdir}*) ++ # echo " + already had $incdir" 1>&6 ++ ;; ++ *) ++ if test "$CPPFLAGS" = "" ; then ++ CPPFLAGS="-I$incdir" ++ else ++ CPPFLAGS="$CPPFLAGS -I$incdir" ++ fi ++ echo " + found $incdir" 1>&6 ++ ;; ++ esac ++fi ++ ++ ++ mylibdir="${exdir}/lib${subexdir}" ++ ++mylibdir="$mylibdir" ++if test -r $mylibdir ; then ++ case "$LDFLAGS" in ++ *-L${mylibdir}*) ++ # echo " + already had $mylibdir" 1>&6 ++ ;; ++ *) ++ if test "$LDFLAGS" = "" ; then ++ LDFLAGS="-L$mylibdir" ++ else ++ LDFLAGS="$LDFLAGS -L$mylibdir" ++ fi ++ echo " + found $mylibdir" 1>&6 ++ ;; ++ esac ++fi ++ ++ ++ progdir="${exdir}/bin${subexdirr}" ++ ++progdir="$progdir" ++if test -r $progdir ; then ++ case "$PATH" in ++ *:${progdir}*) ++ # echo " + already had $progdir" 1>&6 ++ ;; ++ *${progdir}:*) ++ # echo " + already had $progdir" 1>&6 ++ ;; ++ *) ++ if test "$PATH" = "" ; then ++ PATH="$progdir" ++ else ++ PATH="$PATH:$progdir" ++ fi ++ echo " + found $progdir" 1>&6 ++ ;; ++ esac ++fi ++ ++ fi ++done ++done ++ ++ ++ ++ ++ ++if true; then ++ ENABLE_UNIX_SERIAL_TRUE= ++ ENABLE_UNIX_SERIAL_FALSE='#' ++else ++ ENABLE_UNIX_SERIAL_TRUE='#' ++ ENABLE_UNIX_SERIAL_FALSE= ++fi ++ ++# If we find X, set shell vars x_includes and x_libraries to the ++# paths, otherwise set no_x=yes. ++# Uses ac_ vars as temps to allow command line to override cache and checks. ++# --without-x overrides everything else, but does not touch the cache. ++echo $ac_n "checking for X""... $ac_c" 1>&6 ++echo "configure:1460: checking for X" >&5 ++ ++# Check whether --with-x or --without-x was given. ++if test "${with_x+set}" = set; then ++ withval="$with_x" ++ : ++fi ++ ++# $have_x is `yes', `no', `disabled', or empty when we do not yet know. ++if test "x$with_x" = xno; then ++ # The user explicitly disabled X. ++ have_x=disabled ++else ++ if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then ++ # Both variables are already set. ++ have_x=yes ++ else ++if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ # One or both of the vars are not set, and there is no cached value. ++ac_x_includes=NO ac_x_libraries=NO ++rm -fr conftestdir ++if mkdir conftestdir; then ++ cd conftestdir ++ # Make sure to not put "make" in the Imakefile rules, since we grep it out. ++ cat > Imakefile <<'EOF' ++acfindx: ++ @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' ++EOF ++ if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then ++ # GNU make sometimes prints "make[1]: Entering...", which would confuse us. ++ eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` ++ # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. ++ for ac_extension in a so sl; do ++ if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && ++ test -f $ac_im_libdir/libX11.$ac_extension; then ++ ac_im_usrlibdir=$ac_im_libdir; break ++ fi ++ done ++ # Screen out bogus values from the imake configuration. They are ++ # bogus both because they are the default anyway, and because ++ # using them would break gcc on systems where it needs fixed includes. ++ case "$ac_im_incroot" in ++ /usr/include) ;; ++ *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; ++ esac ++ case "$ac_im_usrlibdir" in ++ /usr/lib | /lib) ;; ++ *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; ++ esac ++ fi ++ cd .. ++ rm -fr conftestdir ++fi ++ ++if test "$ac_x_includes" = NO; then ++ # Guess where to find include files, by looking for this one X11 .h file. ++ test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h ++ ++ # First, try using that file with no special directory specified. ++cat > conftest.$ac_ext < ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:1527: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ # We can compile using X headers with no special include directory. ++ac_x_includes= ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ # Look for the header file in a standard set of common directories. ++# Check X11 before X11Rn because it is often a symlink to the current release. ++ for ac_dir in \ ++ /usr/X11/include \ ++ /usr/X11R6/include \ ++ /usr/X11R5/include \ ++ /usr/X11R4/include \ ++ \ ++ /usr/include/X11 \ ++ /usr/include/X11R6 \ ++ /usr/include/X11R5 \ ++ /usr/include/X11R4 \ ++ \ ++ /usr/local/X11/include \ ++ /usr/local/X11R6/include \ ++ /usr/local/X11R5/include \ ++ /usr/local/X11R4/include \ ++ \ ++ /usr/local/include/X11 \ ++ /usr/local/include/X11R6 \ ++ /usr/local/include/X11R5 \ ++ /usr/local/include/X11R4 \ ++ \ ++ /usr/X386/include \ ++ /usr/x386/include \ ++ /usr/XFree86/include/X11 \ ++ \ ++ /usr/include \ ++ /usr/local/include \ ++ /usr/unsupported/include \ ++ /usr/athena/include \ ++ /usr/local/x11r5/include \ ++ /usr/lpp/Xamples/include \ ++ \ ++ /usr/openwin/include \ ++ /usr/openwin/share/include \ ++ ; \ ++ do ++ if test -r "$ac_dir/$x_direct_test_include"; then ++ ac_x_includes=$ac_dir ++ break ++ fi ++ done ++fi ++rm -f conftest* ++fi # $ac_x_includes = NO ++ ++if test "$ac_x_libraries" = NO; then ++ # Check for the libraries. ++ ++ test -z "$x_direct_test_library" && x_direct_test_library=Xt ++ test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc ++ ++ # See if we find them without any special options. ++ # Don't add to $LIBS permanently. ++ ac_save_LIBS="$LIBS" ++ LIBS="-l$x_direct_test_library $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ LIBS="$ac_save_LIBS" ++# We can link X programs with no special library path. ++ac_x_libraries= ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ LIBS="$ac_save_LIBS" ++# First see if replacing the include by lib works. ++# Check X11 before X11Rn because it is often a symlink to the current release. ++for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ ++ /usr/X11/lib \ ++ /usr/X11R6/lib \ ++ /usr/X11R5/lib \ ++ /usr/X11R4/lib \ ++ \ ++ /usr/lib/X11 \ ++ /usr/lib/X11R6 \ ++ /usr/lib/X11R5 \ ++ /usr/lib/X11R4 \ ++ \ ++ /usr/local/X11/lib \ ++ /usr/local/X11R6/lib \ ++ /usr/local/X11R5/lib \ ++ /usr/local/X11R4/lib \ ++ \ ++ /usr/local/lib/X11 \ ++ /usr/local/lib/X11R6 \ ++ /usr/local/lib/X11R5 \ ++ /usr/local/lib/X11R4 \ ++ \ ++ /usr/X386/lib \ ++ /usr/x386/lib \ ++ /usr/XFree86/lib/X11 \ ++ \ ++ /usr/lib \ ++ /usr/local/lib \ ++ /usr/unsupported/lib \ ++ /usr/athena/lib \ ++ /usr/local/x11r5/lib \ ++ /usr/lpp/Xamples/lib \ ++ /lib/usr/lib/X11 \ ++ \ ++ /usr/openwin/lib \ ++ /usr/openwin/share/lib \ ++ ; \ ++do ++ for ac_extension in a so sl; do ++ if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then ++ ac_x_libraries=$ac_dir ++ break 2 ++ fi ++ done ++done ++fi ++rm -f conftest* ++fi # $ac_x_libraries = NO ++ ++if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then ++ # Didn't find X anywhere. Cache the known absence of X. ++ ac_cv_have_x="have_x=no" ++else ++ # Record where we found X for the cache. ++ ac_cv_have_x="have_x=yes \ ++ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" ++fi ++fi ++ fi ++ eval "$ac_cv_have_x" ++fi # $with_x != no ++ ++if test "$have_x" != yes; then ++ echo "$ac_t""$have_x" 1>&6 ++ no_x=yes ++else ++ # If each of the values was on the command line, it overrides each guess. ++ test "x$x_includes" = xNONE && x_includes=$ac_x_includes ++ test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries ++ # Update the cache value to reflect the command line values. ++ ac_cv_have_x="have_x=yes \ ++ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" ++ echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 ++fi ++ ++if test "$no_x" = yes; then ++ # Not all programs may use this symbol, but it does not hurt to define it. ++ cat >> confdefs.h <<\EOF ++#define X_DISPLAY_MISSING 1 ++EOF ++ ++ X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= ++else ++ if test -n "$x_includes"; then ++ X_CFLAGS="$X_CFLAGS -I$x_includes" ++ fi ++ ++ # It would also be nice to do this for all -L options, not just this one. ++ if test -n "$x_libraries"; then ++ X_LIBS="$X_LIBS -L$x_libraries" ++ # For Solaris; some versions of Sun CC require a space after -R and ++ # others require no space. Words are not sufficient . . . . ++ case "`(uname -sr) 2>/dev/null`" in ++ "SunOS 5"*) ++ echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 ++echo "configure:1709: checking whether -R must be followed by a space" >&5 ++ ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" ++ cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ ac_R_nospace=yes ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ ac_R_nospace=no ++fi ++rm -f conftest* ++ if test $ac_R_nospace = yes; then ++ echo "$ac_t""no" 1>&6 ++ X_LIBS="$X_LIBS -R$x_libraries" ++ else ++ LIBS="$ac_xsave_LIBS -R $x_libraries" ++ cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ ac_R_space=yes ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ ac_R_space=no ++fi ++rm -f conftest* ++ if test $ac_R_space = yes; then ++ echo "$ac_t""yes" 1>&6 ++ X_LIBS="$X_LIBS -R $x_libraries" ++ else ++ echo "$ac_t""neither works" 1>&6 ++ fi ++ fi ++ LIBS="$ac_xsave_LIBS" ++ esac ++ fi ++ ++ # Check for system-dependent libraries X programs must link with. ++ # Do this before checking for the system-independent R6 libraries ++ # (-lICE), since we may need -lsocket or whatever for X linking. ++ ++ if test "$ISC" = yes; then ++ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" ++ else ++ # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X ++ # libraries were built with DECnet support. And karl@cs.umb.edu says ++ # the Alpha needs dnet_stub (dnet does not exist). ++ echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 ++echo "configure:1774: checking for dnet_ntoa in -ldnet" >&5 ++ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-ldnet $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ if test $ac_cv_lib_dnet_dnet_ntoa = no; then ++ echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 ++echo "configure:1815: checking for dnet_ntoa in -ldnet_stub" >&5 ++ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-ldnet_stub $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ fi ++ ++ # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, ++ # to get the SysV transport functions. ++ # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) ++ # needs -lnsl. ++ # The nsl library prevents programs from opening the X display ++ # on Irix 5.2, according to dickey@clark.net. ++ echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 ++echo "configure:1863: checking for gethostbyname" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char gethostbyname(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) ++choke me ++#else ++gethostbyname(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:1891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_func_gethostbyname=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_gethostbyname=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ : ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ if test $ac_cv_func_gethostbyname = no; then ++ echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 ++echo "configure:1912: checking for gethostbyname in -lnsl" >&5 ++ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lnsl $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ fi ++ ++ # lieder@skyler.mavd.honeywell.com says without -lsocket, ++ # socket/setsockopt and other routines are undefined under SCO ODT ++ # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary ++ # on later versions), says simon@lia.di.epfl.ch: it contains ++ # gethostby* variants that don't use the nameserver (or something). ++ # -lsocket must be given before -lnsl if both are needed. ++ # We assume that if connect needs -lnsl, so does gethostbyname. ++ echo $ac_n "checking for connect""... $ac_c" 1>&6 ++echo "configure:1961: checking for connect" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char connect(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_connect) || defined (__stub___connect) ++choke me ++#else ++connect(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:1989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_func_connect=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_connect=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ : ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ if test $ac_cv_func_connect = no; then ++ echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 ++echo "configure:2010: checking for connect in -lsocket" >&5 ++ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lsocket $X_EXTRA_LIBS $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ fi ++ ++ # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. ++ echo $ac_n "checking for remove""... $ac_c" 1>&6 ++echo "configure:2053: checking for remove" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char remove(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_remove) || defined (__stub___remove) ++choke me ++#else ++remove(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:2081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_func_remove=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_remove=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ : ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ if test $ac_cv_func_remove = no; then ++ echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 ++echo "configure:2102: checking for remove in -lposix" >&5 ++ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lposix $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ fi ++ ++ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. ++ echo $ac_n "checking for shmat""... $ac_c" 1>&6 ++echo "configure:2145: checking for shmat" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char shmat(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_shmat) || defined (__stub___shmat) ++choke me ++#else ++shmat(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:2173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_func_shmat=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_shmat=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ : ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ if test $ac_cv_func_shmat = no; then ++ echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 ++echo "configure:2194: checking for shmat in -lipc" >&5 ++ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lipc $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ fi ++ fi ++ ++ # Check for libraries that X11R6 Xt/Xaw programs need. ++ ac_save_LDFLAGS="$LDFLAGS" ++ test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" ++ # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to ++ # check for ICE first), but we must link in the order -lSM -lICE or ++ # we get undefined symbols. So assume we have SM if we have ICE. ++ # These have to be linked with before -lX11, unlike the other ++ # libraries we check for below, so use a different variable. ++ # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. ++ echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 ++echo "configure:2246: checking for IceConnectionNumber in -lICE" >&5 ++ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lICE $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ LDFLAGS="$ac_save_LDFLAGS" ++ ++fi ++ ++ ++ ++null_LIBS="$LIBS" ++ ++echo $ac_n "checking for cos in -lm""... $ac_c" 1>&6 ++echo "configure:2294: checking for cos in -lm" >&5 ++ac_lib_var=`echo m'_'cos | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lm $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++ ++base_LIBS="$LIBS" ++ ++echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 ++echo "configure:2344: checking for socket in -lsocket" >&5 ++ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lsocket $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++echo $ac_n "checking for XCreateWindow in -lX11""... $ac_c" 1>&6 ++echo "configure:2391: checking for XCreateWindow in -lX11" >&5 ++ac_lib_var=`echo X11'_'XCreateWindow | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lX11 $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo X11 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++echo $ac_n "checking for XShmCreateImage in -lXext""... $ac_c" 1>&6 ++echo "configure:2438: checking for XShmCreateImage in -lXext" >&5 ++ac_lib_var=`echo Xext'_'XShmCreateImage | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lXext $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo Xext | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++echo $ac_n "checking for XGetExtensionVersion in -lXi""... $ac_c" 1>&6 ++echo "configure:2485: checking for XGetExtensionVersion in -lXi" >&5 ++ac_lib_var=`echo Xi'_'XGetExtensionVersion | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lXi $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo Xi | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++echo $ac_n "checking for IceOpenConnection in -lICE""... $ac_c" 1>&6 ++echo "configure:2532: checking for IceOpenConnection in -lICE" >&5 ++ac_lib_var=`echo ICE'_'IceOpenConnection | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lICE $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo ICE | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++echo $ac_n "checking for SmcOpenConnection in -lSM""... $ac_c" 1>&6 ++echo "configure:2579: checking for SmcOpenConnection in -lSM" >&5 ++ac_lib_var=`echo SM'_'SmcOpenConnection | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lSM $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo SM | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++echo $ac_n "checking for XtMalloc in -lXt""... $ac_c" 1>&6 ++echo "configure:2626: checking for XtMalloc in -lXt" >&5 ++ac_lib_var=`echo Xt'_'XtMalloc | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lXt $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo Xt | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++echo $ac_n "checking for XmuLookupStandardColormap in -lXmu""... $ac_c" 1>&6 ++echo "configure:2673: checking for XmuLookupStandardColormap in -lXmu" >&5 ++ac_lib_var=`echo Xmu'_'XmuLookupStandardColormap | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lXmu $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo Xmu | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++ ++ ++if test "x$ac_cv_header_windows_h" != "xyes" ; then ++ ++ echo $ac_n "checking for glNewList in -lGLcore""... $ac_c" 1>&6 ++echo "configure:2724: checking for glNewList in -lGLcore" >&5 ++ac_lib_var=`echo GLcore'_'glNewList | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lGLcore $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo GLcore | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++ if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then ++ echo $ac_n "checking for glNewList in -lGL""... $ac_c" 1>&6 ++echo "configure:2772: checking for glNewList in -lGL" >&5 ++ac_lib_var=`echo GL'_'glNewList | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lGL $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo GL | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++ if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then ++ echo $ac_n "checking for glNewList in -lMesaGL""... $ac_c" 1>&6 ++echo "configure:2820: checking for glNewList in -lMesaGL" >&5 ++ac_lib_var=`echo MesaGL'_'glNewList | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lMesaGL $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo MesaGL | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++ fi ++ else ++ echo $ac_n "checking for glXCreateContext in -lGL""... $ac_c" 1>&6 ++echo "configure:2869: checking for glXCreateContext in -lGL" >&5 ++ac_lib_var=`echo GL'_'glXCreateContext | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lGL $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo GL | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++ fi ++ ++ if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then ++ ac_safe=`echo "GL/xmesa.h" | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for GL/xmesa.h""... $ac_c" 1>&6 ++echo "configure:2920: checking for GL/xmesa.h" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:2930: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=yes" ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=no" ++fi ++rm -f conftest* ++fi ++if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ : ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++ if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then ++ cat >> confdefs.h <<\EOF ++#define XMESA 1 ++EOF ++ ++ cat >> confdefs.h <<\EOF ++#define FX 1 ++EOF ++ ++ fi ++ fi ++ ++ echo $ac_n "checking for gluLookAt in -lGLU""... $ac_c" 1>&6 ++echo "configure:2964: checking for gluLookAt in -lGLU" >&5 ++ac_lib_var=`echo GLU'_'gluLookAt | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lGLU $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo GLU | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++ if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then ++ echo $ac_n "checking for gluLookAt in -lMesaGLU""... $ac_c" 1>&6 ++echo "configure:3012: checking for gluLookAt in -lMesaGLU" >&5 ++ac_lib_var=`echo MesaGLU'_'gluLookAt | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lMesaGLU $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo MesaGLU | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++ fi ++ ++ echo $ac_n "checking for glutGetModifiers in -lglut""... $ac_c" 1>&6 ++echo "configure:3061: checking for glutGetModifiers in -lglut" >&5 ++ac_lib_var=`echo glut'_'glutGetModifiers | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lglut $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo glut | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++ ++ save_LIBS="$LIBS" ++ echo $ac_n "checking for glutGameModeString in -lglut""... $ac_c" 1>&6 ++echo "configure:3110: checking for glutGameModeString in -lglut" >&5 ++ac_lib_var=`echo glut'_'glutGameModeString | sed 'y%./+-%__p_%'` ++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ ac_save_LIBS="$LIBS" ++LIBS="-lglut $LIBS" ++cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_lib_$ac_lib_var=no" ++fi ++rm -f conftest* ++LIBS="$ac_save_LIBS" ++ ++fi ++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_lib=HAVE_LIB`echo glut | sed -e 's/[^a-zA-Z0-9_]/_/g' \ ++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` ++ cat >> confdefs.h <&6 ++fi ++ ++ LIBS="$save_LIBS" ++else ++ ++ echo Win32 specific hacks... ++ cat >> confdefs.h <<\EOF ++#define WIN32 1 ++EOF ++ ++ ++ ++ ++if test "no" = "yes"; then ++ ENABLE_XMESA_FX_TRUE= ++ ENABLE_XMESA_FX_FALSE='#' ++else ++ ENABLE_XMESA_FX_TRUE='#' ++ ENABLE_XMESA_FX_FALSE= ++fi ++ ++ ac_cv_lib_glut_glutGetModifiers="yes" ++ ac_cv_lib_glut_glutGameModeString="yes" ++ ++ if test "x$with_sgi_opengl" = "xyes" ; then ++ echo "Building with glut.dll, glu.dll, and opengl.dll" ++ WIN32_GLUT=glut ++ WIN32_GLU=glu ++ WIN32_OPENGL=opengl ++ else ++ echo "Building with glut32.dll, glu32.dll, and opengl32.dll" ++ WIN32_GLUT=glut32 ++ WIN32_GLU=glu32 ++ WIN32_OPENGL=opengl32 ++ fi ++ ++ LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}" ++ LIBS="$LIBS -luser32 -lgdi32" ++ echo "Will link apps with $LIBS" ++fi ++ ++if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then ++ echo ++ echo "Unable to find the necessary OpenGL or GLUT libraries." ++ echo "See config.log for automated test details and results ..." ++ exit 1 ++fi ++ ++if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then ++ echo ++ echo "Your version of glut doesn't support game mode." ++ echo "You need to fetch and install the latest version of glut from:" ++ echo ++ echo " http://reality.sgi.com/opengl/glut3/glut3.html" ++ exit 1 ++fi ++ ++opengl_LIBS="$LIBS" ++LIBS="$base_LIBS" ++ ++ ++ ++ ++ ++ ++if test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" ; then ++ HAVE_XWINDOWS_TRUE= ++ HAVE_XWINDOWS_FALSE='#' ++else ++ HAVE_XWINDOWS_TRUE='#' ++ HAVE_XWINDOWS_FALSE= ++fi ++ ++ac_safe=`echo "plib/pu.h" | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for plib/pu.h""... $ac_c" 1>&6 ++echo "configure:3229: checking for plib/pu.h" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:3239: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=yes" ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=no" ++fi ++rm -f conftest* ++fi ++if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ : ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++if test "x$ac_cv_header_plib_pu_h" != "xyes"; then ++ echo ++ echo "You *must* have the plib library installed on your system to build" ++ echo "the FGFS simulator!" ++ echo ++ echo "Please see README.plib for more details." ++ echo ++ echo "configure aborted." ++ exit ++fi ++ ++ac_safe=`echo "zlib.h" | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for zlib.h""... $ac_c" 1>&6 ++echo "configure:3273: checking for zlib.h" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:3283: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=yes" ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=no" ++fi ++rm -f conftest* ++fi ++if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ : ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++if test "x$ac_cv_header_zlib_h" != "xyes"; then ++ echo "no zlib found, building." ++fi ++ ++ ++if test "x$ac_cv_header_zlib_h" = "xyes" ; then ++ HAVE_ZLIB_TRUE= ++ HAVE_ZLIB_FALSE='#' ++else ++ HAVE_ZLIB_TRUE='#' ++ HAVE_ZLIB_FALSE= ++fi ++ ++echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 ++echo "configure:3318: checking for ANSI C header files" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++#include ++#include ++#include ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:3331: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ ac_cv_header_stdc=yes ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ ac_cv_header_stdc=no ++fi ++rm -f conftest* ++ ++if test $ac_cv_header_stdc = yes; then ++ # SunOS 4.x string.h does not declare mem*, contrary to ANSI. ++cat > conftest.$ac_ext < ++EOF ++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ++ egrep "memchr" >/dev/null 2>&1; then ++ : ++else ++ rm -rf conftest* ++ ac_cv_header_stdc=no ++fi ++rm -f conftest* ++ ++fi ++ ++if test $ac_cv_header_stdc = yes; then ++ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. ++cat > conftest.$ac_ext < ++EOF ++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ++ egrep "free" >/dev/null 2>&1; then ++ : ++else ++ rm -rf conftest* ++ ac_cv_header_stdc=no ++fi ++rm -f conftest* ++ ++fi ++ ++if test $ac_cv_header_stdc = yes; then ++ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. ++if test "$cross_compiling" = yes; then ++ : ++else ++ cat > conftest.$ac_ext < ++#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') ++#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) ++#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) ++int main () { int i; for (i = 0; i < 256; i++) ++if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); ++exit (0); } ++ ++EOF ++if { (eval echo configure:3398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null ++then ++ : ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -fr conftest* ++ ac_cv_header_stdc=no ++fi ++rm -fr conftest* ++fi ++ ++fi ++fi ++ ++echo "$ac_t""$ac_cv_header_stdc" 1>&6 ++if test $ac_cv_header_stdc = yes; then ++ cat >> confdefs.h <<\EOF ++#define STDC_HEADERS 1 ++EOF ++ ++fi ++ ++for ac_hdr in \ ++ fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \ ++ sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h ++do ++ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` ++echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ++echo "configure:3427: checking for $ac_hdr" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++EOF ++ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ++{ (eval echo configure:3437: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ++ac_err=`grep -v '^ *+' conftest.out` ++if test -z "$ac_err"; then ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=yes" ++else ++ echo "$ac_err" >&5 ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_header_$ac_safe=no" ++fi ++rm -f conftest* ++fi ++if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` ++ cat >> confdefs.h <&6 ++fi ++done ++ ++ ++echo $ac_n "checking for working const""... $ac_c" 1>&6 ++echo "configure:3465: checking for working const" >&5 ++if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext <j = 5; ++} ++{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ ++ const int foo = 10; ++} ++ ++; return 0; } ++EOF ++if { (eval echo configure:3519: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ rm -rf conftest* ++ ac_cv_c_const=yes ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ ac_cv_c_const=no ++fi ++rm -f conftest* ++fi ++ ++echo "$ac_t""$ac_cv_c_const" 1>&6 ++if test $ac_cv_c_const = no; then ++ cat >> confdefs.h <<\EOF ++#define const ++EOF ++ ++fi ++ ++echo $ac_n "checking for size_t""... $ac_c" 1>&6 ++echo "configure:3540: checking for size_t" >&5 ++if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++#if STDC_HEADERS ++#include ++#include ++#endif ++EOF ++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | ++ egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then ++ rm -rf conftest* ++ ac_cv_type_size_t=yes ++else ++ rm -rf conftest* ++ ac_cv_type_size_t=no ++fi ++rm -f conftest* ++ ++fi ++echo "$ac_t""$ac_cv_type_size_t" 1>&6 ++if test $ac_cv_type_size_t = no; then ++ cat >> confdefs.h <<\EOF ++#define size_t unsigned ++EOF ++ ++fi ++ ++echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 ++echo "configure:3573: checking whether time.h and sys/time.h may both be included" >&5 ++if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++#include ++#include ++int main() { ++struct tm *tp; ++; return 0; } ++EOF ++if { (eval echo configure:3587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ rm -rf conftest* ++ ac_cv_header_time=yes ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ ac_cv_header_time=no ++fi ++rm -f conftest* ++fi ++ ++echo "$ac_t""$ac_cv_header_time" 1>&6 ++if test $ac_cv_header_time = yes; then ++ cat >> confdefs.h <<\EOF ++#define TIME_WITH_SYS_TIME 1 ++EOF ++ ++fi ++ ++echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 ++echo "configure:3608: checking whether struct tm is in sys/time.h or time.h" >&5 ++if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++#include ++int main() { ++struct tm *tp; tp->tm_sec; ++; return 0; } ++EOF ++if { (eval echo configure:3621: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ rm -rf conftest* ++ ac_cv_struct_tm=time.h ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ ac_cv_struct_tm=sys/time.h ++fi ++rm -f conftest* ++fi ++ ++echo "$ac_t""$ac_cv_struct_tm" 1>&6 ++if test $ac_cv_struct_tm = sys/time.h; then ++ cat >> confdefs.h <<\EOF ++#define TM_IN_SYS_TIME 1 ++EOF ++ ++fi ++ ++ ++echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 ++echo "configure:3643: checking return type of signal handlers" >&5 ++if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++#include ++#ifdef signal ++#undef signal ++#endif ++#ifdef __cplusplus ++extern "C" void (*signal (int, void (*)(int)))(int); ++#else ++void (*signal ()) (); ++#endif ++ ++int main() { ++int i; ++; return 0; } ++EOF ++if { (eval echo configure:3665: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then ++ rm -rf conftest* ++ ac_cv_type_signal=void ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ ac_cv_type_signal=int ++fi ++rm -f conftest* ++fi ++ ++echo "$ac_t""$ac_cv_type_signal" 1>&6 ++cat >> confdefs.h <&6 ++echo "configure:3684: checking for vprintf" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char vprintf(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_vprintf) || defined (__stub___vprintf) ++choke me ++#else ++vprintf(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:3712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_func_vprintf=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_vprintf=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ cat >> confdefs.h <<\EOF ++#define HAVE_VPRINTF 1 ++EOF ++ ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++if test "$ac_cv_func_vprintf" != yes; then ++echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 ++echo "configure:3736: checking for _doprnt" >&5 ++if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char _doprnt(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub__doprnt) || defined (__stub____doprnt) ++choke me ++#else ++_doprnt(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:3764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_func__doprnt=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func__doprnt=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ cat >> confdefs.h <<\EOF ++#define HAVE_DOPRNT 1 ++EOF ++ ++else ++ echo "$ac_t""no" 1>&6 ++fi ++ ++fi ++ ++for ac_func in ftime gettimeofday timegm memcpy bcopy mktime strstr rand \ ++ random setitimer getitimer signal GetLocalTime rint getrusage ++do ++echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ++echo "configure:3792: checking for $ac_func" >&5 ++if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then ++ echo $ac_n "(cached) $ac_c" 1>&6 ++else ++ cat > conftest.$ac_ext < ++/* Override any gcc2 internal prototype to avoid an error. */ ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char $ac_func(); ++ ++int main() { ++ ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_$ac_func) || defined (__stub___$ac_func) ++choke me ++#else ++$ac_func(); ++#endif ++ ++; return 0; } ++EOF ++if { (eval echo configure:3820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=yes" ++else ++ echo "configure: failed program was:" >&5 ++ cat conftest.$ac_ext >&5 ++ rm -rf conftest* ++ eval "ac_cv_func_$ac_func=no" ++fi ++rm -f conftest* ++fi ++ ++if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then ++ echo "$ac_t""yes" 1>&6 ++ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` ++ cat >> confdefs.h <&6 ++fi ++done ++ ++ ++ ++ ++ ++ ++trap '' 1 2 15 ++cat > confcache <<\EOF ++# This file is a shell script that caches the results of configure ++# tests run on this system so they can be shared between configure ++# scripts and configure runs. It is not useful on other systems. ++# If it contains results you don't want to keep, you may remove or edit it. ++# ++# By default, configure uses ./config.cache as the cache file, ++# creating it if it does not exist already. You can give configure ++# the --cache-file=FILE option to use a different cache file; that is ++# what configure does when it calls configure scripts in ++# subdirectories, so they share the cache. ++# Giving --cache-file=/dev/null disables caching, for debugging configure. ++# config.status only pays attention to the cache file if you give it the ++# --recheck option to rerun configure. ++# ++EOF ++# The following way of writing the cache mishandles newlines in values, ++# but we know of no workaround that is simple, portable, and efficient. ++# So, don't put newlines in cache variables' values. ++# Ultrix sh set writes to stderr and can't be redirected directly, ++# and sets the high bit in the cache file unless we assign to the vars. ++(set) 2>&1 | ++ case `(ac_space=' '; set) 2>&1` in ++ *ac_space=\ *) ++ # `set' does not quote correctly, so add quotes (double-quote substitution ++ # turns \\\\ into \\, and sed turns \\ into \). ++ sed -n \ ++ -e "s/'/'\\\\''/g" \ ++ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ++ ;; ++ *) ++ # `set' quotes correctly as required by POSIX, so do not add quotes. ++ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ++ ;; ++ esac >> confcache ++if cmp -s $cache_file confcache; then ++ : ++else ++ if test -w $cache_file; then ++ echo "updating cache $cache_file" ++ cat confcache > $cache_file ++ else ++ echo "not updating unwritable cache $cache_file" ++ fi ++fi ++rm -f confcache ++ ++trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 ++ ++test "x$prefix" = xNONE && prefix=$ac_default_prefix ++# Let make expand exec_prefix. ++test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' ++ ++# Any assignment to VPATH causes Sun make to only execute ++# the first set of double-colon rules, so remove it if not needed. ++# If there is a colon in the path, we need to keep it. ++if test "x$srcdir" = x.; then ++ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' ++fi ++ ++trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 ++ ++DEFS=-DHAVE_CONFIG_H ++ ++# Without the "./", some shells look in PATH for config.status. ++: ${CONFIG_STATUS=./config.status} ++ ++echo creating $CONFIG_STATUS ++rm -f $CONFIG_STATUS ++cat > $CONFIG_STATUS </dev/null | sed 1q`: ++# ++# $0 $ac_configure_args ++# ++# Compiler output produced by configure, useful for debugging ++# configure, is in ./config.log if it exists. ++ ++ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" ++for ac_option ++do ++ case "\$ac_option" in ++ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ++ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" ++ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; ++ -version | --version | --versio | --versi | --vers | --ver | --ve | --v) ++ echo "$CONFIG_STATUS generated by autoconf version 2.12" ++ exit 0 ;; ++ -help | --help | --hel | --he | --h) ++ echo "\$ac_cs_usage"; exit 0 ;; ++ *) echo "\$ac_cs_usage"; exit 1 ;; ++ esac ++done ++ ++ac_given_srcdir=$srcdir ++ac_given_INSTALL="$INSTALL" ++ ++trap 'rm -fr `echo "\ ++ VERSION \ ++ Makefile \ ++ include/Makefile \ ++ bucket/Makefile \ ++ debug/Makefile \ ++ math/Makefile \ ++ misc/Makefile \ ++ screen/Makefile \ ++ serial/Makefile \ ++ xgl/Makefile \ ++ zlib/Makefile \ ++ include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 ++EOF ++cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF ++$ac_vpsub ++$extrasub ++s%@CFLAGS@%$CFLAGS%g ++s%@CPPFLAGS@%$CPPFLAGS%g ++s%@CXXFLAGS@%$CXXFLAGS%g ++s%@DEFS@%$DEFS%g ++s%@LDFLAGS@%$LDFLAGS%g ++s%@LIBS@%$LIBS%g ++s%@exec_prefix@%$exec_prefix%g ++s%@prefix@%$prefix%g ++s%@program_transform_name@%$program_transform_name%g ++s%@bindir@%$bindir%g ++s%@sbindir@%$sbindir%g ++s%@libexecdir@%$libexecdir%g ++s%@datadir@%$datadir%g ++s%@sysconfdir@%$sysconfdir%g ++s%@sharedstatedir@%$sharedstatedir%g ++s%@localstatedir@%$localstatedir%g ++s%@libdir@%$libdir%g ++s%@includedir@%$includedir%g ++s%@oldincludedir@%$oldincludedir%g ++s%@infodir@%$infodir%g ++s%@mandir@%$mandir%g ++s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g ++s%@INSTALL_DATA@%$INSTALL_DATA%g ++s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g ++s%@PACKAGE@%$PACKAGE%g ++s%@VERSION@%$VERSION%g ++s%@ACLOCAL@%$ACLOCAL%g ++s%@AUTOCONF@%$AUTOCONF%g ++s%@AUTOMAKE@%$AUTOMAKE%g ++s%@AUTOHEADER@%$AUTOHEADER%g ++s%@MAKEINFO@%$MAKEINFO%g ++s%@SET_MAKE@%$SET_MAKE%g ++s%@CC@%$CC%g ++s%@CXX@%$CXX%g ++s%@RANLIB@%$RANLIB%g ++s%@LN_S@%$LN_S%g ++s%@CPP@%$CPP%g ++s%@ENABLE_UNIX_SERIAL_TRUE@%$ENABLE_UNIX_SERIAL_TRUE%g ++s%@ENABLE_UNIX_SERIAL_FALSE@%$ENABLE_UNIX_SERIAL_FALSE%g ++s%@X_CFLAGS@%$X_CFLAGS%g ++s%@X_PRE_LIBS@%$X_PRE_LIBS%g ++s%@X_LIBS@%$X_LIBS%g ++s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g ++s%@ENABLE_XMESA_FX_TRUE@%$ENABLE_XMESA_FX_TRUE%g ++s%@ENABLE_XMESA_FX_FALSE@%$ENABLE_XMESA_FX_FALSE%g ++s%@base_LIBS@%$base_LIBS%g ++s%@opengl_LIBS@%$opengl_LIBS%g ++s%@HAVE_XWINDOWS_TRUE@%$HAVE_XWINDOWS_TRUE%g ++s%@HAVE_XWINDOWS_FALSE@%$HAVE_XWINDOWS_FALSE%g ++s%@HAVE_ZLIB_TRUE@%$HAVE_ZLIB_TRUE%g ++s%@HAVE_ZLIB_FALSE@%$HAVE_ZLIB_FALSE%g ++ ++CEOF ++EOF ++ ++cat >> $CONFIG_STATUS <<\EOF ++ ++# Split the substitutions into bite-sized pieces for seds with ++# small command number limits, like on Digital OSF/1 and HP-UX. ++ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ++ac_file=1 # Number of current file. ++ac_beg=1 # First line for current file. ++ac_end=$ac_max_sed_cmds # Line after last line for current file. ++ac_more_lines=: ++ac_sed_cmds="" ++while $ac_more_lines; do ++ if test $ac_beg -gt 1; then ++ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file ++ else ++ sed "${ac_end}q" conftest.subs > conftest.s$ac_file ++ fi ++ if test ! -s conftest.s$ac_file; then ++ ac_more_lines=false ++ rm -f conftest.s$ac_file ++ else ++ if test -z "$ac_sed_cmds"; then ++ ac_sed_cmds="sed -f conftest.s$ac_file" ++ else ++ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" ++ fi ++ ac_file=`expr $ac_file + 1` ++ ac_beg=$ac_end ++ ac_end=`expr $ac_end + $ac_max_sed_cmds` ++ fi ++done ++if test -z "$ac_sed_cmds"; then ++ ac_sed_cmds=cat ++fi ++EOF ++ ++cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF ++for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then ++ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". ++ case "$ac_file" in ++ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ++ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; ++ *) ac_file_in="${ac_file}.in" ;; ++ esac ++ ++ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. ++ ++ # Remove last slash and all that follows it. Not all systems have dirname. ++ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` ++ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then ++ # The file is in a subdirectory. ++ test ! -d "$ac_dir" && mkdir "$ac_dir" ++ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" ++ # A "../" for each directory in $ac_dir_suffix. ++ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` ++ else ++ ac_dir_suffix= ac_dots= ++ fi ++ ++ case "$ac_given_srcdir" in ++ .) srcdir=. ++ if test -z "$ac_dots"; then top_srcdir=. ++ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; ++ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; ++ *) # Relative path. ++ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" ++ top_srcdir="$ac_dots$ac_given_srcdir" ;; ++ esac ++ ++ case "$ac_given_INSTALL" in ++ [/$]*) INSTALL="$ac_given_INSTALL" ;; ++ *) INSTALL="$ac_dots$ac_given_INSTALL" ;; ++ esac ++ ++ echo creating "$ac_file" ++ rm -f "$ac_file" ++ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." ++ case "$ac_file" in ++ *Makefile*) ac_comsub="1i\\ ++# $configure_input" ;; ++ *) ac_comsub= ;; ++ esac ++ ++ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` ++ sed -e "$ac_comsub ++s%@configure_input@%$configure_input%g ++s%@srcdir@%$srcdir%g ++s%@top_srcdir@%$top_srcdir%g ++s%@INSTALL@%$INSTALL%g ++" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file ++fi; done ++rm -f conftest.s* ++ ++# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where ++# NAME is the cpp macro being defined and VALUE is the value it is being given. ++# ++# ac_d sets the value in "#define NAME VALUE" lines. ++ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ++ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ++ac_dC='\3' ++ac_dD='%g' ++# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ++ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ++ac_uB='\([ ]\)%\1#\2define\3' ++ac_uC=' ' ++ac_uD='\4%g' ++# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ++ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ++ac_eB='$%\1#\2define\3' ++ac_eC=' ' ++ac_eD='%g' ++ ++if test "${CONFIG_HEADERS+set}" != set; then ++EOF ++cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF ++fi ++for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then ++ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". ++ case "$ac_file" in ++ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ++ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; ++ *) ac_file_in="${ac_file}.in" ;; ++ esac ++ ++ echo creating $ac_file ++ ++ rm -f conftest.frag conftest.in conftest.out ++ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` ++ cat $ac_file_inputs > conftest.in ++ ++EOF ++ ++# Transform confdefs.h into a sed script conftest.vals that substitutes ++# the proper values into config.h.in to produce config.h. And first: ++# Protect against being on the right side of a sed subst in config.status. ++# Protect against being in an unquoted here document in config.status. ++rm -f conftest.vals ++cat > conftest.hdr <<\EOF ++s/[\\&%]/\\&/g ++s%[\\$`]%\\&%g ++s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp ++s%ac_d%ac_u%gp ++s%ac_u%ac_e%gp ++EOF ++sed -n -f conftest.hdr confdefs.h > conftest.vals ++rm -f conftest.hdr ++ ++# This sed command replaces #undef with comments. This is necessary, for ++# example, in the case of _POSIX_SOURCE, which is predefined and required ++# on some systems where configure will not decide to define it. ++cat >> conftest.vals <<\EOF ++s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% ++EOF ++ ++# Break up conftest.vals because some shells have a limit on ++# the size of here documents, and old seds have small limits too. ++ ++rm -f conftest.tail ++while : ++do ++ ac_lines=`grep -c . conftest.vals` ++ # grep -c gives empty output for an empty file on some AIX systems. ++ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi ++ # Write a limited-size here document to conftest.frag. ++ echo ' cat > conftest.frag <> $CONFIG_STATUS ++ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS ++ echo 'CEOF ++ sed -f conftest.frag conftest.in > conftest.out ++ rm -f conftest.in ++ mv conftest.out conftest.in ++' >> $CONFIG_STATUS ++ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail ++ rm -f conftest.vals ++ mv conftest.tail conftest.vals ++done ++rm -f conftest.vals ++ ++cat >> $CONFIG_STATUS <<\EOF ++ rm -f conftest.frag conftest.h ++ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h ++ cat conftest.in >> conftest.h ++ rm -f conftest.in ++ if cmp -s $ac_file conftest.h 2>/dev/null; then ++ echo "$ac_file is unchanged" ++ rm -f conftest.h ++ else ++ # Remove last slash and all that follows it. Not all systems have dirname. ++ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` ++ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then ++ # The file is in a subdirectory. ++ test ! -d "$ac_dir" && mkdir "$ac_dir" ++ fi ++ rm -f $ac_file ++ mv conftest.h $ac_file ++ fi ++fi; done ++ ++EOF ++cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF ++test -z "$CONFIG_HEADERS" || echo timestamp > include/stamp-h ++ ++exit 0 ++EOF ++chmod +x $CONFIG_STATUS ++rm -fr confdefs* $ac_clean_files ++test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 ++ ++ ++ ++ ++echo "" ++echo "Configure Summary" ++echo "=================" ++ ++echo "Prefix: $prefix" ++ ++if test "x$with_logging" != "x"; then ++ echo "Debug messages: $with_logging" ++else ++ echo "Debug messages: yes" ++fi ++ ++if test "x$with_efence" != "x"; then ++ echo "Electric fence: $with_efence" ++else ++ echo "Electric fence: no" ++fi ++./mksymlinks.sh ++ diff --cc configure.in index 00000000,00000000..475cd4c3 new file mode 100644 --- /dev/null +++ b/configure.in @@@ -1,0 -1,0 +1,258 @@@ ++dnl Process this file with aclocal ; automake -a ; autoconf to produce a ++dnl working configure script. ++dnl ++dnl $Id$ ++ ++AC_INIT(bucket/newbucket.cxx) ++ ++dnl Initialize the automake stuff ++AM_INIT_AUTOMAKE(SimGear, 0.0.0) ++ ++dnl Checks for programs. ++AC_PROG_MAKE_SET ++AC_PROG_CC ++AC_PROG_CXX ++AC_PROG_RANLIB ++AC_PROG_INSTALL ++AC_PROG_LN_S ++ ++if echo $includedir | egrep "simgear$" > /dev/null; then ++ echo "includedir is" $includedir "libdir is" $libdir ++else ++ includedir="${includedir}/simgear" ++ echo "includedir changed to" $includedir "libdir is" $libdir ++fi ++ ++ ++dnl Specify if we want logging (testing build) or not (release build) ++# set logging default value ++# with_logging=yes ++AC_ARG_WITH(logging, [ --with-logging Include logging output (default)]) ++if test "x$with_logging" = "xno" ; then ++ AC_DEFINE(FG_NDEBUG) ++fi ++ ++dnl specify if we are building with "checker" ++AC_ARG_WITH(efence, [ --with-efence Specify if we are building with "electric-fence"]) ++ ++if test "x$with_efence" = "xyes" ; then ++ echo "Building with efence" ++ LIBS= "$LIBS -lefence" ++fi ++ ++dnl Check for MS Windows environment ++AC_CHECK_HEADER(windows.h) ++ ++dnl extra library and include directories ++EXTRA_DIRS="/usr/local /usr/local/plib /usr/X11R6" ++ ++if test -d /opt/X11R6 ; then ++ EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6" ++fi ++ ++if test "x$ac_cv_header_windows_h" = "xyes" ; then ++ EXTRA_DIRS="${EXTRA_DIRS} `pwd`/Win32" ++# elif test `uname -s` = "SunOS" ; then ++# EXTRA_DIRS="${EXTRA_DIRS} `pwd`/SunOS" ++fi ++wi_EXTRA_DIRS(no, ${EXTRA_DIRS}) ++ ++dnl Using AM_CONDITIONAL is a step out of the protected little ++dnl automake fold so it is potentially dangerous. But, we are ++dnl beginning to run into cases where the standard checks are not ++dnl enough. AM_CONDITIONALS are then referenced to conditionally ++dnl build a Makefile.in from a Makefile.am which lets us define custom ++dnl includes, compile alternative source files, etc. ++ ++dnl Enable serial support on Unix type systems ++AM_CONDITIONAL(ENABLE_UNIX_SERIAL, true) ++ ++dnl Check for X11 (fancy) ++AC_PATH_XTRA ++ ++dnl Checks for libraries. ++ ++null_LIBS="$LIBS" ++ ++AC_CHECK_LIB(m, cos) ++ ++base_LIBS="$LIBS" ++ ++AC_CHECK_LIB(socket, socket) ++AC_CHECK_LIB(X11, XCreateWindow) ++AC_CHECK_LIB(Xext, XShmCreateImage) ++AC_CHECK_LIB(Xi, XGetExtensionVersion) ++AC_CHECK_LIB(ICE, IceOpenConnection) ++AC_CHECK_LIB(SM, SmcOpenConnection) ++AC_CHECK_LIB(Xt, XtMalloc) ++AC_CHECK_LIB(Xmu, XmuLookupStandardColormap) ++ ++dnl check for OpenGL related libraries ++ ++if test "x$ac_cv_header_windows_h" != "xyes" ; then ++ dnl Reasonable stuff for non-windoze variants ... :-) ++ ++ AC_CHECK_LIB(GLcore, glNewList) ++ if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then ++ dnl if no GLcore, check for GL ++ AC_CHECK_LIB(GL, glNewList) ++ if test "x$ac_cv_lib_GL_glNewList" = "xno" ; then ++ dnl if no GL, check for MesaGL ++ AC_CHECK_LIB(MesaGL, glNewList) ++ fi ++ else ++ dnl if GLcore found, then also check for GL ++ AC_CHECK_LIB(GL, glXCreateContext) ++ fi ++ ++ dnl if using mesa, check for xmesa.h ++ if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then ++ AC_CHECK_HEADER(GL/xmesa.h) ++ if test "x$ac_cv_header_GL_xmesa_h" = "xyes"; then ++ AC_DEFINE( XMESA ) ++ AC_DEFINE( FX ) ++ fi ++ fi ++ ++ AC_CHECK_LIB(GLU, gluLookAt) ++ if test "x$ac_cv_lib_GLU_gluLookAt" = "xno" ; then ++ dnl if no GLU, check for MesaGLU ++ AC_CHECK_LIB(MesaGLU, gluLookAt) ++ fi ++ ++ dnl check for glut ++ AC_CHECK_LIB(glut, glutGetModifiers) ++ ++ dnl test for glutGameModeString, but avoid adding glut a second time into ++ dnl the list of libraries ++ save_LIBS="$LIBS" ++ AC_CHECK_LIB(glut, glutGameModeString) ++ LIBS="$save_LIBS" ++else ++ dnl Win32 is a little wierd because it has to try to handle the various ++ dnl winbloze-isms. We'll just do this manually for now. ++ ++ echo Win32 specific hacks... ++ AC_DEFINE(WIN32) ++ ++ dnl force a failed check since we will be building under windoze ++ AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes") ++ ++ dnl just define these to true and hope for the best ++ ac_cv_lib_glut_glutGetModifiers="yes" ++ ac_cv_lib_glut_glutGameModeString="yes" ++ ++ if test "x$with_sgi_opengl" = "xyes" ; then ++ echo "Building with glut.dll, glu.dll, and opengl.dll" ++ WIN32_GLUT=glut ++ WIN32_GLU=glu ++ WIN32_OPENGL=opengl ++ else ++ echo "Building with glut32.dll, glu32.dll, and opengl32.dll" ++ WIN32_GLUT=glut32 ++ WIN32_GLU=glu32 ++ WIN32_OPENGL=opengl32 ++ fi ++ ++ LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}" ++ LIBS="$LIBS -luser32 -lgdi32" ++ echo "Will link apps with $LIBS" ++fi ++ ++if test "x$ac_cv_lib_glut_glutGetModifiers" = "xno"; then ++ echo ++ echo "Unable to find the necessary OpenGL or GLUT libraries." ++ echo "See config.log for automated test details and results ..." ++ exit 1 ++fi ++ ++if test "x$ac_cv_lib_glut_glutGameModeString" = "xno"; then ++ echo ++ echo "Your version of glut doesn't support game mode." ++ echo "You need to fetch and install the latest version of glut from:" ++ echo ++ echo " http://reality.sgi.com/opengl/glut3/glut3.html" ++ exit 1 ++fi ++ ++opengl_LIBS="$LIBS" ++LIBS="$base_LIBS" ++ ++AC_SUBST(base_LIBS) ++AC_SUBST(opengl_LIBS) ++ ++AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" ) ++ ++dnl Check for "plib" without which we cannot go on ++AC_CHECK_HEADER(plib/pu.h) ++if test "x$ac_cv_header_plib_pu_h" != "xyes"; then ++ echo ++ echo "You *must* have the plib library installed on your system to build" ++ echo "the FGFS simulator!" ++ echo ++ echo "Please see README.plib for more details." ++ echo ++ echo "configure aborted." ++ exit ++fi ++ ++dnl Check for system installed zlib ++AC_CHECK_HEADER(zlib.h) ++if test "x$ac_cv_header_zlib_h" != "xyes"; then ++ echo "no zlib found, building." ++fi ++AM_CONDITIONAL(HAVE_ZLIB, test "x$ac_cv_header_zlib_h" = "xyes" ) ++ ++dnl Checks for header files. ++AC_HEADER_STDC ++AC_CHECK_HEADERS( \ ++ fcntl.h getopt.h malloc.h memory.h stdlib.h sys/param.h sys/stat.h \ ++ sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h ) ++ ++dnl Checks for typedefs, structures, and compiler characteristics. ++AC_C_CONST ++AC_TYPE_SIZE_T ++AC_HEADER_TIME ++AC_STRUCT_TM ++ ++dnl Checks for library functions. ++AC_TYPE_SIGNAL ++AC_FUNC_VPRINTF ++AC_CHECK_FUNCS( ftime gettimeofday timegm memcpy bcopy mktime strstr rand \ ++ random setitimer getitimer signal GetLocalTime rint getrusage ) ++ ++AM_CONFIG_HEADER(include/config.h) ++ ++AC_OUTPUT( \ ++ VERSION \ ++ Makefile \ ++ include/Makefile \ ++ bucket/Makefile \ ++ debug/Makefile \ ++ math/Makefile \ ++ misc/Makefile \ ++ screen/Makefile \ ++ serial/Makefile \ ++ xgl/Makefile \ ++ zlib/Makefile \ ++) ++ ++AC_OUTPUT_COMMANDS([./mksymlinks.sh]) ++ ++echo "" ++echo "Configure Summary" ++echo "=================" ++ ++echo "Prefix: $prefix" ++ ++if test "x$with_logging" != "x"; then ++ echo "Debug messages: $with_logging" ++else ++ echo "Debug messages: yes" ++fi ++ ++if test "x$with_efence" != "x"; then ++ echo "Electric fence: $with_efence" ++else ++ echo "Electric fence: no" ++fi diff --cc mksymlinks.sh index 00000000,00000000..f742e682 new file mode 100755 --- /dev/null +++ b/mksymlinks.sh @@@ -1,0 -1,0 +1,25 @@@ ++#! /bin/sh ++ ++echo "" ++echo "running $0 to rebuild simgear include links" ++ ++# toast the old directory ++rm -rf simgear ++mkdir simgear ++ ++# build new links ++ln -s ../include/compiler.h simgear/compiler.h ++ln -s ../include/constants.h simgear/constants.h ++ln -s ../debug/debug_types.h simgear/debug_types.h ++ln -s ../math/fg_memory.h simgear/fg_memory.h ++ln -s ../include/fg_traits.hxx simgear/fg_traits.hxx ++ln -s ../math/fg_types.hxx simgear/fg_types.hxx ++ln -s ../include/fg_zlib.h simgear/fg_zlib.h ++ln -s ../misc/fgpath.hxx simgear/fgpath.hxx ++ln -s ../debug/logstream.hxx simgear/logstream.hxx ++ln -s ../math/mat3.h simgear/mat3.h ++ln -s ../bucket/newbucket.hxx simgear/newbucket.hxx ++ln -s ../math/point3d.hxx simgear/point3d.hxx ++ln -s ../math/polar3d.hxx simgear/polar3d.hxx ++ln -s ../xgl/xgl.h simgear/xgl.h ++ln -s ../misc/zfstream.hxx simgear/zfstream.hxx diff --cc simgear/bucket/Makefile.am index 00000000,00000000..494d2550 new file mode 100644 --- /dev/null +++ b/simgear/bucket/Makefile.am @@@ -1,0 -1,0 +1,15 @@@ ++lib_LIBRARIES = libsgbucket.a ++ ++include_HEADERS = newbucket.hxx ++ ++libsgbucket_a_SOURCES = newbucket.cxx ++ ++# noinst_PROGRAMS = testbucket ++ ++# testbucket_SOURCES = testbucket.cxx ++ ++# testbucket_LDADD = \ ++# $(top_builddir)/bucket/libsgbucket.a \ ++# $(top_builddir)/misc/libsgmisc.a ++ ++INCLUDES += -I$(top_builddir) diff --cc simgear/bucket/Makefile.in index 00000000,00000000..d929e640 new file mode 100644 --- /dev/null +++ b/simgear/bucket/Makefile.in @@@ -1,0 -1,0 +1,344 @@@ ++# Makefile.in generated automatically by automake 1.3 from Makefile.am ++ ++# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++ ++SHELL = /bin/sh ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++prefix = @prefix@ ++exec_prefix = @exec_prefix@ ++ ++bindir = @bindir@ ++sbindir = @sbindir@ ++libexecdir = @libexecdir@ ++datadir = @datadir@ ++sysconfdir = @sysconfdir@ ++sharedstatedir = @sharedstatedir@ ++localstatedir = @localstatedir@ ++libdir = @libdir@ ++infodir = @infodir@ ++mandir = @mandir@ ++includedir = @includedir@ ++oldincludedir = /usr/include ++ ++DISTDIR = ++ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++ ++top_builddir = .. ++ ++ACLOCAL = @ACLOCAL@ ++AUTOCONF = @AUTOCONF@ ++AUTOMAKE = @AUTOMAKE@ ++AUTOHEADER = @AUTOHEADER@ ++ ++INSTALL = @INSTALL@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++transform = @program_transform_name@ ++ ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++CC = @CC@ ++CXX = @CXX@ ++LN_S = @LN_S@ ++MAKEINFO = @MAKEINFO@ ++PACKAGE = @PACKAGE@ ++RANLIB = @RANLIB@ ++VERSION = @VERSION@ ++base_LIBS = @base_LIBS@ ++opengl_LIBS = @opengl_LIBS@ ++ ++lib_LIBRARIES = libsgbucket.a ++ ++include_HEADERS = newbucket.hxx ++ ++libsgbucket_a_SOURCES = newbucket.cxx ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = ../include/config.h ++CONFIG_CLEAN_FILES = ++LIBRARIES = $(lib_LIBRARIES) ++ ++ ++DEFS = @DEFS@ -I. -I$(srcdir) -I../include ++CPPFLAGS = @CPPFLAGS@ ++LDFLAGS = @LDFLAGS@ ++LIBS = @LIBS@ ++X_CFLAGS = @X_CFLAGS@ ++X_LIBS = @X_LIBS@ ++X_EXTRA_LIBS = @X_EXTRA_LIBS@ ++X_PRE_LIBS = @X_PRE_LIBS@ ++libsgbucket_a_LIBADD = ++libsgbucket_a_OBJECTS = newbucket.o ++AR = ar ++CXXFLAGS = @CXXFLAGS@ ++CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++CXXLINK = $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ ++HEADERS = $(include_HEADERS) ++ ++DIST_COMMON = Makefile.am Makefile.in ++ ++ ++DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ++ ++TAR = tar ++GZIP = --best ++DEP_FILES = .deps/newbucket.P ++CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++SOURCES = $(libsgbucket_a_SOURCES) ++OBJECTS = $(libsgbucket_a_OBJECTS) ++ ++all: Makefile $(LIBRARIES) $(HEADERS) ++ ++.SUFFIXES: ++.SUFFIXES: .S .c .cxx .o .s ++$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu bucket/Makefile ++ ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++ ++mostlyclean-libLIBRARIES: ++ ++clean-libLIBRARIES: ++ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) ++ ++distclean-libLIBRARIES: ++ ++maintainer-clean-libLIBRARIES: ++ ++install-libLIBRARIES: $(lib_LIBRARIES) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(libdir) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ ++ $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ @$(POST_INSTALL) ++ @list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ ++ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ ++uninstall-libLIBRARIES: ++ @$(NORMAL_UNINSTALL) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(libdir)/$$p; \ ++ done ++ ++.s.o: ++ $(COMPILE) -c $< ++ ++.S.o: ++ $(COMPILE) -c $< ++ ++mostlyclean-compile: ++ -rm -f *.o core *.core ++ ++clean-compile: ++ ++distclean-compile: ++ -rm -f *.tab.c ++ ++maintainer-clean-compile: ++ ++libsgbucket.a: $(libsgbucket_a_OBJECTS) $(libsgbucket_a_DEPENDENCIES) ++ -rm -f libsgbucket.a ++ $(AR) cru libsgbucket.a $(libsgbucket_a_OBJECTS) $(libsgbucket_a_LIBADD) ++ $(RANLIB) libsgbucket.a ++.cxx.o: ++ $(CXXCOMPILE) -c $< ++ ++install-includeHEADERS: $(include_HEADERS) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(includedir) ++ @list='$(include_HEADERS)'; for p in $$list; do \ ++ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ ++ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ ++ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++uninstall-includeHEADERS: ++ @$(NORMAL_UNINSTALL) ++ list='$(include_HEADERS)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++tags: TAGS ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) ++ here=`pwd` && cd $(srcdir) \ ++ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) ++ ++TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ ++ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ ++mostlyclean-tags: ++ ++clean-tags: ++ ++distclean-tags: ++ -rm -f TAGS ID ++ ++maintainer-clean-tags: ++ ++distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) ++ ++subdir = bucket ++ ++distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu bucket/Makefile ++ @for file in $(DISTFILES); do \ ++ d=$(srcdir); \ ++ test -f $(distdir)/$$file \ ++ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ++ || cp -p $$d/$$file $(distdir)/$$file; \ ++ done ++ ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ ++maintainer-clean-depend: ++ -rm -rf .deps ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++ ++%.o: %.cxx ++ @echo '$(CXXCOMPILE) -c $<'; \ ++ $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.cxx ++ @echo '$(LTCXXCOMPILE) -c $<'; \ ++ $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++info: ++dvi: ++check: all ++ $(MAKE) ++installcheck: ++install-exec: install-libLIBRARIES ++ @$(NORMAL_INSTALL) ++ ++install-data: install-includeHEADERS ++ @$(NORMAL_INSTALL) ++ ++install: install-exec install-data all ++ @: ++ ++uninstall: uninstall-libLIBRARIES uninstall-includeHEADERS ++ ++install-strip: ++ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install ++installdirs: ++ $(mkinstalldirs) $(DATADIR)$(libdir) $(DATADIR)$(includedir) ++ ++ ++mostlyclean-generic: ++ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f Makefile $(DISTCLEANFILES) ++ -rm -f config.cache config.log stamp-h stamp-h[0-9]* ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) ++ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) ++mostlyclean: mostlyclean-libLIBRARIES mostlyclean-compile \ ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic ++ ++clean: clean-libLIBRARIES clean-compile clean-tags clean-depend \ ++ clean-generic mostlyclean ++ ++distclean: distclean-libLIBRARIES distclean-compile distclean-tags \ ++ distclean-depend distclean-generic clean ++ -rm -f config.status ++ ++maintainer-clean: maintainer-clean-libLIBRARIES \ ++ maintainer-clean-compile maintainer-clean-tags \ ++ maintainer-clean-depend maintainer-clean-generic \ ++ distclean ++ @echo "This command is intended for maintainers to use;" ++ @echo "it deletes files that may require special tools to rebuild." ++ ++.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \ ++clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ ++install-libLIBRARIES mostlyclean-compile distclean-compile \ ++clean-compile maintainer-clean-compile uninstall-includeHEADERS \ ++install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ ++maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ ++clean-depend maintainer-clean-depend info dvi installcheck install-exec \ ++install-data install uninstall all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean ++ ++ ++# noinst_PROGRAMS = testbucket ++ ++# testbucket_SOURCES = testbucket.cxx ++ ++# testbucket_LDADD = \ ++# $(top_builddir)/bucket/libsgbucket.a \ ++# $(top_builddir)/misc/libsgmisc.a ++ ++INCLUDES += -I$(top_builddir) ++ ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --cc simgear/bucket/newbucket.cxx index 00000000,00000000..071ee3a9 new file mode 100644 --- /dev/null +++ b/simgear/bucket/newbucket.cxx @@@ -1,0 -1,0 +1,155 @@@ ++/************************************************************************** ++ * newbucket.hxx -- new bucket routines for better world modeling ++ * ++ * Written by Curtis L. Olson, started February 1999. ++ * ++ * Copyright (C) 1999 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 ++ ++ ++#include ++ ++#include ++ ++#include "newbucket.hxx" ++ ++ ++// Build the path name for this bucket ++string FGBucket::gen_base_path() const { ++ // long int index; ++ int top_lon, top_lat, main_lon, main_lat; ++ char hem, pole; ++ char raw_path[256]; ++ ++ top_lon = lon / 10; ++ main_lon = lon; ++ if ( (lon < 0) && (top_lon * 10 != lon) ) { ++ top_lon -= 1; ++ } ++ top_lon *= 10; ++ if ( top_lon >= 0 ) { ++ hem = 'e'; ++ } else { ++ hem = 'w'; ++ top_lon *= -1; ++ } ++ if ( main_lon < 0 ) { ++ main_lon *= -1; ++ } ++ ++ top_lat = lat / 10; ++ main_lat = lat; ++ if ( (lat < 0) && (top_lat * 10 != lat) ) { ++ top_lat -= 1; ++ } ++ top_lat *= 10; ++ if ( top_lat >= 0 ) { ++ pole = 'n'; ++ } else { ++ pole = 's'; ++ top_lat *= -1; ++ } ++ if ( main_lat < 0 ) { ++ main_lat *= -1; ++ } ++ ++ sprintf(raw_path, "%c%03d%c%02d/%c%03d%c%02d", ++ hem, top_lon, pole, top_lat, ++ hem, main_lon, pole, main_lat); ++ ++ FGPath path( raw_path ); ++ ++ return path.str(); ++} ++ ++ ++// find the bucket which is offset by the specified tile units in the ++// X & Y direction. We need the current lon and lat to resolve ++// ambiguities when going from a wider tile to a narrower one above or ++// below. This assumes that we are feeding in ++FGBucket fgBucketOffset( double dlon, double dlat, int dx, int dy ) { ++ FGBucket result( dlon, dlat ); ++ double clat = result.get_center_lat() + dy * FG_BUCKET_SPAN; ++ ++ // walk dy units in the lat direction ++ result.set_bucket( dlon, clat ); ++ ++ // find the lon span for the new latitude ++ double span = bucket_span( clat ); ++ ++ // walk dx units in the lon direction ++ double tmp = dlon + dx * span; ++ while ( tmp < -180.0 ) { ++ tmp += 360.0; ++ } ++ while ( tmp >= 180.0 ) { ++ tmp -= 360.0; ++ } ++ result.set_bucket( tmp, clat ); ++ ++ return result; ++} ++ ++ ++// calculate the offset between two buckets ++void fgBucketDiff( const FGBucket& b1, const FGBucket& b2, int *dx, int *dy ) { ++ ++ // Latitude difference ++ double c1_lat = b1.get_center_lat(); ++ double c2_lat = b2.get_center_lat(); ++ double diff_lat = c2_lat - c1_lat; ++ ++#ifdef HAVE_RINT ++ *dy = (int)rint( diff_lat / FG_BUCKET_SPAN ); ++#else ++ if ( diff_lat > 0 ) { ++ *dy = (int)( diff_lat / FG_BUCKET_SPAN + 0.5 ); ++ } else { ++ *dy = (int)( diff_lat / FG_BUCKET_SPAN - 0.5 ); ++ } ++#endif ++ ++ // longitude difference ++ double c1_lon = b1.get_center_lon(); ++ double c2_lon = b2.get_center_lon(); ++ double diff_lon = c2_lon - c1_lon; ++ double span; ++ if ( bucket_span(c1_lat) <= bucket_span(c2_lat) ) { ++ span = bucket_span(c1_lat); ++ } else { ++ span = bucket_span(c2_lat); ++ } ++ ++#ifdef HAVE_RINT ++ *dx = (int)rint( diff_lon / span ); ++#else ++ if ( diff_lon > 0 ) { ++ *dx = (int)( diff_lon / span + 0.5 ); ++ } else { ++ *dx = (int)( diff_lon / span - 0.5 ); ++ } ++#endif ++} ++ ++ diff --cc simgear/bucket/newbucket.hxx index 00000000,00000000..64677680 new file mode 100644 --- /dev/null +++ b/simgear/bucket/newbucket.hxx @@@ -1,0 -1,0 +1,351 @@@ ++/************************************************************************** ++ * newbucket.hxx -- new bucket routines for better world modeling ++ * ++ * Written by Curtis L. Olson, started February 1999. ++ * ++ * Copyright (C) 1999 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 _NEWBUCKET_HXX ++#define _NEWBUCKET_HXX ++ ++#include ++#include ++ ++#ifdef FG_HAVE_STD_INCLUDES ++# include ++# include // sprintf() ++# include ++#else ++# include ++# include // sprintf() ++# include ++#endif ++ ++// I don't understand ... or should be included ++// already depending on how you defined FG_HAVE_STD_INCLUDES, but I ++// can go ahead and add this -- CLO ++#ifdef __MWERKS__ ++# include // needed fabs() ++#endif ++ ++#include STL_STRING ++ ++FG_USING_STD(string); ++ ++#if ! defined( FG_HAVE_NATIVE_SGI_COMPILERS ) ++FG_USING_STD(ostream); ++#endif ++ ++ ++ ++#define FG_BUCKET_SPAN 0.125 // 1/8 of a degree ++#define FG_HALF_BUCKET_SPAN 0.0625 // 1/2 of 1/8 of a degree = 1/16 = 0.0625 ++ ++class FGBucket; ++ostream& operator<< ( ostream&, const FGBucket& ); ++bool operator== ( const FGBucket&, const FGBucket& ); ++ ++class FGBucket { ++ ++private: ++ double cx, cy; // centerpoint (lon, lat) in degrees of bucket ++ int lon; // longitude index (-180 to 179) ++ int lat; // latitude index (-90 to 89) ++ int x; // x subdivision (0 to 7) ++ int y; // y subdivision (0 to 7) ++ ++public: ++ ++ // default constructor ++ FGBucket(); ++ ++ // create a bucket which would contain the specified lon/lat ++ FGBucket(const double lon, const double lat); ++ ++ // create a bucket based on "long int" index ++ FGBucket(const long int bindex); ++ ++ // create an impossible bucket if false ++ FGBucket(const bool is_good); ++ ++ ~FGBucket(); ++ ++ // Set the bucket params for the specified lat and lon ++ void set_bucket( double dlon, double dlat ); ++ void make_bad ( void ); ++ ++ // Generate the unique scenery tile index for this bucket ++ long int gen_index(); ++ string gen_index_str() const; ++ ++ // Build the path name for this bucket ++ string gen_base_path() const; ++ ++ // return the center lon of a tile ++ double get_center_lon() const; ++ ++ // return width of the tile ++ double get_width() const; ++ ++ // return the center lat of a tile ++ double get_center_lat() const; ++ ++ // return height of the tile ++ double get_height() const; ++ ++ // Informational methods ++ inline int get_lon() const { return lon; } ++ inline int get_lat() const { return lat; } ++ inline int get_x() const { return x; } ++ inline int get_y() const { return y; } ++ ++ // friends ++ friend ostream& operator<< ( ostream&, const FGBucket& ); ++ friend bool operator== ( const FGBucket&, const FGBucket& ); ++}; ++ ++ ++// return the horizontal tile span factor based on latitude ++inline double bucket_span( double l ) { ++ if ( l >= 89.0 ) { ++ return 360.0; ++ } else if ( l >= 88.0 ) { ++ return 8.0; ++ } else if ( l >= 86.0 ) { ++ return 4.0; ++ } else if ( l >= 83.0 ) { ++ return 2.0; ++ } else if ( l >= 76.0 ) { ++ return 1.0; ++ } else if ( l >= 62.0 ) { ++ return 0.5; ++ } else if ( l >= 22.0 ) { ++ return 0.25; ++ } else if ( l >= -22.0 ) { ++ return 0.125; ++ } else if ( l >= -62.0 ) { ++ return 0.25; ++ } else if ( l >= -76.0 ) { ++ return 0.5; ++ } else if ( l >= -83.0 ) { ++ return 1.0; ++ } else if ( l >= -86.0 ) { ++ return 2.0; ++ } else if ( l >= -88.0 ) { ++ return 4.0; ++ } else if ( l >= -89.0 ) { ++ return 8.0; ++ } else { ++ return 360.0; ++ } ++} ++ ++ ++// Set the bucket params for the specified lat and lon ++inline void FGBucket::set_bucket( double dlon, double dlat ) { ++ // ++ // latitude first ++ // ++ double span = bucket_span( dlat ); ++ double diff = dlon - (double)(int)dlon; ++ ++ // cout << "diff = " << diff << " span = " << span << endl; ++ ++ if ( (dlon >= 0) || (fabs(diff) < FG_EPSILON) ) { ++ lon = (int)dlon; ++ } else { ++ lon = (int)dlon - 1; ++ } ++ ++ // find subdivision or super lon if needed ++ if ( span < FG_EPSILON ) { ++ // polar cap ++ lon = 0; ++ x = 0; ++ } else if ( span <= 1.0 ) { ++ x = (int)((dlon - lon) / span); ++ } else { ++ if ( (dlon >= 0) || (fabs(diff) < FG_EPSILON) ) { ++ lon = (int)( (int)(lon / span) * span); ++ } else { ++ // cout << " lon = " << lon ++ // << " tmp = " << (int)((lon-1) / span) << endl; ++ lon = (int)( (int)((lon + 1) / span) * span - span); ++ if ( lon < -180 ) { ++ lon = -180; ++ } ++ } ++ x = 0; ++ } ++ ++ // ++ // then latitude ++ // ++ diff = dlat - (double)(int)dlat; ++ ++ if ( (dlat >= 0) || (fabs(diff) < FG_EPSILON) ) { ++ lat = (int)dlat; ++ } else { ++ lat = (int)dlat - 1; ++ } ++ y = (int)((dlat - lat) * 8); ++} ++ ++ ++// default constructor ++inline FGBucket::FGBucket() {} ++ ++ ++// constructor for specified location ++inline FGBucket::FGBucket(const double dlon, const double dlat) { ++ set_bucket(dlon, dlat); ++} ++ ++ ++// create an impossible bucket if false ++inline FGBucket::FGBucket(const bool is_good) { ++ set_bucket(0.0, 0.0); ++ if ( !is_good ) { ++ lon = -1000; ++ } ++} ++ ++ ++// Parse a unique scenery tile index and find the lon, lat, x, and y ++inline FGBucket::FGBucket(const long int bindex) { ++ long int index = bindex; ++ ++ lon = index >> 14; ++ index -= lon << 14; ++ lon -= 180; ++ ++ lat = index >> 6; ++ index -= lat << 6; ++ lat -= 90; ++ ++ y = index >> 3; ++ index -= y << 3; ++ ++ x = index; ++} ++ ++ ++// default destructor ++inline FGBucket::~FGBucket() {} ++ ++ ++// Generate the unique scenery tile index for this bucket ++// ++// The index is constructed as follows: ++// ++// 9 bits - to represent 360 degrees of longitude (-180 to 179) ++// 8 bits - to represent 180 degrees of latitude (-90 to 89) ++// ++// Each 1 degree by 1 degree tile is further broken down into an 8x8 ++// grid. So we also need: ++// ++// 3 bits - to represent x (0 to 7) ++// 3 bits - to represent y (0 to 7) ++ ++inline long int FGBucket::gen_index() { ++ return ((lon + 180) << 14) + ((lat + 90) << 6) + (y << 3) + x; ++} ++ ++inline string FGBucket::gen_index_str() const { ++ char tmp[20]; ++ sprintf(tmp, "%ld", ++ (((long)lon + 180) << 14) + ((lat + 90) << 6) + (y << 3) + x); ++ return (string)tmp; ++} ++ ++ ++// return the center lon of a tile ++inline double FGBucket::get_center_lon() const { ++ double span = bucket_span( lat + y / 8.0 + FG_HALF_BUCKET_SPAN ); ++ ++ if ( span >= 1.0 ) { ++ return lon + span / 2.0; ++ } else { ++ return lon + x * span + span / 2.0; ++ } ++} ++ ++ ++// return the center lat of a tile ++inline double FGBucket::get_center_lat() const { ++ return lat + y / 8.0 + FG_HALF_BUCKET_SPAN; ++} ++ ++ ++// return width of the tile ++inline double FGBucket::get_width() const { ++ return bucket_span( get_center_lat() ); ++} ++ ++ ++// return height of the tile ++inline double FGBucket::get_height() const { ++ return FG_BUCKET_SPAN; ++} ++ ++ ++// create an impossible bucket ++inline void FGBucket::make_bad( void ) { ++ set_bucket(0.0, 0.0); ++ lon = -1000; ++} ++ ++ ++// offset a bucket struct by the specified tile units in the X & Y ++// direction ++FGBucket fgBucketOffset( double dlon, double dlat, int x, int y ); ++ ++ ++// calculate the offset between two buckets ++void fgBucketDiff( const FGBucket& b1, const FGBucket& b2, int *dx, int *dy ); ++ ++ ++/* ++// Given a lat/lon, fill in the local tile index array ++void fgBucketGenIdxArray(fgBUCKET *p1, fgBUCKET *tiles, int width, int height); ++*/ ++ ++ ++inline ostream& ++operator<< ( ostream& out, const FGBucket& b ) ++{ ++ return out << b.lon << ":" << b.x << ", " << b.lat << ":" << b.y; ++} ++ ++ ++inline bool ++operator== ( const FGBucket& b1, const FGBucket& b2 ) ++{ ++ return ( b1.lon == b2.lon && ++ b1.lat == b2.lat && ++ b1.x == b2.x && ++ b1.y == b2.y ); ++} ++ ++ ++#endif // _NEWBUCKET_HXX ++ ++ diff --cc simgear/debug/Makefile.am index 00000000,00000000..2fe60c37 new file mode 100644 --- /dev/null +++ b/simgear/debug/Makefile.am @@@ -1,0 -1,0 +1,9 @@@ ++EXTRA_DIST = logtest.cxx ++ ++lib_LIBRARIES = libsgdebug.a ++ ++include_HEADERS = debug_types.h logstream.hxx ++ ++libsgdebug_a_SOURCES = logstream.cxx ++ ++INCLUDES += -I$(top_builddir) diff --cc simgear/debug/Makefile.in index 00000000,00000000..0cda2c28 new file mode 100644 --- /dev/null +++ b/simgear/debug/Makefile.in @@@ -1,0 -1,0 +1,338 @@@ ++# Makefile.in generated automatically by automake 1.3 from Makefile.am ++ ++# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++ ++SHELL = /bin/sh ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++prefix = @prefix@ ++exec_prefix = @exec_prefix@ ++ ++bindir = @bindir@ ++sbindir = @sbindir@ ++libexecdir = @libexecdir@ ++datadir = @datadir@ ++sysconfdir = @sysconfdir@ ++sharedstatedir = @sharedstatedir@ ++localstatedir = @localstatedir@ ++libdir = @libdir@ ++infodir = @infodir@ ++mandir = @mandir@ ++includedir = @includedir@ ++oldincludedir = /usr/include ++ ++DISTDIR = ++ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++ ++top_builddir = .. ++ ++ACLOCAL = @ACLOCAL@ ++AUTOCONF = @AUTOCONF@ ++AUTOMAKE = @AUTOMAKE@ ++AUTOHEADER = @AUTOHEADER@ ++ ++INSTALL = @INSTALL@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++transform = @program_transform_name@ ++ ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++CC = @CC@ ++CXX = @CXX@ ++LN_S = @LN_S@ ++MAKEINFO = @MAKEINFO@ ++PACKAGE = @PACKAGE@ ++RANLIB = @RANLIB@ ++VERSION = @VERSION@ ++base_LIBS = @base_LIBS@ ++opengl_LIBS = @opengl_LIBS@ ++ ++EXTRA_DIST = logtest.cxx ++ ++lib_LIBRARIES = libsgdebug.a ++ ++include_HEADERS = debug_types.h logstream.hxx ++ ++libsgdebug_a_SOURCES = logstream.cxx ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = ../include/config.h ++CONFIG_CLEAN_FILES = ++LIBRARIES = $(lib_LIBRARIES) ++ ++ ++DEFS = @DEFS@ -I. -I$(srcdir) -I../include ++CPPFLAGS = @CPPFLAGS@ ++LDFLAGS = @LDFLAGS@ ++LIBS = @LIBS@ ++X_CFLAGS = @X_CFLAGS@ ++X_LIBS = @X_LIBS@ ++X_EXTRA_LIBS = @X_EXTRA_LIBS@ ++X_PRE_LIBS = @X_PRE_LIBS@ ++libsgdebug_a_LIBADD = ++libsgdebug_a_OBJECTS = logstream.o ++AR = ar ++CXXFLAGS = @CXXFLAGS@ ++CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++CXXLINK = $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ ++HEADERS = $(include_HEADERS) ++ ++DIST_COMMON = Makefile.am Makefile.in ++ ++ ++DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ++ ++TAR = tar ++GZIP = --best ++DEP_FILES = .deps/logstream.P ++CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++SOURCES = $(libsgdebug_a_SOURCES) ++OBJECTS = $(libsgdebug_a_OBJECTS) ++ ++all: Makefile $(LIBRARIES) $(HEADERS) ++ ++.SUFFIXES: ++.SUFFIXES: .S .c .cxx .o .s ++$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu debug/Makefile ++ ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++ ++mostlyclean-libLIBRARIES: ++ ++clean-libLIBRARIES: ++ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) ++ ++distclean-libLIBRARIES: ++ ++maintainer-clean-libLIBRARIES: ++ ++install-libLIBRARIES: $(lib_LIBRARIES) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(libdir) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ ++ $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ @$(POST_INSTALL) ++ @list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ ++ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ ++uninstall-libLIBRARIES: ++ @$(NORMAL_UNINSTALL) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(libdir)/$$p; \ ++ done ++ ++.s.o: ++ $(COMPILE) -c $< ++ ++.S.o: ++ $(COMPILE) -c $< ++ ++mostlyclean-compile: ++ -rm -f *.o core *.core ++ ++clean-compile: ++ ++distclean-compile: ++ -rm -f *.tab.c ++ ++maintainer-clean-compile: ++ ++libsgdebug.a: $(libsgdebug_a_OBJECTS) $(libsgdebug_a_DEPENDENCIES) ++ -rm -f libsgdebug.a ++ $(AR) cru libsgdebug.a $(libsgdebug_a_OBJECTS) $(libsgdebug_a_LIBADD) ++ $(RANLIB) libsgdebug.a ++.cxx.o: ++ $(CXXCOMPILE) -c $< ++ ++install-includeHEADERS: $(include_HEADERS) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(includedir) ++ @list='$(include_HEADERS)'; for p in $$list; do \ ++ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ ++ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ ++ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++uninstall-includeHEADERS: ++ @$(NORMAL_UNINSTALL) ++ list='$(include_HEADERS)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++tags: TAGS ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) ++ here=`pwd` && cd $(srcdir) \ ++ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) ++ ++TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ ++ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ ++mostlyclean-tags: ++ ++clean-tags: ++ ++distclean-tags: ++ -rm -f TAGS ID ++ ++maintainer-clean-tags: ++ ++distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) ++ ++subdir = debug ++ ++distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu debug/Makefile ++ @for file in $(DISTFILES); do \ ++ d=$(srcdir); \ ++ test -f $(distdir)/$$file \ ++ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ++ || cp -p $$d/$$file $(distdir)/$$file; \ ++ done ++ ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ ++maintainer-clean-depend: ++ -rm -rf .deps ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++ ++%.o: %.cxx ++ @echo '$(CXXCOMPILE) -c $<'; \ ++ $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.cxx ++ @echo '$(LTCXXCOMPILE) -c $<'; \ ++ $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++info: ++dvi: ++check: all ++ $(MAKE) ++installcheck: ++install-exec: install-libLIBRARIES ++ @$(NORMAL_INSTALL) ++ ++install-data: install-includeHEADERS ++ @$(NORMAL_INSTALL) ++ ++install: install-exec install-data all ++ @: ++ ++uninstall: uninstall-libLIBRARIES uninstall-includeHEADERS ++ ++install-strip: ++ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install ++installdirs: ++ $(mkinstalldirs) $(DATADIR)$(libdir) $(DATADIR)$(includedir) ++ ++ ++mostlyclean-generic: ++ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f Makefile $(DISTCLEANFILES) ++ -rm -f config.cache config.log stamp-h stamp-h[0-9]* ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) ++ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) ++mostlyclean: mostlyclean-libLIBRARIES mostlyclean-compile \ ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic ++ ++clean: clean-libLIBRARIES clean-compile clean-tags clean-depend \ ++ clean-generic mostlyclean ++ ++distclean: distclean-libLIBRARIES distclean-compile distclean-tags \ ++ distclean-depend distclean-generic clean ++ -rm -f config.status ++ ++maintainer-clean: maintainer-clean-libLIBRARIES \ ++ maintainer-clean-compile maintainer-clean-tags \ ++ maintainer-clean-depend maintainer-clean-generic \ ++ distclean ++ @echo "This command is intended for maintainers to use;" ++ @echo "it deletes files that may require special tools to rebuild." ++ ++.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \ ++clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ ++install-libLIBRARIES mostlyclean-compile distclean-compile \ ++clean-compile maintainer-clean-compile uninstall-includeHEADERS \ ++install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ ++maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ ++clean-depend maintainer-clean-depend info dvi installcheck install-exec \ ++install-data install uninstall all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean ++ ++ ++INCLUDES += -I$(top_builddir) ++ ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --cc simgear/debug/debug_types.h index 00000000,00000000..4c310d21 new file mode 100644 --- /dev/null +++ b/simgear/debug/debug_types.h @@@ -1,0 -1,0 +1,38 @@@ ++// NB: To add a dbg_class, add it here, and add it to the structure in ++// fg_debug.c ++ ++typedef enum { ++ FG_NONE = 0x00000000, ++ ++ FG_TERRAIN = 0x00000001, ++ FG_ASTRO = 0x00000002, ++ FG_FLIGHT = 0x00000004, ++ FG_INPUT = 0x00000008, ++ FG_GL = 0x00000010, ++ FG_VIEW = 0x00000020, ++ FG_COCKPIT = 0x00000040, ++ FG_GENERAL = 0x00000080, ++ FG_MATH = 0x00000100, ++ FG_EVENT = 0x00000200, ++ FG_AIRCRAFT = 0x00000400, ++ FG_AUTOPILOT = 0x00000800, ++ FG_IO = 0x00001000, ++ FG_CLIPPER = 0x00002000, ++ FG_NETWORK = 0x00004000, ++ FG_UNDEFD = 0x00008000, // For range checking ++ ++ FG_ALL = 0xFFFFFFFF ++} fgDebugClass; ++ ++ ++// NB: To add a priority, add it here. ++typedef enum { ++ FG_BULK, // For frequent messages ++ FG_DEBUG, // Less frequent debug type messages ++ FG_INFO, // Informatory messages ++ FG_WARN, // Possible impending problem ++ FG_ALERT // Very possible impending problem ++ // FG_EXIT, // Problem (no core) ++ // FG_ABORT // Abandon ship (core) ++} fgDebugPriority; ++ diff --cc simgear/debug/logstream.cxx index 00000000,00000000..66940629 new file mode 100644 --- /dev/null +++ b/simgear/debug/logstream.cxx @@@ -1,0 -1,0 +1,63 @@@ ++// Stream based logging mechanism. ++// ++// Written by Bernie Bright, 1998 ++// ++// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au ++// ++// 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 "logstream.hxx" ++ ++bool logbuf::logging_enabled = true; ++fgDebugClass logbuf::logClass = FG_NONE; ++fgDebugPriority logbuf::logPriority = FG_INFO; ++streambuf* logbuf::sbuf = NULL; ++ ++logbuf::logbuf() ++{ ++// if ( sbuf == NULL ) ++// sbuf = cerr.rdbuf(); ++} ++ ++logbuf::~logbuf() ++{ ++ if ( sbuf ) ++ sync(); ++} ++ ++void ++logbuf::set_sb( streambuf* sb ) ++{ ++ if ( sbuf ) ++ sync(); ++ ++ sbuf = sb; ++} ++ ++void ++logbuf::set_log_level( fgDebugClass c, fgDebugPriority p ) ++{ ++ logClass = c; ++ logPriority = p; ++} ++ ++void ++logstream::setLogLevels( fgDebugClass c, fgDebugPriority p ) ++{ ++ logbuf::set_log_level( c, p ); ++} ++ diff --cc simgear/debug/logstream.hxx index 00000000,00000000..bc1a4fbf new file mode 100644 --- /dev/null +++ b/simgear/debug/logstream.hxx @@@ -1,0 -1,0 +1,220 @@@ ++// Stream based logging mechanism. ++// ++// Written by Bernie Bright, 1998 ++// ++// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au ++// ++// 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 _LOGSTREAM_H ++#define _LOGSTREAM_H ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++ ++#include ++ ++#ifdef FG_HAVE_STD_INCLUDES ++# include ++# include ++#else ++# include ++# include ++#endif ++ ++#include ++ ++#ifndef FG_HAVE_NATIVE_SGI_COMPILERS ++FG_USING_STD(streambuf); ++FG_USING_STD(ostream); ++FG_USING_STD(cerr); ++FG_USING_STD(endl); ++#endif ++ ++#ifdef __MWERKS__ ++# define cerr std::cerr ++# define endl std::endl ++FG_USING_STD(iostream); ++#endif ++ ++// ++// TODO: ++// ++// 1. Change output destination. Done. ++// 2. Make logbuf thread safe. ++// 3. Read environment for default debugClass and debugPriority. ++// ++ ++//----------------------------------------------------------------------------- ++// ++// logbuf is an output-only streambuf with the ability to disable sets of ++// messages at runtime. Only messages with priority >= logbuf::logPriority ++// and debugClass == logbuf::logClass are output. ++// ++class logbuf : public streambuf ++{ ++public: ++ ++#ifndef FG_HAVE_STD_INCLUDES ++ typedef char_traits traits_type; ++ typedef char_traits::int_type int_type; ++ typedef char_traits::pos_type pos_type; ++ typedef char_traits::off_type off_type; ++#endif ++// logbuf( streambuf* sb ) : sbuf(sb) {} ++ logbuf(); ++ ~logbuf(); ++ ++ // Is logging enabled? ++ bool enabled() { return logging_enabled; } ++ ++ // Set the logging level of subsequent messages. ++ void set_log_state( fgDebugClass c, fgDebugPriority p ); ++ ++ // Set the global logging level. ++ static void set_log_level( fgDebugClass c, fgDebugPriority p ); ++ ++ // ++ void set_sb( streambuf* sb ); ++ ++protected: ++ ++ inline virtual int sync(); ++ int_type overflow( int ch ); ++// int xsputn( const char* s, istreamsize n ); ++ ++private: ++ ++ // The streambuf used for actual output. Defaults to cerr.rdbuf(). ++ static streambuf* sbuf; ++ ++ static bool logging_enabled; ++ static fgDebugClass logClass; ++ static fgDebugPriority logPriority; ++ ++private: ++ ++ // Not defined. ++ logbuf( const logbuf& ); ++ void operator= ( const logbuf& ); ++}; ++ ++inline int ++logbuf::sync() ++{ ++#ifdef FG_HAVE_STD_INCLUDES ++ return sbuf->pubsync(); ++#else ++ return sbuf->sync(); ++#endif ++} ++ ++inline void ++logbuf::set_log_state( fgDebugClass c, fgDebugPriority p ) ++{ ++ logging_enabled = ((c & logClass) != 0 && p >= logPriority); ++} ++ ++inline logbuf::int_type ++logbuf::overflow( int c ) ++{ ++ return logging_enabled ? sbuf->sputc(c) : (EOF == 0 ? 1: 0); ++} ++ ++//----------------------------------------------------------------------------- ++// ++// logstream manipulator for setting the log level of a message. ++// ++struct loglevel ++{ ++ loglevel( fgDebugClass c, fgDebugPriority p ) ++ : logClass(c), logPriority(p) {} ++ ++ fgDebugClass logClass; ++ fgDebugPriority logPriority; ++}; ++ ++//----------------------------------------------------------------------------- ++// ++// A helper class that ensures a streambuf and ostream are constructed and ++// destroyed in the correct order. The streambuf must be created before the ++// ostream but bases are constructed before members. Thus, making this class ++// a private base of logstream, declared to the left of ostream, we ensure the ++// correct order of construction and destruction. ++// ++struct logstream_base ++{ ++// logstream_base( streambuf* sb ) : lbuf(sb) {} ++ logstream_base() {} ++ ++ logbuf lbuf; ++}; ++ ++//----------------------------------------------------------------------------- ++// ++// ++// ++class logstream : private logstream_base, public ostream ++{ ++public: ++ // The default is to send messages to cerr. ++ logstream( ostream& out ) ++// : logstream_base(out.rdbuf()), ++ : logstream_base(), ++ ostream(&lbuf) { lbuf.set_sb(out.rdbuf());} ++ ++ void set_output( ostream& out ) { lbuf.set_sb( out.rdbuf() ); } ++ ++ // Set the global log class and priority level. ++ void setLogLevels( fgDebugClass c, fgDebugPriority p ); ++ ++ // Output operator to capture the debug level and priority of a message. ++ inline ostream& operator<< ( const loglevel& l ); ++}; ++ ++inline ostream& ++logstream::operator<< ( const loglevel& l ) ++{ ++ lbuf.set_log_state( l.logClass, l.logPriority ); ++ return *this; ++} ++ ++//----------------------------------------------------------------------------- ++// ++// Return the one and only logstream instance. ++// We use a function instead of a global object so we are assured that cerr ++// has been initialised. ++// ++inline logstream& ++fglog() ++{ ++ static logstream logstrm( cerr ); ++ return logstrm; ++} ++ ++#ifdef FG_NDEBUG ++# define FG_LOG(C,P,M) ++#elif defined( __MWERKS__ ) ++# define FG_LOG(C,P,M) ::fglog() << ::loglevel(C,P) << M << std::endl ++#else ++# define FG_LOG(C,P,M) fglog() << loglevel(C,P) << M << endl ++#endif ++ ++#endif // _LOGSTREAM_H ++ diff --cc simgear/debug/logtest.cxx index 00000000,00000000..b02c6b08 new file mode 100644 --- /dev/null +++ b/simgear/debug/logtest.cxx @@@ -1,0 -1,0 +1,34 @@@ ++#include ++#include "Debug/logstream.hxx" ++ ++int ++main( int argc, char* argv[] ) ++{ ++ fglog().setLogLevels( FG_ALL, FG_INFO ); ++ ++ FG_LOG( FG_TERRAIN, FG_BULK, "terrain::bulk" ); // shouldnt appear ++ FG_LOG( FG_TERRAIN, FG_DEBUG, "terrain::debug" ); // shouldnt appear ++ FG_LOG( FG_TERRAIN, FG_INFO, "terrain::info" ); ++ FG_LOG( FG_TERRAIN, FG_WARN, "terrain::warn" ); ++ FG_LOG( FG_TERRAIN, FG_ALERT, "terrain::alert" ); ++ ++ int i = 12345; ++ long l = 54321L; ++ double d = 3.14159; ++ string s = "Hello world!"; ++ ++ FG_LOG( FG_EVENT, FG_INFO, "event::info " ++ << "i=" << i ++ << ", l=" << l ++ << ", d=" << d ++ << ", d*l=" << d*l ++ << ", s=\"" << s << "\"" ); ++ ++ // This shouldn't appear in log output: ++ FG_LOG( FG_EVENT, FG_DEBUG, "event::debug " ++ << "- this should be seen - " ++ << "d=" << d ++ << ", s=\"" << s << "\"" ); ++ ++ return 0; ++} diff --cc simgear/math/MAT3geom.c index 00000000,00000000..d07728d6 new file mode 100644 --- /dev/null +++ b/simgear/math/MAT3geom.c @@@ -1,0 -1,0 +1,168 @@@ ++/* #include "HEADERS.h" */ ++/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */ ++ ++/* -------------------------------------------------------------------------- ++ * This file contains routines that perform geometry-related operations ++ * on matrices. ++ * -------------------------------------------------------------------------*/ ++ ++#include "mat3defs.h" ++ ++/* -------------------------- Static Routines ---------------------------- */ ++ ++/* ------------------------- Internal Routines --------------------------- */ ++ ++/* -------------------------- Public Routines ---------------------------- */ ++ ++/* ++ * This takes a matrix used to transform points, and returns a corresponding ++ * matrix that can be used to transform direction vectors (between points). ++ */ ++ ++void ++MAT3direction_matrix(register double (*result_mat)[4], register double (*mat)[4]) ++{ ++ register int i; ++ ++ MAT3copy(result_mat, mat); ++ ++ for (i = 0; i < 4; i++) result_mat[i][3] = result_mat[3][i] = 0.0; ++ ++ result_mat[3][3] = 1.0; ++} ++ ++/* ++ * This takes a matrix used to transform points, and returns a corresponding ++ * matrix that can be used to transform vectors that must remain perpendicular ++ * to planes defined by the points. It is useful when you are transforming ++ * some object that has both points and normals in its definition, and you ++ * only have the transformation matrix for the points. This routine returns ++ * FALSE if the normal matrix is uncomputable. Otherwise, it returns TRUE. ++ * ++ * Spike sez: "This is the adjoint for the non-homogeneous part of the ++ * transformation." ++ */ ++ ++int ++MAT3normal_matrix(register double (*result_mat)[4], register double (*mat)[4]) ++{ ++ register int ret; ++ MAT3mat tmp_mat; ++ ++ MAT3direction_matrix(result_mat, mat); ++ ++ if ( (ret = MAT3invert(tmp_mat, tmp_mat)) ) { ++ MAT3transpose(result_mat, tmp_mat); ++ } ++ ++ return(ret); ++} ++ ++/* ++ * Sets the given matrix to be a scale matrix for the given vector of ++ * scale values. ++ */ ++ ++void ++MAT3scale(double (*result_mat)[4], double *scale) ++{ ++ MAT3identity(result_mat); ++ ++ result_mat[0][0] = scale[0]; ++ result_mat[1][1] = scale[1]; ++ result_mat[2][2] = scale[2]; ++} ++ ++/* ++ * Sets up a matrix for a rotation about an axis given by the line from ++ * (0,0,0) to axis, through an angle (in radians). ++ * Looking along the axis toward the origin, the rotation is counter-clockwise. ++ */ ++ ++#define SELECT .7071 /* selection constant (roughly .5*sqrt(2) */ ++ ++void ++MAT3rotate(double (*result_mat)[4], double *axis, double angle_in_radians) ++{ ++ MAT3vec naxis, /* Axis of rotation, normalized */ ++ base2, /* 2nd unit basis vec, perp to axis */ ++ base3; /* 3rd unit basis vec, perp to axis & base2 */ ++ double dot; ++ MAT3mat base_mat, /* Change-of-basis matrix */ ++ base_mat_trans; /* Inverse of c-o-b matrix */ ++ register int i; ++ ++ /* Step 1: extend { axis } to a basis for 3-space: { axis, base2, base3 } ++ * which is orthonormal (all three have unit length, and all three are ++ * mutually orthogonal). Also should be oriented, i.e. axis cross base2 = ++ * base3, rather than -base3. ++ * ++ * Method: Find a vector linearly independent from axis. For this we ++ * either use the y-axis, or, if that is too close to axis, the ++ * z-axis. 'Too close' means that the dot product is too near to 1. ++ */ ++ ++ MAT3_COPY_VEC(naxis, axis); ++ MAT3_NORMALIZE_VEC(naxis, dot); ++ ++ if (dot == 0.0) { ++ /* ERR_ERROR(MAT3_errid, ERR_SEVERE, ++ (ERR_S, "Zero-length axis vector given to MAT3rotate")); */ ++ return; ++ } ++ ++ MAT3perp_vec(base2, naxis, TRUE); ++ MAT3cross_product(base3, naxis, base2); ++ ++ /* Set up the change-of-basis matrix, and its inverse */ ++ MAT3identity(base_mat); ++ MAT3identity(base_mat_trans); ++ MAT3identity(result_mat); ++ ++ for (i = 0; i < 3; i++){ ++ base_mat_trans[i][0] = base_mat[0][i] = naxis[i]; ++ base_mat_trans[i][1] = base_mat[1][i] = base2[i]; ++ base_mat_trans[i][2] = base_mat[2][i] = base3[i]; ++ } ++ ++ /* If T(u) = uR, where R is base_mat, then T(x-axis) = naxis, ++ * T(y-axis) = base2, and T(z-axis) = base3. The inverse of base_mat is ++ * its transpose. OK? ++ */ ++ ++ result_mat[1][1] = result_mat[2][2] = cos(angle_in_radians); ++ result_mat[2][1] = -(result_mat[1][2] = sin(angle_in_radians)); ++ ++ MAT3mult(result_mat, base_mat_trans, result_mat); ++ MAT3mult(result_mat, result_mat, base_mat); ++} ++ ++/* ++ * Sets the given matrix to be a translation matrix for the given vector of ++ * translation values. ++ */ ++ ++void ++MAT3translate(double (*result_mat)[4], double *trans) ++{ ++ MAT3identity(result_mat); ++ ++ result_mat[3][0] = trans[0]; ++ result_mat[3][1] = trans[1]; ++ result_mat[3][2] = trans[2]; ++} ++ ++/* ++ * Sets the given matrix to be a shear matrix for the given x and y shear ++ * values. ++ */ ++ ++void ++MAT3shear(double (*result_mat)[4], double xshear, double yshear) ++{ ++ MAT3identity(result_mat); ++ ++ result_mat[2][0] = xshear; ++ result_mat[2][1] = yshear; ++} ++ diff --cc simgear/math/MAT3inv.c index 00000000,00000000..b787b8b7 new file mode 100644 --- /dev/null +++ b/simgear/math/MAT3inv.c @@@ -1,0 -1,0 +1,311 @@@ ++/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */ ++ ++/* -------------------------------------------------------------------------- ++ * This file contains routines that operate solely on matrices. ++ * -------------------------------------------------------------------------*/ ++ ++#include "mat3defs.h" ++ ++/* -------------------------- Static Routines ---------------------------- */ ++ ++#define SMALL 1e-20 /* Small enough to be considered zero */ ++ ++/* ++ * Shuffles rows in inverse of 3x3. See comment in MAT3_inv3_second_col(). ++ */ ++ ++static void ++MAT3_inv3_swap( register double inv[3][3], int row0, int row1, int row2) ++{ ++ register int i, tempi; ++ double temp; ++ ++#define SWAP_ROWS(a, b) \ ++ for (i = 0; i < 3; i++) SWAP(inv[a][i], inv[b][i], temp); \ ++ SWAP(a, b, tempi) ++ ++ if (row0 != 0){ ++ if (row1 == 0) { ++ SWAP_ROWS(row0, row1); ++ } ++ else { ++ SWAP_ROWS(row0, row2); ++ } ++ } ++ ++ if (row1 != 1) { ++ SWAP_ROWS(row1, row2); ++ } ++} ++ ++/* ++ * Does Gaussian elimination on second column. ++ */ ++ ++static int ++MAT3_inv3_second_col (register double source[3][3], register double inv[3][3], int row0) ++{ ++ register int row1, row2, i1, i2, i; ++ double temp; ++ double a, b; ++ ++ /* Find which row to use */ ++ if (row0 == 0) i1 = 1, i2 = 2; ++ else if (row0 == 1) i1 = 0, i2 = 2; ++ else i1 = 0, i2 = 1; ++ ++ /* Find which is larger in abs. val.:the entry in [i1][1] or [i2][1] */ ++ /* and use that value for pivoting. */ ++ ++ a = source[i1][1]; if (a < 0) a = -a; ++ b = source[i2][1]; if (b < 0) b = -b; ++ if (a > b) row1 = i1; ++ else row1 = i2; ++ row2 = (row1 == i1 ? i2 : i1); ++ ++ /* Scale row1 in source */ ++ if ((source[row1][1] < SMALL) && (source[row1][1] > -SMALL)) return(FALSE); ++ temp = 1.0 / source[row1][1]; ++ source[row1][1] = 1.0; ++ source[row1][2] *= temp; /* source[row1][0] is zero already */ ++ ++ /* Scale row1 in inv */ ++ inv[row1][row1] = temp; /* it used to be a 1.0 */ ++ inv[row1][row0] *= temp; ++ ++ /* Clear column one, source, and make corresponding changes in inv */ ++ ++ for (i = 0; i < 3; i++) if (i != row1) { /* for i = all rows but row1 */ ++ temp = -source[i][1]; ++ source[i][1] = 0.0; ++ source[i][2] += temp * source[row1][2]; ++ ++ inv[i][row1] = temp * inv[row1][row1]; ++ inv[i][row0] += temp * inv[row1][row0]; ++ } ++ ++ /* Scale row2 in source */ ++ if ((source[row2][2] < SMALL) && (source[row2][2] > -SMALL)) return(FALSE); ++ temp = 1.0 / source[row2][2]; ++ source[row2][2] = 1.0; /* source[row2][*] is zero already */ ++ ++ /* Scale row2 in inv */ ++ inv[row2][row2] = temp; /* it used to be a 1.0 */ ++ inv[row2][row0] *= temp; ++ inv[row2][row1] *= temp; ++ ++ /* Clear column one, source, and make corresponding changes in inv */ ++ for (i = 0; i < 3; i++) if (i != row2) { /* for i = all rows but row2 */ ++ temp = -source[i][2]; ++ source[i][2] = 0.0; ++ inv[i][row0] += temp * inv[row2][row0]; ++ inv[i][row1] += temp * inv[row2][row1]; ++ inv[i][row2] += temp * inv[row2][row2]; ++ } ++ ++ /* ++ * Now all is done except that the inverse needs to have its rows shuffled. ++ * row0 needs to be moved to inv[0][*], row1 to inv[1][*], etc. ++ * ++ * We *didn't* do the swapping before the elimination so that we could more ++ * easily keep track of what ops are needed to be done in the inverse. ++ */ ++ MAT3_inv3_swap(inv, row0, row1, row2); ++ ++ return(TRUE); ++} ++ ++/* ++ * Fast inversion routine for 3 x 3 matrices. - Written by jfh. ++ * ++ * This takes 30 multiplies/divides, as opposed to 39 for Cramer's Rule. ++ * The algorithm consists of performing fast gaussian elimination, by never ++ * doing any operations where the result is guaranteed to be zero, or where ++ * one operand is guaranteed to be zero. This is done at the cost of clarity, ++ * alas. ++ * ++ * Returns 1 if the inverse was successful, 0 if it failed. ++ */ ++ ++static int ++MAT3_invert3 (register double source[3][3], register double inv[3][3]) ++{ ++ register int i, row0; ++ double temp; ++ double a, b, c; ++ ++ inv[0][0] = inv[1][1] = inv[2][2] = 1.0; ++ inv[0][1] = inv[0][2] = inv[1][0] = inv[1][2] = inv[2][0] = inv[2][1] = 0.0; ++ ++ /* attempt to find the largest entry in first column to use as pivot */ ++ a = source[0][0]; if (a < 0) a = -a; ++ b = source[1][0]; if (b < 0) b = -b; ++ c = source[2][0]; if (c < 0) c = -c; ++ ++ if (a > b) { ++ if (a > c) row0 = 0; ++ else row0 = 2; ++ } ++ else { ++ if (b > c) row0 = 1; ++ else row0 = 2; ++ } ++ ++ /* Scale row0 of source */ ++ if ((source[row0][0] < SMALL) && (source[row0][0] > -SMALL)) return(FALSE); ++ temp = 1.0 / source[row0][0]; ++ source[row0][0] = 1.0; ++ source[row0][1] *= temp; ++ source[row0][2] *= temp; ++ ++ /* Scale row0 of inverse */ ++ inv[row0][row0] = temp; /* other entries are zero -- no effort */ ++ ++ /* Clear column zero of source, and make corresponding changes in inverse */ ++ ++ for (i = 0; i < 3; i++) if (i != row0) { /* for i = all rows but row0 */ ++ temp = -source[i][0]; ++ source[i][0] = 0.0; ++ source[i][1] += temp * source[row0][1]; ++ source[i][2] += temp * source[row0][2]; ++ inv[i][row0] = temp * inv[row0][row0]; ++ } ++ ++ /* ++ * We've now done gaussian elimination so that the source and ++ * inverse look like this: ++ * ++ * 1 * * * 0 0 ++ * 0 * * * 1 0 ++ * 0 * * * 0 1 ++ * ++ * We now proceed to do elimination on the second column. ++ */ ++ if (! MAT3_inv3_second_col(source, inv, row0)) return(FALSE); ++ ++ return(TRUE); ++} ++ ++/* ++ * Finds a new pivot for a non-simple 4x4. See comments in MAT3invert(). ++ */ ++ ++static int ++MAT3_inv4_pivot (register MAT3mat src, MAT3vec r, double *s, int *swap) ++{ ++ register int i, j; ++ double temp, max; ++ ++ *swap = -1; ++ ++ if (MAT3_IS_ZERO(src[3][3])) { ++ ++ /* Look for a different pivot element: one with largest abs value */ ++ max = 0.0; ++ ++ for (i = 0; i < 4; i++) { ++ if (src[i][3] > max) max = src[*swap = i][3]; ++ else if (src[i][3] < -max) max = -src[*swap = i][3]; ++ } ++ ++ /* No pivot element available ! */ ++ if (*swap < 0) return(FALSE); ++ ++ else for (j = 0; j < 4; j++) SWAP(src[*swap][j], src[3][j], temp); ++ } ++ ++ MAT3_SET_VEC (r, -src[0][3], -src[1][3], -src[2][3]); ++ ++ *s = 1.0 / src[3][3]; ++ ++ src[0][3] = src[1][3] = src[2][3] = 0.0; ++ src[3][3] = 1.0; ++ ++ MAT3_SCALE_VEC(src[3], src[3], *s); ++ ++ for (i = 0; i < 3; i++) { ++ src[0][i] += r[0] * src[3][i]; ++ src[1][i] += r[1] * src[3][i]; ++ src[2][i] += r[2] * src[3][i]; ++ } ++ ++ return(TRUE); ++} ++ ++/* ------------------------- Internal Routines --------------------------- */ ++ ++/* -------------------------- Public Routines ---------------------------- */ ++ ++/* ++ * This returns the inverse of the given matrix. The result matrix ++ * may be the same as the one to invert. ++ * ++ * Fast inversion routine for 4 x 4 matrices, written by jfh. ++ * ++ * Returns 1 if the inverse was successful, 0 if it failed. ++ * ++ * This routine has been specially tweaked to notice the following: ++ * If the matrix has the form ++ * * * * 0 ++ * * * * 0 ++ * * * * 0 ++ * * * * 1 ++ * ++ * (as do many matrices in graphics), then we compute the inverse of ++ * the upper left 3x3 matrix and use this to find the general inverse. ++ * ++ * In the event that the right column is not 0-0-0-1, we do gaussian ++ * elimination to make it so, then use the 3x3 inverse, and then do ++ * our gaussian elimination. ++ */ ++ ++int ++MAT3invert(double (*result_mat)[4], double (*mat)[4]) ++{ ++ MAT3mat src, inv; ++ register int i, j, simple; ++ double m[3][3], inv3[3][3], s, temp; ++ MAT3vec r, t; ++ int swap; ++ ++ MAT3copy(src, mat); ++ MAT3identity(inv); ++ ++ /* If last column is not (0,0,0,1), use special code */ ++ simple = (mat[0][3] == 0.0 && mat[1][3] == 0.0 && ++ mat[2][3] == 0.0 && mat[3][3] == 1.0); ++ ++ if (! simple && ! MAT3_inv4_pivot(src, r, &s, &swap)) return(FALSE); ++ ++ MAT3_COPY_VEC(t, src[3]); /* Translation vector */ ++ ++ /* Copy upper-left 3x3 matrix */ ++ for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) m[i][j] = src[i][j]; ++ ++ if (! MAT3_invert3(m, inv3)) return(FALSE); ++ ++ for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) inv[i][j] = inv3[i][j]; ++ ++ for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) ++ inv[3][i] -= t[j] * inv3[j][i]; ++ ++ if (! simple) { ++ ++ /* We still have to undo our gaussian elimination from earlier on */ ++ /* add r0 * first col to last col */ ++ /* add r1 * 2nd col to last col */ ++ /* add r2 * 3rd col to last col */ ++ ++ for (i = 0; i < 4; i++) { ++ inv[i][3] += r[0] * inv[i][0] + r[1] * inv[i][1] + r[2] * inv[i][2]; ++ inv[i][3] *= s; ++ } ++ ++ if (swap >= 0) ++ for (i = 0; i < 4; i++) SWAP(inv[i][swap], inv[i][3], temp); ++ } ++ ++ MAT3copy(result_mat, inv); ++ ++ return(TRUE); ++} diff --cc simgear/math/MAT3mat.c index 00000000,00000000..85876843 new file mode 100644 --- /dev/null +++ b/simgear/math/MAT3mat.c @@@ -1,0 -1,0 +1,120 @@@ ++/* #include "HEADERS.h" */ ++/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */ ++ ++/* -------------------------------------------------------------------------- ++ * This file contains routines that operate solely on matrices. ++ * -------------------------------------------------------------------------*/ ++ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#ifdef WIN32 ++# ifndef HAVE_STL_SGI_PORT ++# ifdef __BORLANDC__ ++# include ++# else ++# include /* required for memset() and memcpy() */ ++# endif ++# endif ++#endif ++ ++#include ++#include "mat3defs.h" ++ ++MAT3mat identityMatrix = { ++ { 1.0, 0.0, 0.0, 0.0 }, ++ { 0.0, 1.0, 0.0, 0.0 }, ++ { 0.0, 0.0, 1.0, 0.0 }, ++ { 0.0, 0.0, 0.0, 1.0 } ++}; ++ ++/* #include "macros.h" */ ++ ++/* -------------------------- Static Routines ---------------------------- */ ++ ++/* ------------------------- Internal Routines --------------------------- */ ++ ++/* -------------------------- Public Routines ---------------------------- */ ++ ++ ++#if !defined( USE_XTRA_MAT3_INLINES ) ++ ++/* ++ * This multiplies two matrices, producing a third, which may the same as ++ * either of the first two. ++ */ ++ ++void ++MAT3mult (double (*result_mat)[4], register double (*mat1)[4], register double (*mat2)[4]) ++{ ++ register int i, j; ++ MAT3mat tmp_mat; ++ ++ for (i = 0; i < 4; i++) ++ for (j = 0; j < 4; j++) ++ tmp_mat[i][j] = (mat1[i][0] * mat2[0][j] + ++ mat1[i][1] * mat2[1][j] + ++ mat1[i][2] * mat2[2][j] + ++ mat1[i][3] * mat2[3][j]); ++ MAT3copy (result_mat, tmp_mat); ++} ++#endif // !defined( USE_XTRA_MAT3_INLINES ) ++ ++/* ++ * This returns the transpose of a matrix. The result matrix may be ++ * the same as the one to transpose. ++ */ ++ ++void ++MAT3transpose (double (*result_mat)[4], register double (*mat)[4]) ++{ ++ register int i, j; ++ MAT3mat tmp_mat; ++ ++ for (i = 0; i < 4; i++) ++ for (j = 0; j < 4; j++) ++ tmp_mat[i][j] = mat[j][i]; ++ ++ MAT3copy (result_mat, tmp_mat); ++} ++ ++ ++/* ++ * This prints the given matrix to the given file pointer. ++ */ ++ ++void ++MAT3print(double (*mat)[4], FILE *fp) ++{ ++ MAT3print_formatted(mat, fp, CNULL, CNULL, CNULL, CNULL); ++} ++ ++/* ++ * This prints the given matrix to the given file pointer. ++ * use the format string to pass to fprintf. head and tail ++ * are printed at the beginning and end of each line. ++ */ ++ ++void ++MAT3print_formatted(double (*mat)[4], FILE *fp, char *title, char *head, char *format, char *tail) ++{ ++ register int i, j; ++ ++ /* This is to allow this to be called easily from a debugger */ ++ if (fp == NULL) fp = stderr; ++ ++ if (title == NULL) title = "MAT3 matrix:\n"; ++ if (head == NULL) head = " "; ++ if (format == NULL) format = "%#8.4lf "; ++ if (tail == NULL) tail = "\n"; ++ ++ (void) fprintf(fp, title); ++ ++ for (i = 0; i < 4; i++) { ++ (void) fprintf(fp, head); ++ for (j = 0; j < 4; j++) (void) fprintf(fp, format, mat[i][j]); ++ (void) fprintf(fp, tail); ++ } ++} diff --cc simgear/math/MAT3vec.c index 00000000,00000000..c1b79457 new file mode 100644 --- /dev/null +++ b/simgear/math/MAT3vec.c @@@ -1,0 -1,0 +1,154 @@@ ++/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */ ++ ++/* -------------------------------------------------------------------------- ++ * This file contains routines that operate on matrices and vectors, or ++ * vectors and vectors. ++ * -------------------------------------------------------------------------*/ ++ ++/* #include "sphigslocal.h" */ ++ ++/* -------------------------- Static Routines ---------------------------- */ ++ ++/* ------------------------- Internal Routines --------------------------- */ ++ ++/* -------------------------- Public Routines ---------------------------- */ ++ ++/* ++ * Multiplies a vector by a matrix, setting the result vector. ++ * It assumes all homogeneous coordinates are 1. ++ * The two vectors involved may be the same. ++ */ ++ ++#include "mat3.h" ++ ++#ifndef TRUE ++# define TRUE 1 ++#endif ++ ++#ifndef FALSE ++# define FALSE 0 ++#endif ++ ++#if !defined( USE_XTRA_MAT3_INLINES ) ++ ++void ++MAT3mult_vec(double *result_vec, register double *vec, register double (*mat)[4]) ++{ ++ MAT3vec tempvec; ++ register double *temp = tempvec; ++ ++ temp[0] = vec[0] * mat[0][0] + vec[1] * mat[1][0] + ++ vec[2] * mat[2][0] + mat[3][0]; ++ temp[1] = vec[0] * mat[0][1] + vec[1] * mat[1][1] + ++ vec[2] * mat[2][1] + mat[3][1]; ++ temp[2] = vec[0] * mat[0][2] + vec[1] * mat[1][2] + ++ vec[2] * mat[2][2] + mat[3][2]; ++ ++ MAT3_COPY_VEC(result_vec, temp); ++} ++#endif // !defined( USE_XTRA_MAT3_INLINES ) ++ ++/* ++ * Multiplies a vector of size 4 by a matrix, setting the result vector. ++ * The fourth element of the vector is the homogeneous coordinate, which ++ * may or may not be 1. If the "normalize" parameter is TRUE, then the ++ * result vector will be normalized so that the homogeneous coordinate is 1. ++ * The two vectors involved may be the same. ++ * This returns zero if the vector was to be normalized, but couldn't be. ++ */ ++ ++int ++MAT3mult_hvec(double *result_vec, register double *vec, register double (*mat)[4], int normalize) ++{ ++ MAT3hvec tempvec; ++ double norm_fac; ++ register double *temp = tempvec; ++ register int ret = TRUE; ++ ++ temp[0] = vec[0] * mat[0][0] + vec[1] * mat[1][0] + ++ vec[2] * mat[2][0] + vec[3] * mat[3][0]; ++ temp[1] = vec[0] * mat[0][1] + vec[1] * mat[1][1] + ++ vec[2] * mat[2][1] + vec[3] * mat[3][1]; ++ temp[2] = vec[0] * mat[0][2] + vec[1] * mat[1][2] + ++ vec[2] * mat[2][2] + vec[3] * mat[3][2]; ++ temp[3] = vec[0] * mat[0][3] + vec[1] * mat[1][3] + ++ vec[2] * mat[2][3] + vec[3] * mat[3][3]; ++ ++ /* Normalize if asked for, possible, and necessary */ ++ if (normalize) { ++ if (MAT3_IS_ZERO(temp[3])) { ++#ifndef THINK_C ++ fprintf (stderr, ++ "Can't normalize vector: homogeneous coordinate is 0"); ++#endif ++ ret = FALSE; ++ } ++ else { ++ norm_fac = 1.0 / temp[3]; ++ MAT3_SCALE_VEC(result_vec, temp, norm_fac); ++ result_vec[3] = 1.0; ++ } ++ } ++ else MAT3_COPY_HVEC(result_vec, temp); ++ ++ return(ret); ++} ++ ++#if !defined( USE_XTRA_MAT3_INLINES ) ++ ++/* ++ * Sets the first vector to be the cross-product of the last two vectors. ++ */ ++ ++void ++MAT3cross_product(double *result_vec, register double *vec1, register double *vec2) ++{ ++ MAT3vec tempvec; ++ register double *temp = tempvec; ++ ++ temp[0] = vec1[1] * vec2[2] - vec1[2] * vec2[1]; ++ temp[1] = vec1[2] * vec2[0] - vec1[0] * vec2[2]; ++ temp[2] = vec1[0] * vec2[1] - vec1[1] * vec2[0]; ++ ++ MAT3_COPY_VEC(result_vec, temp); ++} ++#endif // !defined( USE_XTRA_MAT3_INLINES ) ++ ++/* ++ * Finds a vector perpendicular to vec and stores it in result_vec. ++ * Method: take any vector (we use <0,1,0>) and subtract the ++ * portion of it pointing in the vec direction. This doesn't ++ * work if vec IS <0,1,0> or is very near it. So if this is ++ * the case, use <0,0,1> instead. ++ * If "is_unit" is TRUE, the given vector is assumed to be unit length. ++ */ ++ ++#define SELECT .7071 /* selection constant (roughly .5*sqrt(2) */ ++ ++void ++MAT3perp_vec(double *result_vec, double *vec, int is_unit) ++{ ++ MAT3vec norm; ++ double dot; ++ ++ MAT3_SET_VEC(result_vec, 0.0, 1.0, 0.0); ++ ++ MAT3_COPY_VEC(norm, vec); ++ ++ if (! is_unit) MAT3_NORMALIZE_VEC(norm, dot); ++ ++ /* See if vector is too close to <0,1,0>. If so, use <0,0,1> */ ++ if ((dot = MAT3_DOT_PRODUCT(norm, result_vec)) > SELECT || dot < -SELECT) { ++ result_vec[1] = 0.0; ++ result_vec[2] = 1.0; ++ dot = MAT3_DOT_PRODUCT(norm, result_vec); ++ } ++ ++ /* Subtract off non-perpendicular part */ ++ result_vec[0] -= dot * norm[0]; ++ result_vec[1] -= dot * norm[1]; ++ result_vec[2] -= dot * norm[2]; ++ ++ /* Make result unit length */ ++ MAT3_NORMALIZE_VEC(result_vec, dot); ++} diff --cc simgear/math/Makefile.am index 00000000,00000000..046ffe79 new file mode 100644 --- /dev/null +++ b/simgear/math/Makefile.am @@@ -1,0 -1,0 +1,30 @@@ ++lib_LIBRARIES = libsgmath.a ++ ++include_HEADERS = \ ++ fg_geodesy.hxx \ ++ fg_memory.h \ ++ fg_random.h \ ++ fg_types.hxx \ ++ interpolater.hxx \ ++ leastsqs.hxx \ ++ mat3.h \ ++ point3d.hxx \ ++ polar3d.hxx \ ++ vector.hxx ++ ++EXTRA_DIST = linintp2.h linintp2.inl sphrintp.h sphrintp.inl ++ ++libsgmath_a_SOURCES = \ ++ MAT3geom.c \ ++ MAT3inv.c \ ++ MAT3mat.c \ ++ MAT3vec.c \ ++ fg_geodesy.cxx \ ++ fg_random.c \ ++ interpolater.cxx \ ++ leastsqs.cxx \ ++ mat3defs.h mat3err.h \ ++ polar3d.cxx \ ++ vector.cxx ++ ++INCLUDES += -I$(top_builddir) diff --cc simgear/math/Makefile.in index 00000000,00000000..89c63dc1 new file mode 100644 --- /dev/null +++ b/simgear/math/Makefile.in @@@ -1,0 -1,0 +1,365 @@@ ++# Makefile.in generated automatically by automake 1.3 from Makefile.am ++ ++# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++ ++SHELL = /bin/sh ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++prefix = @prefix@ ++exec_prefix = @exec_prefix@ ++ ++bindir = @bindir@ ++sbindir = @sbindir@ ++libexecdir = @libexecdir@ ++datadir = @datadir@ ++sysconfdir = @sysconfdir@ ++sharedstatedir = @sharedstatedir@ ++localstatedir = @localstatedir@ ++libdir = @libdir@ ++infodir = @infodir@ ++mandir = @mandir@ ++includedir = @includedir@ ++oldincludedir = /usr/include ++ ++DISTDIR = ++ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++ ++top_builddir = .. ++ ++ACLOCAL = @ACLOCAL@ ++AUTOCONF = @AUTOCONF@ ++AUTOMAKE = @AUTOMAKE@ ++AUTOHEADER = @AUTOHEADER@ ++ ++INSTALL = @INSTALL@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++transform = @program_transform_name@ ++ ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++CC = @CC@ ++CXX = @CXX@ ++LN_S = @LN_S@ ++MAKEINFO = @MAKEINFO@ ++PACKAGE = @PACKAGE@ ++RANLIB = @RANLIB@ ++VERSION = @VERSION@ ++base_LIBS = @base_LIBS@ ++opengl_LIBS = @opengl_LIBS@ ++ ++lib_LIBRARIES = libsgmath.a ++ ++include_HEADERS = \ ++ fg_geodesy.hxx \ ++ fg_memory.h \ ++ fg_random.h \ ++ fg_types.hxx \ ++ interpolater.hxx \ ++ leastsqs.hxx \ ++ mat3.h \ ++ point3d.hxx \ ++ polar3d.hxx \ ++ vector.hxx ++ ++EXTRA_DIST = linintp2.h linintp2.inl sphrintp.h sphrintp.inl ++ ++libsgmath_a_SOURCES = \ ++ MAT3geom.c \ ++ MAT3inv.c \ ++ MAT3mat.c \ ++ MAT3vec.c \ ++ fg_geodesy.cxx \ ++ fg_random.c \ ++ interpolater.cxx \ ++ leastsqs.cxx \ ++ mat3defs.h mat3err.h \ ++ polar3d.cxx \ ++ vector.cxx ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = ../include/config.h ++CONFIG_CLEAN_FILES = ++LIBRARIES = $(lib_LIBRARIES) ++ ++ ++DEFS = @DEFS@ -I. -I$(srcdir) -I../include ++CPPFLAGS = @CPPFLAGS@ ++LDFLAGS = @LDFLAGS@ ++LIBS = @LIBS@ ++X_CFLAGS = @X_CFLAGS@ ++X_LIBS = @X_LIBS@ ++X_EXTRA_LIBS = @X_EXTRA_LIBS@ ++X_PRE_LIBS = @X_PRE_LIBS@ ++libsgmath_a_LIBADD = ++libsgmath_a_OBJECTS = MAT3geom.o MAT3inv.o MAT3mat.o MAT3vec.o \ ++fg_geodesy.o fg_random.o interpolater.o leastsqs.o polar3d.o vector.o ++AR = ar ++CXXFLAGS = @CXXFLAGS@ ++CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++CXXLINK = $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ ++CFLAGS = @CFLAGS@ ++COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) ++LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ++HEADERS = $(include_HEADERS) ++ ++DIST_COMMON = Makefile.am Makefile.in ++ ++ ++DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ++ ++TAR = tar ++GZIP = --best ++DEP_FILES = .deps/MAT3geom.P .deps/MAT3inv.P .deps/MAT3mat.P \ ++.deps/MAT3vec.P .deps/fg_geodesy.P .deps/fg_random.P \ ++.deps/interpolater.P .deps/leastsqs.P .deps/polar3d.P .deps/vector.P ++CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++SOURCES = $(libsgmath_a_SOURCES) ++OBJECTS = $(libsgmath_a_OBJECTS) ++ ++all: Makefile $(LIBRARIES) $(HEADERS) ++ ++.SUFFIXES: ++.SUFFIXES: .S .c .cxx .o .s ++$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu math/Makefile ++ ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++ ++mostlyclean-libLIBRARIES: ++ ++clean-libLIBRARIES: ++ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) ++ ++distclean-libLIBRARIES: ++ ++maintainer-clean-libLIBRARIES: ++ ++install-libLIBRARIES: $(lib_LIBRARIES) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(libdir) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ ++ $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ @$(POST_INSTALL) ++ @list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ ++ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ ++uninstall-libLIBRARIES: ++ @$(NORMAL_UNINSTALL) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(libdir)/$$p; \ ++ done ++ ++.s.o: ++ $(COMPILE) -c $< ++ ++.S.o: ++ $(COMPILE) -c $< ++ ++mostlyclean-compile: ++ -rm -f *.o core *.core ++ ++clean-compile: ++ ++distclean-compile: ++ -rm -f *.tab.c ++ ++maintainer-clean-compile: ++ ++libsgmath.a: $(libsgmath_a_OBJECTS) $(libsgmath_a_DEPENDENCIES) ++ -rm -f libsgmath.a ++ $(AR) cru libsgmath.a $(libsgmath_a_OBJECTS) $(libsgmath_a_LIBADD) ++ $(RANLIB) libsgmath.a ++.cxx.o: ++ $(CXXCOMPILE) -c $< ++ ++install-includeHEADERS: $(include_HEADERS) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(includedir) ++ @list='$(include_HEADERS)'; for p in $$list; do \ ++ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ ++ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ ++ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++uninstall-includeHEADERS: ++ @$(NORMAL_UNINSTALL) ++ list='$(include_HEADERS)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++tags: TAGS ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) ++ here=`pwd` && cd $(srcdir) \ ++ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) ++ ++TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ ++ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ ++mostlyclean-tags: ++ ++clean-tags: ++ ++distclean-tags: ++ -rm -f TAGS ID ++ ++maintainer-clean-tags: ++ ++distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) ++ ++subdir = math ++ ++distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu math/Makefile ++ @for file in $(DISTFILES); do \ ++ d=$(srcdir); \ ++ test -f $(distdir)/$$file \ ++ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ++ || cp -p $$d/$$file $(distdir)/$$file; \ ++ done ++ ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ ++maintainer-clean-depend: ++ -rm -rf .deps ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++ ++%.o: %.cxx ++ @echo '$(CXXCOMPILE) -c $<'; \ ++ $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.cxx ++ @echo '$(LTCXXCOMPILE) -c $<'; \ ++ $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++info: ++dvi: ++check: all ++ $(MAKE) ++installcheck: ++install-exec: install-libLIBRARIES ++ @$(NORMAL_INSTALL) ++ ++install-data: install-includeHEADERS ++ @$(NORMAL_INSTALL) ++ ++install: install-exec install-data all ++ @: ++ ++uninstall: uninstall-libLIBRARIES uninstall-includeHEADERS ++ ++install-strip: ++ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install ++installdirs: ++ $(mkinstalldirs) $(DATADIR)$(libdir) $(DATADIR)$(includedir) ++ ++ ++mostlyclean-generic: ++ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f Makefile $(DISTCLEANFILES) ++ -rm -f config.cache config.log stamp-h stamp-h[0-9]* ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) ++ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) ++mostlyclean: mostlyclean-libLIBRARIES mostlyclean-compile \ ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic ++ ++clean: clean-libLIBRARIES clean-compile clean-tags clean-depend \ ++ clean-generic mostlyclean ++ ++distclean: distclean-libLIBRARIES distclean-compile distclean-tags \ ++ distclean-depend distclean-generic clean ++ -rm -f config.status ++ ++maintainer-clean: maintainer-clean-libLIBRARIES \ ++ maintainer-clean-compile maintainer-clean-tags \ ++ maintainer-clean-depend maintainer-clean-generic \ ++ distclean ++ @echo "This command is intended for maintainers to use;" ++ @echo "it deletes files that may require special tools to rebuild." ++ ++.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \ ++clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ ++install-libLIBRARIES mostlyclean-compile distclean-compile \ ++clean-compile maintainer-clean-compile uninstall-includeHEADERS \ ++install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ ++maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ ++clean-depend maintainer-clean-depend info dvi installcheck install-exec \ ++install-data install uninstall all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean ++ ++ ++INCLUDES += -I$(top_builddir) ++ ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --cc simgear/math/fg_geodesy.cxx index 00000000,00000000..02377635 new file mode 100644 --- /dev/null +++ b/simgear/math/fg_geodesy.cxx @@@ -1,0 -1,0 +1,446 @@@ ++// fg_geodesy.cxx -- routines to convert between geodetic and geocentric ++// coordinate systems. ++// ++// Copied and adapted directly from LaRCsim/ls_geodesy.c ++// ++// See below for the complete original LaRCsim comments. ++// ++// $Id$ ++ ++#include ++ ++#ifdef FG_HAVE_STD_INCLUDES ++# include ++# include ++#else ++# include ++# include ++#endif ++ ++#include ++#include ++ ++#include "point3d.hxx" ++#include "fg_geodesy.hxx" ++ ++#ifndef FG_HAVE_NATIVE_SGI_COMPILERS ++FG_USING_STD(cout); ++#endif ++ ++// ONE_SECOND is pi/180/60/60, or about 100 feet at earths' equator ++#define ONE_SECOND 4.848136811E-6 ++ ++ ++// fgGeocToGeod(lat_geoc, radius, *lat_geod, *alt, *sea_level_r) ++// INPUTS: ++// lat_geoc Geocentric latitude, radians, + = North ++// radius C.G. radius to earth center (meters) ++// ++// OUTPUTS: ++// lat_geod Geodetic latitude, radians, + = North ++// alt C.G. altitude above mean sea level (meters) ++// sea_level_r radius from earth center to sea level at ++// local vertical (surface normal) of C.G. (meters) ++ ++ ++void fgGeocToGeod( double lat_geoc, double radius, double ++ *lat_geod, double *alt, double *sea_level_r ) ++{ ++ double t_lat, x_alpha, mu_alpha, delt_mu, r_alpha, l_point, rho_alpha; ++ double sin_mu_a, denom,delt_lambda, lambda_sl, sin_lambda_sl; ++ ++ if( ( (FG_PI_2 - lat_geoc) < ONE_SECOND ) // near North pole ++ || ( (FG_PI_2 + lat_geoc) < ONE_SECOND ) ) // near South pole ++ { ++ *lat_geod = lat_geoc; ++ *sea_level_r = EQUATORIAL_RADIUS_M*E; ++ *alt = radius - *sea_level_r; ++ } else { ++ t_lat = tan(lat_geoc); ++ x_alpha = E*EQUATORIAL_RADIUS_M/sqrt(t_lat*t_lat + E*E); ++ double tmp = RESQ_M - x_alpha * x_alpha; ++ if ( tmp < 0.0 ) { tmp = 0.0; } ++ mu_alpha = atan2(sqrt(tmp),E*x_alpha); ++ if (lat_geoc < 0) mu_alpha = - mu_alpha; ++ sin_mu_a = sin(mu_alpha); ++ delt_lambda = mu_alpha - lat_geoc; ++ r_alpha = x_alpha/cos(lat_geoc); ++ l_point = radius - r_alpha; ++ *alt = l_point*cos(delt_lambda); ++ ++ // check for domain error ++ if ( errno == EDOM ) { ++ FG_LOG( FG_GENERAL, FG_ALERT, "Domain ERROR in fgGeocToGeod!!!!" ); ++ *alt = 0.0; ++ } ++ ++ denom = sqrt(1-EPS*EPS*sin_mu_a*sin_mu_a); ++ rho_alpha = EQUATORIAL_RADIUS_M*(1-EPS)/ ++ (denom*denom*denom); ++ delt_mu = atan2(l_point*sin(delt_lambda),rho_alpha + *alt); ++ *lat_geod = mu_alpha - delt_mu; ++ lambda_sl = atan( E*E * tan(*lat_geod) ); // SL geoc. latitude ++ sin_lambda_sl = sin( lambda_sl ); ++ *sea_level_r = ++ sqrt(RESQ_M / (1 + ((1/(E*E))-1)*sin_lambda_sl*sin_lambda_sl)); ++ ++ // check for domain error ++ if ( errno == EDOM ) { ++ FG_LOG( FG_GENERAL, FG_ALERT, "Domain ERROR in fgGeocToGeod!!!!" ); ++ *sea_level_r = 0.0; ++ } ++ } ++ ++} ++ ++ ++// fgGeodToGeoc( lat_geod, alt, *sl_radius, *lat_geoc ) ++// INPUTS: ++// lat_geod Geodetic latitude, radians, + = North ++// alt C.G. altitude above mean sea level (meters) ++// ++// OUTPUTS: ++// sl_radius SEA LEVEL radius to earth center (meters) ++// (add Altitude to get true distance from earth center. ++// lat_geoc Geocentric latitude, radians, + = North ++// ++ ++ ++void fgGeodToGeoc( double lat_geod, double alt, double *sl_radius, ++ double *lat_geoc ) ++{ ++ double lambda_sl, sin_lambda_sl, cos_lambda_sl, sin_mu, cos_mu, px, py; ++ ++ lambda_sl = atan( E*E * tan(lat_geod) ); // sea level geocentric latitude ++ sin_lambda_sl = sin( lambda_sl ); ++ cos_lambda_sl = cos( lambda_sl ); ++ sin_mu = sin(lat_geod); // Geodetic (map makers') latitude ++ cos_mu = cos(lat_geod); ++ *sl_radius = ++ sqrt(RESQ_M / (1 + ((1/(E*E))-1)*sin_lambda_sl*sin_lambda_sl)); ++ py = *sl_radius*sin_lambda_sl + alt*sin_mu; ++ px = *sl_radius*cos_lambda_sl + alt*cos_mu; ++ *lat_geoc = atan2( py, px ); ++} ++ ++ ++// Direct and inverse distance functions ++// ++// Proceedings of the 7th International Symposium on Geodetic ++// Computations, 1985 ++// ++// "The Nested Coefficient Method for Accurate Solutions of Direct and ++// Inverse Geodetic Problems With Any Length" ++// ++// Zhang Xue-Lian ++// pp 747-763 ++// ++// modified for FlightGear to use WGS84 only -- Norman Vine ++ ++#define GEOD_INV_PI FG_PI ++ ++// s == distance ++// az = azimuth ++ ++// for WGS_84 a = 6378137.000, rf = 298.257223563; ++ ++static double M0( double e2 ) { ++ //double e4 = e2*e2; ++ return GEOD_INV_PI*(1.0 - e2*( 1.0/4.0 + e2*( 3.0/64.0 + ++ e2*(5.0/256.0) )))/2.0; ++} ++ ++ ++// given, alt, lat1, lon1, az1 and distance (s), calculate lat2, lon2 ++// and az2. Lat, lon, and azimuth are in degrees. distance in meters ++int geo_direct_wgs_84 ( double alt, double lat1, double lon1, double az1, ++ double s, double *lat2, double *lon2, double *az2 ) ++{ ++ double a = 6378137.000, rf = 298.257223563; ++ double RADDEG = (GEOD_INV_PI)/180.0, testv = 1.0E-10; ++ double f = ( rf > 0.0 ? 1.0/rf : 0.0 ); ++ double b = a*(1.0-f); ++ double e2 = f*(2.0-f); ++ double phi1 = lat1*RADDEG, lam1 = lon1*RADDEG; ++ double sinphi1 = sin(phi1), cosphi1 = cos(phi1); ++ double azm1 = az1*RADDEG; ++ double sinaz1 = sin(azm1), cosaz1 = cos(azm1); ++ ++ ++ if( fabs(s) < 0.01 ) { // distance < centimeter => congruency ++ *lat2 = lat1; ++ *lon2 = lon1; ++ *az2 = 180.0 + az1; ++ if( *az2 > 360.0 ) *az2 -= 360.0; ++ return 0; ++ } else if( cosphi1 ) { // non-polar origin ++ // u1 is reduced latitude ++ double tanu1 = sqrt(1.0-e2)*sinphi1/cosphi1; ++ double sig1 = atan2(tanu1,cosaz1); ++ double cosu1 = 1.0/sqrt( 1.0 + tanu1*tanu1 ), sinu1 = tanu1*cosu1; ++ double sinaz = cosu1*sinaz1, cos2saz = 1.0-sinaz*sinaz; ++ double us = cos2saz*e2/(1.0-e2); ++ ++ // Terms ++ double ta = 1.0+us*(4096.0+us*(-768.0+us*(320.0-175.0*us)))/16384.0, ++ tb = us*(256.0+us*(-128.0+us*(74.0-47.0*us)))/1024.0, ++ tc = 0; ++ ++ // FIRST ESTIMATE OF SIGMA (SIG) ++ double first = s/(b*ta); // !! ++ double sig = first; ++ double c2sigm, sinsig,cossig, temp,denom,rnumer, dlams, dlam; ++ do { ++ c2sigm = cos(2.0*sig1+sig); ++ sinsig = sin(sig); cossig = cos(sig); ++ temp = sig; ++ sig = first + ++ tb*sinsig*(c2sigm+tb*(cossig*(-1.0+2.0*c2sigm*c2sigm) - ++ tb*c2sigm*(-3.0+4.0*sinsig*sinsig) ++ *(-3.0+4.0*c2sigm*c2sigm)/6.0) ++ /4.0); ++ } while( fabs(sig-temp) > testv); ++ ++ // LATITUDE OF POINT 2 ++ // DENOMINATOR IN 2 PARTS (TEMP ALSO USED LATER) ++ temp = sinu1*sinsig-cosu1*cossig*cosaz1; ++ denom = (1.0-f)*sqrt(sinaz*sinaz+temp*temp); ++ ++ // NUMERATOR ++ rnumer = sinu1*cossig+cosu1*sinsig*cosaz1; ++ *lat2 = atan2(rnumer,denom)/RADDEG; ++ ++ // DIFFERENCE IN LONGITUDE ON AUXILARY SPHERE (DLAMS ) ++ rnumer = sinsig*sinaz1; ++ denom = cosu1*cossig-sinu1*sinsig*cosaz1; ++ dlams = atan2(rnumer,denom); ++ ++ // TERM C ++ tc = f*cos2saz*(4.0+f*(4.0-3.0*cos2saz))/16.0; ++ ++ // DIFFERENCE IN LONGITUDE ++ dlam = dlams-(1.0-tc)*f*sinaz*(sig+tc*sinsig* ++ (c2sigm+ ++ tc*cossig*(-1.0+2.0* ++ c2sigm*c2sigm))); ++ *lon2 = (lam1+dlam)/RADDEG; ++ if (*lon2 > 180.0 ) *lon2 -= 360.0; ++ if (*lon2 < -180.0 ) *lon2 += 360.0; ++ ++ // AZIMUTH - FROM NORTH ++ *az2 = atan2(-sinaz,temp)/RADDEG; ++ if ( fabs(*az2) < testv ) *az2 = 0.0; ++ if( *az2 < 0.0) *az2 += 360.0; ++ return 0; ++ } else { // phi1 == 90 degrees, polar origin ++ double dM = a*M0(e2) - s; ++ double paz = ( phi1 < 0.0 ? 180.0 : 0.0 ); ++ return geo_direct_wgs_84( alt, 0.0, lon1, paz, dM,lat2,lon2,az2 ); ++ } ++} ++ ++ ++// given alt, lat1, lon1, lat2, lon2, calculate starting and ending ++// az1, az2 and distance (s). Lat, lon, and azimuth are in degrees. ++// distance in meters ++int geo_inverse_wgs_84( double alt, double lat1, double lon1, double lat2, ++ double lon2, double *az1, double *az2, double *s ) ++{ ++ double a = 6378137.000, rf = 298.257223563; ++ int iter=0; ++ double RADDEG = (GEOD_INV_PI)/180.0, testv = 1.0E-10; ++ double f = ( rf > 0.0 ? 1.0/rf : 0.0 ); ++ double b = a*(1.0-f); ++ // double e2 = f*(2.0-f); // unused in this routine ++ double phi1 = lat1*RADDEG, lam1 = lon1*RADDEG; ++ double sinphi1 = sin(phi1), cosphi1 = cos(phi1); ++ double phi2 = lat2*RADDEG, lam2 = lon2*RADDEG; ++ double sinphi2 = sin(phi2), cosphi2 = cos(phi2); ++ ++ if( (fabs(lat1-lat2) < testv && ++ ( fabs(lon1-lon2) < testv) || fabs(lat1-90.0) < testv ) ) ++ { ++ // TWO STATIONS ARE IDENTICAL : SET DISTANCE & AZIMUTHS TO ZERO */ ++ *az1 = 0.0; *az2 = 0.0; *s = 0.0; ++ return 0; ++ } else if( fabs(cosphi1) < testv ) { ++ // initial point is polar ++ int k = geo_inverse_wgs_84( alt, lat2,lon2,lat1,lon1, az1,az2,s ); ++ k = k; // avoid compiler error since return result is unused ++ b = *az1; *az1 = *az2; *az2 = b; ++ return 0; ++ } else if( fabs(cosphi2) < testv ) { ++ // terminal point is polar ++ int k = geo_inverse_wgs_84( alt, lat1,lon1,lat1,lon1+180.0, ++ az1,az2,s ); ++ k = k; // avoid compiler error since return result is unused ++ *s /= 2.0; ++ *az2 = *az1 + 180.0; ++ if( *az2 > 360.0 ) *az2 -= 360.0; ++ return 0; ++ } else if( (fabs( fabs(lon1-lon2) - 180 ) < testv) && ++ (fabs(lat1+lat2) < testv) ) ++ { ++ // Geodesic passes through the pole (antipodal) ++ double s1,s2; ++ geo_inverse_wgs_84( alt, lat1,lon1, lat1,lon2, az1,az2, &s1 ); ++ geo_inverse_wgs_84( alt, lat2,lon2, lat1,lon2, az1,az2, &s2 ); ++ *az2 = *az1; ++ *s = s1 + s2; ++ return 0; ++ } else { ++ // antipodal and polar points don't get here ++ double dlam = lam2 - lam1, dlams = dlam; ++ double sdlams,cdlams, sig,sinsig,cossig, sinaz, ++ cos2saz, c2sigm; ++ double tc,temp, us,rnumer,denom, ta,tb; ++ double cosu1,sinu1, sinu2,cosu2; ++ ++ // Reduced latitudes ++ temp = (1.0-f)*sinphi1/cosphi1; ++ cosu1 = 1.0/sqrt(1.0+temp*temp); ++ sinu1 = temp*cosu1; ++ temp = (1.0-f)*sinphi2/cosphi2; ++ cosu2 = 1.0/sqrt(1.0+temp*temp); ++ sinu2 = temp*cosu2; ++ ++ do { ++ sdlams = sin(dlams), cdlams = cos(dlams); ++ sinsig = sqrt(cosu2*cosu2*sdlams*sdlams+ ++ (cosu1*sinu2-sinu1*cosu2*cdlams)* ++ (cosu1*sinu2-sinu1*cosu2*cdlams)); ++ cossig = sinu1*sinu2+cosu1*cosu2*cdlams; ++ ++ sig = atan2(sinsig,cossig); ++ sinaz = cosu1*cosu2*sdlams/sinsig; ++ cos2saz = 1.0-sinaz*sinaz; ++ c2sigm = (sinu1 == 0.0 || sinu2 == 0.0 ? cossig : ++ cossig-2.0*sinu1*sinu2/cos2saz); ++ tc = f*cos2saz*(4.0+f*(4.0-3.0*cos2saz))/16.0; ++ temp = dlams; ++ dlams = dlam+(1.0-tc)*f*sinaz* ++ (sig+tc*sinsig* ++ (c2sigm+tc*cossig*(-1.0+2.0*c2sigm*c2sigm))); ++ if (fabs(dlams) > GEOD_INV_PI && iter++ > 50) { ++ return iter; ++ } ++ } while ( fabs(temp-dlams) > testv); ++ ++ us = cos2saz*(a*a-b*b)/(b*b); // !! ++ // BACK AZIMUTH FROM NORTH ++ rnumer = -(cosu1*sdlams); ++ denom = sinu1*cosu2-cosu1*sinu2*cdlams; ++ *az2 = atan2(rnumer,denom)/RADDEG; ++ if( fabs(*az2) < testv ) *az2 = 0.0; ++ if(*az2 < 0.0) *az2 += 360.0; ++ ++ // FORWARD AZIMUTH FROM NORTH ++ rnumer = cosu2*sdlams; ++ denom = cosu1*sinu2-sinu1*cosu2*cdlams; ++ *az1 = atan2(rnumer,denom)/RADDEG; ++ if( fabs(*az1) < testv ) *az1 = 0.0; ++ if(*az1 < 0.0) *az1 += 360.0; ++ ++ // Terms a & b ++ ta = 1.0+us*(4096.0+us*(-768.0+us*(320.0-175.0*us)))/ ++ 16384.0; ++ tb = us*(256.0+us*(-128.0+us*(74.0-47.0*us)))/1024.0; ++ ++ // GEODETIC DISTANCE ++ *s = b*ta*(sig-tb*sinsig* ++ (c2sigm+tb*(cossig*(-1.0+2.0*c2sigm*c2sigm)-tb* ++ c2sigm*(-3.0+4.0*sinsig*sinsig)* ++ (-3.0+4.0*c2sigm*c2sigm)/6.0)/ ++ 4.0)); ++ return 0; ++ } ++} ++ ++ ++/*************************************************************************** ++ ++ TITLE: ls_geodesy ++ ++---------------------------------------------------------------------------- ++ ++ FUNCTION: Converts geocentric coordinates to geodetic positions ++ ++---------------------------------------------------------------------------- ++ ++ MODULE STATUS: developmental ++ ++---------------------------------------------------------------------------- ++ ++ GENEALOGY: Written as part of LaRCSim project by E. B. Jackson ++ ++---------------------------------------------------------------------------- ++ ++ DESIGNED BY: E. B. Jackson ++ ++ CODED BY: E. B. Jackson ++ ++ MAINTAINED BY: E. B. Jackson ++ ++---------------------------------------------------------------------------- ++ ++ MODIFICATION HISTORY: ++ ++ DATE PURPOSE BY ++ ++ 930208 Modified to avoid singularity near polar region. EBJ ++ 930602 Moved backwards calcs here from ls_step. EBJ ++ 931214 Changed erroneous Latitude and Altitude variables to ++ *lat_geod and *alt in routine ls_geoc_to_geod. EBJ ++ 940111 Changed header files from old ls_eom.h style to ls_types, ++ and ls_constants. Also replaced old DATA type with new ++ SCALAR type. EBJ ++ ++ CURRENT RCS HEADER: ++ ++$Header$ ++ * Revision 1.5 1994/01/11 18:47:05 bjax ++ * Changed include files to use types and constants, not ls_eom.h ++ * Also changed DATA type to SCALAR type. ++ * ++ * Revision 1.4 1993/12/14 21:06:47 bjax ++ * Removed global variable references Altitude and Latitude. EBJ ++ * ++ * Revision 1.3 1993/06/02 15:03:40 bjax ++ * Made new subroutine for calculating geodetic to geocentric; changed name ++ * of forward conversion routine from ls_geodesy to ls_geoc_to_geod. ++ * ++ ++---------------------------------------------------------------------------- ++ ++ REFERENCES: ++ ++ [ 1] Stevens, Brian L.; and Lewis, Frank L.: "Aircraft ++ Control and Simulation", Wiley and Sons, 1992. ++ ISBN 0-471-61397-5 ++ ++ ++---------------------------------------------------------------------------- ++ ++ CALLED BY: ls_aux ++ ++---------------------------------------------------------------------------- ++ ++ CALLS TO: ++ ++---------------------------------------------------------------------------- ++ ++ INPUTS: ++ lat_geoc Geocentric latitude, radians, + = North ++ radius C.G. radius to earth center, ft ++ ++---------------------------------------------------------------------------- ++ ++ OUTPUTS: ++ lat_geod Geodetic latitude, radians, + = North ++ alt C.G. altitude above mean sea level, ft ++ sea_level_r radius from earth center to sea level at ++ local vertical (surface normal) of C.G. ++ ++--------------------------------------------------------------------------*/ ++ ++ diff --cc simgear/math/fg_geodesy.hxx index 00000000,00000000..9d2bc209 new file mode 100644 --- /dev/null +++ b/simgear/math/fg_geodesy.hxx @@@ -1,0 -1,0 +1,175 @@@ ++// fg_geodesy.hxx -- routines to convert between geodetic and geocentric ++// coordinate systems. ++// ++// Copied and adapted directly from LaRCsim/ls_geodesy.c ++// ++// See below for the complete original LaRCsim comments. ++// ++// $Id$ ++ ++ ++#ifndef _FG_GEODESY_HXX ++#define _FG_GEODESY_HXX ++ ++ ++#ifndef __cplusplus ++# error This library requires C++ ++#endif ++ ++ ++#include ++#include ++ ++ ++// fgGeocToGeod(lat_geoc, radius, *lat_geod, *alt, *sea_level_r) ++// INPUTS: ++// lat_geoc Geocentric latitude, radians, + = North ++// radius C.G. radius to earth center (meters) ++// ++// OUTPUTS: ++// lat_geod Geodetic latitude, radians, + = North ++// alt C.G. altitude above mean sea level (meters) ++// sea_level_r radius from earth center to sea level at ++// local vertical (surface normal) of C.G. (meters) ++ ++void fgGeocToGeod( double lat_geoc, double radius, double ++ *lat_geod, double *alt, double *sea_level_r ); ++ ++ ++// fgGeodToGeoc( lat_geod, alt, *sl_radius, *lat_geoc ) ++// INPUTS: ++// lat_geod Geodetic latitude, radians, + = North ++// alt C.G. altitude above mean sea level (meters) ++// ++// OUTPUTS: ++// sl_radius SEA LEVEL radius to earth center (meters) ++// (add Altitude to get true distance from earth center. ++// lat_geoc Geocentric latitude, radians, + = North ++// ++ ++void fgGeodToGeoc( double lat_geod, double alt, double *sl_radius, ++ double *lat_geoc ); ++ ++ ++// convert a geodetic point lon(radians), lat(radians), elev(meter) to ++// a cartesian point ++ ++inline Point3D fgGeodToCart(const Point3D& geod) { ++ double gc_lon, gc_lat, sl_radius; ++ ++ // printf("A geodetic point is (%.2f, %.2f, %.2f)\n", ++ // geod[0], geod[1], geod[2]); ++ ++ gc_lon = geod.lon(); ++ fgGeodToGeoc(geod.lat(), geod.radius(), &sl_radius, &gc_lat); ++ ++ // printf("A geocentric point is (%.2f, %.2f, %.2f)\n", gc_lon, ++ // gc_lat, sl_radius+geod[2]); ++ ++ Point3D pp = Point3D( gc_lon, gc_lat, sl_radius + geod.radius()); ++ return fgPolarToCart3d(pp); ++} ++ ++ ++// given, alt, lat1, lon1, az1 and distance (s), calculate lat2, lon2 ++// and az2. Lat, lon, and azimuth are in degrees. distance in meters ++int geo_direct_wgs_84 ( double alt, double lat1, double lon1, double az1, ++ double s, double *lat2, double *lon2, double *az2 ); ++ ++ ++// given alt, lat1, lon1, lat2, lon2, calculate starting and ending ++// az1, az2 and distance (s). Lat, lon, and azimuth are in degrees. ++// distance in meters ++int geo_inverse_wgs_84( double alt, double lat1, double lon1, double lat2, ++ double lon2, double *az1, double *az2, double *s ); ++ ++ ++/*************************************************************************** ++ ++ TITLE: ls_geodesy ++ ++---------------------------------------------------------------------------- ++ ++ FUNCTION: Converts geocentric coordinates to geodetic positions ++ ++---------------------------------------------------------------------------- ++ ++ MODULE STATUS: developmental ++ ++---------------------------------------------------------------------------- ++ ++ GENEALOGY: Written as part of LaRCSim project by E. B. Jackson ++ ++---------------------------------------------------------------------------- ++ ++ DESIGNED BY: E. B. Jackson ++ ++ CODED BY: E. B. Jackson ++ ++ MAINTAINED BY: E. B. Jackson ++ ++---------------------------------------------------------------------------- ++ ++ MODIFICATION HISTORY: ++ ++ DATE PURPOSE BY ++ ++ 930208 Modified to avoid singularity near polar region. EBJ ++ 930602 Moved backwards calcs here from ls_step. EBJ ++ 931214 Changed erroneous Latitude and Altitude variables to ++ *lat_geod and *alt in routine ls_geoc_to_geod. EBJ ++ 940111 Changed header files from old ls_eom.h style to ls_types, ++ and ls_constants. Also replaced old DATA type with new ++ SCALAR type. EBJ ++ ++ CURRENT RCS HEADER: ++ ++$Header$ ++ ++ * Revision 1.5 1994/01/11 18:47:05 bjax ++ * Changed include files to use types and constants, not ls_eom.h ++ * Also changed DATA type to SCALAR type. ++ * ++ * Revision 1.4 1993/12/14 21:06:47 bjax ++ * Removed global variable references Altitude and Latitude. EBJ ++ * ++ * Revision 1.3 1993/06/02 15:03:40 bjax ++ * Made new subroutine for calculating geodetic to geocentric; changed name ++ * of forward conversion routine from ls_geodesy to ls_geoc_to_geod. ++ * ++ ++---------------------------------------------------------------------------- ++ ++ REFERENCES: ++ ++ [ 1] Stevens, Brian L.; and Lewis, Frank L.: "Aircraft ++ Control and Simulation", Wiley and Sons, 1992. ++ ISBN 0-471-61397-5 ++ ++ ++---------------------------------------------------------------------------- ++ ++ CALLED BY: ls_aux ++ ++---------------------------------------------------------------------------- ++ ++ CALLS TO: ++ ++---------------------------------------------------------------------------- ++ ++ INPUTS: ++ lat_geoc Geocentric latitude, radians, + = North ++ radius C.G. radius to earth center, ft ++ ++---------------------------------------------------------------------------- ++ ++ OUTPUTS: ++ lat_geod Geodetic latitude, radians, + = North ++ alt C.G. altitude above mean sea level, ft ++ sea_level_r radius from earth center to sea level at ++ local vertical (surface normal) of C.G. ++ ++--------------------------------------------------------------------------*/ ++ ++ ++#endif // _FG_GEODESY_HXX diff --cc simgear/math/fg_memory.h index 00000000,00000000..a8d012f5 new file mode 100644 --- /dev/null +++ b/simgear/math/fg_memory.h @@@ -1,0 -1,0 +1,59 @@@ ++// 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$ ++ ++ ++#ifndef _FG_MEMORY_H ++#define _FG_MEMORY_H ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#ifdef HAVE_MEMCPY ++ ++# ifdef HAVE_MEMORY_H ++# include ++# 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 ++# define fgmemcmp zmemcmp ++# define fgmemcpy zmemcpy ++# define fgmemzero zmemzero ++ ++#endif ++ ++#endif // _FG_MEMORY_H ++ ++ diff --cc simgear/math/fg_random.c index 00000000,00000000..d6c13c30 new file mode 100644 --- /dev/null +++ b/simgear/math/fg_random.c @@@ -1,0 -1,0 +1,71 @@@ ++// fg_random.c -- routines to handle random number generation ++// ++// 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$ ++ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#include ++#include // for random(), srandom() ++#include // for time() to seed srandom() ++ ++#include "fg_random.h" ++ ++#ifndef HAVE_RAND ++# ifdef sgi ++# undef RAND_MAX ++# define RAND_MAX 2147483647 ++# endif ++#endif ++ ++#ifdef __SUNPRO_CC ++ extern "C" { ++ long int random(void); ++ void srandom(unsigned int seed); ++ } ++#endif ++ ++ ++// Seed the random number generater with time() so we don't see the ++// same sequence every time ++void fg_srandom(void) { ++ // fgPrintf( FG_MATH, FG_INFO, "Seeding random number generater\n"); ++ ++#ifdef HAVE_RAND ++ srand(time(NULL)); ++#else ++ srandom(time(NULL)); ++#endif ++} ++ ++ ++// return a random number between [0.0, 1.0) ++double fg_random(void) { ++#ifdef HAVE_RAND ++ return(rand() / (double)RAND_MAX); ++#else ++ return(random() / (double)RAND_MAX); ++#endif ++} ++ ++ diff --cc simgear/math/fg_random.h index 00000000,00000000..25a2b463 new file mode 100644 --- /dev/null +++ b/simgear/math/fg_random.h @@@ -1,0 -1,0 +1,48 @@@ ++// fg_random.h -- routines to handle random number generation ++// ++// 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$ ++ ++ ++#ifndef _FG_RANDOM_H ++#define _FG_RANDOM_H ++ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++// Seed the random number generater with time() so we don't see the ++// same sequence every time ++void fg_srandom(void); ++ ++// return a random number between [0.0, 1.0) ++double fg_random(void); ++ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++ ++#endif // _FG_RANDOM_H ++ ++ diff --cc simgear/math/fg_types.hxx index 00000000,00000000..419c2eba new file mode 100644 --- /dev/null +++ b/simgear/math/fg_types.hxx @@@ -1,0 -1,0 +1,73 @@@ ++// fg_types.hxx -- commonly used types I don't want to have to keep redefining ++// ++// Written by Curtis Olson, started March 1999. ++// ++// Copyright (C) 1999 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 _FG_TYPES_HXX ++#define _FG_TYPES_HXX ++ ++ ++#ifndef __cplusplus ++# error This library requires C++ ++#endif ++ ++ ++#include ++ ++#include STL_STRING ++#include ++ ++#include ++ ++FG_USING_STD(vector); ++FG_USING_STD(string); ++ ++ ++typedef vector < int > int_list; ++typedef int_list::iterator int_list_iterator; ++typedef int_list::const_iterator const_int_list_iterator; ++ ++typedef vector < Point3D > point_list; ++typedef point_list::iterator point_list_iterator; ++typedef point_list::const_iterator const_point_list_iterator; ++ ++typedef vector < string > string_list; ++typedef string_list::iterator string_list_iterator; ++typedef string_list::const_iterator const_string_list_iterator; ++ ++ ++class point2d { ++public: ++ union { ++ double x; ++ double dist; ++ double lon; ++ }; ++ union { ++ double y; ++ double theta; ++ double lat; ++ }; ++}; ++ ++ ++#endif // _FG_TYPES_HXX ++ diff --cc simgear/math/interpolater.cxx index 00000000,00000000..fb6fdfef new file mode 100644 --- /dev/null +++ b/simgear/math/interpolater.cxx @@@ -1,0 -1,0 +1,107 @@@ ++// ++// interpolater.cxx -- routines to handle linear interpolation from a table of ++// x,y The table must be sorted by "x" in ascending order ++// ++// 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$ ++ ++ ++#include ++ ++#ifdef __MWERKS__ ++#include // for exit() ++#endif ++ ++#include STL_STRING ++ ++#include ++#include ++#include ++ ++#include "interpolater.hxx" ++ ++ ++// Constructor -- loads the interpolation table from the specified ++// file ++fgINTERPTABLE::fgINTERPTABLE( const string& file ) { ++ FG_LOG( FG_MATH, FG_INFO, "Initializing Interpolator for " << file ); ++ ++ fg_gzifstream in( file ); ++ if ( !in ) { ++ FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << file ); ++ exit(-1); ++ } ++ ++ size = 0; ++ in >> skipcomment; ++ while ( in ) { ++ if ( size < MAX_TABLE_SIZE ) { ++ in >> table[size][0] >> table[size][1]; ++ size++; ++ } else { ++ FG_LOG( FG_MATH, FG_ALERT, ++ "fgInterpolateInit(): Exceed max table size = " ++ << MAX_TABLE_SIZE ); ++ exit(-1); ++ } ++ } ++} ++ ++ ++// Given an x value, linearly interpolate the y value from the table ++double fgINTERPTABLE::interpolate(double x) { ++ int i; ++ double y; ++ ++ i = 0; ++ ++ while ( (x > table[i][0]) && (i < size) ) { ++ i++; ++ } ++ ++ // printf ("i = %d ", i); ++ ++ if ( (i == 0) && (x < table[0][0]) ) { ++ FG_LOG( FG_MATH, FG_ALERT, ++ "fgInterpolateInit(): lookup error, x to small = " << x ); ++ return(0.0); ++ } ++ ++ if ( x > table[i][0] ) { ++ FG_LOG( FG_MATH, FG_ALERT, ++ "fgInterpolateInit(): lookup error, x to big = " << x ); ++ return(0.0); ++ } ++ ++ // y = y1 + (y0 - y1)(x - x1) / (x0 - x1) ++ y = table[i][1] + ++ ( (table[i-1][1] - table[i][1]) * ++ (x - table[i][0]) ) / ++ (table[i-1][0] - table[i][0]); ++ ++ return(y); ++} ++ ++ ++// Destructor ++fgINTERPTABLE::~fgINTERPTABLE( void ) { ++} ++ ++ diff --cc simgear/math/interpolater.hxx index 00000000,00000000..d802e6c7 new file mode 100644 --- /dev/null +++ b/simgear/math/interpolater.hxx @@@ -1,0 -1,0 +1,62 @@@ ++// ++// interpolater.hxx -- routines to handle linear interpolation from a table of ++// x,y The table must be sorted by "x" in ascending order ++// ++// 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 _INTERPOLATER_H ++#define _INTERPOLATER_H ++ ++ ++#ifndef __cplusplus ++# error This library requires C++ ++#endif ++ ++#include ++ ++#include STL_STRING ++FG_USING_STD(string); ++ ++#define MAX_TABLE_SIZE 32 ++ ++ ++class fgINTERPTABLE { ++ int size; ++ double table[MAX_TABLE_SIZE][2]; ++ ++public: ++ ++ // Constructor -- loads the interpolation table from the specified ++ // file ++ fgINTERPTABLE( const string& file ); ++ ++ // Given an x value, linearly interpolate the y value from the table ++ double interpolate(double x); ++ ++ // Destructor ++ ~fgINTERPTABLE( void ); ++}; ++ ++ ++#endif // _INTERPOLATER_H ++ ++ diff --cc simgear/math/leastsqs.cxx index 00000000,00000000..dfa8bdf9 new file mode 100644 --- /dev/null +++ b/simgear/math/leastsqs.cxx @@@ -1,0 -1,0 +1,135 @@@ ++// leastsqs.c -- Implements a simple linear least squares best fit routine ++// ++// Written by Curtis Olson, started September 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$ ++// ++ ++ ++#include ++ ++#include "leastsqs.hxx" ++ ++ ++/* ++Least squares fit: ++ ++y = b0 + b1x ++ ++ n*sum(xi*yi) - (sum(xi)*sum(yi)) ++b1 = -------------------------------- ++ n*sum(xi^2) - (sum(xi))^2 ++ ++ ++b0 = sum(yi)/n - b1*(sum(xi)/n) ++*/ ++ ++double sum_xi, sum_yi, sum_xi_2, sum_xi_yi; ++int sum_n; ++ ++void least_squares(double *x, double *y, int n, double *m, double *b) { ++ int i; ++ ++ sum_xi = sum_yi = sum_xi_2 = sum_xi_yi = 0.0; ++ sum_n = n; ++ ++ for ( i = 0; i < n; i++ ) { ++ sum_xi += x[i]; ++ sum_yi += y[i]; ++ sum_xi_2 += x[i] * x[i]; ++ sum_xi_yi += x[i] * y[i]; ++ } ++ ++ /* printf("sum(xi)=%.2f sum(yi)=%.2f sum(xi^2)=%.2f sum(xi*yi)=%.2f\n", ++ sum_xi, sum_yi, sum_xi_2, sum_xi_yi); */ ++ ++ *m = ( (double)sum_n * sum_xi_yi - sum_xi * sum_yi ) / ++ ( (double)sum_n * sum_xi_2 - sum_xi * sum_xi ); ++ *b = (sum_yi / (double)sum_n) - (*m) * (sum_xi / (double)sum_n); ++ ++ /* printf("slope = %.2f intercept = %.2f\n", *m, *b); */ ++} ++ ++ ++/* incrimentally update existing values with a new data point */ ++void least_squares_update(double x, double y, double *m, double *b) { ++ ++sum_n; ++ ++ sum_xi += x; ++ sum_yi += y; ++ sum_xi_2 += x * x; ++ sum_xi_yi += x * y; ++ ++ /* printf("sum(xi)=%.2f sum(yi)=%.2f sum(xi^2)=%.2f sum(xi*yi)=%.2f\n", ++ sum_xi, sum_yi, sum_xi_2, sum_xi_yi); */ ++ ++ *m = ( (double)sum_n * sum_xi_yi - sum_xi * sum_yi ) / ++ ( (double)sum_n * sum_xi_2 - sum_xi * sum_xi ); ++ *b = (sum_yi / (double)sum_n) - (*m) * (sum_xi / (double)sum_n); ++ ++ /* printf("slope = %.2f intercept = %.2f\n", *m, *b); */ ++} ++ ++ ++/* ++ return the least squares error: ++ ++ (y[i] - y_hat[i])^2 ++ ------------------- ++ n ++ */ ++double least_squares_error(double *x, double *y, int n, double m, double b) { ++ int i; ++ double error, sum; ++ ++ sum = 0.0; ++ ++ for ( i = 0; i < n; i++ ) { ++ error = y[i] - (m * x[i] + b); ++ sum += error * error; ++ // printf("%.2f %.2f\n", error, sum); ++ } ++ ++ return ( sum / (double)n ); ++} ++ ++ ++/* ++ return the maximum least squares error: ++ ++ (y[i] - y_hat[i])^2 ++ */ ++double least_squares_max_error(double *x, double *y, int n, double m, double b){ ++ int i; ++ double error, max_error; ++ ++ max_error = 0.0; ++ ++ for ( i = 0; i < n; i++ ) { ++ error = y[i] - (m * x[i] + b); ++ error = error * error; ++ if ( error > max_error ) { ++ max_error = error; ++ } ++ } ++ ++ return ( max_error ); ++} ++ ++ diff --cc simgear/math/leastsqs.hxx index 00000000,00000000..16d6ad09 new file mode 100644 --- /dev/null +++ b/simgear/math/leastsqs.hxx @@@ -1,0 -1,0 +1,73 @@@ ++// leastsqs.h -- Implements a simple linear least squares best fit routine ++// ++// Written by Curtis Olson, started September 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$ ++/// ++ ++ ++#ifndef _LEASTSQS_H ++#define _LEASTSQS_H ++ ++ ++#ifndef __cplusplus ++# error This library requires C++ ++#endif ++ ++ ++/* ++Least squares fit: ++ ++y = b0 + b1x ++ ++ n*sum(xi*yi) - (sum(xi)*sum(yi)) ++b1 = -------------------------------- ++ n*sum(xi^2) - (sum(xi))^2 ++ ++ ++b0 = sum(yi)/n - b1*(sum(xi)/n) ++*/ ++ ++void least_squares(double *x, double *y, int n, double *m, double *b); ++ ++/* incrimentally update existing values with a new data point */ ++void least_squares_update(double x, double y, double *m, double *b); ++ ++ ++/* ++ return the least squares error: ++ ++ (y[i] - y_hat[i])^2 ++ ------------------- ++ n ++*/ ++double least_squares_error(double *x, double *y, int n, double m, double b); ++ ++ ++/* ++ return the maximum least squares error: ++ ++ (y[i] - y_hat[i])^2 ++*/ ++double least_squares_max_error(double *x, double *y, int n, double m, double b); ++ ++ ++#endif // _LEASTSQS_H ++ ++ diff --cc simgear/math/linintp2.h index 00000000,00000000..f0e8a1a9 new file mode 100644 --- /dev/null +++ b/simgear/math/linintp2.h @@@ -1,0 -1,0 +1,110 @@@ ++/* ++ WARNING - Do not remove this header. ++ ++ This code is a templated version of the 'magic-software' spherical ++ interpolation code by Dave Eberly. The original (un-hacked) code can be ++ obtained from here: http://www.magic-software.com/gr_appr.htm ++ This code is derived from linintp2.h/cpp and sphrintp.h/cpp. ++ ++ Dave Eberly says that the conditions for use are: ++ ++ * You may distribute the original source code to others at no charge. ++ ++ * You may modify the original source code and distribute it to others at ++ no charge. The modified code must be documented to indicate that it is ++ not part of the original package. ++ ++ * You may use this code for non-commercial purposes. You may also ++ incorporate this code into commercial packages. However, you may not ++ sell any of your source code which contains my original and/or modified ++ source code. In such a case, you need to factor out my code and freely ++ distribute it. ++ ++ * The original code comes with absolutely no warranty and no guarantee is ++ made that the code is bug-free. ++ ++ This does not seem incompatible with GPL - so this modified version ++ is hereby placed under GPL along with the rest of FlightGear. ++ ++ Christian Mayer ++*/ ++ ++#ifndef LININTP2_H ++#define LININTP2_H ++ ++template ++class mgcLinInterp2D ++{ ++public: ++ mgcLinInterp2D (int _numPoints, double* x, double* y, T* _f); ++ ++ ~mgcLinInterp2D (); ++ ++ double XMin () { return xmin; } ++ double XMax () { return xmax; } ++ double XRange () { return xmax-xmin; } ++ double YMin () { return ymin; } ++ double YMax () { return ymax; } ++ double YRange () { return ymax-ymin; } ++ ++ int PointCount () { return numPoints; } ++ void GetPoint (int i, double& x, double& y); ++ ++ int EdgeCount () { return numEdges; } ++ void GetEdge (int i, double& x0, double& y0, double& x1, double& y1); ++ ++ int TriangleCount () { return numTriangles; } ++ void GetTriangle (int i, double& x0, double& y0, double& x1, double& y1, ++ double& x2, double& y2); ++ ++ int Evaluate (double x, double y, T& F); ++ ++private: ++ typedef struct ++ { ++ double x, y; ++ } ++ Vertex; ++ ++ typedef struct ++ { ++ int vertex[3]; // listed in counterclockwise order ++ ++ int adj[3]; ++ // adj[0] points to triangle sharing edge (vertex[0],vertex[1]) ++ // adj[1] points to triangle sharing edge (vertex[1],vertex[2]) ++ // adj[2] points to triangle sharing edge (vertex[2],vertex[0]) ++ } ++ Triangle; ++ ++ typedef struct ++ { ++ int vertex[2]; ++ int triangle[2]; ++ int index[2]; ++ } ++ Edge; ++ ++ int numPoints; ++ double** point; ++ double** tmppoint; ++ T* f; ++ ++ double xmin, xmax, ymin, ymax; ++ ++ ++ int numEdges; ++ Edge* edge; ++ ++ int numTriangles; ++ Triangle* triangle; ++ ++ int Delaunay2D (); ++ void ComputeBarycenter (Vertex& v0, Vertex& v1, Vertex& v2, Vertex& ver, ++ double c[3]); ++ int InTriangle (Vertex& v0, Vertex& v1, Vertex& v2, Vertex& test); ++}; ++ ++#include "linintp2.inl" ++ ++#endif diff --cc simgear/math/linintp2.inl index 00000000,00000000..1fd489d1 new file mode 100644 --- /dev/null +++ b/simgear/math/linintp2.inl @@@ -1,0 -1,0 +1,540 @@@ ++/* ++ WARNING - Do not remove this header. ++ ++ This code is a templated version of the 'magic-software' spherical ++ interpolation code by Dave Eberly. The original (un-hacked) code can be ++ obtained from here: http://www.magic-software.com/gr_appr.htm ++ This code is derived from linintp2.h/cpp and sphrintp.h/cpp. ++ ++ Dave Eberly says that the conditions for use are: ++ ++ * You may distribute the original source code to others at no charge. ++ ++ * You may modify the original source code and distribute it to others at ++ no charge. The modified code must be documented to indicate that it is ++ not part of the original package. ++ ++ * You may use this code for non-commercial purposes. You may also ++ incorporate this code into commercial packages. However, you may not ++ sell any of your source code which contains my original and/or modified ++ source code. In such a case, you need to factor out my code and freely ++ distribute it. ++ ++ * The original code comes with absolutely no warranty and no guarantee is ++ made that the code is bug-free. ++ ++ This does not seem incompatible with GPL - so this modified version ++ is hereby placed under GPL along with the rest of FlightGear. ++ ++ Christian Mayer ++*/ ++ ++#include ++#include ++#include ++#include "linintp2.h" ++ ++//--------------------------------------------------------------------------- ++template ++mgcLinInterp2D::mgcLinInterp2D (int _numPoints, double* x, double* y, ++ T* _f) ++{ ++ if ( (numPoints = _numPoints) < 3 ) ++ { ++ point = 0; ++ edge = 0; ++ triangle = 0; ++ numTriangles = 0; ++ return; ++ } ++ ++ cout << "[ 20%] allocating memory \r"; ++ ++ point = new double*[numPoints]; ++ tmppoint = new double*[numPoints+3]; ++ f = new T[numPoints]; ++ int i; ++ for (i = 0; i < numPoints; i++) ++ point[i] = new double[2]; ++ for (i = 0; i < numPoints+3; i++) ++ tmppoint[i] = new double[2]; ++ for (i = 0; i < numPoints; i++) ++ { ++ point[i][0] = tmppoint[i][0] = x[i]; ++ point[i][1] = tmppoint[i][1] = y[i]; ++ ++ f[i] = _f[i]; ++ } ++ ++ cout << "[ 30%] creating delaunay diagram \r"; ++ ++ Delaunay2D(); ++} ++//--------------------------------------------------------------------------- ++template ++mgcLinInterp2D::~mgcLinInterp2D () ++{ ++ if ( numPoints < 3 ) ++ return; ++ ++ int i; ++ ++ if ( point ) ++ { ++ for (i = 0; i < numPoints; i++) ++ delete[] point[i]; ++ delete[] point; ++ } ++ if ( tmppoint ) ++ { ++ for (i = 0; i < numPoints+3; i++) ++ delete[] tmppoint[i]; ++ delete[] tmppoint; ++ } ++ ++ delete[] f; ++ delete[] edge; ++ delete[] triangle; ++} ++//--------------------------------------------------------------------------- ++template ++void mgcLinInterp2D::ComputeBarycenter (Vertex& v0, Vertex& v1, Vertex& v2, ++ Vertex& ver, double c[3]) ++{ ++ double A0 = v0.x-v2.x, B0 = v0.y-v2.y; ++ double A1 = v1.x-v2.x, B1 = v1.y-v2.y; ++ double A2 = ver.x-v2.x, B2 = ver.y-v2.y; ++ ++ double m00 = A0*A0+B0*B0, m01 = A0*A1+B0*B1, m11 = A1*A1+B1*B1; ++ double r0 = A2*A0+B2*B0, r1 = A2*A1+B2*B1; ++ double det = m00*m11-m01*m01; ++ ++ c[0] = (m11*r0-m01*r1)/det; ++ c[1] = (m00*r1-m01*r0)/det; ++ c[2] = 1-c[0]-c[1]; ++} ++//--------------------------------------------------------------------------- ++template ++int mgcLinInterp2D::InTriangle (Vertex& v0, Vertex& v1, Vertex& v2, ++ Vertex& test) ++{ ++ const double eps = 1e-08; ++ double tx, ty, nx, ny; ++ ++ // test against normal to first edge ++ tx = test.x - v0.x; ++ ty = test.y - v0.y; ++ nx = v0.y - v1.y; ++ ny = v1.x - v0.x; ++ if ( tx*nx + ty*ny < -eps ) ++ return 0; ++ ++ // test against normal to second edge ++ tx = test.x - v1.x; ++ ty = test.y - v1.y; ++ nx = v1.y - v2.y; ++ ny = v2.x - v1.x; ++ if ( tx*nx + ty*ny < -eps ) ++ return 0; ++ ++ // test against normal to third edge ++ tx = test.x - v2.x; ++ ty = test.y - v2.y; ++ nx = v2.y - v0.y; ++ ny = v0.x - v2.x; ++ if ( tx*nx + ty*ny < -eps ) ++ return 0; ++ ++ return 1; ++} ++//--------------------------------------------------------------------------- ++template ++int mgcLinInterp2D::Evaluate (double x, double y, T& F) ++{ ++ Vertex ver = { x, y }; ++ // determine which triangle contains the target point ++ ++ int i; ++ Vertex v0, v1, v2; ++ for (i = 0; i < numTriangles; i++) ++ { ++ Triangle& t = triangle[i]; ++ v0.x = point[t.vertex[0]][0]; ++ v0.y = point[t.vertex[0]][1]; ++ v1.x = point[t.vertex[1]][0]; ++ v1.y = point[t.vertex[1]][1]; ++ v2.x = point[t.vertex[2]][0]; ++ v2.y = point[t.vertex[2]][1]; ++ ++ if ( InTriangle(v0,v1,v2,ver) ) ++ break; ++ } ++ ++ if ( i == numTriangles ) // point is outside interpolation region ++ { ++ return 0; ++ } ++ ++ Triangle& t = triangle[i]; // (x,y) is in this triangle ++ ++ // compute barycentric coordinates with respect to subtriangle ++ double bary[3]; ++ ComputeBarycenter(v0,v1,v2,ver,bary); ++ ++ // compute barycentric combination of function values at vertices ++ F = bary[0]*f[t.vertex[0]]+bary[1]*f[t.vertex[1]]+bary[2]*f[t.vertex[2]]; ++ ++ return 1; ++} ++//--------------------------------------------------------------------------- ++template ++int mgcLinInterp2D::Delaunay2D () ++{ ++ int result; ++ ++ const double EPSILON = 1e-12; ++ const int TSIZE = 75; ++ const double RANGE = 10.0; ++ ++ xmin = tmppoint[0][0]; ++ xmax = xmin; ++ ymin = tmppoint[0][1]; ++ ymax = ymin; ++ ++ int i; ++ for (i = 0; i < numPoints; i++) ++ { ++ double value = tmppoint[i][0]; ++ if ( xmax < value ) ++ xmax = value; ++ if ( xmin > value ) ++ xmin = value; ++ ++ value = tmppoint[i][1]; ++ if ( ymax < value ) ++ ymax = value; ++ if ( ymin > value ) ++ ymin = value; ++ } ++ ++ double xrange = xmax-xmin, yrange = ymax-ymin; ++ double maxrange = xrange; ++ if ( maxrange < yrange ) ++ maxrange = yrange; ++ ++ // need to scale the data later to do a correct triangle count ++ double maxrange2 = maxrange*maxrange; ++ ++ // tweak the points by very small random numbers ++ double bgs = EPSILON*maxrange; ++ srand(367); ++ for (i = 0; i < numPoints; i++) ++ { ++ tmppoint[i][0] += bgs*(0.5 - rand()/double(RAND_MAX)); ++ tmppoint[i][1] += bgs*(0.5 - rand()/double(RAND_MAX)); ++ } ++ ++ double wrk[2][3] = ++ { ++ { 5*RANGE, -RANGE, -RANGE }, ++ { -RANGE, 5*RANGE, -RANGE } ++ }; ++ for (i = 0; i < 3; i++) ++ { ++ tmppoint[numPoints+i][0] = xmin+xrange*wrk[0][i]; ++ tmppoint[numPoints+i][1] = ymin+yrange*wrk[1][i]; ++ } ++ ++ int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, i11; ++ int nts, ii[3]; ++ double xx; ++ ++ int tsz = 2*TSIZE; ++ int** tmp = new int*[tsz+1]; ++ tmp[0] = new int[2*(tsz+1)]; ++ for (i0 = 1; i0 < tsz+1; i0++) ++ tmp[i0] = tmp[0] + 2*i0; ++ i1 = 2*(numPoints + 2); ++ ++ int* id = new int[i1]; ++ for (i0 = 0; i0 < i1; i0++) ++ id[i0] = i0; ++ ++ int** a3s = new int*[i1]; ++ a3s[0] = new int[3*i1]; ++ for (i0 = 1; i0 < i1; i0++) ++ a3s[i0] = a3s[0] + 3*i0; ++ a3s[0][0] = numPoints; ++ a3s[0][1] = numPoints+1; ++ a3s[0][2] = numPoints+2; ++ ++ double** ccr = new double*[i1]; // circumscribed centers and radii ++ ccr[0] = new double[3*i1]; ++ for (i0 = 1; i0 < i1; i0++) ++ ccr[i0] = ccr[0] + 3*i0; ++ ccr[0][0] = 0.0; ++ ccr[0][1] = 0.0; ++ ccr[0][2] = FLT_MAX; ++ ++ nts = 1; // number of triangles ++ i4 = 1; ++ ++ cout << "[ 40%] create triangulation \r"; ++ ++ // compute triangulation ++ for (i0 = 0; i0 < numPoints; i0++) ++ { ++ i1 = i7 = -1; ++ i9 = 0; ++ for (i11 = 0; i11 < nts; i11++) ++ { ++ i1++; ++ while ( a3s[i1][0] < 0 ) ++ i1++; ++ xx = ccr[i1][2]; ++ for (i2 = 0; i2 < 2; i2++) ++ { ++ double z = tmppoint[i0][i2]-ccr[i1][i2]; ++ xx -= z*z; ++ if ( xx < 0 ) ++ goto Corner3; ++ } ++ i9--; ++ i4--; ++ id[i4] = i1; ++ for (i2 = 0; i2 < 3; i2++) ++ { ++ ii[0] = 0; ++ if (ii[0] == i2) ++ ii[0]++; ++ for (i3 = 1; i3 < 2; i3++) ++ { ++ ii[i3] = ii[i3-1] + 1; ++ if (ii[i3] == i2) ++ ii[i3]++; ++ } ++ if ( i7 > 1 ) ++ { ++ i8 = i7; ++ for (i3 = 0; i3 <= i8; i3++) ++ { ++ for (i5 = 0; i5 < 2; i5++) ++ if ( a3s[i1][ii[i5]] != tmp[i3][i5] ) ++ goto Corner1; ++ for (i6 = 0; i6 < 2; i6++) ++ tmp[i3][i6] = tmp[i8][i6]; ++ i7--; ++ goto Corner2; ++Corner1:; ++ } ++ } ++ if ( ++i7 > tsz ) ++ { ++ // temporary storage exceeded, increase TSIZE ++ result = 0; ++ goto ExitDelaunay; ++ } ++ for (i3 = 0; i3 < 2; i3++) ++ tmp[i7][i3] = a3s[i1][ii[i3]]; ++Corner2:; ++ } ++ a3s[i1][0] = -1; ++Corner3:; ++ } ++ ++ for (i1 = 0; i1 <= i7; i1++) ++ { ++ for (i2 = 0; i2 < 2; i2++) ++ for (wrk[i2][2] = 0, i3 = 0; i3 < 2; i3++) ++ { ++ wrk[i2][i3] = tmppoint[tmp[i1][i2]][i3]-tmppoint[i0][i3]; ++ wrk[i2][2] += ++ 0.5*wrk[i2][i3]*(tmppoint[tmp[i1][i2]][i3]+ ++ tmppoint[i0][i3]); ++ } ++ ++ xx = wrk[0][0]*wrk[1][1]-wrk[1][0]*wrk[0][1]; ++ ccr[id[i4]][0] = (wrk[0][2]*wrk[1][1]-wrk[1][2]*wrk[0][1])/xx; ++ ccr[id[i4]][1] = (wrk[0][0]*wrk[1][2]-wrk[1][0]*wrk[0][2])/xx; ++ ++ for (ccr[id[i4]][2] = 0, i2 = 0; i2 < 2; i2++) ++ { ++ double z = tmppoint[i0][i2]-ccr[id[i4]][i2]; ++ ccr[id[i4]][2] += z*z; ++ a3s[id[i4]][i2] = tmp[i1][i2]; ++ } ++ ++ a3s[id[i4]][2] = i0; ++ i4++; ++ i9++; ++ } ++ nts += i9; ++ } ++ ++ // count the number of triangles ++ cout << "[ 50%] count the number of triangles \r"; ++ ++ numTriangles = 0; ++ i0 = -1; ++ for (i11 = 0; i11 < nts; i11++) ++ { ++ i0++; ++ while ( a3s[i0][0] < 0 ) ++ i0++; ++ if ( a3s[i0][0] < numPoints ) ++ { ++ for (i1 = 0; i1 < 2; i1++) ++ for (i2 = 0; i2 < 2; i2++) ++ wrk[i1][i2] = ++ tmppoint[a3s[i0][i1]][i2]-tmppoint[a3s[i0][2]][i2]; ++ ++ if ( fabs(wrk[0][0]*wrk[1][1]-wrk[0][1]*wrk[1][0]) > EPSILON*maxrange2 ) ++ numTriangles++; ++ } ++ } ++ ++ // create the triangles ++ cout << "[ 60%] create the triangles \r"; ++ ++ triangle = new Triangle[numTriangles]; ++ ++ numTriangles = 0; ++ i0 = -1; ++ for (i11 = 0; i11 < nts; i11++) ++ { ++ i0++; ++ while ( a3s[i0][0] < 0 ) ++ i0++; ++ if ( a3s[i0][0] < numPoints ) ++ { ++ for (i1 = 0; i1 < 2; i1++) ++ for (i2 = 0; i2 < 2; i2++) ++ wrk[i1][i2] = ++ tmppoint[a3s[i0][i1]][i2]-tmppoint[a3s[i0][2]][i2]; ++ xx = wrk[0][0]*wrk[1][1]-wrk[0][1]*wrk[1][0]; ++ if ( fabs(xx) > EPSILON*maxrange2 ) ++ { ++ int delta = xx < 0 ? 1 : 0; ++ Triangle& tri = triangle[numTriangles]; ++ tri.vertex[0] = a3s[i0][0]; ++ tri.vertex[1] = a3s[i0][1+delta]; ++ tri.vertex[2] = a3s[i0][2-delta]; ++ tri.adj[0] = -1; ++ tri.adj[1] = -1; ++ tri.adj[2] = -1; ++ numTriangles++; ++ } ++ } ++ } ++ ++ // build edge table ++ cout << "[ 70%] build the edge table \r"; ++ ++ numEdges = 0; ++ edge = new Edge[3*numTriangles]; ++ ++ int j, j0, j1; ++ for (i = 0; i < numTriangles; i++) ++ { ++ if ( (i%500) == 0) ++ cout << "[ 7" << 10*i/numTriangles << "%] build the edge table \r"; ++ ++ Triangle& t = triangle[i]; ++ ++ for (j0 = 0, j1 = 1; j0 < 3; j0++, j1 = (j1+1)%3) ++ { ++ for (j = 0; j < numEdges; j++) ++ { ++ Edge& e = edge[j]; ++ if ( (t.vertex[j0] == e.vertex[0] ++ && t.vertex[j1] == e.vertex[1]) ++ || (t.vertex[j0] == e.vertex[1] ++ && t.vertex[j1] == e.vertex[0]) ) ++ break; ++ } ++ if ( j == numEdges ) // add edge to table ++ { ++ edge[j].vertex[0] = t.vertex[j0]; ++ edge[j].vertex[1] = t.vertex[j1]; ++ edge[j].triangle[0] = i; ++ edge[j].index[0] = j0; ++ edge[j].triangle[1] = -1; ++ numEdges++; ++ } ++ else // edge already exists, add triangle to table ++ { ++ edge[j].triangle[1] = i; ++ edge[j].index[1] = j0; ++ } ++ } ++ } ++ ++ // establish links between adjacent triangles ++ cout << "[ 80%] establishing links between adjacent triangles \r"; ++ ++ for (i = 0; i < numEdges; i++) ++ { ++ if ( edge[i].triangle[1] != -1 ) ++ { ++ j0 = edge[i].triangle[0]; ++ j1 = edge[i].triangle[1]; ++ triangle[j0].adj[edge[i].index[0]] = j1; ++ triangle[j1].adj[edge[i].index[1]] = j0; ++ } ++ } ++ ++ result = 1; ++ ++ExitDelaunay:; ++ delete[] tmp[0]; ++ delete[] tmp; ++ delete[] id; ++ delete[] a3s[0]; ++ delete[] a3s; ++ delete[] ccr[0]; ++ delete[] ccr; ++ ++ cout << "[ 90%] finsishes delauney triangulation \r"; ++ ++ return result; ++} ++//--------------------------------------------------------------------------- ++template ++void mgcLinInterp2D::GetPoint (int i, double& x, double& y) ++{ ++ // assumes i is valid [can use PointCount() before passing i] ++ x = point[i][0]; ++ y = point[i][1]; ++} ++//--------------------------------------------------------------------------- ++template ++void mgcLinInterp2D::GetEdge (int i, double& x0, double& y0, double& x1, ++ double& y1) ++{ ++ // assumes i is valid [can use EdgeCount() before passing i] ++ int v0 = edge[i].vertex[0], v1 = edge[i].vertex[1]; ++ ++ x0 = point[v0][0]; ++ y0 = point[v0][1]; ++ x1 = point[v1][0]; ++ y1 = point[v1][1]; ++} ++//--------------------------------------------------------------------------- ++template ++void mgcLinInterp2D::GetTriangle (int i, double& x0, double& y0, double& x1, ++ double& y1, double& x2, double& y2) ++{ ++ // assumes i is valid [can use TriangleCount() before passing i] ++ int v0 = triangle[i].vertex[0]; ++ int v1 = triangle[i].vertex[1]; ++ int v2 = triangle[i].vertex[2]; ++ ++ x0 = point[v0][0]; ++ y0 = point[v0][1]; ++ x1 = point[v1][0]; ++ y1 = point[v1][1]; ++ x2 = point[v2][0]; ++ y2 = point[v2][1]; ++} ++//--------------------------------------------------------------------------- ++ diff --cc simgear/math/mat3.h index 00000000,00000000..63f741f7 new file mode 100644 --- /dev/null +++ b/simgear/math/mat3.h @@@ -1,0 -1,0 +1,233 @@@ ++/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */ ++ ++/* ------------------------------------------------------------------------- ++ Public MAT3 include file ++ ------------------------------------------------------------------------- */ ++ ++#ifndef MAT3_HAS_BEEN_INCLUDED ++#define MAT3_HAS_BEEN_INCLUDED ++ ++/* ----------------------------- Constants ------------------------------ */ ++ ++/* ++ * Make sure the math library .h file is included, in case it wasn't. ++ */ ++ ++#ifndef HUGE ++#include ++#endif ++#include ++ ++#include ++#include ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++#define MAT3_DET0 -1 /* Indicates singular mat */ ++#define MAT3_EPSILON 1e-12 /* Close enough to zero */ ++ ++#ifdef M_PI ++# define MAT3_PI M_PI ++#else ++# define MAT3_PI 3.14159265358979323846 ++#endif ++ ++#define USE_XTRA_MAT3_INLINES ++ ++#if defined(i386) ++#define USE_X86_ASM ++#endif ++ ++#if defined(USE_X86_ASM) ++static __inline__ int FloatToInt(float f) ++{ ++ int r; ++ __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st"); ++ return r; ++} ++#elif defined(__MSC__) && defined(__WIN32__) ++static __inline int FloatToInt(float f) ++{ ++ int r; ++ _asm { ++ fld f ++ fistp r ++ } ++ return r; ++} ++#else ++#define FloatToInt(F) ((int) ((F) < 0.0f ? (F)-0.5f : (F)+0.5f)) ++#endif ++ ++/* ------------------------------ Types --------------------------------- */ ++ ++typedef double MAT3mat[4][4]; /* 4x4 matrix */ ++typedef double MAT3vec[3]; /* Vector */ ++typedef double MAT3hvec[4]; /* Vector with homogeneous coord */ ++ ++/* ------------------------------ Macros -------------------------------- */ ++ ++extern MAT3mat identityMatrix; ++ ++/* Tests if a number is within EPSILON of zero */ ++#define MAT3_IS_ZERO(N) ((N) < MAT3_EPSILON && (N) > -MAT3_EPSILON) ++ ++/* Sets a vector to the three given values */ ++#define MAT3_SET_VEC(V,X,Y,Z) ((V)[0]=(X), (V)[1]=(Y), (V)[2]=(Z)) ++ ++/* Tests a vector for all components close to zero */ ++#define MAT3_IS_ZERO_VEC(V) (MAT3_IS_ZERO((V)[0]) && \ ++ MAT3_IS_ZERO((V)[1]) && \ ++ MAT3_IS_ZERO((V)[2])) ++ ++/* Dot product of two vectors */ ++#define MAT3_DOT_PRODUCT(V1,V2) \ ++ ((V1)[0]*(V2)[0] + (V1)[1]*(V2)[1] + (V1)[2]*(V2)[2]) ++ ++/* Copy one vector to other */ ++#define MAT3_COPY_VEC(TO,FROM) ((TO)[0] = (FROM)[0], \ ++ (TO)[1] = (FROM)[1], \ ++ (TO)[2] = (FROM)[2]) ++ ++/* Normalize vector to unit length, using TEMP as temporary variable. ++ * TEMP will be zero if vector has zero length */ ++#define MAT3_NORMALIZE_VEC(V,TEMP) \ ++ if ((TEMP = sqrt(MAT3_DOT_PRODUCT(V,V))) > MAT3_EPSILON) { \ ++ TEMP = 1.0 / TEMP; \ ++ MAT3_SCALE_VEC(V,V,TEMP); \ ++ } else TEMP = 0.0 ++ ++/* Scale vector by given factor, storing result vector in RESULT_V */ ++#define MAT3_SCALE_VEC(RESULT_V,V,SCALE) \ ++ MAT3_SET_VEC(RESULT_V, (V)[0]*(SCALE), (V)[1]*(SCALE), (V)[2]*(SCALE)) ++ ++/* Adds vectors V1 and V2, storing result in RESULT_V */ ++#define MAT3_ADD_VEC(RESULT_V,V1,V2) \ ++ MAT3_SET_VEC(RESULT_V, (V1)[0]+(V2)[0], (V1)[1]+(V2)[1], \ ++ (V1)[2]+(V2)[2]) ++ ++/* Subtracts vector V2 from V1, storing result in RESULT_V */ ++#define MAT3_SUB_VEC(RESULT_V,V1,V2) \ ++ MAT3_SET_VEC(RESULT_V, (V1)[0]-(V2)[0], (V1)[1]-(V2)[1], \ ++ (V1)[2]-(V2)[2]) ++ ++/* Multiplies vectors V1 and V2, storing result in RESULT_V */ ++#define MAT3_MULT_VEC(RESULT_V,V1,V2) \ ++ MAT3_SET_VEC(RESULT_V, (V1)[0]*(V2)[0], (V1)[1]*(V2)[1], \ ++ (V1)[2]*(V2)[2]) ++ ++/* Sets RESULT_V to the linear combination of V1 and V2, scaled by ++ * SCALE1 and SCALE2, respectively */ ++#define MAT3_LINEAR_COMB(RESULT_V,SCALE1,V1,SCALE2,V2) \ ++ MAT3_SET_VEC(RESULT_V, (SCALE1)*(V1)[0] + (SCALE2)*(V2)[0], \ ++ (SCALE1)*(V1)[1] + (SCALE2)*(V2)[1], \ ++ (SCALE1)*(V1)[2] + (SCALE2)*(V2)[2]) ++ ++/* Several of the vector macros are useful for homogeneous-coord vectors */ ++#define MAT3_SET_HVEC(V,X,Y,Z,W) ((V)[0]=(X), (V)[1]=(Y), \ ++ (V)[2]=(Z), (V)[3]=(W)) ++ ++#define MAT3_COPY_HVEC(TO,FROM) ((TO)[0] = (FROM)[0], \ ++ (TO)[1] = (FROM)[1], \ ++ (TO)[2] = (FROM)[2], \ ++ (TO)[3] = (FROM)[3]) ++ ++#define MAT3_SCALE_HVEC(RESULT_V,V,SCALE) \ ++ MAT3_SET_HVEC(RESULT_V, (V)[0]*(SCALE), (V)[1]*(SCALE), \ ++ (V)[2]*(SCALE), (V)[3]*(SCALE)) ++ ++#define MAT3_ADD_HVEC(RESULT_V,V1,V2) \ ++ MAT3_SET_HVEC(RESULT_V, (V1)[0]+(V2)[0], (V1)[1]+(V2)[1], \ ++ (V1)[2]+(V2)[2], (V1)[3]+(V2)[3]) ++ ++#define MAT3_SUB_HVEC(RESULT_V,V1,V2) \ ++ MAT3_SET_HVEC(RESULT_V, (V1)[0]-(V2)[0], (V1)[1]-(V2)[1], \ ++ (V1)[2]-(V2)[2], (V1)[3]-(V2)[3]) ++ ++#define MAT3_MULT_HVEC(RESULT_V,V1,V2) \ ++ MAT3_SET_HVEC(RESULT_V, (V1)[0]*(V2)[0], (V1)[1]*(V2)[1], \ ++ (V1)[2]*(V2)[2], (V1)[3]*(V2)[3]) ++ ++/* ------------------------------ Entries ------------------------------- */ ++ ++ ++#define MAT3identity(mat) fgmemcpy( mat, identityMatrix, sizeof(MAT3mat) ) ++#define MAT3zero(mat) fgmemzero( mat, sizeof(MAT3mat) ) ++#define MAT3copy(to, from) fgmemcpy( to, from, sizeof(MAT3mat) ) ++ ++#if defined( USE_XTRA_MAT3_INLINES ) ++ ++# define MAT3mult_vec( result_vec, vec, mat) { \ ++ MAT3vec tempvec; \ ++ tempvec[0]=vec[0]*mat[0][0]+vec[1]*mat[1][0]+vec[2]*mat[2][0]+mat[3][0]; \ ++ tempvec[1]=vec[0]*mat[0][1]+vec[1]*mat[1][1]+vec[2]*mat[2][1]+mat[3][1]; \ ++ tempvec[2]=vec[0]*mat[0][2]+vec[1]*mat[1][2]+vec[2]*mat[2][2]+mat[3][2]; \ ++ result_vec[0] = tempvec[0]; \ ++ result_vec[1] = tempvec[1]; \ ++ result_vec[2] = tempvec[2]; \ ++} ++ ++# define MAT3cross_product(result_vec, vec1, vec2) { \ ++ MAT3vec tempvec; \ ++ tempvec[0] = vec1[1] * vec2[2] - vec1[2] * vec2[1]; \ ++ tempvec[1] = vec1[2] * vec2[0] - vec1[0] * vec2[2]; \ ++ tempvec[2] = vec1[0] * vec2[1] - vec1[1] * vec2[0]; \ ++ result_vec[0] = tempvec[0]; \ ++ result_vec[1] = tempvec[1]; \ ++ result_vec[2] = tempvec[2]; \ ++} ++ ++# define MAT3mult( result_mat, mat1, mat2) { \ ++ register int i, j; \ ++ MAT3mat tmp_mat; \ ++ for (i = 0; i < 4; i++) \ ++ for (j = 0; j < 4; j++) \ ++ tmp_mat[i][j] = (mat1[i][0] * mat2[0][j] + \ ++ mat1[i][1] * mat2[1][j] + \ ++ mat1[i][2] * mat2[2][j] + \ ++ mat1[i][3] * mat2[3][j]); \ ++ fgmemcpy(result_mat, tmp_mat, sizeof(MAT3mat)); \ ++} ++ ++#else // !defined( USE_XTRA_MAT3_INLINES ) ++ ++/* In MAT3mat.c */ ++void MAT3mult(MAT3mat result, MAT3mat, MAT3mat); ++void MAT3mult_vec(MAT3vec result_vec, MAT3vec vec, MAT3mat mat); ++void MAT3cross_product(MAT3vec result,MAT3vec,MAT3vec); ++ ++#endif // defined( USE_XTRA_MAT3_INLINES ) ++ ++/* In MAT3geom.c */ ++void MAT3direction_matrix (MAT3mat result_mat, MAT3mat mat); ++int MAT3normal_matrix (MAT3mat result_mat, MAT3mat mat); ++void MAT3rotate (MAT3mat result_mat, MAT3vec axis, double angle_in_radians); ++void MAT3translate (MAT3mat result_mat, MAT3vec trans); ++void MAT3scale (MAT3mat result_mat, MAT3vec scale); ++void MAT3shear(MAT3mat result_mat, double xshear, double yshear); ++ ++void MAT3transpose (MAT3mat result, MAT3mat); ++int MAT3invert (MAT3mat result, MAT3mat); ++void MAT3print (MAT3mat, FILE *fp); ++void MAT3print_formatted (MAT3mat, FILE *fp, ++ char *title, char *head, char *format, char *tail); ++int MAT3equal( void ); ++double MAT3trace( void ); ++int MAT3power( void ); ++int MAT3column_reduce( void ); ++int MAT3kernel_basis( void ); ++ ++/* In MAT3vec.c */ ++int MAT3mult_hvec (MAT3hvec result_vec, MAT3hvec vec, MAT3mat mat, int normalize); ++void MAT3perp_vec(MAT3vec result_vec, MAT3vec vec, int is_unit); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++ ++#endif /* MAT3_HAS_BEEN_INCLUDED */ ++ diff --cc simgear/math/mat3defs.h index 00000000,00000000..a79cba9b new file mode 100644 --- /dev/null +++ b/simgear/math/mat3defs.h @@@ -1,0 -1,0 +1,56 @@@ ++/* Copyright 1988, Brown Computer Graphics Group. All Rights Reserved. */ ++ ++ ++#ifndef _MAT3DEFS_H ++#define _MAT3DEFS_H ++ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include ++/* #include */ ++#include "mat3.h" ++ ++/* ----------------------------- Constants ------------------------------ */ ++ ++#define FALSE 0 ++#define TRUE 1 ++ ++#define CNULL ((char *) NULL) ++ ++/* ------------------------------ Macros -------------------------------- */ ++ ++#define ALLOCN(P,T,N,M) \ ++ if ((P = (T *) malloc((unsigned) (N) * sizeof(T))) == NULL) \ ++ ERR_ERROR(MAT3_errid, ERR_FATAL, (ERR_ALLOC1, M)); \ ++ else ++ ++#define FREE(P) free((char *) (P)) ++ ++#define ABS(A) ((A) > 0 ? (A) : -(A)) ++#define MIN(A,B) ((A) < (B) ? (A) : (B)) ++#define MAX(A,B) ((A) > (B) ? (A) : (B)) ++ ++#define SWAP(A,B,T) (T = A, A = B, B = T) ++ ++/* Is N within EPS of zero ? */ ++#define IS_ZERO(N,EPS) ((N) < EPS && (N) > -EPS) ++ ++/* Macros for lu routines */ ++#define LU_PERMUTE(p,i,j) { int LU_T; LU_T = p[i]; p[i] = p[j]; p[j] = LU_T; } ++ ++/* ------------------------- Internal Entries ---------------------------- */ ++ ++/* ------------------------- Global Variables ---------------------------- */ ++ ++/* extern ERRid *MAT3_errid; */ ++ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++ ++#endif /* _MAT3DEFS_H */ diff --cc simgear/math/mat3err.h index 00000000,00000000..7ac5740a new file mode 100644 --- /dev/null +++ b/simgear/math/mat3err.h @@@ -1,0 -1,0 +1,41 @@@ ++#ifndef _MAT3ERR_H ++#define _MAT3ERR_H ++ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++#include "sph_errtypes.h" ++ ++#ifdef THINK_C ++/* We hide this from gnu's compiler, which doesn't understand it. */ ++void SPH__error (int errtype, ...); ++#endif ++ ++ ++#define ERR_ERROR(A,B,C) \ ++ if (1) {char cstr[256]; sprintf C; SPH__error(ERR_MAT3_PACKAGE, cstr); } else ++ ++ ++#define ERR_S cstr,"%s\n" ++#define ERR_SI cstr,"%s: %d\n" ++#define ERR_SS cstr,"%s: %s\n" ++ ++#define ERR_SEVERE 0 ++#define ERR_FATAL 0 ++ ++#define ERR_ALLOC1 0 ++ ++typedef int ERRid; ++ ++#define ERRregister_package(S) 100 ++ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++ ++#endif /* _MAT3ERR_H */ diff --cc simgear/math/point3d.hxx index 00000000,00000000..10b14533 new file mode 100644 --- /dev/null +++ b/simgear/math/point3d.hxx @@@ -1,0 -1,0 +1,341 @@@ ++// point3d.hxx -- a 3d point class. ++// ++// Adapted from algebra3 by Jean-Francois Doue, started October 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 _POINT3D_HXX ++#define _POINT3D_HXX ++ ++ ++#ifndef __cplusplus ++# error This library requires C++ ++#endif ++ ++#include ++ ++#ifdef FG_MATH_EXCEPTION_CLASH ++# define exception c_exception ++#endif ++ ++#ifdef FG_HAVE_STD_INCLUDES ++# include ++# include ++# include ++#else ++# include ++# include ++# include ++#endif ++ ++// I don't understand ... or should be included ++// already depending on how you defined FG_HAVE_STD_INCLUDES, but I ++// can go ahead and add this -- CLO ++#ifdef __MWERKS__ ++FG_USING_NAMESPACE(std); ++#endif ++ ++#ifndef FG_HAVE_NATIVE_SGI_COMPILERS ++FG_USING_STD(ostream); ++FG_USING_STD(istream); ++#endif ++ ++ ++const double fgPoint3_Epsilon = 0.0000001; ++ ++enum {PX, PY, PZ}; // axes ++ ++// Kludge for msvc++ 6.0 - requires forward decls of friend functions. ++class Point3D; ++istream& operator>> ( istream&, Point3D& ); ++ostream& operator<< ( ostream&, const Point3D& ); ++Point3D operator- (const Point3D& p); // -p1 ++bool operator== (const Point3D& a, const Point3D& b); // p1 == p2? ++ ++ ++/////////////////////////// ++// ++// 3D Point ++// ++/////////////////////////// ++ ++class Point3D { ++ ++protected: ++ ++ double n[3]; ++ ++public: ++ ++ // Constructors ++ ++ Point3D(); ++ Point3D(const double x, const double y, const double z); ++ explicit Point3D(const double d); ++ Point3D(const Point3D &p); ++ ++ // Assignment operators ++ ++ Point3D& operator = ( const Point3D& p ); // assignment of a Point3D ++ Point3D& operator += ( const Point3D& p ); // incrementation by a Point3D ++ Point3D& operator -= ( const Point3D& p ); // decrementation by a Point3D ++ Point3D& operator *= ( const double d ); // multiplication by a constant ++ Point3D& operator /= ( const double d ); // division by a constant ++ ++ void setx(const double x); ++ void sety(const double y); ++ void setz(const double z); ++ ++ // Queries ++ ++ double& operator [] ( int i); // indexing ++ double operator[] (int i) const; // read-only indexing ++ ++ inline const double *get_n() const { return n; }; ++ double x() const; // cartesian x ++ double y() const; // cartesian y ++ double z() const; // cartesian z ++ ++ double lon() const; // polar longitude ++ double lat() const; // polar latitude ++ double radius() const; // polar radius ++ double elev() const; // geodetic elevation (if specifying a surface point) ++ ++ // friends ++ friend Point3D operator - (const Point3D& p); // -p1 ++ friend bool operator == (const Point3D& a, const Point3D& b); // p1 == p2? ++ friend istream& operator>> ( istream&, Point3D& ); ++ friend ostream& operator<< ( ostream&, const Point3D& ); ++ ++ // Special functions ++ double distance3D(const Point3D& a) const; // distance between ++ double distance3Dsquared(const Point3D& a) const; // distance between ^ 2 ++}; ++ ++ ++// input from stream ++inline istream& ++operator >> ( istream& in, Point3D& p) ++{ ++ char c; ++ ++ in >> p.n[PX]; ++ ++ // read past optional comma ++ while ( in.get(c) ) { ++ if ( (c != ' ') && (c != ',') ) { ++ // push back on the stream ++ in.putback(c); ++ break; ++ } ++ } ++ ++ in >> p.n[PY]; ++ ++ // read past optional comma ++ while ( in.get(c) ) { ++ if ( (c != ' ') && (c != ',') ) { ++ // push back on the stream ++ in.putback(c); ++ break; ++ } ++ } ++ ++ in >> p.n[PZ]; ++ ++ return in; ++} ++ ++inline ostream& ++operator<< ( ostream& out, const Point3D& p ) ++{ ++ return out << p.n[PX] << ", " << p.n[PY] << ", " << p.n[PZ]; ++} ++ ++/////////////////////////// ++// ++// Point3D Member functions ++// ++/////////////////////////// ++ ++// CONSTRUCTORS ++ ++inline Point3D::Point3D() {} ++ ++inline Point3D::Point3D(const double x, const double y, const double z) ++{ ++ n[PX] = x; n[PY] = y; n[PZ] = z; ++} ++ ++inline Point3D::Point3D(const double d) ++{ ++ n[PX] = n[PY] = n[PZ] = d; ++} ++ ++inline Point3D::Point3D(const Point3D& p) ++{ ++ n[PX] = p.n[PX]; n[PY] = p.n[PY]; n[PZ] = p.n[PZ]; ++} ++ ++// ASSIGNMENT OPERATORS ++ ++inline Point3D& Point3D::operator = (const Point3D& p) ++{ ++ n[PX] = p.n[PX]; n[PY] = p.n[PY]; n[PZ] = p.n[PZ]; return *this; ++} ++ ++inline Point3D& Point3D::operator += ( const Point3D& p ) ++{ ++ n[PX] += p.n[PX]; n[PY] += p.n[PY]; n[PZ] += p.n[PZ]; return *this; ++} ++ ++inline Point3D& Point3D::operator -= ( const Point3D& p ) ++{ ++ n[PX] -= p.n[PX]; n[PY] -= p.n[PY]; n[PZ] -= p.n[PZ]; return *this; ++} ++ ++inline Point3D& Point3D::operator *= ( const double d ) ++{ ++ n[PX] *= d; n[PY] *= d; n[PZ] *= d; return *this; ++} ++ ++inline Point3D& Point3D::operator /= ( const double d ) ++{ ++ double d_inv = 1./d; n[PX] *= d_inv; n[PY] *= d_inv; n[PZ] *= d_inv; ++ return *this; ++} ++ ++inline void Point3D::setx(const double x) { ++ n[PX] = x; ++} ++ ++inline void Point3D::sety(const double y) { ++ n[PY] = y; ++} ++ ++inline void Point3D::setz(const double z) { ++ n[PZ] = z; ++} ++ ++// QUERIES ++ ++inline double& Point3D::operator [] ( int i) ++{ ++ assert(! (i < PX || i > PZ)); ++ return n[i]; ++} ++ ++inline double Point3D::operator [] ( int i) const { ++ assert(! (i < PX || i > PZ)); ++ return n[i]; ++} ++ ++ ++inline double Point3D::x() const { return n[PX]; } ++ ++inline double Point3D::y() const { return n[PY]; } ++ ++inline double Point3D::z() const { return n[PZ]; } ++ ++inline double Point3D::lon() const { return n[PX]; } ++ ++inline double Point3D::lat() const { return n[PY]; } ++ ++inline double Point3D::radius() const { return n[PZ]; } ++ ++inline double Point3D::elev() const { return n[PZ]; } ++ ++ ++// FRIENDS ++ ++inline Point3D operator - (const Point3D& a) ++{ ++ return Point3D(-a.n[PX],-a.n[PY],-a.n[PZ]); ++} ++ ++inline Point3D operator + (const Point3D& a, const Point3D& b) ++{ ++ return Point3D(a) += b; ++} ++ ++inline Point3D operator - (const Point3D& a, const Point3D& b) ++{ ++ return Point3D(a) -= b; ++} ++ ++inline Point3D operator * (const Point3D& a, const double d) ++{ ++ return Point3D(a) *= d; ++} ++ ++inline Point3D operator * (const double d, const Point3D& a) ++{ ++ return a*d; ++} ++ ++inline Point3D operator / (const Point3D& a, const double d) ++{ ++ return Point3D(a) *= (1.0 / d ); ++} ++ ++inline bool operator == (const Point3D& a, const Point3D& b) ++{ ++ return ++ fabs(a.n[PX] - b.n[PX]) < fgPoint3_Epsilon && ++ fabs(a.n[PY] - b.n[PY]) < fgPoint3_Epsilon && ++ fabs(a.n[PZ] - b.n[PZ]) < fgPoint3_Epsilon; ++} ++ ++inline bool operator != (const Point3D& a, const Point3D& b) ++{ ++ return !(a == b); ++} ++ ++// Special functions ++ ++inline double ++Point3D::distance3D(const Point3D& a ) const ++{ ++ double x, y, z; ++ ++ x = n[PX] - a.n[PX]; ++ y = n[PY] - a.n[PY]; ++ z = n[PZ] - a.n[PZ]; ++ ++ return sqrt(x*x + y*y + z*z); ++} ++ ++ ++inline double ++Point3D::distance3Dsquared(const Point3D& a ) const ++{ ++ double x, y, z; ++ ++ x = n[PX] - a.n[PX]; ++ y = n[PY] - a.n[PY]; ++ z = n[PZ] - a.n[PZ]; ++ ++ return(x*x + y*y + z*z); ++} ++ ++ ++#endif // _POINT3D_HXX ++ ++ diff --cc simgear/math/polar3d.cxx index 00000000,00000000..1b6c2b0a new file mode 100644 --- /dev/null +++ b/simgear/math/polar3d.cxx @@@ -1,0 -1,0 +1,61 @@@ ++// polar.cxx -- routines to deal with polar math and transformations ++// ++// Written by Curtis Olson, started June 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$ ++ ++ ++#include ++#include ++ ++#include ++ ++#include "polar3d.hxx" ++ ++ ++// Find the Altitude above the Ellipsoid (WGS84) given the Earth ++// Centered Cartesian coordinate vector Distances are specified in ++// meters. ++double fgGeodAltFromCart(const Point3D& cp) ++{ ++ double t_lat, x_alpha, mu_alpha; ++ double lat_geoc, radius; ++ double result; ++ ++ lat_geoc = FG_PI_2 - atan2( sqrt(cp.x()*cp.x() + cp.y()*cp.y()), cp.z() ); ++ radius = sqrt( cp.x()*cp.x() + cp.y()*cp.y() + cp.z()*cp.z() ); ++ ++ if( ( (FG_PI_2 - lat_geoc) < ONE_SECOND ) // near North pole ++ || ( (FG_PI_2 + lat_geoc) < ONE_SECOND ) ) // near South pole ++ { ++ result = radius - EQUATORIAL_RADIUS_M*E; ++ } else { ++ t_lat = tan(lat_geoc); ++ x_alpha = E*EQUATORIAL_RADIUS_M/sqrt(t_lat*t_lat + E*E); ++ mu_alpha = atan2(sqrt(RESQ_M - x_alpha*x_alpha),E*x_alpha); ++ if (lat_geoc < 0) { ++ mu_alpha = - mu_alpha; ++ } ++ result = (radius - x_alpha/cos(lat_geoc))*cos(mu_alpha - lat_geoc); ++ } ++ ++ return(result); ++} ++ ++ diff --cc simgear/math/polar3d.hxx index 00000000,00000000..8e42fdb0 new file mode 100644 --- /dev/null +++ b/simgear/math/polar3d.hxx @@@ -1,0 -1,0 +1,101 @@@ ++// polar.hxx -- routines to deal with polar math and transformations ++// ++// Written by Curtis Olson, started June 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$ ++ ++ ++#ifndef _POLAR_HXX ++#define _POLAR_HXX ++ ++ ++#ifndef __cplusplus ++# error This library requires C++ ++#endif ++ ++ ++#include ++#include ++ ++ ++// Find the Altitude above the Ellipsoid (WGS84) given the Earth ++// Centered Cartesian coordinate vector Distances are specified in ++// meters. ++double fgGeodAltFromCart(const Point3D& cp); ++ ++ ++// Convert a polar coordinate to a cartesian coordinate. Lon and Lat ++// must be specified in radians. The FG convention is for distances ++// to be specified in meters ++inline Point3D fgPolarToCart3d(const Point3D& p) { ++ double tmp = cos( p.lat() ) * p.radius(); ++ ++ return Point3D( cos( p.lon() ) * tmp, ++ sin( p.lon() ) * tmp, ++ sin( p.lat() ) * p.radius() ); ++} ++ ++ ++// Convert a cartesian coordinate to polar coordinates (lon/lat ++// specified in radians. Distances are specified in meters. ++inline Point3D fgCartToPolar3d(const Point3D& cp) { ++ return Point3D( atan2( cp.y(), cp.x() ), ++ FG_PI_2 - ++ atan2( sqrt(cp.x()*cp.x() + cp.y()*cp.y()), cp.z() ), ++ sqrt(cp.x()*cp.x() + cp.y()*cp.y() + cp.z()*cp.z()) ); ++} ++ ++ ++// calc new lon/lat given starting lon/lat, and offset radial, and ++// distance. NOTE: starting point is specifed in radians, distance is ++// specified in meters (and converted internally to radians) ++// ... assumes a spherical world ++inline Point3D calc_lon_lat( const Point3D& orig, double course, double dist ) { ++ Point3D result; ++ ++ // lat=asin(sin(lat1)*cos(d)+cos(lat1)*sin(d)*cos(tc)) ++ // IF (cos(lat)=0) ++ // lon=lon1 // endpoint a pole ++ // ELSE ++ // lon=mod(lon1-asin(sin(tc)*sin(d)/cos(lat))+pi,2*pi)-pi ++ // ENDIF ++ ++ // printf("calc_lon_lat() offset.theta = %.2f offset.dist = %.2f\n", ++ // offset.theta, offset.dist); ++ ++ dist *= METER_TO_NM * NM_TO_RAD; ++ ++ result.sety( asin( sin(orig.y()) * cos(dist) + ++ cos(orig.y()) * sin(dist) * cos(course) ) ); ++ ++ if ( cos(result.y()) < FG_EPSILON ) { ++ result.setx( orig.x() ); // endpoint a pole ++ } else { ++ result.setx( ++ fmod(orig.x() - asin( sin(course) * sin(dist) / ++ cos(result.y()) ) + FG_PI, FG_2PI) - FG_PI ); ++ } ++ ++ return result; ++} ++ ++ ++#endif // _POLAR_HXX ++ ++ diff --cc simgear/math/sphrintp.h index 00000000,00000000..d0987e23 new file mode 100644 --- /dev/null +++ b/simgear/math/sphrintp.h @@@ -1,0 -1,0 +1,78 @@@ ++/* ++ WARNING - Do not remove this header. ++ ++ This code is a templated version of the 'magic-software' spherical ++ interpolation code by Dave Eberly. The original (un-hacked) code can be ++ obtained from here: http://www.magic-software.com/gr_appr.htm ++ This code is derived from linintp2.h/cpp and sphrintp.h/cpp. ++ ++ Dave Eberly says that the conditions for use are: ++ ++ * You may distribute the original source code to others at no charge. ++ ++ * You may modify the original source code and distribute it to others at ++ no charge. The modified code must be documented to indicate that it is ++ not part of the original package. ++ ++ * You may use this code for non-commercial purposes. You may also ++ incorporate this code into commercial packages. However, you may not ++ sell any of your source code which contains my original and/or modified ++ source code. In such a case, you need to factor out my code and freely ++ distribute it. ++ ++ * The original code comes with absolutely no warranty and no guarantee is ++ made that the code is bug-free. ++ ++ This does not seem incompatible with GPL - so this modified version ++ is hereby placed under GPL along with the rest of FlightGear. ++ ++ Christian Mayer ++*/ ++ ++#ifndef SPHRINTP_H ++#define SPHRINTP_H ++ ++#include "linintp2.h" ++#include ++ ++template ++class SphereInterpolate ++{ ++public: ++ SphereInterpolate (int n, const double* x, const double* y, ++ const double* z, const T* f); ++ SphereInterpolate (int n, const sgVec2* p, const T* f); ++ ++ ~SphereInterpolate (); ++ ++ void GetSphericalCoords (const double x, const double y, const double z, ++ double& thetaAngle, double& phiAngle) const; ++ ++ int Evaluate (const double x, const double y, const double z, T& f) const; ++ int Evaluate (const double thetaAngle, const double phiAngle, T& f) const; ++ ++ T Evaluate(const sgVec2& p) const ++ { ++ T retval; ++ Evaluate(p[1], p[0], retval); ++ return retval; ++ } ++ ++ T Evaluate(const sgVec3& p) const ++ { ++ T retval; ++ Evaluate(p[1], p[0], retval); ++ return retval; ++ } ++ ++protected: ++ int numPoints; ++ double* theta; ++ double* phi; ++ T* func; ++ mgcLinInterp2D* pInterp; ++}; ++ ++#include "sphrintp.inl" ++ ++#endif diff --cc simgear/math/sphrintp.inl index 00000000,00000000..cd31122a new file mode 100644 --- /dev/null +++ b/simgear/math/sphrintp.inl @@@ -1,0 -1,0 +1,172 @@@ ++/* ++ WARNING - Do not remove this header. ++ ++ This code is a templated version of the 'magic-software' spherical ++ interpolation code by Dave Eberly. The original (un-hacked) code can be ++ obtained from here: http://www.magic-software.com/gr_appr.htm ++ This code is derived from linintp2.h/cpp and sphrintp.h/cpp. ++ ++ Dave Eberly says that the conditions for use are: ++ ++ * You may distribute the original source code to others at no charge. ++ ++ * You may modify the original source code and distribute it to others at ++ no charge. The modified code must be documented to indicate that it is ++ not part of the original package. ++ ++ * You may use this code for non-commercial purposes. You may also ++ incorporate this code into commercial packages. However, you may not ++ sell any of your source code which contains my original and/or modified ++ source code. In such a case, you need to factor out my code and freely ++ distribute it. ++ ++ * The original code comes with absolutely no warranty and no guarantee is ++ made that the code is bug-free. ++ ++ This does not seem incompatible with GPL - so this modified version ++ is hereby placed under GPL along with the rest of FlightGear. ++ ++ Christian Mayer ++*/ ++ ++#include ++#include "sphrintp.h" ++ ++static const double PI = 4.0*atan(1.0); ++static const double TWOPI = 2.0*PI; ++ ++//--------------------------------------------------------------------------- ++template ++SphereInterpolate::SphereInterpolate (int n, const double* x, ++ const double* y, const double* z, ++ const T* f) ++{ ++ // Assumes (x[i],y[i],z[i]) is unit length for all 0 <= i < n. ++ // For complete spherical coverage, include the two antipodal points ++ // (0,0,1,f(0,0,1)) and (0,0,-1,f(0,0,-1)) in the data set. ++ ++ cout << "Initialising spherical interpolator.\n"; ++ cout << "[ 0%] Allocating memory \r"; ++ ++ theta = new double[3*n]; ++ phi = new double[3*n]; ++ func = new T[3*n]; ++ ++ // convert data to spherical coordinates ++ int i; ++ T empty; ++ ++ for (i = 0; i < n; i++) ++ { ++ GetSphericalCoords(x[i],y[i],z[i],theta[i],phi[i]); ++ func[i] = f[i]; ++ } ++ ++ // use periodicity to get wrap-around in the Delaunay triangulation ++ cout << "[ 10%] copying vertices for wrap-around\r"; ++ int j, k; ++ for (i = 0, j = n, k = 2*n; i < n; i++, j++, k++) ++ { ++ theta[j] = theta[i]+TWOPI; ++ theta[k] = theta[i]-TWOPI; ++ phi[j] = phi[i]; ++ phi[k] = phi[i]; ++ func[j] = func[i]; ++ func[k] = func[i]; ++ } ++ ++ pInterp = new mgcLinInterp2D(3*n,theta,phi,func); ++ ++ cout << "[100%] Finished initialising spherical interpolator. \n"; ++} ++ ++template ++SphereInterpolate::SphereInterpolate (int n, const sgVec2* p, const T* f) ++{ ++ // Assumes (x[i],y[i],z[i]) is unit length for all 0 <= i < n. ++ // For complete spherical coverage, include the two antipodal points ++ // (0,0,1,f(0,0,1)) and (0,0,-1,f(0,0,-1)) in the data set. ++ cout << "Initialising spherical interpolator.\n"; ++ cout << "[ 0%] Allocating memory \r"; ++ ++ theta = new double[3*n]; ++ phi = new double[3*n]; ++ func = new T[3*n]; ++ ++ // convert data to spherical coordinates ++ cout << "[ 10%] copying vertices for wrap-around \r"; ++ ++ int i, j, k; ++ for (i = 0, j = n, k = 2*n; i < n; i++, j++, k++) ++ { ++ phi[i] = p[i][0]; ++ theta[i] = p[i][1]; ++ func[i] = f[i]; ++ ++ // use periodicity to get wrap-around in the Delaunay triangulation ++ phi[j] = phi[i]; ++ phi[k] = phi[i]; ++ theta[j] = theta[i]+TWOPI; ++ theta[k] = theta[i]-TWOPI; ++ func[j] = func[i]; ++ func[k] = func[i]; ++ } ++ ++ pInterp = new mgcLinInterp2D(3*n,theta,phi,func); ++ ++ cout << "[100%] Finished initialising spherical interpolator. \n"; ++} ++//--------------------------------------------------------------------------- ++template ++SphereInterpolate::~SphereInterpolate () ++{ ++ delete pInterp; ++ delete[] theta; ++ delete[] phi; ++ delete[] func; ++} ++//--------------------------------------------------------------------------- ++template ++void SphereInterpolate::GetSphericalCoords (const double x, const double y, const double z, ++ double& thetaAngle, ++ double& phiAngle) const ++{ ++ // Assumes (x,y,z) is unit length. Returns -PI <= thetaAngle <= PI ++ // and 0 <= phiAngle <= PI. ++ ++ if ( z < 1.0f ) ++ { ++ if ( z > -1.0f ) ++ { ++ thetaAngle = atan2(y,x); ++ phiAngle = acos(z); ++ } ++ else ++ { ++ thetaAngle = -PI; ++ phiAngle = PI; ++ } ++ } ++ else ++ { ++ thetaAngle = -PI; ++ phiAngle = 0.0f; ++ } ++} ++//--------------------------------------------------------------------------- ++template ++int SphereInterpolate::Evaluate (const double x, const double y, const double z, T& f) const ++{ ++ // assumes (x,y,z) is unit length ++ ++ double thetaAngle, phiAngle; ++ GetSphericalCoords(x,y,z,thetaAngle,phiAngle); ++ return pInterp->Evaluate(thetaAngle,phiAngle,f); ++} ++//--------------------------------------------------------------------------- ++template ++int SphereInterpolate::Evaluate (const double thetaAngle, const double phiAngle, T& f) const ++{ ++ return pInterp->Evaluate(thetaAngle,phiAngle,f); ++} ++//--------------------------------------------------------------------------- diff --cc simgear/math/vector.cxx index 00000000,00000000..600d391d new file mode 100644 --- /dev/null +++ b/simgear/math/vector.cxx @@@ -1,0 -1,0 +1,179 @@@ ++// vector.cxx -- additional vector routines ++// ++// Written by Curtis Olson, started December 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$ ++ ++ ++#include ++#include ++ ++// #include ++ ++#include "vector.hxx" ++ ++#include "mat3.h" ++ ++ ++// Map a vector onto the plane specified by normal ++void map_vec_onto_cur_surface_plane(MAT3vec normal, MAT3vec v0, MAT3vec vec, ++ MAT3vec result) ++{ ++ MAT3vec u1, v, tmp; ++ ++ // calculate a vector "u1" representing the shortest distance from ++ // the plane specified by normal and v0 to a point specified by ++ // "vec". "u1" represents both the direction and magnitude of ++ // this desired distance. ++ ++ // u1 = ( (normal vec) / (normal normal) ) * normal ++ ++ MAT3_SCALE_VEC( u1, ++ normal, ++ ( MAT3_DOT_PRODUCT(normal, vec) / ++ MAT3_DOT_PRODUCT(normal, normal) ++ ) ++ ); ++ ++ // printf(" vec = %.2f, %.2f, %.2f\n", vec[0], vec[1], vec[2]); ++ // printf(" v0 = %.2f, %.2f, %.2f\n", v0[0], v0[1], v0[2]); ++ // printf(" u1 = %.2f, %.2f, %.2f\n", u1[0], u1[1], u1[2]); ++ ++ // calculate the vector "v" which is the vector "vec" mapped onto ++ // the plane specified by "normal" and "v0". ++ ++ // v = v0 + vec - u1 ++ ++ MAT3_ADD_VEC(tmp, v0, vec); ++ MAT3_SUB_VEC(v, tmp, u1); ++ // printf(" v = %.2f, %.2f, %.2f\n", v[0], v[1], v[2]); ++ ++ // Calculate the vector "result" which is "v" - "v0" which is a ++ // directional vector pointing from v0 towards v ++ ++ // result = v - v0 ++ ++ MAT3_SUB_VEC(result, v, v0); ++ // printf(" result = %.2f, %.2f, %.2f\n", ++ // result[0], result[1], result[2]); ++} ++ ++ ++// Given a point p, and a line through p0 with direction vector d, ++// find the shortest distance from the point to the line ++double fgPointLine(MAT3vec p, MAT3vec p0, MAT3vec d) { ++ MAT3vec u, u1, v; ++ double ud, dd, tmp; ++ ++ // u = p - p0 ++ MAT3_SUB_VEC(u, p, p0); ++ ++ // calculate the projection, u1, of u along d. ++ // u1 = ( dot_prod(u, d) / dot_prod(d, d) ) * d; ++ ud = MAT3_DOT_PRODUCT(u, d); ++ dd = MAT3_DOT_PRODUCT(d, d); ++ tmp = ud / dd; ++ ++ MAT3_SCALE_VEC(u1, d, tmp);; ++ ++ // v = u - u1 = vector from closest point on line, p1, to the ++ // original point, p. ++ MAT3_SUB_VEC(v, u, u1); ++ ++ return sqrt(MAT3_DOT_PRODUCT(v, v)); ++} ++ ++ ++// Given a point p, and a line through p0 with direction vector d, ++// find the shortest distance (squared) from the point to the line ++double fgPointLineSquared(MAT3vec p, MAT3vec p0, MAT3vec d) { ++ MAT3vec u, u1, v; ++ double ud, dd, tmp; ++ ++ // u = p - p0 ++ MAT3_SUB_VEC(u, p, p0); ++ ++ // calculate the projection, u1, of u along d. ++ // u1 = ( dot_prod(u, d) / dot_prod(d, d) ) * d; ++ ud = MAT3_DOT_PRODUCT(u, d); ++ dd = MAT3_DOT_PRODUCT(d, d); ++ tmp = ud / dd; ++ ++ MAT3_SCALE_VEC(u1, d, tmp);; ++ ++ // v = u - u1 = vector from closest point on line, p1, to the ++ // original point, p. ++ MAT3_SUB_VEC(v, u, u1); ++ ++ return ( MAT3_DOT_PRODUCT(v, v) ); ++} ++ ++ ++// Given a point p, and a line through p0 with direction vector d, ++// find the shortest distance (squared) from the point to the line ++double sgPointLineDistSquared( const sgVec3 p, const sgVec3 p0, ++ const sgVec3 d ) { ++ ++ sgVec3 u, u1, v; ++ double ud, dd, tmp; ++ ++ // u = p - p0 ++ sgSubVec3(u, p, p0); ++ ++ // calculate the projection, u1, of u along d. ++ // u1 = ( dot_prod(u, d) / dot_prod(d, d) ) * d; ++ ud = sgScalarProductVec3(u, d); ++ dd = sgScalarProductVec3(d, d); ++ tmp = ud / dd; ++ ++ sgScaleVec3(u1, d, tmp);; ++ ++ // v = u - u1 = vector from closest point on line, p1, to the ++ // original point, p. ++ sgSubVec3(v, u, u1); ++ ++ return ( sgScalarProductVec3(v, v) ); ++} ++ ++ ++// Given a point p, and a line through p0 with direction vector d, ++// find the shortest distance (squared) from the point to the line ++double sgdPointLineDistSquared( const sgdVec3 p, const sgdVec3 p0, ++ const sgdVec3 d ) { ++ ++ sgdVec3 u, u1, v; ++ double ud, dd, tmp; ++ ++ // u = p - p0 ++ sgdSubVec3(u, p, p0); ++ ++ // calculate the projection, u1, of u along d. ++ // u1 = ( dot_prod(u, d) / dot_prod(d, d) ) * d; ++ ud = sgdScalarProductVec3(u, d); ++ dd = sgdScalarProductVec3(d, d); ++ tmp = ud / dd; ++ ++ sgdScaleVec3(u1, d, tmp);; ++ ++ // v = u - u1 = vector from closest point on line, p1, to the ++ // original point, p. ++ sgdSubVec3(v, u, u1); ++ ++ return ( sgdScalarProductVec3(v, v) ); ++} diff --cc simgear/math/vector.hxx index 00000000,00000000..006b1924 new file mode 100644 --- /dev/null +++ b/simgear/math/vector.hxx @@@ -1,0 -1,0 +1,118 @@@ ++// vector.hxx -- additional vector routines ++// ++// Written by Curtis Olson, started December 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$ ++ ++ ++#ifndef _VECTOR_HXX ++#define _VECTOR_HXX ++ ++ ++#ifndef __cplusplus ++# error This library requires C++ ++#endif ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#include ++ ++#include ++ ++#include ++ ++ ++// Map a vector onto the plane specified by normal ++void map_vec_onto_cur_surface_plane( MAT3vec normal, ++ MAT3vec v0, ++ MAT3vec vec, ++ MAT3vec result ); ++ ++ ++inline void sgmap_vec_onto_cur_surface_plane( sgVec3 normal, ++ sgVec3 v0, ++ sgVec3 vec, ++ sgVec3 result ) ++{ ++ sgVec3 u1, v, tmp; ++ ++ // calculate a vector "u1" representing the shortest distance from ++ // the plane specified by normal and v0 to a point specified by ++ // "vec". "u1" represents both the direction and magnitude of ++ // this desired distance. ++ ++ // u1 = ( (normal vec) / (normal normal) ) * normal ++ ++ sgScaleVec3( u1, ++ normal, ++ ( sgScalarProductVec3(normal, vec) / ++ sgScalarProductVec3(normal, normal) ++ ) ++ ); ++ ++ // printf(" vec = %.2f, %.2f, %.2f\n", vec[0], vec[1], vec[2]); ++ // printf(" v0 = %.2f, %.2f, %.2f\n", v0[0], v0[1], v0[2]); ++ // printf(" u1 = %.2f, %.2f, %.2f\n", u1[0], u1[1], u1[2]); ++ ++ // calculate the vector "v" which is the vector "vec" mapped onto ++ // the plane specified by "normal" and "v0". ++ ++ // v = v0 + vec - u1 ++ ++ sgAddVec3(tmp, v0, vec); ++ sgSubVec3(v, tmp, u1); ++ // printf(" v = %.2f, %.2f, %.2f\n", v[0], v[1], v[2]); ++ ++ // Calculate the vector "result" which is "v" - "v0" which is a ++ // directional vector pointing from v0 towards v ++ ++ // result = v - v0 ++ ++ sgSubVec3(result, v, v0); ++ // printf(" result = %.2f, %.2f, %.2f\n", ++ // result[0], result[1], result[2]); ++} ++ ++ ++// Given a point p, and a line through p0 with direction vector d, ++// find the shortest distance from the point to the line ++double fgPointLine(MAT3vec p, MAT3vec p0, MAT3vec d); ++ ++ ++// Given a point p, and a line through p0 with direction vector d, ++// find the shortest distance (squared) from the point to the line ++double fgPointLineSquared(MAT3vec p, MAT3vec p0, MAT3vec d); ++ ++ ++// Given a point p, and a line through p0 with direction vector d, ++// find the shortest distance (squared) from the point to the line ++double sgPointLineDistSquared( const sgVec3 p, const sgVec3 p0, ++ const sgVec3 d ); ++ ++// Given a point p, and a line through p0 with direction vector d, ++// find the shortest distance (squared) from the point to the line ++double sgdPointLineDistSquared( const sgdVec3 p, const sgdVec3 p0, ++ const sgdVec3 d ); ++ ++ ++#endif // _VECTOR_HXX ++ ++ diff --cc simgear/metar/Antoi.cpp index 00000000,00000000..8b471ae5 new file mode 100644 --- /dev/null +++ b/simgear/metar/Antoi.cpp @@@ -1,0 -1,0 +1,73 @@@ ++#pragma comment(compiler) ++#pragma comment(date) ++#pragma comment(timestamp) ++ ++#include ++ ++#pragma title("antoi - char array to integer") ++#pragma pagesize (80) ++ ++#pragma page(1) ++/********************************************************************/ ++/* */ ++/* Title: antoi */ ++/* Date: Jan 28, 1991 */ ++/* Organization: W/OSO242 - Graphics and Display Section */ ++/* Programmer: Allan Darling */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: This function will convert a character array */ ++/* (string) of length (len) into an integer. */ ++/* The integer is created via a call to the */ ++/* function atoi. This function extends the */ ++/* functionality of atoi by removing the */ ++/* requirement for a sentinal delimited string */ ++/* as input. */ ++/* */ ++/* Input: - Pointer to an array of characters. */ ++/* - Integer indicating the number of character to include */ ++/* in the conversion. */ ++/* */ ++/* Output:- An integer corresponding to the value in the character */ ++/* array or MAXNEG (-2147483648) if the function is */ ++/* unable to acquire system storage. */ ++/* */ ++/* Modification History: */ ++/* None */ ++/* */ ++/********************************************************************/ ++ ++int antoi(char * string, int len) ++{ ++ ++ /*******************/ ++ /* local variables */ ++ /*******************/ ++ ++ char * tmpstr; ++ int i, ++ retval; ++ ++ ++ /*****************/ ++ /* function body */ ++ /*****************/ ++ ++ tmpstr = (char *)malloc((len+1) * sizeof(char)); ++ ++ if (tmpstr == NULL) return (-2147483648); ++ ++ for (i = 0; i < len; i++) ++ tmpstr[i] = string[i]; ++ ++ tmpstr[len] = '\0'; ++ ++ retval = atoi(tmpstr); ++ ++ free(tmpstr); ++ ++ return(retval); ++ ++} /* end antoi */ ++ ++#pragma page(1) diff --cc simgear/metar/Charcmp.cpp index 00000000,00000000..a36dc9b9 new file mode 100644 --- /dev/null +++ b/simgear/metar/Charcmp.cpp @@@ -1,0 -1,0 +1,172 @@@ ++#pragma comment (compiler) ++//#pragma comment (date) ++//#pragma comment (timestamp) ++#pragma pagesize(80) ++ ++#include "Local.h" /* standard header file */ ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("charcmp - characters compare with patterns ") ++/********************************************************************/ ++/* */ ++/* Title: charcmp */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 12 Dec 1995 */ ++/* Programmer: CINDY L. CHONG */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: This function will compare each character in the */ ++/* string match with each character in the pattern */ ++/* which is made up of characters. The str can */ ++/* be longer than the pattern. */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: str is a pointer to char */ ++/* pattern is a pointer to char */ ++/* */ ++/* Output: Return true if str matches pattern, */ ++/* otherwise, return false */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++bool charcmp(char *str, char *pattern) ++{ ++ ++ ++ /**********************************************************/ ++ /* Loop while str and pattern is not equal to null, then */ ++ /* inscreases str and pattern by one */ ++ /**********************************************************/ ++ ++ for (; *pattern != '\0'; pattern++) ++ { ++ if (*str == '\0') ++ return FALSE; ++ ++ /************************************************************/ ++ /* If pattern match str, then increase str and jump out the */ ++ /* case and read next char of the str and pattern */ ++ /************************************************************/ ++ ++ if ( isspace(*pattern) ) ++ pattern = nxtalpha(pattern); ++ ++ switch( *pattern ) ++ { ++ case 'c': ++ if ( !isalnum(*str++) ) ++ { ++ return FALSE; ++ } ++ break; ++ ++ case 'a': ++ if ( !isalpha(*str) ) ++ { ++ return FALSE; ++ } ++ str++; ++ break; ++ ++ case 'n': ++ if ( !iscntrl(*str++) ) ++ { ++ return FALSE; ++ } ++ break; ++ ++ case 'd': ++ if ( !isdigit(*str) ) ++ { ++ return FALSE; ++ } ++ str++; ++ break; ++ ++ case 'g': ++ if ( !isgraph(*str++) ) ++ { ++ return FALSE; ++ } ++ break; ++ ++ case 'i': ++ if ( !islower(*str++) ) ++ { ++ return FALSE; ++ } ++ break; ++ ++ case 'p': ++ if ( !isprint(*str++) ) ++ { ++ return FALSE; ++ } ++ break; ++ ++ case 't': ++ if ( !ispunct(*str++) ) ++ { ++ return FALSE; ++ } ++ break; ++ ++ case 'w': ++ if ( !isspace(*str++) ) ++ { ++ return FALSE; ++ } ++ break; ++ ++ case 'u': ++ if ( !isupper(*str++) ) ++ { ++ return FALSE; ++ } ++ break; ++ ++ case 's': ++ if (*str++ != ' ') ++ { ++ return FALSE; ++ } ++ break; ++ ++ case 'm': ++ if ( !isspace(*str) ) ++ { ++ return FALSE; ++ } ++ else ++ { ++ while ( isspace(*str) ) ++ str++; ++ } ++ break; ++ ++ case '\'': ++ pattern++; ++ if (*pattern != *str) ++ { ++ return FALSE; ++ } ++ pattern++; ++ str++; ++ break; ++ ++ default: ++ return FALSE; ++ ++ } /* end switch */ ++ ++ } /* end for */ ++ ++ return (TRUE); ++} diff --cc simgear/metar/Dcdmetar.cpp index 00000000,00000000..73223a00 new file mode 100644 --- /dev/null +++ b/simgear/metar/Dcdmetar.cpp @@@ -1,0 -1,0 +1,2619 @@@ ++#pragma comment (compiler) ++//#pragma comment (date) ++//#pragma comment (timestamp) ++#pragma pagesize(80) ++ ++ ++#include "Local.h" /* standard header file */ ++#include "Metar.h" /* standard header file */ ++ ++float fracPart( char * ); ++void DcdMTRmk( char **, Decoded_METAR * ); ++ ++ ++#pragma page(1) ++#pragma subtitle(" ") ++#pragma subtitle("subtitle - Decode METAR report. ") ++/********************************************************************/ ++/* */ ++/* Title: SaveTokenString */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 14 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: SaveTokenString tokenizes the input character */ ++/* string based upon the delimeter set supplied */ ++/* by the calling routine. The elements tokenized */ ++/* from the input character string are saved in an */ ++/* array of pointers to characters. The address of */ ++/* this array is the output from this function. */ ++/* */ ++/* Input: string - a pointer to a character string. */ ++/* */ ++/* delimeters - a pointer to a string of 1 or more */ ++/* characters that are used for token- */ ++/* izing the input character string. */ ++/* */ ++/* Output: token - the address of a pointer to an array of */ ++/* pointers to character strings. The */ ++/* array of pointers are the addresses of */ ++/* the character strings that are token- */ ++/* ized from the input character string. */ ++/* */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static char **SaveTokenString ( char *string , char *delimeters ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ int NDEX; ++ static char *token[ MAXTOKENS ], ++ *TOKEN; ++ ++ ++ /*********************************/ ++ /* BEGIN THE BODY OF THE ROUTINE */ ++ /*********************************/ ++ ++ /******************************************/ ++ /* TOKENIZE THE INPUT CHARACTER STRING */ ++ /* AND SAVE THE TOKENS TO THE token ARRAY */ ++ /******************************************/ ++ ++ NDEX = 0; ++ TOKEN = strtok( string, delimeters); ++ ++ if( TOKEN == NULL ) ++ return NULL; ++ ++ token[NDEX] = (char *) malloc(sizeof(char)*(strlen(TOKEN)+1)); ++ strcpy( token[ NDEX ], TOKEN ); ++ ++ ++ while ( token[NDEX] != NULL ) ++ { ++ NDEX++; ++ TOKEN = strtok( NULL, delimeters ); ++ ++ if( TOKEN != NULL ) ++ { ++ token[NDEX] = (char *) ++ malloc(sizeof(char)*(strlen(TOKEN)+1)); ++ strcpy( token[NDEX], TOKEN ); ++ } ++ else ++ token[ NDEX ] = TOKEN; ++ ++ } ++ ++ ++ return token; ++ ++} ++#pragma page(1) ++#pragma subtitle(" ") ++#pragma subtitle("subtitle - Decode METAR report. ") ++/********************************************************************/ ++/* */ ++/* Title: freeTokens */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 14 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: freeTokens frees the storage allocated for the */ ++/* character strings stored in the token array. */ ++/* */ ++/* Input: token - the address of a pointer to an array */ ++/* of string tokens. */ ++/* */ ++/* */ ++/* Output: None. */ ++/* */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static void freeTokens( char **token ) ++{ ++ int NDEX; ++ ++ NDEX = 0; ++ while( *(token+NDEX) != NULL ) ++ { ++ free( *(token+NDEX) ); ++ NDEX++; ++ } ++ return; ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: InitDcdMETAR */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: InitDcdMETAR initializes every member of the */ ++/* structure addressed by the pointer Mptr. */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: Mptr - ptr to a decoded_METAR structure. */ ++/* */ ++/* Output: NONE */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static void InitDcdMETAR( Decoded_METAR *Mptr ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ ++ int i, ++ j; ++ ++ ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ memset(Mptr->TS_LOC,'\0',3); ++ memset(Mptr->TS_MOVMNT,'\0',3); ++ ++ ++ memset(Mptr->TornadicType,'\0',15); ++ memset(Mptr->TornadicLOC,'\0',10); ++ memset(Mptr->TornadicDIR,'\0',4); ++ memset(Mptr->TornadicMovDir,'\0',3); ++ Mptr->BTornadicHour = MAXINT; ++ Mptr->BTornadicMinute = MAXINT; ++ Mptr->ETornadicHour = MAXINT; ++ Mptr->ETornadicMinute = MAXINT; ++ Mptr->TornadicDistance = MAXINT; ++ ++ memset( Mptr->autoIndicator,'\0', 5 ); ++ ++ Mptr->RVRNO = FALSE; ++ Mptr->GR = FALSE; ++ Mptr->GR_Size = (float) MAXINT; ++ ++ Mptr->CHINO = FALSE; ++ memset(Mptr->CHINO_LOC, '\0', 6); ++ ++ Mptr->VISNO = FALSE; ++ memset(Mptr->VISNO_LOC, '\0', 6); ++ ++ Mptr->PNO = FALSE; ++ Mptr->PWINO = FALSE; ++ Mptr->FZRANO = FALSE; ++ Mptr->TSNO = FALSE; ++ Mptr->DollarSign = FALSE; ++ Mptr->hourlyPrecip = (float) MAXINT; ++ ++ Mptr->ObscurAloftHgt = MAXINT; ++ memset(Mptr->ObscurAloft, '\0', 12); ++ memset(Mptr->ObscurAloftSkyCond, '\0', 12); ++ ++ memset(Mptr->VrbSkyBelow, '\0', 4); ++ memset(Mptr->VrbSkyAbove, '\0', 4); ++ Mptr->VrbSkyLayerHgt = MAXINT; ++ ++ Mptr->SectorVsby = (float) MAXINT; ++ memset( Mptr->SectorVsby_Dir, '\0', 3); ++ ++ memset(Mptr->codeName, '\0', 6); ++ memset(Mptr->stnid, '\0', 5); ++ Mptr->ob_hour = MAXINT; ++ Mptr->ob_minute = MAXINT; ++ Mptr->ob_date = MAXINT; ++ ++ memset(Mptr->synoptic_cloud_type, '\0', 6); ++ ++ Mptr->CloudLow = '\0'; ++ Mptr->CloudMedium = '\0'; ++ Mptr->CloudHigh = '\0'; ++ ++ memset(Mptr->snow_depth_group, '\0', 6); ++ Mptr->snow_depth = MAXINT; ++ ++ Mptr->Temp_2_tenths = (float) MAXINT; ++ Mptr->DP_Temp_2_tenths = (float) MAXINT; ++ ++ Mptr->OCNL_LTG = FALSE; ++ Mptr->FRQ_LTG = FALSE; ++ Mptr->CNS_LTG = FALSE; ++ Mptr->CG_LTG = FALSE; ++ Mptr->IC_LTG = FALSE; ++ Mptr->CC_LTG = FALSE; ++ Mptr->CA_LTG = FALSE; ++ Mptr->AP_LTG = FALSE; ++ Mptr->OVHD_LTG = FALSE; ++ Mptr->DSNT_LTG = FALSE; ++ Mptr->VcyStn_LTG = FALSE; ++ Mptr->LightningVCTS = FALSE; ++ Mptr->LightningTS = FALSE; ++ ++ memset( Mptr->LTG_DIR, '\0', 3); ++ ++ ++ for( i = 0; i < 3; i++) ++ { ++ memset(Mptr->ReWx[i].Recent_weather, '\0', 5); ++ ++ Mptr->ReWx[i].Bhh = MAXINT; ++ Mptr->ReWx[i].Bmm = MAXINT; ++ ++ Mptr->ReWx[i].Ehh = MAXINT; ++ Mptr->ReWx[i].Emm = MAXINT; ++ ++ } ++ ++ Mptr->NIL_rpt = FALSE; ++ Mptr->AUTO = FALSE; ++ Mptr->COR = FALSE; ++ ++ Mptr->winData.windDir = MAXINT; ++ Mptr->winData.windSpeed = MAXINT; ++ Mptr->winData.windGust = MAXINT; ++ Mptr->winData.windVRB = FALSE; ++ memset(Mptr->winData.windUnits, '\0', 4); ++ ++ Mptr->minWnDir = MAXINT; ++ Mptr->maxWnDir = MAXINT; ++ ++ memset(Mptr->horiz_vsby, '\0', 5); ++ memset(Mptr->dir_min_horiz_vsby, '\0', 3); ++ ++ Mptr->prevail_vsbySM = (float) MAXINT; ++ Mptr->prevail_vsbyM = (float) MAXINT; ++ Mptr->prevail_vsbyKM = (float) MAXINT; ++ ++ memset(Mptr->vsby_Dir, '\0', 3); ++ ++ Mptr->CAVOK = FALSE; ++ ++ for ( i = 0; i < 12; i++ ) ++ { ++ memset(Mptr->RRVR[ i ].runway_designator, ++ '\0', 6); ++ ++ Mptr->RRVR[ i ].visRange = MAXINT; ++ ++ Mptr->RRVR[ i ].vrbl_visRange = FALSE; ++ Mptr->RRVR[ i ].below_min_RVR = FALSE; ++ Mptr->RRVR[ i ].above_max_RVR = FALSE; ++ ++ ++ Mptr->RRVR[ i ].Max_visRange = MAXINT; ++ Mptr->RRVR[ i ].Min_visRange = MAXINT; ++ } ++ ++ Mptr->DVR.visRange = MAXINT; ++ Mptr->DVR.vrbl_visRange = FALSE; ++ Mptr->DVR.below_min_DVR = FALSE; ++ Mptr->DVR.above_max_DVR = FALSE; ++ Mptr->DVR.Max_visRange = MAXINT; ++ Mptr->DVR.Min_visRange = MAXINT; ++ ++ for ( i = 0; i < 5; i++ ) ++ { ++ for( j = 0; j < 8; j++ ) ++ Mptr->WxObstruct[i][j] = '\0'; ++ } ++ ++ /***********************/ ++ /* PARTIAL OBSCURATION */ ++ /***********************/ ++ ++ memset( &(Mptr->PartialObscurationAmt[0][0]), '\0', 7 ); ++ memset( &(Mptr->PartialObscurationPhenom[0][0]), '\0',12); ++ ++ memset( &(Mptr->PartialObscurationAmt[1][0]), '\0', 7 ); ++ memset( &(Mptr->PartialObscurationPhenom[1][0]), '\0',12); ++ ++ ++ /***************************************************/ ++ /* CLOUD TYPE, CLOUD LEVEL, AND SIGNIFICANT CLOUDS */ ++ /***************************************************/ ++ ++ ++ for ( i = 0; i < 6; i++ ) ++ { ++ memset(Mptr->cldTypHgt[ i ].cloud_type, ++ '\0', 5); ++ ++ memset(Mptr->cldTypHgt[ i ].cloud_hgt_char, ++ '\0', 4); ++ ++ Mptr->cldTypHgt[ i ].cloud_hgt_meters = MAXINT; ++ ++ memset(Mptr->cldTypHgt[ i ].other_cld_phenom, ++ '\0', 4); ++ } ++ ++ Mptr->VertVsby = MAXINT; ++ ++ Mptr->temp = MAXINT; ++ Mptr->dew_pt_temp = MAXINT; ++ Mptr->QFE = MAXINT; ++ ++ Mptr->SLPNO = FALSE; ++ Mptr->SLP = (float) MAXINT; ++ ++ Mptr->A_altstng = FALSE; ++ Mptr->inches_altstng = (double) MAXINT; ++ ++ Mptr->Q_altstng = FALSE; ++ Mptr->hectoPasc_altstng = MAXINT; ++ ++ Mptr->char_prestndcy = MAXINT; ++ Mptr->prestndcy = (float) MAXINT; ++ ++ Mptr->precip_amt = (float) MAXINT; ++ ++ Mptr->precip_24_amt = (float) MAXINT; ++ Mptr->maxtemp = (float) MAXINT; ++ Mptr->mintemp = (float) MAXINT; ++ Mptr->max24temp = (float) MAXINT; ++ Mptr->min24temp = (float) MAXINT; ++ ++ Mptr->VIRGA = FALSE; ++ memset( Mptr->VIRGA_DIR, '\0', 3 ); ++ ++ Mptr->VOLCASH = FALSE; ++ ++ Mptr->minCeiling = MAXINT; ++ Mptr->maxCeiling = MAXINT; ++ ++ Mptr->CIG_2ndSite_Meters = MAXINT; ++ memset(Mptr->CIG_2ndSite_LOC, '\0', 10 ); ++ ++ Mptr->minVsby = (float) MAXINT; ++ Mptr->maxVsby = (float) MAXINT; ++ Mptr->VSBY_2ndSite = (float) MAXINT; ++ memset(Mptr->VSBY_2ndSite_LOC,'\0',10); ++ ++ for( i = 0; i < 6; i++ ) ++ memset (&(Mptr->SfcObscuration[i][0]), '\0', 10); ++ ++ Mptr->Num8thsSkyObscured = MAXINT; ++ ++ Mptr->Indeterminant3_6HrPrecip = FALSE; ++ Mptr->CIGNO = FALSE; ++ Mptr->Ceiling = MAXINT; ++ Mptr->Estimated_Ceiling = MAXINT; ++ ++ Mptr->NOSPECI = FALSE; ++ Mptr->LAST = FALSE; ++ ++ Mptr->SNINCR = MAXINT; ++ Mptr->SNINCR_TotalDepth = MAXINT; ++ ++ Mptr->WaterEquivSnow = (float) MAXINT; ++ ++ Mptr->SunshineDur = MAXINT; ++ Mptr->SunSensorOut = FALSE; ++ ++ ++ Mptr->WshfTime_hour = MAXINT; ++ Mptr->WshfTime_minute = MAXINT; ++ Mptr->Wshft_FROPA = FALSE; ++ Mptr->min_vrbl_wind_dir = MAXINT; ++ Mptr->max_vrbl_wind_dir = MAXINT; ++ ++ Mptr->PRESRR = FALSE; ++ Mptr->PRESFR = FALSE; ++ ++ Mptr->TWR_VSBY = (float) MAXINT; ++ Mptr->SFC_VSBY = (float) MAXINT; ++ ++ Mptr->PKWND_dir = MAXINT; ++ Mptr->PKWND_speed = MAXINT; ++ Mptr->PKWND_hour = MAXINT; ++ Mptr->PKWND_minute = MAXINT; ++ ++ return; ++ ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: ResetMETARGroup */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: ResetMETARGroup returns a METAR_obGroup enumerated */ ++/* variable that indicates which METAR reporting group */ ++/* might next appear in the METAR report and should be */ ++/* considered for decoding. */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: StartGroup - a METAR_obGroup variable that */ ++/* indicates where or on what group */ ++/* METAR Decoding began. */ ++/* */ ++/* SaveStartGroup - a METAR_obGroup variable that */ ++/* indicates the reporting group */ ++/* in the METAR report that was */ ++/* successfully decoded. */ ++/* */ ++/* Output: A METAR_obGroup variable that indicates which */ ++/* reporting group in the METAR report should next */ ++/* be considered for decoding */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static int ResetMETARGroup( int StartGroup, ++ int SaveStartGroup ) ++{ ++ ++ enum METAR_obGroup { codename, stnid, NIL1, COR1, obDateTime, NIL2, ++ AUTO, COR, windData, MinMaxWinDir, ++ CAVOK, visibility, ++ RVR, presentWX, skyCond, tempGroup, ++ altimStng, NotIDed = 99}; ++ ++ if( StartGroup == NotIDed && SaveStartGroup == NotIDed ) ++ return NotIDed; ++ else if( StartGroup == NotIDed && SaveStartGroup != NotIDed && ++ SaveStartGroup != altimStng ) ++ return (++SaveStartGroup); ++ else ++ return (++SaveStartGroup); ++ ++} ++ ++#pragma page(1) ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: CodedHgt2Meters */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: CodedHgt2Meters converts a coded cloud height into */ ++/* meters. */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: token - a pointer to a METAR report group. */ ++/* Mptr - a pointer to a decoded_METAR structure. */ ++/* */ ++/* Output: Cloud height in meters */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static int CodedHgt2Meters( char *token, Decoded_METAR *Mptr ) ++{ ++ int hgt; ++ static int maxhgt = 30000; ++ ++ ++ if( (hgt = atoi(token)) == 999 ) ++ return maxhgt; ++ else ++ return (hgt*30); ++} ++ ++#pragma page(1) ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isPartObscur */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: isPartObscur determines whether or not the METAR */ ++/* report element that is passed to it is or is not */ ++/* a partial obscuration indicator for an amount of */ ++/* obscuration. */ ++/* */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: token - the address of a pointer to the group */ ++/* in the METAR report that isPartObscur */ ++/* determines is or is not a partial */ ++/* obscuration indicator. */ ++/* */ ++/* */ ++/* Mptr - a pointer to a decoded_METAR structure. */ ++/* */ ++/* Output: TRUE, if the group is a partial obscuration */ ++/* indicator and FALSE, if it is not. */ ++/* */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isPartObscur( char **string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp( *string, "FEW///" ) == 0 || ++ strcmp( *string, "SCT///" ) == 0 || ++ strcmp( *string, "BKN///" ) == 0 || ++ strcmp( *string, "FEW000" ) == 0 || ++ strcmp( *string, "SCT000" ) == 0 || ++ strcmp( *string, "BKN000" ) == 0 ) { ++ strcpy( &(Mptr->PartialObscurationAmt[0][0]), *string ); ++ (*NDEX)++; ++ string++; ++ ++ if( *string == NULL ) ++ return TRUE; ++ ++ if( strcmp( (*string+3), "///") ) { ++ if( strcmp( *string, "FEW000" ) == 0 || ++ strcmp( *string, "SCT000" ) == 0 || ++ strcmp( *string, "BKN000" ) == 0 ) { ++ strcpy( &(Mptr->PartialObscurationAmt[1][0]), *string ); ++ (*NDEX)++; ++ } ++ } ++ else { ++ if( strcmp( *string, "FEW///" ) == 0 || ++ strcmp( *string, "SCT///" ) == 0 || ++ strcmp( *string, "BKN///" ) == 0 ) { ++ strcpy( &(Mptr->PartialObscurationAmt[1][0]), *string ); ++ (*NDEX)++; ++ } ++ } ++ return TRUE; ++ } ++ else ++ return FALSE; ++} ++ ++#pragma page(1) ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isCldLayer */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: isCldLayer determines whether or not the */ ++/* current group has a valid cloud layer */ ++/* identifier. */ ++/* */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: token - pointer to a METAR report group. */ ++/* */ ++/* Output: TRUE, if the report group is a valid cloud */ ++/* layer indicator. */ ++/* */ ++/* FALSE, if the report group is not a valid cloud */ ++/* layer indicator. */ ++/* */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isCldLayer( char *token ) ++{ ++ if( token == NULL ) ++ return FALSE; ++ ++ if( strlen(token) < 6 ) ++ return FALSE; ++ else ++ return ((strncmp(token,"OVC",3) == 0 || ++ strncmp(token,"SCT",3) == 0 || ++ strncmp(token,"FEW",3) == 0 || ++ strncmp(token,"BKN",3) == 0 || ++ (isdigit(*token) && ++ strncmp(token+1,"CU",2) == 0) || ++ (isdigit(*token) && ++ strncmp(token+1,"SC",2) == 0) ) && ++ nisdigit((token+3),3)) ? TRUE:FALSE; ++} ++ ++#pragma page(1) ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isCAVOK */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 09 May 1996 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: isCAVOK determines whether or not the current */ ++/* group is a valid CAVOK indicator. */ ++/* */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: token - pointer to a METAR report group. */ ++/* */ ++/* Output: TRUE, if the input group is a valid CAVOK */ ++/* indicator. FALSE, otherwise. */ ++/* */ ++/* */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isCAVOK( char *token, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ ++ if( token == NULL ) ++ return FALSE; ++ ++ if( strcmp(token, "CAVOK") != 0 ) ++ return FALSE; ++ else { ++ (*NDEX)++; ++ Mptr->CAVOK = TRUE; ++ return TRUE; ++ } ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: parseCldData */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static void parseCldData( char *token, Decoded_METAR *Mptr, int next) ++{ ++ ++ ++ if( token == NULL ) ++ return; ++ ++ if( strlen(token) > 6 ) ++ strncpy(Mptr->cldTypHgt[next].other_cld_phenom,token+6, ++ (strlen(token)-6)); ++ ++ strncpy(Mptr->cldTypHgt[next].cloud_type,token,3); ++ ++ strncpy(Mptr->cldTypHgt[next].cloud_hgt_char,token+3,3); ++ ++ Mptr->cldTypHgt[next].cloud_hgt_meters = ++ CodedHgt2Meters( token+3, Mptr ); ++ ++ return; ++} ++ ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isSkyCond */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isSkyCond( char **skycond, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ bool first_layer, ++ second_layer, ++ third_layer, ++ fourth_layer, ++ fifth_layer, ++ sixth_layer; ++ int next; ++ ++ /********************************************************/ ++ /* INTERROGATE skycond TO DETERMINE IF "CLR" IS PRESENT */ ++ /********************************************************/ ++ ++ if( *skycond == NULL ) ++ return FALSE; ++ ++ ++ if( strcmp(*skycond,"CLR") == 0) ++ { ++ strcpy(Mptr->cldTypHgt[0].cloud_type,"CLR"); ++/* ++ memset(Mptr->cldTypHgt[0].cloud_hgt_char,'\0',1); ++ memset(Mptr->cldTypHgt[0].other_cld_phenom, ++ '\0', 1); ++*/ ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ /********************************************************/ ++ /* INTERROGATE skycond TO DETERMINE IF "SKC" IS PRESENT */ ++ /********************************************************/ ++ ++ else if( strcmp(*skycond,"SKC") == 0) ++ { ++ strcpy(Mptr->cldTypHgt[0].cloud_type,"SKC"); ++/* ++ memset(Mptr->cldTypHgt[0].cloud_hgt_char,'\0',1); ++ memset(Mptr->cldTypHgt[0].other_cld_phenom, ++ '\0', 1); ++*/ ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ /****************************************/ ++ /* INTERROGATE skycond TO DETERMINE IF */ ++ /* VERTICAL VISIBILITY IS PRESENT */ ++ /****************************************/ ++ ++ else if( strncmp(*skycond,"VV",2) == 0 ++ && strlen(*skycond) == 5 && ++ nisdigit((*skycond+2),3) ) ++ { ++ Mptr->VertVsby = CodedHgt2Meters( (*skycond+2), Mptr); ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ /****************************************/ ++ /* INTERROGATE skycond TO DETERMINE IF */ ++ /* CLOUD LAYER DATA IS PRESENT */ ++ /****************************************/ ++ ++ else if( isCldLayer( *skycond )) ++ { ++ next = 0; ++ ++ parseCldData( *skycond , Mptr, next ); ++ first_layer = TRUE; ++ next++; ++ (++skycond); ++ ++ if( *skycond == NULL ) ++ return TRUE; ++ ++ second_layer = FALSE; ++ third_layer = FALSE; ++ fourth_layer = FALSE; ++ fifth_layer = FALSE; ++ sixth_layer = FALSE; ++ ++ ++ if( isCldLayer( *skycond ) && first_layer ) ++ { ++ parseCldData( *skycond, Mptr, next ); ++ second_layer = TRUE; ++ next++; ++ (++skycond); ++ ++ if( *skycond == NULL ) ++ return TRUE; ++ ++ } ++ ++ if( isCldLayer( *skycond ) && first_layer && ++ second_layer ) ++ { ++ parseCldData( *skycond , Mptr, next ); ++ third_layer = TRUE; ++ next++; ++ (++skycond); ++ ++ if( *skycond == NULL ) ++ return TRUE; ++ ++ } ++ ++ if( isCldLayer( *skycond ) && first_layer && second_layer && ++ third_layer ) ++ { ++ parseCldData( *skycond, Mptr, next ); ++ fourth_layer = TRUE; ++ next++; ++ (++skycond); ++ ++ if( *skycond == NULL ) ++ return TRUE; ++ ++ } ++ ++ if( isCldLayer( *skycond ) && first_layer && second_layer && ++ third_layer && fourth_layer ) ++ { ++ parseCldData( *skycond , Mptr, next ); ++ fifth_layer = TRUE; ++ next++; ++ (++skycond); ++ ++ if( *skycond == NULL ) ++ return TRUE; ++ ++ } ++ ++ if( isCldLayer( *skycond ) && first_layer && second_layer && ++ third_layer && fourth_layer && fifth_layer ) ++ { ++ parseCldData( *skycond , Mptr, next ); ++ sixth_layer = TRUE; ++ } ++ ++ ++ ++ if( sixth_layer ) ++ { ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( fifth_layer ) ++ { ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( fourth_layer ) ++ { ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( third_layer ) ++ { ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( second_layer ) ++ { ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( first_layer ) ++ { ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ ++ } ++ else ++ return FALSE; ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: prevailVSBY */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static float prevailVSBY( char *visibility ) ++{ ++ float Miles_vsby; ++ char *temp, ++ *Slash_ptr, ++ *SM_KM_ptr; ++ char numerator[3], ++ denominator[3]; ++ ++ ++ if( (SM_KM_ptr = strstr( visibility, "SM" )) == NULL ) ++ SM_KM_ptr = strstr(visibility, "KM"); ++ ++ Slash_ptr = strchr( visibility, '/' ); ++ ++ if( Slash_ptr == NULL ) ++ { ++ temp = (char *) malloc(sizeof(char) * ++ ((SM_KM_ptr - visibility)+1)); ++ memset( temp, '\0', (SM_KM_ptr-visibility)+1); ++ strncpy( temp, visibility, (SM_KM_ptr-visibility) ); ++ Miles_vsby = (float) (atoi(temp)); ++ free( temp ); ++ return Miles_vsby; ++ } ++ else ++ { ++ memset(numerator, '\0', 3); ++ memset(denominator, '\0', 3); ++ ++ strncpy(numerator, visibility, (Slash_ptr - visibility)); ++ ++/*>>>>>>>>>>>>>>>>>>>>>> ++ if( (SM_KM_ptr - (Slash_ptr+1)) == 0 ) ++ strcpy(denominator, "4"); ++ else ++<<<<<<<<<<<<<<<<<<<<<<*/ ++ ++ strncpy(denominator, ++ Slash_ptr+1, (SM_KM_ptr - Slash_ptr)); ++ ++ return ( ((float)(atoi(numerator)))/ ++ ((float)(atoi(denominator))) ); ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isVisibility */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++ ++#pragma page(1) ++ ++static bool isVisibility( char **visblty, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ char *achar, ++ *astring, ++ *save_token; ++ ++ ++ /****************************************/ ++ /* CHECK FOR VISIBILITY MEASURED <1/4SM */ ++ /****************************************/ ++ ++ if( *visblty == NULL ) ++ return FALSE; ++ ++ ++ if( strcmp(*visblty,"M1/4SM") == 0 || ++ strcmp(*visblty,"<1/4SM") == 0 ) { ++ Mptr->prevail_vsbySM = 0.0; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ /***********************************************/ ++ /* CHECK FOR VISIBILITY MEASURED IN KILOMETERS */ ++ /***********************************************/ ++ ++ if( (achar = strstr(*visblty, "KM")) != NULL ) ++ { ++ if( nisdigit(*visblty,(achar - *visblty)) && ++ (achar - *visblty) > 0 ) ++ { ++ Mptr->prevail_vsbyKM = prevailVSBY( *visblty ); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ ++ /***********************************/ ++ /* CHECK FOR VISIBILITY MEASURED */ ++ /* IN A FRACTION OF A STATUTE MILE */ ++ /***********************************/ ++ ++ else if( (achar = strchr( *visblty, '/' )) != ++ NULL && ++ (astring = strstr( *visblty, "SM")) != NULL ) ++ { ++ if( nisdigit(*visblty,(achar - *visblty)) ++ && ++ (achar - *visblty) > 0 && ++ (astring - (achar+1)) > 0 && ++ nisdigit(achar+1, (astring - (achar+1))) ) ++ { ++ Mptr->prevail_vsbySM = prevailVSBY (*visblty); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ ++ /***********************************/ ++ /* CHECK FOR VISIBILITY MEASURED */ ++ /* IN WHOLE STATUTE MILES */ ++ /***********************************/ ++ ++ else if( (astring = strstr(*visblty,"SM") ) != NULL ) ++ { ++ if( nisdigit(*visblty,(astring - *visblty)) && ++ (astring- *visblty) > 0 ) ++ { ++ Mptr->prevail_vsbySM = prevailVSBY (*visblty); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ ++ /***********************************/ ++ /* CHECK FOR VISIBILITY MEASURED */ ++ /* IN WHOLE AND FRACTIONAL STATUTE */ ++ /* MILES */ ++ /***********************************/ ++ ++ else if( nisdigit( *visblty, ++ strlen(*visblty)) && ++ strlen(*visblty) < 4 ) ++ { ++ save_token = (char *) malloc(sizeof(char)* ++ (strlen(*visblty)+1)); ++ strcpy(save_token,*visblty); ++ if( *(++visblty) == NULL) ++ { ++ free( save_token ); ++ return FALSE; ++ } ++ ++ if( (achar = strchr( *visblty, '/' ) ) != NULL && ++ (astring = strstr( *visblty, "SM") ) != NULL ) ++ { ++ if( nisdigit(*visblty, ++ (achar - *visblty)) && ++ (achar - *visblty) > 0 && ++ (astring - (achar+1)) > 0 && ++ nisdigit(achar+1, (astring - (achar+1))) ) ++ { ++ Mptr->prevail_vsbySM = prevailVSBY (*visblty); ++ Mptr->prevail_vsbySM += ++ (float) (atoi(save_token)); ++ free( save_token); ++ ++ (*NDEX)++; ++ (*NDEX)++; ++ ++ return TRUE; ++ ++ } ++ else ++ return FALSE; ++ } ++ else ++ return FALSE; ++ ++ } ++ ++ /***********************************/ ++ /* CHECK FOR VISIBILITY MEASURED */ ++ /* IN METERS WITH OR WITHOUT DI- */ ++ /* RECTION OF OBSERVATION */ ++ /***********************************/ ++ ++ else if( nisdigit(*visblty,4) && ++ strlen(*visblty) >= 4) ++ { ++ if( strcmp(*visblty+4,"NE") == 0 ) ++ { ++ memset(Mptr->vsby_Dir,'\0',3); ++ strcpy(Mptr->vsby_Dir,*visblty+4); ++ } ++ if( strcmp(*visblty+4,"NW") == 0 ) ++ { ++ memset(Mptr->vsby_Dir,'\0',3); ++ strcpy(Mptr->vsby_Dir,*visblty+4); ++ } ++ if( strcmp(*visblty+4,"SE") == 0 ) ++ { ++ memset(Mptr->vsby_Dir,'\0',3); ++ strcpy(Mptr->vsby_Dir,*visblty+4); ++ } ++ if( strcmp(*visblty+4,"SW") == 0 ) ++ { ++ memset(Mptr->vsby_Dir,'\0',3); ++ strcpy(Mptr->vsby_Dir,*visblty+4); ++ } ++ if( strcmp(*visblty+4,"N") == 0 ) ++ { ++ memset(Mptr->vsby_Dir,'\0',3); ++ strcpy(Mptr->vsby_Dir,*visblty+4); ++ } ++ if( strcmp(*visblty+4,"S") == 0 ) ++ { ++ memset(Mptr->vsby_Dir,'\0',3); ++ strcpy(Mptr->vsby_Dir,*visblty+4); ++ } ++ if( strcmp(*visblty+4,"E") == 0 ) ++ { ++ memset(Mptr->vsby_Dir,'\0',3); ++ strcpy(Mptr->vsby_Dir,*visblty+4); ++ } ++ if( strcmp(*visblty+4,"W") == 0 ) ++ { ++ memset(Mptr->vsby_Dir,'\0',3); ++ strcpy(Mptr->vsby_Dir,*visblty+4); ++ } ++ ++ if( antoi(*visblty, ++ strlen(*visblty)) >= 50 && ++ antoi(*visblty, ++ strlen(*visblty)) <= 500 && ++ (antoi(*visblty, ++ strlen(*visblty)) % 50) == 0 ) ++ { ++ Mptr->prevail_vsbyM = ++ (float) (antoi(*visblty, ++ strlen(*visblty))); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( antoi(*visblty, ++ strlen(*visblty)) >= 500 && ++ antoi(*visblty, ++ strlen(*visblty)) <= 3000 && ++ (antoi(*visblty, ++ strlen(*visblty)) % 100) == 0 ) ++ { ++ Mptr->prevail_vsbyM = ++ (float) (antoi(*visblty, ++ strlen(*visblty))); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( antoi(*visblty, ++ strlen(*visblty)) >= 3000 && ++ antoi(*visblty, ++ strlen(*visblty)) <= 5000 && ++ (antoi(*visblty, ++ strlen(*visblty)) % 500) == 0 ) ++ { ++ Mptr->prevail_vsbyM = ++ (float) (antoi(*visblty, ++ strlen(*visblty))); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( antoi(*visblty, ++ strlen(*visblty)) >= 5000 && ++ antoi(*visblty, ++ strlen(*visblty)) <= 9999 && ++ (antoi(*visblty, ++ strlen(*visblty)) % 500) == 0 || ++ antoi(*visblty, ++ strlen(*visblty)) == 9999 ) ++ { ++ Mptr->prevail_vsbyM = ++ (float) (antoi(*visblty, ++ strlen(*visblty))); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ ++ } ++ else ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: vrblVsby */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool vrblVsby( char *string1, char *string2, ++ Decoded_METAR *Mptr, int *NDEX ) ++{ ++ char buf[ 6 ]; ++ int numerator, ++ denominator; ++ char *slash, ++ *V_char, ++ *temp; ++ ++ if( string1 == NULL ) ++ return FALSE; ++ ++ V_char = strchr(string1,'V'); ++ slash = strchr(string1,'/'); ++ ++ if(slash == NULL) ++ { ++ if(nisdigit(string1,V_char-string1)) ++ { ++ memset(buf, '\0', 6); ++ strncpy(buf, string1, V_char-string1); ++ ++ if( Mptr->minVsby != (float) MAXINT ) ++ Mptr->minVsby += (float) atoi(buf); ++ else ++ Mptr->minVsby = (float) atoi(buf); ++ ++ memset(buf, '\0', 6); ++ strncpy(buf, V_char+1, 5); ++ Mptr->maxVsby = (float) atoi(buf); ++ ++ } ++ else ++ return FALSE; ++ } ++ else ++ { ++ temp = (char *) malloc(sizeof(char)*((V_char-string1)+1)); ++ memset(temp, '\0', (V_char-string1) +1); ++ strncpy(temp, string1, V_char-string1); ++ if( Mptr->minVsby != MAXINT ) ++ Mptr->minVsby += fracPart(temp); ++ else ++ Mptr->minVsby = fracPart(temp); ++ ++ free( temp ); ++ ++ if( strchr(V_char+1,'/') != NULL) ++ Mptr->maxVsby = fracPart(V_char+1); ++ else ++ Mptr->maxVsby = (float) atoi(V_char+1); ++ } ++ ++ if( string2 == NULL ) ++ return TRUE; ++ else ++ { ++ slash = strchr( string2, '/' ); ++ ++ if( slash == NULL ) ++ return TRUE; ++ else ++ { ++ if( nisdigit(string2,slash-string2) && ++ nisdigit(slash+1,strlen(slash+1)) ) ++ { ++ Mptr->maxVsby += fracPart(string2); ++ (*NDEX)++; ++ } ++ return TRUE; ++ } ++ } ++ ++} ++ ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isMinMaxWinDir */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isMinMaxWinDir( char *string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++#define buf_len 50 ++ char buf[ buf_len ]; ++ char *V_char; ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( (V_char = strchr(string,'V')) == NULL ) ++ return FALSE; ++ else ++ { ++ if( nisdigit(string,(V_char - string)) && ++ nisdigit(V_char+1,3) ) ++ { ++ memset( buf, '\0', buf_len); ++ strncpy( buf, string, V_char - string); ++ Mptr->minWnDir = atoi( buf ); ++ ++ memset( buf, '\0', buf_len); ++ strcpy( buf, V_char+1 ); ++ Mptr->maxWnDir = atoi( buf ); ++ ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isRVR */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isRVR( char *token, Decoded_METAR *Mptr, int *NDEX, ++ int ndex ) ++{ ++ char *slashPtr, *FT_ptr; ++ char *vPtr; ++ int length; ++ ++ if( token == NULL ) ++ return FALSE; ++ ++ if( *token != 'R' || (length = strlen(token)) < 7 || ++ (slashPtr = strchr(token,'/')) == NULL || ++ nisdigit(token+1,2) == FALSE ) ++ return FALSE; ++ ++ if( (slashPtr - (token+3)) > 0 ) ++ if( !nisalpha(token+3,(slashPtr - (token+3))) ) ++ return FALSE; ++ ++ if( strcmp(token+(strlen(token)-2),"FT") != 0 ) ++ return FALSE; ++ else ++ FT_ptr = token + (strlen(token)-2); ++ ++ if( strchr(slashPtr+1, 'P' ) != NULL ) ++ Mptr->RRVR[ndex].above_max_RVR = TRUE; ++ ++ if( strchr(slashPtr+1, 'M' ) != NULL ) ++ Mptr->RRVR[ndex].below_min_RVR = TRUE; ++ ++ ++ strncpy(Mptr->RRVR[ndex].runway_designator, token+1, ++ (slashPtr-(token+1))); ++ ++ if( (vPtr = strchr(slashPtr, 'V' )) != NULL ) ++ { ++ Mptr->RRVR[ndex].vrbl_visRange = TRUE; ++ Mptr->RRVR[ndex].Min_visRange = antoi(slashPtr+1, ++ (vPtr-(slashPtr+1)) ); ++ Mptr->RRVR[ndex].Max_visRange = antoi(vPtr+1, ++ (FT_ptr - (vPtr+1)) ); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ { ++ if( Mptr->RRVR[ndex].below_min_RVR || ++ Mptr->RRVR[ndex].above_max_RVR ) ++ Mptr->RRVR[ndex].visRange = antoi(slashPtr+2, ++ (FT_ptr - (slashPtr+2)) ); ++ else ++ Mptr->RRVR[ndex].visRange = antoi(slashPtr+1, ++ (FT_ptr - (slashPtr+1)) ); ++ ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++} ++ ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isAltimStng */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isAltimStng( char *token, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ char dummy[6]; ++ ++ ++ if( token == NULL ) ++ return FALSE; ++ ++ if( strlen(token) < 5 ) ++ return FALSE; ++ else ++ { ++ Mptr->A_altstng = FALSE; ++ Mptr->Q_altstng = FALSE; ++ ++ if( (*token == 'A' || *token == 'Q') && ++ (nisdigit(token+1, strlen(token)-1) || ++ nisdigit(token+1,strlen(token)-3)) ) ++ { ++ if( *token == 'A' ) ++ { ++ Mptr->A_altstng = TRUE; ++ Mptr->inches_altstng = atof(token+1) * 0.01; ++ } ++ else ++ { ++ Mptr->Q_altstng = TRUE; ++ ++ if( strchr(token,'.') != NULL) ++ { ++ memset(dummy, '\0', 6); ++ strncpy(dummy,token+1,4); ++ Mptr->hectoPasc_altstng = atoi(dummy); ++ } ++ else ++ Mptr->hectoPasc_altstng = atoi(token+1); ++ } ++ ++ (*NDEX)++; ++ return TRUE; ++ ++ } ++ return FALSE; ++ } ++} ++ ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isTempGroup */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isTempGroup( char *token, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ char *slash; ++ ++ if( token == NULL ) ++ return FALSE; ++ ++ if( (slash = strchr(token,'/')) == NULL) ++ return FALSE; ++ else ++ { ++ if( charcmp(token,"aa'/'dd") ) { ++ Mptr->dew_pt_temp = atoi(slash+1); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( charcmp(token,"aa'/''M'dd") ) { ++ Mptr->dew_pt_temp = atoi(slash+2) * -1; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( charcmp(token,"dd'/'aa") ) { ++ Mptr->temp = antoi(token,(slash-token)); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( charcmp(token,"'M'dd'/'aa") ) { ++ Mptr->temp = antoi(token+1,(slash-(token+1))) * -1; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( nisdigit(token,(slash-token)) && ++ nisdigit(slash+1,strlen(slash+1)) ) ++ { ++ Mptr->temp = antoi(token,(slash-token)); ++ Mptr->dew_pt_temp = atoi(slash+1); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( *token == 'M' && nisdigit(token+1,(slash-(token+1))) ++ && *(slash+1) != '\0' && ++ *(slash+1) == 'M' && nisdigit(slash+2,strlen(slash+2)) ) ++ { ++ Mptr->temp = antoi(token+1,(slash-(token+1))) * -1; ++ Mptr->dew_pt_temp = atoi(slash+2) * -1; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( *token == 'M' && nisdigit(token+1,(slash-(token+1))) ++ && *(slash+1) != '\0' && ++ nisdigit(slash+1,strlen(slash+1)) ) ++ { ++ Mptr->temp = antoi(token+1,(slash-(token+1))) * -1; ++ Mptr->dew_pt_temp = atoi(slash+1); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( nisdigit(token,(slash - token)) && ++ *(slash+1) != '\0' && ++ nisdigit(slash+2,strlen(slash+2)) ) ++ { ++ Mptr->temp = antoi(token,(slash-token)); ++ Mptr->dew_pt_temp = atoi(slash+2) * -1; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( nisdigit(token,(slash-token)) && ++ strlen(token) <= 3) ++ { ++ Mptr->temp = antoi(token,(slash-token)); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( *token == 'M' && ++ nisdigit(token+1,(slash-(token+1))) && ++ strlen(token) <= 4) ++ { ++ Mptr->temp = antoi(token+1,(slash-(token+1))) * -1; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ ++} ++ ++ ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isWxToken */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isWxToken( char *token ) ++{ ++ int i; ++ ++ if( token == NULL ) ++ return FALSE; ++ for( i = 0; i < strlen(token); i++ ) ++ { ++ if( !(isalpha(*(token+i)) || *(token+i) == '+' || ++ *(token+i) == '-' ) ) ++ return FALSE; ++ } ++ return TRUE; ++} ++ ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isPresentWX */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isPresentWX( char *token, Decoded_METAR *Mptr, ++ int *NDEX, int *next ) ++{ ++/* ++ static char *WxSymbols[] = {"BCFG", "BLDU", "BLSA", "BLPY", ++ "DRDU", "DRSA", "DRSN", "DZ", "DS", "FZFG", "FZDZ", "FZRA", ++ "FG", "FC", "FU", "GS", "GR", "HZ", "IC", "MIFG", ++ "PE", "PO", "RA", "SHRA", "SHSN", "SHPE", "SHGS", ++ "SHGR", "SN", "SG", "SQ", "SA", "SS", "TSRA", ++ "TSSN", "TSPE", "TSGS", "TSGR", "TS", "VA", "VCFG", "VCFC", ++ "VCSH", "VCPO", "VCBLDU", "VCBLSA", "VCBLSN", NULL}; ++*/ ++ static char *WxSymbols[] = {"BCFG", "BLDU", "BLSA", "BLPY", ++ "BR", "FZBR", "VCBR", ++ "DRDU", "DRSA", "DRSN", "DZ", "DS", "FZFG", "FZDZ", "FZRA", ++ "FG", "FC", "FU", "GS", "GR", "HZ", "IC", "MIFG", ++ "PE", "PO", "RA", "SHRA", "SHSN", "SHPE", "SHGS", ++ "SHGR", "SN", "SG", "SQ", "SA", "SS", "TS", ++ "VA", "VCFG", "VCFC", ++ "VCSH", "VCPO", "VCBLDU", "VCBLSA", "VCBLSN", NULL}; ++ int i; ++ char *ptr, ++ *temp_token, ++ *save_token, ++ *temp_token_orig; ++ ++ if( token == NULL) ++ return FALSE; ++ ++ temp_token_orig = temp_token = ++ (char *) malloc(sizeof(char)*(strlen(token)+1)); ++ strcpy(temp_token, token); ++ while( temp_token != NULL && (*next) < MAXWXSYMBOLS ) ++ { ++ i = 0; ++ save_token = NULL; ++ ++ if( *temp_token == '+' || *temp_token == '-' ) ++ { ++ save_token = temp_token; ++ temp_token++; ++ } ++ ++ while( WxSymbols[i] != NULL ) ++ if( strncmp(temp_token, WxSymbols[i], ++ strlen(WxSymbols[i])) != 0 ) ++ i++; ++ else ++ break; ++ ++ if( WxSymbols[i] == NULL ) { ++ free( temp_token_orig ); ++ return FALSE; ++ } ++ else ++ { ++ ++ if( save_token != NULL ) ++ { ++ strncpy( Mptr->WxObstruct[*next], save_token, 1); ++ strcpy( (Mptr->WxObstruct[*next])+1, ++ WxSymbols[i]); ++ (*next)++; ++ } ++ else ++ { ++ strcpy( Mptr->WxObstruct[*next], WxSymbols[i]); ++ (*next)++; ++ } ++ ++ ++ if( strcmp(temp_token, WxSymbols[i]) != 0) ++ { ++ ptr = strstr(temp_token, WxSymbols[i]); ++ temp_token = ptr + strlen(WxSymbols[i]); ++ } ++ else ++ { ++ free( temp_token_orig ); ++ temp_token = NULL; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ } ++ ++ } ++ ++ free( temp_token_orig ); ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isStnID */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isStnId( char *stnID, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ if( stnID == NULL ) ++ return FALSE; ++ ++ if( strlen(stnID) == 4 ) ++ { ++ if( nisalpha(stnID,1) && nisalnum(stnID+1,3) ) { ++ strcpy(Mptr->stnid,stnID); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isCodeName */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isCodeName( char *codename, Decoded_METAR *Mptr, int *NDEX) ++{ ++ if( codename == NULL ) ++ return FALSE; ++ ++ if( strcmp(codename,"METAR") == 0 || ++ strcmp(codename,"SPECI") == 0 ) ++ { ++ strcpy(Mptr->codeName, codename ); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ ++} ++ ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isNIL */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isNIL( char *token, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ if( token == NULL ) ++ return FALSE; ++ ++ if( strcmp(token, "NIL") == 0 ) ++ { ++ Mptr->NIL_rpt = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isAUTO */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isAUTO( char *token, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ if( token == NULL ) ++ return FALSE; ++ ++ if( strcmp(token, "AUTO") == 0 ) ++ { ++ Mptr->AUTO = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isCOR */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 24 Apr 1996 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isCOR ( char *token, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ if( token == NULL ) ++ return FALSE; ++ ++ if( strcmp(token, "COR") == 0 ) ++ { ++ Mptr->COR = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isTimeUTC */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isTimeUTC( char *UTC, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ ++ if( UTC == NULL ) ++ return FALSE; ++ ++ if( strlen( UTC ) == 4 ) { ++ if(nisdigit(UTC,4) ) { ++ Mptr->ob_hour = antoi(UTC,2); ++ Mptr->ob_minute = antoi(UTC+2,2); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else if( strlen( UTC ) == 6 ) { ++ if(nisdigit(UTC,6) ) { ++ Mptr->ob_date = antoi(UTC,2); ++ Mptr->ob_hour = antoi(UTC+2,2); ++ Mptr->ob_minute = antoi(UTC+4,2); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ if( strlen( UTC ) == 5 ) { ++ if(nisdigit(UTC,4) && (*(UTC+4) == 'Z') ) { ++ Mptr->ob_hour = antoi(UTC,2); ++ Mptr->ob_minute = antoi(UTC+2,2); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else if( strlen( UTC ) == 7 ) { ++ if(nisdigit(UTC,6) && (*(UTC+6) == 'Z') ) { ++ Mptr->ob_date = antoi(UTC,2); ++ Mptr->ob_hour = antoi(UTC+2, 2); ++ Mptr->ob_minute = antoi(UTC+4, 2 ); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else ++ return FALSE; ++} ++ ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isWindData */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isWindData( char *wind, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ ++ char *GustPtr, ++ *unitsPtr; ++ char dummy[8]; ++ ++ if( wind == NULL ) ++ return FALSE; ++ ++ if( strlen(wind) < 7 ) ++ return FALSE; ++ ++ memset(dummy,'\0',8); ++ ++ if( ( unitsPtr = strstr( wind, "KMH" ) ) != NULL ) ++ strcpy( dummy, "KMH" ); ++ else if( (unitsPtr = strstr( wind, "KT") ) != NULL ) ++ strcpy( dummy, "KT" ); ++ else if( (unitsPtr = strstr( wind, "MPS") ) != NULL ) ++ strcpy( dummy, "MPS" ); ++ else ++ return FALSE; ++ ++ if( (GustPtr = strchr( wind, 'G' )) != NULL ) ++ { ++ if( (nisdigit(wind,(GustPtr-wind)) || ++ (strncmp(wind,"VRB",3) == 0 && ++ nisdigit(wind+3,(GustPtr-(wind+3))))) && ++ nisdigit(GustPtr+1,(unitsPtr-(GustPtr+1))) && ++ ((GustPtr-wind) >= 5 && (GustPtr-wind) <= 6) && ++ ((unitsPtr-(GustPtr+1)) >= 2 && ++ (unitsPtr-(GustPtr+1)) <= 3) ) ++ { ++ if( strncmp(wind,"VRB",3) == 0 ) ++ Mptr->winData.windVRB = TRUE; ++ else ++ Mptr->winData.windDir = antoi(wind,3); ++ ++ Mptr->winData.windSpeed = antoi(wind+3, (GustPtr-(wind+3))); ++ Mptr->winData.windGust = antoi(GustPtr+1,(unitsPtr- ++ (GustPtr+1))); ++ (*NDEX)++; ++ strcpy( Mptr->winData.windUnits, dummy ); ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else if( nisdigit(wind,(unitsPtr-wind)) || ++ (strncmp(wind,"VRB",3) == 0 && ++ nisdigit(wind+3,(unitsPtr-(wind+3)))) && ++ ((unitsPtr-wind) >= 5 && (unitsPtr-wind) <= 6) ) ++ { ++ if( strncmp(wind,"VRB",3) == 0 ) ++ Mptr->winData.windVRB = TRUE; ++ else ++ Mptr->winData.windDir = antoi(wind, 3); ++ ++ Mptr->winData.windSpeed = antoi(wind+3,(unitsPtr-(wind+3))); ++ (*NDEX)++; ++ strcpy( Mptr->winData.windUnits, dummy ); ++ return TRUE; ++ } ++ else ++ return FALSE; ++ ++} ++#pragma page(1) ++#pragma subtitle(" ") ++#pragma subtitle("subtitle - Decode METAR report. ") ++/********************************************************************/ ++/* */ ++/* Title: DcdMETAR */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 14 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: DcdMETAR takes a pointer to a METAR report char- */ ++/* acter string as input, decodes the report, and */ ++/* puts the individual decoded/parsed groups into */ ++/* a structure that has the variable type */ ++/* Decoded_METAR. */ ++/* */ ++/* Input: string - a pointer to a METAR report character */ ++/* string. */ ++/* */ ++/* Output: Mptr - a pointer to a structure that has the */ ++/* variable type Decoded_METAR. */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++ ++int DcdMETAR( char *string , Decoded_METAR *Mptr ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ ++ enum METAR_obGroup { codename, stnid, NIL1, COR1, obDateTime, NIL2, ++ AUTO, COR, windData, MinMaxWinDir, ++ CAVOK, visibility, ++ RVR, presentWX, PartialObscur, ++ skyCond, tempGroup, ++ altimStng, NotIDed = 99} StartGroup, ++ SaveStartGroup, ++ MetarGroup; ++ ++ WindStruct *WinDataPtr; ++ ++ int ndex, ++ NDEX, ++ i, ++ jkj, ++ j; ++ ++ ++ char **token, ++ *delimeters = {" "}; ++ ++ bool IS_NOT_RMKS; ++ ++/*********************************/ ++/* BEGIN THE BODY OF THE ROUTINE */ ++/*********************************/ ++ ++ /********************************************************/ ++ /* ONLY PARSE OR DECOCODE NON-NULL METAR REPORT STRINGS */ ++ /********************************************************/ ++ ++ if( string == NULL ) ++ return 8; ++ ++ ++ /*****************************************/ ++ /* INITIALIZE STRUCTURE THAT HAS THE */ ++ /* VARIABLE TYPE Decoded_METAR */ ++ /*****************************************/ ++ ++ InitDcdMETAR( Mptr ); ++ ++#ifdef DEBUGZZ ++ printf("DcdMETAR: Returned from InitDcdMETAR\n"); ++#endif ++ ++ ++ /****************************************************/ ++ /* TOKENIZE AND STORE THE INPUT METAR REPORT STRING */ ++ /****************************************************/ ++#ifdef DEBUGZZ ++ printf("DcdMETAR: Before start of tokenizing, string = %s\n", ++ string); ++#endif ++ ++ token = SaveTokenString( string, delimeters ); ++ ++ ++ ++ /*********************************************************/ ++ /* DECODE THE METAR REPORT (POSITIONAL ORDER PRECEDENCE) */ ++ /*********************************************************/ ++ ++ NDEX = 0; ++ MetarGroup = codename; ++ IS_NOT_RMKS = TRUE; ++ ++#ifdef DEBUGZZ ++printf("DcdMETAR: token[0] = %s\n",token[0]); ++#endif ++ ++ while( token[NDEX] != NULL && IS_NOT_RMKS ) { ++ ++#ifdef DEBUGZZ ++if( strcmp(token[0],"OPKC") == 0 || strcmp(token[0],"MDSD") == 0 ) ++ printf("DcdMETAR: token[%d] = %s\n",NDEX,token[NDEX]); ++#endif ++ ++#ifdef DEBUGZZ ++ printf("DcdMETAR: Token[%d] = %s\n",NDEX,token[NDEX]); ++#endif ++#ifdef DEBUGZZ ++ printf("DcdMETAR: MetarGroup = %d\n",MetarGroup); ++#endif ++ ++ if( strcmp( token[NDEX], "RMK" ) != 0 ) { ++ ++ StartGroup = NotIDed; ++ ++#ifdef DEBUGZZ ++ printf("DcdMETAR: StartGroup = %d\n",StartGroup); ++ printf("DcdMETAR: SaveStartGroup = %d\n",SaveStartGroup); ++#endif ++ ++ /**********************************************/ ++ /* SET ID_break_CODE TO ITS DEFAULT VALUE OF */ ++ /* 99, WHICH MEANS THAT NO SUCCESSFUL ATTEMPT */ ++ /* WAS MADE TO DECODE ANY METAR CODED GROUP */ ++ /* FOR THIS PASS THROUGH THE DECODING LOOP */ ++ /**********************************************/ ++ switch( MetarGroup ) { ++ case( codename ): ++ if( isCodeName( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = codename; ++ MetarGroup = stnid; ++ break; ++ case( stnid ): ++ if( isStnId( token[NDEX], Mptr, &NDEX ) ) { ++ SaveStartGroup = StartGroup = stnid; ++ MetarGroup = NIL1; ++ } ++ else { ++#ifdef DEBUGZZ ++printf("DcdMETAR: token[%d] = %s\n",NDEX,token[NDEX]); ++#endif ++ freeTokens( token ); ++ return 12; ++ } ++ break; ++ case( NIL1 ): ++ if( isNIL( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = NIL1; ++ MetarGroup = COR1; ++ break; ++ case( COR1 ): ++ if( isCOR( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = COR1; ++ MetarGroup = obDateTime; ++ break; ++ case( obDateTime ): ++/* ++ if( isTimeUTC( token[NDEX], Mptr, &NDEX ) ) { ++ SaveStartGroup = StartGroup = obDateTime; ++ MetarGroup = NIL2; ++ } ++ else { ++ freeTokens( token ); ++ return 12; ++ } ++ break; ++*/ ++ if( isTimeUTC( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = obDateTime; ++ MetarGroup = NIL2; ++ break; ++ case( NIL2 ): ++ if( isNIL( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = NIL2; ++ MetarGroup = AUTO; ++ break; ++ case( AUTO ): ++ if( isAUTO( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = AUTO; ++ MetarGroup = COR; ++ break; ++ case( COR ): ++ if( isCOR( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = COR; ++ MetarGroup = windData; ++ break; ++ case( windData ): ++ if( isWindData( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = windData; ++ MetarGroup = MinMaxWinDir; ++ break; ++ case( MinMaxWinDir ): ++ if( isMinMaxWinDir( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = MinMaxWinDir; ++ MetarGroup = CAVOK; ++ break; ++ case( CAVOK ): ++ if( isCAVOK( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = CAVOK; ++ MetarGroup = visibility; ++ break; ++ case( visibility ): ++ if( isVisibility( &(token[NDEX]), Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = visibility; ++ MetarGroup = RVR; ++ break; ++ case( RVR ): ++ ndex = 0; ++ MetarGroup = presentWX; ++ ++ while (isRVR( token[NDEX], Mptr, &NDEX, ndex ) && ++ ndex < 12 ) { ++ ndex++; ++ SaveStartGroup = StartGroup = RVR; ++ MetarGroup = presentWX; ++ } ++ break; ++ case( presentWX ): ++ ndex = 0; ++ MetarGroup = skyCond; ++ ++ while( isPresentWX( token[NDEX], Mptr, &NDEX, ++ &ndex ) && ndex < MAXWXSYMBOLS) { ++ SaveStartGroup = StartGroup = presentWX; ++ MetarGroup = PartialObscur; ++ } ++ break; ++ case( PartialObscur ): ++ if( isPartObscur( &(token[NDEX]), Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = PartialObscur; ++ MetarGroup = skyCond; ++ break; ++ case( skyCond ): ++ if( isSkyCond( &(token[NDEX]), Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = skyCond; ++ MetarGroup = tempGroup; ++ break; ++ case( tempGroup ): ++ if( isTempGroup( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = tempGroup; ++ MetarGroup = altimStng; ++ break; ++ case( altimStng ): ++ if( isAltimStng( token[NDEX], Mptr, &NDEX ) ) ++ SaveStartGroup = StartGroup = altimStng; ++ MetarGroup = NotIDed; ++ break; ++ default: ++ NDEX++; ++ MetarGroup = SaveStartGroup; ++/* MetarGroup = ResetMETARGroup( StartGroup, ++ SaveStartGroup ); */ ++ break; ++ } ++ } ++ else ++ IS_NOT_RMKS = FALSE; ++ ++ } ++ ++ ++#ifdef DEBUGZZ ++ printf("DcdMETAR: while loop exited, Token[%d] = %s\n", ++ NDEX,token[NDEX]); ++#endif ++ /******************************/ ++ /* DECODE GROUPS FOUND IN THE */ ++ /* REMARKS SECTION OF THE */ ++ /* METAR REPORT */ ++ /******************************/ ++ ++ if( token[NDEX] != NULL ) ++ if( strcmp( token[NDEX], "RMK" ) == 0 ) ++ DcdMTRmk( token, Mptr ); ++ ++ /****************************************/ ++ freeTokens( token ); /* FREE THE STORAGE ALLOCATED FOR THE */ ++ /* ARRAY USED TO HOLD THE METAR REPORT */ ++ /* GROUPS */ ++ /****************************************/ ++ return 0; ++ ++} diff --cc simgear/metar/Dcdmtrmk.cpp index 00000000,00000000..3b345980 new file mode 100644 --- /dev/null +++ b/simgear/metar/Dcdmtrmk.cpp @@@ -1,0 -1,0 +1,5210 @@@ ++#include "Local.h" /* standard header file */ ++#include "Metar.h" ++ ++#define SKY1_len 50 ++float fracPart( char * ); ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isTS_LOC */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 06 May 1996 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Identify the input character string as a thunder- */ ++/* storm location. If the input string is a thunder- */ ++/* storm location, then return TRUE. Otherwise, */ ++/* return FALSE. */ ++/* */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: string - a pointer to a pointer to a charac- */ ++/* ter string from a METAR report. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the index */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the index */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if the input string is a thunderstorm */ ++/* location. */ ++/* FALSE - the input string is not a thunderstorm */ ++/* location. */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isTS_LOC( char **string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ int i; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ /*******************************************/ ++ /* COMPARE THE INPUT CHARACTER STRING WITH */ ++ /* VALID AUTOMATED STATION CODE TYPE. IF */ ++ /* A MATCH IS FOUND, RETURN TRUE. OTHER- */ ++ /* WISE, RETURN FALSE */ ++ /*******************************************/ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ i = 0; ++ ++ if( strcmp( *string, "TS") != 0 ) ++ return FALSE; ++ else { ++ string++; ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp(*string,"N") == 0 || ++ strcmp(*string,"NE") == 0 || ++ strcmp(*string,"NW") == 0 || ++ strcmp(*string,"S") == 0 || ++ strcmp(*string,"SE") == 0 || ++ strcmp(*string,"SW") == 0 || ++ strcmp(*string,"E") == 0 || ++ strcmp(*string,"W") == 0 ) { ++ strcpy( Mptr->TS_LOC, *string ); ++ (*NDEX)++; ++ (*NDEX)++; ++ string++; ++ ++ if( *string == NULL ) ++ return TRUE; ++ ++ if( strcmp( *string, "MOV" ) == 0 ) { ++ string++; ++ ++ if( *string == NULL ) { ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ if( strcmp(*string,"N") == 0 || ++ strcmp(*string,"NE") == 0 || ++ strcmp(*string,"NW") == 0 || ++ strcmp(*string,"S") == 0 || ++ strcmp(*string,"SE") == 0 || ++ strcmp(*string,"SW") == 0 || ++ strcmp(*string,"E") == 0 || ++ strcmp(*string,"W") == 0 ) { ++ strcpy( Mptr->TS_MOVMNT, *string ); ++ (*NDEX)++; ++ (*NDEX)++; ++ string++; ++ return TRUE; ++ } ++ } ++ else ++ return TRUE; ++ ++ } ++ else { ++ (*NDEX)++; ++ return FALSE; ++ } ++ } ++ return FALSE; ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isDVR */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isDVR( char *token, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ char *slashPtr, *FT_ptr; ++ char *vPtr; ++ int length; ++ ++ if( token == NULL ) ++ return FALSE; ++ ++ if( (length = strlen( token )) < 4 ) ++ return FALSE; ++ ++ if( strncmp( token, "DVR", 3 ) != 0 ) ++ return FALSE; ++ ++ if( *(slashPtr = token+3) != '/' ) { ++ (*NDEX)++; ++ return FALSE; ++ } ++ ++ if( strcmp(token+(strlen(token)-2),"FT") != 0 ) ++ return FALSE; ++ else ++ FT_ptr = token + (strlen(token)-2); ++ ++ if( strchr(slashPtr+1, 'P' ) != NULL ) ++ Mptr->DVR.above_max_DVR = TRUE; ++ ++ if( strchr(slashPtr+1, 'M' ) != NULL ) ++ Mptr->DVR.below_min_DVR = TRUE; ++ ++ ++ if( (vPtr = strchr(slashPtr, 'V' )) != NULL ) ++ { ++ Mptr->DVR.vrbl_visRange = TRUE; ++ Mptr->DVR.Min_visRange = antoi(slashPtr+1, ++ (vPtr-(slashPtr+1)) ); ++ Mptr->DVR.Max_visRange = antoi(vPtr+1, ++ (FT_ptr - (vPtr+1)) ); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ { ++ if( Mptr->DVR.below_min_DVR || ++ Mptr->DVR.above_max_DVR ) ++ Mptr->DVR.visRange = antoi(slashPtr+2, ++ (FT_ptr - (slashPtr+2)) ); ++ else ++ Mptr->DVR.visRange = antoi(slashPtr+1, ++ (FT_ptr - (slashPtr+1)) ); ++ ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isTornadicActiv */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Determines whether or not the input character */ ++/* string is signals the beginning of TORNADIC */ ++/* ACTIVITY data. If it is, then interrogate subse- */ ++/* quent report groups for time, location, and movement*/ ++/* of tornado. Return TRUE, if TORNADIC ACTIVITY is */ ++/* found. Otherwise, return FALSE. */ ++/* */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: string - the address of a pointer to a charac- */ ++/* ter string that may or may not signal */ ++/* TORNADIC ACTIVITY. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the index */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the index */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if TORNADIC ACTIVITY is found. */ ++/* FALSE - if no TORNADIC ACTIVITY is found. */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isTornadicActiv( char **string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ int saveNdex, ++ TornadicTime; ++ bool Completion_flag; ++ char *B_stringPtr, ++ *E_stringPtr; ++ ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ ++ saveNdex = *NDEX; ++ ++ B_stringPtr = NULL; ++ E_stringPtr = NULL; ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( !( strcmp(*string, "TORNADO") == 0 || ++ strcmp(*string, "TORNADOS") == 0 || ++ strcmp(*string, "TORNADOES") == 0 || ++ strcmp(*string, "WATERSPOUT") == 0 || ++ strcmp(*string, "WATERSPOUTS") == 0 || ++ strcmp(*string, "FUNNEL") == 0 ) ) ++ return FALSE; ++ else { ++ if( strcmp(*string, "FUNNEL") == 0 ) { ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( !(strcmp(*string,"CLOUD") == 0 || ++ strcmp(*string,"CLOUDS") == 0 ) ) { ++ (*NDEX)++; ++ return FALSE; ++ } ++ else ++ strcpy(Mptr->TornadicType,"FUNNEL CLOUD"); ++ } ++ else { ++ strcpy(Mptr->TornadicType, *string); ++ (*NDEX)++; ++ (++string); ++ } ++ ++ Completion_flag = FALSE; ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ while( !Completion_flag ) { ++ ++/* printf("isTornadicActivity: current *string = %s\n", ++ *string); */ ++ ++ if( *(*string) =='B' || *(*string) == 'E') { ++ if( *(*string) == 'B' ) { ++ B_stringPtr = *string; ++ E_stringPtr = strchr((*string)+1,'E'); ++ } ++ else { ++ B_stringPtr = strchr((*string)+1,'B'); ++ E_stringPtr = *string; ++ } ++/* ++ if( B_stringPtr != NULL ) ++ printf("isTornadicActivity: B_stringPtr = %x\n", ++ B_stringPtr); ++ else ++ printf("isTornadicActivity: B_stringPtr = NULL\n"); ++ ++ if( E_stringPtr != NULL ) ++ printf("isTornadicActivity: E_stringPtr = %x\n", ++ E_stringPtr); ++ else ++ printf("isTornadicActivity: E_stringPtr = NULL\n"); ++*/ ++ if( B_stringPtr != NULL && E_stringPtr == NULL ) { ++ if( nisdigit((*string)+1, strlen((*string)+1)) && ++ strlen((*string)+1) <= 4 ) { ++ TornadicTime = antoi((*string)+1, ++ strlen((*string)+1)); ++ if( TornadicTime > 99 ) { ++ Mptr->BTornadicHour = TornadicTime / 100; ++ Mptr->BTornadicMinute = TornadicTime % 100; ++ (*NDEX)++; ++ (++string); ++ } ++ else { ++ Mptr->BTornadicHour = TornadicTime; ++ (*NDEX)++; ++ (++string); ++ } ++ } ++ else { ++ (*NDEX)++; ++ (++string); ++ } ++ } ++ else if( B_stringPtr == NULL && E_stringPtr != NULL ) { ++ if( nisdigit((*string)+1,strlen((*string)+1)) && ++ strlen((*string)+1) <= 4 ) { ++ TornadicTime = antoi((*string)+1, ++ strlen((*string)+1)); ++ if( TornadicTime > 99 ) { ++ Mptr->ETornadicHour = TornadicTime / 100; ++ Mptr->ETornadicMinute = TornadicTime % 100; ++ (*NDEX)++; ++ (++string); ++ } ++ else { ++ Mptr->ETornadicHour = TornadicTime; ++ (*NDEX)++; ++ (++string); ++ } ++ } ++ else { ++ (*NDEX)++; ++ (++string); ++ } ++ } ++ else { ++/* printf("isTornadicActivity: B_stringPtr != NULL" ++ " and E_stringPtr != NULL\n"); */ ++ if( nisdigit((B_stringPtr+1),(E_stringPtr - ++ (B_stringPtr+1)))) { ++ TornadicTime = antoi(( B_stringPtr+1), ++ (E_stringPtr-(B_stringPtr+1))); ++ if( TornadicTime > 99 ) { ++ Mptr->BTornadicHour = TornadicTime / 100; ++ Mptr->BTornadicMinute = TornadicTime % 100; ++ (*NDEX)++; ++ (++string); ++ } ++ else { ++ Mptr->BTornadicHour = TornadicTime; ++ (*NDEX)++; ++ (++string); ++ } ++ ++ TornadicTime = antoi(( E_stringPtr+1), ++ strlen(E_stringPtr+1)); ++ ++ if( TornadicTime > 99 ) { ++ Mptr->ETornadicHour = TornadicTime / 100; ++ Mptr->ETornadicMinute = TornadicTime % 100; ++ (*NDEX)++; ++ (++string); ++ } ++ else { ++ Mptr->ETornadicHour = TornadicTime; ++ (*NDEX)++; ++ (++string); ++ } ++ } ++ else { ++ (*NDEX)++; ++ (++string); ++ } ++ } ++ } ++ else if( nisdigit(*string, strlen(*string))) { ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp(*string,"N") == 0 || ++ strcmp(*string,"NE") == 0 || ++ strcmp(*string,"NW") == 0 || ++ strcmp(*string,"S") == 0 || ++ strcmp(*string,"SE") == 0 || ++ strcmp(*string,"SW") == 0 || ++ strcmp(*string,"E") == 0 || ++ strcmp(*string,"W") == 0 ) { ++ (--string); ++ Mptr->TornadicDistance = antoi(*string, ++ strlen(*string)); ++ (*NDEX)++; ++ (++string); ++ } ++ else { ++ (--string); ++ ++ if( saveNdex == *NDEX ) ++ return FALSE; ++ else ++ return TRUE; ++ } ++ ++ } ++ else if(strcmp(*string,"DSNT") == 0 || ++ strcmp(*string,"VC") == 0 || ++ strcmp(*string,"VCY") == 0 ) { ++ if( strcmp(*string,"VCY") == 0 || ++ strcmp(*string,"VC") == 0 ) { ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp(*string,"STN") == 0 ){ ++ strcpy(Mptr->TornadicLOC,"VC STN"); ++ (*NDEX)++; ++ (*NDEX)++; ++ (++string); ++ } ++ else { ++ strcpy(Mptr->TornadicLOC,"VC"); ++ (*NDEX)++; ++ } ++ } ++ else { ++ strcpy(Mptr->TornadicLOC,"DSNT"); ++ (*NDEX)++; ++ (++string); ++ } ++ } ++ else if(strcmp(*string,"N") == 0 || ++ strcmp(*string,"NE") == 0 || ++ strcmp(*string,"NW") == 0 || ++ strcmp(*string,"S") == 0 || ++ strcmp(*string,"SE") == 0 || ++ strcmp(*string,"SW") == 0 || ++ strcmp(*string,"E") == 0 || ++ strcmp(*string,"W") == 0 ) { ++ strcpy(Mptr->TornadicDIR, *string); ++ (*NDEX)++; ++ (++string); ++ } ++ else if( strcmp(*string, "MOV" ) == 0 ) { ++ (*NDEX)++; ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp(*string, "N") == 0 || ++ strcmp(*string, "S") == 0 || ++ strcmp(*string, "E") == 0 || ++ strcmp(*string, "W") == 0 || ++ strcmp(*string, "NE") == 0 || ++ strcmp(*string, "NW") == 0 || ++ strcmp(*string, "SE") == 0 || ++ strcmp(*string, "SW") == 0 ) { ++ strcpy( Mptr->TornadicMovDir, *string ); ++ (*NDEX)++; ++ (++string); ++ ++ } ++ } ++ else ++ Completion_flag = TRUE; ++ } ++ ++ if( saveNdex == *NDEX ) ++ return FALSE; ++ else ++ return TRUE; ++ ++ } ++ ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isPartObscur */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Determine whether or not the input character string */ ++/* is a partial obscuration phenomenon. If a partial */ ++/* obscuration is found, then take the preceding group */ ++/* as the obscuring phenomenon. If a partial obscura- */ ++/* tion is found, then return TRUE. Otherwise, return */ ++/* false. */ ++/* */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: string - the address of a pointer to a group */ ++/* in a METAR report that may or may not */ ++/* be a partial obscuration indicator. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the index */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the index */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if the input string is a partial obscura- */ ++/* tion. */ ++/* FALSE - if the input string is not a partial ob- */ ++/* scuration. */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isPartObscur( char **string, Decoded_METAR *Mptr, ++ int ndex, int *NDEX ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ int i; ++ ++ static char *phenom[] = {"-DZ", "DZ", "+DZ", ++ "FZDZ", "-RA", "RA", "+RA", ++ "SHRA", "TSRA", "FZRA", "-SN", "SN", "+SN", "DRSN", "BLSN", ++ "SHSN", "TSSN", "-SG", "SG", "+SG", "IC", "-PE", "PE", "+PE", ++ "SHPE", "TSPE", "GR", "SHGR", "TSGR", "GS", "SHGS", "TSGS", "-GS", ++ "+GS", "TS", "VCTS", "-TSRA", "TSRA", "+TSRA", "-TSSN", "TSSN", ++ "+TSSN", "-TSPE", "TSPE", "+TSPE", "-TSGS", "TSGS", "+TSGS", ++ "VCSH", "-SHRA", "+SHRA", "-SHSN", "+SHSN", "-SHPE", "+SHPE", ++ "-SHGS", "+SHGS", "-FZDZ", "+FZDZ", "-FZRA", "+FZRA", "FZFG", ++ "+FZFG", "BR", "FG", "VCFG", "MIFG", "PRFG", "BCFG", "FU", ++ "VA", "DU", "DRDU", "BLDU", "SA", "DRSA", "BLSA", "HZ", ++ "BLPY", "BLSN", "+BLSN", "VCBLSN", "BLSA", "+BLSA", ++ "VCBLSA", "+BLDU", "VCBLDU", "PO", "VCPO", "SQ", "FC", "+FC", ++ "VCFC", "SS", "+SS", "VCSS", "DS", "+DS", "VCDS", NULL}; ++ ++ ++#ifdef DEBUGXX ++ printf("isPartObscur: Routine Entered...\n"); ++ printf("isPartObscur: *string = %s\n",*string); ++ if( Mptr->PartialObscurationAmt[ndex][0] != '\0' ) { ++ printf("PartialObscurationAmt = %s\n", ++ &(Mptr->PartialObscurationAmt[ndex][0])); ++ if( strcmp( *string, "FEW///" ) == 0 || ++ strcmp( *string, "SCT///" ) == 0 || ++ strcmp( *string, "BKN///" ) == 0 || ++ strcmp( *string, "FEW000" ) == 0 || ++ strcmp( *string, "SCT000" ) == 0 || ++ strcmp( *string, "BKN000" ) == 0 ) { ++ ++ --string; ++ printf("isPartObscur: Preceding group = %s\n", ++ *string); ++ ++string; ++ } ++ } ++#endif ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp( *string, "FEW///" ) == 0 || ++ strcmp( *string, "SCT///" ) == 0 || ++ strcmp( *string, "BKN///" ) == 0 || ++ strcmp( *string, "FEW000" ) == 0 || ++ strcmp( *string, "SCT000" ) == 0 || ++ strcmp( *string, "BKN000" ) == 0 ) { ++ if( Mptr->PartialObscurationAmt[ndex][0] == '\0' ) ++ { ++ (*NDEX)++; ++ return FALSE; ++ } ++ else { ++ if( strcmp( *string, ++ &(Mptr->PartialObscurationAmt[ndex][0]) ) == 0 ) ++ { ++ --string; ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ i = 0; ++ while( phenom[i] != NULL ) { ++ if( strcmp( *string, phenom[i] ) == 0 ) { ++ strcpy(&(Mptr->PartialObscurationPhenom[ndex][0]), ++ *string); ++ ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ i++; ++ } ++ ++ (*NDEX)++; ++ return FALSE; ++ ++ } ++ else { ++ (*NDEX)++; ++ return FALSE; ++ } ++ ++ } ++ ++ } ++ else ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isA0indicator */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Identify the input character string as an automated */ ++/* station code type. If the input character string */ ++/* is an automated station code type, then return */ ++/* TRUE. Otherwise, return FALSE. */ ++/* */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: indicator - a pointer to a character string */ ++/* that may or may not be an ASOS */ ++/* automated station code type. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the index */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the index */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if the input string matches one of the */ ++/* valid ASOS automated station indicators. */ ++/* FALSE - the input string did not match one of the*/ ++/* valid ASOS automated station indicators. */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isA0indicator( char *indicator, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ char *autoFlag[] = {"A01", "A01A", "A02", "A02A", "AOA", ++ "A0A", "AO1", "AO1A", "AO2", "AO2A", NULL}; ++ int i; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ /*******************************************/ ++ /* COMPARE THE INPUT CHARACTER STRING WITH */ ++ /* VALID AUTOMATED STATION CODE TYPE. IF */ ++ /* A MATCH IS FOUND, RETURN TRUE. OTHER- */ ++ /* WISE, RETURN FALSE */ ++ /*******************************************/ ++ ++ if( indicator == NULL ) ++ return FALSE; ++ ++ i = 0; ++ ++ while( autoFlag[ i ] != NULL ) ++ { ++ if( strcmp( indicator, autoFlag[ i ]) == 0 ) ++ { ++ (*NDEX)++; ++ strcpy(Mptr->autoIndicator, indicator); ++ return TRUE; ++ } ++ i++; ++ } ++ ++ return FALSE; ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isPeakWind */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Determine whether or not the current and subsequent */ ++/* groups from the METAR report make up a valid report */ ++/* of peak wind. */ ++/* */ ++/* */ ++/* Input: string - the addr of a ptr to a character string */ ++/* that may or may not be the indicator */ ++/* for a peak wind data group. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the index */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the index */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if the input string (and subsequent grps) */ ++/* are decoded as peak wind. */ ++/* FALSE - if the input string (and subsequent grps)*/ ++/* are not decoded as peak wind. */ ++/* External Functions Called: */ ++/* nisdigit */ ++/* */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isPeakWind( char **string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ char buf[ 6 ]; ++ char *slash; ++ int temp; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ ++ ++ /******************************************************/ ++ /* IF THE CURRENT AND NEXT GROUPS ARE "PK WND", THEN */ ++ /* DETERMINE WHETHER OR NOT THE GROUP THAT FOLLOWS IS */ ++ /* A VALID PK WND GROUP. IF IT IS, THEN DECODE THE */ ++ /* GROUP AND RETURN TRUE. OTHERWISE, RETURN FALSE. */ ++ /******************************************************/ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp(*string,"PK") != 0 ) ++ return FALSE; ++ else ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ if( strcmp(*string,"WND") != 0 ) { ++ (*NDEX)++; ++ return FALSE; ++ } ++ else ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( (slash = strchr(*string,'/')) == NULL ) { ++ /********************************/ ++ /* INVALID PEAK WIND. BUMP PAST */ ++ /* PK AND WND GROUP AND RETURN */ ++ /* FALSE. */ ++ /********************************/ ++ (*NDEX)++; ++ (*NDEX)++; ++ return FALSE; ++ } ++ else if( strlen(*string) >= 8 && strlen(*string) <= 11 && ++ nisdigit(slash+1,strlen(slash+1)) && ++ nisdigit(*string, (slash - *string)) && ++ (slash - *string) <= 6 ) ++ { ++ memset( buf, '\0', 4); ++ strncpy( buf, *string, 3 ); ++ Mptr->PKWND_dir = atoi( buf ); ++ ++ memset( buf, '\0', 4); ++ strncpy( buf, *string+3, slash-(*string+3) ); ++ Mptr->PKWND_speed = atoi( buf ); ++ ++ memset( buf, '\0', 5); ++ strcpy( buf, slash+1 ); ++ temp = atoi( buf ); ++ ++ if( temp > 99 ) ++ { ++ Mptr->PKWND_hour = atoi(buf)/100; ++ Mptr->PKWND_minute = (atoi(buf)) % 100; ++ } ++ else ++ Mptr->PKWND_minute = atoi( buf ); ++ /********************************/ ++ /* VALID PEAK WIND FOUND. BUMP */ ++ /* PAST PK, WND, AND PEAK WIND */ ++ /* GROUPS AND RETURN TRUE. */ ++ /********************************/ ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isWindShift */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Determine whether or not the current and subsequent */ ++/* groups from the METAR report make up a valid report */ ++/* of wind shift and frontal passage, if included. */ ++/* */ ++/* */ ++/* Input: string - the addr of a ptr to a character string */ ++/* that may or may not be the indicator */ ++/* for a wind shift data group. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the index */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the index */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if the input string (and subsequent grps) */ ++/* are decoded as wind shift. */ ++/* FALSE - if the input string (and subsequent grps)*/ ++/* are not decoded as wind shift. */ ++/* External Functions Called: */ ++/* nisdigit */ ++/* */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isWindShift( char **string, Decoded_METAR *Mptr, ++ int *NDEX) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ int temp; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ ++ /****************************************************/ ++ /* IF THE CURRENT GROUP IS "WSHFT", THEN DETERMINE */ ++ /* WHETHER OR NOT THE GROUP THAT FOLLOWS IS A VALID */ ++ /* WSHFT GROUP. IF IT IS, THEN DECODE THE GROUP */ ++ /* GROUP AND RETURN TRUE. OTHERWISE, RETURN FALSE. */ ++ /****************************************************/ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp( *string, "WSHFT" ) != 0 ) ++ return FALSE; ++ else ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( nisdigit(*string,strlen(*string)) && strlen(*string) <= 4) ++ { ++ temp = atoi( *string ); ++ ++ if( temp > 100 ) ++ { ++ Mptr->WshfTime_hour = (atoi(*string))/100; ++ Mptr->WshfTime_minute = (atoi(*string)) % 100; ++ } ++ else ++ Mptr->WshfTime_minute = (atoi(*string)) % 100; ++ ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ ++ if( **string == '\0') { ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( strcmp( *string, "FROPA") == 0 ) ++ { ++ Mptr->Wshft_FROPA = TRUE; ++ /********************************/ ++ /* VALID WIND SHIFT FOUND. BUMP */ ++ /* PAST WSHFT, WSHFT GROUP, AND */ ++ /* FROPA GROUPS AND RETURN TRUE.*/ ++ /********************************/ ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ /********************************/ ++ /* VALID WIND SHIFT FOUND. BUMP */ ++ /* PAST WSHFT AND WSHFT GROUP */ ++ /* AND RETURN TRUE. */ ++ /********************************/ ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else { ++ /**********************************/ ++ /* INVALID WIND SHIFT FOUND. BUMP */ ++ /* PAST WSHFT AND RETURN FALSE. */ ++ /********************************/ ++ (*NDEX)++; ++ return FALSE; ++ } ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isTowerVsby */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Determine whether or not the current and subsequent */ ++/* groups from the METAR report make up a valid report */ ++/* of tower visibility. */ ++/* */ ++/* */ ++/* Input: string - the addr of a ptr to a character string */ ++/* that may or may not be the indicator */ ++/* for tower visibility. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the index */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the index */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if the input string (and subsequent grps) */ ++/* are decoded as tower visibility. */ ++/* FALSE - if the input string (and subsequent grps)*/ ++/* are not decoded as tower visibility */ ++/* External Functions Called: */ ++/* nisdigit */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isTowerVsby( char **token, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ char *slash; ++ float T_vsby; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ ++ /****************************************************************/ ++ /* IF THE CURRENT AND NEXT GROUPS ARE "TWR VIS", THEN DETERMINE */ ++ /* WHETHER OR NOT THE GROUP(S) THAT FOLLOWS IS(ARE) A VALID */ ++ /* TOWER VISIBILITY GROUP. IF IT IS, THEN DECODE THE GROUP */ ++ /* GROUP AND RETURN TRUE. OTHERWISE, RETURN FALSE. */ ++ /****************************************************************/ ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if(strcmp(*token,"TWR") != 0) ++ return FALSE; ++ else ++ (++token); ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if( strcmp(*token,"VIS") != 0) { ++ (*NDEX)++; ++ return FALSE; ++ } ++ else ++ (++token); ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if( nisdigit(*token, ++ strlen(*token))) ++ { ++ Mptr->TWR_VSBY = (float) atoi(*token); ++ (++token); ++ if( *token != NULL ) ++ { ++ if( (slash = strchr(*token, '/')) ++ != NULL ) ++ { ++ if( nisdigit(slash+1,strlen(slash+1)) && ++ nisdigit(*token, ++ (slash-*token))) ++ { ++ T_vsby = fracPart(*token); ++ Mptr->TWR_VSBY += T_vsby; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ } ++ else if( (slash = strchr(*token, '/')) ++ != NULL ) ++ { ++ if( nisdigit(slash+1,strlen(slash+1)) && ++ nisdigit(*token, ++ (slash-*token))) ++ { ++ Mptr->TWR_VSBY = fracPart(*token); ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ return FALSE; ++ } ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ return FALSE; ++ } ++ ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isSurfaceVsby */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Determine whether or not the current and subsequent */ ++/* groups from the METAR report make up a valid report */ ++/* of surface visibility. */ ++/* */ ++/* */ ++/* Input: string - the addr of a ptr to a character string */ ++/* that may or may not be the indicator */ ++/* for surface visibility. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the index */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the index */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if the input string (and subsequent grps) */ ++/* are decoded as surface visibility. */ ++/* FALSE - if the input string (and subsequent grps)*/ ++/* are not decoded as surface visibility. */ ++/* External Functions Called: */ ++/* nisdigit */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isSurfaceVsby( char **token, Decoded_METAR *Mptr, ++ int *NDEX) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ char *slash; ++ float S_vsby; ++ ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ ++ /****************************************************************/ ++ /* IF THE CURRENT AND NEXT GROUPS ARE "SFC VIS", THEN DETERMINE */ ++ /* WHETHER OR NOT THE GROUP(S) THAT FOLLOWS IS(ARE) A VALID */ ++ /* SURFACE VISIBILITY GROUP. IF IT IS, THEN DECODE THE GROUP */ ++ /* GROUP AND RETURN TRUE. OTHERWISE, RETURN FALSE. */ ++ /****************************************************************/ ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if(strcmp(*token,"SFC") != 0) ++ return FALSE; ++ else ++ (++token); ++ ++ if( strcmp(*token,"VIS") != 0) { ++ (*NDEX)++; ++ return FALSE; ++ } ++ else ++ (++token); ++ ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ ++ if( nisdigit(*token, ++ strlen(*token))) ++ { ++ Mptr->SFC_VSBY = (float) atoi(*token); ++ (++token); ++ if( *token != NULL ) ++ { ++ if( (slash = strchr(*token, '/')) ++ != NULL ) ++ { ++ if( nisdigit(slash+1,strlen(slash+1)) && ++ nisdigit(*token, ++ (slash-*token))) ++ { ++ S_vsby = fracPart(*token); ++ Mptr->SFC_VSBY += S_vsby; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ } ++ else if( (slash = strchr(*token, '/')) ++ != NULL ) ++ { ++ if( nisdigit(slash+1,strlen(slash+1)) && ++ nisdigit(*token, ++ (slash-*token))) ++ { ++ Mptr->SFC_VSBY = fracPart(*token); ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ return FALSE; ++ } ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ return FALSE; ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isVariableVsby */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 21 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Determine whether or not the current and subsequent */ ++/* groups from the METAR report make up a valid report */ ++/* of variable prevailing visibility. */ ++/* */ ++/* */ ++/* Input: string - the addr of a ptr to a character string */ ++/* that may or may not be the indicator */ ++/* for variable prevailing visibility. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the index */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the index */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if the input string (and subsequent grps) */ ++/* are decoded as variable prevailing vsby. */ ++/* FALSE - if the input string (and subsequent grps)*/ ++/* are not decoded as variable prevailing */ ++/* vsby. */ ++/* External Functions Called: */ ++/* nisdigit */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isVariableVsby( char **string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ char *slash, ++ *slash1, ++ *slash2, ++ buf[ 5 ], ++ *V_char; ++ float minimumVsby, ++ maximumVsby; ++ ++ ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ ++ /***************************************************/ ++ /* IF THE CURRENT GROUP IS "VIS", THEN DETERMINE */ ++ /* WHETHER OR NOT THE GROUPS THAT FOLLOW ARE VALID */ ++ /* VARIABLE PREVAILING VSBY. IF THEY ARE, THEN */ ++ /* DECODE THE GROUPS AND RETURN TRUE. OTHERWISE, */ ++ /* RETURN FALSE. */ ++ /***************************************************/ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp(*string, "VIS") != 0 ) ++ return FALSE; ++ else ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( !((V_char = strchr(*string, 'V')) != NULL || ++ nisdigit(*string,strlen(*string))) ) ++ return FALSE; ++ else if( nisdigit(*string,strlen(*string)) ) { ++ minimumVsby = (float) atoi(*string); ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( (V_char = strchr(*string,'V')) == NULL ) ++ return FALSE; ++ else { ++ if( (slash = strchr(*string,'/')) == NULL ) ++ return FALSE; ++ else { ++ if( nisdigit(*string,(slash - *string)) && ++ nisdigit(slash+1,(V_char-(slash+1))) && ++ nisdigit(V_char+1,strlen(V_char+1)) ) { ++ if( (V_char - *string) > 4 ) ++ return FALSE; ++ else { ++ memset(buf,'\0',5); ++ strncpy(buf,*string,(V_char - *string)); ++ Mptr->minVsby = minimumVsby + fracPart(buf); ++ maximumVsby = (float) atoi(V_char+1); ++ } ++ ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( (slash = strchr(*string,'/')) == NULL ) { ++ Mptr->maxVsby = maximumVsby; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( nisdigit(*string,(slash - *string)) && ++ nisdigit(slash+1, strlen(slash+1)) ) { ++ Mptr->maxVsby = maximumVsby + fracPart(*string); ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ Mptr->maxVsby = maximumVsby; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else ++ return FALSE; ++ } ++ } ++ } ++ else { ++ if( (V_char = strchr(*string,'V')) == NULL ) ++ return FALSE; ++ if(nisdigit(*string,(V_char - *string)) && ++ nisdigit(V_char+1,strlen(V_char+1)) ) { ++ Mptr->minVsby = (float) antoi(*string,(V_char - *string)); ++ maximumVsby = (float) atoi(V_char+1); ++ ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( (slash = strchr(*string,'/')) == NULL ) { ++ Mptr->maxVsby = maximumVsby; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( nisdigit(*string, (slash - *string)) && ++ nisdigit(slash+1,strlen(slash+1)) ) { ++ Mptr->maxVsby = maximumVsby + fracPart( *string ); ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ Mptr->maxVsby = maximumVsby; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else { ++ if( (slash2 = strchr(V_char+1,'/')) == NULL && ++ (slash1 = strchr(*string,'/')) == NULL ) ++ return FALSE; ++ else if( slash1 == NULL ) ++ return FALSE; ++ else if( slash == slash2 ) ++ return FALSE; ++ else if( nisdigit(*string,(slash1 - *string)) && ++ nisdigit((slash1+1),(V_char-(slash1+1))) ) { ++ if( (V_char - *string) > 4 ) ++ return FALSE; ++ else { ++ memset(buf,'\0',5); ++ strncpy(buf,*string,(V_char - *string)); ++ minimumVsby = fracPart(buf); ++ } ++ if( slash2 == NULL) { ++ if( nisdigit(V_char+1, strlen(V_char+1)) ) { ++ maximumVsby = (float) atoi(V_char+1); ++ ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( (slash = strchr(*string,'/')) == NULL ) { ++ Mptr->minVsby = minimumVsby; ++ Mptr->maxVsby = maximumVsby; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( nisdigit(*string,(slash-*string)) && ++ nisdigit((slash+1),strlen(slash+1)) ) { ++ Mptr->minVsby = minimumVsby; ++ Mptr->maxVsby = maximumVsby + ++ fracPart(*string); ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else{ ++ Mptr->minVsby = minimumVsby; ++ Mptr->maxVsby = maximumVsby; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else ++ return FALSE; ++ } ++ else { ++ if( nisdigit(V_char+1,(slash2-V_char+1)) && ++ nisdigit((slash2+1),strlen(slash2+1)) ) { ++ Mptr->minVsby = minimumVsby; ++ Mptr->maxVsby = fracPart(V_char+1); ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ } ++ } ++ } ++ return FALSE; ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isVsby2ndSite */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Determine whether or not the current and subsequent */ ++/* groups from the METAR report make up a valid report */ ++/* of visibility at a secondary site. */ ++/* */ ++/* */ ++/* Input: token - the addr of a ptr to a character string */ ++/* that may or may not be the indicator */ ++/* for visibility at a secondary site. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the index */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the index */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if the input string (and subsequent grps) */ ++/* are decoded as visibility at a 2ndry site.*/ ++/* FALSE - if the input string (and subsequent grps)*/ ++/* are not decoded as visibility at a 2ndry */ ++/* site. */ ++/* */ ++/* External Functions Called: */ ++/* nisalnum */ ++/* fracPart */ ++/* nisdigit */ ++/* */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isVsby2ndSite( char **token, Decoded_METAR *Mptr, ++ int *NDEX) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ char *slash; ++ float S_vsby, ++ VSBY_2ndSite; ++ ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ ++ /***************************************************/ ++ /* IF THE CURRENT GROUP IS "VIS", THEN DETERMINE */ ++ /* WHETHER OR NOT THE GROUPS THAT FOLLOW ARE VALID */ ++ /* VSBILITY AT A 2NDRY SITE. IF THEY ARE, THEN */ ++ /* DECODE THE GROUPS AND RETURN TRUE. OTHERWISE, */ ++ /* RETURN FALSE. */ ++ /***************************************************/ ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if(strcmp(*token,"VIS") != 0) ++ return FALSE; ++ else ++ (++token); ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if( nisdigit(*token, ++ strlen(*token))) ++ { ++ VSBY_2ndSite = (float) atoi(*token); ++ (++token); ++ if( *token != NULL ) ++ { ++ if( (slash = strchr(*token, '/')) ++ != NULL ) ++ { ++ if( nisdigit(slash+1,strlen(slash+1)) && ++ nisdigit(*token, ++ (slash-*token))) ++ { ++ S_vsby = fracPart(*token); ++ ++ (++token); ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if( strncmp( *token, "RY", 2 ) == 0) { ++ if( nisalnum( *token, strlen(*token) ) ) { ++ strcpy(Mptr->VSBY_2ndSite_LOC, *token); ++ Mptr->VSBY_2ndSite = VSBY_2ndSite + S_vsby; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else ++ return FALSE; ++ } ++ else { ++ if( strncmp( *token, "RY", 2 ) == 0) { ++ if( nisalnum( *token, strlen(*token) ) ) { ++ strcpy(Mptr->VSBY_2ndSite_LOC, *token); ++ Mptr->VSBY_2ndSite = VSBY_2ndSite; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else ++ return FALSE; ++ } ++ ++ } ++ else { ++ if( strncmp( *token, "RY", 2 ) == 0) { ++ if( nisalnum( *token, strlen(*token) ) ) { ++ strcpy(Mptr->VSBY_2ndSite_LOC, *token); ++ Mptr->VSBY_2ndSite = VSBY_2ndSite; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ } ++ else { ++ if( strncmp( *token, "RY", 2 ) == 0) { ++ if( nisalnum( *token, strlen(*token) ) ) { ++ strcpy(Mptr->VSBY_2ndSite_LOC, *token); ++ Mptr->VSBY_2ndSite = VSBY_2ndSite; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else ++ return FALSE; ++ } ++ ++ } ++ else if( (slash = strchr(*token, '/')) ++ != NULL ) ++ { ++ if( nisdigit(slash+1,strlen(slash+1)) && ++ nisdigit(*token, ++ (slash-*token))) ++ { ++ VSBY_2ndSite = fracPart(*token); ++ if( strncmp( *(++token), "RY", 2 ) == 0) { ++ if( nisalnum( *token, strlen(*token) ) ) { ++ Mptr->VSBY_2ndSite = VSBY_2ndSite; ++ strcpy(Mptr->VSBY_2ndSite_LOC, *token); ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else ++ return FALSE; ++ } ++ else ++ return FALSE; ++ } ++ else ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isLTGfreq */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Determine whether or not the current and subsequent */ ++/* groups from the METAR report make up a valid report */ ++/* of lightning. */ ++/* */ ++/* */ ++/* Input: string - the addr of a ptr to a character string */ ++/* that may or may not be the indicator */ ++/* for lightning. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the index */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the index */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if the input string (and subsequent grps) */ ++/* are decoded as lightning. */ ++/* FALSE - if the input string (and subsequent grps)*/ ++/* are not decoded as lightning. */ ++/* */ ++/* External Functions Called: */ ++/* NONE. */ ++/* */ ++/* */ ++/* Modification History: */ ++/* 09 May 1996: Software modified to properly */ ++/* decode lightning types. */ ++/* */ ++/* */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++bool static isLTGfreq( char **string, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ bool LTG_FREQ_FLAG, ++ LTG_TYPE_FLAG, ++ LTG_LOC_FLAG, ++ LTG_DIR_FLAG, ++ TYPE_NOT_FOUND; ++ char *temp; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ ++ ++ /***************************************************/ ++ /* IF THE CURRENT GROUP IS "LTG", THEN DETERMINE */ ++ /* WHETHER OR NOT THE PREVIOUS GROUP AS WELL AS */ ++ /* GROUPS THAT FOLLOW ARE VALID LIGHTNING REPORT */ ++ /* PARAMETERS. IF THEY ARE, THEN DECODE THE */ ++ /* GROUPS AND RETURN TRUE. OTHERWISE, RETURN */ ++ /* FALSE. */ ++ /***************************************************/ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp(*string,"VCTS") == 0 ) { ++ Mptr->LightningVCTS = TRUE; ++ (++string); ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strncmp( *string, "LTG", 3 ) != 0 ) { ++ return FALSE; ++ } ++ else { ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ (--string); ++ ++ ++ LTG_FREQ_FLAG = FALSE; ++ /*-- CHECK FOR LIGHTNING FREQUENCY -----------*/ ++ if( strcmp( *string, "OCNL" ) == 0 ) { ++ Mptr->OCNL_LTG = TRUE; ++ LTG_FREQ_FLAG = TRUE; ++ } ++ else if( strcmp( *string, "FRQ" ) == 0 ) { ++ Mptr->FRQ_LTG = TRUE; ++ LTG_FREQ_FLAG = TRUE; ++ } ++ else if( strcmp( *string, "CNS" ) == 0 ) { ++ Mptr->CNS_LTG = TRUE; ++ LTG_FREQ_FLAG = TRUE; ++ } ++ ++ ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ ++ if( strcmp( *string, "LTG") == 0 ) { ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ (*NDEX)++; ++ ++ LTG_LOC_FLAG = FALSE; ++ /*-- CHECK FOR LIGHTNING LOCATION ------------*/ ++ if( strcmp( *string, "DSNT" ) == 0 ) { ++ Mptr->DSNT_LTG = TRUE; ++ LTG_LOC_FLAG = TRUE; ++ } ++ else if( strcmp( *string, "AP" ) == 0 ) { ++ Mptr->AP_LTG = TRUE; ++ LTG_LOC_FLAG = TRUE; ++ } ++ else if( strcmp( *string, "VCY" ) == 0 || ++ strcmp( *string, "VC" ) == 0 ) { ++ Mptr->VcyStn_LTG = TRUE; ++ LTG_LOC_FLAG = TRUE; ++ } ++ else if( strcmp( *string, "OVHD" ) == 0 || ++ strcmp( *string, "OHD" ) == 0 ) { ++ Mptr->OVHD_LTG = TRUE; ++ LTG_LOC_FLAG = TRUE; ++ } ++ ++ if( LTG_LOC_FLAG ) ++ (++string); ++ ++ if( *string == NULL ) { ++ if( LTG_LOC_FLAG ) ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ LTG_DIR_FLAG = FALSE; ++ /*-- CHECK FOR LIGHTNING DIRECTION -----------*/ ++ if( strcmp( *string, "N" ) == 0 || ++ strcmp( *string, "NE" ) == 0 || ++ strcmp( *string, "NW" ) == 0 || ++ strcmp( *string, "S" ) == 0 || ++ strcmp( *string, "SE" ) == 0 || ++ strcmp( *string, "SW" ) == 0 || ++ strcmp( *string, "E" ) == 0 || ++ strcmp( *string, "W" ) == 0 ) { ++ strcpy( Mptr->LTG_DIR, *string); ++ LTG_DIR_FLAG = TRUE; ++ } ++ ++ ++ if( LTG_LOC_FLAG ) ++ (*NDEX)++; ++ if( LTG_DIR_FLAG ) ++ (*NDEX)++; ++ ++ return TRUE; ++ } ++ else { ++ ++ LTG_TYPE_FLAG = FALSE; ++ /*-- CHECK FOR LIGHTNING TYPE ----------------*/ ++ TYPE_NOT_FOUND = FALSE; ++ temp = (*string) + 3; ++ while( *temp != '\0' && !TYPE_NOT_FOUND ) { ++ if( strncmp( temp, "CG", 2 ) == 0 ) { ++ Mptr->CG_LTG = TRUE; ++ LTG_TYPE_FLAG = TRUE; ++ temp++; ++ temp++; ++ } ++ else if( strncmp( temp, "IC", 2 ) == 0 ) { ++ Mptr->IC_LTG = TRUE; ++ LTG_TYPE_FLAG = TRUE; ++ temp++; ++ temp++; ++ } ++ else if( strncmp( temp, "CC", 2 ) == 0 ) { ++ Mptr->CC_LTG = TRUE; ++ LTG_TYPE_FLAG = TRUE; ++ temp++; ++ temp++; ++ } ++ else if( strncmp( temp, "CA", 2 ) == 0 ) { ++ Mptr->CA_LTG = TRUE; ++ LTG_TYPE_FLAG = TRUE; ++ temp++; ++ temp++; ++ } ++ else ++ TYPE_NOT_FOUND = TRUE; ++ } ++ ++ (++string); ++ ++ if( *string == NULL ) { ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ (*NDEX)++; ++ ++ LTG_LOC_FLAG = FALSE; ++ /*-- CHECK FOR LIGHTNING LOCATION ------------*/ ++ if( strcmp( *string, "DSNT" ) == 0 ) { ++ Mptr->DSNT_LTG = TRUE; ++ LTG_LOC_FLAG = TRUE; ++ } ++ else if( strcmp( *string, "AP" ) == 0 ) { ++ Mptr->AP_LTG = TRUE; ++ LTG_LOC_FLAG = TRUE; ++ } ++ else if( strcmp( *string, "VCY" ) == 0 || ++ strcmp( *string, "VC" ) == 0 ) { ++ Mptr->VcyStn_LTG = TRUE; ++ LTG_LOC_FLAG = TRUE; ++ } ++ else if( strcmp( *string, "OVHD" ) == 0 ) { ++ Mptr->OVHD_LTG = TRUE; ++ LTG_LOC_FLAG = TRUE; ++ } ++ ++ if( LTG_LOC_FLAG ) ++ (++string); ++ ++ if( *string == NULL ) { ++ if( LTG_LOC_FLAG ) ++ (*NDEX)++; ++ if( LTG_TYPE_FLAG ) ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ LTG_DIR_FLAG = FALSE; ++ /*-- CHECK FOR LIGHTNING DIRECTION -----------*/ ++ if( strcmp( *string, "N" ) == 0 || ++ strcmp( *string, "NE" ) == 0 || ++ strcmp( *string, "NW" ) == 0 || ++ strcmp( *string, "S" ) == 0 || ++ strcmp( *string, "SE" ) == 0 || ++ strcmp( *string, "SW" ) == 0 || ++ strcmp( *string, "E" ) == 0 || ++ strcmp( *string, "W" ) == 0 ) { ++ strcpy( Mptr->LTG_DIR, *string); ++ LTG_DIR_FLAG = TRUE; ++ } ++ ++ ++ if( LTG_TYPE_FLAG ) ++ (*NDEX)++; ++ if( LTG_LOC_FLAG ) ++ (*NDEX)++; ++ if( LTG_DIR_FLAG ) ++ (*NDEX)++; ++ ++ return TRUE; ++ } ++ } ++} ++ ++ ++ ++#pragma comment (compiler) ++//#pragma comment (date) ++//#pragma comment (timestamp) ++#pragma pagesize(80) ++ ++#include "Metar.h" /* standard header file */ ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isRecentWx */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Determine whether or not the current and subsequent */ ++/* groups from the METAR report make up a valid report */ ++/* recent weather. */ ++/* */ ++/* Input: token - the addr of a ptr to a character token */ ++/* that may or may not be a recent weather */ ++/* group. */ ++/* */ ++/* Mptr - a pointer to a structure that has the */ ++/* data type Decoded_METAR. */ ++/* */ ++/* NDEX - a pointer to an integer that is the i*NDEX */ ++/* into an array that contains the indi- */ ++/* vidual groups of the METAR report being */ ++/* decoded. Upon entry, NDEX is the i*NDEX */ ++/* of the current group of the METAR report */ ++/* that is to be indentified. */ ++/* */ ++/* Output: TRUE - if the input token (and possibly subse- */ ++/* quent groups) are decoded as recent wx. */ ++/* FALSE - if the input token (and possibly subse- */ ++/* quent groups) are not decoded as recent */ ++/* wx. */ ++/* */ ++/* External Functions Called: */ ++/* nisdigit */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isRecentWX( char **token, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ static char *phenom[] = {"-DZB", "DZB", "+DZB", ++ "FZDZB", "-RAB", "RAB", "+RAB", ++ "SHRAB", "TSRAB", "FZRAB", "-SNB", ++ "SNB", "+SNB", "DRSNB", "BLSNB", ++ "SHSNB", "TSSNB", "-SGB", "SGB", ++ "+SGB", "ICB", "-PEB", "PEB", "+PEB", ++ "SHPEB", "TSPEB", "GRB", "SHGRB", ++ "TSGRB", "GSB", "SHGSB", "TSGSB", "-GSB", ++ "+GSB", "TSB", "VCTSB", "-TSRAB", ++ "TSRAB", "+TSRAB", "-TSSNB", "TSSNB", ++ "+TSSNB", "-TSPEB", "TSPEB", "+TSPEB", ++ "-TSGSB", "TSGSB", "+TSGSB", ++ "VCSHB", "-SHRAB", "+SHRAB", "-SHSNB", ++ "+SHSNB", "-SHPEB", "+SHPEB", ++ "-SHGSB", "+SHGSB", "-FZDZB", "+FZDZB", ++ "-FZRAB", "+FZRAB", "FZFGB", ++ "+FZFGB", "BRB", "FGB", "VCFGB", "MIFGB", ++ "PRFGB", "BCFGB", "FUB", ++ "VAB", "DUB", "DRDUB", "BLDUB", "SAB", ++ "DRSAB", "BLSAB", "HZB", ++ "BLPYB", "BLSNB", "+BLSNB", "VCBLSNB", ++ "BLSAB", "+BLSAB", ++ "VCBLSAB", "+BLDUB", "VCBLDUB", "POB", ++ "VCPOB", "SQB", "FCB", "+FCB", ++ "VCFCB", "SSB", "+SSB", "VCSSB", "DSB", ++ "+DSB", "VCDSB", ++ ++ ++ "-DZE", "DZE", "+DZE", ++ "FZDZE", "-RAE", "RAE", "+RAE", ++ "SHRAE", "TSRAE", "FZRAE", "-SNE", ++ "SNE", "+SNE", "DRSNE", "BLSNE", ++ "SHSNE", "TSSNE", "-SGE", "SGE", ++ "+SGE", "ICE", "-PEE", "PEE", "+PEE", ++ "SHPEE", "TSPEE", "GRE", "SHGRE", ++ "TSGRE", "GSE", "SHGSE", "TSGSE", "-GSE", ++ "+GSE", "TSE", "VCTSE", "-TSRAE", ++ "TSRAE", "+TSRAE", "-TSSNE", "TSSNE", ++ "+TSSNE", "-TSPEE", "TSPEE", "+TSPEE", ++ "-TSGSE", "TSGSE", "+TSGSE", ++ "VCSHE", "-SHRAE", "+SHRAE", "-SHSNE", ++ "+SHSNE", "-SHPEE", "+SHPEE", ++ "-SHGSE", "+SHGSE", "-FZDZE", "+FZDZE", ++ "-FZRAE", "+FZRAE", "FZFGE", ++ "+FZFGE", "BRE", "FGE", "VCFGE", "MIFGE", ++ "PRFGE", "BCFGE", "FUE", ++ "VAE", "DUE", "DRDUE", "BLDUE", "SAE", ++ "DRSAE", "BLSAE", "HZE", ++ "BLPYE", "BLSNE", "+BLSNE", "VCBLSNE", ++ "BLSAE", "+BLSAE", ++ "VCBLSAE", "+BLDUE", "VCBLDUE", "POE", ++ "VCPOE", "SQE", "FCE", "+FCE", ++ "VCFCE", "SSE", "+SSE", "VCSSE", "DSE", ++ "+DSE", "VCDSE", "4-Zs"}; ++ ++ int i, ++ beg_hour, ++ beg_min, ++ end_hour, ++ end_min; ++ ++ char *temp, ++ *free_temp, ++ *numb_char, ++ *C_char; ++ ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if( (free_temp = temp = (char *) malloc(sizeof(char) * ++ (strlen(*token) + 1))) == NULL ) { ++ return FALSE; ++ } ++ else ++ strcpy(temp,*token); ++ ++ while ( *temp != '\0' ) { ++ ++ i = 0; ++ ++ beg_hour = beg_min = end_hour = end_min = MAXINT; ++ ++ while( strncmp(temp, phenom[i],strlen(phenom[i])) != 0 && ++ strcmp(phenom[i],"4-Zs") != 0 ) ++ i++; ++ ++ if( strcmp(phenom[i],"4-Zs") != 0 ) { ++#ifdef PRECENX ++ printf("PHENOM = %s\n",phenom[i]); ++#endif ++ C_char = (strlen(phenom[i]) - 1) + temp; ++ numb_char = C_char + 1; ++ ++ if( *numb_char == '\0') ++ return FALSE; ++ ++ if( nisdigit(numb_char,4) && strlen(numb_char) >= 4) { ++ if( *C_char == 'B' ) { ++ beg_hour = antoi( numb_char, 2 ); ++ beg_min = antoi( numb_char+2,2 ); ++#ifdef PRECENT ++ printf("BEG_HOUR1 = %d\n",beg_hour); ++ printf("BEG_MIN1 = %d\n",beg_min ); ++#endif ++ temp = numb_char+4; ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Bmm = beg_min; ++ Mptr->ReWx[*NDEX].Bhh = beg_hour; ++ } ++ ++ if( *(numb_char+4) == 'E' ) { ++ numb_char += 5; ++ if( nisdigit(numb_char,4) && ++ strlen(numb_char) >= 4 ) { ++ end_hour = antoi( numb_char, 2 ); ++ end_min = antoi( numb_char+2,2 ); ++#ifdef PRECENT ++ printf("END_HOUR2 = %d\n",end_hour); ++ printf("END_MIN2 = %d\n",end_min ); ++#endif ++ temp = numb_char+4; ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Emm = end_min; ++ Mptr->ReWx[*NDEX].Ehh = end_hour; ++ } ++ } ++ else if( nisdigit(numb_char,2) && ++ strlen(numb_char) >= 2 ) { ++ end_min = antoi( numb_char,2 ); ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Emm = end_min; ++#ifdef PRECENT ++ printf("END_MIN3 = %d\n",end_min ); ++#endif ++ } ++ temp = numb_char+2; ++ } ++ ++ } ++ ++ if( *NDEX <= 3 ) ++ strncpy(Mptr->ReWx[*NDEX].Recent_weather, ++ phenom[i], (strlen(phenom[i])-1) ); ++ ++ free( free_temp ); ++ return TRUE; ++ ++ } ++ else { ++ end_hour = antoi( numb_char, 2 ); ++ end_min = antoi( numb_char+2,2 ); ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Emm = end_min; ++ Mptr->ReWx[*NDEX].Ehh = end_hour; ++ ++#ifdef PRECENT ++ printf("END_HOUR4 = %d\n",end_hour); ++ printf("END_MIN4 = %d\n",end_min ); ++#endif ++ } ++ ++ temp = numb_char+4; ++ ++ if( *(numb_char+4) == 'B' ) { ++ numb_char += 5; ++ if( nisdigit(numb_char,4) && ++ strlen(numb_char) >= 4 ) { ++/* beg_hour = antoi( numb_char, 2 ); ++ beg_min = antoi( numb_char+2,2 ); */ ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Bmm = beg_min; ++ Mptr->ReWx[*NDEX].Bhh = beg_hour; ++ ++#ifdef PRECENT ++ printf("BEG_HOUR5 = %d\n",beg_hour); ++ printf("BEG_MIN5 = %d\n",beg_min ); ++#endif ++ } ++ ++ temp = numb_char+4; ++ } ++ else if( nisdigit(numb_char,2) && ++ strlen(numb_char) >= 2 ) { ++ beg_min = antoi( numb_char,2 ); ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Bmm = beg_min; ++#ifdef PRECENT ++ printf("BEG_MIN6 = %d\n",beg_min ); ++#endif ++ } ++ ++ temp = numb_char+2; ++ } ++ ++ } ++ ++ if( *NDEX <= 3 ) ++ strncpy(Mptr->ReWx[*NDEX].Recent_weather, ++ phenom[i], (strlen(phenom[i])-1) ); ++ ++ free( free_temp ); ++ return TRUE; ++ ++ } ++ ++ } ++ else if(nisdigit(numb_char,2) && strlen(numb_char) >= 2 ) { ++ if( *C_char == 'B' ) { ++ beg_min = antoi( numb_char,2 ); ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Bmm = beg_min; ++#ifdef PRECENT ++ printf("BEG_MIN7 = %d\n",beg_min ); ++#endif ++ } ++ ++ temp = numb_char+2; ++ ++ if( *(numb_char+2) == 'E' ) { ++ numb_char += 3; ++ if( nisdigit(numb_char,4) && ++ strlen(numb_char) >= 4 ) { ++ end_hour = antoi( numb_char,2 ); ++ end_min = antoi( numb_char+2,2 ); ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Emm = end_min; ++ Mptr->ReWx[*NDEX].Ehh = end_hour; ++ ++#ifdef PRECENT ++ printf("END_HOUR8 = %d\n",end_hour); ++ printf("END_MIN8 = %d\n",end_min ); ++#endif ++ } ++ ++ temp = numb_char+4; ++ } ++ else if( nisdigit(numb_char,2) && ++ strlen(numb_char) >= 2 ) { ++ end_min = antoi( numb_char,2 ); ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Emm = end_min; ++#ifdef PRECENT ++ printf("END_MIN9 = %d\n",end_min ); ++#endif ++ } ++ ++ temp = numb_char+2; ++ } ++ } ++ } ++ else { ++ end_min = antoi( numb_char, 2 ); ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Emm = end_min; ++#ifdef PRECENT ++ printf("END_MIN10 = %d\n",end_min ); ++#endif ++ } ++ ++ temp = numb_char+2; ++ ++ if( *(numb_char+2) == 'B' ) { ++ numb_char += 3; ++ if( nisdigit(numb_char,4) && ++ strlen(numb_char) >= 4 ) { ++ beg_hour = antoi( numb_char,2 ); ++ beg_min = antoi( numb_char+2,2 ); ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Bmm = beg_min; ++ Mptr->ReWx[*NDEX].Bhh = beg_hour; ++ ++#ifdef PRECENT ++ printf("BEG_HOUR11 = %d\n",beg_hour); ++ printf("BEG_MIN11 = %d\n",beg_min ); ++#endif ++ } ++ ++ temp = numb_char+4; ++ } ++ else if( nisdigit(numb_char,2) && ++ strlen(numb_char) >= 2 ) { ++ beg_min = antoi( numb_char,2 ); ++ ++ if( *NDEX <= 3 ) { ++ Mptr->ReWx[*NDEX].Bmm = beg_min; ++#ifdef PRECENT ++ printf("BEG_MIN12 = %d\n",beg_min ); ++#endif ++ } ++ ++ temp = numb_char+2; ++ } ++ ++ } ++ ++ } ++ ++ if( *NDEX <= 3 ) ++ strncpy(Mptr->ReWx[*NDEX].Recent_weather, ++ phenom[i], (strlen(phenom[i])-1) ); ++ ++ free( free_temp ); ++ return TRUE; ++ ++ } ++ else { ++ free( free_temp ); ++ return FALSE; ++ } ++ ++ } ++ else { ++ free( free_temp ); ++ return FALSE; ++ } ++ ++ } ++ return FALSE; ++} ++ ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isVariableCIG */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 21 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: isVariableCIG determines whether or not the */ ++/* current group in combination with the next */ ++/* one or more groups is a report of variable */ ++/* ceiling. */ ++/* */ ++/* External Functions Called: */ ++/* nisdigit */ ++/* */ ++/* Input: token - a pointer to an array of METAR report */ ++/* groups. */ ++/* Mptr - a pointer to a decoded_METAR structure */ ++/* NDEX - the index value of the current METAR */ ++/* report group array element. */ ++/* */ ++/* Output: TRUE, if the token is currently pointing to */ ++/* METAR report group(s) that a report of vari- */ ++/* ble ceiling. */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isVariableCIG( char **token, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ char *V_char; ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if( strcmp(*token, "CIG") != 0 ) ++ return FALSE; ++ else ++ (++token); ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if( (V_char = strchr(*token,'V')) != NULL ) { ++ if( nisdigit(*token, (V_char - *token)) && ++ nisdigit( V_char+1, strlen(V_char+1)) ) { ++ Mptr->minCeiling = antoi(*token, (V_char - *token)); ++ Mptr->maxCeiling = atoi(V_char+1); ++ ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else ++ return FALSE; ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isCeil2ndSite */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: isCeil2ndSite determines whether or not the */ ++/* current group in combination with the next */ ++/* one or more groups is a report of a ceiling */ ++/* at a secondary site. */ ++/* */ ++/* External Functions Called: */ ++/* nisdigit */ ++/* */ ++/* Input: token - a pointer to an array of METAR report */ ++/* groups. */ ++/* Mptr - a pointer to a decoded_METAR structure */ ++/* NDEX - the index value of the current METAR */ ++/* report group array element. */ ++/* */ ++/* Output: TRUE, if the token is currently pointing to */ ++/* METAR report group(s) that are reporting */ ++/* ceiling at a secondary site. */ ++/* */ ++/* External Functions Called: */ ++/* nisdigit */ ++/* */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isCIG2ndSite( char **token, Decoded_METAR *Mptr, ++ int *NDEX) ++{ ++ int CIG2ndSite; ++ ++ if( (*token) == NULL ) ++ return FALSE; ++ ++ if(strcmp(*token,"CIG") != 0) ++ return FALSE; ++ else ++ (++token); ++ ++ if( (*token) == NULL ) ++ return FALSE; ++ ++ if( strlen(*token) != 3 ) ++ return FALSE; ++ ++ if( nisdigit(*token,3) ) ++ { ++ CIG2ndSite = atoi(*token ) * 10; ++ ++ if( strncmp(*(++token),"RY",2) != 0) ++ return FALSE; ++ else { ++ strcpy(Mptr->CIG_2ndSite_LOC, *token ); ++ Mptr->CIG_2ndSite_Meters = CIG2ndSite; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else ++ return FALSE; ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isPRESFR */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Input: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Output: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isPRESFR( char *string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( strcmp(string, "PRESFR") != 0 ) ++ return FALSE; ++ else { ++ Mptr->PRESFR = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isPRESRR */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Input: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Output: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isPRESRR( char *string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( strcmp(string, "PRESRR") != 0 ) ++ return FALSE; ++ else { ++ Mptr->PRESRR = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isSLP */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isSLP( char **token, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ int pressure, ++ ndex; ++ ++ /*************************/ ++ /* BEGIN BODY OF ROUTINE */ ++ /*************************/ ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if( strcmp(*token, "SLPNO") == 0 ) { ++ Mptr->SLPNO = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ ++ if( strncmp(*token, "SLP", 3) != 0 ) ++ return FALSE; ++ else ++ { ++ if( strncmp(*token, "SLP", 3) == 0 && ++ strcmp(*token,"SLP") != 0 ) ++ { ++ if( nisdigit( *token+3, 3) ) ++ { ++ pressure = atoi(*token+3); ++ ++ if(pressure >= 550 ) ++ Mptr->SLP = ((float) pressure)/10. + 900.; ++ else ++ Mptr->SLP = ((float) pressure)/10. + 1000.; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else ++ { ++ (++token); ++ ++ if( *token == NULL ) ++ return FALSE; ++ ++ if( nisdigit( *token, 3) ) ++ { ++ pressure = atoi(*token); ++ ++ if(pressure >= 550 ) ++ Mptr->SLP = ((float) pressure)/10. + 900.; ++ else ++ Mptr->SLP = ((float) pressure)/10. + 1000.; ++ ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ ++ } ++ ++} ++#pragma page(1) ++static bool isSectorVsby( char **string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ float vsby; ++ char dd[3], ++ *slash; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ memset( dd, '\0', 3 ); ++ ++ if( strcmp(*string, "VIS") != 0 ) ++ return FALSE; ++ else { ++ ++string; ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strncmp(*string,"NE", 2) == 0 ) ++ strncpy(dd,*string,2); ++ else if( strncmp(*string,"SE",2) == 0 ) ++ strncpy(dd,*string,2); ++ else if( strncmp(*string,"NW",2) == 0 ) ++ strncpy(dd,*string,2); ++ else if( strncmp(*string,"SW",2) == 0 ) ++ strncpy(dd,*string,2); ++ else if( strncmp(*string,"N",1) == 0 ) ++ strncpy(dd,*string,1); ++ else if( strncmp(*string,"E",1) == 0 ) ++ strncpy(dd,*string,1); ++ else if( strncmp(*string,"S",1) == 0 ) ++ strncpy(dd,*string,1); ++ else if( strncmp(*string,"W",1) == 0 ) ++ strncpy(dd,*string,1); ++ else ++ return FALSE; ++ ++ if(nisdigit((*string+strlen(dd)),(strlen(*string)-strlen(dd)))) ++ vsby = atoi((*string+strlen(dd))); ++ ++ (++string); ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( (slash = strchr(*string,'/')) == NULL ) { ++ strcpy(Mptr->SectorVsby_Dir,dd); ++ Mptr->SectorVsby = vsby; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( nisdigit(*string,(slash-*string)) && ++ nisdigit(slash+1,strlen(slash+1)) ) { ++ vsby += fracPart(*string); ++ strcpy( Mptr->SectorVsby_Dir, dd ); ++ Mptr->SectorVsby = vsby; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isGR */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Input: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Output: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isGR( char **string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ char *slash; ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp(*string, "GS") == 0 ) { ++ Mptr->GR = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ ++ if( strcmp(*string, "GR") != 0 ) ++ return FALSE; ++ else { ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( (slash = strchr( *string, '/' )) != NULL ) { ++ if( strcmp( *string, "M1/4" ) == 0 ) { ++ Mptr->GR_Size = 1./8.; ++ Mptr->GR = TRUE; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( nisdigit( *string, (slash - *string) ) && ++ nisdigit( slash+1, strlen(slash+1)) ) { ++ Mptr->GR_Size = fracPart( *string ); ++ Mptr->GR = TRUE; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ Mptr->GR = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else if( nisdigit( *string, strlen(*string) ) ) { ++ Mptr->GR_Size = antoi( *string, strlen(*string) ); ++ Mptr->GR = TRUE; ++ ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( (slash = strchr( *string, '/' )) != NULL ) { ++ if( nisdigit( *string, (slash - *string) ) && ++ nisdigit( slash+1, strlen(slash+1)) ) { ++ Mptr->GR_Size += fracPart( *string ); ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else { ++ Mptr->GR = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isVIRGA */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Input: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Output: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isVIRGA( char **string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp(*string, "VIRGA") != 0 ) ++ return FALSE; ++ else { ++ Mptr->VIRGA = TRUE; ++ (*NDEX)++; ++ ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ ++ if( strcmp( *string, "N" ) == 0 || ++ strcmp( *string, "S" ) == 0 || ++ strcmp( *string, "E" ) == 0 || ++ strcmp( *string, "W" ) == 0 || ++ strcmp( *string, "NE" ) == 0 || ++ strcmp( *string, "NW" ) == 0 || ++ strcmp( *string, "SE" ) == 0 || ++ strcmp( *string, "SW" ) == 0 ) { ++ strcpy(Mptr->VIRGA_DIR, *string); ++ (*NDEX)++; ++ } ++ return TRUE; ++ } ++ ++} ++ ++#pragma page(1) ++static bool isSfcObscuration( char *string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ static char *WxSymbols[] = {"BCFG", "BLDU", "BLSA", "BLPY", ++ "DRDU", "DRSA", "DRSN", "DZ", "DS", "FZFG", "FZDZ", "FZRA", ++ "FG", "FC", "FU", "GS", "GR", "HZ", "IC", "MIFG", ++ "PE", "PO", "RA", "SHRA", "SHSN", "SHPE", "SHGS", ++ "SHGR", "SN", "SG", "SQ", "SA", "SS", "TSRA", ++ "TSSN", "TSPE", "TSGS", "TSGR", "TS", ++ "VCSH", "VCPO", "VCBLDU", "VCBLSA", "VCBLSN", ++ "VCFG", "VCFC","VA", NULL}; ++ int i, ++ ndex; ++ char *numLoc, ++ ww[12], ++ *temp; ++ ++ bool IS_NOT_FOUND; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ memset( ww, '\0', sizeof(ww) ); ++ ++ if( strlen(string) < 4 ) ++ return FALSE; ++ ++ if( strncmp(string, "-X",2 ) != 0 ) ++ return FALSE; ++ ++ if( !(nisdigit(string+(strlen(string)-1), 1)) ) ++ return FALSE; ++ else { ++ temp = string + 2; ++ strncpy( ww, temp, (strlen(string)-2) ); ++ ++ ndex = 0; ++ temp = ww; ++ numLoc = temp + (strlen(temp) - 1 ); ++ ++ while( temp < numLoc && ndex < 6 ) { ++ i = 0; ++ ++ IS_NOT_FOUND = TRUE; ++ ++ while( WxSymbols[i] != NULL && IS_NOT_FOUND ) { ++ if( strncmp( WxSymbols[i], temp, strlen(WxSymbols[i])) ++ != 0 ) ++ i++; ++ else ++ IS_NOT_FOUND = FALSE; ++ } ++ ++ if( WxSymbols[i] == NULL ) { ++ (*NDEX)++; ++ return FALSE; ++ } ++ else { ++ strcpy(&(Mptr->SfcObscuration[ndex][0]),WxSymbols[i]); ++ temp += strlen(WxSymbols[i]); ++ ndex++; ++ } ++ ++ } ++ ++ if( ndex > 0 ) { ++ Mptr->Num8thsSkyObscured = antoi( numLoc,1 ); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ return FALSE; ++ } ++ ++ } ++ ++} ++ ++#pragma page(1) ++static bool isCeiling( char *string, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( !(strncmp(string,"CIG",3) == 0 && strlen(string) >= 5) ) ++ return FALSE; ++ else { ++ if( strcmp(string, "CIGNO") == 0 ) { ++ Mptr->CIGNO = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( strlen( string+3 ) == 3 ) { ++ if( nisdigit(string+3, strlen(string+3)) && ++ strlen(string+3) == 3 ) { ++ Mptr->Ceiling = atoi(string+3) * 100; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else if( strlen(string+3) == 4 ) { ++ if( *(string+3) == 'E' && nisdigit(string+4,3) ) { ++ Mptr->Estimated_Ceiling = antoi(string+4,3) * 100; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ else ++ return FALSE; ++ ++ } ++ ++} ++#pragma page(1) ++static bool isVrbSky( char **string, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ static char *cldPtr[] = {"FEW", "SCT", "BKN", "OVC", NULL }; ++ bool IS_NOT_FOUND; ++ int i; ++ char SKY1[ SKY1_len ]; ++ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ ++ memset( SKY1, '\0', SKY1_len ); ++ i = 0; ++ IS_NOT_FOUND = TRUE; ++ ++ while( cldPtr[i] != NULL && IS_NOT_FOUND ) { ++#ifdef DEBUGQQ ++ printf("isVrbSky: *string = %s cldPtr[%d] = %s\n", ++ *string,i,cldPtr[i]); ++#endif ++ if( strncmp(*string, cldPtr[i], strlen(cldPtr[i])) != 0 ) ++ i++; ++ else ++ IS_NOT_FOUND = FALSE; ++ } ++ ++ if( cldPtr[i] == NULL ) ++ return FALSE; ++ else { ++#ifdef DEBUGQQ ++ printf("isVrbSky: *string = %s = cldPtr[%d] = %s\n", ++ *string,i,cldPtr[i]); ++#endif ++ strcpy( SKY1, cldPtr[i] ); ++ ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ ++ if( strcmp(*string, "V") != 0 ) ++ return FALSE; ++ else { ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ i = 0; ++ IS_NOT_FOUND = TRUE; ++ while( cldPtr[i] != NULL && IS_NOT_FOUND ) { ++#ifdef DEBUGQQ ++ printf("isVrbSky: *string = %s cldPtr[%d] = %s\n", ++ *string,i,cldPtr[i]); ++#endif ++ if( strncmp(*string, cldPtr[i], strlen(cldPtr[i])) != 0 ) ++ i++; ++ else ++ IS_NOT_FOUND = FALSE; ++ } ++ ++ if( cldPtr[i] == NULL ) { ++ (*NDEX)++; ++ (*NDEX)++; ++ return FALSE; ++ } ++ else { ++ if(strlen(SKY1) == 6 ) { ++ if( nisdigit(SKY1+3,3)) { ++ strncpy(Mptr->VrbSkyBelow,SKY1,3); ++ strcpy(Mptr->VrbSkyAbove,cldPtr[i]); ++ Mptr->VrbSkyLayerHgt = antoi(SKY1+3,3)*100; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else { ++ strcpy(Mptr->VrbSkyBelow,SKY1); ++ strcpy(Mptr->VrbSkyAbove,cldPtr[i]); ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ } ++ ++ } ++ ++ } ++ ++} ++ ++#pragma page(1) ++static bool isObscurAloft( char **string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ static char *WxSymbols[] = {"BCFG", "BLDU", "BLSA", "BLPY", ++ "DRDU", "DRSA", "DRSN", "DZ", "DS", "FZFG", "FZDZ", "FZRA", ++ "FG", "FC", "FU", "GS", "GR", "HZ", "IC", "MIFG", ++ "PE", "PO", "RA", "SHRA", "SHSN", "SHPE", "SHGS", ++ "SHGR", "SN", "SG", "SQ", "SA", "SS", "TSRA", ++ "TSSN", "TSPE", "TSGS", "TSGR", "TS", ++ "VCSH", "VCPO", "VCBLDU", "VCBLSA", "VCBLSN", ++ "VCFG", "VCFC","VA", NULL}; ++ int i; ++ char *saveTemp, ++ *temp; ++ ++ bool IS_NOT_FOUND; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ saveTemp = temp = *string; ++ ++ if( *temp == '\0' ) ++ return FALSE; ++ ++ while( *temp != '\0' ) { ++ i = 0; ++ ++ IS_NOT_FOUND = TRUE; ++ ++ while( WxSymbols[i] != NULL && IS_NOT_FOUND ) { ++ if( strncmp(temp,WxSymbols[i],strlen(WxSymbols[i])) != 0 ) ++ i++; ++ else ++ IS_NOT_FOUND = FALSE; ++ } ++ ++ if( WxSymbols[i] == NULL ) { ++ return FALSE; ++ } ++ else ++ temp += strlen(WxSymbols[i]); ++ } ++ ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strlen(*string) != 6 ) ++ return FALSE; ++ else { ++ if((strncmp(*string,"FEW",3) == 0 || ++ strncmp(*string,"SCT",3) == 0 || ++ strncmp(*string,"BKN",3) == 0 || ++ strncmp(*string,"OVC",3) == 0 ) && ++ (nisdigit(*string+3,3) && ++ strcmp(*string+3,"000") != 0 )) { ++ strcpy(Mptr->ObscurAloft,saveTemp); ++ strncpy(Mptr->ObscurAloftSkyCond, *string,3); ++ Mptr->ObscurAloftHgt = atoi(*string+3)*100; ++ (*NDEX)++; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ } ++ ++} ++#pragma page(1) ++static bool isNOSPECI( char *string, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( strcmp(string,"NOSPECI") != 0 ) ++ return FALSE; ++ else { ++ Mptr->NOSPECI = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++} ++#pragma page(1) ++static bool isLAST( char *string, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( strcmp(string,"LAST") != 0 ) ++ return FALSE; ++ else { ++ Mptr->LAST = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isSynopClouds */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isSynopClouds( char *token, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ ++ if( token == NULL ) ++ return FALSE; ++ ++ if(strlen(token) != 5) ++ return FALSE; ++ ++ if( *token == '8' && ++ *(token+1) == '/' && ++ ((*(token+2) <= '9' && *(token+2) >= '0') || *(token+2) == '/') ++ && ++ ((*(token+3) <= '9' && *(token+3) >= '0') || *(token+3) == '/') ++ && ++ ((*(token+4) <= '9' && *(token+4) >= '0') || *(token+4) == '/')) ++ { ++ strcpy(Mptr->synoptic_cloud_type,token); ++ ++ Mptr->CloudLow = *(token+2); ++ Mptr->CloudMedium = *(token+3); ++ Mptr->CloudHigh = *(token+4); ++ ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++} ++ ++#pragma page(1) ++static bool isSNINCR( char **string, Decoded_METAR *Mptr, int *NDEX ) ++{ ++ ++ char *slash; ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp( *string, "SNINCR") != 0 ) ++ return FALSE; ++ else { ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ ++ if( (slash = strchr(*string,'/')) == NULL ) { ++ (*NDEX)++; ++ return FALSE; ++ } ++ else if( nisdigit (*string,(slash-*string)) && ++ nisdigit(slash+1,strlen(slash+1)) ) { ++ Mptr->SNINCR = antoi(*string,(slash-*string)); ++ Mptr->SNINCR_TotalDepth = antoi(slash+1,strlen(slash+1)); ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ return FALSE; ++ } ++ ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isSnowDepth */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isSnowDepth( char *token, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ if( token == NULL ) ++ return FALSE; ++ ++ if(strlen(token) != 5) ++ return FALSE; ++ ++ if( *token == '4' && ++ *(token+1) == '/' && ++ nisdigit( (token+2),3) ) ++ { ++ strcpy(Mptr->snow_depth_group,token); ++ Mptr->snow_depth = antoi(token+2,3); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++} ++ ++#pragma page(1) ++static bool isWaterEquivSnow( char *string, ++ Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( strlen(string) != 6 ) ++ return FALSE; ++ else if( !(nisdigit(string,6)) ) ++ return FALSE; ++ else if( strncmp(string, "933", 3) != 0 ) ++ return FALSE; ++ else { ++ Mptr->WaterEquivSnow = ((float) atoi(string+3))/10.; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++} ++#pragma page(1) ++static bool isSunshineDur( char *string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( strlen(string) != 5 ) ++ return FALSE; ++ else if( strncmp(string, "98", 2) != 0 ) ++ return FALSE; ++ else if(nisdigit(string+2,3)) { ++ Mptr->SunshineDur = atoi(string+2); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else if( strncmp(string+2, "///", 3) == 0 ) { ++ Mptr->SunSensorOut = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isHourlyPrecip */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Input: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Output: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isHourlyPrecip( char **string, Decoded_METAR *Mptr, ++ int *NDEX) ++{ ++ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( !(strcmp(*string, "P") == 0 || charcmp(*string, "'P'dddd") || ++ charcmp(*string, "'P'ddd") ) ) ++ return FALSE; ++ else if( strcmp(*string, "P") != 0 ) { ++ if( nisdigit((*string+1), strlen(*string+1)) ) { ++ Mptr->hourlyPrecip = ((float) ++ atoi(*string+1)) * 0.01; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ return FALSE; ++ } ++ } ++ else { ++ ++ (++string); ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ ++ if( nisdigit(*string,strlen(*string)) ) { ++ Mptr->hourlyPrecip = ((float) ++ atoi(*string)) * 0.01; ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ return FALSE; ++ } ++ } ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isP6Precip */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Input: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Output: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isP6Precip( char *string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( *string == '6' && (nisdigit(string+1,4) || ++ strcmp(string+1,"////") == 0) ) { ++ if( strcmp(string+1, "////") == 0 ) { ++ Mptr->precip_amt = (float) MAXINT; ++ Mptr->Indeterminant3_6HrPrecip = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ Mptr->precip_amt = ((float) atoi(string+1)) / 100; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isP24Precip */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Input: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Output: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isP24Precip( char *string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( *string == '7' && (nisdigit(string+1,4) || ++ strcmp(string+1,"////") == 0) ) { ++ if( strcmp(string+1, "////") == 0 ) { ++ Mptr->precip_24_amt = (float) MAXINT; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ Mptr->precip_24_amt = ((float) atoi(string+1)) / 100.; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else ++ return FALSE; ++ ++} ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isTTdTenths */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 16 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Input: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Output: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isTTdTenths( char *token, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ bool returnFlag = FALSE; ++ float sign; ++ ++ if( token == NULL ) ++ return FALSE; ++ ++ if( *token != 'T' ) ++ return FALSE; ++ else if( !(strlen(token) == 5 || strlen(token) == 9) ) ++ return FALSE; ++ else ++ { ++ if( (*(token+1) == '0' || *(token+1) == '1') && ++ nisdigit(token+2,3) ) ++ { ++ if( *(token+1) == '0' ) ++ sign = 0.1; ++ else ++ sign = -0.1; ++ ++ Mptr->Temp_2_tenths = sign * ((float) antoi(token+2,3)); ++ returnFlag = TRUE; ++ } ++ else ++ return FALSE; ++ ++ if( (*(token+5) == '0' || *(token+5) == '1') && ++ nisdigit(token+6,3) ) ++ { ++ if( *(token+5) == '0' ) ++ sign = 0.1; ++ else ++ sign = -0.1; ++ ++ Mptr->DP_Temp_2_tenths = sign * ((float) atoi(token+6)); ++ (*NDEX)++; ++ return TRUE; ++ ++ } ++ else ++ { ++ if( returnFlag ) ++ { ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ return FALSE; ++ } ++ } ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isMaxTemp */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isMaxTemp(char *string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ char buf[ 6 ]; ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if(strlen(string) != 5 ) ++ return FALSE; ++ else if(*string == '1' && (*(string+1) == '0' || ++ *(string+1) == '1' || ++ *(string+1) == '/' ) && ++ (nisdigit((string+2),3) || ++ strncmp(string+2,"///",3) == 0) ) ++ { ++ if(nisdigit(string+2,3)) ++ { ++ memset(buf,'\0',6); ++ strncpy(buf,string+2,3); ++ Mptr->maxtemp = ( (float) atoi(buf))/10.; ++ ++ if( *(string+1) == '1' ) ++ Mptr->maxtemp *= (-1.0); ++ ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ { ++ Mptr->maxtemp = (float) MAXINT; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isMinTemp */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isMinTemp(char *string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ char buf[ 6 ]; ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if(strlen(string) != 5 ) ++ return FALSE; ++ else if(*string == '2' && (*(string+1) == '0' || ++ *(string+1) == '1' || ++ *(string+1) == '/' ) && ++ (nisdigit((string+2),3) || ++ strncmp(string+2,"///",3) == 0) ) ++ { ++ if(nisdigit(string+2,3)) ++ { ++ memset(buf,'\0',6); ++ strncpy(buf,string+2,3); ++ Mptr->mintemp = ( (float) atoi(buf) )/10.; ++ ++ if( *(string+1) == '1' ) ++ Mptr->mintemp *= (-1.0); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ { ++ Mptr->mintemp = (float) MAXINT; ++ (*NDEX)++; ++ return TRUE; ++ } ++ } ++ else ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isT24MaxMinTemp */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++static bool isT24MaxMinTemp( char *string, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ char buf[ 6 ]; ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( strlen(string) != 9 ) ++ return FALSE; ++ else if( (*string == '4' && (*(string+1) == '0' || ++ *(string+1) == '1' || ++ *(string+1) == '/') && ++ (nisdigit((string+2),3) || strncmp(string+2,"///",3))) ++ && ++ ((*(string+5) == '0' || *(string+5) == '1' || ++ *(string+5) == '/') && ++ (nisdigit((string+6),3) || ++ strncmp(string+6,"///",3) == 0 )) ) ++ { ++ if(nisdigit(string+1,4) && (*(string+1) == '0' || ++ *(string+1) == '1') ) ++ { ++ memset(buf, '\0', 6); ++ strncpy(buf, string+2, 3); ++ Mptr->max24temp = ( (float) atoi( buf ) )/10.; ++ ++ if( *(string+1) == '1' ) ++ Mptr->max24temp *= -1.; ++ } ++ else ++ Mptr->max24temp = (float) MAXINT; ++ ++ ++ if(nisdigit(string+5,4) && (*(string+5) == '0' || ++ *(string+5) == '1' ) ) ++ { ++ memset(buf, '\0', 6); ++ strncpy(buf, string+6, 3); ++ Mptr->min24temp = ( (float) atoi(buf) )/10.; ++ ++ if( *(string+5) == '1' ) ++ Mptr->min24temp *= -1.; ++ } ++ else ++ Mptr->min24temp = (float) MAXINT; ++ ++ (*NDEX)++; ++ return TRUE; ++ ++ } ++ else ++ return FALSE; ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isPtendency */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isPtendency(char *string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ char buf[ 6 ]; ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if(strlen(string) != 5) ++ return FALSE; ++ else if(*string == '5' && ('0' <= *(string+1) <= '8') && ++ (nisdigit(string+2,3) || strncmp(string+2,"///",3) ++ == 0) ) ++ { ++ if( !(nisdigit(string+2,3)) ) ++ { ++ memset(buf,'\0',6); ++ strncpy(buf,(string+1),1); ++ Mptr->char_prestndcy = atoi(buf); ++ (*NDEX)++; ++ return TRUE; ++ } ++ else ++ { ++ memset(buf,'\0',6); ++ strncpy(buf,(string+1),1); ++ Mptr->char_prestndcy = atoi(buf); ++ ++ Mptr->prestndcy = ((float) atoi(string+2)) * 0.1; ++ ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++ } ++ else ++ return FALSE; ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isPWINO */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isPWINO( char *string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ ++ if( strcmp(string, "PWINO") != 0 ) ++ return FALSE; ++ else { ++ Mptr->PWINO = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isPNO */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isPNO( char *string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( strcmp(string, "PNO") != 0 ) ++ return FALSE; ++ else { ++ Mptr->PNO = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isRVRNO */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isRVRNO( char *string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( strcmp(string, "RVRNO") != 0 ) ++ return FALSE; ++ else { ++ Mptr->RVRNO = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isCHINO */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isCHINO( char **string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp(*string, "CHINO") != 0 ) ++ return FALSE; ++ else ++ string++; ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strlen(*string) <= 2 ) { ++ (*NDEX)++; ++ return FALSE; ++ } ++ else { ++ if( strncmp( *string, "RY", 2 ) == 0 && ++ nisdigit(*string+2,strlen(*string+2)) ) { ++ Mptr->CHINO = TRUE; ++ strcpy(Mptr->CHINO_LOC, *string); ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ return FALSE; ++ } ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isVISNO */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isVISNO( char **string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strcmp(*string, "VISNO") != 0 ) ++ return FALSE; ++ else ++ string++; ++ ++ if( *string == NULL ) ++ return FALSE; ++ ++ if( strlen(*string) <= 2 ) { ++ (*NDEX)++; ++ return FALSE; ++ } ++ else { ++ if( strncmp( *string, "RY", 2 ) == 0 && ++ nisdigit(*string+2,strlen(*string+2))) { ++ Mptr->VISNO = TRUE; ++ strcpy(Mptr->VISNO_LOC, *string); ++ (*NDEX)++; ++ (*NDEX)++; ++ return TRUE; ++ } ++ else { ++ (*NDEX)++; ++ return FALSE; ++ } ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isFZRANO */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isFZRANO( char *string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( strcmp(string, "FZRANO") != 0 ) ++ return FALSE; ++ else { ++ Mptr->FZRANO = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isTSNO */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 20 Nov 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Input: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Output: x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isTSNO( char *string, Decoded_METAR *Mptr, int *NDEX) ++{ ++ ++ if( string == NULL ) ++ return FALSE; ++ ++ if( strcmp(string, "TSNO") != 0 ) ++ return FALSE; ++ else { ++ Mptr->TSNO = TRUE; ++ (*NDEX)++; ++ return TRUE; ++ } ++ ++} ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: isDollarSign */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: x */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++static bool isDollarSign( char *indicator, Decoded_METAR *Mptr, ++ int *NDEX ) ++{ ++ ++ if( indicator == NULL ) ++ return FALSE; ++ ++ if( strcmp(indicator,"$") != 0 ) ++ return FALSE; ++ else ++ { ++ (*NDEX)++; ++ Mptr->DollarSign = TRUE; ++ return TRUE; ++ } ++} ++ ++#pragma page(1) ++#pragma subtitle(" ") ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: DcdMTRmk */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: DcdMTRmk takes a pointer to a METAR */ ++/* report and parses/decodes data elements from */ ++/* the remarks section of the report. */ ++/* */ ++/* */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: token - the address of a pointer to a METAR */ ++/* report character string. */ ++/* Mptr - a pointer to a structure of the vari- */ ++/* able type Decoded_METAR. */ ++/* */ ++/* */ ++/* Output: x */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++void DcdMTRmk( char **token, Decoded_METAR *Mptr ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ int TornadicActvty = 0, A0indicator = 0, ++ peakwind = 0, windshift = 0, towerVsby = 0, surfaceVsby = 0, ++ variableVsby = 0, LTGfreq = 0, ++ TS_LOC = 0, ++ recentWX = 0, variableCIG = 0, PRESFR = 0, ++ Vsby2ndSite = 0, CIG2ndSite = 0, ++ PRESRR = 0, SLP = 0, PartObscur = 0, ++ SectorVsby = 0, GR = 0, Virga = 0, ++ SfcObscur = 0, Ceiling = 0, VrbSkyCond = 0, ObscurAloft = 0, ++ NoSPECI = 0, Last = 0, SynopClouds = 0, Snincr = 0, ++ SnowDepth = 0, WaterEquivSnow = 0, SunshineDur = 0, ++ hourlyPrecip = 0, P6Precip = 0, P24Precip = 0, ++ TTdTenths = 0, MaxTemp = 0, MinTemp = 0, T24MaxMinTemp = 0, ++ Ptendency = 0, PWINO = 0, ++ FZRANO = 0, TSNO = 0, maintIndicator = 0, CHINO = 0, RVRNO = 0, ++ VISNO = 0, PNO = 0, DVR = 0; ++ ++ int NDEX, ++ ndex, ++ i; ++ char *slash, ++ *tokenX, ++ *V_char, ++ *temp_token; ++ ++ bool extra_token, ++ IS_NOT_RMKS; ++ ++ float T_vsby; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ NDEX = 0; ++ ++ /*************************************************/ ++ /* LOCATE THE START OF THE METAR REMARKS SECTION */ ++ /*************************************************/ ++ ++ IS_NOT_RMKS = TRUE; ++ ++ while( token[ NDEX ] != NULL && IS_NOT_RMKS) { ++#ifdef DEBUGZZ ++ printf("DcdMTRmk: token[%d] = %s\n",NDEX,token[NDEX]); ++#endif ++ if( strcmp(token[ NDEX ], "RMK") != 0 ) ++ NDEX++; ++ else ++ IS_NOT_RMKS = FALSE; ++ } ++ ++ /***********************************************/ ++ /* IF THE METAR REPORT CONTAINS NO REMARKS */ ++ /* SECTION, THEN RETURN TO THE CALLING ROUTINE */ ++ /***********************************************/ ++ ++ if( token[ NDEX ] != NULL ) { ++#ifdef DEBUGZZ ++ printf("DcdMTRmk: RMK found, token[%d] = %s\n", ++ NDEX,token[NDEX]); ++#endif ++ NDEX++; ++#ifdef DEBUGZZ ++ printf("DcdMTRmk: Bump NDEX, token[%d] = %s\n", ++ NDEX,token[NDEX]); ++#endif ++ } ++ else { ++#ifdef DEBUGZZ ++ printf("DcdMTRmk: No RMK found. NULL ptr encountered\n"); ++#endif ++ return; ++ } ++ /*****************************************/ ++ /* IDENTIFY AND VALIDATE REMARKS SECTION */ ++ /* DATA GROUPS FOR PARSING/DECODING */ ++ /*****************************************/ ++ ++ while(token[NDEX] != NULL) { ++ ++#ifdef DEBUGZZ ++ printf("DcdMTRmk: DECODE RMKS: token[%d] = %s\n",NDEX,token[NDEX]); ++#endif ++ ++ ++ if( isTornadicActiv( &(token[NDEX]), Mptr, &NDEX ) ) { ++ TornadicActvty++; ++ if( TornadicActvty > 1 ) { ++ memset(Mptr->TornadicType,'\0',15); ++ memset(Mptr->TornadicLOC,'\0',10); ++ memset(Mptr->TornadicDIR,'\0',4); ++ Mptr->BTornadicHour = MAXINT; ++ Mptr->BTornadicMinute = MAXINT; ++ Mptr->ETornadicHour = MAXINT; ++ Mptr->ETornadicMinute = MAXINT; ++ } ++ } ++ else if( isA0indicator( token[NDEX], Mptr, &NDEX ) ) { ++ A0indicator++; ++ if( A0indicator > 1 ) ++ memset(Mptr->autoIndicator,'\0',5); ++ } ++ else if( isPeakWind( &(token[NDEX]), Mptr, &NDEX ) ) { ++ peakwind++; ++ if( peakwind > 1 ) { ++ Mptr->PKWND_dir = MAXINT; ++ Mptr->PKWND_speed = MAXINT; ++ Mptr->PKWND_hour = MAXINT; ++ Mptr->PKWND_minute = MAXINT; ++ } ++ } ++ else if( isWindShift( &(token[NDEX]), Mptr, &NDEX ) ) { ++ windshift++; ++ if( windshift > 1 ) { ++ Mptr->WshfTime_hour = MAXINT; ++ Mptr->WshfTime_minute = MAXINT; ++ } ++ } ++ else if( isTowerVsby( &(token[NDEX]), Mptr, &NDEX ) ) { ++ towerVsby++; ++ if( towerVsby > 1 ) ++ Mptr->TWR_VSBY = (float) MAXINT; ++ } ++ else if( isSurfaceVsby( &(token[NDEX]), Mptr, &NDEX ) ) { ++ surfaceVsby++; ++ if( surfaceVsby > 1 ) ++ Mptr->TWR_VSBY = (float) MAXINT; ++ } ++ else if( isVariableVsby( &(token[NDEX]), Mptr, &NDEX ) ) { ++ variableVsby++; ++ if( variableVsby > 1 ) { ++ Mptr->minVsby = (float) MAXINT; ++ Mptr->maxVsby = (float) MAXINT; ++ } ++ } ++ else if( isVsby2ndSite( &(token[NDEX]), Mptr, &NDEX ) ) { ++ Vsby2ndSite++; ++ if( Vsby2ndSite > 1 ) { ++ Mptr->VSBY_2ndSite = (float) MAXINT; ++ memset(Mptr->VSBY_2ndSite_LOC,'\0',10); ++ } ++ } ++ else if( isLTGfreq( &(token[NDEX]), Mptr, &NDEX ) ) { ++ LTGfreq++; ++ if( LTGfreq > 1 ) { ++ Mptr->OCNL_LTG = FALSE; ++ Mptr->FRQ_LTG = FALSE; ++ Mptr->CNS_LTG = FALSE; ++ Mptr->CG_LTG = FALSE; ++ Mptr->IC_LTG = FALSE; ++ Mptr->CC_LTG = FALSE; ++ Mptr->CA_LTG = FALSE; ++ Mptr->DSNT_LTG = FALSE; ++ Mptr->OVHD_LTG = FALSE; ++ Mptr->VcyStn_LTG = FALSE; ++ Mptr->LightningVCTS = FALSE; ++ Mptr->LightningTS = FALSE; ++ memset(Mptr->LTG_DIR,'\0',3 ); ++ } ++ } ++ else if( isTS_LOC( &(token[NDEX]), Mptr, &NDEX ) ) { ++ TS_LOC++; ++ if( TS_LOC > 1 ) { ++ memset(Mptr->TS_LOC, '\0', 3); ++ memset(Mptr->TS_MOVMNT, '\0', 3); ++ } ++ } ++ else if( isRecentWX( &(token[NDEX]), Mptr, &recentWX ) ) { ++ recentWX++; ++/* if( recentWX > 3 ) { ++ for( i = 0; i < 3; i++ ) { ++ memset(Mptr->ReWx[i].Recent_weather, '\0', 5); ++ ++ Mptr->ReWx[i].Bhh = MAXINT; ++ Mptr->ReWx[i].Bmm = MAXINT; ++ ++ Mptr->ReWx[i].Ehh = MAXINT; ++ Mptr->ReWx[i].Emm = MAXINT; ++ } ++ ++ NDEX++; ++ } ++ else */ ++ NDEX++; ++ } ++ else if( isVariableCIG( &(token[NDEX]), Mptr, &NDEX ) ) { ++ variableCIG++; ++ if( variableCIG > 1) { ++ Mptr->minCeiling = MAXINT; ++ Mptr->maxCeiling = MAXINT; ++ } ++ } ++ else if( isCIG2ndSite( &(token[NDEX]), Mptr, &NDEX ) ) { ++ CIG2ndSite++; ++ if( CIG2ndSite > 1) { ++ Mptr->CIG_2ndSite_Meters = MAXINT; ++ memset( Mptr->CIG_2ndSite_LOC, '\0', 10); ++ } ++ } ++ else if( isPRESFR( token[NDEX], Mptr, &NDEX ) ) { ++ PRESFR++; ++ if( PRESFR > 1 ) ++ Mptr->PRESFR = FALSE; ++ } ++ else if( isPRESRR( token[NDEX], Mptr, &NDEX ) ) { ++ PRESRR++; ++ if( PRESRR > 1 ) ++ Mptr->PRESRR = FALSE; ++ } ++ else if( isSLP( &(token[NDEX]), Mptr, &NDEX ) ) { ++ SLP++; ++ if( SLP > 1 ) ++ Mptr->SLP = (float) MAXINT; ++ } ++ else if( isPartObscur( &(token[NDEX]), Mptr, PartObscur, ++ &NDEX ) ) { ++ PartObscur++; ++ if( PartObscur > 2 ) { ++ memset(&(Mptr->PartialObscurationAmt[0][0]), '\0', 7 ); ++ memset(&(Mptr->PartialObscurationPhenom[0][0]),'\0',12 ); ++ ++ memset(&(Mptr->PartialObscurationAmt[1][0]), '\0', 7 ); ++ memset(&(Mptr->PartialObscurationPhenom[1][0]),'\0',12 ); ++ } ++ } ++ else if( isSectorVsby( &(token[NDEX]), Mptr, &NDEX ) ) { ++ SectorVsby++; ++ if( SectorVsby > 1 ) { ++ Mptr->SectorVsby = (float) MAXINT; ++ memset(Mptr->SectorVsby_Dir, '\0', 3); ++ } ++ } ++ else if( isGR( &(token[NDEX]), Mptr, &NDEX ) ) { ++ GR++; ++ if( GR > 1 ) { ++ Mptr->GR_Size = (float) MAXINT; ++ Mptr->GR = FALSE; ++ } ++ } ++ else if( isVIRGA( &(token[NDEX]), Mptr, &NDEX ) ) { ++ Virga++; ++ if( Virga > 1 ) { ++ Mptr->VIRGA = FALSE; ++ memset(Mptr->VIRGA_DIR, '\0', 3); ++ } ++ } ++ else if( isSfcObscuration( token[NDEX], Mptr, &NDEX ) ) { ++ SfcObscur++; ++ if( SfcObscur > 1 ) { ++ for( i = 0; i < 6; i++ ) { ++ memset(&(Mptr->SfcObscuration[i][0]), '\0', 10); ++ Mptr->Num8thsSkyObscured = MAXINT; ++ } ++ } ++ } ++ else if( isCeiling( token[NDEX], Mptr, &NDEX ) ) { ++ Ceiling++; ++ if( Ceiling > 1 ) { ++ Mptr->CIGNO = FALSE; ++ Mptr->Ceiling = MAXINT; ++ Mptr->Estimated_Ceiling = FALSE; ++ } ++ } ++ else if( isVrbSky( &(token[NDEX]), Mptr, &NDEX ) ) { ++ VrbSkyCond++; ++ if( VrbSkyCond > 1 ) { ++ memset(Mptr->VrbSkyBelow, '\0', 4); ++ memset(Mptr->VrbSkyAbove, '\0', 4); ++ Mptr->VrbSkyLayerHgt = MAXINT; ++ } ++ } ++ else if( isObscurAloft( &(token[NDEX]), Mptr, &NDEX ) ) { ++ ObscurAloft++; ++ if( ObscurAloft > 1 ) { ++ Mptr->ObscurAloftHgt = MAXINT; ++ memset( Mptr->ObscurAloft, '\0', 12 ); ++ memset( Mptr->ObscurAloftSkyCond, '\0', 12 ); ++ } ++ } ++ else if( isNOSPECI( token[NDEX], Mptr, &NDEX ) ) { ++ NoSPECI++; ++ if( NoSPECI > 1 ) ++ Mptr->NOSPECI = FALSE; ++ } ++ else if( isLAST( token[NDEX], Mptr, &NDEX ) ) { ++ Last++; ++ if( Last > 1 ) ++ Mptr->LAST = FALSE; ++ } ++ else if( isSynopClouds( token[NDEX], Mptr, &NDEX ) ) { ++ SynopClouds++; ++ if( SynopClouds > 1 ) { ++ memset( Mptr->synoptic_cloud_type, '\0', 6 ); ++ Mptr->CloudLow = '\0'; ++ Mptr->CloudMedium = '\0'; ++ Mptr->CloudHigh = '\0'; ++ } ++ } ++ else if( isSNINCR( &(token[NDEX]), Mptr, &NDEX ) ) { ++ Snincr++; ++ if( Snincr > 1 ) { ++ Mptr->SNINCR = MAXINT; ++ Mptr->SNINCR_TotalDepth = MAXINT; ++ } ++ } ++ else if( isSnowDepth( token[NDEX], Mptr, &NDEX ) ) { ++ SnowDepth++; ++ if( SnowDepth > 1 ) { ++ memset( Mptr->snow_depth_group, '\0', 6 ); ++ Mptr->snow_depth = MAXINT; ++ } ++ } ++ else if( isWaterEquivSnow( token[NDEX], Mptr, &NDEX ) ) { ++ WaterEquivSnow++; ++ if( WaterEquivSnow > 1 ) ++ Mptr->WaterEquivSnow = (float) MAXINT; ++ } ++ else if( isSunshineDur( token[NDEX], Mptr, &NDEX ) ) { ++ SunshineDur++; ++ if( SunshineDur > 1 ) { ++ Mptr->SunshineDur = MAXINT; ++ Mptr->SunSensorOut = FALSE; ++ } ++ } ++ else if( isHourlyPrecip( &(token[NDEX]), Mptr, &NDEX ) ) { ++ hourlyPrecip++; ++ if( hourlyPrecip > 1 ) ++ Mptr->hourlyPrecip = (float) MAXINT; ++ } ++ else if( isP6Precip( token[NDEX], Mptr, &NDEX ) ) { ++ P6Precip++; ++ if( P6Precip > 1 ) ++ Mptr->precip_amt = (float) MAXINT; ++ } ++ else if( isP24Precip( token[NDEX], Mptr, &NDEX ) ) { ++ P24Precip++; ++ if( P24Precip > 1 ) ++ Mptr->precip_24_amt = (float) MAXINT; ++ } ++ else if( isTTdTenths( token[NDEX], Mptr, &NDEX ) ) { ++ TTdTenths++; ++ if( TTdTenths > 1 ) { ++ Mptr->Temp_2_tenths = (float) MAXINT; ++ Mptr->DP_Temp_2_tenths = (float) MAXINT; ++ } ++ } ++ else if( isMaxTemp( token[NDEX], Mptr, &NDEX ) ) { ++ MaxTemp++; ++ if( MaxTemp > 1 ) ++ Mptr->maxtemp = (float) MAXINT; ++ } ++ else if( isMinTemp( token[NDEX], Mptr, &NDEX ) ) { ++ MinTemp++; ++ if( MinTemp > 1 ) ++ Mptr->mintemp = (float) MAXINT; ++ } ++ else if( isT24MaxMinTemp( token[NDEX], ++ Mptr, &NDEX ) ) { ++ T24MaxMinTemp++; ++ if( T24MaxMinTemp > 1 ) { ++ Mptr->max24temp = (float) MAXINT; ++ Mptr->min24temp = (float) MAXINT; ++ } ++ } ++ else if( isPtendency( token[NDEX], Mptr, &NDEX ) ) { ++ Ptendency++; ++ if( Ptendency > 1 ) { ++ Mptr->char_prestndcy = MAXINT; ++ Mptr->prestndcy = (float) MAXINT; ++ } ++ } ++ else if( isPWINO( token[NDEX], Mptr, &NDEX ) ) { ++ PWINO++; ++ if( PWINO > 1 ) ++ Mptr->PWINO = FALSE; ++ } ++ else if( isFZRANO( token[NDEX], Mptr, &NDEX ) ) { ++ FZRANO++; ++ if( FZRANO > 1 ) ++ Mptr->FZRANO = FALSE; ++ } ++ else if( isTSNO( token[NDEX], Mptr, &NDEX ) ) { ++ TSNO++; ++ if( TSNO > 1 ) ++ Mptr->TSNO = FALSE; ++ } ++ else if( isDollarSign( token[NDEX], Mptr, &NDEX ) ) { ++ maintIndicator++; ++ if( maintIndicator > 1 ) ++ Mptr->DollarSign = FALSE; ++ } ++ else if( isRVRNO( token[NDEX], Mptr, &NDEX ) ) { ++ RVRNO++; ++ if( RVRNO > 1 ) ++ Mptr->RVRNO = FALSE; ++ } ++ else if( isPNO( token[NDEX], Mptr, &NDEX ) ) { ++ PNO++; ++ if( PNO > 1 ) ++ Mptr->PNO = FALSE; ++ } ++ else if( isVISNO( &(token[NDEX]), Mptr, &NDEX ) ) { ++ VISNO++; ++ if( VISNO > 1 ) { ++ Mptr->VISNO = FALSE; ++ memset(Mptr->VISNO_LOC, '\0', 6); ++ } ++ } ++ else if( isCHINO( &(token[NDEX]), Mptr, &NDEX ) ) { ++ CHINO++; ++ if( CHINO > 1 ) { ++ Mptr->CHINO = FALSE; ++ memset(Mptr->CHINO_LOC, '\0', 6); ++ } ++ } ++ else if( isDVR( token[NDEX], Mptr, &NDEX ) ) { ++ DVR++; ++ if( DVR > 1 ) { ++ Mptr->DVR.Min_visRange = MAXINT; ++ Mptr->DVR.Max_visRange = MAXINT; ++ Mptr->DVR.visRange = MAXINT; ++ Mptr->DVR.vrbl_visRange = FALSE; ++ Mptr->DVR.below_min_DVR = FALSE; ++ Mptr->DVR.above_max_DVR = FALSE; ++ } ++ } ++ else ++ NDEX++; ++ ++ } ++ ++ return; ++} diff --cc simgear/metar/Drvmetar.c index 00000000,00000000..58891567 new file mode 100644 --- /dev/null +++ b/simgear/metar/Drvmetar.c @@@ -1,0 -1,0 +1,544 @@@ ++#include "Metar.h" ++ ++#pragma page(1) ++#pragma subtitle(" ") ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: dRVMETAR */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 28 Oct 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: DRVMETAR is a main routine that acts a driver */ ++/* for testing the METAR Decoder function. */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* DcdMETAR */ ++/* prtDcdMetar */ ++/* Sec0MTSm */ ++/* Sec1MTSm */ ++/* */ ++/* Input: None */ ++/* */ ++/* Output: None */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++main() ++{ ++ char bltn_prefix[20]; ++ static char *string[] = ++ { ++ "KAST 221156Z COR 09005KT 7SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005", ++ ++ "KAST COR 221156Z 09005KT 7SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005", ++ ++ "KAST COR 221156Z 09005KT 1/SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005", ++ ++ "KP88 COR 221156 09005KT 1/SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005", ++ ++ "KP88 COR 221156 09005KT 1/SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 6//// 70109 T00890084 10100 20089 55005", ++ ++ NULL, ++ ++ ++ "EPIT 1755 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1/2V3/4", ++ ++ "KFAR 181154Z 10003KT 1/4SM HZ CLR 16/13 A2988 RMK AO2 " ++ "SLP117 56012 10345 20226 T01610133 $", ++ ++ "KFAR 181154Z 10003KT 1/SM HZ CLR 16/13 A2988 RMK AO2 " ++ "SLP117 56012 10345 20226 T01610133 $", ++ ++ ++ ++ ++"RKSS 21009KT 1400 RP2000 // ////// 21/20 1006/2972 NOSIG", ++ ++"RKSS 1200 21009KT 1400 RP2000 // ////// 21/20 1006/2972 NOSIG", ++ ++"RKSS 1130Z 23011KT 1100 R14R/P1500N R14L/P1500N BR SCT010 BKN030 " ++"BKN080 21/21 Q1006 NOSIG", ++ ++"RKSS 1130Z 23011KT 1100 R14R/P1500 R14L/P1500 BR SCT010 BKN030 " ++"BKN080 21/21 Q1006 NOSIG", ++ ++NULL, ++ "KFAR 181154Z 10003KT 4SM HZ CLR 16/13 A2988 RMK AO2 " ++ "SLP117 56012 1//// 2//// T01610133 $", ++ ++ "CYYE 061300Z 3500KT 15SM BKN005 OVC040 08/08 A3004 RMK " ++ "SF6SC1 VSBY RDCE DUE LO CLD SLP186", ++ ++ "CYYE 061300Z 3500KT 15SM BKN005 OVC040 08/08 A3004 RMK " ++ "SF6SC1 VSBY RDCE DUE10 LO CLD SLP186", ++ ++ "CYYE 061300Z 3500KT 15SM BKN005 OVC040 08/08 A3004 RMK " ++ "SF6SC1 VSBY RDCE DUE9 LO CLD SLP186", ++ ++ "CYYE 061300Z 3500KT 15SM BKN005 OVC040 08/08 A3004 RMK " ++ "SF6SC1 VSBY RDCE FZDZE10 LO CLD SLP186", ++ ++ "CYYE 061300Z 3500KT 15SM BKN005 OVC040 08/08 A3004 RMK " ++ "SF6SC1 VSBY RDCE FZDZE9 LO CLD SLP186", ++ ++ ++ ++ ++ ++"MKJP 1400Z 13011KT 9999 FEW022 30/XX Q1015", ++"MKJP 1400Z 13011KT 9999 FEW022 M30/XX Q1015", ++"MKJP 1400Z 13011KT 9999 FEW022 MM/XX Q1015", ++"MKJP 1400Z 13011KT 9999 FEW022 MM/30 Q1015", ++"MKJP 1400Z 13011KT 9999 FEW022 MM/M30 Q1015", ++ ++ ++ ++ ++ "EGPD 36016G26KT 320V030 9999 FEW015TCU SCT026 BKN045 OVC090 " ++ "SCT120 FEW250 RMK OCNL LTGICCG OHD", ++ ++ "EGPD 36016G26KT 320V030 9999 FEW015TCU SCT026 07/01 Q1011 " ++ "RMK TEMPO 8000 -SHRA BKN015 FRQ LTG VC", ++ ++ "EGPD 36016G26KT 320V030 9999 FEW015TCU SCT026 07/01 Q1011 " ++ "RMK TEMPO 8000 -SHRA BKN015 LTG DSNT W", ++ ++ ++ "METAR KLAX 281156Z AUTO VRB100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT FC " ++ "+TS BLPY FEW/// SCT000 BKN050 SCT150 OVC250 3/M1 A2991 RMK " ++ "TORNADO B13E45 6 NE MOV E A02 PK WND 18515/45 " ++ "WSHFT 1350 FROPA TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "VIS 2 1/2 RY11 " ++ "DVR/1000V1600FT " ++ "OCNL LTG VCY STN " ++ "RAB1030E1145 FZDZE56 BLPYE57 CIG 1000V1500 CIG 020 RY11 " ++ "PRESFR PRESRR SLP013 FG FEW/// HZ SCT000 VIS NW 2 1/2 GR 3/4 " ++ "VIRGA SE -XRAFG3 CIGE005 BKN014 V OVC " ++ "FU BKN020 NOSPECI LAST 8/365 SNINCR 2/10 4/178 " ++ "933125 98096 P 0125 60225 70565 " ++ "T00261015 10369 21026 " ++ "404800360 52101 VISNO RY05 CHINO RY27 PNO RVRNO " ++ "PWINO FZRANO TSNO $", ++ ++ ++ "KBOS 251356Z 26011KT 10SM CLR 12/02 A2995 RMK AO2 SC VCNTY " ++ "STN SSE-NNW SCT CI ABV SLP141 T01220023", ++ ++ "EFHK 36009KT 340V060 CAVOK 12/M02 Q1013 NOSIG", ++ "EGKK 24011KT 210V300 9999 SCT020 BKN045 12/06 Q1007 NOSIG", ++ "EGPD 31018KT 8000 RA FEW013 BKN021 OVC045 06/04 Q0994 NOSIG", ++ "EKCH 16012KT CAVOK 20/07 Q1006 NOSIG", ++ "ESKN 10014KT 9000 BR SCT100 14/04 Q1010", ++ "LOWW 231450Z 14017KT CAVOK 23/07 Q1010 NOSIG", ++ ++ ++ "METAR CYCH 171500Z CCA 30017KT 2SM -SN BKN006", ++ ++ "METAR CYOW 171500Z CCA 30017KT 2SM -SN BKN006 OVC020 00/M02 " ++ "A2957 RMK S35F4NS1 /S01/ SNW WET SNW MELTG ON GRND CIG 5-7 " ++ "SLP018", ++ ++ "KAST 221156Z AUTO 09005KT 7SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005" ++ " TSB0159E30 TS SE MOV NE", ++ ++ "KAST 221156Z AUTO 09005KT 7SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005" ++ " TSE0159 TS SE", ++ ++ "KHVR 1756Z 31007KT 5SM -SN SCT011 BKN024 OVC030 M05/M08 A3056 " ++ "RMK AOA 933004 " ++ "BKN V SCT TNO PCPN 000 $ SLP389 4/015 60002 " ++ "T10501077 11050 21078 51010", ++ ++ "SPECI KGFI 041420Z AUTO 18030KT 3 1/2SM RVRNO TS -RA BKN008 OVC060 " ++ "26/22 A2991 RMK A02 RA15TSB20 PRESFR SLP 101 P 0000 T02640218", ++ ++ "METAR KCLE 281156Z 170100G135KT 110V180 M1/4SM " ++ "R01L/P6000FT +TSSHRA VCFG " ++ "BKN025 SCT100 OVC200 M26/ A2991 RMK PK WND 18515/45 A02 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "CIG 1000V1500 PRESFR FRQ LTG CG NW " ++ "RAB1030E1145 FZDZE56 PRESRR SLP135 GS " ++ "T1263 " ++ "VIRGA NW 8/365 4/178 P 0125 60225 7//// 70565 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ "CYQR 161700Z 15015KT 15SM SCT045 SCT090 BKN250 10/03 A2955 " ++ "RMK SC1AC2C11 OB TAKEN H+ 5 DUE AWOS FAILURE SLP027", ++ ++ ++ ++ ++ "KPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1V2", ++ ++ ++ ++ ++ ++ "SPECI KGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "A2900 RMK A02A PK WND 18056/28 RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP 701 P 0254 199/182", ++ ++ "SPECI KGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "A2900 RMK A02A PK WND 18056/28 RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP701 P0254 199/182", ++ ++"KHLN 281156Z AUTO 27005KT 10SM OVC023 07/05 A3011 RMK AOA OVC V " ++"BKN $ SLP202 60000 70001 T00670050 10122 20061 53003", ++ ++"KPHX 281156Z 12004KT 10SM CLR 15/05 A2996 RMK AOA SLP135 T01500050 " ++"10250 20150 53006", ++"KFCA 281156Z 30003KT 10SM CLR 06/02 A3009 RMK AO TNO $ SLP191 " ++"T00610023 10167 20056 53003", ++"KAST 281156Z 00000KT 10SM BKN095 09/08 A2997 RMK AOA SLP150 " ++"T00940084 10161 20094 52005 ", ++"KHVR 281156Z 03003KT 10SM OVC020 09/07 A3010 RMK AO TNO ZRNO " ++"$ SLP194 T00940073 10156 20089 51005", ++"KGGW 281156Z 35006KT 5SM BR OVC010 10/09 A3003 RMK AOA $ SLP177 " ++"70003 T01000095 10156 20110 53008", ++"KELY 1153Z AUTO 14004KT 10SM SCT075 01/M01 A3011 RMK AOA TNO ZRNO " ++"SLP171 70001 T00061011 10139 21006 51005", ++"KFLG 281156Z 29006KT 10SM CLR 04/M01 A3012 RMK AO TNO SLP147 " ++"T00391011 21006 51004", ++"KGTF 281156Z 27005KT 7SM BKN080 04/04 A3010 RMK AOA SLP205 " ++"T00440045 10117 20039 51006", ++ ++"K13A 1918Z 20011KT 26/M06 RMK AO PKWND 020/RNO 644V264 T02611061", ++ ++"KP88 1919Z 09001KT 14/03 RMK AO / PKWND 002/RNO 158 Z T01440034", ++ ++"K40B 1924Z 29004KT 15/M07 RMK AO PKWND 011/RM MV263 T01501072", ++ ++ "KGGW 1756Z 33018KT 10SM OVC015 M03/M06 A3041 RMK AOA SLP338 " ++ "4/007 60002 T10281055 11028 21072 51009", ++ "KPHX 1756Z 130004KT 10SM CLR 18/M03 A3001 RMK AOA SLP154 " ++ "T01781033 10178 20067 58007", ++ "KFCA 1756Z 29005KT 10SM CLR 05/M11 A3049 RMK AOA TNO SLP352 " ++ "T00501111 10050 21044 50004", ++ "KAST 1756Z 01006KT 10SM CLR 11/04 A3047 RMK AOA SLP316 " ++ "T01110045 10111 20000 50002", ++ "KELY 1753Z 34010KT 10SM CLR 01/M07 A3022 RMK AOA TNO ZRNO " ++ "SLP240 T00111066 10011 21078 58007", ++ "KFLG 1756Z 07006KT 10SM CLR 06/M12 A3009 RMK AO TNO ZRNO " ++ "SLP178 T00561122 10061 21100 58005", ++ "KGTF 1756Z 35010KT 1/2SM -SN FG VV09 M06/M08 A3051 RMK AOA " ++ "933004 SFC VSBY 3/4 " ++ "PCPN M SLP393 60010 T10611077 11044 21067 53013", ++ "KHLN 1756Z 35012KT 10SM SCT032 OVC060 M02/M09 A3048 RMK AOA " ++ "SLP369 60000 T10171094 11017 21061 53006", ++ "KAST 1756Z 01006KT 10SM CLR 11/04 A3047 RMK AOA SLP316 61104 " ++ "71235 T01110045 10111 20000 401720056 58002", ++ "METAR KLAX 04281156Z AUTO VRB100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT FC " ++ "+TS BLPY FEW000 BKN050 SCT150 OVC250 3/M1 A2991 RMK " ++ "TORNADO B13 DSNT NE A02 PK WND 18515/45 " ++ "WSHFT 1350 FROPA TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "VIS 2 1/2 RY11 OCNL LTG VCY STN " ++ "RAB1030E1145 FZDZE56 BLPYE57 CIG 1000V1500 CIG 020 RY11 " ++ "PRESFR PRESRR SLP013 FG FEW000 VIS NW2 1/2 GR 3/4 " ++ "VIRGA SE -XRAFG3 CIGE005 BKN014 V OVC " ++ "FU BKN020 NOSPECI LAST 8/365 SNINCR 2/10 4/178 " ++ "933125 98096 P 0125 60225 70565 " ++ "T00261015 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ ++ ++ "METAR KGFI 041356Z AUTO 17012KT 130V210 3 1/2SM R15L/0500FT -RA " ++ "SCT050 OVC110 26/18 A2991 RMK FUNNEL CLOUDS A02 RAB30 " ++ "SLP 101 GR M1/4 VIRGA SCT V BKN P 0010 T02640178", ++ ++ "METAR KGFI 041356Z AUTO 05008KT 10SM R15L/P6000FT CLR A2991 " ++ "RMK WATERSPOUTS VCY STN NW A02 SLP 101 10288 20243 52021 $ ", ++ ++ "SPECI KGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "A2900 RMK A02A PK WND 18056/28 OCNL LTG AP " ++ "RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP 701 P 0254 T01990182", ++ ++ "KABE 281900Z NIL", ++ ++ "METAR KPIT NIL", ++ ++ "METAR KCLE 04281156Z 170100G135KT 110V180 M1/4SM " ++ "R01L/P6000FT +TSSHRA VCFG " ++ "BKN025 SCT100 OVC200 M26/ A2991 RMK PK WND 18515/45 A02 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "CIG 1000V1500 PRESFR FRQ LTG CG NW " ++ "RAB1030E1145 FZDZE56 PRESRR SLP135 GS " ++ "T1263 " ++ "VIRGA NW 8/365 4/178 P 0125 60225 7//// 70565 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ "METAR KPHL 040256Z AUTO 170100G135KT 130V210 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT " ++ "FC +TS BKN050 SCT150 OVC250 M26/ A2991 RMK A02 PK WND 185150/1345 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 LTG DSNT " ++ "RAB1030E1145 FZDZE56 CIG 1000V1500 PRESFR PRESRR SLP037 GR 2 3/4 " ++ "VIRGA E 8/365 4/178 P 0125 70565 21026 T0263 10369 60225 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ "SPECI KGFI 041420Z AUTO 18030KT 2 1/2SM RVRNO TS -RA BKN008 " ++ "OVC060 25/22 A2991 RMK A02 LTG DSNT W " ++ "RAB15TSB20 PRESFR SLP101 P 0000 " ++ "254/218", ++ ++ "METAR KGFI 041356Z AUTO 170100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT " ++ "FC +TS BKN050 SCT150 OVC250 M26/ A2991 RMK A02 PK WND 185150/1345 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "RAB1030E1145 FZDZE56 CIG 1000V1500 PRESFR PRESRR SLP997 GR M1/4 " ++ "VIRGA SE 8/365 4/178 P 0125 6//// 60225 70565 T0263 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ ++ ++ ++ "METAR KGFI 041356Z AUTO 170100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT " ++ "FC +TS BKN050 SCT150 OVC250 M26/ A2991 RMK A02 PK WND 185150/1345 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "RAB1030E1145 FZDZE56 CIG 1000V1500 PRESFR PRESRR SLP997 GR 25 " ++ "VIRGA 35 8/365 4/178 P 0125 6//// 60225 70565 T0263 10369 21026 " ++ "VIRGA 35 8/365 4/178 P 0125 21026 70565 10369 60225 T0263 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ ++ "METAR KGFI 041356Z AUTO 170100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT " ++ "FC +TS BKN050 SCT150 OVC250 3/M1 A2991 RMK A02 PK WND 18515/45 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "RAB1030E1145 FZDZE56 CIG 1000V1500 PRESFR PRESRR SLP997 GR 25 " ++ "VIRGA 35 8/365 4/178 P 0125 60225 70565 T00261015 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ "METAR KGFI 041356Z AUTO 170100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT " ++ "FC +TS BKN050 SCT150 OVC250 3/M1 A2991 RMK A02 PK WND 185150/1345 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "RAB1030E1145 FZDZE56 CIG 1000V1500 PRESFR PRESRR SLP997 GR 25 " ++ "VIRGA 35 8/365 4/178 P 0125 60225 70565 T00261015 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO", ++ ++ ++ ++ "METAR KGFI 041356Z AUTO 05008KT 10SM R15L/P6000FT CLR A2991 RMK " ++ "A02 SLP 101 10288 20243 52021", ++ "SPECI DGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "M20/M18 A2900 RMK A02A PK WND 18056/28 RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP 701 P 0254 M199/M182", ++ ++ "SPECI DGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "M20/M18 A2900 RMK A02A PK WND 18056/28 RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP 701 P 0254 M199/182", ++ ++ "SPECI DGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "M20/M18 A2900 RMK A02A PK WND 18056/28 RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP 701 P 0254 199/M182", ++ ++ "METAR APIT 171755Z AUTO 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 4/369 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 8/563 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1 1/2V2 SLP875 SGB1213E1225", ++ ++ "NZWN 1700Z 35030G49KT 320V030 20KM 02 5SC021 7SC046 12/08 " ++ " Q0994.2 TEMPO 6000 RA 5ST012 2CB015 RMK SLP056 " ++ "RAE0123", ++ ++ "SPECI APIT 171755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 8/321 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1 SLP875 FGB1713", ++ ++ "APIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1V2 SLP875", ++ ++ ++ "APIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1 1/2V2 1/2 SLP875", ++ ++ "APIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1V2 1/2 SLP875", ++ ++ ++ "EGPF 1720Z 00000KT 9999 -SHRA STC014 SCT020CB BNK024 12/09 " ++ "Q1003 NOSIG", ++ ++ "NZAA 1700Z 03010KT 30KM 03 5CU022 7SC035 11/07 Q1006.5 NOSIG", ++ "NZWN 1700Z 35030G49KT 320V030 20KM 02 5SC021 7SC046 12/08 " ++ " Q0994.2 TEMPO 6000 RA 5ST012 2CB015 RMK KAUKAU 30050KT", ++ "DGAA 1800Z 22012KT 9999 SCT009 BKN120 25/21 Q1015", ++ "DAAT 1830Z 30010KT CAVOK 29/06 Q1019", ++ ++ "GQPP 1800Z 34023KT 3000 DRSA SKC 24/20 Q1011 NSG", ++ "DAAG 1830Z 06006KT 9999 SCT020 25/22 Q1015", ++ "DABB 1830Z 04010KT 9999 SCT030TCU SCT033CB 27/18 Q1017", ++ "DABC 1830Z 00000KT 9999 SCT026TCU SCT036CB 22/18 Q1020 RETS", ++ ++ "NZAA 1700Z 03010KT 30KM 03 5CU022 7SC035 11/07 Q1006.5 NOSIG", ++ "NZWN 1700Z 35030G49KT 320V030 20KM 02 5SC021 7SC046 12/08 " ++ " Q0994.2 TEMPO 6000 RA 5ST012 2CB015 RMK K", ++ "NZWN 1700Z 35030G49KT 320V030 20KM 02 5SC021 7SC046 12/08 " ++ " Q0994.2 TEMPO 6000 RA 5ST012 2CB015 RMK KAUKAU 30050KT", ++ "DGAA 1800Z 22012KT 9999 SCT009 BKN120 25/21 Q1015", ++ ++ "GFLL 1900Z NIL", ++ ++ "GOOY 1800Z 03006G17KT 340V080 6000 TSRA BKN016 BKN030CB " ++ "BKN133 26/23 Q1013 NOSIG", ++ ++ "GCXO 1930Z 32018KT 8000 SCT003 SCT007 18/16 Q1019", ++ ++ "APIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1 1/2V2", ++ ++ "BPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1V2", ++ ++ "CPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1V2 1/2", ++ ++ "DPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1 1/2V2 1/2", ++ ++ ++ "FPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 3/4V2 1/2", ++ ++ "GPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 3/4V3", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB M18/M16 A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB M18/16 A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/M16 A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB MM/M16 A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB MM/16 A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB M18/MM A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/MM A2992", ++ ++ NULL}; ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ Decoded_METAR Metar; ++ Decoded_METAR *Mptr = &Metar; ++ int j, ++ ErReturn; ++ static char *synopRTRN = NULL; ++ ++ ++ /***************************************************/ ++ /* START BODY OF MAIN ROUTINE FOR CALLING DcdMETAR */ ++ /***************************************************/ ++ ++ j = 0; ++ ++ while( string[j] != NULL) ++ { ++ /*-- PRINT INPUT METAR REPORT ----------------------------*/ ++ printf("INPUT METAR REPORT: %s\n",string[j] ); ++ ++ /*-- DECODE INPUT REPORT ---------------------------------*/ ++ if ( (ErReturn = DcdMETAR( string[ j ], Mptr )) != 0 ) ++ printf("DcdMETAR: Error Return Number: %d\n",ErReturn); ++ ++ /*-- PRINT DECODED METAR REPORT ELEMENTS -----------------*/ ++ prtDMETR( Mptr ); ++ ++ j++; ++ ++ } ++ ++} diff --cc simgear/metar/Fracpart.cpp index 00000000,00000000..636e5a84 new file mode 100644 --- /dev/null +++ b/simgear/metar/Fracpart.cpp @@@ -1,0 -1,0 +1,63 @@@ ++#include "Local.h" /* standard header file */ ++#include "Metar.h" ++ ++#pragma subtitle(" ") ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: fracPart */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 13 Jun 1995 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: Convert a character string fraction into a */ ++/* decimal (floating point) number. */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: string - a pointer to a character string frac- */ ++/* tion. */ ++/* Output: A decimal (floating point) number. */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++float fracPart( char *string ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ char buf[ 6 ], ++ *slash; ++ ++ float numerator, ++ denominator; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ slash = strchr(string, '/'); ++ ++ memset(buf , '\0', 6); ++ strncpy( buf, string, slash-string); ++ ++ numerator = (float) atoi(buf); ++ ++ memset(buf , '\0', 6); ++ strcpy( buf, slash+1); ++ ++ denominator = (float) atoi(buf); ++ ++ return (numerator/denominator); ++ ++} ++ diff --cc simgear/metar/Local.h index 00000000,00000000..47bec5de new file mode 100644 --- /dev/null +++ b/simgear/metar/Local.h @@@ -1,0 -1,0 +1,1171 @@@ ++/*********************************************************************/ ++/* */ ++/* Title: local h */ ++/* Updated: 3 June 1996 */ ++/* Organization: W/OSO242 - Graphics and Display Section */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: */ ++/* This header file provides all function definitions necessary for */ ++/* the OSO242 C function library. */ ++/* */ ++/*********************************************************************/ ++ ++#ifndef locallib_defined ++#define locallib_defined ++ ++ ++ ++/*****************/ ++/* Include Files */ ++/*****************/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ ++ ++/********************/ ++/* Standard Defines */ ++/********************/ ++ ++#define FALSE 0 /* boolean value */ ++#define MAXINT INT_MAX /* maximum integer */ ++#define MININT INT_MIN /* minimum integer */ ++#define MAXNEG INT_MIN /* minimum integer */ ++#define NO FALSE /* boolean value */ ++#define TRUE 1 /* boolean value */ ++#define TRUNCATED -1 /* indicates truncation */ ++#define YES TRUE /* boolean value */ ++ ++ ++/*****************/ ++/* Macro defines */ ++/*****************/ ++ ++#define ABS(x) (((x) < 0) ? -(x) : (x)) ++#define clearscrn system("CLRSCRN") ++#define assgndev(d, v) v = 0x##d ++#define DIM(a) (sizeof(a) / sizeof(a[0])) ++#define FOREVER for(;;) /* endless loop */ ++#define getln(s, n) ((fgets(s, n, stdin)==NULL) ? EOF : strlen(s)) ++#define IMOD(i, j) (((i) % (j)) < 0 ? ((i) % (j))+(j) : ((i) % (j))) ++#define IN_RANGE(n, lo, hi) ((lo) <= (n) && (n) <= (hi)) ++#define LOOPDN(r, n) for ((r) = (n)+1; --(r) > 0;) ++#define MAX(x, y) (((x) < (y)) ? (y) : (x)) ++#ifndef max ++#define max(x, y) (((x) < (y)) ? (y) : (x)) ++#endif ++#define MIN(x, y) (((x) < (y)) ? (x) : (y)) ++#ifndef min ++#define min(x, y) (((x) < (y)) ? (x) : (y)) ++#endif ++#define STREQ(s, t) (strcmp(s, t) == 0) ++#define STRGT(s, t) (strcmp(s, t) > 0) ++#define STRLT(s, t) (strcmp(s, t) < 0) ++#define STRNEQ(s, t, l) (strncmp(s, t, l) == 0) ++#define STRNGT(s, t, l) (strncmp(s, t, l) > 0) ++#define STRNLT(s, t, l) (strncmp(s, t, l) < 0) ++#define SWAP(a,b,t) ((t) = (a), (a) = (b), (b) = (t)) ++ ++ ++/*********************************************************************/ ++/* */ ++/* Memory allocation debugging routines */ ++/* */ ++/*********************************************************************/ ++ ++#ifdef MEMDEBUG ++ ++void *mallocx(size_t, char *, int); ++void *callocx(size_t, size_t, char *, int); ++void *reallocx(void *, size_t, char *, int); ++void freex(void *, char *, int); ++ ++#define malloct(x) mallocx((x), __FILE__, __LINE__) ++#define calloct(x, y) callocx((x), (y), __FILE__, __LINE__) ++#define realloct(x, y) reallocx((x), (y), __FILE__, __LINE__) ++#define freet(x) freex((x), __FILE__, __LINE__) ++ ++#define malloc malloct ++#define calloc calloct ++#define realloc realloct ++#define free freet ++ ++#endif ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* General typedefs */ ++/* */ ++/*********************************************************************/ ++ ++typedef unsigned char byte; ++ ++#ifndef __cplusplus ++typedef unsigned short int bool; ++#endif ++ ++typedef unsigned short int Devaddr; ++ ++typedef struct diskaddr { ++ int cylinder; ++ int track; ++ int record; ++} Diskaddr; ++ ++ ++typedef struct record_id { ++ ++ char id[8]; ++ time_t write_timestamp; ++ ++} Record_ID; ++ ++ ++typedef struct location { ++ ++ union { ++ unsigned bsn; ++ char cs[9]; ++ unsigned short msn; ++ } loc; ++ ++ unsigned location_is_bsn:1, ++ location_is_cs:1, ++ location_is_msn:1; ++ ++} Location; ++ ++ ++ ++/*********************************************************************/ ++/*********************************************************************/ ++/* */ ++/* */ ++/* Functions specific defines, typedefs, and structures */ ++/* */ ++/* */ ++/*********************************************************************/ ++/*********************************************************************/ ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* Function prototype and structure(s) used in - */ ++/* */ ++/* bldstree - Build station information tree */ ++/* delstree - Delete station information tree */ ++/* getstinf - Get station information from tree */ ++/* */ ++/*********************************************************************/ ++ ++typedef struct stn_info_node { ++ int key; ++ int block; ++ int station; ++ int latitude; ++ int longitude; ++ int elev; ++ struct stn_info_node * right; ++ struct stn_info_node * left; ++} Stninfo; ++ ++struct stn_info_node *bldstree(void); ++void delstree(struct stn_info_node *); ++struct stn_info_node *getstinf(struct stn_info_node *, ++ int, ++ int); ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* Function prototype and structure(s) used in - */ ++/* */ ++/* capqread - Read bulletins from CAPQ chain */ ++/* */ ++/*********************************************************************/ ++ ++typedef struct CAPQ_data { ++ char * bulletin; ++ int bulletin_length; ++ char * WMO_heading; ++ char * AFOS_pil; ++ char * current_CAPQ_end_address; ++ int start_offset; ++ int record_count; ++ int end_offset; ++ char * bulletin_address; ++ int input_line; ++ int receive_line; ++ int receive_hour; ++ int receive_minute; ++ int CAPQ_day; ++ int CAPQ_hour; ++ int CAPQ_minute; ++ int rc; ++ char flag1; ++ char flag2; ++} CAPQdata; ++ ++struct CAPQ_data * capqread (char *, ...); ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* Function prototype and structure(s) used in - */ ++/* */ ++/* mdadread - Read bulletins from MDAD chain */ ++/* */ ++/*********************************************************************/ ++ ++typedef struct MDAD_data { ++ char * bulletin; ++ int bulletin_length; ++ char * WMO_heading; ++ char * AFOS_pil; ++ char * current_MDAD_end_address; ++ int start_offset; ++ int record_count; ++ int end_offset; ++ char * bulletin_address; ++ int input_line; ++ int receive_line; ++ int receive_hour; ++ int receive_minute; ++ int MDAD_year; ++ int MDAD_month; ++ int MDAD_day; ++ int MDAD_hour; ++ int MDAD_minute; ++ int rc; ++ int part_number; ++ int number_of_parts; ++ char MDAD_flag; ++ char flag1; ++ char flag2; ++ char flag3; ++ char MDAD_flag2; ++} MDADdata; ++ ++MDADdata * mdadread (char *, ...); ++ ++MDADdata * mdadscan (char *, ...); ++ ++void mdadinpt ( MDADdata *, char, bool ); ++ ++char * mdadnxtr ( void ); ++char * mdadnxtk ( void ); ++ ++ ++#define MDAD_HISTORY_LIMIT 39 ++ ++typedef ++struct MDAD_history_entry ++{ ++ unsigned short hour; ++ unsigned short minute; ++ Diskaddr MDAD_chain_addr; ++} ++MDAD_History_Entry; ++ ++typedef ++struct MDAD_history ++{ ++ MDAD_History_Entry history_array[MDAD_HISTORY_LIMIT]; ++} ++MDAD_History; ++ ++MDAD_History *mdadhist ( void ); ++ ++ ++/*********************************************************************/ ++/* */ ++/* Function prototype and structure(s) used in - */ ++/* */ ++/* gethdgi - Get bulletin heading information */ ++/* */ ++/*********************************************************************/ ++ ++typedef struct bltn_heading_info { ++ int bltn_day; ++ int bltn_hour; ++ int bltn_min; ++ int rtd_present; ++ int cor_present; ++ int amd_present; ++ char * first_report; ++ // char TTAAii??(7??); ++ // char CCCC??(5??); ++ char amd_seq; ++ char cor_seq; ++ char rtd_seq; ++} Abbrevhdg; ++ ++Abbrevhdg *gethdgi(char * ); ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* Function prototype and structure(s) used in - */ ++/* */ ++/* getime - Get current system time */ ++/* suspend - Delay execution until specified minute boundary */ ++/* */ ++/*********************************************************************/ ++ ++ ++typedef struct tm_struct{ ++ int hour; ++ int min; ++} Stime; ++ ++Stime *gettime(void); ++int suspend(Stime *, int); ++int timediff(Stime *, Stime *); ++#define timecmp timediff ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* Function prototype and structure(s) used in - */ ++/* */ ++/* rdtaend - Specify rdtaread Ending Address */ ++/* rdtaread - Read From RGTR Data Tank */ ++/* rdtastrt - Specify rdtaread Starting Address */ ++/* rdtatend - Specify rdtaread End Time */ ++/* rdtatnke - Specify rdtaread Ending Address */ ++/* rdtarstr - Specify rdtaread Start Time */ ++/* */ ++/*********************************************************************/ ++ ++typedef struct rgtrdata { ++ Diskaddr forward_chain; ++ Diskaddr bulletin_addr; ++ int receive_line; ++ int receive_day; ++ Stime receive_time; ++ Stime RGTR_time; ++ int length; ++ char *bulletin; ++ char datatype; ++} RGTRdata; ++ ++int rdtaend(char, Diskaddr *); ++int rdtaread(RGTRdata *); ++int rdtastrt(char, Diskaddr *); ++int rdtatend (char, Stime *); ++int rdtatnke(char); ++int rdtatstr(char, Stime *); ++void rdtainit(void); ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* Typedefs and function prototypes for bulletin and report parsing */ ++/* functions. */ ++/* */ ++/*********************************************************************/ ++ ++ ++ ++typedef struct rptNode { ++ char *rptPtr; ++ int rptLength; ++ struct rptNode* next; ++} RptNode; ++ ++ ++typedef struct synpBltn { ++ Abbrevhdg heading; ++ short int day; ++ short int hour; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} SynpBltn; ++ ++ ++typedef struct shipBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} ShipBltn; ++ ++ ++typedef struct tepiBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} TePiBltn; ++ ++ ++typedef struct drftBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} DrftBltn; ++ ++ ++typedef struct airpBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} AirpBltn; ++ ++ ++typedef struct amdrBltn { ++ Abbrevhdg heading; ++ short int day; ++ short int hour; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} AmdrBltn; ++ ++ ++typedef struct bthyBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} BthyBltn; ++ ++ ++typedef struct tescBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} TescBltn; ++ ++ ++typedef struct tracBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} TracBltn; ++ ++ ++typedef struct climBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ int month; ++ int year; ++ RptNode *rptList; ++ bool valid; ++} ClimBltn; ++ ++ ++typedef struct clmtBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ int month; ++ int year; ++ RptNode *rptList; ++ bool valid; ++} ClmtBltn; ++ ++ ++typedef struct metBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++ short int day; /* -1 indicates missing/invalid */ ++ short int hour; /* -1 indicates missing/invalid */ ++ short int min; /* -1 indicates missing/invalid */ ++} MetBltn; ++ ++ ++typedef struct saoBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} SAOBltn; ++ ++ ++typedef struct prBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} PRBltn; ++ ++ ++typedef struct tafBltn { ++ Abbrevhdg heading; ++ int reportCount; ++ RptNode *rptList; ++ bool valid; ++} TafBltn; ++ ++ ++typedef struct metrRptP { ++ char locind[4]; ++ int groupCount; ++ short int day; /* -1 indicates missing or invalid */ ++ short int hour; /* -1 indicates missing or invalid */ ++ short int min; /* -1 indicates missing or invalid */ ++ bool valid; ++} MetrRptP; ++ ++ ++typedef struct saoRptP { ++ char locind[4]; ++ int groupCount; ++ short int hour; /* -1 indicates missing or invalid */ ++ short int min; /* -1 indicates missing or invalid */ ++ bool valid; ++} SAORptP; ++ ++ ++typedef struct prRptP { ++ char locind[4]; ++ int groupCount; ++ short int hour; /* -1 indicates missing or invalid */ ++ short int min; /* -1 indicates missing or invalid */ ++ bool valid; ++} PRRptP; ++ ++ ++typedef struct tafRptP { ++ char locind[4]; ++ int groupCount; ++ short int YY; ++ short int GG; ++ short int validPeriod; ++ bool ammendment; ++ bool correction; ++ bool valid; ++} TafRptP; ++ ++ ++typedef struct synpRptP { ++ short int II; ++ short int iii; ++ int groupCount; ++ bool valid; ++} SynpRptP; ++ ++ ++typedef struct climRptP { ++ short int II; ++ short int iii; ++ int groupCount; ++ bool valid; ++} ClimRptP; ++ ++ ++typedef struct clmtRptP { ++ short int II; ++ short int iii; ++ int groupCount; ++ bool valid; ++} ClmtRptP; ++ ++ ++typedef struct tepiRptP { ++ short int II; ++ short int iii; ++ short int YY; ++ short int GG; ++ short int quad; ++ short int ulatitude; ++ short int ulongitude; ++ int msquare; ++ int latitude; ++ int longitude; ++ int groupCount; ++ char callsign[15]; ++ char type; ++ char part; ++ bool valid; ++} TePiRptP; ++ ++ ++SynpBltn *pbsynp(char *); ++ShipBltn *pbship(char *); ++TePiBltn *pbtepi(char *); ++DrftBltn *pbdrft(char *); ++AirpBltn *pbairp(char *); ++AmdrBltn *pbamdr(char *); ++BthyBltn *pbbthy(char *); ++TescBltn *pbtesc(char *); ++TracBltn *pbtrac(char *); ++ClimBltn *pbclim(char *); ++ClmtBltn *pbclmt(char *); ++MetBltn *pbmetr(char *); ++MetBltn *pbspec(char *); ++TafBltn *pbtaf(char *); ++SAOBltn *pbsao(char *); ++PRBltn *pbpirep(char *); ++ ++SynpRptP *prpsynp(char *, int); ++TePiRptP *prptepi(char *, int); ++ClimRptP *prpclim(char *, int); ++ClmtRptP *prpclmt(char *, int); ++MetrRptP *prpmetr(char *, int); ++TafRptP *prptaf(char *, int); ++SAORptP *prpsao(char *, int); ++PRRptP *prppirep(char *, int); ++ ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* Structures and Function Prototypes for RRN physical I/O */ ++/* */ ++/*********************************************************************/ ++ ++ ++typedef struct RRN_device { ++ ++ char name[44], ++ ownerid[8]; ++ ++ unsigned short dev_addr, ++ base_cylinder, ++ base_track, ++ base_record, ++ max_cylinder, ++ max_track, ++ max_record, ++ records_per_track, ++ tracks_per_cylinder, ++ record_length; ++ ++} RRN_Device; ++ ++ ++bool readrrn(char *device_name, ++ unsigned int rrn, ++ void *input_buffer, ++ unsigned int read_count); ++ ++bool writerrn(char *device_name, ++ unsigned int rrn, ++ void *output_buffer, ++ unsigned int write_count); ++ ++RRN_Device *devinfo(char *device_name); ++ ++bool valid_dn(char *device_name); ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* Function prototype for string value test functions. */ ++/* */ ++/*********************************************************************/ ++ ++ ++int sisalnum(char *); ++int sisalpha(char *); ++int siscntrl(char *); ++int sisdigit(char *); ++int sisgraph(char *); ++int sislower(char *); ++int sisprint(char *); ++int sispunct(char *); ++int sisspace(char *); ++int sisupper(char *); ++int sisxdigi(char *); ++ ++int nisalnum(char *, int); ++int nisalpha(char *, int); ++int niscntrl(char *, int); ++int nisdigit(char *, int); ++int nisgraph(char *, int); ++int nislower(char *, int); ++int nisprint(char *, int); ++int nispunct(char *, int); ++int nisspace(char *, int); ++int nisupper(char *, int); ++int nisxdigi(char *, int); ++ ++char *nxtalnum(char *); ++char *nxtalpha(char *); ++char *nxtcntrl(char *); ++char *nxtdigit(char *); ++char *nxtgraph(char *); ++char *nxtlower(char *); ++char *nxtprint(char *); ++char *nxtpunct(char *); ++char *nxtspace(char *); ++char *nxtupper(char *); ++char *nxtxdigi(char *); ++ ++char *lstalnum(char *, int); ++char *lstalpha(char *, int); ++char *lstcntrl(char *, int); ++char *lstdigit(char *, int); ++char *lstgraph(char *, int); ++char *lstlower(char *, int); ++char *lstprint(char *, int); ++char *lstpunct(char *, int); ++char *lstspace(char *, int); ++char *lstupper(char *, int); ++char *lstxdigi(char *, int); ++ ++ ++/*********************************************************************/ ++/* */ ++/* Enumeration type and declaration for code form identification */ ++/* function */ ++/* */ ++/*********************************************************************/ ++ ++ ++typedef ++enum codeform {AIREP, AMDAR, ARFOR, ARMET, BATHY, CLIMAT, CLIMAT_SHIP, ++ CLIMAT_TEMP, CLIMAT_TEMP_SHIP, CODAR, DRIFTER, FC, ++ HYFOR, IAC, IAC_FLEET, ICEAN, METAR, PILOT, PILOT_MOBILE, ++ PILOT_SHIP, RECCO, ROCOB, ROCOB_SHIP, ROFOR, SAO, PIREP, ++ SATEM, SATOB, SHIP, SPECI, SYNOP, TAF, TEMP, TEMP_DROP, ++ TEMP_MOBILE, TEMP_SHIP, TESAC, TRACKOB, WAVEOB, ++ UNKNOWN_FORM, TEMP_A, TEMP_B, TEMP_C, TEMP_D, ++ TEMP_DROP_A, TEMP_DROP_B, TEMP_DROP_C, TEMP_DROP_D, ++ TEMP_MOBILE_A, TEMP_MOBILE_B, TEMP_MOBILE_C, ++ TEMP_MOBILE_D, TEMP_SHIP_A, TEMP_SHIP_B, TEMP_SHIP_C, ++ TEMP_SHIP_D, PILOT_A, PILOT_B, PILOT_C, PILOT_D, ++ PILOT_MOBILE_A, PILOT_MOBILE_B, PILOT_MOBILE_C, ++ PILOT_MOBILE_D, PILOT_SHIP_A, PILOT_SHIP_B, ++ PILOT_SHIP_C, PILOT_SHIP_D } ++CodeForm; ++ ++CodeForm idcode(char *); ++ ++char *codename(CodeForm); ++CodeForm name2cf ( char * ); ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* String manipulation functions */ ++/* */ ++/*********************************************************************/ ++ ++ ++char *strnlf(char *, size_t); ++char *strnmid(char *, size_t, size_t); ++char *strnrt(char *, size_t); ++char *strrstr(char *, char *); ++char *strcentr(char *, size_t); ++char *strdel(char *, char *, size_t); ++char *strins(char *, char *, char *); ++char *strljust(char * , size_t); ++char *strltrim(char *, char *); ++char *strmrplc(char *, char *, char *); ++char *strocat(char *, char *); ++char *strrpt(char *, char *, size_t); ++char *strrjust(char *, size_t); ++char *strrplc(char * , char *, char *); ++char *strrtrim(char * , char *); ++char *strtrim(char *, char *); ++char *strvcat(char *, char *, ...); ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* Bulletin Generator declarations */ ++/* */ ++/*********************************************************************/ ++ ++typedef bool (*ParseBltnFnPtr) ( char *bltn, ++ char **rptPtr, ++ char *bbbTypePtr, ++ char **prefixPtr, ++ short *YYPtr, ++ short *GGPtr, ++ char *bltnTypePtr, ++ char **headingPtr ); ++ ++void cbltngen ( ParseBltnFnPtr fnPtr, ++ char *filename, ++ Devaddr *historyDevice, ++ Diskaddr *historyAddr, ++ unsigned * bltnInCountPtr, ++ unsigned * bltnOutCountPtr, ++ unsigned * rptOutCountPtr ); ++ ++void tbltngen ( ParseBltnFnPtr fnPtr, ++ char *filename, ++ Devaddr *historyDevice, ++ Diskaddr *historyAddr, ++ unsigned * bltnInCountPtr, ++ unsigned * bltnOutCountPtr, ++ unsigned * rptOutCountPtr ); ++ ++ ++typedef bool (*ParseBltnFnPtrX) ( char *bltn, ++ char **rptPtr, ++ char *bbbTypePtr, ++ char **prefixPtr, ++ short *YYPtr, ++ short *GGPtr, ++ short *ggPtr, ++ char *bltnTypePtr, ++ char **headingPtr ); ++ ++void xbltngen ( ParseBltnFnPtrX fnPtr, ++ char *filename, ++ Devaddr *historyDevice, ++ Diskaddr *historyAddr, ++ unsigned * bltnInCountPtr, ++ unsigned * bltnOutCountPtr, ++ unsigned * rptOutCountPtr ); ++ ++void dbltngen ( ParseBltnFnPtrX fnPtr, ++ char *filename, ++ Devaddr *historyDevice, ++ Diskaddr *historyAddr, ++ unsigned * bltnInCountPtr, ++ unsigned * bltnOutCountPtr, ++ unsigned * rptOutCountPtr ); ++ ++typedef bool (*OParseBltnFnPtr) ( char *bltn, ++ char **rptPtr, ++ char *bbbTypePtr, ++ char **prefixPtr, ++ short *YYPtr, ++ short *GGPtr, ++ char *bltnTypePtr, ++ char **headingPtr, ++ char **ccccPtr ); ++ ++void obltngen ( OParseBltnFnPtr fnPtr, ++ char *filename, ++ Devaddr *historyDevice, ++ Diskaddr *historyAddr, ++ unsigned * bltnInCountPtr, ++ unsigned * bltnOutCountPtr, ++ unsigned * rptOutCountPtr ); ++ ++ ++void pbltngen ( OParseBltnFnPtr fnPtr, ++ char *filename, ++ Devaddr *historyDevice, ++ Diskaddr *historyAddr, ++ unsigned * bltnInCountPtr, ++ unsigned * bltnOutCountPtr, ++ unsigned * rptOutCountPtr ); ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* Typedefs and function prototypes for retrieving information from */ ++/* switching directory. */ ++/* */ ++/*********************************************************************/ ++ ++typedef struct bltn_history{ ++ Diskaddr bltn_disk_addr; ++ unsigned short bltn_start_offset; ++ unsigned short bltn_record_count; ++ unsigned short bltn_end_offset; ++ time_t bltn_time_recvd; ++} BltnHistory; ++ ++/* ++typedef struct sw_dir_info_rec { ++ char wmo_header[11]; ++ char AFOS_pil[10]; ++ char multiple_line; ++ short int line_num; ++ short int recvd_line; ++ char flag1; ++ char flag2; ++ char flag3; ++ char class; ++ short int domestic_cat_num; ++ char afos_tmp; ++ char ccb[2]; ++ char region_addr; ++ short int output_line_count; ++ unsigned short trans_line[128]; ++ time_t change_date; ++ char dir_flags; ++ Diskaddr history_file_addr; ++ BltnHistory bltn_history[4]; ++} SwDirInfo; ++ ++SwDirInfo *rtswdir(char *, int); ++SwDirInfo *rtpswdir(void); ++SwDirInfo *rtnswdir(void); ++ ++ */ ++ ++ ++ ++/*********************************************************************/ ++/* */ ++/* General local functions */ ++/* */ ++/*********************************************************************/ ++ ++ ++int itoc(int, char *, int); ++ ++int antoi(char *, int); ++ ++float antof(char *, int); ++ ++void errmsg(char *, ...); ++ ++void logmsg(char *, ...); ++ ++void opermsg(char *, ...); ++ ++int lmsg(const char *, const char *, ...); ++int emsg(const char *, const char *, ...); ++int omsg(const char *, const char *, ...); ++ ++//#pragma linkage(ASCTOEB, OS) ++void ASCTOEB(char *, int); ++ ++//#pragma linkage(EAXLATE, OS) ++void EAXLATE(char *, int); ++ ++//#pragma linkage(PASCTOEB, OS) ++void PASCTOEB(char *, int); ++ ++char **bldhdarr(char *); ++ ++void dalchdar(char **); ++ ++//#pragma linkage(CCAPREAD, OS) ++void *CCAPREAD(char *, int); ++ ++//#pragma linkage(CCAPWRIT, OS) ++void CCAPWRIT(char *, char *, int); ++ ++//#pragma linkage(PPTOI, OS) ++int PPTOI(char); ++ ++char itopp(int); ++ ++int diffmin(int, int, int, int, int, int); ++ ++char incrseq(char); ++ ++void nextdate(int *, int *, int *); ++ ++void prevdate(int *, int *, int *); ++ ++void rdstaddr(char *, char *); ++ ++int wrenaddr(char *, char *); ++ ++int vfydigit (char *, int); ++ ++int readline(char * , int); ++ ++int prevjul(int, int); ++ ++int nextjul(int, int); ++ ++int fcomppos(fpos_t *, fpos_t *); ++ ++void lfprint(char *); ++ ++void flfprint(FILE *, char *); ++ ++void slfprint(char *, int, char *); ++ ++void flfnprnt(FILE *, char *, int); ++ ++void slfnprnt(char *, int, char *, int); ++ ++int strhash(char *); ++ ++void reverse(char *); ++ ++//bool itoa(int, char *, int); ++ ++int getsnn(char * , int); ++ ++int fgetsnn(char *, int, FILE *); ++ ++int getreply(char *, char *, int); ++ ++bool strfit(char *, char *, size_t); ++ ++bool addrfrm3(char *, Diskaddr *); ++ ++bool addrfrm5(char *, Diskaddr *); ++ ++bool addrto3(Diskaddr *, char *); ++ ++bool addrto5(Diskaddr *, char *); ++ ++int addrcmp(Diskaddr *, Diskaddr *); ++ ++void incraddr(Diskaddr *, Diskaddr *, Diskaddr *); ++void decraddr(Diskaddr *, Diskaddr *, Diskaddr *); ++ ++//#pragma linkage(readrec, OS) ++char *readrec(Diskaddr *, Devaddr *, int, void *); ++ ++//#pragma linkage(writerec, OS) ++int writerec(Diskaddr*, Devaddr *, int, void *); ++ ++char prhold(char *, ...); ++ ++void dump(char *, int); ++ ++void fdump(FILE *, char *, int); ++ ++void fwdump(FILE *, char *, int); ++ ++//char toascii(char); ++ ++char *strtoas(char *); ++ ++char *strntoas(char *, int); ++ ++char toebcdic(char); ++ ++char *strtoeb(char *); ++ ++char *strntoeb(char *, int); ++ ++char *lfind(char *, char *, int, int, int(*)(char *, char *)); ++ ++char *lsearch(char *, char *, int *, int, int(*)(char *, char *)); ++ ++bool strcmpw(char *, char *); ++ ++int strccnt(char *, int); ++ ++int strnccnt(char *, int, size_t); ++ ++int pprt(FILE *, char *, char *, char *, char *, ...); ++ ++bool pprtbrk(FILE *, char *, char *, char *); ++ ++bool pprtend(FILE *, char *); ++ ++bool pprtinit(int, char, char *, char *, char *); ++ ++char *monthnam(int, char); ++ ++char *getrec(FILE *, int, char *); ++ ++bool jtog(int, int, int *, int *, int *); ++ ++bool gtoj(int, int, int, int *, int *); ++ ++bool ccap2std(char *, Devaddr *, Diskaddr *); ++ ++bool std2ccap(Devaddr *, Diskaddr *, char *); ++ ++char *strupr(char *); ++char *strlwr(char *); ++//char *strdup(char *); ++//int strcmpi(char *, char *); ++ ++//void *memccpy(void *, void *, int, unsigned); ++ ++char *rptstrip(char *); ++char *rptfmt(char *); ++char *rptfmti(char *, unsigned short int); ++ ++char *strnstr(char *, char *, size_t); ++ ++int stregion(int); ++int ccregion(char *); ++char *rgnname(int); ++ ++void *memrchr(const void *, int, size_t); ++ ++bool sysmonms(char *, char *, ...); ++bool sysmoncl(char *); ++ ++short prevndx ( short max, short min, short current ); ++short nextndx ( short max, short min, short current ); ++ ++time_t extrym ( unsigned day, unsigned hour, unsigned minute ); ++time_t extrymd ( unsigned hour, unsigned minute ); ++ ++int cmptimet ( time_t t1, time_t t2 ); ++ ++int tfprintf ( FILE *, const char *, ... ); ++ ++bool purgelog ( char *filename, unsigned short delete_age ); ++ ++time_t odbtime ( void ); ++ ++int bltnpcnt ( char *, int ); ++void bltnpage ( char *, int, int ); ++ ++void rot( char *, unsigned int ); ++void unrot( char *, unsigned int ); ++ ++void encrypt( char *, char * ); ++void decrypt( char *, char * ); ++ ++int HEXTOI( char *, int ); ++ ++char **hdgxref( char * ); ++ ++struct tm *zonetime( unsigned short, unsigned short, char ); ++ ++int wordcnt( char * ); ++int wordcntn( char *, unsigned int ); ++ ++char *word( char *, unsigned int ); ++char *wordn( char *, unsigned int, unsigned int ); ++ ++char *crlfstrp( char * ); ++ ++bool charcmp( char *, char * ); ++ ++int linecnt( char * ); ++int linecntn( char *, unsigned int ); ++ ++char *bltline( char *, unsigned int ); ++char *bltlinen( char *, unsigned int, unsigned int ); ++ ++char *pttoline( char *, unsigned int ); ++char *pttoword( char *, unsigned int ); ++ ++char *moblrgn(unsigned short, ++ unsigned short, ++ unsigned short ); ++ ++char *nxtgroup( char * ); ++ ++#endif diff --cc simgear/metar/Makefile index 00000000,00000000..b1e1595f new file mode 100644 --- /dev/null +++ b/simgear/metar/Makefile @@@ -1,0 -1,0 +1,305 @@@ ++# Generated automatically from Makefile.in by configure. ++# Makefile.in generated automatically by automake 1.3 from Makefile.am ++ ++# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++ ++SHELL = /bin/sh ++ ++srcdir = . ++top_srcdir = ../.. ++prefix = /h/curt ++exec_prefix = ${prefix} ++ ++bindir = /h/curt/bin/Linux ++sbindir = ${exec_prefix}/sbin ++libexecdir = ${exec_prefix}/libexec ++datadir = ${prefix}/share ++sysconfdir = ${prefix}/etc ++sharedstatedir = ${prefix}/com ++localstatedir = ${prefix}/var ++libdir = ${exec_prefix}/lib ++infodir = ${prefix}/info ++mandir = ${prefix}/man ++includedir = ${prefix}/include ++oldincludedir = /usr/include ++ ++DISTDIR = ++ ++pkgdatadir = $(datadir)/FlightGear ++pkglibdir = $(libdir)/FlightGear ++pkgincludedir = $(includedir)/FlightGear ++ ++top_builddir = ../.. ++ ++ACLOCAL = aclocal ++AUTOCONF = autoconf ++AUTOMAKE = automake ++AUTOHEADER = autoheader ++ ++INSTALL = /usr/bin/install -c ++INSTALL_PROGRAM = ${INSTALL} ++INSTALL_DATA = ${INSTALL} -m 644 ++INSTALL_SCRIPT = ${INSTALL_PROGRAM} ++transform = s,x,x, ++ ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++CC = egcc ++CXX = c++ ++LN_S = ln -s ++MAKEINFO = /h/curt/projects/FlightGear-0.7/missing makeinfo ++PACKAGE = FlightGear ++RANLIB = ranlib ++VERSION = 0.7.2 ++audio_LIBS = -lsl -lsm ++base_LIBS = -lm ++opengl_LIBS = -lglut -lMesaGLU -lMesaGL -lXmu -lXt -lSM -lICE -lXi -lXext -lX11 -lm ++ ++noinst_LIBRARIES = libMetar.a ++ ++libMetar_a_SOURCES = \ ++ Antoi.cpp Charcmp.cpp Dcdmetar.cpp Dcdmtrmk.cpp Drvmetar.c \ ++ Fracpart.cpp Local.h Metar.h \ ++ MetarReport.cpp MetarReport.h \ ++ MetarStation.cpp MetarStation.h \ ++ Prtdmetr.cpp Stspack2.cpp Stspack3.cpp ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = ../../Include/config.h ++CONFIG_CLEAN_FILES = ++LIBRARIES = $(noinst_LIBRARIES) ++ ++ ++DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I../../Include ++CPPFLAGS = -I/usr/local/include -I/usr/local/plib/include -I/usr/X11R6/include ++LDFLAGS = -L/h/curt/lib -L/usr/local/lib -L/usr/local/plib/lib -L/usr/X11R6/lib ++LIBS = -lm ++X_CFLAGS = -I/usr/X11R6/include ++X_LIBS = -L/usr/X11R6/lib ++X_EXTRA_LIBS = ++X_PRE_LIBS = -lSM -lICE ++libMetar_a_LIBADD = ++libMetar_a_OBJECTS = Antoi.o Charcmp.o Dcdmetar.o Dcdmtrmk.o Drvmetar.o \ ++Fracpart.o MetarReport.o MetarStation.o Prtdmetr.o Stspack2.o \ ++Stspack3.o ++AR = ar ++CXXFLAGS = -Wall -fomit-frame-pointer -ffast-math -funroll-loops -mpentium ++CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++CXXLINK = $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ ++CFLAGS = -Wall -fomit-frame-pointer -ffast-math -funroll-loops -mpentium ++COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) ++LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ++DIST_COMMON = Makefile.am Makefile.in ++ ++ ++DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ++ ++TAR = tar ++GZIP = --best ++DEP_FILES = .deps/Antoi.P .deps/Charcmp.P .deps/Dcdmetar.P \ ++.deps/Dcdmtrmk.P .deps/Drvmetar.P .deps/Fracpart.P .deps/MetarReport.P \ ++.deps/MetarStation.P .deps/Prtdmetr.P .deps/Stspack2.P .deps/Stspack3.P ++CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++SOURCES = $(libMetar_a_SOURCES) ++OBJECTS = $(libMetar_a_OBJECTS) ++ ++all: Makefile $(LIBRARIES) ++ ++.SUFFIXES: ++.SUFFIXES: .S .c .cpp .o .s ++$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu Lib/Metar/Makefile ++ ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++ ++mostlyclean-noinstLIBRARIES: ++ ++clean-noinstLIBRARIES: ++ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) ++ ++distclean-noinstLIBRARIES: ++ ++maintainer-clean-noinstLIBRARIES: ++ ++.s.o: ++ $(COMPILE) -c $< ++ ++.S.o: ++ $(COMPILE) -c $< ++ ++mostlyclean-compile: ++ -rm -f *.o core *.core ++ ++clean-compile: ++ ++distclean-compile: ++ -rm -f *.tab.c ++ ++maintainer-clean-compile: ++ ++libMetar.a: $(libMetar_a_OBJECTS) $(libMetar_a_DEPENDENCIES) ++ -rm -f libMetar.a ++ $(AR) cru libMetar.a $(libMetar_a_OBJECTS) $(libMetar_a_LIBADD) ++ $(RANLIB) libMetar.a ++.cpp.o: ++ $(CXXCOMPILE) -c $< ++ ++tags: TAGS ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) ++ here=`pwd` && cd $(srcdir) \ ++ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) ++ ++TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ ++ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ ++mostlyclean-tags: ++ ++clean-tags: ++ ++distclean-tags: ++ -rm -f TAGS ID ++ ++maintainer-clean-tags: ++ ++distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) ++ ++subdir = Lib/Metar ++ ++distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Lib/Metar/Makefile ++ @for file in $(DISTFILES); do \ ++ d=$(srcdir); \ ++ test -f $(distdir)/$$file \ ++ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ++ || cp -p $$d/$$file $(distdir)/$$file; \ ++ done ++ ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ ++maintainer-clean-depend: ++ -rm -rf .deps ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++ ++%.o: %.cpp ++ @echo '$(CXXCOMPILE) -c $<'; \ ++ $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.cpp ++ @echo '$(LTCXXCOMPILE) -c $<'; \ ++ $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++info: ++dvi: ++check: all ++ $(MAKE) ++installcheck: ++install-exec: ++ @$(NORMAL_INSTALL) ++ ++install-data: ++ @$(NORMAL_INSTALL) ++ ++install: install-exec install-data all ++ @: ++ ++uninstall: ++ ++install-strip: ++ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install ++installdirs: ++ ++ ++mostlyclean-generic: ++ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f Makefile $(DISTCLEANFILES) ++ -rm -f config.cache config.log stamp-h stamp-h[0-9]* ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) ++ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) ++mostlyclean: mostlyclean-noinstLIBRARIES mostlyclean-compile \ ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic ++ ++clean: clean-noinstLIBRARIES clean-compile clean-tags clean-depend \ ++ clean-generic mostlyclean ++ ++distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \ ++ distclean-depend distclean-generic clean ++ -rm -f config.status ++ ++maintainer-clean: maintainer-clean-noinstLIBRARIES \ ++ maintainer-clean-compile maintainer-clean-tags \ ++ maintainer-clean-depend maintainer-clean-generic \ ++ distclean ++ @echo "This command is intended for maintainers to use;" ++ @echo "it deletes files that may require special tools to rebuild." ++ ++.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ ++clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ ++mostlyclean-compile distclean-compile clean-compile \ ++maintainer-clean-compile tags mostlyclean-tags distclean-tags \ ++clean-tags maintainer-clean-tags distdir mostlyclean-depend \ ++distclean-depend clean-depend maintainer-clean-depend info dvi \ ++installcheck install-exec install-data install uninstall all \ ++installdirs mostlyclean-generic distclean-generic clean-generic \ ++maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++ ++ ++INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib ++ ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --cc simgear/metar/Makefile.am index 00000000,00000000..5916aa93 new file mode 100644 --- /dev/null +++ b/simgear/metar/Makefile.am @@@ -1,0 -1,0 +1,12 @@@ ++## Process this file with automake to produce Makefile.in ++ ++lib_LIBRARIES = libsgmetar.a ++ ++libsgmetar_a_SOURCES = \ ++ Antoi.cpp Charcmp.cpp Dcdmetar.cpp Dcdmtrmk.cpp Drvmetar.c \ ++ Fracpart.cpp Local.h Metar.h \ ++ MetarReport.cpp MetarReport.h \ ++ MetarStation.cpp MetarStation.h \ ++ Prtdmetr.cpp Stspack2.cpp Stspack3.cpp ++ ++INCLUDES += -I$(top_builddir) diff --cc simgear/metar/Makefile.in index 00000000,00000000..d89e59b5 new file mode 100644 --- /dev/null +++ b/simgear/metar/Makefile.in @@@ -1,0 -1,0 +1,305 @@@ ++# Makefile.in generated automatically by automake 1.3 from Makefile.am ++ ++# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++ ++SHELL = /bin/sh ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++prefix = @prefix@ ++exec_prefix = @exec_prefix@ ++ ++bindir = @bindir@ ++sbindir = @sbindir@ ++libexecdir = @libexecdir@ ++datadir = @datadir@ ++sysconfdir = @sysconfdir@ ++sharedstatedir = @sharedstatedir@ ++localstatedir = @localstatedir@ ++libdir = @libdir@ ++infodir = @infodir@ ++mandir = @mandir@ ++includedir = @includedir@ ++oldincludedir = /usr/include ++ ++DISTDIR = ++ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++ ++top_builddir = ../.. ++ ++ACLOCAL = @ACLOCAL@ ++AUTOCONF = @AUTOCONF@ ++AUTOMAKE = @AUTOMAKE@ ++AUTOHEADER = @AUTOHEADER@ ++ ++INSTALL = @INSTALL@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++transform = @program_transform_name@ ++ ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++CC = @CC@ ++CXX = @CXX@ ++LN_S = @LN_S@ ++MAKEINFO = @MAKEINFO@ ++PACKAGE = @PACKAGE@ ++RANLIB = @RANLIB@ ++VERSION = @VERSION@ ++audio_LIBS = @audio_LIBS@ ++base_LIBS = @base_LIBS@ ++opengl_LIBS = @opengl_LIBS@ ++ ++noinst_LIBRARIES = libMetar.a ++ ++libMetar_a_SOURCES = \ ++ Antoi.cpp Charcmp.cpp Dcdmetar.cpp Dcdmtrmk.cpp Drvmetar.c \ ++ Fracpart.cpp Local.h Metar.h \ ++ MetarReport.cpp MetarReport.h \ ++ MetarStation.cpp MetarStation.h \ ++ Prtdmetr.cpp Stspack2.cpp Stspack3.cpp ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = ../../Include/config.h ++CONFIG_CLEAN_FILES = ++LIBRARIES = $(noinst_LIBRARIES) ++ ++ ++DEFS = @DEFS@ -I. -I$(srcdir) -I../../Include ++CPPFLAGS = @CPPFLAGS@ ++LDFLAGS = @LDFLAGS@ ++LIBS = @LIBS@ ++X_CFLAGS = @X_CFLAGS@ ++X_LIBS = @X_LIBS@ ++X_EXTRA_LIBS = @X_EXTRA_LIBS@ ++X_PRE_LIBS = @X_PRE_LIBS@ ++libMetar_a_LIBADD = ++libMetar_a_OBJECTS = Antoi.o Charcmp.o Dcdmetar.o Dcdmtrmk.o Drvmetar.o \ ++Fracpart.o MetarReport.o MetarStation.o Prtdmetr.o Stspack2.o \ ++Stspack3.o ++AR = ar ++CXXFLAGS = @CXXFLAGS@ ++CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++CXXLINK = $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ ++CFLAGS = @CFLAGS@ ++COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) ++LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ++DIST_COMMON = Makefile.am Makefile.in ++ ++ ++DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ++ ++TAR = tar ++GZIP = --best ++DEP_FILES = .deps/Antoi.P .deps/Charcmp.P .deps/Dcdmetar.P \ ++.deps/Dcdmtrmk.P .deps/Drvmetar.P .deps/Fracpart.P .deps/MetarReport.P \ ++.deps/MetarStation.P .deps/Prtdmetr.P .deps/Stspack2.P .deps/Stspack3.P ++CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++SOURCES = $(libMetar_a_SOURCES) ++OBJECTS = $(libMetar_a_OBJECTS) ++ ++all: Makefile $(LIBRARIES) ++ ++.SUFFIXES: ++.SUFFIXES: .S .c .cpp .o .s ++$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu Lib/Metar/Makefile ++ ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++ ++mostlyclean-noinstLIBRARIES: ++ ++clean-noinstLIBRARIES: ++ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) ++ ++distclean-noinstLIBRARIES: ++ ++maintainer-clean-noinstLIBRARIES: ++ ++.s.o: ++ $(COMPILE) -c $< ++ ++.S.o: ++ $(COMPILE) -c $< ++ ++mostlyclean-compile: ++ -rm -f *.o core *.core ++ ++clean-compile: ++ ++distclean-compile: ++ -rm -f *.tab.c ++ ++maintainer-clean-compile: ++ ++libMetar.a: $(libMetar_a_OBJECTS) $(libMetar_a_DEPENDENCIES) ++ -rm -f libMetar.a ++ $(AR) cru libMetar.a $(libMetar_a_OBJECTS) $(libMetar_a_LIBADD) ++ $(RANLIB) libMetar.a ++.cpp.o: ++ $(CXXCOMPILE) -c $< ++ ++tags: TAGS ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) ++ here=`pwd` && cd $(srcdir) \ ++ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) ++ ++TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ ++ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ ++mostlyclean-tags: ++ ++clean-tags: ++ ++distclean-tags: ++ -rm -f TAGS ID ++ ++maintainer-clean-tags: ++ ++distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) ++ ++subdir = Lib/Metar ++ ++distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Lib/Metar/Makefile ++ @for file in $(DISTFILES); do \ ++ d=$(srcdir); \ ++ test -f $(distdir)/$$file \ ++ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ++ || cp -p $$d/$$file $(distdir)/$$file; \ ++ done ++ ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ ++maintainer-clean-depend: ++ -rm -rf .deps ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++ ++%.o: %.cpp ++ @echo '$(CXXCOMPILE) -c $<'; \ ++ $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.cpp ++ @echo '$(LTCXXCOMPILE) -c $<'; \ ++ $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++info: ++dvi: ++check: all ++ $(MAKE) ++installcheck: ++install-exec: ++ @$(NORMAL_INSTALL) ++ ++install-data: ++ @$(NORMAL_INSTALL) ++ ++install: install-exec install-data all ++ @: ++ ++uninstall: ++ ++install-strip: ++ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install ++installdirs: ++ ++ ++mostlyclean-generic: ++ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f Makefile $(DISTCLEANFILES) ++ -rm -f config.cache config.log stamp-h stamp-h[0-9]* ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) ++ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) ++mostlyclean: mostlyclean-noinstLIBRARIES mostlyclean-compile \ ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic ++ ++clean: clean-noinstLIBRARIES clean-compile clean-tags clean-depend \ ++ clean-generic mostlyclean ++ ++distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \ ++ distclean-depend distclean-generic clean ++ -rm -f config.status ++ ++maintainer-clean: maintainer-clean-noinstLIBRARIES \ ++ maintainer-clean-compile maintainer-clean-tags \ ++ maintainer-clean-depend maintainer-clean-generic \ ++ distclean ++ @echo "This command is intended for maintainers to use;" ++ @echo "it deletes files that may require special tools to rebuild." ++ ++.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ ++clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ ++mostlyclean-compile distclean-compile clean-compile \ ++maintainer-clean-compile tags mostlyclean-tags distclean-tags \ ++clean-tags maintainer-clean-tags distdir mostlyclean-depend \ ++distclean-depend clean-depend maintainer-clean-depend info dvi \ ++installcheck install-exec install-data install uninstall all \ ++installdirs mostlyclean-generic distclean-generic clean-generic \ ++maintainer-clean-generic clean mostlyclean distclean maintainer-clean ++ ++ ++INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib ++ ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --cc simgear/metar/Metar.dsp index 00000000,00000000..856fe2b9 new file mode 100644 --- /dev/null +++ b/simgear/metar/Metar.dsp @@@ -1,0 -1,0 +1,149 @@@ ++# Microsoft Developer Studio Project File - Name="Metar" - Package Owner=<4> ++# Microsoft Developer Studio Generated Build File, Format Version 6.00 ++# ** DO NOT EDIT ** ++ ++# TARGTYPE "Win32 (x86) Static Library" 0x0104 ++ ++CFG=Metar - Win32 Debug ++!MESSAGE This is not a valid makefile. To build this project using NMAKE, ++!MESSAGE use the Export Makefile command and run ++!MESSAGE ++!MESSAGE NMAKE /f "Metar.mak". ++!MESSAGE ++!MESSAGE You can specify a configuration when running NMAKE ++!MESSAGE by defining the macro CFG on the command line. For example: ++!MESSAGE ++!MESSAGE NMAKE /f "Metar.mak" CFG="Metar - Win32 Debug" ++!MESSAGE ++!MESSAGE Possible choices for configuration are: ++!MESSAGE ++!MESSAGE "Metar - Win32 Release" (based on "Win32 (x86) Static Library") ++!MESSAGE "Metar - Win32 Debug" (based on "Win32 (x86) Static Library") ++!MESSAGE ++ ++# Begin Project ++# PROP AllowPerConfigDependencies 0 ++# PROP Scc_ProjName "" ++# PROP Scc_LocalPath "" ++CPP=cl.exe ++RSC=rc.exe ++ ++!IF "$(CFG)" == "Metar - Win32 Release" ++ ++# PROP BASE Use_MFC 0 ++# PROP BASE Use_Debug_Libraries 0 ++# PROP BASE Output_Dir "Release" ++# PROP BASE Intermediate_Dir "Release" ++# PROP BASE Target_Dir "" ++# PROP Use_MFC 0 ++# PROP Use_Debug_Libraries 0 ++# PROP Output_Dir "Release" ++# PROP Intermediate_Dir "Release" ++# PROP Target_Dir "" ++# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c ++# ADD CPP /nologo /G6 /W3 /GX /Zi /O2 /I "..\..\..\lib" /I "..\lib" /I "..\..\lib" /I "..\..\..\..\lib" /I ".." /I "..\.." /I "..\..\.." /I "..\..\..\.." /I "..\include" /I "..\..\include" /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c ++# SUBTRACT CPP /YX ++# ADD BASE RSC /l 0x409 /d "NDEBUG" ++# ADD RSC /l 0x409 /d "NDEBUG" ++BSC32=bscmake.exe ++# ADD BASE BSC32 /nologo ++# ADD BSC32 /nologo ++LIB32=link.exe -lib ++# ADD BASE LIB32 /nologo ++# ADD LIB32 /nologo ++ ++!ELSEIF "$(CFG)" == "Metar - Win32 Debug" ++ ++# PROP BASE Use_MFC 0 ++# PROP BASE Use_Debug_Libraries 1 ++# PROP BASE Output_Dir "Debug" ++# PROP BASE Intermediate_Dir "Debug" ++# PROP BASE Target_Dir "" ++# PROP Use_MFC 0 ++# PROP Use_Debug_Libraries 1 ++# PROP Output_Dir "Debug" ++# PROP Intermediate_Dir "Debug" ++# PROP Target_Dir "" ++# ADD BASE CPP /nologo /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c ++# ADD CPP /nologo /G6 /W3 /Gm /GX /Zi /Od /I "..\..\..\lib" /I "..\lib" /I "..\..\lib" /I "..\..\..\..\lib" /I ".." /I "..\.." /I "..\..\.." /I "..\..\..\.." /I "..\include" /I "..\..\include" /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /c ++# ADD BASE RSC /l 0x409 /d "_DEBUG" ++# ADD RSC /l 0x409 /d "_DEBUG" ++BSC32=bscmake.exe ++# ADD BASE BSC32 /nologo ++# ADD BSC32 /nologo ++LIB32=link.exe -lib ++# ADD BASE LIB32 /nologo ++# ADD LIB32 /nologo ++ ++!ENDIF ++ ++# Begin Target ++ ++# Name "Metar - Win32 Release" ++# Name "Metar - Win32 Debug" ++# Begin Group "Source Files" ++ ++# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" ++# Begin Source File ++ ++SOURCE=.\Antoi.cpp ++# End Source File ++# Begin Source File ++ ++SOURCE=.\Charcmp.cpp ++# End Source File ++# Begin Source File ++ ++SOURCE=.\Dcdmetar.cpp ++# End Source File ++# Begin Source File ++ ++SOURCE=.\Dcdmtrmk.cpp ++# End Source File ++# Begin Source File ++ ++SOURCE=.\Fracpart.cpp ++# End Source File ++# Begin Source File ++ ++SOURCE=.\MetarReport.cpp ++# End Source File ++# Begin Source File ++ ++SOURCE=.\MetarStation.cpp ++# End Source File ++# Begin Source File ++ ++SOURCE=.\Prtdmetr.cpp ++# End Source File ++# Begin Source File ++ ++SOURCE=.\Stspack2.cpp ++# End Source File ++# Begin Source File ++ ++SOURCE=.\Stspack3.cpp ++# End Source File ++# End Group ++# Begin Group "Header Files" ++ ++# PROP Default_Filter "h;hpp;hxx;hm;inl" ++# Begin Source File ++ ++SOURCE=.\LOCAL.H ++# End Source File ++# Begin Source File ++ ++SOURCE=.\METAR.H ++# End Source File ++# Begin Source File ++ ++SOURCE=.\MetarReport.h ++# End Source File ++# Begin Source File ++ ++SOURCE=.\MetarStation.h ++# End Source File ++# End Group ++# End Target ++# End Project diff --cc simgear/metar/Metar.h index 00000000,00000000..a9fea251 new file mode 100644 --- /dev/null +++ b/simgear/metar/Metar.h @@@ -1,0 -1,0 +1,265 @@@ ++#ifndef METARX ++#define METARX ++ ++/********************************************************************/ ++/* */ ++/* Title: METAR H */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 19 Jan 1996 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: METAR Decoder Header File. */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++ ++ ++#include "Local.h" /* standard header file */ ++ ++ ++/*********************************************/ ++/* */ ++/* RUNWAY VISUAL RANGE STRUCTURE DECLARATION */ ++/* AND VARIABLE TYPE DEFINITION */ ++/* */ ++/*********************************************/ ++ ++typedef struct runway_VisRange { ++ char runway_designator[6]; ++ bool vrbl_visRange; ++ bool below_min_RVR; ++ bool above_max_RVR; ++ int visRange; ++ int Max_visRange; ++ int Min_visRange; ++} Runway_VisRange; ++ ++/***********************************************/ ++/* */ ++/* DISPATCH VISUAL RANGE STRUCTURE DECLARATION */ ++/* AND VARIABLE TYPE DEFINITION */ ++/* */ ++/***********************************************/ ++ ++typedef struct dispatch_VisRange { ++ bool vrbl_visRange; ++ bool below_min_DVR; ++ bool above_max_DVR; ++ int visRange; ++ int Max_visRange; ++ int Min_visRange; ++} Dispatch_VisRange; ++ ++/*****************************************/ ++/* */ ++/* CLOUD CONDITION STRUCTURE DECLARATION */ ++/* AND VARIABLE TYPE DEFINITION */ ++/* */ ++/*****************************************/ ++ ++typedef struct cloud_Conditions { ++ char cloud_type[5]; ++ char cloud_hgt_char[4]; ++ char other_cld_phenom[4]; ++ int cloud_hgt_meters; ++} Cloud_Conditions; ++ ++/*****************************************/ ++/* */ ++/* WIND GROUP DATA STRUCTURE DECLARATION */ ++/* AND VARIABLE TYPE DEFINITION */ ++/* */ ++/*****************************************/ ++ ++typedef struct windstruct { ++ char windUnits[ 4 ]; ++ bool windVRB; ++ int windDir; ++ int windSpeed; ++ int windGust; ++} WindStruct; ++ ++/*****************************************/ ++/* */ ++/* RECENT WX GROUP STRUCTURE DECLARATION */ ++/* AND VARIABLE TYPE DEFINITION */ ++/* */ ++/*****************************************/ ++ ++typedef struct recent_wx { ++ char Recent_weather[ 5 ]; ++ int Bhh; ++ int Bmm; ++ int Ehh; ++ int Emm; ++} Recent_Wx; ++ ++/***************************************/ ++/* */ ++/* DECODED METAR STRUCTURE DECLARATION */ ++/* AND VARIABLE TYPE DEFINITION */ ++/* */ ++/***************************************/ ++ ++typedef struct decoded_METAR { ++ char synoptic_cloud_type[ 6 ]; ++ char snow_depth_group[ 6 ]; ++ char codeName[ 6 ]; ++ char stnid[5]; ++ char horiz_vsby[5]; ++ char dir_min_horiz_vsby[3]; ++ char vsby_Dir[ 3 ]; ++ char WxObstruct[10][8]; ++ char autoIndicator[5]; ++ char VSBY_2ndSite_LOC[10]; ++ char SKY_2ndSite_LOC[10]; ++ char SKY_2ndSite[10]; ++ char SectorVsby_Dir[ 3 ]; ++ char ObscurAloft[ 12 ]; ++ char ObscurAloftSkyCond[ 12 ]; ++ char VrbSkyBelow[ 4 ]; ++ char VrbSkyAbove[ 4 ]; ++ char LTG_DIR[ 3 ]; ++ char CloudLow; ++ char CloudMedium; ++ char CloudHigh; ++ char CIG_2ndSite_LOC[10]; ++ char VIRGA_DIR[3]; ++ char TornadicType[15]; ++ char TornadicLOC[10]; ++ char TornadicDIR[4]; ++ char TornadicMovDir[3]; ++ char CHINO_LOC[6]; ++ char VISNO_LOC[6]; ++ char PartialObscurationAmt[2][7]; ++ char PartialObscurationPhenom[2][12]; ++ char SfcObscuration[6][10]; ++ char charPrevailVsby[12]; ++ char charVertVsby[10]; ++ char TS_LOC[3]; ++ char TS_MOVMNT[3]; ++ ++ bool Indeterminant3_6HrPrecip; ++ bool CIGNO; ++ bool SLPNO; ++ bool ACFTMSHP; ++ bool NOSPECI; ++ bool FIRST; ++ bool LAST; ++ bool SunSensorOut; ++ bool AUTO; ++ bool COR; ++ bool NIL_rpt; ++ bool CAVOK; ++ bool RVRNO; ++ bool A_altstng; ++ bool Q_altstng; ++ bool VIRGA; ++ bool VOLCASH; ++ bool GR; ++ bool CHINO; ++ bool VISNO; ++ bool PNO; ++ bool PWINO; ++ bool FZRANO; ++ bool TSNO; ++ bool DollarSign; ++ bool PRESRR; ++ bool PRESFR; ++ bool Wshft_FROPA; ++ bool OCNL_LTG; ++ bool FRQ_LTG; ++ bool CNS_LTG; ++ bool CG_LTG; ++ bool IC_LTG; ++ bool CC_LTG; ++ bool CA_LTG; ++ bool DSNT_LTG; ++ bool AP_LTG; ++ bool VcyStn_LTG; ++ bool OVHD_LTG; ++ bool LightningVCTS; ++ bool LightningTS; ++ ++ int TornadicDistance; ++ int ob_hour; ++ int ob_minute; ++ int ob_date; ++ int minWnDir; ++ int maxWnDir; ++ int VertVsby; ++ int temp; ++ int dew_pt_temp; ++ int QFE; ++ int hectoPasc_altstng; ++ int char_prestndcy; ++ int minCeiling; ++ int maxCeiling; ++ int WshfTime_hour; ++ int WshfTime_minute; ++ int min_vrbl_wind_dir; ++ int max_vrbl_wind_dir; ++ int PKWND_dir; ++ int PKWND_speed; ++ int PKWND_hour; ++ int PKWND_minute; ++ int SKY_2ndSite_Meters; ++ int Ceiling; ++ int Estimated_Ceiling; ++ int SNINCR; ++ int SNINCR_TotalDepth; ++ int SunshineDur; ++ int ObscurAloftHgt; ++ int VrbSkyLayerHgt; ++ int Num8thsSkyObscured; ++ int CIG_2ndSite_Meters; ++ int snow_depth; ++ int BTornadicHour; ++ int BTornadicMinute; ++ int ETornadicHour; ++ int ETornadicMinute; ++ ++ ++ float SectorVsby; ++ float WaterEquivSnow; ++ float VSBY_2ndSite; ++ float prevail_vsbySM; ++ float prevail_vsbyM; ++ float prevail_vsbyKM; ++ float prestndcy; ++ float precip_amt; ++ float precip_24_amt; ++ float maxtemp; ++ float mintemp; ++ float max24temp; ++ float min24temp; ++ float minVsby; ++ float maxVsby; ++ float hourlyPrecip; ++ float TWR_VSBY; ++ float SFC_VSBY; ++ float Temp_2_tenths; ++ float DP_Temp_2_tenths; ++ float SLP; ++ float GR_Size; ++ ++ double inches_altstng; ++ ++ Runway_VisRange RRVR[12]; ++ Dispatch_VisRange DVR; ++ Recent_Wx ReWx[3]; ++ WindStruct winData; ++ Cloud_Conditions cldTypHgt[6]; ++ ++} Decoded_METAR; ++ ++#define MAXWXSYMBOLS 10 /*-- NOT TO EXCEED 10 PRES. WX GRPS --*/ ++#define MAXTOKENS 500 /*-- RPT NOT TO EXCEED 500 GRPS --*/ ++ ++void prtDMETR( Decoded_METAR *Mptr ); ++int DcdMETAR( char *string, Decoded_METAR *Mptr ); ++ ++#endif diff --cc simgear/metar/MetarReport.cpp index 00000000,00000000..3e3d7a57 new file mode 100644 --- /dev/null +++ b/simgear/metar/MetarReport.cpp @@@ -1,0 -1,0 +1,259 @@@ ++// Metar report implementation class code ++ ++#include "MetarReport.h" ++#include "Metar.h" ++ ++CMetarReport::CMetarReport( ++ char *s ) : ++ m_DecodedReport( 0 ) ++{ ++ m_DecodedReport = new Decoded_METAR; ++ DcdMETAR( s, (Decoded_METAR *)m_DecodedReport ); ++} ++ ++ ++CMetarReport::~CMetarReport() ++{ ++} ++ ++static int DecodeDirChars( char* c ) ++{ ++ int r = 0; ++ ++ if ( c[0] ) ++ { ++ if ( c[0] == 'E' ) r = 90; ++ else if ( c[0] == 'S' ) r = 180; ++ else if ( c[0] == 'W' ) r = 270; ++ ++ if ( r == 0 ) ++ { ++ if ( c[1] == 'E' ) r = 45; ++ else if ( c[1] == 'W' ) r = 315; ++ } ++ else if ( r = 180 ) ++ { ++ if ( c[1] == 'E' ) r = 135; ++ else if ( c[1] == 'W' ) r = 225; ++ } ++ } ++ return r; ++} ++ ++char *CMetarReport::StationID() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->stnid; ++} ++ ++int CMetarReport::WindDirection() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->winData.windDir; ++} ++ ++int CMetarReport::WindSpeed() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->winData.windSpeed; ++} ++ ++int CMetarReport::WindGustSpeed() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->winData.windGust; ++} ++ ++int CMetarReport::LightningDirection() ++{ ++ return DecodeDirChars( ((Decoded_METAR *)m_DecodedReport)->LTG_DIR ); ++} ++ ++char CMetarReport::CloudLow() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->CloudLow; ++} ++ ++char CMetarReport::CloudMedium() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->CloudMedium; ++} ++ ++char CMetarReport::CloudHigh() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->CloudHigh; ++} ++ ++int CMetarReport::VirgaDirection() ++{ ++ return DecodeDirChars( ((Decoded_METAR *)m_DecodedReport)->VIRGA_DIR ); ++} ++ ++int CMetarReport::TornadicDirection() ++{ ++ return DecodeDirChars( ((Decoded_METAR *)m_DecodedReport)->TornadicDIR ); ++} ++ ++int CMetarReport::TornadicMovementDirection() ++{ ++ return DecodeDirChars( ((Decoded_METAR *)m_DecodedReport)->TornadicMovDir ); ++} ++ ++int CMetarReport::ThunderStormDirection() ++{ ++ return DecodeDirChars( ((Decoded_METAR *)m_DecodedReport)->TS_LOC ); ++} ++ ++int CMetarReport::ThunderStormMovementDirection() ++{ ++ return DecodeDirChars( ((Decoded_METAR *)m_DecodedReport)->TS_MOVMNT ); ++} ++ ++bool CMetarReport::Virga() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->VIRGA; ++} ++ ++bool CMetarReport::VolcanicAsh() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->VOLCASH; ++} ++ ++bool CMetarReport::Hail() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->GR; ++} ++ ++bool CMetarReport::OccationalLightning() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->OCNL_LTG; ++} ++ ++bool CMetarReport::FrequentLightning() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->FRQ_LTG; ++} ++ ++bool CMetarReport::ContinuousLightning() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->CNS_LTG; ++} ++ ++bool CMetarReport::CloudToGroundLightning() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->CG_LTG; ++} ++ ++bool CMetarReport::InterCloudLightning() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->IC_LTG; ++} ++ ++bool CMetarReport::CloudToCloudLightning() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->CC_LTG; ++} ++ ++bool CMetarReport::CloudToAirLightning() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->CA_LTG; ++} ++ ++bool CMetarReport::DistantLightning() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->DSNT_LTG; ++} ++ ++bool CMetarReport::AirportLightning() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->AP_LTG; ++} ++ ++bool CMetarReport::VicinityLightning() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->VcyStn_LTG; ++} ++ ++bool CMetarReport::OverheadLightning() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->OVHD_LTG; ++} ++ ++int CMetarReport::Temperature() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->temp; ++} ++ ++int CMetarReport::DewpointTemperature() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->dew_pt_temp; ++} ++ ++int CMetarReport::VerticalVisibility() // Meters ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->VertVsby; ++} ++ ++int CMetarReport::Ceiling() ++{ ++ return FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->Ceiling; ++} ++ ++int CMetarReport::EstimatedCeiling() ++{ ++ return FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->Estimated_Ceiling; ++} ++ ++int CMetarReport::VariableSkyLayerHeight() ++{ ++ return FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->VrbSkyLayerHgt; ++} ++ ++int CMetarReport::SnowDepthInches() ++{ ++ return ((Decoded_METAR *)m_DecodedReport)->snow_depth; ++} ++ ++ ++std::ostream& ++operator << ( ostream& out, CMetarReport& p ) ++{ ++ return out ++ << "StationID " << p.StationID() ++ << " WindDirection " << p.WindDirection() ++ << " WindSpeed " << p.WindSpeed() ++ << " WindGustSpeed " << p.WindGustSpeed() << std::endl ++ << "CloudLow " << p.CloudLow() ++ << " CloudMedium " << p.CloudMedium() ++ << " CloudHigh " << p.CloudHigh() << std::endl ++ << "TornadicDirection " << p.TornadicDirection() ++ << " TornadicMovementDirection " << p.TornadicMovementDirection() << std::endl ++ << "ThunderStormDirection " << p.ThunderStormDirection() ++ << " ThunderStormMovementDirection " << p.ThunderStormMovementDirection() << std::endl ++ << "Virga " << p.Virga() ++ << " VirgaDirection " << p.VirgaDirection() << std::endl ++ << "VolcanicAsh " << p.VolcanicAsh() << std::endl ++ << "Hail " << p.Hail() << std::endl ++ << "LightningDirection " << p.LightningDirection() ++ << " OccationalLightning " << p.OccationalLightning() ++ << " FrequentLightning " << p.FrequentLightning() ++ << " ContinuousLightning " << p.ContinuousLightning() << std::endl ++ << "CloudToGroundLightning " << p.CloudToGroundLightning() ++ << " InterCloudLightning " << p.InterCloudLightning() ++ << " CloudToCloudLightning " << p.CloudToCloudLightning() ++ << " CloudToAirLightning " << p.CloudToAirLightning() << std::endl ++ << "DistantLightning " << p.DistantLightning() ++ << " AirportLightning " << p.AirportLightning() ++ << " VicinityLightning " << p.VicinityLightning() ++ << " OverheadLightning " << p.OverheadLightning() << std::endl ++ << "VerticalVisibility " << p.VerticalVisibility() << std::endl // Meters ++ << "Temperature " << p.Temperature() ++ << " DewpointTemperature " << p.DewpointTemperature() << std::endl ++ << "Ceiling " << p.Ceiling() ++ << " EstimatedCeiling " << p.EstimatedCeiling() ++ << " VariableSkyLayerHeight " << p.VariableSkyLayerHeight() << std::endl ++ << "SnowDepthInches " << p.SnowDepthInches() << std::endl ++ ; ++} ++ ++ ++void CMetarReport::dump() ++{ ++ prtDMETR( (Decoded_METAR *)m_DecodedReport ); ++} diff --cc simgear/metar/MetarReport.h index 00000000,00000000..06e09808 new file mode 100644 --- /dev/null +++ b/simgear/metar/MetarReport.h @@@ -1,0 -1,0 +1,111 @@@ ++// Class encapulating the metar report information ++// ++// Individual METAR reports are found in this directory: ++// ftp://weather.noaa.gov/data/observations/metar/stations ++// ++ ++#ifndef _MetarReport_ ++#define _MetarReport_ ++ ++#include ++#include ++#include ++#include ++#include ++ ++class CMetarReport ++{ ++ // Typedefs, enumerations ++ ++ // Attributes ++private: ++ void *m_DecodedReport; ++ // A void pointer which is cast to the correct type in the cpp file. ++ // I don't want the ugly metar structure and header files dragged into ++ // every report user program file. ++ // Probably should be a smart pointer if copy constructor and assignment ++ // is allowed. ++ ++ // Operations ++ ++public: ++ CMetarReport( ++ char *s ); ++ // Constructor ++ ++ ~CMetarReport(); ++ // Destructor ++ ++ char *StationID(); ++ ++ // Directions in degrees ++ // Speed in knots ++ // Altitude in meters ++ // Temperature in centigrade ++ ++ int WindDirection(); ++ int WindSpeed(); ++ int WindGustSpeed(); ++ ++ // Add cloud more cloud info... ++ // Cloud code characters... ++ char CloudLow(); ++ char CloudMedium(); ++ char CloudHigh(); ++ ++ bool Virga(); ++ int VirgaDirection(); ++ ++ int TornadicDirection(); ++ int TornadicMovementDirection(); ++ ++ int ThunderStormDirection(); ++ int ThunderStormMovementDirection(); ++ ++ bool VolcanicAsh(); ++ bool Hail(); ++ ++ int LightningDirection(); ++ bool OccationalLightning(); ++ bool FrequentLightning(); ++ bool ContinuousLightning(); ++ bool Lightning() ++ { ++ return OccationalLightning() || FrequentLightning() || ContinuousLightning(); ++ } ++ ++ bool CloudToGroundLightning(); ++ bool InterCloudLightning(); ++ bool CloudToCloudLightning(); ++ bool CloudToAirLightning(); ++ ++ bool DistantLightning(); ++ bool AirportLightning(); ++ bool OverheadLightning(); ++ bool VicinityLightning(); ++ ++ int Temperature(); ++ int DewpointTemperature(); ++ ++ int VerticalVisibility(); ++ int Ceiling(); ++ int EstimatedCeiling(); ++ int VariableSkyLayerHeight(); ++ ++ int SnowDepthInches(); ++ ++ void dump(); ++ ++private: ++ CMetarReport( ++ const CMetarReport &rNewObj ); ++ // Copy constructor. Not implemented. ++ ++ CMetarReport &operator =( ++ const CMetarReport &rObj ); ++ // Assignment operator. Not implemented. ++}; ++ ++std::ostream& operator << ( std::ostream&, CMetarReport& ); ++ ++#endif diff --cc simgear/metar/MetarStation.cpp index 00000000,00000000..451204cc new file mode 100644 --- /dev/null +++ b/simgear/metar/MetarStation.cpp @@@ -1,0 -1,0 +1,231 @@@ ++// Metar station implementation code ++ ++#include ++ ++#include "MetarStation.h" ++#include ++#define TESTPROG ++#ifndef TESTPROG ++// options is too tightly integrated into FlightGear to use in a test program ++#include
++#endif ++#include ++ ++ ++std::vector< CMetarStation *> METAR_Stations; ++ ++int CMetarStation::initialized( CMetarStation::initialize() ); ++ ++std::string CMetarStation::tempName; ++ ++ ++double CMetarStation::decodeDMS( char *b ) ++{ ++ double r = 0; ++ double m = 0; ++ double s = 0; ++ if ( *b ) ++ { ++ // Degrees ++ r = (*b - '0') * 10.0; b++; ++ r += (*b - '0'); b++; ++ if ( *b != '-' ) ++ { ++ r *= 10; ++ r += (*b - '0'); b++; ++ } ++ b++; ++ // Minutes ++ m = (*b - '0') * 10.0; b++; ++ m += (*b - '0'); b++; ++ r += m/60.0; ++ if ( *b == '-' ) ++ { ++ // Seconds ++ b++; ++ s = (*b - '0') * 10.0; b++; ++ s += (*b - '0'); b++; ++ } ++ r += s/3600.0; ++ // Direction (E W N S) ++ if ( *b == 'W' || *b == 'S' ) r = -r; ++ } ++ return r * DEG_TO_RAD; ++} ++ ++ ++CMetarStation::CMetarStation( ++ char *s ) ++{ ++ char *t; ++ t = strchr( s, ';' ); *t = 0; t++; ++ m_ID = s; ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ m_number = atoi( s ) * 1000; ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ m_number += atoi( s ); ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ m_name = s; ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ m_state = s; ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ m_country = s; ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ m_region = atoi( s ); ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ double latitude = decodeDMS( s ); ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ double longitude = decodeDMS( s ); ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ double ulatitude = decodeDMS( s ); ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ double ulongitude = decodeDMS( s ); ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ double altitude = atoi( s ) * FEET_TO_METER; ++ s = t; t = strchr( s, ';' ); *t = 0; t++; ++ double ualtitude = atoi( s ) * FEET_TO_METER; ++ Point3D p( longitude, latitude, altitude+EQUATORIAL_RADIUS_M ); ++ m_locationPolar = p; ++ m_locationCart = fgPolarToCart3d( p ); ++ Point3D up( ulongitude, ulatitude, ualtitude+EQUATORIAL_RADIUS_M ); ++ m_upperLocationPolar = up; ++ m_upperLocationCart = fgPolarToCart3d( up ); ++ s = t; ++ m_pFlag = s[0]; ++} ++ // Constructor ++ // Decodes METAR station string of this format: ++ // KPUB;72;464;Pueblo, Pueblo Memorial Airport;CO;United States;4;38-17-24N;104-29-54W;38-17-03N;104-29-43W;1440;1420;P ++ ++ ++int CMetarStation::initialize() ++{ ++ // Read the list of metar stations, decoding and adding to global list. ++ ++ CMetarStation *m; ++ char buf[256]; ++ ++ // Goto the Flight Gear installation directory ++#ifdef TESTPROG ++ FGPath weatherPath( "/mkv/Build/FlightGear" ); ++#else ++ FGPath weatherPath( current_options.get_fg_root() ); ++#endif ++ ++ weatherPath.append( "Weather/MetarStations" ); ++ // Open the metar station list ++ FILE *f = fopen( weatherPath.c_str(), "r" ); ++ ++ ++ if ( f != NULL ) ++ { ++ // Read each line, create an instance of a station, and add it to the vector ++ while ( fgets( buf, 256, f) != NULL && feof( f ) == 0 ) ++ { ++ //std::cout << buf << std::endl; ++ m = new CMetarStation( buf ); ++ //m->dump(); ++ METAR_Stations.push_back( m ); ++ } ++ ++ // Close the list ++ fclose( f ); ++ std::cout << METAR_Stations.size() << " Metar stations" << std::endl; ++ return 1; ++ } ++ else ++ { ++ std::cout << "Could not open MetarStations file " << std::endl; ++ return 0; ++ } ++} ++ ++ ++int CMetarStation::sameName( CMetarStation *m ) ++{ ++ return m->m_ID == tempName; ++} ++ ++ ++CMetarStation *CMetarStation::find( std::string stationID ) ++{ ++ tempName = stationID; ++ CMetarStation **m = std::find_if( METAR_Stations.begin(), METAR_Stations.end(), sameName ); ++ if ( m != METAR_Stations.end() ) return *m; ++ return 0; ++} ++ ++double bestDist; ++CMetarStation *bestStation; ++Point3D curLocation; ++ ++void findHelper( CMetarStation *s ) ++{ ++ double dist = s->locationCart().distance3Dsquared( curLocation ); ++ if (dist < bestDist ) ++ { ++ bestDist = dist; ++ bestStation = s; ++ } ++} ++ ++CMetarStation *CMetarStation::find( Point3D locationCart ) ++{ ++ bestDist = 99999999; ++ bestStation = 0; ++ curLocation = locationCart; ++ ++ for_each( findHelper ); ++ return bestStation; ++} ++ ++ ++void CMetarStation::for_each( void f( CMetarStation *s ) ) ++{ ++ std::for_each( METAR_Stations.begin(), METAR_Stations.end(), f ); ++} ++ ++ ++void CMetarStation::dump() ++{ ++ std::cout << "ID:" << ID(); ++ std::cout << std::endl; ++ std::cout << "number:" << number(); ++ std::cout << std::endl; ++ std::cout << "name:" << name(); ++ std::cout << std::endl; ++ std::cout << "state:" << state(); ++ std::cout << std::endl; ++ std::cout << "country:" << country(); ++ std::cout << std::endl; ++ std::cout << "region:" << region(); ++ std::cout << std::endl; ++ std::cout << "Location (cart):" << locationCart(); ++ std::cout << std::endl; ++ std::cout << "Location (polar):" << locationPolar(); ++ std::cout << std::endl; ++ std::cout << "Upper Location (cart):" << upperLocationCart(); ++ std::cout << std::endl; ++ std::cout << "Upper Location (polar):" << upperLocationPolar(); ++ std::cout << std::endl; ++ std::cout << "P flag:" << pFlag(); ++ std::cout << std::endl; ++} ++ ++std::ostream& ++operator << ( ostream& out, const CMetarStation& p ) ++{ ++ return out ++ << "ID:" << p.m_ID << std::endl ++ << "number:" << p.m_number << std::endl ++ << "name:" << p.m_name << std::endl ++ << "state:" << p.m_state << std::endl ++ << "country:" << p.m_country << std::endl ++ << "region:" << p.m_region << std::endl ++ << "Location (cart):" << p.m_locationCart << std::endl ++ << "Location (polar):" << p.m_locationCart << std::endl ++ << "Upper Location (cart):" << p.m_upperLocationCart << std::endl ++ << "Upper Location (polar):" << p.m_upperLocationPolar << std::endl ++ << "P flag:" << p.m_pFlag << std::endl; ++} ++ diff --cc simgear/metar/MetarStation.h index 00000000,00000000..299e5e17 new file mode 100644 --- /dev/null +++ b/simgear/metar/MetarStation.h @@@ -1,0 -1,0 +1,87 @@@ ++// Class encapulating the metar station information ++// ++// METAR station information is kept in this file: ++// http://www.nws.noaa.gov/pub/stninfo/nsd_cccc.gz ++// http://www.nws.noaa.gov/pub/stninfo/nsd_cccc.txt ++// This class looks for the file FG_ROOT/Weather/MetarStations instread of nsd_cccc. ++ ++#ifndef _MetarStation_ ++#define _MetarStation_ ++ ++#include ++#include ++#include ++#include ++#include ++//using namespace std; ++ ++class CMetarStation ++{ ++ // Attributes ++private: ++ std::string m_ID; ++ unsigned long m_number; ++ std::string m_name; ++ std::string m_state; ++ std::string m_country; ++ int m_region; ++ Point3D m_locationPolar; ++ Point3D m_upperLocationPolar; ++ Point3D m_locationCart; ++ Point3D m_upperLocationCart; ++ int m_altitude; ++ int m_upperAltitude; ++ char m_pFlag; ++ ++ static int initialized; ++ static std::string tempName; ++ ++ // Operations ++private: ++ double decodeDMS( char *b ); ++ static int sameName( CMetarStation *m ); ++ ++ CMetarStation( ++ char *s ); ++ // Constructor ++ ++ ~CMetarStation() ++ { ++ } ++ // Destructor ++ ++public: ++ std::string &ID() { return m_ID; } ++ unsigned long number() { return m_number; } ++ std::string &name() { return m_name; } ++ std::string &state() { return m_state; } ++ std::string &country() { return m_country; } ++ int region() { return m_region; } ++ Point3D &locationPolar() { return m_locationPolar; } ++ Point3D &upperLocationPolar() { return m_upperLocationPolar; } ++ Point3D &locationCart() { return m_locationCart; } ++ Point3D &upperLocationCart() { return m_upperLocationCart; } ++ char pFlag() { return m_pFlag; } ++ // Get attributes ++ ++ friend std::ostream& operator << ( std::ostream&, const CMetarStation& ); ++ void dump(); ++ ++ static CMetarStation *find( std::string stationID ); ++ static CMetarStation *find( Point3D locationCart ); ++ static void for_each( void f( CMetarStation *s ) ); ++ ++private: ++ CMetarStation( ++ const CMetarStation &rNewObj ); ++ // Copy constructor. Not implemented. ++ ++ CMetarStation &operator =( ++ const CMetarStation &rObj ); ++ // Assignment operator. Not implemented. ++ ++ static int initialize(); ++}; ++ ++ ++#endif diff --cc simgear/metar/MetarTest/MetarLibTest.cpp index 00000000,00000000..81410d0e new file mode 100644 --- /dev/null +++ b/simgear/metar/MetarTest/MetarLibTest.cpp @@@ -1,0 -1,0 +1,549 @@@ ++// Metar Library test ++ ++#include ++#include "../MetarReport.h" ++#include "../MetarStation.h" ++#include ++ ++static char *report[] = ++{ ++ "KAST 221156Z COR 09005KT 7SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005", ++ ++ "KAST COR 221156Z 09005KT 7SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005", ++ ++ "KAST COR 221156Z 09005KT 1/SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005", ++ ++ "KP88 COR 221156 09005KT 1/SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005", ++ ++ "KP88 COR 221156 09005KT 1/SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 6//// 70109 T00890084 10100 20089 55005", ++ ++ ++ "EPIT 1755 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1/2V3/4", ++ ++ "KFAR 181154Z 10003KT 1/4SM HZ CLR 16/13 A2988 RMK AO2 " ++ "SLP117 56012 10345 20226 T01610133 $", ++ ++ "KFAR 181154Z 10003KT 1/SM HZ CLR 16/13 A2988 RMK AO2 " ++ "SLP117 56012 10345 20226 T01610133 $", ++ ++ "RKSS 21009KT 1400 RP2000 // ////// 21/20 1006/2972 NOSIG", ++ ++ "RKSS 1200 21009KT 1400 RP2000 // ////// 21/20 1006/2972 NOSIG", ++ ++ "RKSS 1130Z 23011KT 1100 R14R/P1500N R14L/P1500N BR SCT010 BKN030 " ++ "BKN080 21/21 Q1006 NOSIG", ++ ++ "RKSS 1130Z 23011KT 1100 R14R/P1500 R14L/P1500 BR SCT010 BKN030 " ++ "BKN080 21/21 Q1006 NOSIG", ++ ++ "KFAR 181154Z 10003KT 4SM HZ CLR 16/13 A2988 RMK AO2 " ++ "SLP117 56012 1//// 2//// T01610133 $", ++ ++ "CYYE 061300Z 3500KT 15SM BKN005 OVC040 08/08 A3004 RMK " ++ "SF6SC1 VSBY RDCE DUE LO CLD SLP186", ++ ++ "CYYE 061300Z 3500KT 15SM BKN005 OVC040 08/08 A3004 RMK " ++ "SF6SC1 VSBY RDCE DUE10 LO CLD SLP186", ++ ++ "CYYE 061300Z 3500KT 15SM BKN005 OVC040 08/08 A3004 RMK " ++ "SF6SC1 VSBY RDCE DUE9 LO CLD SLP186", ++ ++ "CYYE 061300Z 3500KT 15SM BKN005 OVC040 08/08 A3004 RMK " ++ "SF6SC1 VSBY RDCE FZDZE10 LO CLD SLP186", ++ ++ "CYYE 061300Z 3500KT 15SM BKN005 OVC040 08/08 A3004 RMK " ++ "SF6SC1 VSBY RDCE FZDZE9 LO CLD SLP186", ++ ++ "MKJP 1400Z 13011KT 9999 FEW022 30/XX Q1015", ++ "MKJP 1400Z 13011KT 9999 FEW022 M30/XX Q1015", ++ "MKJP 1400Z 13011KT 9999 FEW022 MM/XX Q1015", ++ "MKJP 1400Z 13011KT 9999 FEW022 MM/30 Q1015", ++ "MKJP 1400Z 13011KT 9999 FEW022 MM/M30 Q1015", ++ ++ "EGPD 36016G26KT 320V030 9999 FEW015TCU SCT026 BKN045 OVC090 " ++ "SCT120 FEW250 RMK OCNL LTGICCG OHD", ++ ++ "EGPD 36016G26KT 320V030 9999 FEW015TCU SCT026 07/01 Q1011 " ++ "RMK TEMPO 8000 -SHRA BKN015 FRQ LTG VC", ++ ++ "EGPD 36016G26KT 320V030 9999 FEW015TCU SCT026 07/01 Q1011 " ++ "RMK TEMPO 8000 -SHRA BKN015 LTG DSNT W", ++ ++ "METAR KLAX 281156Z AUTO VRB100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT FC " ++ "+TS BLPY FEW/// SCT000 BKN050 SCT150 OVC250 3/M1 A2991 RMK " ++ "TORNADO B13E45 6 NE MOV E A02 PK WND 18515/45 " ++ "WSHFT 1350 FROPA TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "VIS 2 1/2 RY11 " ++ "DVR/1000V1600FT " ++ "OCNL LTG VCY STN " ++ "RAB1030E1145 FZDZE56 BLPYE57 CIG 1000V1500 CIG 020 RY11 " ++ "PRESFR PRESRR SLP013 FG FEW/// HZ SCT000 VIS NW 2 1/2 GR 3/4 " ++ "VIRGA SE -XRAFG3 CIGE005 BKN014 V OVC " ++ "FU BKN020 NOSPECI LAST 8/365 SNINCR 2/10 4/178 " ++ "933125 98096 P 0125 60225 70565 " ++ "T00261015 10369 21026 " ++ "404800360 52101 VISNO RY05 CHINO RY27 PNO RVRNO " ++ "PWINO FZRANO TSNO $", ++ ++ "KBOS 251356Z 26011KT 10SM CLR 12/02 A2995 RMK AO2 SC VCNTY " ++ "STN SSE-NNW SCT CI ABV SLP141 T01220023", ++ ++ "EFHK 36009KT 340V060 CAVOK 12/M02 Q1013 NOSIG", ++ "EGKK 24011KT 210V300 9999 SCT020 BKN045 12/06 Q1007 NOSIG", ++ "EGPD 31018KT 8000 RA FEW013 BKN021 OVC045 06/04 Q0994 NOSIG", ++ "EKCH 16012KT CAVOK 20/07 Q1006 NOSIG", ++ "ESKN 10014KT 9000 BR SCT100 14/04 Q1010", ++ "LOWW 231450Z 14017KT CAVOK 23/07 Q1010 NOSIG", ++ ++ "METAR CYCH 171500Z CCA 30017KT 2SM -SN BKN006", ++ ++ "METAR CYOW 171500Z CCA 30017KT 2SM -SN BKN006 OVC020 00/M02 " ++ "A2957 RMK S35F4NS1 /S01/ SNW WET SNW MELTG ON GRND CIG 5-7 " ++ "SLP018", ++ ++ "KAST 221156Z AUTO 09005KT 7SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005" ++ " TSB0159E30 TS SE MOV NE", ++ ++ "KAST 221156Z AUTO 09005KT 7SM -RA OVC026 09/08 A2996 RMK " ++ "AO2 TNO SLP143 P0007 60047 70109 T00890084 10100 20089 55005" ++ " TSE0159 TS SE", ++ ++ "KHVR 1756Z 31007KT 5SM -SN SCT011 BKN024 OVC030 M05/M08 A3056 " ++ "RMK AOA 933004 " ++ "BKN V SCT TNO PCPN 000 $ SLP389 4/015 60002 " ++ "T10501077 11050 21078 51010", ++ ++ "SPECI KGFI 041420Z AUTO 18030KT 3 1/2SM RVRNO TS -RA BKN008 OVC060 " ++ "26/22 A2991 RMK A02 RA15TSB20 PRESFR SLP 101 P 0000 T02640218", ++ ++ "METAR KCLE 281156Z 170100G135KT 110V180 M1/4SM " ++ "R01L/P6000FT +TSSHRA VCFG " ++ "BKN025 SCT100 OVC200 M26/ A2991 RMK PK WND 18515/45 A02 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "CIG 1000V1500 PRESFR FRQ LTG CG NW " ++ "RAB1030E1145 FZDZE56 PRESRR SLP135 GS " ++ "T1263 " ++ "VIRGA NW 8/365 4/178 P 0125 60225 7//// 70565 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ "CYQR 161700Z 15015KT 15SM SCT045 SCT090 BKN250 10/03 A2955 " ++ "RMK SC1AC2C11 OB TAKEN H+ 5 DUE AWOS FAILURE SLP027", ++ ++ "KPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1V2", ++ ++ "SPECI KGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "A2900 RMK A02A PK WND 18056/28 RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP 701 P 0254 199/182", ++ ++ "SPECI KGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "A2900 RMK A02A PK WND 18056/28 RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP701 P0254 199/182", ++ ++ "KHLN 281156Z AUTO 27005KT 10SM OVC023 07/05 A3011 RMK AOA OVC V " ++ "BKN $ SLP202 60000 70001 T00670050 10122 20061 53003", ++ ++ "KPHX 281156Z 12004KT 10SM CLR 15/05 A2996 RMK AOA SLP135 T01500050 " ++ "10250 20150 53006", ++ "KFCA 281156Z 30003KT 10SM CLR 06/02 A3009 RMK AO TNO $ SLP191 " ++ "T00610023 10167 20056 53003", ++ "KAST 281156Z 00000KT 10SM BKN095 09/08 A2997 RMK AOA SLP150 " ++ "T00940084 10161 20094 52005 ", ++ "KHVR 281156Z 03003KT 10SM OVC020 09/07 A3010 RMK AO TNO ZRNO " ++ "$ SLP194 T00940073 10156 20089 51005", ++ "KGGW 281156Z 35006KT 5SM BR OVC010 10/09 A3003 RMK AOA $ SLP177 " ++ "70003 T01000095 10156 20110 53008", ++ "KELY 1153Z AUTO 14004KT 10SM SCT075 01/M01 A3011 RMK AOA TNO ZRNO " ++ "SLP171 70001 T00061011 10139 21006 51005", ++ "KFLG 281156Z 29006KT 10SM CLR 04/M01 A3012 RMK AO TNO SLP147 " ++ "T00391011 21006 51004", ++ "KGTF 281156Z 27005KT 7SM BKN080 04/04 A3010 RMK AOA SLP205 " ++ "T00440045 10117 20039 51006", ++ ++ "K13A 1918Z 20011KT 26/M06 RMK AO PKWND 020/RNO 644V264 T02611061", ++ ++ "KP88 1919Z 09001KT 14/03 RMK AO / PKWND 002/RNO 158 Z T01440034", ++ ++ "K40B 1924Z 29004KT 15/M07 RMK AO PKWND 011/RM MV263 T01501072", ++ ++ "KGGW 1756Z 33018KT 10SM OVC015 M03/M06 A3041 RMK AOA SLP338 " ++ "4/007 60002 T10281055 11028 21072 51009", ++ "KPHX 1756Z 130004KT 10SM CLR 18/M03 A3001 RMK AOA SLP154 " ++ "T01781033 10178 20067 58007", ++ "KFCA 1756Z 29005KT 10SM CLR 05/M11 A3049 RMK AOA TNO SLP352 " ++ "T00501111 10050 21044 50004", ++ "KAST 1756Z 01006KT 10SM CLR 11/04 A3047 RMK AOA SLP316 " ++ "T01110045 10111 20000 50002", ++ "KELY 1753Z 34010KT 10SM CLR 01/M07 A3022 RMK AOA TNO ZRNO " ++ "SLP240 T00111066 10011 21078 58007", ++ "KFLG 1756Z 07006KT 10SM CLR 06/M12 A3009 RMK AO TNO ZRNO " ++ "SLP178 T00561122 10061 21100 58005", ++ "KGTF 1756Z 35010KT 1/2SM -SN FG VV09 M06/M08 A3051 RMK AOA " ++ "933004 SFC VSBY 3/4 " ++ "PCPN M SLP393 60010 T10611077 11044 21067 53013", ++ "KHLN 1756Z 35012KT 10SM SCT032 OVC060 M02/M09 A3048 RMK AOA " ++ "SLP369 60000 T10171094 11017 21061 53006", ++ "KAST 1756Z 01006KT 10SM CLR 11/04 A3047 RMK AOA SLP316 61104 " ++ "71235 T01110045 10111 20000 401720056 58002", ++ "METAR KLAX 04281156Z AUTO VRB100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT FC " ++ "+TS BLPY FEW000 BKN050 SCT150 OVC250 3/M1 A2991 RMK " ++ "TORNADO B13 DSNT NE A02 PK WND 18515/45 " ++ "WSHFT 1350 FROPA TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "VIS 2 1/2 RY11 OCNL LTG VCY STN " ++ "RAB1030E1145 FZDZE56 BLPYE57 CIG 1000V1500 CIG 020 RY11 " ++ "PRESFR PRESRR SLP013 FG FEW000 VIS NW2 1/2 GR 3/4 " ++ "VIRGA SE -XRAFG3 CIGE005 BKN014 V OVC " ++ "FU BKN020 NOSPECI LAST 8/365 SNINCR 2/10 4/178 " ++ "933125 98096 P 0125 60225 70565 " ++ "T00261015 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ "METAR KGFI 041356Z AUTO 17012KT 130V210 3 1/2SM R15L/0500FT -RA " ++ "SCT050 OVC110 26/18 A2991 RMK FUNNEL CLOUDS A02 RAB30 " ++ "SLP 101 GR M1/4 VIRGA SCT V BKN P 0010 T02640178", ++ ++ "METAR KGFI 041356Z AUTO 05008KT 10SM R15L/P6000FT CLR A2991 " ++ "RMK WATERSPOUTS VCY STN NW A02 SLP 101 10288 20243 52021 $ ", ++ ++ "SPECI KGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "A2900 RMK A02A PK WND 18056/28 OCNL LTG AP " ++ "RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP 701 P 0254 T01990182", ++ ++ "KABE 281900Z NIL", ++ ++ "METAR KPIT NIL", ++ ++ "METAR KCLE 04281156Z 170100G135KT 110V180 M1/4SM " ++ "R01L/P6000FT +TSSHRA VCFG " ++ "BKN025 SCT100 OVC200 M26/ A2991 RMK PK WND 18515/45 A02 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "CIG 1000V1500 PRESFR FRQ LTG CG NW " ++ "RAB1030E1145 FZDZE56 PRESRR SLP135 GS " ++ "T1263 " ++ "VIRGA NW 8/365 4/178 P 0125 60225 7//// 70565 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ "METAR KPHL 040256Z AUTO 170100G135KT 130V210 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT " ++ "FC +TS BKN050 SCT150 OVC250 M26/ A2991 RMK A02 PK WND 185150/1345 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 LTG DSNT " ++ "RAB1030E1145 FZDZE56 CIG 1000V1500 PRESFR PRESRR SLP037 GR 2 3/4 " ++ "VIRGA E 8/365 4/178 P 0125 70565 21026 T0263 10369 60225 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ "SPECI KGFI 041420Z AUTO 18030KT 2 1/2SM RVRNO TS -RA BKN008 " ++ "OVC060 25/22 A2991 RMK A02 LTG DSNT W " ++ "RAB15TSB20 PRESFR SLP101 P 0000 " ++ "254/218", ++ ++ "METAR KGFI 041356Z AUTO 170100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT " ++ "FC +TS BKN050 SCT150 OVC250 M26/ A2991 RMK A02 PK WND 185150/1345 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "RAB1030E1145 FZDZE56 CIG 1000V1500 PRESFR PRESRR SLP997 GR M1/4 " ++ "VIRGA SE 8/365 4/178 P 0125 6//// 60225 70565 T0263 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ "METAR KGFI 041356Z AUTO 170100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT " ++ "FC +TS BKN050 SCT150 OVC250 M26/ A2991 RMK A02 PK WND 185150/1345 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "RAB1030E1145 FZDZE56 CIG 1000V1500 PRESFR PRESRR SLP997 GR 25 " ++ "VIRGA 35 8/365 4/178 P 0125 6//// 60225 70565 T0263 10369 21026 " ++ "VIRGA 35 8/365 4/178 P 0125 21026 70565 10369 60225 T0263 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ "METAR KGFI 041356Z AUTO 170100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT " ++ "FC +TS BKN050 SCT150 OVC250 3/M1 A2991 RMK A02 PK WND 18515/45 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "RAB1030E1145 FZDZE56 CIG 1000V1500 PRESFR PRESRR SLP997 GR 25 " ++ "VIRGA 35 8/365 4/178 P 0125 60225 70565 T00261015 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO $", ++ ++ "METAR KGFI 041356Z AUTO 170100G135KT 130V210 3 1/2SM " ++ "R15L/0500FT R22L/2700FT R16/1200FT R34/1000V1600FT R01L/P6000FT " ++ "FC +TS BKN050 SCT150 OVC250 3/M1 A2991 RMK A02 PK WND 185150/1345 " ++ "WSHFT 1350 TWR VIS 1 1/2 SFC VIS 1/4 VIS 1/4V1 1/4 " ++ "RAB1030E1145 FZDZE56 CIG 1000V1500 PRESFR PRESRR SLP997 GR 25 " ++ "VIRGA 35 8/365 4/178 P 0125 60225 70565 T00261015 10369 21026 " ++ "404800360 52101 PWINO FZRANO TSNO", ++ ++ "METAR KGFI 041356Z AUTO 05008KT 10SM R15L/P6000FT CLR A2991 RMK " ++ "A02 SLP 101 10288 20243 52021", ++ "SPECI DGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "M20/M18 A2900 RMK A02A PK WND 18056/28 RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP 701 P 0254 M199/M182", ++ ++ "SPECI DGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "M20/M18 A2900 RMK A02A PK WND 18056/28 RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP 701 P 0254 M199/182", ++ ++ "SPECI DGFI 041430Z 18045G56KT M1/4SM R15/0200FT FC +TS VV010 20/18 " ++ "M20/M18 A2900 RMK A02A PK WND 18056/28 RAB15E25TSB20 FCB1430 PRESFR " ++ "SLP 701 P 0254 199/M182", ++ ++ "METAR APIT 171755Z AUTO 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 4/369 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 8/563 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1 1/2V2 SLP875 SGB1213E1225", ++ ++ "NZWN 1700Z 35030G49KT 320V030 20KM 02 5SC021 7SC046 12/08 " ++ " Q0994.2 TEMPO 6000 RA 5ST012 2CB015 RMK SLP056 " ++ "RAE0123", ++ ++ "SPECI APIT 171755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 8/321 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1 SLP875 FGB1713", ++ ++ "APIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1V2 SLP875", ++ ++ "APIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1 1/2V2 1/2 SLP875", ++ ++ "APIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1V2 1/2 SLP875", ++ ++ "EGPF 1720Z 00000KT 9999 -SHRA STC014 SCT020CB BNK024 12/09 " ++ "Q1003 NOSIG", ++ ++ "NZAA 1700Z 03010KT 30KM 03 5CU022 7SC035 11/07 Q1006.5 NOSIG", ++ "NZWN 1700Z 35030G49KT 320V030 20KM 02 5SC021 7SC046 12/08 " ++ " Q0994.2 TEMPO 6000 RA 5ST012 2CB015 RMK KAUKAU 30050KT", ++ "DGAA 1800Z 22012KT 9999 SCT009 BKN120 25/21 Q1015", ++ "DAAT 1830Z 30010KT CAVOK 29/06 Q1019", ++ ++ "GQPP 1800Z 34023KT 3000 DRSA SKC 24/20 Q1011 NSG", ++ "DAAG 1830Z 06006KT 9999 SCT020 25/22 Q1015", ++ "DABB 1830Z 04010KT 9999 SCT030TCU SCT033CB 27/18 Q1017", ++ "DABC 1830Z 00000KT 9999 SCT026TCU SCT036CB 22/18 Q1020 RETS", ++ ++ "NZAA 1700Z 03010KT 30KM 03 5CU022 7SC035 11/07 Q1006.5 NOSIG", ++ "NZWN 1700Z 35030G49KT 320V030 20KM 02 5SC021 7SC046 12/08 " ++ " Q0994.2 TEMPO 6000 RA 5ST012 2CB015 RMK K", ++ "NZWN 1700Z 35030G49KT 320V030 20KM 02 5SC021 7SC046 12/08 " ++ " Q0994.2 TEMPO 6000 RA 5ST012 2CB015 RMK KAUKAU 30050KT", ++ "DGAA 1800Z 22012KT 9999 SCT009 BKN120 25/21 Q1015", ++ ++ "GFLL 1900Z NIL", ++ ++ "GOOY 1800Z 03006G17KT 340V080 6000 TSRA BKN016 BKN030CB " ++ "BKN133 26/23 Q1013 NOSIG", ++ ++ "GCXO 1930Z 32018KT 8000 SCT003 SCT007 18/16 Q1019", ++ ++ "APIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1 1/2V2", ++ ++ "BPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1V2", ++ ++ "CPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1V2 1/2", ++ ++ "DPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 1 1/2V2 1/2", ++ ++ "FPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 3/4V2 1/2", ++ ++ "GPIT 1755Z 22015G25KT 1 3/4SM R22L/2700FT R16/1200FT " ++ "R34/1000V1600FT R01L/P6000FT R04RR/900FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/16 A2992 " ++ "RMK 58033 6003/ TWELVE 70125 10039 20029 410840112 " ++ "PCPN 0009 WSHFT 1715 PK WND 2032/1725 " ++ "CIG 20V25 WND 12V25 TWR VIS 2 1/2 " ++ "SFC VIS 1 1/2 VIS 3/4V3", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB M18/M16 A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB M18/16 A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/M16 A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB MM/M16 A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB MM/16 A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB M18/MM A2992", ++ ++ "KPIT 1935Z 22015G25KT 1 3/4SM R22L/2700FT " ++ "TSRA -DZ FG +SNPE SCT005 BKN010 OVC250CB 18/MM A2992", ++ ++ NULL}; ++ ++ ++void dispMetarStation( CMetarStation *s ) ++{ ++ glPointSize( 2.0 ); ++ glColor3d(1.0,1.0,0.0); ++ glVertex3d( s->locationCart().x()/1000.0, s->locationCart().y()/1000.0, s->locationCart().z()/1000.0 ); ++} ++ ++static int ii = 0; ++ ++void ++display(void) ++{ ++ glPushMatrix(); ++ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); ++ glRotatef((ii%360), 1.0, 0.0, 0.0); ++ glRotatef((ii%360), 0.0, 1.0, 0.0); ++ glRotatef((ii%360), 0.0, 0.0, 1.0); ++ glBegin( GL_POINTS ); ++ CMetarStation::for_each( dispMetarStation ); ++ glEnd(); ++ glColor3d(0.0, 0.0, 1.0); ++ glutWireSphere(EARTH_RAD,32,16); ++ glutSwapBuffers(); ++ ii++; ++ glPopMatrix(); ++} ++ ++ ++void ++idle(void) ++{ ++// std::cout << "Idle" << std::endl; ++ glutPostRedisplay(); ++} ++ ++ ++void ++init(void) ++{ ++ glEnable(GL_DEPTH_TEST); ++ ++ glMatrixMode(GL_PROJECTION); ++ gluPerspective( 50.0, 1.0, 1.0, 40000.0); ++ glMatrixMode(GL_MODELVIEW); ++ gluLookAt(0.0, -19000.0, 0.0, ++ 0.0, 0.0, 0.0, ++ 0.0, 0.0, 1.0); ++} ++ ++ ++void testMetarStation(int argc, ++ char **argv ) ++{ ++ std::cout << "Display all Metar Stations" << std::endl; ++ glutInit(&argc, argv); ++ glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); ++ glutCreateWindow("Metar Stations"); ++ glutDisplayFunc(display); ++ glutIdleFunc(idle); ++ init(); ++ glutMainLoop(); ++} ++ ++void testMetarReport() ++{ ++ std::cout << "Decode some Metar reports" << std::endl; ++ int i = 0; ++ while ( report[i] ) ++ { ++ std::cout << i << ": " << report[i] << std::endl; ++ ++ CMetarReport dr( report[i] ); ++ ++ //dr.dump(); ++ std::cout << dr << std::endl; ++ ++ CMetarStation *ms = CMetarStation::find( dr.StationID() ); ++ if ( ms ) ++ { ++ std::cout << *ms << std::endl; ++ } ++ else ++ { ++ std::cout << "No corresponding METAR station found" << std::endl; ++ } ++ i++; ++ } ++} ++ ++int ++main( ++ int argc, ++ char **argv ) ++{ ++ std::cout << "Metar subsystem test" << std::endl; ++ ++ testMetarReport(); ++ testMetarStation( argc, argv ); ++ return 0; ++} diff --cc simgear/metar/MetarTest/MetarLibTest.dsp index 00000000,00000000..1fcc603d new file mode 100644 --- /dev/null +++ b/simgear/metar/MetarTest/MetarLibTest.dsp @@@ -1,0 -1,0 +1,100 @@@ ++# Microsoft Developer Studio Project File - Name="MetarLibTest" - Package Owner=<4> ++# Microsoft Developer Studio Generated Build File, Format Version 6.00 ++# ** DO NOT EDIT ** ++ ++# TARGTYPE "Win32 (x86) Console Application" 0x0103 ++ ++CFG=MetarLibTest - Win32 Debug ++!MESSAGE This is not a valid makefile. To build this project using NMAKE, ++!MESSAGE use the Export Makefile command and run ++!MESSAGE ++!MESSAGE NMAKE /f "MetarLibTest.mak". ++!MESSAGE ++!MESSAGE You can specify a configuration when running NMAKE ++!MESSAGE by defining the macro CFG on the command line. For example: ++!MESSAGE ++!MESSAGE NMAKE /f "MetarLibTest.mak" CFG="MetarLibTest - Win32 Debug" ++!MESSAGE ++!MESSAGE Possible choices for configuration are: ++!MESSAGE ++!MESSAGE "MetarLibTest - Win32 Release" (based on "Win32 (x86) Console Application") ++!MESSAGE "MetarLibTest - Win32 Debug" (based on "Win32 (x86) Console Application") ++!MESSAGE ++ ++# Begin Project ++# PROP AllowPerConfigDependencies 0 ++# PROP Scc_ProjName "" ++# PROP Scc_LocalPath "" ++CPP=cl.exe ++RSC=rc.exe ++ ++!IF "$(CFG)" == "MetarLibTest - Win32 Release" ++ ++# PROP BASE Use_MFC 0 ++# PROP BASE Use_Debug_Libraries 0 ++# PROP BASE Output_Dir "Release" ++# PROP BASE Intermediate_Dir "Release" ++# PROP BASE Target_Dir "" ++# PROP Use_MFC 0 ++# PROP Use_Debug_Libraries 0 ++# PROP Output_Dir "Release" ++# PROP Intermediate_Dir "Release" ++# PROP Target_Dir "" ++# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ++# ADD CPP /nologo /W3 /GX /Zi /O2 /I "..\..\..\lib" /I "..\lib" /I "..\..\lib" /I "..\..\..\..\lib" /I ".." /I "..\.." /I "..\..\.." /I "..\..\..\.." /I "..\include" /I "..\..\include" /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ++# ADD BASE RSC /l 0x409 /d "NDEBUG" ++# ADD RSC /l 0x409 /d "NDEBUG" ++BSC32=bscmake.exe ++# ADD BASE BSC32 /nologo ++# ADD BSC32 /nologo ++LINK32=link.exe ++# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ++# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ++ ++!ELSEIF "$(CFG)" == "MetarLibTest - Win32 Debug" ++ ++# PROP BASE Use_MFC 0 ++# PROP BASE Use_Debug_Libraries 1 ++# PROP BASE Output_Dir "Debug" ++# PROP BASE Intermediate_Dir "Debug" ++# PROP BASE Target_Dir "" ++# PROP Use_MFC 0 ++# PROP Use_Debug_Libraries 1 ++# PROP Output_Dir "Debug" ++# PROP Intermediate_Dir "Debug" ++# PROP Target_Dir "" ++# ADD BASE CPP /nologo /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c ++# ADD CPP /nologo /W3 /GX /Zi /Od /I "..\..\..\lib" /I "..\lib" /I "..\..\lib" /I "..\..\..\..\lib" /I ".." /I "..\.." /I "..\..\.." /I "..\..\..\.." /I "..\include" /I "..\..\include" /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ++# ADD BASE RSC /l 0x409 /d "_DEBUG" ++# ADD RSC /l 0x409 /d "_DEBUG" ++BSC32=bscmake.exe ++# ADD BASE BSC32 /nologo ++# ADD BSC32 /nologo ++LINK32=link.exe ++# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ++# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ++ ++!ENDIF ++ ++# Begin Target ++ ++# Name "MetarLibTest - Win32 Release" ++# Name "MetarLibTest - Win32 Debug" ++# Begin Group "Source Files" ++ ++# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" ++# Begin Source File ++ ++SOURCE=.\MetarLibTest.cpp ++# End Source File ++# End Group ++# Begin Group "Header Files" ++ ++# PROP Default_Filter "h;hpp;hxx;hm;inl" ++# End Group ++# Begin Group "Resource Files" ++ ++# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" ++# End Group ++# End Target ++# End Project diff --cc simgear/metar/MetarTest/MetarTest.dsw index 00000000,00000000..f816a054 new file mode 100644 --- /dev/null +++ b/simgear/metar/MetarTest/MetarTest.dsw @@@ -1,0 -1,0 +1,95 @@@ ++Microsoft Developer Studio Workspace File, Format Version 6.00 ++# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ++ ++############################################################################### ++ ++Project: "LibMisc"=..\..\..\..\Win32\Workspace\LibMisc\LibMisc.dsp - Package Owner=<4> ++ ++Package=<5> ++{{{ ++}}} ++ ++Package=<4> ++{{{ ++}}} ++ ++############################################################################### ++ ++Project: "Metar"=..\Metar.dsp - Package Owner=<4> ++ ++Package=<5> ++{{{ ++}}} ++ ++Package=<4> ++{{{ ++}}} ++ ++############################################################################### ++ ++Project: "MetarLibTest"=.\MetarLibTest.dsp - Package Owner=<4> ++ ++Package=<5> ++{{{ ++}}} ++ ++Package=<4> ++{{{ ++ Begin Project Dependency ++ Project_Dep_Name Metar ++ End Project Dependency ++ Begin Project Dependency ++ Project_Dep_Name MetarLib ++ End Project Dependency ++ Begin Project Dependency ++ Project_Dep_Name glut ++ End Project Dependency ++ Begin Project Dependency ++ Project_Dep_Name LibMisc ++ End Project Dependency ++}}} ++ ++############################################################################### ++ ++Project: "MetarTest"=.\MetarTest.dsp - Package Owner=<4> ++ ++Package=<5> ++{{{ ++}}} ++ ++Package=<4> ++{{{ ++ Begin Project Dependency ++ Project_Dep_Name Metar ++ End Project Dependency ++ Begin Project Dependency ++ Project_Dep_Name MetarLib ++ End Project Dependency ++}}} ++ ++############################################################################### ++ ++Project: "glut"=..\..\..\..\..\glut\glut.dsp - Package Owner=<4> ++ ++Package=<5> ++{{{ ++}}} ++ ++Package=<4> ++{{{ ++}}} ++ ++############################################################################### ++ ++Global: ++ ++Package=<5> ++{{{ ++}}} ++ ++Package=<3> ++{{{ ++}}} ++ ++############################################################################### ++ diff --cc simgear/metar/Prtdmetr.cpp index 00000000,00000000..b9854bd8 new file mode 100644 --- /dev/null +++ b/simgear/metar/Prtdmetr.cpp @@@ -1,0 -1,0 +1,590 @@@ ++#include "Local.h" /* standard header file */ ++#include "Metar.h" ++#pragma page(1) ++#pragma subtitle("subtitle - description ") ++/********************************************************************/ ++/* */ ++/* Title: prtDMETR */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 15 Sep 1994 */ ++/* Programmer: CARL MCCALLA */ ++/* Language: C/370 */ ++/* */ ++/* Abstract: prtDMETR prints, in order of the ASOS METAR */ ++/* format, all non-initialized members of the structure */ ++/* addressed by the Decoded_METAR pointer. */ ++/* */ ++/* External Functions Called: */ ++/* None. */ ++/* */ ++/* Input: Mptr - ptr to a decoded_METAR structure. */ ++/* */ ++/* Output: NONE */ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++void prtDMETR( Decoded_METAR *Mptr ) ++{ ++ ++ /***************************/ ++ /* DECLARE LOCAL VARIABLES */ ++ /***************************/ ++ ++ int i; ++ ++ /*************************/ ++ /* START BODY OF ROUTINE */ ++ /*************************/ ++ ++ printf("\n\n\n/*******************************************/\n"); ++ printf("/* THE DECODED METAR REPORT FOLLOWS */\n"); ++ printf("/*******************************************/\n\n"); ++ ++ if( Mptr->codeName[ 0 ] != '\0' ) ++ printf("REPORT CODE NAME : %s\n",Mptr->codeName); ++ ++ if( Mptr->stnid[ 0 ] != '\0' ) ++ printf("STATION ID : %s\n",Mptr->stnid); ++ ++ if( Mptr->ob_date != MAXINT ) ++ printf("OBSERVATION DAY : %d\n",Mptr->ob_date); ++ ++ if( Mptr->ob_hour != MAXINT ) ++ printf("OBSERVATION HOUR : %d\n",Mptr->ob_hour); ++ ++ if( Mptr->ob_minute != MAXINT ) ++ printf("OBSERVATION MINUTE : %d\n",Mptr->ob_minute); ++ ++ if( Mptr->NIL_rpt ) ++ printf("NIL REPORT : TRUE\n"); ++ ++ if( Mptr->AUTO ) ++ printf("AUTO REPORT : TRUE\n"); ++ ++ if( Mptr->COR ) ++ printf("CORRECTED REPORT : TRUE\n"); ++ ++ if( Mptr->winData.windVRB ) ++ printf("WIND DIRECTION VRB : TRUE\n"); ++ ++ if( Mptr->winData.windDir != MAXINT ) ++ printf("WIND DIRECTION : %d\n",Mptr->winData.windDir); ++ ++ if( Mptr->winData.windSpeed != MAXINT ) ++ printf("WIND SPEED : %d\n",Mptr->winData.windSpeed); ++ ++ if( Mptr->winData.windGust != MAXINT ) ++ printf("WIND GUST : %d\n",Mptr->winData.windGust); ++ ++ if( Mptr->winData.windUnits[ 0 ] != '\0' ) ++ printf("WIND UNITS : %s\n",Mptr->winData.windUnits); ++ ++ if( Mptr->minWnDir != MAXINT ) ++ printf("MIN WIND DIRECTION : %d\n",Mptr->minWnDir); ++ ++ if( Mptr->maxWnDir != MAXINT ) ++ printf("MAX WIND DIRECTION : %d\n",Mptr->maxWnDir); ++ ++ if( Mptr->prevail_vsbyM != (float) MAXINT ) ++ printf("PREVAIL VSBY (M) : %f\n",Mptr->prevail_vsbyM); ++ ++ if( Mptr->prevail_vsbyKM != (float) MAXINT ) ++ printf("PREVAIL VSBY (KM) : %f\n",Mptr->prevail_vsbyKM); ++ ++ if( Mptr->prevail_vsbySM != (float) MAXINT ) ++ printf("PREVAIL VSBY (SM) : %.3f\n",Mptr->prevail_vsbySM); ++ ++ if( Mptr->charPrevailVsby[0] != '\0' ) ++ printf("PREVAIL VSBY (CHAR) : %s\n",Mptr->charPrevailVsby); ++ ++ if( Mptr->vsby_Dir[ 0 ] != '\0' ) ++ printf("VISIBILITY DIRECTION: %s\n",Mptr->vsby_Dir); ++ ++ if( Mptr->RVRNO ) ++ printf("RVRNO : TRUE\n"); ++ ++ for ( i = 0; i < 12; i++ ) ++ { ++ if( Mptr->RRVR[i].runway_designator[0] != '\0' ) ++ printf("RUNWAY DESIGNATOR : %s\n", ++ Mptr->RRVR[i].runway_designator); ++ ++ if( Mptr->RRVR[i].visRange != MAXINT ) ++ printf("R_WAY VIS RANGE (FT): %d\n", ++ Mptr->RRVR[i].visRange); ++ ++ if( Mptr->RRVR[i].vrbl_visRange ) ++ printf("VRBL VISUAL RANGE : TRUE\n"); ++ ++ if( Mptr->RRVR[i].below_min_RVR ) ++ printf("BELOW MIN RVR : TRUE\n"); ++ ++ if( Mptr->RRVR[i].above_max_RVR ) ++ printf("ABOVE MAX RVR : TRUE\n"); ++ ++ if( Mptr->RRVR[i].Max_visRange != MAXINT ) ++ printf("MX R_WAY VISRNG (FT): %d\n", ++ Mptr->RRVR[i].Max_visRange); ++ ++ if( Mptr->RRVR[i].Min_visRange != MAXINT ) ++ printf("MN R_WAY VISRNG (FT): %d\n", ++ Mptr->RRVR[i].Min_visRange); ++ ++ } ++ ++ ++ if( Mptr->DVR.visRange != MAXINT ) ++ printf("DISPATCH VIS RANGE : %d\n", ++ Mptr->DVR.visRange); ++ ++ if( Mptr->DVR.vrbl_visRange ) ++ printf("VRBL DISPATCH VISRNG: TRUE\n"); ++ ++ if( Mptr->DVR.below_min_DVR ) ++ printf("BELOW MIN DVR : TRUE\n"); ++ ++ if( Mptr->DVR.above_max_DVR ) ++ printf("ABOVE MAX DVR : TRUE\n"); ++ ++ if( Mptr->DVR.Max_visRange != MAXINT ) ++ printf("MX DSPAT VISRNG (FT): %d\n", ++ Mptr->DVR.Max_visRange); ++ ++ if( Mptr->DVR.Min_visRange != MAXINT ) ++ printf("MN DSPAT VISRNG (FT): %d\n", ++ Mptr->DVR.Min_visRange); ++ ++ ++ i = 0; ++ while ( Mptr->WxObstruct[i][0] != '\0' && i < MAXWXSYMBOLS ) ++ { ++ printf("WX/OBSTRUCT VISION : %s\n", ++ Mptr->WxObstruct[i] ); ++ i++; ++ } ++ ++ if( Mptr->PartialObscurationAmt[0][0] != '\0' ) ++ printf("OBSCURATION AMOUNT : %s\n", ++ &(Mptr->PartialObscurationAmt[0][0])); ++ ++ if( Mptr->PartialObscurationPhenom[0][0] != '\0' ) ++ printf("OBSCURATION PHENOM : %s\n", ++ &(Mptr->PartialObscurationPhenom[0][0])); ++ ++ ++ if( Mptr->PartialObscurationAmt[1][0] != '\0' ) ++ printf("OBSCURATION AMOUNT : %s\n", ++ &(Mptr->PartialObscurationAmt[1][0])); ++ ++ if( Mptr->PartialObscurationPhenom[1][0] != '\0' ) ++ printf("OBSCURATION PHENOM : %s\n", ++ &(Mptr->PartialObscurationPhenom[1][0])); ++ ++ i = 0; ++ while ( Mptr->cldTypHgt[ i ].cloud_type[0] != '\0' && ++ i < 6 ) ++ { ++ if( Mptr->cldTypHgt[ i ].cloud_type[0] != '\0' ) ++ printf("CLOUD COVER : %s\n", ++ Mptr->cldTypHgt[ i ].cloud_type); ++ ++ if( Mptr->cldTypHgt[ i ].cloud_hgt_char[0] != '\0' ) ++ printf("CLOUD HGT (CHARAC.) : %s\n", ++ Mptr->cldTypHgt[ i ].cloud_hgt_char); ++ ++ if( Mptr->cldTypHgt[ i ].cloud_hgt_meters != MAXINT) ++ printf("CLOUD HGT (METERS) : %d\n", ++ Mptr->cldTypHgt[ i ].cloud_hgt_meters); ++ ++ if( Mptr->cldTypHgt[ i ].other_cld_phenom[0] != '\0' ) ++ printf("OTHER CLOUD PHENOM : %s\n", ++ Mptr->cldTypHgt[ i ].other_cld_phenom); ++ ++ i++; ++ ++ } ++ ++ if( Mptr->temp != MAXINT ) ++ printf("TEMP. (CELSIUS) : %d\n", Mptr->temp); ++ ++ if( Mptr->dew_pt_temp != MAXINT ) ++ printf("D.P. TEMP. (CELSIUS): %d\n", Mptr->dew_pt_temp); ++ ++ if( Mptr->A_altstng ) ++ printf("ALTIMETER (INCHES) : %.2f\n", ++ Mptr->inches_altstng ); ++ ++ if( Mptr->Q_altstng ) ++ printf("ALTIMETER (PASCALS) : %d\n", ++ Mptr->hectoPasc_altstng ); ++ ++ if( Mptr->TornadicType[0] != '\0' ) ++ printf("TORNADIC ACTVTY TYPE: %s\n", ++ Mptr->TornadicType ); ++ ++ if( Mptr->BTornadicHour != MAXINT ) ++ printf("TORN. ACTVTY BEGHOUR: %d\n", ++ Mptr->BTornadicHour ); ++ ++ if( Mptr->BTornadicMinute != MAXINT ) ++ printf("TORN. ACTVTY BEGMIN : %d\n", ++ Mptr->BTornadicMinute ); ++ ++ if( Mptr->ETornadicHour != MAXINT ) ++ printf("TORN. ACTVTY ENDHOUR: %d\n", ++ Mptr->ETornadicHour ); ++ ++ if( Mptr->ETornadicMinute != MAXINT ) ++ printf("TORN. ACTVTY ENDMIN : %d\n", ++ Mptr->ETornadicMinute ); ++ ++ if( Mptr->TornadicDistance != MAXINT ) ++ printf("TORN. DIST. FROM STN: %d\n", ++ Mptr->TornadicDistance ); ++ ++ if( Mptr->TornadicLOC[0] != '\0' ) ++ printf("TORNADIC LOCATION : %s\n", ++ Mptr->TornadicLOC ); ++ ++ if( Mptr->TornadicDIR[0] != '\0' ) ++ printf("TORNAD. DIR FROM STN: %s\n", ++ Mptr->TornadicDIR ); ++ ++ if( Mptr->TornadicMovDir[0] != '\0' ) ++ printf("TORNADO DIR OF MOVM.: %s\n", ++ Mptr->TornadicMovDir ); ++ ++ ++ if( Mptr->autoIndicator[0] != '\0' ) ++ printf("AUTO INDICATOR : %s\n", ++ Mptr->autoIndicator); ++ ++ if( Mptr->PKWND_dir != MAXINT ) ++ printf("PEAK WIND DIRECTION : %d\n",Mptr->PKWND_dir); ++ if( Mptr->PKWND_speed != MAXINT ) ++ printf("PEAK WIND SPEED : %d\n",Mptr->PKWND_speed); ++ if( Mptr->PKWND_hour != MAXINT ) ++ printf("PEAK WIND HOUR : %d\n",Mptr->PKWND_hour); ++ if( Mptr->PKWND_minute != MAXINT ) ++ printf("PEAK WIND MINUTE : %d\n",Mptr->PKWND_minute); ++ ++ if( Mptr->WshfTime_hour != MAXINT ) ++ printf("HOUR OF WIND SHIFT : %d\n",Mptr->WshfTime_hour); ++ if( Mptr->WshfTime_minute != MAXINT ) ++ printf("MINUTE OF WIND SHIFT: %d\n",Mptr->WshfTime_minute); ++ if( Mptr->Wshft_FROPA != FALSE ) ++ printf("FROPA ASSOC. W/WSHFT: TRUE\n"); ++ ++ if( Mptr->TWR_VSBY != (float) MAXINT ) ++ printf("TOWER VISIBILITY : %.2f\n",Mptr->TWR_VSBY); ++ if( Mptr->SFC_VSBY != (float) MAXINT ) ++ printf("SURFACE VISIBILITY : %.2f\n",Mptr->SFC_VSBY); ++ ++ if( Mptr->minVsby != (float) MAXINT ) ++ printf("MIN VRBL_VIS (SM) : %.4f\n",Mptr->minVsby); ++ if( Mptr->maxVsby != (float) MAXINT ) ++ printf("MAX VRBL_VIS (SM) : %.4f\n",Mptr->maxVsby); ++ ++ if( Mptr->VSBY_2ndSite != (float) MAXINT ) ++ printf("VSBY_2ndSite (SM) : %.4f\n",Mptr->VSBY_2ndSite); ++ if( Mptr->VSBY_2ndSite_LOC[0] != '\0' ) ++ printf("VSBY_2ndSite LOC. : %s\n", ++ Mptr->VSBY_2ndSite_LOC); ++ ++ ++ if( Mptr->OCNL_LTG ) ++ printf("OCCASSIONAL LTG : TRUE\n"); ++ ++ if( Mptr->FRQ_LTG ) ++ printf("FREQUENT LIGHTNING : TRUE\n"); ++ ++ if( Mptr->CNS_LTG ) ++ printf("CONTINUOUS LTG : TRUE\n"); ++ ++ if( Mptr->CG_LTG ) ++ printf("CLOUD-GROUND LTG : TRUE\n"); ++ ++ if( Mptr->IC_LTG ) ++ printf("IN-CLOUD LIGHTNING : TRUE\n"); ++ ++ if( Mptr->CC_LTG ) ++ printf("CLD-CLD LIGHTNING : TRUE\n"); ++ ++ if( Mptr->CA_LTG ) ++ printf("CLOUD-AIR LIGHTNING : TRUE\n"); ++ ++ if( Mptr->AP_LTG ) ++ printf("LIGHTNING AT AIRPORT: TRUE\n"); ++ ++ if( Mptr->OVHD_LTG ) ++ printf("LIGHTNING OVERHEAD : TRUE\n"); ++ ++ if( Mptr->DSNT_LTG ) ++ printf("DISTANT LIGHTNING : TRUE\n"); ++ ++ if( Mptr->LightningVCTS ) ++ printf("L'NING W/I 5-10(ALP): TRUE\n"); ++ ++ if( Mptr->LightningTS ) ++ printf("L'NING W/I 5 (ALP) : TRUE\n"); ++ ++ if( Mptr->VcyStn_LTG ) ++ printf("VCY STN LIGHTNING : TRUE\n"); ++ ++ if( Mptr->LTG_DIR[0] != '\0' ) ++ printf("DIREC. OF LIGHTNING : %s\n", Mptr->LTG_DIR); ++ ++ ++ ++ i = 0; ++ while( i < 3 && Mptr->ReWx[ i ].Recent_weather[0] != '\0' ) ++ { ++ printf("RECENT WEATHER : %s", ++ Mptr->ReWx[i].Recent_weather); ++ ++ if( Mptr->ReWx[i].Bhh != MAXINT ) ++ printf(" BEG_hh = %d",Mptr->ReWx[i].Bhh); ++ if( Mptr->ReWx[i].Bmm != MAXINT ) ++ printf(" BEG_mm = %d",Mptr->ReWx[i].Bmm); ++ ++ if( Mptr->ReWx[i].Ehh != MAXINT ) ++ printf(" END_hh = %d",Mptr->ReWx[i].Ehh); ++ if( Mptr->ReWx[i].Emm != MAXINT ) ++ printf(" END_mm = %d",Mptr->ReWx[i].Emm); ++ ++ printf("\n"); ++ ++ i++; ++ } ++ ++ if( Mptr->minCeiling != MAXINT ) ++ printf("MIN VRBL_CIG (FT) : %d\n",Mptr->minCeiling); ++ if( Mptr->maxCeiling != MAXINT ) ++ printf("MAX VRBL_CIG (FT)) : %d\n",Mptr->maxCeiling); ++ ++ if( Mptr->CIG_2ndSite_Meters != MAXINT ) ++ printf("CIG2ndSite (FT) : %d\n",Mptr->CIG_2ndSite_Meters); ++ if( Mptr->CIG_2ndSite_LOC[0] != '\0' ) ++ printf("CIG @ 2nd Site LOC. : %s\n",Mptr->CIG_2ndSite_LOC); ++ ++ if( Mptr->PRESFR ) ++ printf("PRESFR : TRUE\n"); ++ if( Mptr->PRESRR ) ++ printf("PRESRR : TRUE\n"); ++ ++ if( Mptr->SLPNO ) ++ printf("SLPNO : TRUE\n"); ++ ++ if( Mptr->SLP != (float) MAXINT ) ++ printf("SLP (hPa) : %.1f\n", Mptr->SLP); ++ ++ if( Mptr->SectorVsby != (float) MAXINT ) ++ printf("SECTOR VSBY (MILES) : %.2f\n", Mptr->SectorVsby ); ++ ++ if( Mptr->SectorVsby_Dir[ 0 ] != '\0' ) ++ printf("SECTOR VSBY OCTANT : %s\n", Mptr->SectorVsby_Dir ); ++ ++ if( Mptr->TS_LOC[ 0 ] != '\0' ) ++ printf("THUNDERSTORM LOCAT. : %s\n", Mptr->TS_LOC ); ++ ++ if( Mptr->TS_MOVMNT[ 0 ] != '\0' ) ++ printf("THUNDERSTORM MOVMNT.: %s\n", Mptr->TS_MOVMNT); ++ ++ if( Mptr->GR ) ++ printf("GR (HAILSTONES) : TRUE\n"); ++ ++ if( Mptr->GR_Size != (float) MAXINT ) ++ printf("HLSTO SIZE (INCHES) : %.3f\n",Mptr->GR_Size); ++ ++ if( Mptr->VIRGA ) ++ printf("VIRGA : TRUE\n"); ++ ++ if( Mptr->VIRGA_DIR[0] != '\0' ) ++ printf("DIR OF VIRGA FRM STN: %s\n", Mptr->VIRGA_DIR); ++ ++ for( i = 0; i < 6; i++ ) { ++ if( Mptr->SfcObscuration[i][0] != '\0' ) ++ printf("SfcObscuration : %s\n", ++ &(Mptr->SfcObscuration[i][0]) ); ++ } ++ ++ if( Mptr->Num8thsSkyObscured != MAXINT ) ++ printf("8ths of SkyObscured : %d\n",Mptr->Num8thsSkyObscured); ++ ++ if( Mptr->CIGNO ) ++ printf("CIGNO : TRUE\n"); ++ ++ if( Mptr->Ceiling != MAXINT ) ++ printf("Ceiling (ft) : %d\n",Mptr->Ceiling); ++ ++ if( Mptr->Estimated_Ceiling != MAXINT ) ++ printf("Estimated CIG (ft) : %d\n",Mptr->Estimated_Ceiling); ++ ++ if( Mptr->VrbSkyBelow[0] != '\0' ) ++ printf("VRB SKY COND BELOW : %s\n",Mptr->VrbSkyBelow); ++ ++ if( Mptr->VrbSkyAbove[0] != '\0' ) ++ printf("VRB SKY COND ABOVE : %s\n",Mptr->VrbSkyAbove); ++ ++ if( Mptr->VrbSkyLayerHgt != MAXINT ) ++ printf("VRBSKY COND HGT (FT): %d\n",Mptr->VrbSkyLayerHgt); ++ ++ if( Mptr->ObscurAloftHgt != MAXINT ) ++ printf("Hgt Obscur Aloft(ft): %d\n",Mptr->ObscurAloftHgt); ++ ++ if( Mptr->ObscurAloft[0] != '\0' ) ++ printf("Obscur Phenom Aloft : %s\n",Mptr->ObscurAloft); ++ ++ if( Mptr->ObscurAloftSkyCond[0] != '\0' ) ++ printf("Obscur ALOFT SKYCOND: %s\n",Mptr->ObscurAloftSkyCond); ++ ++ ++ if( Mptr->NOSPECI ) ++ printf("NOSPECI : TRUE\n"); ++ ++ if( Mptr->LAST ) ++ printf("LAST : TRUE\n"); ++ ++ if( Mptr->synoptic_cloud_type[ 0 ] != '\0' ) ++ printf("SYNOPTIC CLOUD GROUP: %s\n",Mptr->synoptic_cloud_type); ++ ++ if( Mptr->CloudLow != '\0' ) ++ printf("LOW CLOUD CODE : %c\n",Mptr->CloudLow); ++ ++ if( Mptr->CloudMedium != '\0' ) ++ printf("MEDIUM CLOUD CODE : %c\n",Mptr->CloudMedium); ++ ++ if( Mptr->CloudHigh != '\0' ) ++ printf("HIGH CLOUD CODE : %c\n",Mptr->CloudHigh); ++ ++ if( Mptr->SNINCR != MAXINT ) ++ printf("SNINCR (INCHES) : %d\n",Mptr->SNINCR); ++ ++ if( Mptr->SNINCR_TotalDepth != MAXINT ) ++ printf("SNINCR(TOT. INCHES) : %d\n",Mptr->SNINCR_TotalDepth); ++ ++ if( Mptr->snow_depth_group[ 0 ] != '\0' ) ++ printf("SNOW DEPTH GROUP : %s\n",Mptr->snow_depth_group); ++ ++ if( Mptr->snow_depth != MAXINT ) ++ printf("SNOW DEPTH (INCHES) : %d\n",Mptr->snow_depth); ++ ++ if( Mptr->WaterEquivSnow != (float) MAXINT ) ++ printf("H2O EquivSno(inches): %.2f\n",Mptr->WaterEquivSnow); ++ ++ if( Mptr->SunshineDur != MAXINT ) ++ printf("SUNSHINE (MINUTES) : %d\n",Mptr->SunshineDur); ++ ++ if( Mptr->SunSensorOut ) ++ printf("SUN SENSOR OUT : TRUE\n"); ++ ++ if( Mptr->hourlyPrecip != (float) MAXINT ) ++ printf("HRLY PRECIP (INCHES): %.2f\n",Mptr->hourlyPrecip); ++ ++ if( Mptr->precip_amt != (float) MAXINT) ++ printf("3/6HR PRCIP (INCHES): %.2f\n", ++ Mptr->precip_amt); ++ ++ if( Mptr->Indeterminant3_6HrPrecip ) ++ printf("INDTRMN 3/6HR PRECIP: TRUE\n"); ++ ++ if( Mptr->precip_24_amt != (float) MAXINT) ++ printf("24HR PRECIP (INCHES): %.2f\n", ++ Mptr->precip_24_amt); ++ ++ if( Mptr->Temp_2_tenths != (float) MAXINT ) ++ printf("TMP2TENTHS (CELSIUS): %.1f\n",Mptr->Temp_2_tenths); ++ ++ if( Mptr->DP_Temp_2_tenths != (float) MAXINT ) ++ printf("DPT2TENTHS (CELSIUS): %.1f\n",Mptr->DP_Temp_2_tenths); ++ ++ if( Mptr->maxtemp != (float) MAXINT) ++ printf("MAX TEMP (CELSIUS) : %.1f\n", ++ Mptr->maxtemp); ++ ++ if( Mptr->mintemp != (float) MAXINT) ++ printf("MIN TEMP (CELSIUS) : %.1f\n", ++ Mptr->mintemp); ++ ++ if( Mptr->max24temp != (float) MAXINT) ++ printf("24HrMAXTMP (CELSIUS): %.1f\n", ++ Mptr->max24temp); ++ ++ if( Mptr->min24temp != (float) MAXINT) ++ printf("24HrMINTMP (CELSIUS): %.1f\n", ++ Mptr->min24temp); ++ ++ if( Mptr->char_prestndcy != MAXINT) ++ printf("CHAR PRESS TENDENCY : %d\n", ++ Mptr->char_prestndcy ); ++ ++ if( Mptr->prestndcy != (float) MAXINT) ++ printf("PRES. TENDENCY (hPa): %.1f\n", ++ Mptr->prestndcy ); ++ ++ if( Mptr->PWINO ) ++ printf("PWINO : TRUE\n"); ++ ++ if( Mptr->PNO ) ++ printf("PNO : TRUE\n"); ++ ++ if( Mptr->CHINO ) ++ printf("CHINO : TRUE\n"); ++ ++ if( Mptr->CHINO_LOC[0] != '\0' ) ++ printf("CHINO_LOC : %s\n",Mptr->CHINO_LOC); ++ ++ if( Mptr->VISNO ) ++ printf("VISNO : TRUE\n"); ++ ++ if( Mptr->VISNO_LOC[0] != '\0' ) ++ printf("VISNO_LOC : %s\n",Mptr->VISNO_LOC); ++ ++ if( Mptr->FZRANO ) ++ printf("FZRANO : TRUE\n"); ++ ++ if( Mptr->TSNO ) ++ printf("TSNO : TRUE\n"); ++ ++ if( Mptr->DollarSign) ++ printf("DOLLAR $IGN INDCATR : TRUE\n"); ++ ++ if( Mptr->horiz_vsby[ 0 ] != '\0' ) ++ printf("HORIZ VISIBILITY : %s\n",Mptr->horiz_vsby); ++ ++ if( Mptr->dir_min_horiz_vsby[ 0 ] != '\0' ) ++ printf("DIR MIN HORIZ VSBY : %s\n",Mptr->dir_min_horiz_vsby); ++ ++ if( Mptr->CAVOK ) ++ printf("CAVOK : TRUE\n"); ++ ++ ++ if( Mptr->VertVsby != MAXINT ) ++ printf("Vert. Vsby (meters) : %d\n", ++ Mptr->VertVsby ); ++ ++ if( Mptr->charVertVsby[0] != '\0' ) ++ printf("Vert. Vsby (CHAR) : %s\n", ++ Mptr->charVertVsby ); ++ ++ if( Mptr->QFE != MAXINT ) ++ printf("QFE : %d\n", Mptr->QFE); ++ ++ if( Mptr->VOLCASH ) ++ printf("VOLCANIC ASH : TRUE\n"); ++ ++ if( Mptr->min_vrbl_wind_dir != MAXINT ) ++ printf("MIN VRBL WIND DIR : %d\n",Mptr->min_vrbl_wind_dir); ++ if( Mptr->max_vrbl_wind_dir != MAXINT ) ++ printf("MAX VRBL WIND DIR : %d\n",Mptr->max_vrbl_wind_dir); ++ ++ ++ printf("\n\n\n"); ++ ++ ++ return; ++ ++} diff --cc simgear/metar/README.Metar index 00000000,00000000..59ae797f new file mode 100644 --- /dev/null +++ b/simgear/metar/README.Metar @@@ -1,0 -1,0 +1,69 @@@ ++There are 2 classes: CMetarStation (MetarStation.h) and CMetarReport ++(MetarReport.h). These classes provide mechanisms to get information ++about meteorological data reporting stations and about the reports ++themselves. These stations and reports are known as METAR. See ++http://tgsv5.nws.noaa.gov/oso/oso1/oso12/metar.htm for information ++from the USA perspective. Quoting from that site: ++ ++ On 1 July 1996, the international standard code for hourly and special ++ surface weather observations, METAR/SPECI, took effect. ++ The METAR acronym roughly translates from the French as Aviation ++ Routine Weather Report . A special report, SPECI, is merely a METAR ++ formatted report which is issued on a non-routine basis as dictated by ++ changing meteorological conditions. The SPECI acronym roughly translates as ++ ++ Aviation Selected Special Weather Report . Meanwhile, the international ++ standard code format for terminal forecasts issued for airports, TAF, ++ also took effect. The acronym translates to Aerodrome Forecast. ++ ++This implementation ignores the SPECI and TAF acronyms, calling the ++entire system METAR. ++ ++The class CMetarStation is implemented by MetarStation.h and ++MetarStation.cpp. It decodes a text file containing information about ++individual METAR reporting stations and builds a static database of that ++information during static construction of the class. There are static ++member methods to find individual stations, and member functions to ++extract individual station attributes. The information about METAR ++stations probably has some overlap with FGFS airport information. That ++needs to be investigated. The METAR station information is kept in this ++file: ++ http://www.nws.noaa.gov/pub/stninfo/nsd_cccc.gz ++ http://www.nws.noaa.gov/pub/stninfo/nsd_cccc.txt ++This class looks for the file FG_ROOT/Weather/MetarStations instead of ++nsd_cccc. ++The current implementation does not look for updates to this file on the ++internet. ++ ++The class CMetarReport is implemented by MetarReport.h and MetarReport.cpp. ++It encapsulates the decoding software written by Carl McCalla at - ++ NOAA/National Weather Service ++ 1325 East-West Highway ++ SSMC2, W/OSO242, Station 5114 ++ Silver Spring, Maryland 20910 ++ Work: (301) 713-0882, Ext 115 ++ FAX: (301) 608-0911 ++ E-Mail Address: cmccalla@smtpgate.ssmc.noaa.gov ++http://www.nws.noaa.gov/software/ ++This software generally sucks and the CMetarReport class attempts to clean ++up some of that suckiness. A CMetarReport object is created with an ASCII ++string as a construction parameter. The string contains a METAR report. ++There ++are member methods to extract selected information from a report by calling ++the McCalla software. Additional information can be selected by adding new ++member methods as needed. Certainly the methods currently implemented are ++not sufficient. METAR reports are available via the internet. In the USA, ++NOAA provides individual METAR reports in this directory: ++ ftp://weather.noaa.gov/data/observations/metar/stations ++Other sources are available as well. The current implementation does not ++look for reports on the internet. ++ ++There is a test program in the MetarTest subdirectory. It requires that a ++#define be changed in the MetarStation.cpp file. Add #define TESTPROG to ++the code or -D TESTPROG to the compilation. This is necessary because the ++FGFS options class is coupled tightly to code that shouldn't be pulled into ++the test program. The test program will decode many METAR reports and ++display ++them to the screen, then it will plot all the METAR reporting stations on a ++tumbling globe. ++ diff --cc simgear/metar/Stspack2.cpp index 00000000,00000000..3f7a21c8 new file mode 100644 --- /dev/null +++ b/simgear/metar/Stspack2.cpp @@@ -1,0 -1,0 +1,211 @@@ ++#pragma comment (compiler) ++//#pragma comment (date) ++//#pragma comment (timestamp) ++#pragma pagesize(80) ++ ++#include "Local.h" /* standard header file */ ++ ++#pragma page(1) ++#pragma subtitle(" ") ++#pragma subtitle("stspack2 - Local string test functions ") ++/********************************************************************/ ++/* */ ++/* Title: stspack2 */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 05 Oct 1992 */ ++/* Programmer: ALLAN DARLING */ ++/* Language: C/2 */ ++/* */ ++/* Abstract: The stspack2 package contains functions to */ ++/* perform the isalnum through isxdigit functions */ ++/* on strings. The functions come in four forms: */ ++/* those that test NULL delimited strings and are */ ++/* named in the form sxxxxxxx, those that test at */ ++/* most n characters and are named in the form */ ++/* nxxxxxxx, those that search forward in a string */ ++/* and are named in the form nxtyyyyy, and those */ ++/* that search backward in a string and are named */ ++/* in the form lstyyyyy. */ ++/* */ ++/* The xxxxxxx is the name of the test applied to */ ++/* each character in the string, such as isalpha, */ ++/* thus a function to test a NULL delimited string */ ++/* an return a nonzero value if all characters in */ ++/* the string are digits is named sisdigit. */ ++/* */ ++/* The yyyyy is the name of the test applied to */ ++/* characters in a string, minus the 'is' prefix. */ ++/* Thus a function to find the next digit in a NULL */ ++/* delimited string and return a pointer to it is */ ++/* named nxtdigit. */ ++/* */ ++/* The only exception to the naming rule is for the */ ++/* functions that test for hexadecimal digits. */ ++/* These are named sisxdigi, nisxdigi, nxtxdigi, */ ++/* and lstxdigi because of the eight character */ ++/* function name limitation. */ ++/* */ ++/* The nxxxxxxx class of functions will test up to */ ++/* n characters or the first NULL character */ ++/* encountered, whichever comes first. For all */ ++/* classes of functions, the string sentinal is */ ++/* not included in the test. */ ++/* */ ++/* External Functions Called: */ ++/* isalnum, isalpha, iscntrl, isdigit, isgraph, */ ++/* islower, isprint, ispunct, isspace, isupper, */ ++/* isxdigit. */ ++/* */ ++/* Input: For sxxxxxxx class functions, a pointer to a */ ++/* NULL delimited character string. */ ++/* */ ++/* For nxtyyyyy class functions, a pointer to a */ ++/* NULL delimited character string. */ ++/* */ ++/* for nxxxxxxx class functions, a pointer to a */ ++/* character array, and a positive, nonzero integer.*/ ++/* */ ++/* for lstyyyyy class functions, a pointer to a */ ++/* character array, and a positive, nonzero integer.*/ ++/* */ ++/* Output: A nonzero value if the test is true for all */ ++/* characters in the string, a zero value otherwise.*/ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++ ++int nisalnum(char *s, int n) { ++ ++ for (; *s && n; s++, n--) ++ ++ if (!isalnum(*s)) ++ return (0); ++ ++ return (1); ++ ++} /* end nisalnum */ ++ ++ ++int nisalpha(char *s, int n) { ++ ++ for (; *s && n; s++, n--) ++ ++ if (!isalpha(*s)) ++ return (0); ++ ++ return (1); ++ ++} /* end nisalpha */ ++ ++ ++int niscntrl(char *s, int n) { ++ ++ for (; *s && n; s++, n--) ++ ++ if (!iscntrl(*s)) ++ return (0); ++ ++ return (1); ++ ++} /* end niscntrl */ ++ ++ ++int nisdigit(char *s, int n) { ++ ++ for (; *s && n; s++, n--) ++ ++ if (!isdigit(*s)) ++ return (0); ++ ++ return (1); ++ ++} /* end nisdigit */ ++ ++ ++int nisgraph(char *s, int n) { ++ ++ for (; *s && n; s++, n--) ++ ++ if (!isgraph(*s)) ++ return (0); ++ ++ return (1); ++ ++} /* end nisgraph */ ++ ++ ++int nislower(char *s, int n) { ++ ++ for (; *s && n; s++, n--) ++ ++ if (!islower(*s)) ++ return (0); ++ ++ return (1); ++ ++} /* end nislower */ ++ ++ ++int nisprint(char *s, int n) { ++ ++ for (; *s && n; s++, n--) ++ ++ if (!isprint(*s)) ++ return (0); ++ ++ return (1); ++ ++} /* end nisprint */ ++ ++ ++int nispunct(char *s, int n) { ++ ++ for (; *s && n; s++, n--) ++ ++ if (!ispunct(*s)) ++ return (0); ++ ++ return (1); ++ ++} /* end nispunct */ ++ ++ ++int nisspace(char *s, int n) { ++ ++ for (; *s && n; s++, n--) ++ ++ if (!isspace(*s)) ++ return (0); ++ ++ return (1); ++ ++} /* end nisspace */ ++ ++ ++int nisupper(char *s, int n) { ++ ++ for (; *s && n; s++, n--) ++ ++ if (!isupper(*s)) ++ return (0); ++ ++ return (1); ++ ++} /* end nisupper */ ++ ++ ++int nisxdigi(char *s, int n) { ++ ++ for (; *s && n; s++, n--) ++ ++ if (!isxdigit(*s)) ++ return (0); ++ ++ return (1); ++ ++} /* end nisxdigi */ ++ ++#pragma page(1) diff --cc simgear/metar/Stspack3.cpp index 00000000,00000000..c927f8f9 new file mode 100644 --- /dev/null +++ b/simgear/metar/Stspack3.cpp @@@ -1,0 -1,0 +1,211 @@@ ++#pragma comment (compiler) ++//#pragma comment (date) ++//#pragma comment (timestamp) ++#pragma pagesize(80) ++ ++#include "Local.h" /* standard header file */ ++ ++#pragma page(1) ++#pragma subtitle(" ") ++#pragma subtitle("stspack3 - Local string test functions ") ++/********************************************************************/ ++/* */ ++/* Title: stspack3 */ ++/* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */ ++/* Date: 05 Oct 1992 */ ++/* Programmer: ALLAN DARLING */ ++/* Language: C/2 */ ++/* */ ++/* Abstract: The stspack3 package contains functions to */ ++/* perform the isalnum through isxdigit functions */ ++/* on strings. The functions come in four forms: */ ++/* those that test NULL delimited strings and are */ ++/* named in the form sxxxxxxx, those that test at */ ++/* most n characters and are named in the form */ ++/* nxxxxxxx, those that search forward in a string */ ++/* and are named in the form nxtyyyyy, and those */ ++/* that search backward in a string and are named */ ++/* in the form lstyyyyy. */ ++/* */ ++/* The xxxxxxx is the name of the test applied to */ ++/* each character in the string, such as isalpha, */ ++/* thus a function to test a NULL delimited string */ ++/* an return a nonzero value if all characters in */ ++/* the string are digits is named sisdigit. */ ++/* */ ++/* The yyyyy is the name of the test applied to */ ++/* characters in a string, minus the 'is' prefix. */ ++/* Thus a function to find the next digit in a NULL */ ++/* delimited string and return a pointer to it is */ ++/* named nxtdigit. */ ++/* */ ++/* The only exception to the naming rule is for the */ ++/* functions that test for hexadecimal digits. */ ++/* These are named sisxdigi, nisxdigi, nxtxdigi, */ ++/* and lstxdigi because of the eight character */ ++/* function name limitation. */ ++/* */ ++/* The nxxxxxxx class of functions will test up to */ ++/* n characters or the first NULL character */ ++/* encountered, whichever comes first. For all */ ++/* classes of functions, the string sentinal is */ ++/* not included in the test. */ ++/* */ ++/* External Functions Called: */ ++/* isalnum, isalpha, iscntrl, isdigit, isgraph, */ ++/* islower, isprint, ispunct, isspace, isupper, */ ++/* isxdigit. */ ++/* */ ++/* Input: For sxxxxxxx class functions, a pointer to a */ ++/* NULL delimited character string. */ ++/* */ ++/* For nxtyyyyy class functions, a pointer to a */ ++/* NULL delimited character string. */ ++/* */ ++/* for nxxxxxxx class functions, a pointer to a */ ++/* character array, and a positive, nonzero integer.*/ ++/* */ ++/* for lstyyyyy class functions, a pointer to a */ ++/* character array, and a positive, nonzero integer.*/ ++/* */ ++/* Output: A nonzero value if the test is true for all */ ++/* characters in the string, a zero value otherwise.*/ ++/* */ ++/* Modification History: */ ++/* None. */ ++/* */ ++/********************************************************************/ ++#pragma page(1) ++char *nxtalnum(char *s) { ++ ++ for (; !isalnum(*s) && *s; s++) ; ++ ++ if (*s) ++ return (s); ++ else ++ return (NULL); ++ ++} /* end nxtalnum */ ++ ++ ++char *nxtalpha(char *s) { ++ ++ for (; !isalpha(*s) && *s; s++) ; ++ ++ if (*s) ++ return (s); ++ else ++ return (NULL); ++ ++} /* end nxtalpha */ ++ ++ ++char *nxtcntrl(char *s) { ++ ++ for (; !iscntrl(*s) && *s; s++) ; ++ ++ if (*s) ++ return (s); ++ else ++ return (NULL); ++ ++} /* end nxtcntrl */ ++ ++ ++char *nxtdigit(char *s) { ++ ++ for (; !isdigit(*s) && *s; s++) ; ++ ++ if (*s) ++ return (s); ++ else ++ return (NULL); ++ ++} /* end nxtdigit */ ++ ++ ++char *nxtgraph(char *s) { ++ ++ for (; !isgraph(*s) && *s; s++) ; ++ ++ if (*s) ++ return (s); ++ else ++ return (NULL); ++ ++} /* end nxtgraph */ ++ ++ ++char *nxtlower(char *s) { ++ ++ for (; !islower(*s) && *s; s++) ; ++ ++ if (*s) ++ return (s); ++ else ++ return (NULL); ++ ++} /* end nxtlower */ ++ ++ ++char *nxtprint(char *s) { ++ ++ for (; !isprint(*s) && *s; s++) ; ++ ++ if (*s) ++ return (s); ++ else ++ return (NULL); ++ ++} /* end nxtprint */ ++ ++ ++char *nxtpunct(char *s) { ++ ++ for (; !ispunct(*s) && *s; s++) ; ++ ++ if (*s) ++ return (s); ++ else ++ return (NULL); ++ ++} /* end nxtpunct */ ++ ++ ++char *nxtspace(char *s) { ++ ++ for (; !isspace(*s) && *s; s++) ; ++ ++ if (*s) ++ return (s); ++ else ++ return (NULL); ++ ++} /* end nxtspace */ ++ ++ ++char *nxtupper(char *s) { ++ ++ for (; !isupper(*s) && *s; s++) ; ++ ++ if (*s) ++ return (s); ++ else ++ return (NULL); ++ ++} /* end nxtupper */ ++ ++ ++char *nxtxdigi(char *s) { ++ ++ for (; !isxdigit(*s) && *s; s++) ; ++ ++ if (*s) ++ return (s); ++ else ++ return (NULL); ++ ++} /* end nxtxdigi */ ++ ++ ++#pragma page(1) diff --cc simgear/misc/Makefile.am index 00000000,00000000..0691d537 new file mode 100644 --- /dev/null +++ b/simgear/misc/Makefile.am @@@ -1,0 -1,0 +1,30 @@@ ++## Process this file with automake to produce Makefile.in ++ ++if HAVE_ZLIB ++ZLIB_INCL = ++else ++ZLIB_INCL = -I$(top_builddir)/zlib ++endif ++ ++lib_LIBRARIES = libsgmisc.a ++ ++include_HEADERS = \ ++ fgpath.hxx \ ++ fgstream.hxx \ ++ stopwatch.hxx \ ++ strutils.hxx \ ++ texcoord.hxx \ ++ zfstream.hxx ++ ++libsgmisc_a_SOURCES = \ ++ fgpath.cxx \ ++ fgstream.cxx \ ++ strutils.cxx \ ++ texcoord.cxx \ ++ zfstream.cxx ++ ++INCLUDES += \ ++ -I$(top_builddir) \ ++ -I$(top_builddir)/bucket \ ++ -I$(top_builddir)/math \ ++ $(ZLIB_INCL) diff --cc simgear/misc/Makefile.in index 00000000,00000000..d18d18a7 new file mode 100644 --- /dev/null +++ b/simgear/misc/Makefile.in @@@ -1,0 -1,0 +1,356 @@@ ++# Makefile.in generated automatically by automake 1.3 from Makefile.am ++ ++# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++ ++SHELL = /bin/sh ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++prefix = @prefix@ ++exec_prefix = @exec_prefix@ ++ ++bindir = @bindir@ ++sbindir = @sbindir@ ++libexecdir = @libexecdir@ ++datadir = @datadir@ ++sysconfdir = @sysconfdir@ ++sharedstatedir = @sharedstatedir@ ++localstatedir = @localstatedir@ ++libdir = @libdir@ ++infodir = @infodir@ ++mandir = @mandir@ ++includedir = @includedir@ ++oldincludedir = /usr/include ++ ++DISTDIR = ++ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++ ++top_builddir = .. ++ ++ACLOCAL = @ACLOCAL@ ++AUTOCONF = @AUTOCONF@ ++AUTOMAKE = @AUTOMAKE@ ++AUTOHEADER = @AUTOHEADER@ ++ ++INSTALL = @INSTALL@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++transform = @program_transform_name@ ++ ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++CC = @CC@ ++CXX = @CXX@ ++LN_S = @LN_S@ ++MAKEINFO = @MAKEINFO@ ++PACKAGE = @PACKAGE@ ++RANLIB = @RANLIB@ ++VERSION = @VERSION@ ++base_LIBS = @base_LIBS@ ++opengl_LIBS = @opengl_LIBS@ ++ ++@HAVE_ZLIB_TRUE@ZLIB_INCL = ++@HAVE_ZLIB_FALSE@ZLIB_INCL = -I$(top_builddir)/zlib ++ ++lib_LIBRARIES = libsgmisc.a ++ ++include_HEADERS = \ ++ fgpath.hxx \ ++ fgstream.hxx \ ++ stopwatch.hxx \ ++ strutils.hxx \ ++ texcoord.hxx \ ++ zfstream.hxx ++ ++libsgmisc_a_SOURCES = \ ++ fgpath.cxx \ ++ fgstream.cxx \ ++ strutils.cxx \ ++ texcoord.cxx \ ++ zfstream.cxx ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = ../include/config.h ++CONFIG_CLEAN_FILES = ++LIBRARIES = $(lib_LIBRARIES) ++ ++ ++DEFS = @DEFS@ -I. -I$(srcdir) -I../include ++CPPFLAGS = @CPPFLAGS@ ++LDFLAGS = @LDFLAGS@ ++LIBS = @LIBS@ ++X_CFLAGS = @X_CFLAGS@ ++X_LIBS = @X_LIBS@ ++X_EXTRA_LIBS = @X_EXTRA_LIBS@ ++X_PRE_LIBS = @X_PRE_LIBS@ ++libsgmisc_a_LIBADD = ++libsgmisc_a_OBJECTS = fgpath.o fgstream.o strutils.o texcoord.o \ ++zfstream.o ++AR = ar ++CXXFLAGS = @CXXFLAGS@ ++CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++CXXLINK = $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ ++HEADERS = $(include_HEADERS) ++ ++DIST_COMMON = Makefile.am Makefile.in ++ ++ ++DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ++ ++TAR = tar ++GZIP = --best ++DEP_FILES = .deps/fgpath.P .deps/fgstream.P .deps/strutils.P \ ++.deps/texcoord.P .deps/zfstream.P ++CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++SOURCES = $(libsgmisc_a_SOURCES) ++OBJECTS = $(libsgmisc_a_OBJECTS) ++ ++all: Makefile $(LIBRARIES) $(HEADERS) ++ ++.SUFFIXES: ++.SUFFIXES: .S .c .cxx .o .s ++$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu misc/Makefile ++ ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++ ++mostlyclean-libLIBRARIES: ++ ++clean-libLIBRARIES: ++ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) ++ ++distclean-libLIBRARIES: ++ ++maintainer-clean-libLIBRARIES: ++ ++install-libLIBRARIES: $(lib_LIBRARIES) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(libdir) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ ++ $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ @$(POST_INSTALL) ++ @list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ ++ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ ++uninstall-libLIBRARIES: ++ @$(NORMAL_UNINSTALL) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(libdir)/$$p; \ ++ done ++ ++.s.o: ++ $(COMPILE) -c $< ++ ++.S.o: ++ $(COMPILE) -c $< ++ ++mostlyclean-compile: ++ -rm -f *.o core *.core ++ ++clean-compile: ++ ++distclean-compile: ++ -rm -f *.tab.c ++ ++maintainer-clean-compile: ++ ++libsgmisc.a: $(libsgmisc_a_OBJECTS) $(libsgmisc_a_DEPENDENCIES) ++ -rm -f libsgmisc.a ++ $(AR) cru libsgmisc.a $(libsgmisc_a_OBJECTS) $(libsgmisc_a_LIBADD) ++ $(RANLIB) libsgmisc.a ++.cxx.o: ++ $(CXXCOMPILE) -c $< ++ ++install-includeHEADERS: $(include_HEADERS) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(includedir) ++ @list='$(include_HEADERS)'; for p in $$list; do \ ++ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ ++ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ ++ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++uninstall-includeHEADERS: ++ @$(NORMAL_UNINSTALL) ++ list='$(include_HEADERS)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++tags: TAGS ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) ++ here=`pwd` && cd $(srcdir) \ ++ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) ++ ++TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ ++ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ ++mostlyclean-tags: ++ ++clean-tags: ++ ++distclean-tags: ++ -rm -f TAGS ID ++ ++maintainer-clean-tags: ++ ++distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) ++ ++subdir = misc ++ ++distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu misc/Makefile ++ @for file in $(DISTFILES); do \ ++ d=$(srcdir); \ ++ test -f $(distdir)/$$file \ ++ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ++ || cp -p $$d/$$file $(distdir)/$$file; \ ++ done ++ ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ ++maintainer-clean-depend: ++ -rm -rf .deps ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++ ++%.o: %.cxx ++ @echo '$(CXXCOMPILE) -c $<'; \ ++ $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.cxx ++ @echo '$(LTCXXCOMPILE) -c $<'; \ ++ $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++info: ++dvi: ++check: all ++ $(MAKE) ++installcheck: ++install-exec: install-libLIBRARIES ++ @$(NORMAL_INSTALL) ++ ++install-data: install-includeHEADERS ++ @$(NORMAL_INSTALL) ++ ++install: install-exec install-data all ++ @: ++ ++uninstall: uninstall-libLIBRARIES uninstall-includeHEADERS ++ ++install-strip: ++ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install ++installdirs: ++ $(mkinstalldirs) $(DATADIR)$(libdir) $(DATADIR)$(includedir) ++ ++ ++mostlyclean-generic: ++ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f Makefile $(DISTCLEANFILES) ++ -rm -f config.cache config.log stamp-h stamp-h[0-9]* ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) ++ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) ++mostlyclean: mostlyclean-libLIBRARIES mostlyclean-compile \ ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic ++ ++clean: clean-libLIBRARIES clean-compile clean-tags clean-depend \ ++ clean-generic mostlyclean ++ ++distclean: distclean-libLIBRARIES distclean-compile distclean-tags \ ++ distclean-depend distclean-generic clean ++ -rm -f config.status ++ ++maintainer-clean: maintainer-clean-libLIBRARIES \ ++ maintainer-clean-compile maintainer-clean-tags \ ++ maintainer-clean-depend maintainer-clean-generic \ ++ distclean ++ @echo "This command is intended for maintainers to use;" ++ @echo "it deletes files that may require special tools to rebuild." ++ ++.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \ ++clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ ++install-libLIBRARIES mostlyclean-compile distclean-compile \ ++clean-compile maintainer-clean-compile uninstall-includeHEADERS \ ++install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ ++maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ ++clean-depend maintainer-clean-depend info dvi installcheck install-exec \ ++install-data install uninstall all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean ++ ++ ++INCLUDES += \ ++ -I$(top_builddir) \ ++ -I$(top_builddir)/bucket \ ++ -I$(top_builddir)/math \ ++ $(ZLIB_INCL) ++ ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --cc simgear/misc/fgpath.cxx index 00000000,00000000..d31b44c6 new file mode 100644 --- /dev/null +++ b/simgear/misc/fgpath.cxx @@@ -1,0 -1,0 +1,101 @@@ ++// ++// fgpath.cxx -- routines to abstract out path separator differences ++// between MacOS and the rest of the world ++// ++// Written by Curtis L. Olson, started April 1999. ++// ++// Copyright (C) 1999 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$ ++ ++ ++#include "fgpath.hxx" ++ ++ ++// If Unix, replace all ":" with "/". If MacOS, replace all "/" with ++// ":" it should go without saying that neither of these characters ++// should be used in file or directory names. In windoze, allow the ++// second character to be a ":" for things like c:\foo\bar ++ ++static string fix_path( const string path ) { ++ string result = path; ++ ++ for ( int i = 0; i < (int)path.size(); ++i ) { ++#if defined( WIN32 ) ++ // for windoze, don't replace the ":" for the second character ++ if ( i == 1 ) { ++ continue; ++ } ++#endif ++ if ( result[i] == FG_BAD_PATH_SEP ) { ++ result[i] = FG_PATH_SEP; ++ } ++ } ++ ++ return result; ++} ++ ++ ++// default constructor ++FGPath::FGPath() { ++ path = ""; ++} ++ ++ ++// create a path based on "path" ++FGPath::FGPath( const string p ) { ++ set( p ); ++} ++ ++ ++// destructor ++FGPath::~FGPath() { ++} ++ ++ ++// set path ++void FGPath::set( const string p ) { ++ path = fix_path( p ); ++} ++ ++ ++// append another piece to the existing path ++void FGPath::append( const string p ) { ++ string part = fix_path( p ); ++ ++ if ( path.size() == 0 ) { ++ path = part; ++ } else { ++ if ( part[0] != FG_PATH_SEP ) { ++ path += FG_PATH_SEP; ++ } ++ path += part; ++ } ++} ++ ++ ++// concatenate a string to the end of the path without inserting a ++// path separator ++void FGPath::concat( const string p ) { ++ string part = fix_path( p ); ++ ++ if ( path.size() == 0 ) { ++ path = part; ++ } else { ++ path += part; ++ } ++} diff --cc simgear/misc/fgpath.hxx index 00000000,00000000..42c43310 new file mode 100644 --- /dev/null +++ b/simgear/misc/fgpath.hxx @@@ -1,0 -1,0 +1,85 @@@ ++// ++// fgpath.hxx -- routines to abstract out path separator differences ++// between MacOS and the rest of the world ++// ++// Written by Curtis L. Olson, started April 1999. ++// ++// Copyright (C) 1999 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 _FGPATH_HXX ++#define _FGPATH_HXX ++ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#include ++ ++#include STL_STRING ++ ++FG_USING_STD(string); ++ ++ ++#ifdef MACOS ++# define FG_PATH_SEP ':' ++# define FG_BAD_PATH_SEP '/' ++#else ++# define FG_PATH_SEP '/' ++# define FG_BAD_PATH_SEP ':' ++#endif ++ ++ ++class FGPath { ++ ++private: ++ ++ string path; ++ ++public: ++ ++ // default constructor ++ FGPath(); ++ ++ // create a path based on "path" ++ FGPath( const string p ); ++ ++ // destructor ++ ~FGPath(); ++ ++ // set path ++ void set( const string p ); ++ ++ // append another piece to the existing path ++ void append( const string p ); ++ ++ // concatenate a string to the end of the path without inserting a ++ // path separator ++ void concat( const string p ); ++ ++ // get the path string ++ inline string str() const { return path; } ++ inline const char *c_str() { return path.c_str(); } ++}; ++ ++ ++#endif // _FGPATH_HXX ++ ++ diff --cc simgear/misc/fgstream.cxx index 00000000,00000000..8eac63c9 new file mode 100644 --- /dev/null +++ b/simgear/misc/fgstream.cxx @@@ -1,0 -1,0 +1,158 @@@ ++// zlib input file stream wrapper. ++// ++// Written by Bernie Bright, 1998 ++// ++// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au ++// ++// 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 // isspace() ++ ++#include "fgstream.hxx" ++ ++fg_gzifstream::fg_gzifstream() ++ : istream(&gzbuf) ++{ ++} ++ ++//----------------------------------------------------------------------------- ++// ++// Open a possibly gzipped file for reading. ++// ++fg_gzifstream::fg_gzifstream( const string& name, ios_openmode io_mode ) ++ : istream(&gzbuf) ++{ ++ this->open( name, io_mode ); ++} ++ ++//----------------------------------------------------------------------------- ++// ++// Attach a stream to an already opened file descriptor. ++// ++fg_gzifstream::fg_gzifstream( int fd, ios_openmode io_mode ) ++ : istream(&gzbuf) ++{ ++ gzbuf.attach( fd, io_mode ); ++} ++ ++//----------------------------------------------------------------------------- ++// ++// Open a possibly gzipped file for reading. ++// If the initial open fails and the filename has a ".gz" extension then ++// remove the extension and try again. ++// If the initial open fails and the filename doesn't have a ".gz" extension ++// then append ".gz" and try again. ++// ++void ++fg_gzifstream::open( const string& name, ios_openmode io_mode ) ++{ ++ gzbuf.open( name.c_str(), io_mode ); ++ if ( ! gzbuf.is_open() ) ++ { ++ string s = name; ++ if ( s.substr( s.length() - 3, 3 ) == ".gz" ) ++ { ++ // remove ".gz" suffix ++ s.replace( s.length() - 3, 3, "" ); ++// s.erase( s.length() - 3, 3 ); ++ } ++ else ++ { ++ // Append ".gz" suffix ++ s += ".gz"; ++ } ++ ++ // Try again. ++ gzbuf.open( s.c_str(), io_mode ); ++ } ++} ++ ++void ++fg_gzifstream::attach( int fd, ios_openmode io_mode ) ++{ ++ gzbuf.attach( fd, io_mode ); ++} ++ ++// ++// Manipulators ++// ++ ++istream& ++skipeol( istream& in ) ++{ ++ char c = '\0'; ++ // skip to end of line. ++ ++#ifdef __MWERKS__ ++ while ( in.get(c) && c != '\0' ) { ++#else ++ while ( in.get(c) ) { ++#endif ++ if ( (c == '\n') || (c == '\r') ) { ++ break; ++ } ++ } ++ ++ return in; ++} ++ ++istream& ++skipws( istream& in ) { ++ char c; ++#ifdef __MWERKS__ ++ while ( in.get(c) && c != '\0' ) { ++#else ++ while ( in.get(c) ) { ++#endif ++ ++#ifdef __MWERKS__ ++ if ( ! isspace( c ) && c != '\n' ) { ++#else ++ if ( ! isspace( c ) ) { ++#endif ++ // put pack the non-space character ++ in.putback(c); ++ break; ++ } ++ } ++ return in; ++} ++ ++istream& ++skipcomment( istream& in ) ++{ ++ while ( in ) ++ { ++ // skip whitespace ++#ifdef __MWERKS__ ++ in >> ::skipws; ++#else ++ in >> skipws; ++#endif ++ ++ char c; ++ if ( in.get( c ) && c != '#' ) ++ { ++ // not a comment ++ in.putback(c); ++ break; ++ } ++ in >> skipeol; ++ } ++ return in; ++} ++ diff --cc simgear/misc/fgstream.hxx index 00000000,00000000..ee4c61ba new file mode 100644 --- /dev/null +++ b/simgear/misc/fgstream.hxx @@@ -1,0 -1,0 +1,102 @@@ ++// zlib input file stream wrapper. ++// ++// Written by Bernie Bright, 1998 ++// ++// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au ++// ++// 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 _FGSTREAM_HXX ++#define _FGSTREAM_HXX ++ ++#ifndef __cplusplus ++# error This library requires C++ ++#endif ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#include ++ ++#if defined( FG_HAVE_STD_INCLUDES ) ++# include ++#elif defined ( FG_HAVE_NATIVE_SGI_COMPILERS ) ++# include ++#elif defined ( __BORLANDC__ ) ++# include ++#else ++# include ++#endif ++ ++#include STL_STRING ++ ++#include ++ ++FG_USING_STD(string); ++ ++#ifndef FG_HAVE_NATIVE_SGI_COMPILERS ++FG_USING_STD(istream); ++#endif ++ ++ ++//----------------------------------------------------------------------------- ++// ++// Envelope class for gzifstream. ++// ++class fg_gzifstream : private gzifstream_base, public istream ++{ ++public: ++ // ++ fg_gzifstream(); ++ ++ // Attempt to open a file with and without ".gz" extension. ++ fg_gzifstream( const string& name, ++ ios_openmode io_mode = ios_in | ios_binary ); ++ ++ // ++ fg_gzifstream( int fd, ios_openmode io_mode = ios_in|ios_binary ); ++ ++ // Attempt to open a file with and without ".gz" extension. ++ void open( const string& name, ++ ios_openmode io_mode = ios_in|ios_binary ); ++ ++ void attach( int fd, ios_openmode io_mode = ios_in|ios_binary ); ++ ++ void close() { gzbuf.close(); } ++ ++ bool is_open() { return gzbuf.is_open(); } ++ ++private: ++ // Not defined! ++ fg_gzifstream( const fg_gzifstream& ); ++ void operator= ( const fg_gzifstream& ); ++}; ++ ++// istream manipulator that skips to end of line. ++istream& skipeol( istream& in ); ++ ++// istream manipulator that skips over white space. ++istream& skipws( istream& in ); ++ ++// istream manipulator that skips comments and white space. ++// A comment starts with '#'. ++istream& skipcomment( istream& in ); ++ ++ ++#endif /* _FGSTREAM_HXX */ ++ diff --cc simgear/misc/stopwatch.hxx index 00000000,00000000..f9019393 new file mode 100644 --- /dev/null +++ b/simgear/misc/stopwatch.hxx @@@ -1,0 -1,0 +1,121 @@@ ++/*************************************************************************** ++ * stopwatch.hxx Timer class, for use in benchmarking ++ * ++ * Based on blitz/Timer.h ++ * ++ * $Id$ ++ * ++ * Copyright (C) 1997,1998 Todd Veldhuizen ++ * ++ * 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. ++ * ++ * Suggestions: blitz-suggest@cybervision.com ++ * Bugs: blitz-bugs@cybervision.com ++ * ++ * For more information, please see the Blitz++ Home Page: ++ * http://seurat.uwaterloo.ca/blitz/ ++ * ++ */ ++ ++// This class is not portable to non System V platforms. ++// It will need to be rewritten for Windows, NT, Mac. ++// NEEDS_WORK ++ ++#ifndef _STOPWATCH_HXX ++#define _STOPWATCH_HXX ++ ++#ifndef __cplusplus ++# error This library requires C++ ++#endif ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#if defined(__linux__) && ! defined(HAVE_GETRUSAGE) ++# define HAVE_GETRUSAGE ++#endif ++ ++#if defined( WIN32 ) && defined( HAVE_GETRUSAGE ) ++# undef HAVE_GETRUSAGE ++#endif // WIN32 ++ ++#if defined( HAVE_GETRUSAGE ) ++# if defined( __FreeBSD__ ) ++# include ++# endif ++# include ++# include ++# include ++#elif defined( WIN32 ) ++# include ++#else ++# include ++#endif ++ ++class StopWatch { ++ ++public: ++ StopWatch() ++ { ++// state_ = uninitialized; ++ } ++ ++ void start() ++ { ++// state_ = running; ++ t1_ = systemTime(); ++ } ++ ++ void stop() ++ { ++ t2_ = systemTime(); ++// BZPRECONDITION(state_ == running); ++// state_ = stopped; ++ } ++ ++ double elapsedSeconds() ++ { ++// BZPRECONDITION(state_ == stopped); ++ return t2_ - t1_; ++ } ++ ++private: ++ StopWatch(StopWatch&) { } ++ void operator=(StopWatch&) { } ++ ++ double systemTime() ++ { ++#if defined( HAVE_GETRUSAGE ) ++ getrusage(RUSAGE_SELF, &resourceUsage_); ++ double seconds = resourceUsage_.ru_utime.tv_sec ++ + resourceUsage_.ru_stime.tv_sec; ++ double micros = resourceUsage_.ru_utime.tv_usec ++ + resourceUsage_.ru_stime.tv_usec; ++ return seconds + micros/1.0e6; ++#elif defined( WIN32 ) ++ return double(GetTickCount()) * double(1e-3); ++#else ++ return clock() / (double) CLOCKS_PER_SEC; ++#endif ++ } ++ ++// enum { uninitialized, running, stopped } state_; ++ ++#if defined( HAVE_GETRUSAGE ) ++ struct rusage resourceUsage_; ++#endif ++ ++ double t1_, t2_; ++}; ++ ++#endif // _STOPWATCH_HXX ++ diff --cc simgear/misc/strutils.cxx index 00000000,00000000..17e39c95 new file mode 100644 --- /dev/null +++ b/simgear/misc/strutils.cxx @@@ -1,0 -1,0 +1,71 @@@ ++// String utilities. ++// ++// Written by Bernie Bright, 1998 ++// ++// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au ++// ++// 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 ++ ++#include "strutils.hxx" ++ ++const string whitespace = " \n\r\t"; ++ ++// ++string ++trimleft( const string& s, const string& trimmings ) ++{ ++ string result; ++ string::size_type pos = s.find_first_not_of( trimmings ); ++ if ( pos != string::npos ) ++ { ++ result.assign( s.substr( pos ) ); ++ } ++ ++ return result; ++} ++ ++// ++string ++trimright( const string& s, const string& trimmings ) ++{ ++ string result; ++ ++ string::size_type pos = s.find_last_not_of( trimmings ); ++ if ( pos == string::npos ) ++ { ++ // Not found, return the original string. ++ result = s; ++ } ++ else ++ { ++ result.assign( s.substr( 0, pos+1 ) ); ++ } ++ ++ return result; ++} ++ ++// ++string ++trim( const string& s, const string& trimmings ) ++{ ++ return trimright( trimleft( s, trimmings ), trimmings ); ++} ++ diff --cc simgear/misc/strutils.hxx index 00000000,00000000..4b116d8b new file mode 100644 --- /dev/null +++ b/simgear/misc/strutils.hxx @@@ -1,0 -1,0 +1,65 @@@ ++// String utilities. ++// ++// Written by Bernie Bright, 1998 ++// ++// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au ++// ++// 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 STRUTILS_H ++#define STRUTILS_H ++ ++#include ++ ++#include STL_STRING ++ ++#ifdef FG_HAVE_STD_INCLUDES ++# include ++#else ++# include ++#endif ++ ++FG_USING_STD(string); ++ ++// Default characters to remove. ++extern const string whitespace; ++ ++// Returns a string with trailing characters removed. ++string trimleft( const string& s, const string& trimmings = whitespace ); ++ ++// Returns a string with leading characters removed. ++string trimright( const string& s, const string& trimmings = whitespace ); ++ ++// Returns a string with leading and trailing characters removed. ++string trim( const string& s, const string& trimmings = whitespace ); ++ ++//----------------------------------------------------------------------------- ++ ++inline double ++atof( const string& str ) ++{ ++ return ::atof( str.c_str() ); ++} ++ ++inline int ++atoi( const string& str ) ++{ ++ return ::atoi( str.c_str() ); ++} ++ ++#endif // STRUTILS_H ++ diff --cc simgear/misc/texcoord.cxx index 00000000,00000000..61efc23e new file mode 100644 --- /dev/null +++ b/simgear/misc/texcoord.cxx @@@ -1,0 -1,0 +1,197 @@@ ++// texcoord.hxx -- routine(s) to handle texture coordinate generation ++// ++// Written by Curtis Olson, started March 1999. ++// ++// Copyright (C) 1999 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$ ++ ++ ++#include "texcoord.hxx" ++ ++ ++#define FG_STANDARD_TEXTURE_DIMENSION 1000.0 // meters ++#define MAX_TEX_COORD 8.0 ++#define HALF_MAX_TEX_COORD ( MAX_TEX_COORD / 2.0 ) ++ ++ ++// return the basic unshifted/unmoded texture coordinate for a lat/lon ++inline Point3D basic_tex_coord( const Point3D& p, ++ double degree_width, double degree_height, ++ double scale ) ++{ ++ return Point3D( p.x() * ( degree_width * scale / ++ FG_STANDARD_TEXTURE_DIMENSION ), ++ p.y() * ( degree_width * scale / ++ FG_STANDARD_TEXTURE_DIMENSION ), ++ 0.0 ); ++} ++ ++ ++// traverse the specified fan/strip/list of vertices and attempt to ++// calculate "none stretching" texture coordinates ++point_list calc_tex_coords( const FGBucket& b, const point_list& geod_nodes, ++ const int_list& fan, double scale ) ++{ ++ // cout << "calculating texture coordinates for a specific fan of size = " ++ // << fan.size() << endl; ++ ++ // calculate perimeter based on center of this degree (not center ++ // of bucket) ++ double clat = (int)b.get_center_lat(); ++ if ( clat > 0 ) { ++ clat = (int)clat + 0.5; ++ } else { ++ clat = (int)clat - 0.5; ++ } ++ ++ double clat_rad = clat * DEG_TO_RAD; ++ double cos_lat = cos( clat_rad ); ++ double local_radius = cos_lat * EQUATORIAL_RADIUS_M; ++ double local_perimeter = 2.0 * local_radius * FG_PI; ++ double degree_width = local_perimeter / 360.0; ++ ++ // cout << "clat = " << clat << endl; ++ // cout << "clat (radians) = " << clat_rad << endl; ++ // cout << "cos(lat) = " << cos_lat << endl; ++ // cout << "local_radius = " << local_radius << endl; ++ // cout << "local_perimeter = " << local_perimeter << endl; ++ // cout << "degree_width = " << degree_width << endl; ++ ++ double perimeter = 2.0 * EQUATORIAL_RADIUS_M * FG_PI; ++ double degree_height = perimeter / 360.0; ++ // cout << "degree_height = " << degree_height << endl; ++ ++ // find min/max of fan ++ Point3D tmin, tmax, p, t; ++ bool first = true; ++ ++ for ( int i = 0; i < (int)fan.size(); ++i ) { ++ p = geod_nodes[ fan[i] ]; ++ // cout << "point p = " << p << endl; ++ ++ t = basic_tex_coord( p, degree_width, degree_height, scale ); ++ // cout << "basic_tex_coord = " << t << endl; ++ ++ if ( first ) { ++ tmin = tmax = t; ++ first = false; ++ } else { ++ if ( t.x() < tmin.x() ) { ++ tmin.setx( t.x() ); ++ } ++ if ( t.y() < tmin.y() ) { ++ tmin.sety( t.y() ); ++ } ++ if ( t.x() > tmax.x() ) { ++ tmax.setx( t.x() ); ++ } ++ if ( t.y() > tmax.y() ) { ++ tmax.sety( t.y() ); ++ } ++ } ++ } ++ ++ double dx = fabs( tmax.x() - tmin.x() ); ++ double dy = fabs( tmax.y() - tmin.y() ); ++ // cout << "dx = " << dx << " dy = " << dy << endl; ++ ++ bool do_shift = false; ++ Point3D mod_shift; ++ if ( (dx > HALF_MAX_TEX_COORD) || (dy > HALF_MAX_TEX_COORD) ) { ++ // structure is too big, we'll just have to shift it so that ++ // tmin = (0,0). This messes up subsequent texture scaling, ++ // but is the best we can do. ++ // cout << "SHIFTING" << endl; ++ do_shift = true; ++ tmin.setx( (double)( (int)tmin.x() + 1 ) ); ++ tmin.sety( (double)( (int)tmin.y() + 1 ) ); ++ // cout << "found tmin = " << tmin << endl; ++ } else { ++ // structure is small enough ... we can mod it so we can ++ // properly scale the texture coordinates later. ++ // cout << "MODDING" << endl; ++ double x1 = fmod(tmin.x(), MAX_TEX_COORD); ++ while ( x1 < 0 ) { x1 += MAX_TEX_COORD; } ++ ++ double y1 = fmod(tmin.y(), MAX_TEX_COORD); ++ while ( y1 < 0 ) { y1 += MAX_TEX_COORD; } ++ ++ double x2 = fmod(tmax.x(), MAX_TEX_COORD); ++ while ( x2 < 0 ) { x2 += MAX_TEX_COORD; } ++ ++ double y2 = fmod(tmax.y(), MAX_TEX_COORD); ++ while ( y2 < 0 ) { y2 += MAX_TEX_COORD; } ++ ++ // At this point we know that the object is < 16 wide in ++ // texture coordinate space. If the modulo of the tmin is > ++ // the mod of the tmax at this point, then we know that the ++ // starting tex coordinate for the tmin > 16 so we can shift ++ // everything down by 16 and get it within the 0-32 range. ++ ++ if ( x1 > x2 ) { ++ mod_shift.setx( HALF_MAX_TEX_COORD ); ++ } else { ++ mod_shift.setx( 0.0 ); ++ } ++ ++ if ( y1 > y2 ) { ++ mod_shift.sety( HALF_MAX_TEX_COORD ); ++ } else { ++ mod_shift.sety( 0.0 ); ++ } ++ ++ // cout << "mod_shift = " << mod_shift << endl; ++ } ++ ++ // generate tex_list ++ Point3D adjusted_t; ++ point_list tex; ++ tex.clear(); ++ for ( int i = 0; i < (int)fan.size(); ++i ) { ++ p = geod_nodes[ fan[i] ]; ++ t = basic_tex_coord( p, degree_width, degree_height, scale ); ++ // cout << "second t = " << t << endl; ++ ++ if ( do_shift ) { ++ adjusted_t = t - tmin; ++ } else { ++ adjusted_t.setx( fmod(t.x() + mod_shift.x(), MAX_TEX_COORD) ); ++ while ( adjusted_t.x() < 0 ) { ++ adjusted_t.setx( adjusted_t.x() + MAX_TEX_COORD ); ++ } ++ adjusted_t.sety( fmod(t.y() + mod_shift.y(), MAX_TEX_COORD) ); ++ while ( adjusted_t.y() < 0 ) { ++ adjusted_t.sety( adjusted_t.y() + MAX_TEX_COORD ); ++ } ++ // cout << "adjusted_t " << adjusted_t << endl; ++ } ++ ++ if ( adjusted_t.x() < FG_EPSILON ) { ++ adjusted_t.setx( 0.0 ); ++ } ++ if ( adjusted_t.y() < FG_EPSILON ) { ++ adjusted_t.sety( 0.0 ); ++ } ++ adjusted_t.setz( 0.0 ); ++ // cout << "adjusted_t = " << adjusted_t << endl; ++ ++ tex.push_back( adjusted_t ); ++ } ++ ++ return tex; ++} diff --cc simgear/misc/texcoord.hxx index 00000000,00000000..1be573ba new file mode 100644 --- /dev/null +++ b/simgear/misc/texcoord.hxx @@@ -1,0 -1,0 +1,45 @@@ ++// texcoord.hxx -- routine(s) to handle texture coordinate generation ++// ++// Written by Curtis Olson, started March 1999. ++// ++// Copyright (C) 1999 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 _TEXCOORD_HXX ++#define _TEXCOORD_HXX ++ ++ ++#ifndef __cplusplus ++# error This library requires C++ ++#endif ++ ++ ++#include ++#include ++ ++ ++// traverse the specified fan/strip/list of vertices and attempt to ++// calculate "none stretching" texture coordinates ++point_list calc_tex_coords( const FGBucket& b, const point_list& geod_nodes, ++ const int_list& fan, double scale = 1.0 ); ++ ++ ++#endif // _TEXCOORD_HXX ++ ++ diff --cc simgear/misc/zfstream.cxx index 00000000,00000000..f265665c new file mode 100644 --- /dev/null +++ b/simgear/misc/zfstream.cxx @@@ -1,0 -1,0 +1,313 @@@ ++// A C++ I/O streams interface to the zlib gz* functions ++// ++// Written by Bernie Bright, 1998 ++// Based on zlib/contrib/iostream/ by Kevin Ruland ++// ++// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au ++// ++// 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 "zfstream.hxx" ++ ++// ++// Construct a gzfilebuf object. ++// Allocate memory for 'get' buffer and zero all buffer pointers. ++// ++gzfilebuf::gzfilebuf() ++ : streambuf(), ++ file(NULL), ++#if defined( __MWERKS__ ) ++ mode(ios_openmode(0)), ++#else ++ mode(0), ++#endif ++ own_file_descriptor(false), ++ ibuf_size(0), ++ ibuffer(0) ++{ ++// try { ++ ibuf_size = page_size / sizeof(char); ++ ibuffer = new char [ibuf_size]; ++// } catch (...) { ++// delete [] ibuffer; ++// } ++ ++ // Null get and set pointers. ++ this->setg(0,0,0); ++ this->setp(0,0); ++} ++ ++gzfilebuf::~gzfilebuf() ++{ ++ sync(); ++ if ( own_file_descriptor ) ++ this->close(); ++ delete [] ibuffer; ++} ++ ++void ++gzfilebuf::cvt_iomode( char* p, ios_openmode io_mode ) ++{ ++// memset( char_mode, '\0', 10 ); ++// char* p = char_mode; ++ ++ if ( io_mode & ios_in ) ++ { ++ mode = ios_in; ++ *p++ = 'r'; ++ } ++ else if ( io_mode & ios_app ) ++ { ++ mode = ios_app; ++ *p++ = 'a'; ++ } ++ else ++ { ++ mode = ios_out; ++ *p++ = 'w'; ++ } ++ ++ if ( io_mode & ios_binary ) ++ { ++ mode |= ios_binary; ++ *p++ = 'b'; ++ } ++ ++ // Hard code the compression level ++ if ( io_mode & (ios_out | ios_app) ) ++ { ++ *p++ = '9'; ++ } ++ ++ *p = '\0'; ++} ++ ++gzfilebuf* ++gzfilebuf::open( const char *name, ios_openmode io_mode ) ++{ ++ if ( is_open() ) ++ return NULL; ++ ++ char char_mode[10]; ++ cvt_iomode( char_mode, io_mode ); ++ if ( (file = gzopen(name, char_mode)) == NULL ) ++ return NULL; ++ ++ own_file_descriptor = true; ++ ++ return this; ++} ++ ++gzfilebuf* ++gzfilebuf::attach( int file_descriptor, ios_openmode io_mode ) ++{ ++ if ( is_open() ) ++ return NULL; ++ ++ char char_mode[10]; ++ cvt_iomode( char_mode, io_mode ); ++ if ( (file = gzdopen(file_descriptor, char_mode)) == NULL ) ++ return NULL; ++ ++ own_file_descriptor = false; ++ ++ return this; ++} ++ ++gzfilebuf* ++gzfilebuf::close() ++{ ++ if ( is_open() ) ++ { ++ sync(); ++ gzclose( file ); ++ file = NULL; ++ } ++ ++ return this; ++} ++ ++// int ++// gzfilebuf::setcompressionlevel( int comp_level ) ++// { ++// return gzsetparams(file, comp_level, -2); ++// } ++ ++// int ++// gzfilebuf::setcompressionstrategy( int comp_strategy ) ++// { ++// return gzsetparams(file, -2, comp_strategy); ++// } ++ ++ ++streampos ++gzfilebuf::seekoff( streamoff, ios_seekdir, int ) ++{ ++ return streampos(EOF); ++} ++ ++gzfilebuf::int_type ++gzfilebuf::overflow( int_type ) ++{ ++#if 0 ++ if ( !is_open() || !(mode & ios::out) ) ++ return EOF; ++ ++ if ( !base() ) ++ { ++ if ( allocate() == EOF ) ++ return EOF; ++ setg(0,0,0); ++ } ++ else ++ { ++ if (in_avail()) ++ { ++ return EOF; ++ } ++ ++ if (out_waiting()) ++ { ++ if (flushbuf() == EOF) ++ return EOF; ++ } ++ } ++ ++ int bl = blen(); ++ setp( base(), base() + bl); ++ ++ if ( c != EOF ) ++ { ++ *pptr() = c; ++ pbump(1); ++ } ++#endif ++ return 0; ++} ++ ++int ++gzfilebuf::sync() ++{ ++ if ( !is_open() ) ++ return EOF; ++ ++ if ( pptr() != 0 && pptr() > pbase() ) ++ return flushbuf(); ++ ++ return 0; ++} ++ ++gzfilebuf::int_type ++gzfilebuf::flushbuf() ++{ ++ char* q = pbase(); ++ int n = pptr() - q; ++ ++ if ( gzwrite( file, q, n) < n ) ++ return traits_type::eof(); ++ ++ setp(0,0); ++ ++ return 0; ++} ++ ++gzfilebuf::int_type ++gzfilebuf::underflow() ++{ ++// cerr << "gzfilebuf::underflow(): gptr()=" << (void*)gptr() << endl; ++ // Error if the file not open for reading. ++ if ( !is_open() || !(mode & ios_in) ) ++ return traits_type::eof(); ++ ++ // If the input buffer is empty then try to fill it. ++ if ( gptr() != 0 && gptr() < egptr() ) ++ { ++ return int_type(*gptr()); ++ } ++ else ++ { ++ return fillbuf() == EOF ? traits_type::eof() : int_type(*gptr()); ++ } ++} ++ ++// ++// Load the input buffer from the underlying gz file. ++// Returns number of characters read, or EOF. ++// ++int ++gzfilebuf::fillbuf() ++{ ++ int t = gzread( file, ibuffer, ibuf_size ); ++ if ( t <= 0) ++ { ++ // disable get area ++ setg(0,0,0); ++ return EOF; ++ } ++ ++ // Set the input (get) pointers ++ setg( ibuffer, ibuffer, ibuffer+t ); ++ ++// cerr << "gzfilebuf::fillbuf():" ++// << " t=" << t ++// << ", ibuffer=" << (void*)ibuffer ++// << ", ibuffer+t=" << (void*)(ibuffer+t) << endl; ++ ++ return t; ++} ++ ++#if 0 ++gzifstream::gzifstream() ++ : istream(&buffer), buffer() ++{ ++ clear( ios_badbit ); ++} ++ ++gzifstream::gzifstream( const char *name, ios_openmode io_mode ) ++ : istream(&buffer), buffer() ++{ ++ this->open( name, io_mode ); ++} ++ ++gzifstream::gzifstream( int fd, ios_openmode io_mode ) ++ : istream(&buffer), buffer() ++{ ++ buffer.attach( fd, io_mode ); ++} ++ ++gzifstream::~gzifstream() ++{ ++} ++ ++void ++gzifstream::open( const char *name, ios_openmode io_mode ) ++{ ++ if ( !buffer.open( name, io_mode ) ) ++ clear( ios_failbit | ios_badbit ); ++ else ++ clear(); ++} ++ ++void ++gzifstream::close() ++{ ++ if ( !buffer.close() ) ++ clear( ios_failbit | ios_badbit ); ++} ++#endif ++ diff --cc simgear/misc/zfstream.hxx index 00000000,00000000..41b3d04d new file mode 100644 --- /dev/null +++ b/simgear/misc/zfstream.hxx @@@ -1,0 -1,0 +1,155 @@@ ++// A C++ I/O streams interface to the zlib gz* functions ++// ++// Written by Bernie Bright, 1998 ++// Based on zlib/contrib/iostream/ by Kevin Ruland ++// ++// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au ++// ++// 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 _zfstream_hxx ++#define _zfstream_hxx ++ ++#include ++ ++#include ++ ++#ifdef FG_HAVE_STD_INCLUDES ++ ++# include ++# include ++ ++# define ios_openmode ios_base::openmode ++# define ios_in ios_base::in ++# define ios_out ios_base::out ++# define ios_app ios_base::app ++# define ios_binary ios_base::binary ++ ++# define ios_seekdir ios_base::seekdir ++ ++# define ios_badbit ios_base::badbit ++# define ios_failbit ios_base::failbit ++ ++FG_USING_STD(streambuf); ++FG_USING_STD(ios_base); ++FG_USING_STD(streampos); ++FG_USING_STD(streamoff); ++ ++#else ++ ++# ifdef FG_HAVE_STREAMBUF ++# include ++# include ++# else ++# include ++# endif ++ ++//# define ios_openmode ios::open_mode ++# define ios_openmode int ++# define ios_in ios::in ++# define ios_out ios::out ++# define ios_app ios::app ++ ++#if defined(__GNUC__) && __GNUC_MINOR__ < 8 ++# define ios_binary ios::bin ++#elif defined( FG_HAVE_NATIVE_SGI_COMPILERS ) ++# define ios_binary 0 ++#else ++# define ios_binary ios::binary ++#endif ++ ++# define ios_seekdir ios::seek_dir ++ ++# define ios_badbit ios::badbit ++# define ios_failbit ios::failbit ++ ++# include ++ ++#endif // FG_HAVE_STD_INCLUDES ++ ++//----------------------------------------------------------------------------- ++// ++// ++// ++class gzfilebuf : public streambuf ++{ ++public: ++ ++#ifndef FG_HAVE_STD_INCLUDES ++ typedef char_traits traits_type; ++ typedef char_traits::int_type int_type; ++ typedef char_traits::pos_type pos_type; ++ typedef char_traits::off_type off_type; ++#endif ++ ++ gzfilebuf(); ++ virtual ~gzfilebuf(); ++ ++ gzfilebuf* open( const char* name, ios_openmode io_mode ); ++ gzfilebuf* attach( int file_descriptor, ios_openmode io_mode ); ++ gzfilebuf* close(); ++ ++// int setcompressionlevel( int comp_level ); ++// int setcompressionstrategy( int comp_strategy ); ++ bool is_open() const { return (file != NULL); } ++ virtual streampos seekoff( streamoff off, ios_seekdir way, int which ); ++ virtual int sync(); ++ ++protected: ++ ++ virtual int_type underflow(); ++ virtual int_type overflow( int_type c = traits_type::eof() ); ++ ++private: ++ ++ int_type flushbuf(); ++ int fillbuf(); ++ ++ // Convert io_mode to "rwab" string. ++ void cvt_iomode( char* mode_str, ios_openmode io_mode ); ++ ++private: ++ ++ gzFile file; ++ ios_openmode mode; ++ bool own_file_descriptor; ++ ++ // Get (input) buffer. ++ int ibuf_size; ++ char* ibuffer; ++ ++ enum { page_size = 4096 }; ++ ++private: ++ // Not defined ++ gzfilebuf( const gzfilebuf& ); ++ void operator= ( const gzfilebuf& ); ++}; ++ ++//----------------------------------------------------------------------------- ++// ++// ++// ++struct gzifstream_base ++{ ++ gzifstream_base() {} ++ ++ gzfilebuf gzbuf; ++}; ++ ++#endif // _zfstream_hxx ++ diff --cc simgear/screen/GLBitmaps.cxx index 00000000,00000000..225f5cb9 new file mode 100755 --- /dev/null +++ b/simgear/screen/GLBitmaps.cxx @@@ -1,0 -1,0 +1,82 @@@ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#ifdef HAVE_WINDOWS_H ++# include ++#endif ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "GLBitmaps.h" ++ ++GlBitmap::GlBitmap( GLenum mode, GLint width, GLint height, GLubyte *bitmap ) ++: m_bytesPerPixel(mode==GL_RGB?3:4), m_width(width), m_height(height), m_bitmap(NULL) ++{ ++ m_bitmapSize = m_bytesPerPixel*m_width*m_height; ++ if ( !m_bitmapSize ) ++ { ++ GLint vp[4]; ++ glGetIntegerv( GL_VIEWPORT, vp ); ++ m_width = vp[2]; ++ m_height = vp[3]; ++ m_bitmapSize = m_bytesPerPixel*m_width*m_height; ++ } ++ m_bitmap = (GLubyte *)malloc( m_bitmapSize ); ++ if ( bitmap ) memcpy( m_bitmap, bitmap, m_bitmapSize ); ++ else glReadPixels( 0,0, m_width,m_height, mode, GL_UNSIGNED_BYTE, m_bitmap ); ++} ++ ++GlBitmap::~GlBitmap( ) ++{ ++ if ( m_bitmap ) free( m_bitmap ); ++} ++ ++GLubyte *GlBitmap::getBitmap() ++{ ++ return m_bitmap; ++} ++ ++void GlBitmap::copyBitmap( GlBitmap *from, GLint at_x, GLint at_y ) ++{ ++ GLint newWidth = at_x + from->m_width; ++ GLint newHeight = at_y + from->m_height; ++ if ( newWidth < m_width ) newWidth = m_width; ++ if ( newHeight < m_height ) newHeight = m_height; ++ m_bitmapSize = m_bytesPerPixel*newWidth*newHeight; ++ GLubyte *newBitmap = (GLubyte *)malloc( m_bitmapSize ); ++ GLint x,y; ++ for ( y=0; ym_height; y++ ) ++ { ++ GLubyte *s = from->m_bitmap + from->m_bytesPerPixel * (y * from->m_width); ++ GLubyte *d = m_bitmap + m_bytesPerPixel * ((at_y+y) * m_width + at_x); ++ for ( x=0; xm_width; x++ ) ++ { ++ d[0] = s[0]; ++ d[1] = s[1]; ++ d[2] = s[2]; ++ if ( m_bytesPerPixel == 4 ) ++ { ++ d[3] = (from->m_bytesPerPixel == 4) ? s[3] : 0; ++ } ++ s += from->m_bytesPerPixel; ++ d += m_bytesPerPixel; ++ } ++ } ++} ++ diff --cc simgear/screen/GLBitmaps.h index 00000000,00000000..dc346bd6 new file mode 100755 --- /dev/null +++ b/simgear/screen/GLBitmaps.h @@@ -1,0 -1,0 +1,14 @@@ ++class GlBitmap ++{ ++public: ++ GlBitmap( GLenum mode=GL_RGB, GLint width=0, GLint height=0, GLubyte *bitmap=0 ); ++ ~GlBitmap(); ++ GLubyte *getBitmap(); ++ void copyBitmap( GlBitmap *from, GLint at_x, GLint at_y ); ++private: ++ GLint m_bytesPerPixel; ++ GLint m_width; ++ GLint m_height; ++ GLint m_bitmapSize; ++ GLubyte *m_bitmap; ++}; diff --cc simgear/screen/Makefile.am index 00000000,00000000..01eab5f7 new file mode 100644 --- /dev/null +++ b/simgear/screen/Makefile.am @@@ -1,0 -1,0 +1,10 @@@ ++lib_LIBRARIES = libsgscreen.a ++ ++include_HEADERS = screen-dump.hxx ++ ++libsgscreen_a_SOURCES = \ ++ GLBitmaps.cxx GLBitmaps.h \ ++ screen-dump.cxx \ ++ win32-printer.h ++ ++INCLUDES += -I$(top_builddir) diff --cc simgear/screen/Makefile.in index 00000000,00000000..45ecbab9 new file mode 100644 --- /dev/null +++ b/simgear/screen/Makefile.in @@@ -1,0 -1,0 +1,339 @@@ ++# Makefile.in generated automatically by automake 1.3 from Makefile.am ++ ++# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++ ++SHELL = /bin/sh ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++prefix = @prefix@ ++exec_prefix = @exec_prefix@ ++ ++bindir = @bindir@ ++sbindir = @sbindir@ ++libexecdir = @libexecdir@ ++datadir = @datadir@ ++sysconfdir = @sysconfdir@ ++sharedstatedir = @sharedstatedir@ ++localstatedir = @localstatedir@ ++libdir = @libdir@ ++infodir = @infodir@ ++mandir = @mandir@ ++includedir = @includedir@ ++oldincludedir = /usr/include ++ ++DISTDIR = ++ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++ ++top_builddir = .. ++ ++ACLOCAL = @ACLOCAL@ ++AUTOCONF = @AUTOCONF@ ++AUTOMAKE = @AUTOMAKE@ ++AUTOHEADER = @AUTOHEADER@ ++ ++INSTALL = @INSTALL@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++transform = @program_transform_name@ ++ ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++CC = @CC@ ++CXX = @CXX@ ++LN_S = @LN_S@ ++MAKEINFO = @MAKEINFO@ ++PACKAGE = @PACKAGE@ ++RANLIB = @RANLIB@ ++VERSION = @VERSION@ ++base_LIBS = @base_LIBS@ ++opengl_LIBS = @opengl_LIBS@ ++ ++lib_LIBRARIES = libsgscreen.a ++ ++include_HEADERS = screen-dump.hxx ++ ++libsgscreen_a_SOURCES = \ ++ GLBitmaps.cxx GLBitmaps.h \ ++ screen-dump.cxx \ ++ win32-printer.h ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = ../include/config.h ++CONFIG_CLEAN_FILES = ++LIBRARIES = $(lib_LIBRARIES) ++ ++ ++DEFS = @DEFS@ -I. -I$(srcdir) -I../include ++CPPFLAGS = @CPPFLAGS@ ++LDFLAGS = @LDFLAGS@ ++LIBS = @LIBS@ ++X_CFLAGS = @X_CFLAGS@ ++X_LIBS = @X_LIBS@ ++X_EXTRA_LIBS = @X_EXTRA_LIBS@ ++X_PRE_LIBS = @X_PRE_LIBS@ ++libsgscreen_a_LIBADD = ++libsgscreen_a_OBJECTS = GLBitmaps.o screen-dump.o ++AR = ar ++CXXFLAGS = @CXXFLAGS@ ++CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++CXXLINK = $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ ++HEADERS = $(include_HEADERS) ++ ++DIST_COMMON = Makefile.am Makefile.in ++ ++ ++DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ++ ++TAR = tar ++GZIP = --best ++DEP_FILES = .deps/GLBitmaps.P .deps/screen-dump.P ++CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++SOURCES = $(libsgscreen_a_SOURCES) ++OBJECTS = $(libsgscreen_a_OBJECTS) ++ ++all: Makefile $(LIBRARIES) $(HEADERS) ++ ++.SUFFIXES: ++.SUFFIXES: .S .c .cxx .o .s ++$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu screen/Makefile ++ ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++ ++mostlyclean-libLIBRARIES: ++ ++clean-libLIBRARIES: ++ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) ++ ++distclean-libLIBRARIES: ++ ++maintainer-clean-libLIBRARIES: ++ ++install-libLIBRARIES: $(lib_LIBRARIES) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(libdir) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ ++ $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ @$(POST_INSTALL) ++ @list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ ++ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ ++uninstall-libLIBRARIES: ++ @$(NORMAL_UNINSTALL) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(libdir)/$$p; \ ++ done ++ ++.s.o: ++ $(COMPILE) -c $< ++ ++.S.o: ++ $(COMPILE) -c $< ++ ++mostlyclean-compile: ++ -rm -f *.o core *.core ++ ++clean-compile: ++ ++distclean-compile: ++ -rm -f *.tab.c ++ ++maintainer-clean-compile: ++ ++libsgscreen.a: $(libsgscreen_a_OBJECTS) $(libsgscreen_a_DEPENDENCIES) ++ -rm -f libsgscreen.a ++ $(AR) cru libsgscreen.a $(libsgscreen_a_OBJECTS) $(libsgscreen_a_LIBADD) ++ $(RANLIB) libsgscreen.a ++.cxx.o: ++ $(CXXCOMPILE) -c $< ++ ++install-includeHEADERS: $(include_HEADERS) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(includedir) ++ @list='$(include_HEADERS)'; for p in $$list; do \ ++ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ ++ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ ++ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++uninstall-includeHEADERS: ++ @$(NORMAL_UNINSTALL) ++ list='$(include_HEADERS)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++tags: TAGS ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) ++ here=`pwd` && cd $(srcdir) \ ++ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) ++ ++TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ ++ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ ++mostlyclean-tags: ++ ++clean-tags: ++ ++distclean-tags: ++ -rm -f TAGS ID ++ ++maintainer-clean-tags: ++ ++distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) ++ ++subdir = screen ++ ++distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu screen/Makefile ++ @for file in $(DISTFILES); do \ ++ d=$(srcdir); \ ++ test -f $(distdir)/$$file \ ++ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ++ || cp -p $$d/$$file $(distdir)/$$file; \ ++ done ++ ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ ++maintainer-clean-depend: ++ -rm -rf .deps ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++ ++%.o: %.cxx ++ @echo '$(CXXCOMPILE) -c $<'; \ ++ $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.cxx ++ @echo '$(LTCXXCOMPILE) -c $<'; \ ++ $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++info: ++dvi: ++check: all ++ $(MAKE) ++installcheck: ++install-exec: install-libLIBRARIES ++ @$(NORMAL_INSTALL) ++ ++install-data: install-includeHEADERS ++ @$(NORMAL_INSTALL) ++ ++install: install-exec install-data all ++ @: ++ ++uninstall: uninstall-libLIBRARIES uninstall-includeHEADERS ++ ++install-strip: ++ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install ++installdirs: ++ $(mkinstalldirs) $(DATADIR)$(libdir) $(DATADIR)$(includedir) ++ ++ ++mostlyclean-generic: ++ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f Makefile $(DISTCLEANFILES) ++ -rm -f config.cache config.log stamp-h stamp-h[0-9]* ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) ++ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) ++mostlyclean: mostlyclean-libLIBRARIES mostlyclean-compile \ ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic ++ ++clean: clean-libLIBRARIES clean-compile clean-tags clean-depend \ ++ clean-generic mostlyclean ++ ++distclean: distclean-libLIBRARIES distclean-compile distclean-tags \ ++ distclean-depend distclean-generic clean ++ -rm -f config.status ++ ++maintainer-clean: maintainer-clean-libLIBRARIES \ ++ maintainer-clean-compile maintainer-clean-tags \ ++ maintainer-clean-depend maintainer-clean-generic \ ++ distclean ++ @echo "This command is intended for maintainers to use;" ++ @echo "it deletes files that may require special tools to rebuild." ++ ++.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \ ++clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ ++install-libLIBRARIES mostlyclean-compile distclean-compile \ ++clean-compile maintainer-clean-compile uninstall-includeHEADERS \ ++install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ ++maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ ++clean-depend maintainer-clean-depend info dvi installcheck install-exec \ ++install-data install uninstall all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean ++ ++ ++INCLUDES += -I$(top_builddir) ++ ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --cc simgear/screen/screen-dump.cxx index 00000000,00000000..4be50960 new file mode 100644 --- /dev/null +++ b/simgear/screen/screen-dump.cxx @@@ -1,0 -1,0 +1,83 @@@ ++// screen-dump.cxx -- dump a copy of the opengl screen buffer to a file ++// ++// Contributed by Richard Kaszeta , started October 1999. ++// ++// 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 ++#include ++#include ++ ++#include ++#include ++ ++#include "screen-dump.hxx" ++ ++ ++#define RGB 3 // 3 bytes of color info per pixel ++#define RGBA 4 // 4 bytes of color+alpha info ++ ++void my_glWritePPMFile(const char *filename, GLubyte *buffer, int win_width, int win_height, int mode) ++{ ++ int i, j, k, q; ++ unsigned char *ibuffer; ++ FILE *fp; ++ int pixelSize = mode==GL_RGBA?4:3; ++ ++ ibuffer = (unsigned char *) malloc(win_width*win_height*RGB); ++ ++ fp = fopen(filename, "wb"); ++ fprintf(fp, "P6\n# CREATOR: glReadPixel()\n%d %d\n%d\n", ++ win_width, win_height, UCHAR_MAX); ++ q = 0; ++ for (i = 0; i < win_height; i++) ++ for (j = 0; j < win_width; j++) ++ for (k = 0; k < RGB; k++) ++ ibuffer[q++] = (unsigned char) ++ *(buffer + (pixelSize*((win_height-1-i)*win_width+j)+k)); ++ fwrite(ibuffer, sizeof(unsigned char), RGB*win_width*win_height, fp); ++ fclose(fp); ++ free(ibuffer); ++ ++ printf("wrote file (%d x %d pixels, %d bytes)\n", ++ win_width, win_height, RGB*win_width*win_height); ++} ++ ++ ++// dump the screen buffer to a ppm file ++void my_glDumpWindow(const char *filename, int win_width, int win_height) { ++ GLubyte *buffer; ++ ++ buffer = (GLubyte *) malloc(win_width*win_height*RGBA); ++ ++ // read window contents from color buffer with glReadPixels ++ glFinish(); ++ glReadPixels(0, 0, win_width, win_height, ++ GL_RGBA, GL_UNSIGNED_BYTE, buffer); ++ my_glWritePPMFile( filename, buffer, win_width, win_height, GL_RGBA ); ++ free(buffer); ++} ++ diff --cc simgear/screen/screen-dump.hxx index 00000000,00000000..bcdf11f3 new file mode 100644 --- /dev/null +++ b/simgear/screen/screen-dump.hxx @@@ -1,0 -1,0 +1,26 @@@ ++// screen-dump.hxx -- dump a copy of the opengl screen buffer to a file ++// ++// Contributed by Richard Kaszeta , started October 1999. ++// ++// 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$ ++ ++ ++// dump the screen buffer to a ppm file ++void my_glDumpWindow( const char *filename, int win_width, int win_height ); ++ ++void my_glWritePPMFile( const char *filename, GLubyte *buffer, int win_width, ++ int win_height, int mode); diff --cc simgear/screen/win32-printer.h index 00000000,00000000..6aff3a2c new file mode 100644 --- /dev/null +++ b/simgear/screen/win32-printer.h @@@ -1,0 -1,0 +1,325 @@@ ++ ++class CGlPrinter ++{ ++public: ++ typedef enum { RENDER_TO_PRINTER, RENDER_TO_BITMAP, READ_BITMAP, PRINT_BITMAP } PRINTMODE; ++public: ++ inline CGlPrinter( PRINTMODE mode = READ_BITMAP ); ++ inline ~CGlPrinter(); ++ inline bool Begin( char *title, int w=0, int h=0 ); ++ inline void End( GLubyte *bm=NULL ); ++ inline double GetAspect(); ++ inline int GetHorzRes(); ++ inline int GetVertRes(); ++ ++private: ++ PRINTMODE m_printMode; ++ PRINTDLG m_printDLG; ++ BITMAPINFO m_bitmapInfo; ++ void *m_bitmap; ++ HBITMAP bitmapHandle; ++ HDC m_bitmapDC; ++ HGLRC m_printerHGLRC; ++ HGLRC m_bitmapHGLRC; ++ int m_pageWidth; // Dimension of printer page (x) ++ int m_pageHeight; // Dimension of printer page (y) ++}; ++ ++inline double CGlPrinter::GetAspect() ++{ ++ return (double)m_pageWidth/(double)m_pageHeight; ++} ++ ++inline int CGlPrinter::GetHorzRes() ++{ ++ return m_pageWidth; ++} ++ ++inline int CGlPrinter::GetVertRes() ++{ ++ return m_pageHeight; ++} ++ ++inline CGlPrinter::CGlPrinter( PRINTMODE mode ) : ++ m_printerHGLRC( 0 ), m_bitmapHGLRC( 0 ), m_printMode( mode ), m_bitmap( NULL ) ++{ ++} ++ ++inline CGlPrinter::~CGlPrinter() ++{ ++} ++ ++inline bool CGlPrinter::Begin( char *title, int w, int h ) ++{ ++ // Pixel format for Printer Device context ++ static PIXELFORMATDESCRIPTOR pPrintfd = { ++ sizeof(PIXELFORMATDESCRIPTOR), // Size of this structure ++ 1, // Version of this structure ++ PFD_DRAW_TO_WINDOW | // Draw to Window (not to m_bitmap) ++ PFD_SUPPORT_OPENGL | // Support OpenGL calls ++ PFD_SUPPORT_GDI | // Allow GDI drawing in window too ++ PFD_DEPTH_DONTCARE, // Don't care about depth buffering ++ PFD_TYPE_RGBA, // RGBA Color mode ++ 24, // Want 24bit color ++ 0,0,0,0,0,0, // Not used to select mode ++ 0,0, // Not used to select mode ++ 0,0,0,0,0, // Not used to select mode ++ 0, // Size of depth buffer ++ 0, // Not used to select mode ++ 0, // Not used to select mode ++ 0, // Not used to select mode ++ 0, // Not used to select mode ++ 0,0,0 }; // Not used to select mode ++ ++ DOCINFO docInfo; // Document Info ++ int nPixelFormat; // Pixel format requested ++ ++ // Get printer information ++ memset(&m_printDLG,0,sizeof(PRINTDLG)); ++ m_printDLG.lStructSize = sizeof(PRINTDLG); ++ m_printDLG.hwndOwner = GetForegroundWindow(); ++ m_printDLG.hDevMode = NULL; ++ m_printDLG.hDevNames = NULL; ++ m_printDLG.Flags = PD_RETURNDC | PD_ALLPAGES; ++ ++ // Display printer dialog ++ if(!PrintDlg(&m_printDLG)) ++ { ++ printf( "PrintDlg() failed %lx\n", GetLastError() ); ++ return false; ++ } ++ ++ // Get the dimensions of the page ++ m_pageWidth = GetDeviceCaps(m_printDLG.hDC, HORZRES); ++ m_pageHeight = GetDeviceCaps(m_printDLG.hDC, VERTRES); ++ ++ // Initialize DocInfo structure ++ docInfo.cbSize = sizeof(DOCINFO); ++ docInfo.lpszDocName = title; ++ docInfo.lpszOutput = NULL; ++ ++ ++ // Choose a pixel format that best matches that described in pfd ++ nPixelFormat = ChoosePixelFormat(m_printDLG.hDC, &pPrintfd); ++ // Watch for no pixel format available for this printer ++ if(nPixelFormat == 0) ++ { ++ // Delete the printer context ++ DeleteDC(m_printDLG.hDC); ++ ++ printf( "ChoosePixelFormat() failed %lx\n", GetLastError() ); ++ return false; ++ } ++ ++ // Start the document and page ++ StartDoc(m_printDLG.hDC, &docInfo); ++ StartPage(m_printDLG.hDC); ++ ++ // Set the pixel format for the device context, but watch for failure ++ if(!SetPixelFormat(m_printDLG.hDC, nPixelFormat, &pPrintfd)) ++ { ++ // Delete the printer context ++ DeleteDC(m_printDLG.hDC); ++ ++ printf( "SetPixelFormat() failed %lx\n", GetLastError() ); ++ return false; ++ } ++ ++ // Create the Rendering context and make it current ++ if ( m_printMode == RENDER_TO_PRINTER ) ++ { ++ m_printerHGLRC = wglCreateContext(m_printDLG.hDC); ++ wglMakeCurrent(m_printDLG.hDC, m_printerHGLRC); ++ } ++ else ++ { ++ memset( &m_bitmapInfo, 0, sizeof(BITMAPINFO) ); ++ m_bitmapInfo.bmiHeader.biSize = sizeof( BITMAPINFOHEADER ); ++ if ( m_printMode == READ_BITMAP ) ++ { ++ GLint vp[4]; ++ glGetIntegerv( GL_VIEWPORT, vp ); ++ m_bitmapInfo.bmiHeader.biWidth = vp[2]; ++ m_bitmapInfo.bmiHeader.biHeight = (vp[3] + 3) & ~3; ++ } ++ else ++ { ++ if ( m_printMode == RENDER_TO_BITMAP ) ++ { ++ m_bitmapInfo.bmiHeader.biWidth = m_pageWidth; ++ m_bitmapInfo.bmiHeader.biHeight = m_pageHeight; ++ } ++ else ++ { ++ // PRINT_BITMAP ++ m_bitmapInfo.bmiHeader.biWidth = w; ++ m_bitmapInfo.bmiHeader.biHeight = h; ++ } ++ } ++ m_bitmapInfo.bmiHeader.biPlanes = 1; ++ m_bitmapInfo.bmiHeader.biBitCount = 24; ++ m_bitmapInfo.bmiHeader.biCompression = BI_RGB; ++ m_bitmapInfo.bmiHeader.biSizeImage = m_bitmapInfo.bmiHeader.biWidth*m_bitmapInfo.bmiHeader.biHeight*3; ++ m_bitmapInfo.bmiHeader.biXPelsPerMeter = 2952; // 75dpi ++ m_bitmapInfo.bmiHeader.biYPelsPerMeter = 2952; // 75dpi ++ m_bitmapInfo.bmiHeader.biClrUsed = 0; ++ m_bitmapInfo.bmiHeader.biClrImportant = 0; ++ bitmapHandle = CreateDIBSection( NULL, &m_bitmapInfo, DIB_RGB_COLORS, &m_bitmap, NULL, 0); ++ m_bitmapDC = CreateCompatibleDC( NULL ); ++ if ( m_bitmapDC == NULL ) ++ { ++ DeleteDC(m_printDLG.hDC); ++ printf( "CreateCompatibleDC() failed %lx\n", GetLastError() ); ++ return false; ++ } ++ if ( SelectObject( m_bitmapDC, bitmapHandle ) == NULL ) ++ { ++ DeleteDC(m_printDLG.hDC); ++ DeleteDC(m_bitmapDC); ++ printf( "SelectObject() failed %lx\n", GetLastError() ); ++ return false; ++ } ++ PIXELFORMATDESCRIPTOR pfd; ++ memset( &pfd, 0, sizeof(PIXELFORMATDESCRIPTOR) ); ++ pfd.nVersion = 1 ; ++ pfd.dwFlags = PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL; ++ pfd.iPixelType = PFD_TYPE_RGBA ; ++ pfd.cColorBits = 24; ++ pfd.iLayerType = PFD_MAIN_PLANE; ++ int pixelFormat = ::ChoosePixelFormat(m_bitmapDC, &pfd); ++ SetPixelFormat (m_bitmapDC, pixelFormat, &pfd); ++ if ( m_printMode == RENDER_TO_BITMAP ) ++ { ++ m_bitmapHGLRC = wglCreateContext( m_bitmapDC ); ++ wglMakeCurrent( m_bitmapDC, m_bitmapHGLRC ); ++ } ++ } ++ ++ if ( m_printMode == RENDER_TO_PRINTER || m_printMode == RENDER_TO_BITMAP ) ++ { ++ // Set viewing volume info ++ //glViewport(0,0,m_pageWidth/2,m_pageHeight/2); // Put this in to restrict area of page. ++ ++ GLfloat nRange = 100.0f; ++ ++ // Reset projection matrix stack ++ glMatrixMode(GL_PROJECTION); ++ glLoadIdentity(); ++ ++ // Establish clipping volume (left, right, bottom, top, near, far) ++ // This keeps the perspective square regardless of window or page size ++ ++ if (m_pageHeight <= m_pageWidth) ++ { ++ glOrtho (-nRange, nRange, -nRange*m_pageHeight/m_pageWidth, nRange*m_pageHeight/m_pageWidth, -nRange, nRange); ++ } ++ else ++ { ++ glOrtho (-nRange*m_pageWidth/m_pageHeight, nRange*m_pageWidth/m_pageHeight, -nRange, nRange, -nRange, nRange); ++ } ++ ++ // Reset Model view matrix stack ++ glMatrixMode(GL_MODELVIEW); ++ glLoadIdentity(); ++ glRotatef(270.0f, 1.0, 0.0, 0.0); ++ } ++ ++ return true; ++} ++ ++inline void CGlPrinter::End( GLubyte *bm ) ++{ ++ if ( m_printDLG.hDC ) ++ { ++ glFinish(); ++ ++ if ( m_printMode == RENDER_TO_PRINTER ) ++ { ++ if ( m_printerHGLRC ) ++ { ++ wglDeleteContext( m_printerHGLRC ); ++ } ++ } ++ else ++ { ++ if ( m_printMode == RENDER_TO_BITMAP ) ++ { ++ BitBlt( m_printDLG.hDC, 0,0, m_pageWidth,m_pageHeight, m_bitmapDC, 0,0, SRCCOPY ); ++ } ++ else ++ { ++ if ( m_printMode == READ_BITMAP ) ++ { ++ glPixelStorei( GL_PACK_ALIGNMENT, 4 ); ++ glPixelStorei( GL_PACK_ROW_LENGTH, 0 ); ++ glPixelStorei( GL_PACK_SKIP_ROWS, 0 ); ++ glPixelStorei( GL_PACK_SKIP_PIXELS, 0 ); ++ //GLubyte *tempbitmap = (GLubyte *) malloc(m_bitmapInfo.bmiHeader.biWidth*m_bitmapInfo.bmiHeader.biHeight*4); ++ glReadPixels( 0,0, m_bitmapInfo.bmiHeader.biWidth,m_bitmapInfo.bmiHeader.biHeight, ++ GL_RGB, GL_UNSIGNED_BYTE, m_bitmap ); ++ } ++ else ++ { ++ //PRINT_BITMAP ++ memcpy( m_bitmap, bm, m_bitmapInfo.bmiHeader.biSizeImage ); ++ } ++ int i,j; ++ GLubyte *rgb, temp; ++ for ( i = 0; i < m_bitmapInfo.bmiHeader.biHeight; i++ ) ++ { ++ for ( j = 0, rgb = ((GLubyte *)m_bitmap) + i * m_bitmapInfo.bmiHeader.biWidth * 3; ++ j < m_bitmapInfo.bmiHeader.biWidth; ++ j++, rgb +=3 ) ++ { ++ temp = rgb[0]; ++ rgb[0] = rgb[2]; ++ rgb[2] = temp; ++ } ++ } ++ long width = m_pageWidth; ++ long height = width * m_bitmapInfo.bmiHeader.biHeight / m_bitmapInfo.bmiHeader.biWidth; ++ if ( height > m_pageHeight ) ++ { ++ height = m_pageHeight; ++ width = height * m_bitmapInfo.bmiHeader.biWidth / m_bitmapInfo.bmiHeader.biHeight; ++ } ++ long xoffset = (m_pageWidth - width) / 2; ++ long yoffset = (m_pageHeight - height) / 2; ++ StretchBlt( m_printDLG.hDC, xoffset, yoffset, width, height, m_bitmapDC, 0, 0, ++ m_bitmapInfo.bmiHeader.biWidth, m_bitmapInfo.bmiHeader.biHeight, SRCCOPY ); ++ } ++ if ( m_bitmapDC ) ++ { ++ DeleteDC( m_bitmapDC ); ++ } ++ if ( bitmapHandle ) ++ { ++ DeleteObject( bitmapHandle ); ++ } ++ if ( m_bitmapHGLRC ) ++ { ++ wglDeleteContext( m_bitmapHGLRC ); ++ } ++ } ++ ++ /* EndPage... */ ++ if ( EndPage( m_printDLG.hDC ) <=0 ) ++ { ++ printf( "EndPage() failed\n" ); ++ } ++ ++ /* EndDoc... */ ++ if ( EndDoc( m_printDLG.hDC ) <=0 ) ++ { ++ printf( "EndDoc() failed\n" ); ++ } ++ ++ // Delete the printer context when done with it ++ DeleteDC(m_printDLG.hDC); ++ ++ // Restore window rendering context ++ //wglMakeCurrent(hDC, hRC); ++ wglMakeCurrent( NULL, NULL ); ++ ++ } ++} diff --cc simgear/serial/Makefile.am index 00000000,00000000..77c1feb8 new file mode 100644 --- /dev/null +++ b/simgear/serial/Makefile.am @@@ -1,0 -1,0 +1,15 @@@ ++noinst_PROGRAMS = testserial ++ ++lib_LIBRARIES = libsgserial.a ++ ++include_HEADERS = serial.hxx ++ ++libsgserial_a_SOURCES = serial.cxx ++ ++testserial_SOURCES = testserial.cxx ++ ++testserial_LDADD = \ ++ $(top_builddir)/serial/libsgserial.a \ ++ $(top_builddir)/debug/libsgdebug.a ++ ++INCLUDES += -I$(top_builddir) diff --cc simgear/serial/Makefile.in index 00000000,00000000..4f863f16 new file mode 100644 --- /dev/null +++ b/simgear/serial/Makefile.in @@@ -1,0 -1,0 +1,368 @@@ ++# Makefile.in generated automatically by automake 1.3 from Makefile.am ++ ++# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++ ++SHELL = /bin/sh ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++prefix = @prefix@ ++exec_prefix = @exec_prefix@ ++ ++bindir = @bindir@ ++sbindir = @sbindir@ ++libexecdir = @libexecdir@ ++datadir = @datadir@ ++sysconfdir = @sysconfdir@ ++sharedstatedir = @sharedstatedir@ ++localstatedir = @localstatedir@ ++libdir = @libdir@ ++infodir = @infodir@ ++mandir = @mandir@ ++includedir = @includedir@ ++oldincludedir = /usr/include ++ ++DISTDIR = ++ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++ ++top_builddir = .. ++ ++ACLOCAL = @ACLOCAL@ ++AUTOCONF = @AUTOCONF@ ++AUTOMAKE = @AUTOMAKE@ ++AUTOHEADER = @AUTOHEADER@ ++ ++INSTALL = @INSTALL@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++transform = @program_transform_name@ ++ ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++CC = @CC@ ++CXX = @CXX@ ++LN_S = @LN_S@ ++MAKEINFO = @MAKEINFO@ ++PACKAGE = @PACKAGE@ ++RANLIB = @RANLIB@ ++VERSION = @VERSION@ ++base_LIBS = @base_LIBS@ ++opengl_LIBS = @opengl_LIBS@ ++ ++noinst_PROGRAMS = testserial ++ ++lib_LIBRARIES = libsgserial.a ++ ++include_HEADERS = serial.hxx ++ ++libsgserial_a_SOURCES = serial.cxx ++ ++testserial_SOURCES = testserial.cxx ++ ++testserial_LDADD = \ ++ $(top_builddir)/serial/libsgserial.a \ ++ $(top_builddir)/debug/libsgdebug.a ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = ../include/config.h ++CONFIG_CLEAN_FILES = ++LIBRARIES = $(lib_LIBRARIES) ++ ++ ++DEFS = @DEFS@ -I. -I$(srcdir) -I../include ++CPPFLAGS = @CPPFLAGS@ ++LDFLAGS = @LDFLAGS@ ++LIBS = @LIBS@ ++X_CFLAGS = @X_CFLAGS@ ++X_LIBS = @X_LIBS@ ++X_EXTRA_LIBS = @X_EXTRA_LIBS@ ++X_PRE_LIBS = @X_PRE_LIBS@ ++libsgserial_a_LIBADD = ++libsgserial_a_OBJECTS = serial.o ++AR = ar ++PROGRAMS = $(noinst_PROGRAMS) ++ ++testserial_OBJECTS = testserial.o ++testserial_DEPENDENCIES = $(top_builddir)/serial/libsgserial.a \ ++$(top_builddir)/debug/libsgdebug.a ++testserial_LDFLAGS = ++CXXFLAGS = @CXXFLAGS@ ++CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++CXXLINK = $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ ++HEADERS = $(include_HEADERS) ++ ++DIST_COMMON = Makefile.am Makefile.in ++ ++ ++DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ++ ++TAR = tar ++GZIP = --best ++DEP_FILES = .deps/serial.P .deps/testserial.P ++CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) ++SOURCES = $(libsgserial_a_SOURCES) $(testserial_SOURCES) ++OBJECTS = $(libsgserial_a_OBJECTS) $(testserial_OBJECTS) ++ ++all: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) ++ ++.SUFFIXES: ++.SUFFIXES: .S .c .cxx .o .s ++$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu serial/Makefile ++ ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++ ++mostlyclean-libLIBRARIES: ++ ++clean-libLIBRARIES: ++ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) ++ ++distclean-libLIBRARIES: ++ ++maintainer-clean-libLIBRARIES: ++ ++install-libLIBRARIES: $(lib_LIBRARIES) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(libdir) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ ++ $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ @$(POST_INSTALL) ++ @list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ ++ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ ++uninstall-libLIBRARIES: ++ @$(NORMAL_UNINSTALL) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(libdir)/$$p; \ ++ done ++ ++.s.o: ++ $(COMPILE) -c $< ++ ++.S.o: ++ $(COMPILE) -c $< ++ ++mostlyclean-compile: ++ -rm -f *.o core *.core ++ ++clean-compile: ++ ++distclean-compile: ++ -rm -f *.tab.c ++ ++maintainer-clean-compile: ++ ++libsgserial.a: $(libsgserial_a_OBJECTS) $(libsgserial_a_DEPENDENCIES) ++ -rm -f libsgserial.a ++ $(AR) cru libsgserial.a $(libsgserial_a_OBJECTS) $(libsgserial_a_LIBADD) ++ $(RANLIB) libsgserial.a ++ ++mostlyclean-noinstPROGRAMS: ++ ++clean-noinstPROGRAMS: ++ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) ++ ++distclean-noinstPROGRAMS: ++ ++maintainer-clean-noinstPROGRAMS: ++ ++testserial: $(testserial_OBJECTS) $(testserial_DEPENDENCIES) ++ @rm -f testserial ++ $(CXXLINK) $(testserial_LDFLAGS) $(testserial_OBJECTS) $(testserial_LDADD) $(LIBS) ++.cxx.o: ++ $(CXXCOMPILE) -c $< ++ ++install-includeHEADERS: $(include_HEADERS) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(includedir) ++ @list='$(include_HEADERS)'; for p in $$list; do \ ++ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ ++ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ ++ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++uninstall-includeHEADERS: ++ @$(NORMAL_UNINSTALL) ++ list='$(include_HEADERS)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++tags: TAGS ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) ++ here=`pwd` && cd $(srcdir) \ ++ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) ++ ++TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ ++ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ ++mostlyclean-tags: ++ ++clean-tags: ++ ++distclean-tags: ++ -rm -f TAGS ID ++ ++maintainer-clean-tags: ++ ++distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) ++ ++subdir = serial ++ ++distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu serial/Makefile ++ @for file in $(DISTFILES); do \ ++ d=$(srcdir); \ ++ test -f $(distdir)/$$file \ ++ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ++ || cp -p $$d/$$file $(distdir)/$$file; \ ++ done ++ ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ ++maintainer-clean-depend: ++ -rm -rf .deps ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++ ++%.o: %.cxx ++ @echo '$(CXXCOMPILE) -c $<'; \ ++ $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.cxx ++ @echo '$(LTCXXCOMPILE) -c $<'; \ ++ $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++info: ++dvi: ++check: all ++ $(MAKE) ++installcheck: ++install-exec: install-libLIBRARIES ++ @$(NORMAL_INSTALL) ++ ++install-data: install-includeHEADERS ++ @$(NORMAL_INSTALL) ++ ++install: install-exec install-data all ++ @: ++ ++uninstall: uninstall-libLIBRARIES uninstall-includeHEADERS ++ ++install-strip: ++ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install ++installdirs: ++ $(mkinstalldirs) $(DATADIR)$(libdir) $(DATADIR)$(includedir) ++ ++ ++mostlyclean-generic: ++ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f Makefile $(DISTCLEANFILES) ++ -rm -f config.cache config.log stamp-h stamp-h[0-9]* ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) ++ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) ++mostlyclean: mostlyclean-libLIBRARIES mostlyclean-compile \ ++ mostlyclean-noinstPROGRAMS mostlyclean-tags \ ++ mostlyclean-depend mostlyclean-generic ++ ++clean: clean-libLIBRARIES clean-compile clean-noinstPROGRAMS clean-tags \ ++ clean-depend clean-generic mostlyclean ++ ++distclean: distclean-libLIBRARIES distclean-compile \ ++ distclean-noinstPROGRAMS distclean-tags \ ++ distclean-depend distclean-generic clean ++ -rm -f config.status ++ ++maintainer-clean: maintainer-clean-libLIBRARIES \ ++ maintainer-clean-compile \ ++ maintainer-clean-noinstPROGRAMS maintainer-clean-tags \ ++ maintainer-clean-depend maintainer-clean-generic \ ++ distclean ++ @echo "This command is intended for maintainers to use;" ++ @echo "it deletes files that may require special tools to rebuild." ++ ++.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \ ++clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ ++install-libLIBRARIES mostlyclean-compile distclean-compile \ ++clean-compile maintainer-clean-compile mostlyclean-noinstPROGRAMS \ ++distclean-noinstPROGRAMS clean-noinstPROGRAMS \ ++maintainer-clean-noinstPROGRAMS uninstall-includeHEADERS \ ++install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ ++maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ ++clean-depend maintainer-clean-depend info dvi installcheck install-exec \ ++install-data install uninstall all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean ++ ++ ++INCLUDES += -I$(top_builddir) ++ ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --cc simgear/serial/serial.cxx index 00000000,00000000..7bac809c new file mode 100644 --- /dev/null +++ b/simgear/serial/serial.cxx @@@ -1,0 -1,0 +1,446 @@@ ++// serial.cxx -- Unix serial I/O support ++// ++// Written by Curtis Olson, started November 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 ++ ++#include ++ ++#ifdef FG_HAVE_STD_INCLUDE ++# include ++#else ++# include ++#endif ++ ++#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ ) ++ // maybe include something??? ++#else ++# include ++# include ++# include ++# include ++# include ++#endif ++ ++#include ++ ++#include "serial.hxx" ++ ++ ++FGSerialPort::FGSerialPort() ++ : dev_open(false) ++{ ++ // empty ++} ++ ++FGSerialPort::FGSerialPort(const string& device, int baud) { ++ open_port(device); ++ ++ if ( dev_open ) { ++ set_baud(baud); ++ } ++} ++ ++FGSerialPort::~FGSerialPort() { ++ // closing the port here screws us up because if we would even so ++ // much as make a copy of an FGSerialPort object and then delete it, ++ // the file descriptor gets closed. Doh!!! ++} ++ ++bool FGSerialPort::open_port(const string& device) { ++ ++#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ ) ++ ++ fd = CreateFile( device.c_str(), ++ GENERIC_READ | GENERIC_WRITE, ++ 0, // dwShareMode ++ NULL, // lpSecurityAttributes ++ OPEN_EXISTING, ++ FILE_FLAG_OVERLAPPED, ++ NULL ); ++ if ( fd == INVALID_HANDLE_VALUE ) ++ { ++ LPVOID lpMsgBuf; ++ FormatMessage( ++ FORMAT_MESSAGE_ALLOCATE_BUFFER | ++ FORMAT_MESSAGE_FROM_SYSTEM | ++ FORMAT_MESSAGE_IGNORE_INSERTS, ++ NULL, ++ GetLastError(), ++ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language ++ (LPTSTR) &lpMsgBuf, ++ 0, ++ NULL ); ++ ++ FG_LOG( FG_IO, FG_ALERT, "Error opening serial device \"" ++ << device << "\" " << (const char*) lpMsgBuf ); ++ LocalFree( lpMsgBuf ); ++ return false; ++ } ++ ++ dev_open = true; ++ return true; ++ ++#else ++ ++ struct termios config; ++ ++ fd = open(device.c_str(), O_RDWR | O_NONBLOCK); ++ cout << "Serial fd created = " << fd << endl; ++ ++ if ( fd == -1 ) { ++ FG_LOG( FG_IO, FG_ALERT, "Cannot open " << device ++ << " for serial I/O" ); ++ return false; ++ } else { ++ dev_open = true; ++ } ++ ++ // set required port parameters ++ if ( tcgetattr( fd, &config ) != 0 ) { ++ FG_LOG( FG_IO, FG_ALERT, "Unable to poll port settings" ); ++ return false; ++ } ++ ++ // cfmakeraw( &config ); ++ ++ // cout << "config.c_iflag = " << config.c_iflag << endl; ++ ++ // software flow control on ++ config.c_iflag |= IXON; ++ // config.c_iflag |= IXOFF; ++ ++ // config.c_cflag |= CLOCAL; ++ ++#if ! defined( sgi ) ++ // disable hardware flow control ++ config.c_cflag &= ~(CRTSCTS); ++#endif ++ ++ // cout << "config.c_iflag = " << config.c_iflag << endl; ++ ++ if ( tcsetattr( fd, TCSANOW, &config ) != 0 ) { ++ FG_LOG( FG_IO, FG_ALERT, "Unable to update port settings" ); ++ return false; ++ } ++ ++ return true; ++#endif ++} ++ ++ ++bool FGSerialPort::close_port() { ++#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ ) ++ CloseHandle( fd ); ++#else ++ close(fd); ++#endif ++ ++ dev_open = false; ++ ++ return true; ++} ++ ++ ++bool FGSerialPort::set_baud(int baud) { ++ ++#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ ) ++ ++ return true; ++ ++#else ++ ++ struct termios config; ++ speed_t speed = B9600; ++ ++ if ( tcgetattr( fd, &config ) != 0 ) { ++ FG_LOG( FG_IO, FG_ALERT, "Unable to poll port settings" ); ++ return false; ++ } ++ ++ if ( baud == 300 ) { ++ speed = B300; ++ } else if ( baud == 1200 ) { ++ speed = B1200; ++ } else if ( baud == 2400 ) { ++ speed = B2400; ++ } else if ( baud == 4800 ) { ++ speed = B4800; ++ } else if ( baud == 9600 ) { ++ speed = B9600; ++ } else if ( baud == 19200 ) { ++ speed = B19200; ++ } else if ( baud == 38400 ) { ++ speed = B38400; ++ } else if ( baud == 57600 ) { ++ speed = B57600; ++ } else if ( baud == 115200 ) { ++ speed = B115200; ++#if defined( linux ) || defined( __FreeBSD__ ) ++ } else if ( baud == 230400 ) { ++ speed = B230400; ++#endif ++ } else { ++ FG_LOG( FG_IO, FG_ALERT, "Unsupported baud rate " << baud ); ++ return false; ++ } ++ ++ if ( cfsetispeed( &config, speed ) != 0 ) { ++ FG_LOG( FG_IO, FG_ALERT, "Problem setting input baud rate" ); ++ return false; ++ } ++ ++ if ( cfsetospeed( &config, speed ) != 0 ) { ++ FG_LOG( FG_IO, FG_ALERT, "Problem setting output baud rate" ); ++ return false; ++ } ++ ++ if ( tcsetattr( fd, TCSANOW, &config ) != 0 ) { ++ FG_LOG( FG_IO, FG_ALERT, "Unable to update port settings" ); ++ return false; ++ } ++ ++ return true; ++ ++#endif ++ ++} ++ ++string FGSerialPort::read_port() { ++ ++#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ ) ++ ++ string result = ""; ++ return result; ++ ++#else ++ ++ const int max_count = 1024; ++ char buffer[max_count+1]; ++ int count; ++ string result; ++ ++ count = read(fd, buffer, max_count); ++ // cout << "read " << count << " bytes" << endl; ++ ++ if ( count < 0 ) { ++ // error condition ++ if ( errno != EAGAIN ) { ++ FG_LOG( FG_IO, FG_ALERT, ++ "Serial I/O on read, error number = " << errno ); ++ } ++ ++ return ""; ++ } else { ++ buffer[count] = '\0'; ++ result = buffer; ++ ++ return result; ++ } ++ ++#endif ++ ++} ++ ++int FGSerialPort::read_port(char *buf, int len) { ++ ++#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ ) ++ ++ buf[0] = '\0'; ++ return 0; ++ ++#else ++ ++ string result; ++ ++ int count = read(fd, buf, len); ++ // cout << "read " << count << " bytes" << endl; ++ ++ if ( count < 0 ) { ++ // error condition ++ if ( errno != EAGAIN ) { ++ FG_LOG( FG_IO, FG_ALERT, ++ "Serial I/O on read, error number = " << errno ); ++ } ++ ++ buf[0] = '\0'; ++ return 0; ++ } else { ++ buf[count] = '\0'; ++ ++ return count; ++ } ++ ++#endif ++ ++} ++ ++ ++int FGSerialPort::write_port(const string& value) { ++ ++#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ ) ++ ++ LPCVOID lpBuffer = value.c_str(); ++ DWORD nNumberOfBytesToWrite = value.length(); ++ DWORD lpNumberOfBytesWritten; ++ OVERLAPPED lpOverlapped; ++ ++ if ( WriteFile( fd, ++ lpBuffer, ++ nNumberOfBytesToWrite, ++ &lpNumberOfBytesWritten, ++ &lpOverlapped ) == 0 ) ++ { ++ LPVOID lpMsgBuf; ++ FormatMessage( ++ FORMAT_MESSAGE_ALLOCATE_BUFFER | ++ FORMAT_MESSAGE_FROM_SYSTEM | ++ FORMAT_MESSAGE_IGNORE_INSERTS, ++ NULL, ++ GetLastError(), ++ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language ++ (LPTSTR) &lpMsgBuf, ++ 0, ++ NULL ); ++ ++ FG_LOG( FG_IO, FG_ALERT, "Serial I/O write error: " ++ << (const char*) lpMsgBuf ); ++ LocalFree( lpMsgBuf ); ++ return int(lpNumberOfBytesWritten); ++ } ++ ++ return int(lpNumberOfBytesWritten); ++ ++#else ++ ++ static bool error = false; ++ int count; ++ ++ if ( error ) { ++ FG_LOG( FG_IO, FG_ALERT, "attempting serial write error recovery" ); ++ // attempt some sort of error recovery ++ count = write(fd, "\n", 1); ++ if ( count == 1 ) { ++ // cout << "Serial error recover successful!\n"; ++ error = false; ++ } else { ++ return 0; ++ } ++ } ++ ++ count = write(fd, value.c_str(), value.length()); ++ // cout << "write '" << value << "' " << count << " bytes" << endl; ++ ++ if ( (int)count == (int)value.length() ) { ++ error = false; ++ } else { ++ if ( errno == EAGAIN ) { ++ // ok ... in our context we don't really care if we can't ++ // write a string, we'll just get it the next time around ++ error = false; ++ } else { ++ error = true; ++ FG_LOG( FG_IO, FG_ALERT, ++ "Serial I/O on write, error number = " << errno ); ++ } ++ } ++ ++ return count; ++ ++#endif ++ ++} ++ ++ ++int FGSerialPort::write_port(const char* buf, int len) { ++#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ ) ++ ++ LPCVOID lpBuffer = buf; ++ DWORD nNumberOfBytesToWrite = len; ++ DWORD lpNumberOfBytesWritten; ++ OVERLAPPED lpOverlapped; ++ ++ if ( WriteFile( fd, ++ lpBuffer, ++ nNumberOfBytesToWrite, ++ &lpNumberOfBytesWritten, ++ &lpOverlapped ) == 0 ) ++ { ++ LPVOID lpMsgBuf; ++ FormatMessage( ++ FORMAT_MESSAGE_ALLOCATE_BUFFER | ++ FORMAT_MESSAGE_FROM_SYSTEM | ++ FORMAT_MESSAGE_IGNORE_INSERTS, ++ NULL, ++ GetLastError(), ++ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language ++ (LPTSTR) &lpMsgBuf, ++ 0, ++ NULL ); ++ ++ FG_LOG( FG_IO, FG_ALERT, "Serial I/O write error: " ++ << (const char*) lpMsgBuf ); ++ LocalFree( lpMsgBuf ); ++ return int(lpNumberOfBytesWritten); ++ } ++ ++ return int(lpNumberOfBytesWritten); ++ ++#else ++ ++ static bool error = false; ++ int count; ++ ++ if ( error ) { ++ // attempt some sort of error recovery ++ count = write(fd, "\n", 1); ++ if ( count == 1 ) { ++ // cout << "Serial error recover successful!\n"; ++ error = false; ++ } else { ++ return 0; ++ } ++ } ++ ++ count = write(fd, buf, len); ++ // cout << "write '" << buf << "' " << count << " bytes" << endl; ++ ++ if ( (int)count == len ) { ++ error = false; ++ } else { ++ error = true; ++ if ( errno == EAGAIN ) { ++ // ok ... in our context we don't really care if we can't ++ // write a string, we'll just get it the next time around ++ } else { ++ FG_LOG( FG_IO, FG_ALERT, ++ "Serial I/O on write, error number = " << errno ); ++ } ++ } ++ ++ return count; ++ ++#endif ++ ++} diff --cc simgear/serial/serial.hxx index 00000000,00000000..d0831e6b new file mode 100644 --- /dev/null +++ b/simgear/serial/serial.hxx @@@ -1,0 -1,0 +1,82 @@@ ++// serial.hxx -- Unix serial I/O support ++// ++// Written by Curtis Olson, started November 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$ ++ ++ ++#ifndef _SERIAL_HXX ++#define _SERIAL_HXX ++ ++ ++#ifndef __cplusplus ++# error This library requires C++ ++#endif ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ ) ++# include ++#endif ++ ++#include ++#include STL_STRING ++FG_USING_STD(string); ++ ++// if someone know how to do this all with C++ streams let me know ++// #include ++ ++ ++class FGSerialPort ++{ ++#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ ) ++ typedef HANDLE fd_type; ++#else ++ typedef int fd_type; ++#endif ++ ++private: ++ ++ fd_type fd; ++ bool dev_open; ++ ++public: ++ ++ FGSerialPort(); ++ FGSerialPort(const string& device, int baud); ++ ++ ~FGSerialPort(); ++ ++ bool open_port(const string& device); ++ bool close_port(); ++ bool set_baud(int baud); ++ string read_port(); ++ int read_port(char *buf, int len); ++ int write_port(const string& value); ++ int write_port(const char *buf, int len); ++ ++ inline bool is_enabled() { return dev_open; } ++}; ++ ++ ++#endif // _SERIAL_HXX ++ ++ diff --cc simgear/serial/testserial.cxx index 00000000,00000000..0ad05f09 new file mode 100644 --- /dev/null +++ b/simgear/serial/testserial.cxx @@@ -1,0 -1,0 +1,30 @@@ ++#include ++ ++#include ++ ++#include "serial.hxx" ++ ++main () { ++ FGSerialPort port; ++ string value; ++ bool result; ++ ++ fglog().setLogLevels( FG_ALL, FG_INFO ); ++ ++ cout << "start of main" << endl; ++ ++ result = port.open_port("/dev/ttyS1"); ++ cout << "opened port, result = " << result << endl; ++ ++ result = port.set_baud(4800); ++ cout << "set baud, result = " << result << endl; ++ ++ port.write_port("ATDT 626-9800\n"); ++ ++ while ( true ) { ++ value = port.read_port(); ++ if ( value.length() ) { ++ cout << "-> " << value << endl; ++ } ++ } ++} diff --cc simgear/xgl/Makefile.am index 00000000,00000000..13d95f70 new file mode 100644 --- /dev/null +++ b/simgear/xgl/Makefile.am @@@ -1,0 -1,0 +1,7 @@@ ++lib_LIBRARIES = libsgxgl.a ++ ++include_HEADERS = xgl.h ++ ++libsgxgl_a_SOURCES = xgl.c xglUtils.c ++ ++INCLUDES += -I$(top_builddir) diff --cc simgear/xgl/Makefile.in index 00000000,00000000..1c355bb4 new file mode 100644 --- /dev/null +++ b/simgear/xgl/Makefile.in @@@ -1,0 -1,0 +1,322 @@@ ++# Makefile.in generated automatically by automake 1.3 from Makefile.am ++ ++# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++ ++SHELL = /bin/sh ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++prefix = @prefix@ ++exec_prefix = @exec_prefix@ ++ ++bindir = @bindir@ ++sbindir = @sbindir@ ++libexecdir = @libexecdir@ ++datadir = @datadir@ ++sysconfdir = @sysconfdir@ ++sharedstatedir = @sharedstatedir@ ++localstatedir = @localstatedir@ ++libdir = @libdir@ ++infodir = @infodir@ ++mandir = @mandir@ ++includedir = @includedir@ ++oldincludedir = /usr/include ++ ++DISTDIR = ++ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++ ++top_builddir = .. ++ ++ACLOCAL = @ACLOCAL@ ++AUTOCONF = @AUTOCONF@ ++AUTOMAKE = @AUTOMAKE@ ++AUTOHEADER = @AUTOHEADER@ ++ ++INSTALL = @INSTALL@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++transform = @program_transform_name@ ++ ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++CC = @CC@ ++CXX = @CXX@ ++LN_S = @LN_S@ ++MAKEINFO = @MAKEINFO@ ++PACKAGE = @PACKAGE@ ++RANLIB = @RANLIB@ ++VERSION = @VERSION@ ++base_LIBS = @base_LIBS@ ++opengl_LIBS = @opengl_LIBS@ ++ ++lib_LIBRARIES = libsgxgl.a ++ ++include_HEADERS = xgl.h ++ ++libsgxgl_a_SOURCES = xgl.c xglUtils.c ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = ../include/config.h ++CONFIG_CLEAN_FILES = ++LIBRARIES = $(lib_LIBRARIES) ++ ++ ++DEFS = @DEFS@ -I. -I$(srcdir) -I../include ++CPPFLAGS = @CPPFLAGS@ ++LDFLAGS = @LDFLAGS@ ++LIBS = @LIBS@ ++X_CFLAGS = @X_CFLAGS@ ++X_LIBS = @X_LIBS@ ++X_EXTRA_LIBS = @X_EXTRA_LIBS@ ++X_PRE_LIBS = @X_PRE_LIBS@ ++libsgxgl_a_LIBADD = ++libsgxgl_a_OBJECTS = xgl.o xglUtils.o ++AR = ar ++CFLAGS = @CFLAGS@ ++COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) ++LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ ++HEADERS = $(include_HEADERS) ++ ++DIST_COMMON = Makefile.am Makefile.in ++ ++ ++DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) ++ ++TAR = tar ++GZIP = --best ++DEP_FILES = .deps/xgl.P .deps/xglUtils.P ++SOURCES = $(libsgxgl_a_SOURCES) ++OBJECTS = $(libsgxgl_a_OBJECTS) ++ ++all: Makefile $(LIBRARIES) $(HEADERS) ++ ++.SUFFIXES: ++.SUFFIXES: .S .c .o .s ++$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && $(AUTOMAKE) --gnu xgl/Makefile ++ ++Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++ ++mostlyclean-libLIBRARIES: ++ ++clean-libLIBRARIES: ++ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) ++ ++distclean-libLIBRARIES: ++ ++maintainer-clean-libLIBRARIES: ++ ++install-libLIBRARIES: $(lib_LIBRARIES) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(libdir) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ ++ $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ @$(POST_INSTALL) ++ @list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ if test -f $$p; then \ ++ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ ++ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ ++ else :; fi; \ ++ done ++ ++uninstall-libLIBRARIES: ++ @$(NORMAL_UNINSTALL) ++ list='$(lib_LIBRARIES)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(libdir)/$$p; \ ++ done ++ ++.s.o: ++ $(COMPILE) -c $< ++ ++.S.o: ++ $(COMPILE) -c $< ++ ++mostlyclean-compile: ++ -rm -f *.o core *.core ++ ++clean-compile: ++ ++distclean-compile: ++ -rm -f *.tab.c ++ ++maintainer-clean-compile: ++ ++libsgxgl.a: $(libsgxgl_a_OBJECTS) $(libsgxgl_a_DEPENDENCIES) ++ -rm -f libsgxgl.a ++ $(AR) cru libsgxgl.a $(libsgxgl_a_OBJECTS) $(libsgxgl_a_LIBADD) ++ $(RANLIB) libsgxgl.a ++ ++install-includeHEADERS: $(include_HEADERS) ++ @$(NORMAL_INSTALL) ++ $(mkinstalldirs) $(DESTDIR)$(includedir) ++ @list='$(include_HEADERS)'; for p in $$list; do \ ++ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ ++ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ ++ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++uninstall-includeHEADERS: ++ @$(NORMAL_UNINSTALL) ++ list='$(include_HEADERS)'; for p in $$list; do \ ++ rm -f $(DESTDIR)$(includedir)/$$p; \ ++ done ++ ++tags: TAGS ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) ++ here=`pwd` && cd $(srcdir) \ ++ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) ++ ++TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS)'; \ ++ unique=`for i in $$list; do echo $$i; done | \ ++ awk ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ ++ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) ++ ++mostlyclean-tags: ++ ++clean-tags: ++ ++distclean-tags: ++ -rm -f TAGS ID ++ ++maintainer-clean-tags: ++ ++distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) ++ ++subdir = xgl ++ ++distdir: $(DISTFILES) ++ here=`cd $(top_builddir) && pwd`; \ ++ top_distdir=`cd $(top_distdir) && pwd`; \ ++ distdir=`cd $(distdir) && pwd`; \ ++ cd $(top_srcdir) \ ++ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu xgl/Makefile ++ @for file in $(DISTFILES); do \ ++ d=$(srcdir); \ ++ test -f $(distdir)/$$file \ ++ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ ++ || cp -p $$d/$$file $(distdir)/$$file; \ ++ done ++ ++DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) ++ ++-include $(DEP_FILES) ++ ++mostlyclean-depend: ++ ++clean-depend: ++ ++distclean-depend: ++ ++maintainer-clean-depend: ++ -rm -rf .deps ++ ++%.o: %.c ++ @echo '$(COMPILE) -c $<'; \ ++ $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< ++ ++%.lo: %.c ++ @echo '$(LTCOMPILE) -c $<'; \ ++ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< ++ @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ ++ < .deps/$(*F).p > .deps/$(*F).P ++ @-rm -f .deps/$(*F).p ++info: ++dvi: ++check: all ++ $(MAKE) ++installcheck: ++install-exec: install-libLIBRARIES ++ @$(NORMAL_INSTALL) ++ ++install-data: install-includeHEADERS ++ @$(NORMAL_INSTALL) ++ ++install: install-exec install-data all ++ @: ++ ++uninstall: uninstall-libLIBRARIES uninstall-includeHEADERS ++ ++install-strip: ++ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install ++installdirs: ++ $(mkinstalldirs) $(DATADIR)$(libdir) $(DATADIR)$(includedir) ++ ++ ++mostlyclean-generic: ++ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f Makefile $(DISTCLEANFILES) ++ -rm -f config.cache config.log stamp-h stamp-h[0-9]* ++ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) ++ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) ++mostlyclean: mostlyclean-libLIBRARIES mostlyclean-compile \ ++ mostlyclean-tags mostlyclean-depend mostlyclean-generic ++ ++clean: clean-libLIBRARIES clean-compile clean-tags clean-depend \ ++ clean-generic mostlyclean ++ ++distclean: distclean-libLIBRARIES distclean-compile distclean-tags \ ++ distclean-depend distclean-generic clean ++ -rm -f config.status ++ ++maintainer-clean: maintainer-clean-libLIBRARIES \ ++ maintainer-clean-compile maintainer-clean-tags \ ++ maintainer-clean-depend maintainer-clean-generic \ ++ distclean ++ @echo "This command is intended for maintainers to use;" ++ @echo "it deletes files that may require special tools to rebuild." ++ ++.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \ ++clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ ++install-libLIBRARIES mostlyclean-compile distclean-compile \ ++clean-compile maintainer-clean-compile uninstall-includeHEADERS \ ++install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ ++maintainer-clean-tags distdir mostlyclean-depend distclean-depend \ ++clean-depend maintainer-clean-depend info dvi installcheck install-exec \ ++install-data install uninstall all installdirs mostlyclean-generic \ ++distclean-generic clean-generic maintainer-clean-generic clean \ ++mostlyclean distclean maintainer-clean ++ ++ ++INCLUDES += -I$(top_builddir) ++ ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --cc simgear/xgl/xgl.c index 00000000,00000000..65380524 new file mode 100644 --- /dev/null +++ b/simgear/xgl/xgl.c @@@ -1,0 -1,0 +1,3034 @@@ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#ifdef HAVE_WINDOWS_H ++# include ++#endif ++ ++#include "xgl.h" ++#include ++ ++#include ++#include ++ ++#ifdef HAVE_UNISTD_H ++# include ++#endif ++ ++ ++#ifdef XGL_TRACE ++ ++#ifndef TRUE ++#define TRUE 1 ++#define FALSE 0 ++#endif ++ ++GLboolean xglIsEnabled ( GLenum cap ) ++{ ++ if ( xglTraceIsEnabled("glIsEnabled") ) ++ fprintf ( xglTraceFd, " /* glIsEnabled ( (GLenum)%s ) ; */\n" , xglExpandGLenum ( (GLenum) cap ) ) ; ++ ++ return glIsEnabled ( cap ) ; ++} ++ ++GLboolean xglIsList ( GLuint list ) ++{ ++ if ( xglTraceIsEnabled("glIsList") ) ++ fprintf ( xglTraceFd, " /* glIsList ( (GLuint)%u ) ; */\n" , list ) ; ++ ++ return glIsList ( list ) ; ++} ++ ++GLenum xglGetError ( ) ++{ ++ if ( xglTraceIsEnabled("glGetError") ) ++ fprintf ( xglTraceFd, " /* glGetError ( ) ; */\n" ) ; ++ ++ return glGetError ( ) ; ++} ++ ++GLint xglRenderMode ( GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glRenderMode") ) ++ fprintf ( xglTraceFd, " glRenderMode ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) mode ) ) ; ++ ++ return glRenderMode ( mode ) ; ++} ++ ++GLuint xglGenLists ( GLsizei range ) ++{ ++ if ( xglTraceIsEnabled("glGenLists") ) ++ fprintf ( xglTraceFd, " glGenLists ( (GLsizei)%d ) ;\n" , range ) ; ++ ++ return glGenLists ( range ) ; ++} ++ ++const GLubyte* xglGetString ( GLenum name ) ++{ ++ if ( xglTraceIsEnabled("glGetString") ) ++ fprintf ( xglTraceFd, " /* glGetString ( (GLenum)%s ) ; */\n" , xglExpandGLenum ( (GLenum) name ) ) ; ++ ++ return glGetString ( name ) ; ++} ++ ++void xglAccum ( GLenum op, GLfloat value ) ++{ ++ if ( xglTraceIsEnabled("glAccum") ) ++ fprintf ( xglTraceFd, " glAccum ( (GLenum)%s, (GLfloat)%ff ) ;\n" , xglExpandGLenum ( (GLenum) op ), value ) ; ++ if ( xglExecuteIsEnabled("glAccum") ) ++ glAccum ( op, value ) ; ++} ++ ++void xglAlphaFunc ( GLenum func, GLclampf ref ) ++{ ++ if ( xglTraceIsEnabled("glAlphaFunc") ) ++ fprintf ( xglTraceFd, " glAlphaFunc ( (GLenum)%s, (GLclampf)%ff ) ;\n" , xglExpandGLenum ( (GLenum) func ), ref ) ; ++ if ( xglExecuteIsEnabled("glAlphaFunc") ) ++ glAlphaFunc ( func, ref ) ; ++} ++ ++void xglArrayElementEXT ( GLint i ) ++{ ++ if ( xglTraceIsEnabled("glArrayElementEXT") ) ++ fprintf ( xglTraceFd, " glArrayElementEXT ( (GLint)%d ) ;\n" , i ) ; ++#ifdef GL_VERSION_1_1 ++ glArrayElement ( i ) ; ++#else ++#ifdef GL_EXT_vertex_array ++ if ( xglExecuteIsEnabled("glArrayElementEXT") ) ++ glArrayElementEXT ( i ) ; ++#else ++ fprintf ( xglTraceFd, " glArrayElementEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++#endif ++} ++ ++void xglBegin ( GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glBegin") ) ++ fprintf ( xglTraceFd, " glBegin ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) mode ) ) ; ++ if ( xglExecuteIsEnabled("glBegin") ) ++ glBegin ( mode ) ; ++} ++ ++void xglBitmap ( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, GLubyte* bitmap ) ++{ ++ if ( xglTraceIsEnabled("glBitmap") ) ++ fprintf ( xglTraceFd, " glBitmap ( (GLsizei)%d, (GLsizei)%d, (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff, (GLubyte *)0x%08x ) ;\n" , width, height, xorig, yorig, xmove, ymove, bitmap ) ; ++ if ( xglExecuteIsEnabled("glBitmap") ) ++ glBitmap ( width, height, xorig, yorig, xmove, ymove, bitmap ) ; ++} ++ ++void xglBlendColorEXT ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) ++{ ++ if ( xglTraceIsEnabled("glBlendColorEXT") ) ++ fprintf ( xglTraceFd, " glBlendColorEXT ( (GLclampf)%ff, (GLclampf)%ff, (GLclampf)%ff, (GLclampf)%ff ) ;\n" , red, green, blue, alpha ) ; ++#ifdef GL_EXT_blend_color ++ if ( xglExecuteIsEnabled("glBlendColorEXT") ) ++ glBlendColorEXT ( red, green, blue, alpha ) ; ++#else ++ fprintf ( xglTraceFd, " glBlendColorEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++} ++ ++void xglBlendEquationEXT ( GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glBlendEquationEXT") ) ++ fprintf ( xglTraceFd, " glBlendEquationEXT ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) mode ) ) ; ++#ifdef GL_EXT_blend_minmax ++ if ( xglExecuteIsEnabled("glBlendEquationEXT") ) ++ glBlendEquationEXT ( mode ) ; ++#else ++ fprintf ( xglTraceFd, " glBlendEquationEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++} ++ ++void xglBlendFunc ( GLenum sfactor, GLenum dfactor ) ++{ ++ if ( xglTraceIsEnabled("glBlendFunc") ) ++ fprintf ( xglTraceFd, " glBlendFunc ( (GLenum)%s, (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) sfactor ), xglExpandGLenum ( (GLenum) dfactor ) ) ; ++ if ( xglExecuteIsEnabled("glBlendFunc") ) ++ glBlendFunc ( sfactor, dfactor ) ; ++} ++ ++void xglCallList ( GLuint list ) ++{ ++ if ( xglTraceIsEnabled("glCallList") ) ++ fprintf ( xglTraceFd, " glCallList ( (GLuint)%u ) ;\n" , list ) ; ++ if ( xglExecuteIsEnabled("glCallList") ) ++ glCallList ( list ) ; ++} ++ ++void xglCallLists ( GLsizei n, GLenum type, GLvoid* lists ) ++{ ++ if ( xglTraceIsEnabled("glCallLists") ) ++ fprintf ( xglTraceFd, " glCallLists ( (GLsizei)%d, (GLenum)%s, (GLvoid *)0x%08x ) ;\n" , n, xglExpandGLenum ( (GLenum) type ), lists ) ; ++ if ( xglExecuteIsEnabled("glCallLists") ) ++ glCallLists ( n, type, lists ) ; ++} ++ ++ ++void xglClear ( GLbitfield mask ) ++{ ++ if ( xglTraceIsEnabled("glClear") ) ++ switch ( mask ) ++ { ++ case GL_COLOR_BUFFER_BIT : ++ fprintf ( xglTraceFd, " glClear ( GL_COLOR_BUFFER_BIT ) ;\n" ) ; ++ break ; ++ case GL_DEPTH_BUFFER_BIT : ++ fprintf ( xglTraceFd, " glClear ( GL_DEPTH_BUFFER_BIT ) ;\n" ) ; ++ break ; ++ case GL_ACCUM_BUFFER_BIT : ++ fprintf ( xglTraceFd, " glClear ( GL_ACCUM_BUFFER_BIT ) ;\n" ) ; ++ break ; ++ case GL_STENCIL_BUFFER_BIT : ++ fprintf ( xglTraceFd, " glClear ( GL_STENCIL_BUFFER_BIT ) ;\n" ) ; ++ break ; ++ case (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) : ++ fprintf ( xglTraceFd, " glClear ( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT ) ;\n" ) ; ++ break ; ++ ++ default : ++ fprintf ( xglTraceFd, " glClear ( (GLbitfield)0x%08x ) ;\n" , mask ) ; break ; ++ } ++ ++ if ( xglExecuteIsEnabled("glClear") ) ++ glClear ( mask ) ; ++} ++ ++ ++void xglClearAccum ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) ++{ ++ if ( xglTraceIsEnabled("glClearAccum") ) ++ fprintf ( xglTraceFd, " glClearAccum ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , red, green, blue, alpha ) ; ++ if ( xglExecuteIsEnabled("glClearAccum") ) ++ glClearAccum ( red, green, blue, alpha ) ; ++} ++ ++void xglClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) ++{ ++ if ( xglTraceIsEnabled("glClearColor") ) ++ fprintf ( xglTraceFd, " glClearColor ( (GLclampf)%ff, (GLclampf)%ff, (GLclampf)%ff, (GLclampf)%ff ) ;\n" , red, green, blue, alpha ) ; ++ if ( xglExecuteIsEnabled("glClearColor") ) ++ glClearColor ( red, green, blue, alpha ) ; ++} ++ ++void xglClearDepth ( GLclampd depth ) ++{ ++ if ( xglTraceIsEnabled("glClearDepth") ) ++ fprintf ( xglTraceFd, " glClearDepth ( (GLclampd)%f ) ;\n" , depth ) ; ++ if ( xglExecuteIsEnabled("glClearDepth") ) ++ glClearDepth ( depth ) ; ++} ++ ++void xglClearIndex ( GLfloat c ) ++{ ++ if ( xglTraceIsEnabled("glClearIndex") ) ++ fprintf ( xglTraceFd, " glClearIndex ( (GLfloat)%ff ) ;\n" , c ) ; ++ if ( xglExecuteIsEnabled("glClearIndex") ) ++ glClearIndex ( c ) ; ++} ++ ++void xglClearStencil ( GLint s ) ++{ ++ if ( xglTraceIsEnabled("glClearStencil") ) ++ fprintf ( xglTraceFd, " glClearStencil ( (GLint)%d ) ;\n" , s ) ; ++ if ( xglExecuteIsEnabled("glClearStencil") ) ++ glClearStencil ( s ) ; ++} ++ ++void xglClipPlane ( GLenum plane, GLdouble* equation ) ++{ ++ if ( xglTraceIsEnabled("glClipPlane") ) ++ fprintf ( xglTraceFd, " glClipPlane ( (GLenum)%s, (GLdouble *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) plane ), equation ) ; ++ if ( xglExecuteIsEnabled("glClipPlane") ) ++ glClipPlane ( plane, equation ) ; ++} ++ ++void xglColor3b ( GLbyte red, GLbyte green, GLbyte blue ) ++{ ++ if ( xglTraceIsEnabled("glColor3b") ) ++ fprintf ( xglTraceFd, " glColor3b ( (GLbyte)%d, (GLbyte)%d, (GLbyte)%d ) ;\n" , red, green, blue ) ; ++ if ( xglExecuteIsEnabled("glColor3b") ) ++ glColor3b ( red, green, blue ) ; ++} ++ ++void xglColor3bv ( GLbyte* v ) ++{ ++ if ( xglTraceIsEnabled("glColor3bv") ) ++ fprintf ( xglTraceFd, " glColor3bv ( xglBuild3bv((GLbyte)%d,(GLbyte)%d,(GLbyte)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glColor3bv") ) ++ glColor3bv ( v ) ; ++} ++ ++void xglColor3d ( GLdouble red, GLdouble green, GLdouble blue ) ++{ ++ if ( xglTraceIsEnabled("glColor3d") ) ++ fprintf ( xglTraceFd, " glColor3d ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , red, green, blue ) ; ++ if ( xglExecuteIsEnabled("glColor3d") ) ++ glColor3d ( red, green, blue ) ; ++} ++ ++void xglColor3dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glColor3dv") ) ++ fprintf ( xglTraceFd, " glColor3dv ( xglBuild3dv((GLdouble)%f,(GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glColor3dv") ) ++ glColor3dv ( v ) ; ++} ++ ++void xglColor3f ( GLfloat red, GLfloat green, GLfloat blue ) ++{ ++ if ( xglTraceIsEnabled("glColor3f") ) ++ fprintf ( xglTraceFd, " glColor3f ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , red, green, blue ) ; ++ if ( xglExecuteIsEnabled("glColor3f") ) ++ glColor3f ( red, green, blue ) ; ++} ++ ++void xglColor3fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glColor3fv") ) ++ fprintf ( xglTraceFd, " glColor3fv ( xglBuild3fv((GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glColor3fv") ) ++ glColor3fv ( v ) ; ++} ++ ++void xglColor3i ( GLint red, GLint green, GLint blue ) ++{ ++ if ( xglTraceIsEnabled("glColor3i") ) ++ fprintf ( xglTraceFd, " glColor3i ( (GLint)%d, (GLint)%d, (GLint)%d ) ;\n" , red, green, blue ) ; ++ if ( xglExecuteIsEnabled("glColor3i") ) ++ glColor3i ( red, green, blue ) ; ++} ++ ++void xglColor3iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glColor3iv") ) ++ fprintf ( xglTraceFd, " glColor3iv ( xglBuild3iv((GLint)%d,(GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glColor3iv") ) ++ glColor3iv ( v ) ; ++} ++ ++void xglColor3s ( GLshort red, GLshort green, GLshort blue ) ++{ ++ if ( xglTraceIsEnabled("glColor3s") ) ++ fprintf ( xglTraceFd, " glColor3s ( (GLshort)%d, (GLshort)%d, (GLshort)%d ) ;\n" , red, green, blue ) ; ++ if ( xglExecuteIsEnabled("glColor3s") ) ++ glColor3s ( red, green, blue ) ; ++} ++ ++void xglColor3sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glColor3sv") ) ++ fprintf ( xglTraceFd, " glColor3sv ( xglBuild3sv((GLshort)%d,(GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glColor3sv") ) ++ glColor3sv ( v ) ; ++} ++ ++void xglColor3ub ( GLubyte red, GLubyte green, GLubyte blue ) ++{ ++ if ( xglTraceIsEnabled("glColor3ub") ) ++ fprintf ( xglTraceFd, " glColor3ub ( (GLubyte)%u, (GLubyte)%u, (GLubyte)%u ) ;\n" , red, green, blue ) ; ++ if ( xglExecuteIsEnabled("glColor3ub") ) ++ glColor3ub ( red, green, blue ) ; ++} ++ ++void xglColor3ubv ( GLubyte* v ) ++{ ++ if ( xglTraceIsEnabled("glColor3ubv") ) ++ fprintf ( xglTraceFd, " glColor3ubv ( xglBuild3ubv((GLubyte)%d,(GLubyte)%d,(GLubyte)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glColor3ubv") ) ++ glColor3ubv ( v ) ; ++} ++ ++void xglColor3ui ( GLuint red, GLuint green, GLuint blue ) ++{ ++ if ( xglTraceIsEnabled("glColor3ui") ) ++ fprintf ( xglTraceFd, " glColor3ui ( (GLuint)%u, (GLuint)%u, (GLuint)%u ) ;\n" , red, green, blue ) ; ++ if ( xglExecuteIsEnabled("glColor3ui") ) ++ glColor3ui ( red, green, blue ) ; ++} ++ ++void xglColor3uiv ( GLuint* v ) ++{ ++ if ( xglTraceIsEnabled("glColor3uiv") ) ++ fprintf ( xglTraceFd, " glColor3uiv ( xglBuild3uiv((GLuint)%d,(GLuint)%d,(GLuint)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glColor3uiv") ) ++ glColor3uiv ( v ) ; ++} ++ ++void xglColor3us ( GLushort red, GLushort green, GLushort blue ) ++{ ++ if ( xglTraceIsEnabled("glColor3us") ) ++ fprintf ( xglTraceFd, " glColor3us ( (GLushort)%u, (GLushort)%u, (GLushort)%u ) ;\n" , red, green, blue ) ; ++ if ( xglExecuteIsEnabled("glColor3us") ) ++ glColor3us ( red, green, blue ) ; ++} ++ ++void xglColor3usv ( GLushort* v ) ++{ ++ if ( xglTraceIsEnabled("glColor3usv") ) ++ fprintf ( xglTraceFd, " glColor3usv ( xglBuild3usv((GLushort)%d,(GLushort)%d,(GLushort)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glColor3usv") ) ++ glColor3usv ( v ) ; ++} ++ ++void xglColor4b ( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) ++{ ++ if ( xglTraceIsEnabled("glColor4b") ) ++ fprintf ( xglTraceFd, " glColor4b ( (GLbyte)%d, (GLbyte)%d, (GLbyte)%d, (GLbyte)%d ) ;\n" , red, green, blue, alpha ) ; ++ if ( xglExecuteIsEnabled("glColor4b") ) ++ glColor4b ( red, green, blue, alpha ) ; ++} ++ ++void xglColor4bv ( GLbyte* v ) ++{ ++ if ( xglTraceIsEnabled("glColor4bv") ) ++ fprintf ( xglTraceFd, " glColor4bv ( xglBuild4bv((GLbyte)%d,(GLbyte)%d,(GLbyte)%d,(GLbyte)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glColor4bv") ) ++ glColor4bv ( v ) ; ++} ++ ++void xglColor4d ( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) ++{ ++ if ( xglTraceIsEnabled("glColor4d") ) ++ fprintf ( xglTraceFd, " glColor4d ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , red, green, blue, alpha ) ; ++ if ( xglExecuteIsEnabled("glColor4d") ) ++ glColor4d ( red, green, blue, alpha ) ; ++} ++ ++void xglColor4dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glColor4dv") ) ++ fprintf ( xglTraceFd, " glColor4dv ( xglBuild4dv((GLdouble)%f,(GLdouble)%f,(GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glColor4dv") ) ++ glColor4dv ( v ) ; ++} ++ ++void xglColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) ++{ ++ if ( xglTraceIsEnabled("glColor4f") ) ++ fprintf ( xglTraceFd, " glColor4f ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , red, green, blue, alpha ) ; ++ if ( xglExecuteIsEnabled("glColor4f") ) ++ glColor4f ( red, green, blue, alpha ) ; ++} ++ ++void xglColor4fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glColor4fv") ) ++ fprintf ( xglTraceFd, " glColor4fv ( xglBuild4fv((GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glColor4fv") ) ++ glColor4fv ( v ) ; ++} ++ ++void xglColor4i ( GLint red, GLint green, GLint blue, GLint alpha ) ++{ ++ if ( xglTraceIsEnabled("glColor4i") ) ++ fprintf ( xglTraceFd, " glColor4i ( (GLint)%d, (GLint)%d, (GLint)%d, (GLint)%d ) ;\n" , red, green, blue, alpha ) ; ++ if ( xglExecuteIsEnabled("glColor4i") ) ++ glColor4i ( red, green, blue, alpha ) ; ++} ++ ++void xglColor4iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glColor4iv") ) ++ fprintf ( xglTraceFd, " glColor4iv ( xglBuild4iv((GLint)%d,(GLint)%d,(GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glColor4iv") ) ++ glColor4iv ( v ) ; ++} ++ ++void xglColor4s ( GLshort red, GLshort green, GLshort blue, GLshort alpha ) ++{ ++ if ( xglTraceIsEnabled("glColor4s") ) ++ fprintf ( xglTraceFd, " glColor4s ( (GLshort)%d, (GLshort)%d, (GLshort)%d, (GLshort)%d ) ;\n" , red, green, blue, alpha ) ; ++ if ( xglExecuteIsEnabled("glColor4s") ) ++ glColor4s ( red, green, blue, alpha ) ; ++} ++ ++void xglColor4sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glColor4sv") ) ++ fprintf ( xglTraceFd, " glColor4sv ( xglBuild4sv((GLshort)%d,(GLshort)%d,(GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glColor4sv") ) ++ glColor4sv ( v ) ; ++} ++ ++void xglColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) ++{ ++ if ( xglTraceIsEnabled("glColor4ub") ) ++ fprintf ( xglTraceFd, " glColor4ub ( (GLubyte)%u, (GLubyte)%u, (GLubyte)%u, (GLubyte)%u ) ;\n" , red, green, blue, alpha ) ; ++ if ( xglExecuteIsEnabled("glColor4ub") ) ++ glColor4ub ( red, green, blue, alpha ) ; ++} ++ ++void xglColor4ubv ( GLubyte* v ) ++{ ++ if ( xglTraceIsEnabled("glColor4ubv") ) ++ fprintf ( xglTraceFd, " glColor4ubv ( xglBuild4ubv((GLubyte)%d,(GLubyte)%d,(GLubyte)%d,(GLubyte)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glColor4ubv") ) ++ glColor4ubv ( v ) ; ++} ++ ++void xglColor4ui ( GLuint red, GLuint green, GLuint blue, GLuint alpha ) ++{ ++ if ( xglTraceIsEnabled("glColor4ui") ) ++ fprintf ( xglTraceFd, " glColor4ui ( (GLuint)%u, (GLuint)%u, (GLuint)%u, (GLuint)%u ) ;\n" , red, green, blue, alpha ) ; ++ if ( xglExecuteIsEnabled("glColor4ui") ) ++ glColor4ui ( red, green, blue, alpha ) ; ++} ++ ++void xglColor4uiv ( GLuint* v ) ++{ ++ if ( xglTraceIsEnabled("glColor4uiv") ) ++ fprintf ( xglTraceFd, " glColor4uiv ( xglBuild4uiv((GLuint)%d,(GLuint)%d,(GLuint)%d,(GLuint)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glColor4uiv") ) ++ glColor4uiv ( v ) ; ++} ++ ++void xglColor4us ( GLushort red, GLushort green, GLushort blue, GLushort alpha ) ++{ ++ if ( xglTraceIsEnabled("glColor4us") ) ++ fprintf ( xglTraceFd, " glColor4us ( (GLushort)%u, (GLushort)%u, (GLushort)%u, (GLushort)%u ) ;\n" , red, green, blue, alpha ) ; ++ if ( xglExecuteIsEnabled("glColor4us") ) ++ glColor4us ( red, green, blue, alpha ) ; ++} ++ ++void xglColor4usv ( GLushort* v ) ++{ ++ if ( xglTraceIsEnabled("glColor4usv") ) ++ fprintf ( xglTraceFd, " glColor4usv ( xglBuild4usv((GLushort)%d,(GLushort)%d,(GLushort)%d,(GLushort)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glColor4usv") ) ++ glColor4usv ( v ) ; ++} ++ ++void xglColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) ++{ ++ if ( xglTraceIsEnabled("glColorMask") ) ++ fprintf ( xglTraceFd, " glColorMask ( (GLboolean)%d, (GLboolean)%d, (GLboolean)%d, (GLboolean)%d ) ;\n" , red, green, blue, alpha ) ; ++ if ( xglExecuteIsEnabled("glColorMask") ) ++ glColorMask ( red, green, blue, alpha ) ; ++} ++ ++void xglColorMaterial ( GLenum face, GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glColorMaterial") ) ++ fprintf ( xglTraceFd, " glColorMaterial ( (GLenum)%s, (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) face ), xglExpandGLenum ( (GLenum) mode ) ) ; ++ if ( xglExecuteIsEnabled("glColorMaterial") ) ++ glColorMaterial ( face, mode ) ; ++} ++ ++void xglColorPointerEXT ( GLint size, GLenum type, GLsizei stride, GLsizei count, void* ptr ) ++{ ++ if ( xglTraceIsEnabled("glColorPointerEXT") ) ++ fprintf ( xglTraceFd, " glColorPointerEXT ( (GLint)%d, (GLenum)%s, (GLsizei)%d, (GLsizei)%d, (void *)0x%08x ) ;\n" , size, xglExpandGLenum ( (GLenum) type ), stride, count, ptr ) ; ++#ifdef GL_VERSION_1_1 ++ glColorPointer ( size, type, stride, ptr ) ; ++#else ++#ifdef GL_EXT_vertex_array ++ if ( xglExecuteIsEnabled("glColorPointerEXT") ) ++ glColorPointerEXT ( size, type, stride, count, ptr ) ; ++#else ++ fprintf ( xglTraceFd, " glColorPointerEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++#endif ++} ++ ++void xglCopyPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) ++{ ++ if ( xglTraceIsEnabled("glCopyPixels") ) ++ fprintf ( xglTraceFd, " glCopyPixels ( (GLint)%d, (GLint)%d, (GLsizei)%d, (GLsizei)%d, (GLenum)%s ) ;\n" , x, y, width, height, xglExpandGLenum ( (GLenum) type ) ) ; ++ if ( xglExecuteIsEnabled("glCopyPixels") ) ++ glCopyPixels ( x, y, width, height, type ) ; ++} ++ ++void xglCullFace ( GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glCullFace") ) ++ fprintf ( xglTraceFd, " glCullFace ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) mode ) ) ; ++ if ( xglExecuteIsEnabled("glCullFace") ) ++ glCullFace ( mode ) ; ++} ++ ++void xglDeleteLists ( GLuint list, GLsizei range ) ++{ ++ if ( xglTraceIsEnabled("glDeleteLists") ) ++ fprintf ( xglTraceFd, " glDeleteLists ( (GLuint)%u, (GLsizei)%d ) ;\n" , list, range ) ; ++ if ( xglExecuteIsEnabled("glDeleteLists") ) ++ glDeleteLists ( list, range ) ; ++} ++ ++void xglDepthFunc ( GLenum func ) ++{ ++ if ( xglTraceIsEnabled("glDepthFunc") ) ++ fprintf ( xglTraceFd, " glDepthFunc ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) func ) ) ; ++ if ( xglExecuteIsEnabled("glDepthFunc") ) ++ glDepthFunc ( func ) ; ++} ++ ++void xglDepthMask ( GLboolean flag ) ++{ ++ if ( xglTraceIsEnabled("glDepthMask") ) ++ fprintf ( xglTraceFd, " glDepthMask ( (GLboolean)%d ) ;\n" , flag ) ; ++ if ( xglExecuteIsEnabled("glDepthMask") ) ++ glDepthMask ( flag ) ; ++} ++ ++void xglDepthRange ( GLclampd near_val, GLclampd far_val ) ++{ ++ if ( xglTraceIsEnabled("glDepthRange") ) ++ fprintf ( xglTraceFd, " glDepthRange ( (GLclampd)%f, (GLclampd)%f ) ;\n" , near_val, far_val ) ; ++ if ( xglExecuteIsEnabled("glDepthRange") ) ++ glDepthRange ( near_val, far_val ) ; ++} ++ ++void xglDisable ( GLenum cap ) ++{ ++ if ( xglTraceIsEnabled("glDisable") ) ++ fprintf ( xglTraceFd, " glDisable ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) cap ) ) ; ++ if ( xglExecuteIsEnabled("glDisable") ) ++ glDisable ( cap ) ; ++} ++ ++void xglDrawArraysEXT ( GLenum mode, GLint first, GLsizei count ) ++{ ++ if ( xglTraceIsEnabled("glDrawArraysEXT") ) ++ fprintf ( xglTraceFd, " glDrawArraysEXT ( (GLenum)%s, (GLint)%d, (GLsizei)%d ) ;\n" , xglExpandGLenum ( (GLenum) mode ), first, count ) ; ++#ifdef GL_VERSION_1_1 ++ glDrawArrays ( mode, first, count ) ; ++#else ++#ifdef GL_EXT_vertex_array ++ if ( xglExecuteIsEnabled("glDrawArraysEXT") ) ++ glDrawArraysEXT ( mode, first, count ) ; ++#else ++ fprintf ( xglTraceFd, " glDrawArraysEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++#endif ++} ++ ++void xglDrawBuffer ( GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glDrawBuffer") ) ++ fprintf ( xglTraceFd, " glDrawBuffer ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) mode ) ) ; ++ if ( xglExecuteIsEnabled("glDrawBuffer") ) ++ glDrawBuffer ( mode ) ; ++} ++ ++void xglDrawPixels ( GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels ) ++{ ++ if ( xglTraceIsEnabled("glDrawPixels") ) ++ fprintf ( xglTraceFd, " glDrawPixels ( (GLsizei)%d, (GLsizei)%d, (GLenum)%s, (GLenum)%s, (GLvoid *)0x%08x ) ;\n" , width, height, xglExpandGLenum ( (GLenum) format ), xglExpandGLenum ( (GLenum) type ), pixels ) ; ++ if ( xglExecuteIsEnabled("glDrawPixels") ) ++ glDrawPixels ( width, height, format, type, pixels ) ; ++} ++ ++void xglEdgeFlag ( GLboolean flag ) ++{ ++ if ( xglTraceIsEnabled("glEdgeFlag") ) ++ fprintf ( xglTraceFd, " glEdgeFlag ( (GLboolean)%d ) ;\n" , flag ) ; ++ if ( xglExecuteIsEnabled("glEdgeFlag") ) ++ glEdgeFlag ( flag ) ; ++} ++ ++void xglEdgeFlagPointerEXT ( GLsizei stride, GLsizei count, GLboolean* ptr ) ++{ ++ if ( xglTraceIsEnabled("glEdgeFlagPointerEXT") ) ++ fprintf ( xglTraceFd, " glEdgeFlagPointerEXT ( (GLsizei)%d, (GLsizei)%d, (GLboolean *)0x%08x ) ;\n" , stride, count, ptr ) ; ++#ifdef GL_VERSION_1_1 ++ glEdgeFlagPointer ( stride, ptr ) ; ++#else ++#ifdef GL_EXT_vertex_array ++ if ( xglExecuteIsEnabled("glEdgeFlagPointerEXT") ) ++ glEdgeFlagPointerEXT ( stride, count, ptr ) ; ++#else ++ fprintf ( xglTraceFd, " glEdgeFlagPointerEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++#endif ++} ++ ++void xglEdgeFlagv ( GLboolean* flag ) ++{ ++ if ( xglTraceIsEnabled("glEdgeFlagv") ) ++ fprintf ( xglTraceFd, " glEdgeFlagv ( (GLboolean *)0x%08x ) ;\n" , flag ) ; ++ if ( xglExecuteIsEnabled("glEdgeFlagv") ) ++ glEdgeFlagv ( flag ) ; ++} ++ ++void xglEnable ( GLenum cap ) ++{ ++ if ( xglTraceIsEnabled("glEnable") ) ++ fprintf ( xglTraceFd, " glEnable ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) cap ) ) ; ++ if ( xglExecuteIsEnabled("glEnable") ) ++ glEnable ( cap ) ; ++} ++ ++void xglEnd ( ) ++{ ++ if ( xglTraceIsEnabled("glEnd") ) ++ fprintf ( xglTraceFd, " glEnd ( ) ;\n" ) ; ++ if ( xglExecuteIsEnabled("glEnd") ) ++ glEnd ( ) ; ++} ++ ++void xglEndList ( ) ++{ ++ if ( xglTraceIsEnabled("glEndList") ) ++ fprintf ( xglTraceFd, " glEndList ( ) ;\n" ) ; ++ if ( xglExecuteIsEnabled("glEndList") ) ++ glEndList ( ) ; ++} ++ ++void xglEvalCoord1d ( GLdouble u ) ++{ ++ if ( xglTraceIsEnabled("glEvalCoord1d") ) ++ fprintf ( xglTraceFd, " glEvalCoord1d ( (GLdouble)%f ) ;\n" , u ) ; ++ if ( xglExecuteIsEnabled("glEvalCoord1d") ) ++ glEvalCoord1d ( u ) ; ++} ++ ++void xglEvalCoord1dv ( GLdouble* u ) ++{ ++ if ( xglTraceIsEnabled("glEvalCoord1dv") ) ++ fprintf ( xglTraceFd, " glEvalCoord1dv ( xglBuild1dv((GLdouble)%f) ) ;\n" , u[0] ) ; ++ if ( xglExecuteIsEnabled("glEvalCoord1dv") ) ++ glEvalCoord1dv ( u ) ; ++} ++ ++void xglEvalCoord1f ( GLfloat u ) ++{ ++ if ( xglTraceIsEnabled("glEvalCoord1f") ) ++ fprintf ( xglTraceFd, " glEvalCoord1f ( (GLfloat)%ff ) ;\n" , u ) ; ++ if ( xglExecuteIsEnabled("glEvalCoord1f") ) ++ glEvalCoord1f ( u ) ; ++} ++ ++void xglEvalCoord1fv ( GLfloat* u ) ++{ ++ if ( xglTraceIsEnabled("glEvalCoord1fv") ) ++ fprintf ( xglTraceFd, " glEvalCoord1fv ( xglBuild1fv((GLfloat)%ff) ) ;\n" , u[0] ) ; ++ if ( xglExecuteIsEnabled("glEvalCoord1fv") ) ++ glEvalCoord1fv ( u ) ; ++} ++ ++void xglEvalCoord2d ( GLdouble u, GLdouble v ) ++{ ++ if ( xglTraceIsEnabled("glEvalCoord2d") ) ++ fprintf ( xglTraceFd, " glEvalCoord2d ( (GLdouble)%f, (GLdouble)%f ) ;\n" , u, v ) ; ++ if ( xglExecuteIsEnabled("glEvalCoord2d") ) ++ glEvalCoord2d ( u, v ) ; ++} ++ ++void xglEvalCoord2dv ( GLdouble* u ) ++{ ++ if ( xglTraceIsEnabled("glEvalCoord2dv") ) ++ fprintf ( xglTraceFd, " glEvalCoord2dv ( xglBuild2dv((GLdouble)%f,(GLdouble)%f) ) ;\n" , u[0], u[1] ) ; ++ if ( xglExecuteIsEnabled("glEvalCoord2dv") ) ++ glEvalCoord2dv ( u ) ; ++} ++ ++void xglEvalCoord2f ( GLfloat u, GLfloat v ) ++{ ++ if ( xglTraceIsEnabled("glEvalCoord2f") ) ++ fprintf ( xglTraceFd, " glEvalCoord2f ( (GLfloat)%ff, (GLfloat)%ff ) ;\n" , u, v ) ; ++ if ( xglExecuteIsEnabled("glEvalCoord2f") ) ++ glEvalCoord2f ( u, v ) ; ++} ++ ++void xglEvalCoord2fv ( GLfloat* u ) ++{ ++ if ( xglTraceIsEnabled("glEvalCoord2fv") ) ++ fprintf ( xglTraceFd, " glEvalCoord2fv ( xglBuild2fv((GLfloat)%ff,(GLfloat)%ff) ) ;\n" , u[0], u[1] ) ; ++ if ( xglExecuteIsEnabled("glEvalCoord2fv") ) ++ glEvalCoord2fv ( u ) ; ++} ++ ++void xglEvalMesh1 ( GLenum mode, GLint i1, GLint i2 ) ++{ ++ if ( xglTraceIsEnabled("glEvalMesh1") ) ++ fprintf ( xglTraceFd, " glEvalMesh1 ( (GLenum)%s, (GLint)%d, (GLint)%d ) ;\n" , xglExpandGLenum ( (GLenum) mode ), i1, i2 ) ; ++ if ( xglExecuteIsEnabled("glEvalMesh1") ) ++ glEvalMesh1 ( mode, i1, i2 ) ; ++} ++ ++void xglEvalMesh2 ( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) ++{ ++ if ( xglTraceIsEnabled("glEvalMesh2") ) ++ fprintf ( xglTraceFd, " glEvalMesh2 ( (GLenum)%s, (GLint)%d, (GLint)%d, (GLint)%d, (GLint)%d ) ;\n" , xglExpandGLenum ( (GLenum) mode ), i1, i2, j1, j2 ) ; ++ if ( xglExecuteIsEnabled("glEvalMesh2") ) ++ glEvalMesh2 ( mode, i1, i2, j1, j2 ) ; ++} ++ ++void xglEvalPoint1 ( GLint i ) ++{ ++ if ( xglTraceIsEnabled("glEvalPoint1") ) ++ fprintf ( xglTraceFd, " glEvalPoint1 ( (GLint)%d ) ;\n" , i ) ; ++ if ( xglExecuteIsEnabled("glEvalPoint1") ) ++ glEvalPoint1 ( i ) ; ++} ++ ++void xglEvalPoint2 ( GLint i, GLint j ) ++{ ++ if ( xglTraceIsEnabled("glEvalPoint2") ) ++ fprintf ( xglTraceFd, " glEvalPoint2 ( (GLint)%d, (GLint)%d ) ;\n" , i, j ) ; ++ if ( xglExecuteIsEnabled("glEvalPoint2") ) ++ glEvalPoint2 ( i, j ) ; ++} ++ ++void xglFeedbackBuffer ( GLsizei size, GLenum type, GLfloat* buffer ) ++{ ++ if ( xglTraceIsEnabled("glFeedbackBuffer") ) ++ fprintf ( xglTraceFd, " glFeedbackBuffer ( (GLsizei)%d, (GLenum)%s, (GLfloat *)0x%08x ) ;\n" , size, xglExpandGLenum ( (GLenum) type ), buffer ) ; ++ if ( xglExecuteIsEnabled("glFeedbackBuffer") ) ++ glFeedbackBuffer ( size, type, buffer ) ; ++} ++ ++void xglFinish ( ) ++{ ++ if ( xglTraceIsEnabled("glFinish") ) ++ fprintf ( xglTraceFd, " glFinish ( ) ;\n" ) ; ++ if ( xglExecuteIsEnabled("glFinish") ) ++ glFinish ( ) ; ++} ++ ++void xglFlush ( ) ++{ ++ if ( xglTraceIsEnabled("glFlush") ) ++ fprintf ( xglTraceFd, " glFlush ( ) ;\n" ) ; ++ if ( xglExecuteIsEnabled("glFlush") ) ++ glFlush ( ) ; ++} ++ ++void xglFogf ( GLenum pname, GLfloat param ) ++{ ++ if ( xglTraceIsEnabled("glFogf") ) ++ fprintf ( xglTraceFd, " glFogf ( (GLenum)%s, (GLfloat)%ff ) ;\n" , xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glFogf") ) ++ glFogf ( pname, param ) ; ++} ++ ++void xglFogfv ( GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glFogfv") ) ++ fprintf ( xglTraceFd, " glFogfv ( (GLenum)%s, (GLfloat *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glFogfv") ) ++ glFogfv ( pname, params ) ; ++} ++ ++void xglFogi ( GLenum pname, GLint param ) ++{ ++ if ( xglTraceIsEnabled("glFogi") ) ++ fprintf ( xglTraceFd, " glFogi ( (GLenum)%s, (GLint)%d ) ;\n" , xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glFogi") ) ++ glFogi ( pname, param ) ; ++} ++ ++void xglFogiv ( GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glFogiv") ) ++ fprintf ( xglTraceFd, " glFogiv ( (GLenum)%s, (GLint *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glFogiv") ) ++ glFogiv ( pname, params ) ; ++} ++ ++void xglFrontFace ( GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glFrontFace") ) ++ fprintf ( xglTraceFd, " glFrontFace ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) mode ) ) ; ++ if ( xglExecuteIsEnabled("glFrontFace") ) ++ glFrontFace ( mode ) ; ++} ++ ++void xglFrustum ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ) ++{ ++ if ( xglTraceIsEnabled("glFrustum") ) ++ fprintf ( xglTraceFd, " glFrustum ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , left, right, bottom, top, near_val, far_val ) ; ++ if ( xglExecuteIsEnabled("glFrustum") ) ++ glFrustum ( left, right, bottom, top, near_val, far_val ) ; ++} ++ ++void xglGetBooleanv ( GLenum pname, GLboolean* params ) ++{ ++ if ( xglTraceIsEnabled("glGetBooleanv") ) ++ fprintf ( xglTraceFd, " /* glGetBooleanv ( (GLenum)%s, (GLboolean *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetBooleanv") ) ++ glGetBooleanv ( pname, params ) ; ++} ++ ++void xglGetClipPlane ( GLenum plane, GLdouble* equation ) ++{ ++ if ( xglTraceIsEnabled("glGetClipPlane") ) ++ fprintf ( xglTraceFd, " /* glGetClipPlane ( (GLenum)%s, (GLdouble *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) plane ), equation ) ; ++ if ( xglExecuteIsEnabled("glGetClipPlane") ) ++ glGetClipPlane ( plane, equation ) ; ++} ++ ++void xglGetDoublev ( GLenum pname, GLdouble* params ) ++{ ++ if ( xglTraceIsEnabled("glGetDoublev") ) ++ fprintf ( xglTraceFd, " /* glGetDoublev ( (GLenum)%s, (GLdouble *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetDoublev") ) ++ glGetDoublev ( pname, params ) ; ++} ++ ++void xglGetFloatv ( GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glGetFloatv") ) ++ fprintf ( xglTraceFd, " /* glGetFloatv ( (GLenum)%s, (GLfloat *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetFloatv") ) ++ glGetFloatv ( pname, params ) ; ++} ++ ++void xglGetIntegerv ( GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glGetIntegerv") ) ++ fprintf ( xglTraceFd, " /* glGetIntegerv ( (GLenum)%s, (GLint *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetIntegerv") ) ++ glGetIntegerv ( pname, params ) ; ++} ++ ++void xglGetLightfv ( GLenum light, GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glGetLightfv") ) ++ fprintf ( xglTraceFd, " /* glGetLightfv ( (GLenum)%s, (GLenum)%s, (GLfloat *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) light ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetLightfv") ) ++ glGetLightfv ( light, pname, params ) ; ++} ++ ++void xglGetLightiv ( GLenum light, GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glGetLightiv") ) ++ fprintf ( xglTraceFd, " /* glGetLightiv ( (GLenum)%s, (GLenum)%s, (GLint *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) light ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetLightiv") ) ++ glGetLightiv ( light, pname, params ) ; ++} ++ ++void xglGetMapdv ( GLenum target, GLenum query, GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glGetMapdv") ) ++ fprintf ( xglTraceFd, " /* glGetMapdv ( (GLenum)%s, (GLenum)%s, (GLdouble *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) query ), v ) ; ++ if ( xglExecuteIsEnabled("glGetMapdv") ) ++ glGetMapdv ( target, query, v ) ; ++} ++ ++void xglGetMapfv ( GLenum target, GLenum query, GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glGetMapfv") ) ++ fprintf ( xglTraceFd, " /* glGetMapfv ( (GLenum)%s, (GLenum)%s, (GLfloat *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) query ), v ) ; ++ if ( xglExecuteIsEnabled("glGetMapfv") ) ++ glGetMapfv ( target, query, v ) ; ++} ++ ++void xglGetMapiv ( GLenum target, GLenum query, GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glGetMapiv") ) ++ fprintf ( xglTraceFd, " /* glGetMapiv ( (GLenum)%s, (GLenum)%s, (GLint *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) query ), v ) ; ++ if ( xglExecuteIsEnabled("glGetMapiv") ) ++ glGetMapiv ( target, query, v ) ; ++} ++ ++void xglGetMaterialfv ( GLenum face, GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glGetMaterialfv") ) ++ fprintf ( xglTraceFd, " /* glGetMaterialfv ( (GLenum)%s, (GLenum)%s, (GLfloat *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) face ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetMaterialfv") ) ++ glGetMaterialfv ( face, pname, params ) ; ++} ++ ++void xglGetMaterialiv ( GLenum face, GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glGetMaterialiv") ) ++ fprintf ( xglTraceFd, " /* glGetMaterialiv ( (GLenum)%s, (GLenum)%s, (GLint *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) face ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetMaterialiv") ) ++ glGetMaterialiv ( face, pname, params ) ; ++} ++ ++void xglGetPixelMapfv ( GLenum map, GLfloat* values ) ++{ ++ if ( xglTraceIsEnabled("glGetPixelMapfv") ) ++ fprintf ( xglTraceFd, " /* glGetPixelMapfv ( (GLenum)%s, (GLfloat *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) map ), values ) ; ++ if ( xglExecuteIsEnabled("glGetPixelMapfv") ) ++ glGetPixelMapfv ( map, values ) ; ++} ++ ++void xglGetPixelMapuiv ( GLenum map, GLuint* values ) ++{ ++ if ( xglTraceIsEnabled("glGetPixelMapuiv") ) ++ fprintf ( xglTraceFd, " /* glGetPixelMapuiv ( (GLenum)%s, (GLuint *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) map ), values ) ; ++ if ( xglExecuteIsEnabled("glGetPixelMapuiv") ) ++ glGetPixelMapuiv ( map, values ) ; ++} ++ ++void xglGetPixelMapusv ( GLenum map, GLushort* values ) ++{ ++ if ( xglTraceIsEnabled("glGetPixelMapusv") ) ++ fprintf ( xglTraceFd, " /* glGetPixelMapusv ( (GLenum)%s, (GLushort *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) map ), values ) ; ++ if ( xglExecuteIsEnabled("glGetPixelMapusv") ) ++ glGetPixelMapusv ( map, values ) ; ++} ++ ++void xglGetPointervEXT ( GLenum pname, void** params ) ++{ ++ if ( xglTraceIsEnabled("glGetPointervEXT") ) ++ fprintf ( xglTraceFd, " /* glGetPointervEXT ( (GLenum)%s, (void **)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) pname ), params ) ; ++#ifdef GL_VERSION_1_1 ++ glGetPointerv ( pname, params ) ; ++#else ++#ifdef GL_EXT_vertex_array ++ if ( xglExecuteIsEnabled("glGetPointervEXT") ) ++ glGetPointervEXT ( pname, params ) ; ++#else ++ fprintf ( xglTraceFd, " glGetPointervEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++#endif ++} ++ ++void xglGetPolygonStipple ( GLubyte* mask ) ++{ ++ if ( xglTraceIsEnabled("glGetPolygonStipple") ) ++ fprintf ( xglTraceFd, " /* glGetPolygonStipple ( (GLubyte *)0x%08x ) ; */\n" , mask ) ; ++ if ( xglExecuteIsEnabled("glGetPolygonStipple") ) ++ glGetPolygonStipple ( mask ) ; ++} ++ ++void xglGetTexEnvfv ( GLenum target, GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glGetTexEnvfv") ) ++ fprintf ( xglTraceFd, " /* glGetTexEnvfv ( (GLenum)%s, (GLenum)%s, (GLfloat *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetTexEnvfv") ) ++ glGetTexEnvfv ( target, pname, params ) ; ++} ++ ++void xglGetTexEnviv ( GLenum target, GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glGetTexEnviv") ) ++ fprintf ( xglTraceFd, " /* glGetTexEnviv ( (GLenum)%s, (GLenum)%s, (GLint *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetTexEnviv") ) ++ glGetTexEnviv ( target, pname, params ) ; ++} ++ ++void xglGetTexGendv ( GLenum coord, GLenum pname, GLdouble* params ) ++{ ++ if ( xglTraceIsEnabled("glGetTexGendv") ) ++ fprintf ( xglTraceFd, " /* glGetTexGendv ( (GLenum)%s, (GLenum)%s, (GLdouble *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) coord ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetTexGendv") ) ++ glGetTexGendv ( coord, pname, params ) ; ++} ++ ++void xglGetTexGenfv ( GLenum coord, GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glGetTexGenfv") ) ++ fprintf ( xglTraceFd, " /* glGetTexGenfv ( (GLenum)%s, (GLenum)%s, (GLfloat *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) coord ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetTexGenfv") ) ++ glGetTexGenfv ( coord, pname, params ) ; ++} ++ ++void xglGetTexGeniv ( GLenum coord, GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glGetTexGeniv") ) ++ fprintf ( xglTraceFd, " /* glGetTexGeniv ( (GLenum)%s, (GLenum)%s, (GLint *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) coord ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetTexGeniv") ) ++ glGetTexGeniv ( coord, pname, params ) ; ++} ++ ++void xglGetTexImage ( GLenum target, GLint level, GLenum format, GLenum type, GLvoid* pixels ) ++{ ++ if ( xglTraceIsEnabled("glGetTexImage") ) ++ fprintf ( xglTraceFd, " /* glGetTexImage ( (GLenum)%s, (GLint)%d, (GLenum)%s, (GLenum)%s, (GLvoid *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) target ), level, xglExpandGLenum ( (GLenum) format ), xglExpandGLenum ( (GLenum) type ), pixels ) ; ++ if ( xglExecuteIsEnabled("glGetTexImage") ) ++ glGetTexImage ( target, level, format, type, pixels ) ; ++} ++ ++void xglGetTexLevelParameterfv ( GLenum target, GLint level, GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glGetTexLevelParameterfv") ) ++ fprintf ( xglTraceFd, " /* glGetTexLevelParameterfv ( (GLenum)%s, (GLint)%d, (GLenum)%s, (GLfloat *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) target ), level, xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetTexLevelParameterfv") ) ++ glGetTexLevelParameterfv ( target, level, pname, params ) ; ++} ++ ++void xglGetTexLevelParameteriv ( GLenum target, GLint level, GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glGetTexLevelParameteriv") ) ++ fprintf ( xglTraceFd, " /* glGetTexLevelParameteriv ( (GLenum)%s, (GLint)%d, (GLenum)%s, (GLint *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) target ), level, xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetTexLevelParameteriv") ) ++ glGetTexLevelParameteriv ( target, level, pname, params ) ; ++} ++ ++void xglGetTexParameterfv ( GLenum target, GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glGetTexParameterfv") ) ++ fprintf ( xglTraceFd, " /* glGetTexParameterfv ( (GLenum)%s, (GLenum)%s, (GLfloat *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetTexParameterfv") ) ++ glGetTexParameterfv ( target, pname, params ) ; ++} ++ ++void xglGetTexParameteriv ( GLenum target, GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glGetTexParameteriv") ) ++ fprintf ( xglTraceFd, " /* glGetTexParameteriv ( (GLenum)%s, (GLenum)%s, (GLint *)0x%08x ) ; */\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glGetTexParameteriv") ) ++ glGetTexParameteriv ( target, pname, params ) ; ++} ++ ++void xglHint ( GLenum target, GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glHint") ) ++ fprintf ( xglTraceFd, " glHint ( (GLenum)%s, (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) mode ) ) ; ++ if ( xglExecuteIsEnabled("glHint") ) ++ glHint ( target, mode ) ; ++} ++ ++void xglIndexMask ( GLuint mask ) ++{ ++ if ( xglTraceIsEnabled("glIndexMask") ) ++ fprintf ( xglTraceFd, " glIndexMask ( (GLuint)%u ) ;\n" , mask ) ; ++ if ( xglExecuteIsEnabled("glIndexMask") ) ++ glIndexMask ( mask ) ; ++} ++ ++void xglIndexPointerEXT ( GLenum type, GLsizei stride, GLsizei count, void* ptr ) ++{ ++ if ( xglTraceIsEnabled("glIndexPointerEXT") ) ++ fprintf ( xglTraceFd, " glIndexPointerEXT ( (GLenum)%s, (GLsizei)%d, (GLsizei)%d, (void *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) type ), stride, count, ptr ) ; ++#ifdef GL_VERSION_1_1 ++ glIndexPointer ( type, stride, ptr ) ; ++#else ++#ifdef GL_EXT_vertex_array ++ if ( xglExecuteIsEnabled("glIndexPointerEXT") ) ++ glIndexPointerEXT ( type, stride, count, ptr ) ; ++#else ++ fprintf ( xglTraceFd, " glIndexPointerEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++#endif ++} ++ ++void xglIndexd ( GLdouble c ) ++{ ++ if ( xglTraceIsEnabled("glIndexd") ) ++ fprintf ( xglTraceFd, " glIndexd ( (GLdouble)%f ) ;\n" , c ) ; ++ if ( xglExecuteIsEnabled("glIndexd") ) ++ glIndexd ( c ) ; ++} ++ ++void xglIndexdv ( GLdouble* c ) ++{ ++ if ( xglTraceIsEnabled("glIndexdv") ) ++ fprintf ( xglTraceFd, " glIndexdv ( (GLdouble *)0x%08x ) ;\n" , c ) ; ++ if ( xglExecuteIsEnabled("glIndexdv") ) ++ glIndexdv ( c ) ; ++} ++ ++void xglIndexf ( GLfloat c ) ++{ ++ if ( xglTraceIsEnabled("glIndexf") ) ++ fprintf ( xglTraceFd, " glIndexf ( (GLfloat)%ff ) ;\n" , c ) ; ++ if ( xglExecuteIsEnabled("glIndexf") ) ++ glIndexf ( c ) ; ++} ++ ++void xglIndexfv ( GLfloat* c ) ++{ ++ if ( xglTraceIsEnabled("glIndexfv") ) ++ fprintf ( xglTraceFd, " glIndexfv ( (GLfloat *)0x%08x ) ;\n" , c ) ; ++ if ( xglExecuteIsEnabled("glIndexfv") ) ++ glIndexfv ( c ) ; ++} ++ ++void xglIndexi ( GLint c ) ++{ ++ if ( xglTraceIsEnabled("glIndexi") ) ++ fprintf ( xglTraceFd, " glIndexi ( (GLint)%d ) ;\n" , c ) ; ++ if ( xglExecuteIsEnabled("glIndexi") ) ++ glIndexi ( c ) ; ++} ++ ++void xglIndexiv ( GLint* c ) ++{ ++ if ( xglTraceIsEnabled("glIndexiv") ) ++ fprintf ( xglTraceFd, " glIndexiv ( (GLint *)0x%08x ) ;\n" , c ) ; ++ if ( xglExecuteIsEnabled("glIndexiv") ) ++ glIndexiv ( c ) ; ++} ++ ++void xglIndexs ( GLshort c ) ++{ ++ if ( xglTraceIsEnabled("glIndexs") ) ++ fprintf ( xglTraceFd, " glIndexs ( (GLshort)%d ) ;\n" , c ) ; ++ if ( xglExecuteIsEnabled("glIndexs") ) ++ glIndexs ( c ) ; ++} ++ ++void xglIndexsv ( GLshort* c ) ++{ ++ if ( xglTraceIsEnabled("glIndexsv") ) ++ fprintf ( xglTraceFd, " glIndexsv ( (GLshort *)0x%08x ) ;\n" , c ) ; ++ if ( xglExecuteIsEnabled("glIndexsv") ) ++ glIndexsv ( c ) ; ++} ++ ++void xglInitNames ( ) ++{ ++ if ( xglTraceIsEnabled("glInitNames") ) ++ fprintf ( xglTraceFd, " glInitNames ( ) ;\n" ) ; ++ if ( xglExecuteIsEnabled("glInitNames") ) ++ glInitNames ( ) ; ++} ++ ++void xglLightModelf ( GLenum pname, GLfloat param ) ++{ ++ if ( xglTraceIsEnabled("glLightModelf") ) ++ fprintf ( xglTraceFd, " glLightModelf ( (GLenum)%s, (GLfloat)%ff ) ;\n" , xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glLightModelf") ) ++ glLightModelf ( pname, param ) ; ++} ++ ++void xglLightModelfv ( GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glLightModelfv") ) ++ fprintf ( xglTraceFd, " glLightModelfv ( (GLenum)%s, (GLfloat *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glLightModelfv") ) ++ glLightModelfv ( pname, params ) ; ++} ++ ++void xglLightModeli ( GLenum pname, GLint param ) ++{ ++ if ( xglTraceIsEnabled("glLightModeli") ) ++ fprintf ( xglTraceFd, " glLightModeli ( (GLenum)%s, (GLint)%d ) ;\n" , xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glLightModeli") ) ++ glLightModeli ( pname, param ) ; ++} ++ ++void xglLightModeliv ( GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glLightModeliv") ) ++ fprintf ( xglTraceFd, " glLightModeliv ( (GLenum)%s, (GLint *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glLightModeliv") ) ++ glLightModeliv ( pname, params ) ; ++} ++ ++void xglLightf ( GLenum light, GLenum pname, GLfloat param ) ++{ ++ if ( xglTraceIsEnabled("glLightf") ) ++ fprintf ( xglTraceFd, " glLightf ( (GLenum)%s, (GLenum)%s, (GLfloat)%ff ) ;\n" , xglExpandGLenum ( (GLenum) light ), xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glLightf") ) ++ glLightf ( light, pname, param ) ; ++} ++ ++void xglLightfv ( GLenum light, GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glLightfv") ) ++ fprintf ( xglTraceFd, " glLightfv ( (GLenum)%s, (GLenum)%s, xglBuild4fv((GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff) ) ;\n", ++ xglExpandGLenum ( (GLenum) light ), xglExpandGLenum ( (GLenum) pname ), params[0], params[1], params[2], params[3] ) ; ++ if ( xglExecuteIsEnabled("glLightfv") ) ++ glLightfv ( light, pname, params ) ; ++} ++ ++void xglLighti ( GLenum light, GLenum pname, GLint param ) ++{ ++ if ( xglTraceIsEnabled("glLighti") ) ++ fprintf ( xglTraceFd, " glLighti ( (GLenum)%s, (GLenum)%s, (GLint)%d ) ;\n" , xglExpandGLenum ( (GLenum) light ), xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glLighti") ) ++ glLighti ( light, pname, param ) ; ++} ++ ++void xglLightiv ( GLenum light, GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glLightiv") ) ++ fprintf ( xglTraceFd, " glLightiv ( (GLenum)%s, (GLenum)%s, (GLint *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) light ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glLightiv") ) ++ glLightiv ( light, pname, params ) ; ++} ++ ++void xglLineStipple ( GLint factor, GLushort pattern ) ++{ ++ if ( xglTraceIsEnabled("glLineStipple") ) ++ fprintf ( xglTraceFd, " glLineStipple ( (GLint)%d, (GLushort)%u ) ;\n" , factor, pattern ) ; ++ if ( xglExecuteIsEnabled("glLineStipple") ) ++ glLineStipple ( factor, pattern ) ; ++} ++ ++void xglLineWidth ( GLfloat width ) ++{ ++ if ( xglTraceIsEnabled("glLineWidth") ) ++ fprintf ( xglTraceFd, " glLineWidth ( (GLfloat)%ff ) ;\n" , width ) ; ++ if ( xglExecuteIsEnabled("glLineWidth") ) ++ glLineWidth ( width ) ; ++} ++ ++void xglListBase ( GLuint base ) ++{ ++ if ( xglTraceIsEnabled("glListBase") ) ++ fprintf ( xglTraceFd, " glListBase ( (GLuint)%u ) ;\n" , base ) ; ++ if ( xglExecuteIsEnabled("glListBase") ) ++ glListBase ( base ) ; ++} ++ ++void xglLoadIdentity ( ) ++{ ++ if ( xglTraceIsEnabled("glLoadIdentity") ) ++ fprintf ( xglTraceFd, " glLoadIdentity ( ) ;\n" ) ; ++ if ( xglExecuteIsEnabled("glLoadIdentity") ) ++ glLoadIdentity ( ) ; ++} ++ ++void xglLoadMatrixd ( GLdouble* m ) ++{ ++ if ( xglTraceIsEnabled("glLoadMatrixd") ) ++ { ++ fprintf ( xglTraceFd, " glLoadMatrixd ( xglBuildMatrixd(%f,%f,%f,%f,\n" , m[ 0],m[ 1],m[ 2],m[ 3] ) ; ++ fprintf ( xglTraceFd, " %f,%f,%f,%f,\n" , m[ 4],m[ 5],m[ 6],m[ 7] ) ; ++ fprintf ( xglTraceFd, " %f,%f,%f,%f,\n" , m[ 8],m[ 9],m[10],m[11] ) ; ++ fprintf ( xglTraceFd, " %f,%f,%f,%f) ) ;\n", m[12],m[13],m[14],m[15] ) ; ++ } ++ ++ if ( xglExecuteIsEnabled("glLoadMatrixd") ) ++ glLoadMatrixd ( m ) ; ++} ++ ++void xglLoadMatrixf ( GLfloat* m ) ++{ ++ if ( xglTraceIsEnabled("glLoadMatrixf") ) ++ { ++ fprintf ( xglTraceFd, " glLoadMatrixf ( xglBuildMatrixf(%ff,%ff,%ff,%ff,\n" , m[ 0],m[ 1],m[ 2],m[ 3] ) ; ++ fprintf ( xglTraceFd, " %ff,%ff,%ff,%ff,\n" , m[ 4],m[ 5],m[ 6],m[ 7] ) ; ++ fprintf ( xglTraceFd, " %ff,%ff,%ff,%ff,\n" , m[ 8],m[ 9],m[10],m[11] ) ; ++ fprintf ( xglTraceFd, " %ff,%ff,%ff,%ff) ) ;\n", m[12],m[13],m[14],m[15] ) ; ++ } ++ ++ if ( xglExecuteIsEnabled("glLoadMatrixf") ) ++ glLoadMatrixf ( m ) ; ++} ++ ++void xglLoadName ( GLuint name ) ++{ ++ if ( xglTraceIsEnabled("glLoadName") ) ++ fprintf ( xglTraceFd, " glLoadName ( (GLuint)%u ) ;\n" , name ) ; ++ if ( xglExecuteIsEnabled("glLoadName") ) ++ glLoadName ( name ) ; ++} ++ ++void xglLogicOp ( GLenum opcode ) ++{ ++ if ( xglTraceIsEnabled("glLogicOp") ) ++ fprintf ( xglTraceFd, " glLogicOp ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) opcode ) ) ; ++ if ( xglExecuteIsEnabled("glLogicOp") ) ++ glLogicOp ( opcode ) ; ++} ++ ++void xglMap1d ( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, GLdouble* points ) ++{ ++ if ( xglTraceIsEnabled("glMap1d") ) ++ fprintf ( xglTraceFd, " glMap1d ( (GLenum)%s, (GLdouble)%f, (GLdouble)%f, (GLint)%d, (GLint)%d, (GLdouble *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) target ), u1, u2, stride, order, points ) ; ++ if ( xglExecuteIsEnabled("glMap1d") ) ++ glMap1d ( target, u1, u2, stride, order, points ) ; ++} ++ ++void xglMap1f ( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, GLfloat* points ) ++{ ++ if ( xglTraceIsEnabled("glMap1f") ) ++ fprintf ( xglTraceFd, " glMap1f ( (GLenum)%s, (GLfloat)%ff, (GLfloat)%ff, (GLint)%d, (GLint)%d, (GLfloat *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) target ), u1, u2, stride, order, points ) ; ++ if ( xglExecuteIsEnabled("glMap1f") ) ++ glMap1f ( target, u1, u2, stride, order, points ) ; ++} ++ ++void xglMap2d ( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble* points ) ++{ ++ if ( xglTraceIsEnabled("glMap2d") ) ++ fprintf ( xglTraceFd, " glMap2d ( (GLenum)%s, (GLdouble)%f, (GLdouble)%f, (GLint)%d, (GLint)%d, (GLdouble)%f, (GLdouble)%f, (GLint)%d, (GLint)%d, (GLdouble *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) target ), u1, u2, ustride, uorder, v1, v2, vstride, vorder, points ) ; ++ if ( xglExecuteIsEnabled("glMap2d") ) ++ glMap2d ( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points ) ; ++} ++ ++void xglMap2f ( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat* points ) ++{ ++ if ( xglTraceIsEnabled("glMap2f") ) ++ fprintf ( xglTraceFd, " glMap2f ( (GLenum)%s, (GLfloat)%ff, (GLfloat)%ff, (GLint)%d, (GLint)%d, (GLfloat)%ff, (GLfloat)%ff, (GLint)%d, (GLint)%d, (GLfloat *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) target ), u1, u2, ustride, uorder, v1, v2, vstride, vorder, points ) ; ++ if ( xglExecuteIsEnabled("glMap2f") ) ++ glMap2f ( target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points ) ; ++} ++ ++void xglMapGrid1d ( GLint un, GLdouble u1, GLdouble u2 ) ++{ ++ if ( xglTraceIsEnabled("glMapGrid1d") ) ++ fprintf ( xglTraceFd, " glMapGrid1d ( (GLint)%d, (GLdouble)%f, (GLdouble)%f ) ;\n" , un, u1, u2 ) ; ++ if ( xglExecuteIsEnabled("glMapGrid1d") ) ++ glMapGrid1d ( un, u1, u2 ) ; ++} ++ ++void xglMapGrid1f ( GLint un, GLfloat u1, GLfloat u2 ) ++{ ++ if ( xglTraceIsEnabled("glMapGrid1f") ) ++ fprintf ( xglTraceFd, " glMapGrid1f ( (GLint)%d, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , un, u1, u2 ) ; ++ if ( xglExecuteIsEnabled("glMapGrid1f") ) ++ glMapGrid1f ( un, u1, u2 ) ; ++} ++ ++void xglMapGrid2d ( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) ++{ ++ if ( xglTraceIsEnabled("glMapGrid2d") ) ++ fprintf ( xglTraceFd, " glMapGrid2d ( (GLint)%d, (GLdouble)%f, (GLdouble)%f, (GLint)%d, (GLdouble)%f, (GLdouble)%f ) ;\n" , un, u1, u2, vn, v1, v2 ) ; ++ if ( xglExecuteIsEnabled("glMapGrid2d") ) ++ glMapGrid2d ( un, u1, u2, vn, v1, v2 ) ; ++} ++ ++void xglMapGrid2f ( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) ++{ ++ if ( xglTraceIsEnabled("glMapGrid2f") ) ++ fprintf ( xglTraceFd, " glMapGrid2f ( (GLint)%d, (GLfloat)%ff, (GLfloat)%ff, (GLint)%d, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , un, u1, u2, vn, v1, v2 ) ; ++ if ( xglExecuteIsEnabled("glMapGrid2f") ) ++ glMapGrid2f ( un, u1, u2, vn, v1, v2 ) ; ++} ++ ++void xglMaterialf ( GLenum face, GLenum pname, GLfloat param ) ++{ ++ if ( xglTraceIsEnabled("glMaterialf") ) ++ fprintf ( xglTraceFd, " glMaterialf ( (GLenum)%s, (GLenum)%s, (GLfloat)%ff ) ;\n" , xglExpandGLenum ( (GLenum) face ), xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glMaterialf") ) ++ glMaterialf ( face, pname, param ) ; ++} ++ ++void xglMaterialfv ( GLenum face, GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glMaterialfv") ) ++ fprintf ( xglTraceFd, " glMaterialfv ( (GLenum)%s, (GLenum)%s, (GLfloat *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) face ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glMaterialfv") ) ++ glMaterialfv ( face, pname, params ) ; ++} ++ ++void xglMateriali ( GLenum face, GLenum pname, GLint param ) ++{ ++ if ( xglTraceIsEnabled("glMateriali") ) ++ fprintf ( xglTraceFd, " glMateriali ( (GLenum)%s, (GLenum)%s, (GLint)%d ) ;\n" , xglExpandGLenum ( (GLenum) face ), xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glMateriali") ) ++ glMateriali ( face, pname, param ) ; ++} ++ ++void xglMaterialiv ( GLenum face, GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glMaterialiv") ) ++ fprintf ( xglTraceFd, " glMaterialiv ( (GLenum)%s, (GLenum)%s, (GLint *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) face ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glMaterialiv") ) ++ glMaterialiv ( face, pname, params ) ; ++} ++ ++void xglMatrixMode ( GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glMatrixMode") ) ++ fprintf ( xglTraceFd, " glMatrixMode ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) mode ) ) ; ++ if ( xglExecuteIsEnabled("glMatrixMode") ) ++ glMatrixMode ( mode ) ; ++} ++ ++ ++void xglMultMatrixd ( GLdouble* m ) ++{ ++ if ( xglTraceIsEnabled("glMultMatrixd") ) ++ { ++ fprintf ( xglTraceFd, " glMultMatrixd ( xglBuildMatrixd(%f,%f,%f,%f,\n" , m[ 0],m[ 1],m[ 2],m[ 3] ) ; ++ fprintf ( xglTraceFd, " %f,%f,%f,%f,\n" , m[ 4],m[ 5],m[ 6],m[ 7] ) ; ++ fprintf ( xglTraceFd, " %f,%f,%f,%f,\n" , m[ 8],m[ 9],m[10],m[11] ) ; ++ fprintf ( xglTraceFd, " %f,%f,%f,%f) ) ;\n", m[12],m[13],m[14],m[15] ) ; ++ } ++ ++ if ( xglExecuteIsEnabled("glMultMatrixd") ) ++ glMultMatrixd ( m ) ; ++} ++ ++void xglMultMatrixf ( GLfloat* m ) ++{ ++ if ( xglTraceIsEnabled("glMultMatrixf") ) ++ { ++ fprintf ( xglTraceFd, " glMultMatrixf ( xglBuildMatrixf(%ff,%ff,%ff,%ff,\n" , m[ 0],m[ 1],m[ 2],m[ 3] ) ; ++ fprintf ( xglTraceFd, " %ff,%ff,%ff,%ff,\n" , m[ 4],m[ 5],m[ 6],m[ 7] ) ; ++ fprintf ( xglTraceFd, " %ff,%ff,%ff,%ff,\n" , m[ 8],m[ 9],m[10],m[11] ) ; ++ fprintf ( xglTraceFd, " %ff,%ff,%ff,%ff) ) ;\n", m[12],m[13],m[14],m[15] ) ; ++ } ++ ++ if ( xglExecuteIsEnabled("glMultMatrixf") ) ++ glMultMatrixf ( m ) ; ++} ++ ++void xglNewList ( GLuint list, GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glNewList") ) ++ fprintf ( xglTraceFd, " glNewList ( (GLuint)%u, (GLenum)%s ) ;\n" , list, xglExpandGLenum ( (GLenum) mode ) ) ; ++ if ( xglExecuteIsEnabled("glNewList") ) ++ glNewList ( list, mode ) ; ++} ++ ++void xglNormal3b ( GLbyte nx, GLbyte ny, GLbyte nz ) ++{ ++ if ( xglTraceIsEnabled("glNormal3b") ) ++ fprintf ( xglTraceFd, " glNormal3b ( (GLbyte)%d, (GLbyte)%d, (GLbyte)%d ) ;\n" , nx, ny, nz ) ; ++ if ( xglExecuteIsEnabled("glNormal3b") ) ++ glNormal3b ( nx, ny, nz ) ; ++} ++ ++void xglNormal3bv ( GLbyte* v ) ++{ ++ if ( xglTraceIsEnabled("glNormal3bv") ) ++ fprintf ( xglTraceFd, " glNormal3bv ( xglBuild3bv((GLbyte)%d,(GLbyte)%d,(GLbyte)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glNormal3bv") ) ++ glNormal3bv ( v ) ; ++} ++ ++void xglNormal3d ( GLdouble nx, GLdouble ny, GLdouble nz ) ++{ ++ if ( xglTraceIsEnabled("glNormal3d") ) ++ fprintf ( xglTraceFd, " glNormal3d ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , nx, ny, nz ) ; ++ if ( xglExecuteIsEnabled("glNormal3d") ) ++ glNormal3d ( nx, ny, nz ) ; ++} ++ ++void xglNormal3dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glNormal3dv") ) ++ fprintf ( xglTraceFd, " glNormal3dv ( xglBuild3dv((GLdouble)%f,(GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glNormal3dv") ) ++ glNormal3dv ( v ) ; ++} ++ ++void xglNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) ++{ ++ if ( xglTraceIsEnabled("glNormal3f") ) ++ fprintf ( xglTraceFd, " glNormal3f ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , nx, ny, nz ) ; ++ if ( xglExecuteIsEnabled("glNormal3f") ) ++ glNormal3f ( nx, ny, nz ) ; ++} ++ ++void xglNormal3fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glNormal3fv") ) ++ fprintf ( xglTraceFd, " glNormal3fv ( xglBuild3fv((GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glNormal3fv") ) ++ glNormal3fv ( v ) ; ++} ++ ++void xglNormal3i ( GLint nx, GLint ny, GLint nz ) ++{ ++ if ( xglTraceIsEnabled("glNormal3i") ) ++ fprintf ( xglTraceFd, " glNormal3i ( (GLint)%d, (GLint)%d, (GLint)%d ) ;\n" , nx, ny, nz ) ; ++ if ( xglExecuteIsEnabled("glNormal3i") ) ++ glNormal3i ( nx, ny, nz ) ; ++} ++ ++void xglNormal3iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glNormal3iv") ) ++ fprintf ( xglTraceFd, " glNormal3iv ( xglBuild3iv((GLint)%d,(GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glNormal3iv") ) ++ glNormal3iv ( v ) ; ++} ++ ++void xglNormal3s ( GLshort nx, GLshort ny, GLshort nz ) ++{ ++ if ( xglTraceIsEnabled("glNormal3s") ) ++ fprintf ( xglTraceFd, " glNormal3s ( (GLshort)%d, (GLshort)%d, (GLshort)%d ) ;\n" , nx, ny, nz ) ; ++ if ( xglExecuteIsEnabled("glNormal3s") ) ++ glNormal3s ( nx, ny, nz ) ; ++} ++ ++void xglNormal3sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glNormal3sv") ) ++ fprintf ( xglTraceFd, " glNormal3sv ( xglBuild3sv((GLshort)%d,(GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glNormal3sv") ) ++ glNormal3sv ( v ) ; ++} ++ ++void xglNormalPointerEXT ( GLenum type, GLsizei stride, GLsizei count, void* ptr ) ++{ ++ if ( xglTraceIsEnabled("glNormalPointerEXT") ) ++ fprintf ( xglTraceFd, " glNormalPointerEXT ( (GLenum)%s, (GLsizei)%d, (GLsizei)%d, (void *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) type ), stride, count, ptr ) ; ++#ifdef GL_VERSION_1_1 ++ glNormalPointer ( type, stride, ptr ) ; ++#else ++#ifdef GL_EXT_vertex_array ++ if ( xglExecuteIsEnabled("glNormalPointerEXT") ) ++ glNormalPointerEXT ( type, stride, count, ptr ) ; ++#else ++ fprintf ( xglTraceFd, " glNormalPointerEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++#endif ++} ++ ++void xglOrtho ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ) ++{ ++ if ( xglTraceIsEnabled("glOrtho") ) ++ fprintf ( xglTraceFd, " glOrtho ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , left, right, bottom, top, near_val, far_val ) ; ++ if ( xglExecuteIsEnabled("glOrtho") ) ++ glOrtho ( left, right, bottom, top, near_val, far_val ) ; ++} ++ ++void xglPassThrough ( GLfloat token ) ++{ ++ if ( xglTraceIsEnabled("glPassThrough") ) ++ fprintf ( xglTraceFd, " glPassThrough ( (GLfloat)%ff ) ;\n" , token ) ; ++ if ( xglExecuteIsEnabled("glPassThrough") ) ++ glPassThrough ( token ) ; ++} ++ ++void xglPixelMapfv ( GLenum map, GLint mapsize, GLfloat* values ) ++{ ++ if ( xglTraceIsEnabled("glPixelMapfv") ) ++ fprintf ( xglTraceFd, " glPixelMapfv ( (GLenum)%s, (GLint)%d, (GLfloat *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) map ), mapsize, values ) ; ++ if ( xglExecuteIsEnabled("glPixelMapfv") ) ++ glPixelMapfv ( map, mapsize, values ) ; ++} ++ ++void xglPixelMapuiv ( GLenum map, GLint mapsize, GLuint* values ) ++{ ++ if ( xglTraceIsEnabled("glPixelMapuiv") ) ++ fprintf ( xglTraceFd, " glPixelMapuiv ( (GLenum)%s, (GLint)%d, (GLuint *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) map ), mapsize, values ) ; ++ if ( xglExecuteIsEnabled("glPixelMapuiv") ) ++ glPixelMapuiv ( map, mapsize, values ) ; ++} ++ ++void xglPixelMapusv ( GLenum map, GLint mapsize, GLushort* values ) ++{ ++ if ( xglTraceIsEnabled("glPixelMapusv") ) ++ fprintf ( xglTraceFd, " glPixelMapusv ( (GLenum)%s, (GLint)%d, (GLushort *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) map ), mapsize, values ) ; ++ if ( xglExecuteIsEnabled("glPixelMapusv") ) ++ glPixelMapusv ( map, mapsize, values ) ; ++} ++ ++void xglPixelStoref ( GLenum pname, GLfloat param ) ++{ ++ if ( xglTraceIsEnabled("glPixelStoref") ) ++ fprintf ( xglTraceFd, " glPixelStoref ( (GLenum)%s, (GLfloat)%ff ) ;\n" , xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glPixelStoref") ) ++ glPixelStoref ( pname, param ) ; ++} ++ ++void xglPixelStorei ( GLenum pname, GLint param ) ++{ ++ if ( xglTraceIsEnabled("glPixelStorei") ) ++ fprintf ( xglTraceFd, " glPixelStorei ( (GLenum)%s, (GLint)%d ) ;\n" , xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glPixelStorei") ) ++ glPixelStorei ( pname, param ) ; ++} ++ ++void xglPixelTransferf ( GLenum pname, GLfloat param ) ++{ ++ if ( xglTraceIsEnabled("glPixelTransferf") ) ++ fprintf ( xglTraceFd, " glPixelTransferf ( (GLenum)%s, (GLfloat)%ff ) ;\n" , xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glPixelTransferf") ) ++ glPixelTransferf ( pname, param ) ; ++} ++ ++void xglPixelTransferi ( GLenum pname, GLint param ) ++{ ++ if ( xglTraceIsEnabled("glPixelTransferi") ) ++ fprintf ( xglTraceFd, " glPixelTransferi ( (GLenum)%s, (GLint)%d ) ;\n" , xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glPixelTransferi") ) ++ glPixelTransferi ( pname, param ) ; ++} ++ ++void xglPixelZoom ( GLfloat xfactor, GLfloat yfactor ) ++{ ++ if ( xglTraceIsEnabled("glPixelZoom") ) ++ fprintf ( xglTraceFd, " glPixelZoom ( (GLfloat)%ff, (GLfloat)%ff ) ;\n" , xfactor, yfactor ) ; ++ if ( xglExecuteIsEnabled("glPixelZoom") ) ++ glPixelZoom ( xfactor, yfactor ) ; ++} ++ ++void xglPointSize ( GLfloat size ) ++{ ++ if ( xglTraceIsEnabled("glPointSize") ) ++ fprintf ( xglTraceFd, " glPointSize ( (GLfloat)%ff ) ;\n" , size ) ; ++ if ( xglExecuteIsEnabled("glPointSize") ) ++ glPointSize ( size ) ; ++} ++ ++void xglPolygonMode ( GLenum face, GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glPolygonMode") ) ++ fprintf ( xglTraceFd, " glPolygonMode ( (GLenum)%s, (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) face ), xglExpandGLenum ( (GLenum) mode ) ) ; ++ if ( xglExecuteIsEnabled("glPolygonMode") ) ++ glPolygonMode ( face, mode ) ; ++} ++ ++void xglPolygonOffsetEXT ( GLfloat factor, GLfloat bias ) ++{ ++ if ( xglTraceIsEnabled("glPolygonOffsetEXT") ) ++ fprintf ( xglTraceFd, " glPolygonOffsetEXT ( (GLfloat)%ff, (GLfloat)%ff ) ;\n" , factor, bias ) ; ++ ++#ifdef GL_VERSION_1_1 ++ if ( xglExecuteIsEnabled("glPolygonOffsetEXT") ) ++ glPolygonOffset ( factor, bias ) ; ++#else ++#ifdef GL_EXT_polygon_offset ++ if ( xglExecuteIsEnabled("glPolygonOffsetEXT") ) ++ glPolygonOffsetEXT ( factor, bias ) ; ++#else ++ fprintf ( xglTraceFd, " glPolygonOffsetEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++#endif ++} ++ ++void xglPolygonOffset ( GLfloat factor, GLfloat bias ) ++{ ++ if ( xglTraceIsEnabled("glPolygonOffset") ) ++ fprintf ( xglTraceFd, " glPolygonOffset ( (GLfloat)%ff, (GLfloat)%ff ) ;\n" , factor, bias ) ; ++#ifdef GL_VERSION_1_1 ++ if ( xglExecuteIsEnabled("glPolygonOffset") ) ++ glPolygonOffset ( factor, bias ) ; ++#else ++#ifdef GL_EXT_polygon_offset ++ if ( xglExecuteIsEnabled("glPolygonOffset") ) ++ glPolygonOffsetEXT ( factor, bias ) ; ++#else ++ fprintf ( xglTraceFd, " glPolygonOffsetEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++#endif ++} ++ ++void xglPolygonStipple ( GLubyte* mask ) ++{ ++ if ( xglTraceIsEnabled("glPolygonStipple") ) ++ fprintf ( xglTraceFd, " glPolygonStipple ( (GLubyte *)0x%08x ) ;\n" , mask ) ; ++ if ( xglExecuteIsEnabled("glPolygonStipple") ) ++ glPolygonStipple ( mask ) ; ++} ++ ++void xglPopAttrib ( ) ++{ ++ if ( xglTraceIsEnabled("glPopAttrib") ) ++ fprintf ( xglTraceFd, " glPopAttrib ( ) ;\n" ) ; ++ if ( xglExecuteIsEnabled("glPopAttrib") ) ++ glPopAttrib ( ) ; ++} ++ ++void xglPopMatrix ( ) ++{ ++ if ( xglTraceIsEnabled("glPopMatrix") ) ++ fprintf ( xglTraceFd, " glPopMatrix ( ) ;\n" ) ; ++ if ( xglExecuteIsEnabled("glPopMatrix") ) ++ glPopMatrix ( ) ; ++} ++ ++void xglPopName ( ) ++{ ++ if ( xglTraceIsEnabled("glPopName") ) ++ fprintf ( xglTraceFd, " glPopName ( ) ;\n" ) ; ++ if ( xglExecuteIsEnabled("glPopName") ) ++ glPopName ( ) ; ++} ++ ++void xglPushAttrib ( GLbitfield mask ) ++{ ++ if ( xglTraceIsEnabled("glPushAttrib") ) ++ fprintf ( xglTraceFd, " glPushAttrib ( (GLbitfield)0x%08x ) ;\n" , mask ) ; ++ if ( xglExecuteIsEnabled("glPushAttrib") ) ++ glPushAttrib ( mask ) ; ++} ++ ++void xglPushMatrix ( ) ++{ ++ if ( xglTraceIsEnabled("glPushMatrix") ) ++ fprintf ( xglTraceFd, " glPushMatrix ( ) ;\n" ) ; ++ if ( xglExecuteIsEnabled("glPushMatrix") ) ++ glPushMatrix ( ) ; ++} ++ ++void xglPushName ( GLuint name ) ++{ ++ if ( xglTraceIsEnabled("glPushName") ) ++ fprintf ( xglTraceFd, " glPushName ( (GLuint)%u ) ;\n" , name ) ; ++ if ( xglExecuteIsEnabled("glPushName") ) ++ glPushName ( name ) ; ++} ++ ++void xglRasterPos2d ( GLdouble x, GLdouble y ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos2d") ) ++ fprintf ( xglTraceFd, " glRasterPos2d ( (GLdouble)%f, (GLdouble)%f ) ;\n" , x, y ) ; ++ if ( xglExecuteIsEnabled("glRasterPos2d") ) ++ glRasterPos2d ( x, y ) ; ++} ++ ++void xglRasterPos2dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos2dv") ) ++ fprintf ( xglTraceFd, " glRasterPos2dv ( xglBuild2dv((GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos2dv") ) ++ glRasterPos2dv ( v ) ; ++} ++ ++void xglRasterPos2f ( GLfloat x, GLfloat y ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos2f") ) ++ fprintf ( xglTraceFd, " glRasterPos2f ( (GLfloat)%ff, (GLfloat)%ff ) ;\n" , x, y ) ; ++ if ( xglExecuteIsEnabled("glRasterPos2f") ) ++ glRasterPos2f ( x, y ) ; ++} ++ ++void xglRasterPos2fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos2fv") ) ++ fprintf ( xglTraceFd, " glRasterPos2fv ( xglBuild2fv((GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos2fv") ) ++ glRasterPos2fv ( v ) ; ++} ++ ++void xglRasterPos2i ( GLint x, GLint y ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos2i") ) ++ fprintf ( xglTraceFd, " glRasterPos2i ( (GLint)%d, (GLint)%d ) ;\n" , x, y ) ; ++ if ( xglExecuteIsEnabled("glRasterPos2i") ) ++ glRasterPos2i ( x, y ) ; ++} ++ ++void xglRasterPos2iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos2iv") ) ++ fprintf ( xglTraceFd, " glRasterPos2iv ( xglBuild2iv((GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos2iv") ) ++ glRasterPos2iv ( v ) ; ++} ++ ++void xglRasterPos2s ( GLshort x, GLshort y ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos2s") ) ++ fprintf ( xglTraceFd, " glRasterPos2s ( (GLshort)%d, (GLshort)%d ) ;\n" , x, y ) ; ++ if ( xglExecuteIsEnabled("glRasterPos2s") ) ++ glRasterPos2s ( x, y ) ; ++} ++ ++void xglRasterPos2sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos2sv") ) ++ fprintf ( xglTraceFd, " glRasterPos2sv ( xglBuild2sv((GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos2sv") ) ++ glRasterPos2sv ( v ) ; ++} ++ ++void xglRasterPos3d ( GLdouble x, GLdouble y, GLdouble z ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos3d") ) ++ fprintf ( xglTraceFd, " glRasterPos3d ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glRasterPos3d") ) ++ glRasterPos3d ( x, y, z ) ; ++} ++ ++void xglRasterPos3dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos3dv") ) ++ fprintf ( xglTraceFd, " glRasterPos3dv ( xglBuild3dv((GLdouble)%f,(GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos3dv") ) ++ glRasterPos3dv ( v ) ; ++} ++ ++void xglRasterPos3f ( GLfloat x, GLfloat y, GLfloat z ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos3f") ) ++ fprintf ( xglTraceFd, " glRasterPos3f ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glRasterPos3f") ) ++ glRasterPos3f ( x, y, z ) ; ++} ++ ++void xglRasterPos3fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos3fv") ) ++ fprintf ( xglTraceFd, " glRasterPos3fv ( xglBuild3fv((GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos3fv") ) ++ glRasterPos3fv ( v ) ; ++} ++ ++void xglRasterPos3i ( GLint x, GLint y, GLint z ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos3i") ) ++ fprintf ( xglTraceFd, " glRasterPos3i ( (GLint)%d, (GLint)%d, (GLint)%d ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glRasterPos3i") ) ++ glRasterPos3i ( x, y, z ) ; ++} ++ ++void xglRasterPos3iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos3iv") ) ++ fprintf ( xglTraceFd, " glRasterPos3iv ( xglBuild3iv((GLint)%d,(GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos3iv") ) ++ glRasterPos3iv ( v ) ; ++} ++ ++void xglRasterPos3s ( GLshort x, GLshort y, GLshort z ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos3s") ) ++ fprintf ( xglTraceFd, " glRasterPos3s ( (GLshort)%d, (GLshort)%d, (GLshort)%d ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glRasterPos3s") ) ++ glRasterPos3s ( x, y, z ) ; ++} ++ ++void xglRasterPos3sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos3sv") ) ++ fprintf ( xglTraceFd, " glRasterPos3sv ( xglBuild3sv((GLshort)%d,(GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos3sv") ) ++ glRasterPos3sv ( v ) ; ++} ++ ++void xglRasterPos4d ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos4d") ) ++ fprintf ( xglTraceFd, " glRasterPos4d ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , x, y, z, w ) ; ++ if ( xglExecuteIsEnabled("glRasterPos4d") ) ++ glRasterPos4d ( x, y, z, w ) ; ++} ++ ++void xglRasterPos4dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos4dv") ) ++ fprintf ( xglTraceFd, " glRasterPos4dv ( xglBuild4dv((GLdouble)%f,(GLdouble)%f,(GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos4dv") ) ++ glRasterPos4dv ( v ) ; ++} ++ ++void xglRasterPos4f ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos4f") ) ++ fprintf ( xglTraceFd, " glRasterPos4f ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , x, y, z, w ) ; ++ if ( xglExecuteIsEnabled("glRasterPos4f") ) ++ glRasterPos4f ( x, y, z, w ) ; ++} ++ ++void xglRasterPos4fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos4fv") ) ++ fprintf ( xglTraceFd, " glRasterPos4fv ( xglBuild4fv((GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos4fv") ) ++ glRasterPos4fv ( v ) ; ++} ++ ++void xglRasterPos4i ( GLint x, GLint y, GLint z, GLint w ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos4i") ) ++ fprintf ( xglTraceFd, " glRasterPos4i ( (GLint)%d, (GLint)%d, (GLint)%d, (GLint)%d ) ;\n" , x, y, z, w ) ; ++ if ( xglExecuteIsEnabled("glRasterPos4i") ) ++ glRasterPos4i ( x, y, z, w ) ; ++} ++ ++void xglRasterPos4iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos4iv") ) ++ fprintf ( xglTraceFd, " glRasterPos4iv ( xglBuild4iv((GLint)%d,(GLint)%d,(GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos4iv") ) ++ glRasterPos4iv ( v ) ; ++} ++ ++void xglRasterPos4s ( GLshort x, GLshort y, GLshort z, GLshort w ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos4s") ) ++ fprintf ( xglTraceFd, " glRasterPos4s ( (GLshort)%d, (GLshort)%d, (GLshort)%d, (GLshort)%d ) ;\n" , x, y, z, w ) ; ++ if ( xglExecuteIsEnabled("glRasterPos4s") ) ++ glRasterPos4s ( x, y, z, w ) ; ++} ++ ++void xglRasterPos4sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glRasterPos4sv") ) ++ fprintf ( xglTraceFd, " glRasterPos4sv ( xglBuild4sv((GLshort)%d,(GLshort)%d,(GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glRasterPos4sv") ) ++ glRasterPos4sv ( v ) ; ++} ++ ++void xglReadBuffer ( GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glReadBuffer") ) ++ fprintf ( xglTraceFd, " glReadBuffer ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) mode ) ) ; ++ if ( xglExecuteIsEnabled("glReadBuffer") ) ++ glReadBuffer ( mode ) ; ++} ++ ++void xglReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels ) ++{ ++ if ( xglTraceIsEnabled("glReadPixels") ) ++ fprintf ( xglTraceFd, " glReadPixels ( (GLint)%d, (GLint)%d, (GLsizei)%d, (GLsizei)%d, (GLenum)%s, (GLenum)%s, (GLvoid *)0x%08x ) ;\n" , x, y, width, height, xglExpandGLenum ( (GLenum) format ), xglExpandGLenum ( (GLenum) type ), pixels ) ; ++ if ( xglExecuteIsEnabled("glReadPixels") ) ++ glReadPixels ( x, y, width, height, format, type, pixels ) ; ++} ++ ++void xglRectd ( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ) ++{ ++ if ( xglTraceIsEnabled("glRectd") ) ++ fprintf ( xglTraceFd, " glRectd ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , x1, y1, x2, y2 ) ; ++ if ( xglExecuteIsEnabled("glRectd") ) ++ glRectd ( x1, y1, x2, y2 ) ; ++} ++ ++void xglRectdv ( GLdouble* v1, GLdouble* v2 ) ++{ ++ if ( xglTraceIsEnabled("glRectdv") ) ++ fprintf ( xglTraceFd, " glRectdv ( (GLdouble *)0x%08x, (GLdouble *)0x%08x ) ;\n" , v1, v2 ) ; ++ if ( xglExecuteIsEnabled("glRectdv") ) ++ glRectdv ( v1, v2 ) ; ++} ++ ++void xglRectf ( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) ++{ ++ if ( xglTraceIsEnabled("glRectf") ) ++ fprintf ( xglTraceFd, " glRectf ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , x1, y1, x2, y2 ) ; ++ if ( xglExecuteIsEnabled("glRectf") ) ++ glRectf ( x1, y1, x2, y2 ) ; ++} ++ ++void xglRectfv ( GLfloat* v1, GLfloat* v2 ) ++{ ++ if ( xglTraceIsEnabled("glRectfv") ) ++ fprintf ( xglTraceFd, " glRectfv ( (GLfloat *)0x%08x, (GLfloat *)0x%08x ) ;\n" , v1, v2 ) ; ++ if ( xglExecuteIsEnabled("glRectfv") ) ++ glRectfv ( v1, v2 ) ; ++} ++ ++void xglRecti ( GLint x1, GLint y1, GLint x2, GLint y2 ) ++{ ++ if ( xglTraceIsEnabled("glRecti") ) ++ fprintf ( xglTraceFd, " glRecti ( (GLint)%d, (GLint)%d, (GLint)%d, (GLint)%d ) ;\n" , x1, y1, x2, y2 ) ; ++ if ( xglExecuteIsEnabled("glRecti") ) ++ glRecti ( x1, y1, x2, y2 ) ; ++} ++ ++void xglRectiv ( GLint* v1, GLint* v2 ) ++{ ++ if ( xglTraceIsEnabled("glRectiv") ) ++ fprintf ( xglTraceFd, " glRectiv ( (GLint *)0x%08x, (GLint *)0x%08x ) ;\n" , v1, v2 ) ; ++ if ( xglExecuteIsEnabled("glRectiv") ) ++ glRectiv ( v1, v2 ) ; ++} ++ ++void xglRects ( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ) ++{ ++ if ( xglTraceIsEnabled("glRects") ) ++ fprintf ( xglTraceFd, " glRects ( (GLshort)%d, (GLshort)%d, (GLshort)%d, (GLshort)%d ) ;\n" , x1, y1, x2, y2 ) ; ++ if ( xglExecuteIsEnabled("glRects") ) ++ glRects ( x1, y1, x2, y2 ) ; ++} ++ ++void xglRectsv ( GLshort* v1, GLshort* v2 ) ++{ ++ if ( xglTraceIsEnabled("glRectsv") ) ++ fprintf ( xglTraceFd, " glRectsv ( (GLshort *)0x%08x, (GLshort *)0x%08x ) ;\n" , v1, v2 ) ; ++ if ( xglExecuteIsEnabled("glRectsv") ) ++ glRectsv ( v1, v2 ) ; ++} ++ ++void xglRotated ( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) ++{ ++ if ( xglTraceIsEnabled("glRotated") ) ++ fprintf ( xglTraceFd, " glRotated ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , angle, x, y, z ) ; ++ if ( xglExecuteIsEnabled("glRotated") ) ++ glRotated ( angle, x, y, z ) ; ++} ++ ++void xglRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) ++{ ++ if ( xglTraceIsEnabled("glRotatef") ) ++ fprintf ( xglTraceFd, " glRotatef ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , angle, x, y, z ) ; ++ if ( xglExecuteIsEnabled("glRotatef") ) ++ glRotatef ( angle, x, y, z ) ; ++} ++ ++void xglScaled ( GLdouble x, GLdouble y, GLdouble z ) ++{ ++ if ( xglTraceIsEnabled("glScaled") ) ++ fprintf ( xglTraceFd, " glScaled ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glScaled") ) ++ glScaled ( x, y, z ) ; ++} ++ ++void xglScalef ( GLfloat x, GLfloat y, GLfloat z ) ++{ ++ if ( xglTraceIsEnabled("glScalef") ) ++ fprintf ( xglTraceFd, " glScalef ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glScalef") ) ++ glScalef ( x, y, z ) ; ++} ++ ++void xglScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) ++{ ++ if ( xglTraceIsEnabled("glScissor") ) ++ fprintf ( xglTraceFd, " glScissor ( (GLint)%d, (GLint)%d, (GLsizei)%d, (GLsizei)%d ) ;\n" , x, y, width, height ) ; ++ if ( xglExecuteIsEnabled("glScissor") ) ++ glScissor ( x, y, width, height ) ; ++} ++ ++void xglSelectBuffer ( GLsizei size, GLuint* buffer ) ++{ ++ if ( xglTraceIsEnabled("glSelectBuffer") ) ++ fprintf ( xglTraceFd, " glSelectBuffer ( (GLsizei)%d, (GLuint *)0x%08x ) ;\n" , size, buffer ) ; ++ if ( xglExecuteIsEnabled("glSelectBuffer") ) ++ glSelectBuffer ( size, buffer ) ; ++} ++ ++void xglShadeModel ( GLenum mode ) ++{ ++ if ( xglTraceIsEnabled("glShadeModel") ) ++ fprintf ( xglTraceFd, " glShadeModel ( (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) mode ) ) ; ++ if ( xglExecuteIsEnabled("glShadeModel") ) ++ glShadeModel ( mode ) ; ++} ++ ++void xglStencilFunc ( GLenum func, GLint ref, GLuint mask ) ++{ ++ if ( xglTraceIsEnabled("glStencilFunc") ) ++ fprintf ( xglTraceFd, " glStencilFunc ( (GLenum)%s, (GLint)%d, (GLuint)%u ) ;\n" , xglExpandGLenum ( (GLenum) func ), ref, mask ) ; ++ if ( xglExecuteIsEnabled("glStencilFunc") ) ++ glStencilFunc ( func, ref, mask ) ; ++} ++ ++void xglStencilMask ( GLuint mask ) ++{ ++ if ( xglTraceIsEnabled("glStencilMask") ) ++ fprintf ( xglTraceFd, " glStencilMask ( (GLuint)%u ) ;\n" , mask ) ; ++ if ( xglExecuteIsEnabled("glStencilMask") ) ++ glStencilMask ( mask ) ; ++} ++ ++void xglStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) ++{ ++ if ( xglTraceIsEnabled("glStencilOp") ) ++ fprintf ( xglTraceFd, " glStencilOp ( (GLenum)%s, (GLenum)%s, (GLenum)%s ) ;\n" , xglExpandGLenum ( (GLenum) fail ), xglExpandGLenum ( (GLenum) zfail ), xglExpandGLenum ( (GLenum) zpass ) ) ; ++ if ( xglExecuteIsEnabled("glStencilOp") ) ++ glStencilOp ( fail, zfail, zpass ) ; ++} ++ ++void xglTexCoord1d ( GLdouble s ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord1d") ) ++ fprintf ( xglTraceFd, " glTexCoord1d ( (GLdouble)%f ) ;\n" , s ) ; ++ if ( xglExecuteIsEnabled("glTexCoord1d") ) ++ glTexCoord1d ( s ) ; ++} ++ ++void xglTexCoord1dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord1dv") ) ++ fprintf ( xglTraceFd, " glTexCoord1dv ( xglBuild1dv((GLdouble)%f) ) ;\n" , v[0] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord1dv") ) ++ glTexCoord1dv ( v ) ; ++} ++ ++void xglTexCoord1f ( GLfloat s ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord1f") ) ++ fprintf ( xglTraceFd, " glTexCoord1f ( (GLfloat)%ff ) ;\n" , s ) ; ++ if ( xglExecuteIsEnabled("glTexCoord1f") ) ++ glTexCoord1f ( s ) ; ++} ++ ++void xglTexCoord1fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord1fv") ) ++ fprintf ( xglTraceFd, " glTexCoord1fv ( xglBuild1fv((GLfloat)%ff) ) ;\n" , v[0] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord1fv") ) ++ glTexCoord1fv ( v ) ; ++} ++ ++void xglTexCoord1i ( GLint s ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord1i") ) ++ fprintf ( xglTraceFd, " glTexCoord1i ( (GLint)%d ) ;\n" , s ) ; ++ if ( xglExecuteIsEnabled("glTexCoord1i") ) ++ glTexCoord1i ( s ) ; ++} ++ ++void xglTexCoord1iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord1iv") ) ++ fprintf ( xglTraceFd, " glTexCoord1iv ( xglBuild1iv((GLint)%d) ) ;\n" , v[0] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord1iv") ) ++ glTexCoord1iv ( v ) ; ++} ++ ++void xglTexCoord1s ( GLshort s ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord1s") ) ++ fprintf ( xglTraceFd, " glTexCoord1s ( (GLshort)%d ) ;\n" , s ) ; ++ if ( xglExecuteIsEnabled("glTexCoord1s") ) ++ glTexCoord1s ( s ) ; ++} ++ ++void xglTexCoord1sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord1sv") ) ++ fprintf ( xglTraceFd, " glTexCoord1sv ( xglBuild1sv((GLshort)%d) ) ;\n" , v[0] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord1sv") ) ++ glTexCoord1sv ( v ) ; ++} ++ ++void xglTexCoord2d ( GLdouble s, GLdouble t ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord2d") ) ++ fprintf ( xglTraceFd, " glTexCoord2d ( (GLdouble)%f, (GLdouble)%f ) ;\n" , s, t ) ; ++ if ( xglExecuteIsEnabled("glTexCoord2d") ) ++ glTexCoord2d ( s, t ) ; ++} ++ ++void xglTexCoord2dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord2dv") ) ++ fprintf ( xglTraceFd, " glTexCoord2dv ( xglBuild2dv((GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord2dv") ) ++ glTexCoord2dv ( v ) ; ++} ++ ++void xglTexCoord2f ( GLfloat s, GLfloat t ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord2f") ) ++ fprintf ( xglTraceFd, " glTexCoord2f ( (GLfloat)%ff, (GLfloat)%ff ) ;\n" , s, t ) ; ++ if ( xglExecuteIsEnabled("glTexCoord2f") ) ++ glTexCoord2f ( s, t ) ; ++} ++ ++void xglTexCoord2fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord2fv") ) ++ fprintf ( xglTraceFd, " glTexCoord2fv ( xglBuild2fv((GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord2fv") ) ++ glTexCoord2fv ( v ) ; ++} ++ ++void xglTexCoord2i ( GLint s, GLint t ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord2i") ) ++ fprintf ( xglTraceFd, " glTexCoord2i ( (GLint)%d, (GLint)%d ) ;\n" , s, t ) ; ++ if ( xglExecuteIsEnabled("glTexCoord2i") ) ++ glTexCoord2i ( s, t ) ; ++} ++ ++void xglTexCoord2iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord2iv") ) ++ fprintf ( xglTraceFd, " glTexCoord2iv ( xglBuild2iv((GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord2iv") ) ++ glTexCoord2iv ( v ) ; ++} ++ ++void xglTexCoord2s ( GLshort s, GLshort t ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord2s") ) ++ fprintf ( xglTraceFd, " glTexCoord2s ( (GLshort)%d, (GLshort)%d ) ;\n" , s, t ) ; ++ if ( xglExecuteIsEnabled("glTexCoord2s") ) ++ glTexCoord2s ( s, t ) ; ++} ++ ++void xglTexCoord2sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord2sv") ) ++ fprintf ( xglTraceFd, " glTexCoord2sv ( xglBuild2sv((GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord2sv") ) ++ glTexCoord2sv ( v ) ; ++} ++ ++void xglTexCoord3d ( GLdouble s, GLdouble t, GLdouble r ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord3d") ) ++ fprintf ( xglTraceFd, " glTexCoord3d ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , s, t, r ) ; ++ if ( xglExecuteIsEnabled("glTexCoord3d") ) ++ glTexCoord3d ( s, t, r ) ; ++} ++ ++void xglTexCoord3dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord3dv") ) ++ fprintf ( xglTraceFd, " glTexCoord3dv ( xglBuild3dv((GLdouble)%f,(GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord3dv") ) ++ glTexCoord3dv ( v ) ; ++} ++ ++void xglTexCoord3f ( GLfloat s, GLfloat t, GLfloat r ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord3f") ) ++ fprintf ( xglTraceFd, " glTexCoord3f ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , s, t, r ) ; ++ if ( xglExecuteIsEnabled("glTexCoord3f") ) ++ glTexCoord3f ( s, t, r ) ; ++} ++ ++void xglTexCoord3fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord3fv") ) ++ fprintf ( xglTraceFd, " glTexCoord3fv ( xglBuild3fv((GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord3fv") ) ++ glTexCoord3fv ( v ) ; ++} ++ ++void xglTexCoord3i ( GLint s, GLint t, GLint r ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord3i") ) ++ fprintf ( xglTraceFd, " glTexCoord3i ( (GLint)%d, (GLint)%d, (GLint)%d ) ;\n" , s, t, r ) ; ++ if ( xglExecuteIsEnabled("glTexCoord3i") ) ++ glTexCoord3i ( s, t, r ) ; ++} ++ ++void xglTexCoord3iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord3iv") ) ++ fprintf ( xglTraceFd, " glTexCoord3iv ( xglBuild3iv((GLint)%d,(GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord3iv") ) ++ glTexCoord3iv ( v ) ; ++} ++ ++void xglTexCoord3s ( GLshort s, GLshort t, GLshort r ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord3s") ) ++ fprintf ( xglTraceFd, " glTexCoord3s ( (GLshort)%d, (GLshort)%d, (GLshort)%d ) ;\n" , s, t, r ) ; ++ if ( xglExecuteIsEnabled("glTexCoord3s") ) ++ glTexCoord3s ( s, t, r ) ; ++} ++ ++void xglTexCoord3sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord3sv") ) ++ fprintf ( xglTraceFd, " glTexCoord3sv ( xglBuild3sv((GLshort)%d,(GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord3sv") ) ++ glTexCoord3sv ( v ) ; ++} ++ ++void xglTexCoord4d ( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord4d") ) ++ fprintf ( xglTraceFd, " glTexCoord4d ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , s, t, r, q ) ; ++ if ( xglExecuteIsEnabled("glTexCoord4d") ) ++ glTexCoord4d ( s, t, r, q ) ; ++} ++ ++void xglTexCoord4dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord4dv") ) ++ fprintf ( xglTraceFd, " glTexCoord4dv ( xglBuild4dv((GLdouble)%f,(GLdouble)%f,(GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord4dv") ) ++ glTexCoord4dv ( v ) ; ++} ++ ++void xglTexCoord4f ( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord4f") ) ++ fprintf ( xglTraceFd, " glTexCoord4f ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , s, t, r, q ) ; ++ if ( xglExecuteIsEnabled("glTexCoord4f") ) ++ glTexCoord4f ( s, t, r, q ) ; ++} ++ ++void xglTexCoord4fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord4fv") ) ++ fprintf ( xglTraceFd, " glTexCoord4fv ( xglBuild4fv((GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord4fv") ) ++ glTexCoord4fv ( v ) ; ++} ++ ++void xglTexCoord4i ( GLint s, GLint t, GLint r, GLint q ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord4i") ) ++ fprintf ( xglTraceFd, " glTexCoord4i ( (GLint)%d, (GLint)%d, (GLint)%d, (GLint)%d ) ;\n" , s, t, r, q ) ; ++ if ( xglExecuteIsEnabled("glTexCoord4i") ) ++ glTexCoord4i ( s, t, r, q ) ; ++} ++ ++void xglTexCoord4iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord4iv") ) ++ fprintf ( xglTraceFd, " glTexCoord4iv ( xglBuild4iv((GLint)%d,(GLint)%d,(GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord4iv") ) ++ glTexCoord4iv ( v ) ; ++} ++ ++void xglTexCoord4s ( GLshort s, GLshort t, GLshort r, GLshort q ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord4s") ) ++ fprintf ( xglTraceFd, " glTexCoord4s ( (GLshort)%d, (GLshort)%d, (GLshort)%d, (GLshort)%d ) ;\n" , s, t, r, q ) ; ++ if ( xglExecuteIsEnabled("glTexCoord4s") ) ++ glTexCoord4s ( s, t, r, q ) ; ++} ++ ++void xglTexCoord4sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glTexCoord4sv") ) ++ fprintf ( xglTraceFd, " glTexCoord4sv ( xglBuild4sv((GLshort)%d,(GLshort)%d,(GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glTexCoord4sv") ) ++ glTexCoord4sv ( v ) ; ++} ++ ++void xglTexCoordPointerEXT ( GLint size, GLenum type, GLsizei stride, GLsizei count, void* ptr ) ++{ ++ if ( xglTraceIsEnabled("glTexCoordPointerEXT") ) ++ fprintf ( xglTraceFd, " glTexCoordPointerEXT ( (GLint)%d, (GLenum)%s, (GLsizei)%d, (GLsizei)%d, (void *)0x%08x ) ;\n" , size, xglExpandGLenum ( (GLenum) type ), stride, count, ptr ) ; ++#ifdef GL_VERSION_1_1 ++ glTexCoordPointer ( size, type, stride, ptr ) ; ++#else ++#ifdef GL_EXT_vertex_array ++ if ( xglExecuteIsEnabled("glTexCoordPointerEXT") ) ++ glTexCoordPointerEXT ( size, type, stride, count, ptr ) ; ++#else ++ fprintf ( xglTraceFd, " glTexCoordPointerEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++#endif ++} ++ ++void xglTexEnvf ( GLenum target, GLenum pname, GLfloat param ) ++{ ++ if ( xglTraceIsEnabled("glTexEnvf") ) ++ fprintf ( xglTraceFd, " glTexEnvf ( (GLenum)%s, (GLenum)%s, (GLfloat)%ff ) ;\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glTexEnvf") ) ++ glTexEnvf ( target, pname, param ) ; ++} ++ ++void xglTexEnvfv ( GLenum target, GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glTexEnvfv") ) ++ fprintf ( xglTraceFd, " glTexEnvfv ( (GLenum)%s, (GLenum)%s, xglBuild4fv(%ff,%ff,%ff,%ff) ) ;\n", ++ xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) pname ), params[0], params[1], params[2], params[3] ) ; ++ if ( xglExecuteIsEnabled("glTexEnvfv") ) ++ glTexEnvfv ( target, pname, params ) ; ++} ++ ++void xglTexEnvi ( GLenum target, GLenum pname, GLint param ) ++{ ++ if ( xglTraceIsEnabled("glTexEnvi") ) ++ fprintf ( xglTraceFd, " glTexEnvi ( (GLenum)%s, (GLenum)%s, (GLint)%s ) ;\n", ++ xglExpandGLenum ( (GLenum) target ), ++ xglExpandGLenum ( (GLenum) pname ), ++ xglExpandGLenum ( (GLenum) param ) ) ; ++ ++ if ( xglExecuteIsEnabled("glTexEnvi") ) ++ glTexEnvi ( target, pname, param ) ; ++} ++ ++void xglTexEnviv ( GLenum target, GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glTexEnviv") ) ++ fprintf ( xglTraceFd, " glTexEnviv ( (GLenum)%s, (GLenum)%s, (GLint *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glTexEnviv") ) ++ glTexEnviv ( target, pname, params ) ; ++} ++ ++void xglTexGend ( GLenum coord, GLenum pname, GLdouble param ) ++{ ++ if ( xglTraceIsEnabled("glTexGend") ) ++ fprintf ( xglTraceFd, " glTexGend ( (GLenum)%s, (GLenum)%s, (GLdouble)%f ) ;\n" , xglExpandGLenum ( (GLenum) coord ), xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glTexGend") ) ++ glTexGend ( coord, pname, param ) ; ++} ++ ++void xglTexGendv ( GLenum coord, GLenum pname, GLdouble* params ) ++{ ++ if ( xglTraceIsEnabled("glTexGendv") ) ++ fprintf ( xglTraceFd, " glTexGendv ( (GLenum)%s, (GLenum)%s, (GLdouble *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) coord ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glTexGendv") ) ++ glTexGendv ( coord, pname, params ) ; ++} ++ ++void xglTexGenf ( GLenum coord, GLenum pname, GLfloat param ) ++{ ++ if ( xglTraceIsEnabled("glTexGenf") ) ++ fprintf ( xglTraceFd, " glTexGenf ( (GLenum)%s, (GLenum)%s, (GLfloat)%ff ) ;\n" , xglExpandGLenum ( (GLenum) coord ), xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glTexGenf") ) ++ glTexGenf ( coord, pname, param ) ; ++} ++ ++void xglTexGenfv ( GLenum coord, GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glTexGenfv") ) ++ fprintf ( xglTraceFd, " glTexGenfv ( (GLenum)%s, (GLenum)%s, (GLfloat *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) coord ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glTexGenfv") ) ++ glTexGenfv ( coord, pname, params ) ; ++} ++ ++void xglTexGeni ( GLenum coord, GLenum pname, GLint param ) ++{ ++ if ( xglTraceIsEnabled("glTexGeni") ) ++ fprintf ( xglTraceFd, " glTexGeni ( (GLenum)%s, (GLenum)%s, (GLint)%d ) ;\n" , xglExpandGLenum ( (GLenum) coord ), xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glTexGeni") ) ++ glTexGeni ( coord, pname, param ) ; ++} ++ ++void xglTexGeniv ( GLenum coord, GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glTexGeniv") ) ++ fprintf ( xglTraceFd, " glTexGeniv ( (GLenum)%s, (GLenum)%s, (GLint *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) coord ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glTexGeniv") ) ++ glTexGeniv ( coord, pname, params ) ; ++} ++ ++void xglTexImage1D ( GLenum target, GLint level, GLint components, GLsizei width, GLint border, GLenum format, GLenum type, GLvoid* pixels ) ++{ ++ if ( xglTraceIsEnabled("glTexImage1D") ) ++ fprintf ( xglTraceFd, " glTexImage1D ( (GLenum)%s, (GLint)%d, (GLint)%d, (GLsizei)%d, (GLint)%d, (GLenum)%s, (GLenum)%s, (GLvoid *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) target ), level, components, width, border, xglExpandGLenum ( (GLenum) format ), xglExpandGLenum ( (GLenum) type ), pixels ) ; ++ if ( xglExecuteIsEnabled("glTexImage1D") ) ++ glTexImage1D ( target, level, components, width, border, format, type, pixels ) ; ++} ++ ++void xglTexImage2D ( GLenum target, GLint level, GLint components, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid* pixels ) ++{ ++ if ( xglTraceIsEnabled("glTexImage2D") ) ++ fprintf ( xglTraceFd, " glTexImage2D ( (GLenum)%s, (GLint)%d, (GLint)%d, (GLsizei)%d, (GLsizei)%d, (GLint)%d, (GLenum)%s, (GLenum)%s, (GLvoid *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) target ), level, components, width, height, border, xglExpandGLenum ( (GLenum) format ), xglExpandGLenum ( (GLenum) type ), pixels ) ; ++ if ( xglExecuteIsEnabled("glTexImage2D") ) ++ glTexImage2D ( target, level, components, width, height, border, format, type, pixels ) ; ++} ++ ++void xglTexParameterf ( GLenum target, GLenum pname, GLfloat param ) ++{ ++ if ( xglTraceIsEnabled("glTexParameterf") ) ++ fprintf ( xglTraceFd, " glTexParameterf ( (GLenum)%s, (GLenum)%s, (GLfloat)%ff ) ;\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glTexParameterf") ) ++ glTexParameterf ( target, pname, param ) ; ++} ++ ++void xglTexParameterfv ( GLenum target, GLenum pname, GLfloat* params ) ++{ ++ if ( xglTraceIsEnabled("glTexParameterfv") ) ++ fprintf ( xglTraceFd, " glTexParameterfv ( (GLenum)%s, (GLenum)%s, (GLfloat *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glTexParameterfv") ) ++ glTexParameterfv ( target, pname, params ) ; ++} ++ ++void xglTexParameteri ( GLenum target, GLenum pname, GLint param ) ++{ ++ if ( xglTraceIsEnabled("glTexParameteri") ) ++ fprintf ( xglTraceFd, " glTexParameteri ( (GLenum)%s, (GLenum)%s, (GLint)%d ) ;\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) pname ), param ) ; ++ if ( xglExecuteIsEnabled("glTexParameteri") ) ++ glTexParameteri ( target, pname, param ) ; ++} ++ ++void xglTexParameteriv ( GLenum target, GLenum pname, GLint* params ) ++{ ++ if ( xglTraceIsEnabled("glTexParameteriv") ) ++ fprintf ( xglTraceFd, " glTexParameteriv ( (GLenum)%s, (GLenum)%s, (GLint *)0x%08x ) ;\n" , xglExpandGLenum ( (GLenum) target ), xglExpandGLenum ( (GLenum) pname ), params ) ; ++ if ( xglExecuteIsEnabled("glTexParameteriv") ) ++ glTexParameteriv ( target, pname, params ) ; ++} ++ ++void xglTranslated ( GLdouble x, GLdouble y, GLdouble z ) ++{ ++ if ( xglTraceIsEnabled("glTranslated") ) ++ fprintf ( xglTraceFd, " glTranslated ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glTranslated") ) ++ glTranslated ( x, y, z ) ; ++} ++ ++void xglTranslatef ( GLfloat x, GLfloat y, GLfloat z ) ++{ ++ if ( xglTraceIsEnabled("glTranslatef") ) ++ fprintf ( xglTraceFd, " glTranslatef ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glTranslatef") ) ++ glTranslatef ( x, y, z ) ; ++} ++ ++void xglVertex2d ( GLdouble x, GLdouble y ) ++{ ++ if ( xglTraceIsEnabled("glVertex2d") ) ++ fprintf ( xglTraceFd, " glVertex2d ( (GLdouble)%f, (GLdouble)%f ) ;\n" , x, y ) ; ++ if ( xglExecuteIsEnabled("glVertex2d") ) ++ glVertex2d ( x, y ) ; ++} ++ ++void xglVertex2dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex2dv") ) ++ fprintf ( xglTraceFd, " glVertex2dv ( xglBuild2dv((GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glVertex2dv") ) ++ glVertex2dv ( v ) ; ++} ++ ++void xglVertex2f ( GLfloat x, GLfloat y ) ++{ ++ if ( xglTraceIsEnabled("glVertex2f") ) ++ fprintf ( xglTraceFd, " glVertex2f ( (GLfloat)%ff, (GLfloat)%ff ) ;\n" , x, y ) ; ++ if ( xglExecuteIsEnabled("glVertex2f") ) ++ glVertex2f ( x, y ) ; ++} ++ ++void xglVertex2fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex2fv") ) ++ fprintf ( xglTraceFd, " glVertex2fv ( xglBuild2fv((GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glVertex2fv") ) ++ glVertex2fv ( v ) ; ++} ++ ++void xglVertex2i ( GLint x, GLint y ) ++{ ++ if ( xglTraceIsEnabled("glVertex2i") ) ++ fprintf ( xglTraceFd, " glVertex2i ( (GLint)%d, (GLint)%d ) ;\n" , x, y ) ; ++ if ( xglExecuteIsEnabled("glVertex2i") ) ++ glVertex2i ( x, y ) ; ++} ++ ++void xglVertex2iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex2iv") ) ++ fprintf ( xglTraceFd, " glVertex2iv ( xglBuild2iv((GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glVertex2iv") ) ++ glVertex2iv ( v ) ; ++} ++ ++void xglVertex2s ( GLshort x, GLshort y ) ++{ ++ if ( xglTraceIsEnabled("glVertex2s") ) ++ fprintf ( xglTraceFd, " glVertex2s ( (GLshort)%d, (GLshort)%d ) ;\n" , x, y ) ; ++ if ( xglExecuteIsEnabled("glVertex2s") ) ++ glVertex2s ( x, y ) ; ++} ++ ++void xglVertex2sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex2sv") ) ++ fprintf ( xglTraceFd, " glVertex2sv ( xglBuild2sv((GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1] ) ; ++ if ( xglExecuteIsEnabled("glVertex2sv") ) ++ glVertex2sv ( v ) ; ++} ++ ++void xglVertex3d ( GLdouble x, GLdouble y, GLdouble z ) ++{ ++ if ( xglTraceIsEnabled("glVertex3d") ) ++ fprintf ( xglTraceFd, " glVertex3d ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glVertex3d") ) ++ glVertex3d ( x, y, z ) ; ++} ++ ++void xglVertex3dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex3dv") ) ++ fprintf ( xglTraceFd, " glVertex3dv ( xglBuild3dv((GLdouble)%f,(GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glVertex3dv") ) ++ glVertex3dv ( v ) ; ++} ++ ++void xglVertex3f ( GLfloat x, GLfloat y, GLfloat z ) ++{ ++ if ( xglTraceIsEnabled("glVertex3f") ) ++ fprintf ( xglTraceFd, " glVertex3f ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glVertex3f") ) ++ glVertex3f ( x, y, z ) ; ++} ++ ++void xglVertex3fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex3fv") ) ++ fprintf ( xglTraceFd, " glVertex3fv ( xglBuild3fv((GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glVertex3fv") ) ++ glVertex3fv ( v ) ; ++} ++ ++void xglVertex3i ( GLint x, GLint y, GLint z ) ++{ ++ if ( xglTraceIsEnabled("glVertex3i") ) ++ fprintf ( xglTraceFd, " glVertex3i ( (GLint)%d, (GLint)%d, (GLint)%d ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glVertex3i") ) ++ glVertex3i ( x, y, z ) ; ++} ++ ++void xglVertex3iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex3iv") ) ++ fprintf ( xglTraceFd, " glVertex3iv ( xglBuild3iv((GLint)%d,(GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glVertex3iv") ) ++ glVertex3iv ( v ) ; ++} ++ ++void xglVertex3s ( GLshort x, GLshort y, GLshort z ) ++{ ++ if ( xglTraceIsEnabled("glVertex3s") ) ++ fprintf ( xglTraceFd, " glVertex3s ( (GLshort)%d, (GLshort)%d, (GLshort)%d ) ;\n" , x, y, z ) ; ++ if ( xglExecuteIsEnabled("glVertex3s") ) ++ glVertex3s ( x, y, z ) ; ++} ++ ++void xglVertex3sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex3sv") ) ++ fprintf ( xglTraceFd, " glVertex3sv ( xglBuild3sv((GLshort)%d,(GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1], v[2] ) ; ++ if ( xglExecuteIsEnabled("glVertex3sv") ) ++ glVertex3sv ( v ) ; ++} ++ ++void xglVertex4d ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) ++{ ++ if ( xglTraceIsEnabled("glVertex4d") ) ++ fprintf ( xglTraceFd, " glVertex4d ( (GLdouble)%f, (GLdouble)%f, (GLdouble)%f, (GLdouble)%f ) ;\n" , x, y, z, w ) ; ++ if ( xglExecuteIsEnabled("glVertex4d") ) ++ glVertex4d ( x, y, z, w ) ; ++} ++ ++void xglVertex4dv ( GLdouble* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex4dv") ) ++ fprintf ( xglTraceFd, " glVertex4dv ( xglBuild4dv((GLdouble)%f,(GLdouble)%f,(GLdouble)%f,(GLdouble)%f) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glVertex4dv") ) ++ glVertex4dv ( v ) ; ++} ++ ++void xglVertex4f ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) ++{ ++ if ( xglTraceIsEnabled("glVertex4f") ) ++ fprintf ( xglTraceFd, " glVertex4f ( (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff, (GLfloat)%ff ) ;\n" , x, y, z, w ) ; ++ if ( xglExecuteIsEnabled("glVertex4f") ) ++ glVertex4f ( x, y, z, w ) ; ++} ++ ++void xglVertex4fv ( GLfloat* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex4fv") ) ++ fprintf ( xglTraceFd, " glVertex4fv ( xglBuild4fv((GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff,(GLfloat)%ff) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glVertex4fv") ) ++ glVertex4fv ( v ) ; ++} ++ ++void xglVertex4i ( GLint x, GLint y, GLint z, GLint w ) ++{ ++ if ( xglTraceIsEnabled("glVertex4i") ) ++ fprintf ( xglTraceFd, " glVertex4i ( (GLint)%d, (GLint)%d, (GLint)%d, (GLint)%d ) ;\n" , x, y, z, w ) ; ++ if ( xglExecuteIsEnabled("glVertex4i") ) ++ glVertex4i ( x, y, z, w ) ; ++} ++ ++void xglVertex4iv ( GLint* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex4iv") ) ++ fprintf ( xglTraceFd, " glVertex4iv ( xglBuild4iv((GLint)%d,(GLint)%d,(GLint)%d,(GLint)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glVertex4iv") ) ++ glVertex4iv ( v ) ; ++} ++ ++void xglVertex4s ( GLshort x, GLshort y, GLshort z, GLshort w ) ++{ ++ if ( xglTraceIsEnabled("glVertex4s") ) ++ fprintf ( xglTraceFd, " glVertex4s ( (GLshort)%d, (GLshort)%d, (GLshort)%d, (GLshort)%d ) ;\n" , x, y, z, w ) ; ++ if ( xglExecuteIsEnabled("glVertex4s") ) ++ glVertex4s ( x, y, z, w ) ; ++} ++ ++void xglVertex4sv ( GLshort* v ) ++{ ++ if ( xglTraceIsEnabled("glVertex4sv") ) ++ fprintf ( xglTraceFd, " glVertex4sv ( xglBuild4sv((GLshort)%d,(GLshort)%d,(GLshort)%d,(GLshort)%d) ) ;\n" , v[0], v[1], v[2], v[3] ) ; ++ if ( xglExecuteIsEnabled("glVertex4sv") ) ++ glVertex4sv ( v ) ; ++} ++ ++void xglVertexPointerEXT ( GLint size, GLenum type, GLsizei stride, GLsizei count, void* ptr ) ++{ ++ if ( xglTraceIsEnabled("glVertexPointerEXT") ) ++ fprintf ( xglTraceFd, " glVertexPointerEXT ( (GLint)%d, (GLenum)%s, (GLsizei)%d, (GLsizei)%d, (void *)0x%08x ) ;\n" , size, xglExpandGLenum ( (GLenum) type ), stride, count, ptr ) ; ++#ifdef GL_VERSION_1_1 ++ glVertexPointer ( size, type, stride, ptr ) ; ++#else ++#ifdef GL_EXT_vertex_array ++ if ( xglExecuteIsEnabled("glVertexPointerEXT") ) ++ glVertexPointerEXT ( size, type, stride, count, ptr ) ; ++#else ++ fprintf ( xglTraceFd, " glVertexPointerEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++#endif ++} ++ ++void xglViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) ++{ ++ if ( xglTraceIsEnabled("glViewport") ) ++ fprintf ( xglTraceFd, " glViewport ( (GLint)%d, (GLint)%d, (GLsizei)%d, (GLsizei)%d ) ;\n" , x, y, width, height ) ; ++ if ( xglExecuteIsEnabled("glViewport") ) ++ glViewport ( x, y, width, height ) ; ++} ++ ++void xglutAddMenuEntry ( char* label, int value ) ++{ ++ if ( xglTraceIsEnabled("glutAddMenuEntry") ) ++ fprintf ( xglTraceFd, " /* glutAddMenuEntry ( \"%s\", %d ) ; */\n" , label, value ) ; ++ if ( xglExecuteIsEnabled("glutAddMenuEntry") ) ++ glutAddMenuEntry ( label, value ) ; ++} ++ ++void xglutAttachMenu ( int button ) ++{ ++ if ( xglTraceIsEnabled("glutAttachMenu") ) ++ fprintf ( xglTraceFd, " /* glutAttachMenu ( %d ) ; */\n" , button ) ; ++ if ( xglExecuteIsEnabled("glutAttachMenu") ) ++ glutAttachMenu ( button ) ; ++} ++ ++int xglutCreateMenu ( void (*func)(int) ) ++{ ++ if ( xglTraceIsEnabled("glutCreateMenu") ) ++ fprintf ( xglTraceFd, " /* glutCreateMenu ( 0x%08x ) ; */\n" , func ) ; ++ ++ return glutCreateMenu ( func ) ; ++} ++ ++int xglutCreateWindow ( char* title ) ++{ ++ if ( xglTraceIsEnabled("glutCreateWindow") ) ++ fprintf ( xglTraceFd, " /* glutCreateWindow ( \"%s\" ) ; */\n" , title ) ; ++ ++ return glutCreateWindow ( title ) ; ++} ++ ++void xglutDisplayFunc ( void (*func)(void) ) ++{ ++ if ( xglTraceIsEnabled("glutDisplayFunc") ) ++ fprintf ( xglTraceFd, " /* glutDisplayFunc ( 0x%08x ) ; */\n" , func ) ; ++ if ( xglExecuteIsEnabled("glutDisplayFunc") ) ++ glutDisplayFunc ( func ) ; ++} ++ ++void xglutIdleFunc ( void (*func)(void) ) ++{ ++ if ( xglTraceIsEnabled("glutIdleFunc") ) ++ fprintf ( xglTraceFd, " /* glutIdleFunc ( 0x%08x ) ; */\n" , func ) ; ++ if ( xglExecuteIsEnabled("glutIdleFunc") ) ++ glutIdleFunc ( func ) ; ++} ++ ++void xglutInit ( int* argcp, char** argv ) ++{ ++ if(!xglTraceFd ) { // Not defined by any other means, must be here ++ xglTraceFd = stdout; // avoid a crash from a NULL ptr. ++ } ++ if ( xglTraceIsEnabled("glutInit") ) ++ fprintf ( xglTraceFd, ++ " /* glutInit ( (int *)0x%08x, (char **)0x%08x ) ; */\n" , ++ argcp, argv ) ; ++ if ( xglExecuteIsEnabled("glutInit") ) ++ glutInit ( argcp, argv ) ; ++} ++ ++void xglutInitDisplayMode ( unsigned int mode ) ++{ ++ if ( xglTraceIsEnabled("glutInitDisplayMode") ) ++ fprintf ( xglTraceFd, " /* glutInitDisplayMode ( %u ) ; */\n" , mode ) ; ++ if ( xglExecuteIsEnabled("glutInitDisplayMode") ) ++ glutInitDisplayMode ( mode ) ; ++} ++ ++void xglutInitWindowPosition ( int x, int y ) ++{ ++ if ( xglTraceIsEnabled("glutInitWindowPosition") ) ++ fprintf ( xglTraceFd, " /* glutInitWindowPosition ( %d, %d ) ; */\n" , x, y ) ; ++ if ( xglExecuteIsEnabled("glutInitWindowPosition") ) ++ glutInitWindowPosition ( x, y ) ; ++} ++ ++void xglutInitWindowSize ( int width, int height ) ++{ ++ if ( xglTraceIsEnabled("glutInitWindowSize") ) ++ fprintf ( xglTraceFd, " /* glutInitWindowSize ( %d, %d ) ; */\n" , width, height ) ; ++ if ( xglExecuteIsEnabled("glutInitWindowSize") ) ++ glutInitWindowSize ( width, height ) ; ++} ++ ++void xglutKeyboardFunc ( void (*func)(unsigned char key, int x, int y) ) ++{ ++ if ( xglTraceIsEnabled("glutKeyboardFunc") ) ++ fprintf ( xglTraceFd, " /* glutKeyboardFunc ( 0x%08x ) ; */\n" , func ) ; ++ if ( xglExecuteIsEnabled("glutKeyboardFunc") ) ++ glutKeyboardFunc ( func ) ; ++} ++ ++void xglutMainLoopUpdate ( ) ++{ ++ if ( xglTraceIsEnabled("glutMainLoopUpdate") ) ++ fprintf ( xglTraceFd, " /* glutMainLoopUpdate ( ) ; */\n" ) ; ++ if ( xglExecuteIsEnabled("glutMainLoopUpdate") ) ++ /* glutMainLoopUpdate ( ) ; */ ++ printf("Steves glutMainLoopUpdate() hack not executed!!!!\n"); ++} ++ ++void xglutPostRedisplay ( ) ++{ ++ if ( xglTraceIsEnabled("glutPostRedisplay") ) ++ fprintf ( xglTraceFd, " /* glutPostRedisplay ( ) ; */\n" ) ; ++ if ( xglExecuteIsEnabled("glutPostRedisplay") ) ++ glutPostRedisplay ( ) ; ++} ++ ++void xglutPreMainLoop ( ) ++{ ++ if ( xglTraceIsEnabled("glutPreMainLoop") ) ++ fprintf ( xglTraceFd, " /* glutPreMainLoop ( ) ; */\n" ) ; ++ if ( xglExecuteIsEnabled("glutPreMainLoop") ) ++ /* glutPreMainLoop ( ) ; */ ++ printf("Steves glutPreLoopUpdate() hack not executed!!!!\n"); ++ ++} ++ ++void xglutReshapeFunc ( void (*func)(int width, int height) ) ++{ ++ if ( xglTraceIsEnabled("glutReshapeFunc") ) ++ fprintf ( xglTraceFd, " /* glutReshapeFunc ( 0x%08x ) ; */\n" , func ) ; ++ if ( xglExecuteIsEnabled("glutReshapeFunc") ) ++ glutReshapeFunc ( func ) ; ++} ++ ++void xglutSwapBuffers () ++{ ++ if ( xglTraceIsEnabled("glutSwapBuffers") ) ++ fprintf ( xglTraceFd, " /* glutSwapBuffers ( ) ; */\n" ) ; ++ if ( xglExecuteIsEnabled("glutSwapBuffers") ) ++ glutSwapBuffers () ; ++} ++ ++GLboolean xglAreTexturesResidentEXT ( GLsizei n, GLuint* textures, GLboolean* residences ) ++{ ++ if ( xglTraceIsEnabled("glAreTexturesResidentEXT") ) ++ fprintf ( xglTraceFd, " /* glAreTexturesResidentEXT ( (GLsizei)%d, (GLuint *)0x%08x, (GLboolean *)0x%08x ) ; */\n" , n, textures, residences ) ; ++ ++#ifdef GL_TEXTURE_2D_BINDING_EXT ++ if ( xglExecuteIsEnabled("glAreTexturesResidentEXT") ) ++ return glAreTexturesResidentEXT ( n, textures, residences ) ; ++#else ++ fprintf ( xglTraceFd, " glAreTexturesResidentEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++ ++ return TRUE ; ++} ++ ++GLboolean xglIsTextureEXT ( GLuint texture ) ++{ ++ if ( xglTraceIsEnabled("glIsTextureEXT") ) ++ fprintf ( xglTraceFd, " /* glIsTextureEXT ( (GLuint)%u ) ; */\n" , texture ) ; ++ ++#ifdef GL_TEXTURE_2D_BINDING_EXT ++ if ( xglExecuteIsEnabled("glIsTextureEXT") ) ++ return glIsTextureEXT ( texture ) ; ++#else ++ fprintf ( xglTraceFd, " glIsTextureEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++ ++ return TRUE ; ++} ++ ++void xglBindTextureEXT ( GLenum target, GLuint texture ) ++{ ++ if ( xglTraceIsEnabled("glBindTextureEXT") ) ++ fprintf ( xglTraceFd, " glBindTextureEXT ( (GLenum)%s, (GLuint)%u ) ;\n" , xglExpandGLenum ( (GLenum) target ), texture ) ; ++ ++#ifdef GL_TEXTURE_2D_BINDING_EXT ++ if ( xglExecuteIsEnabled("glBindTextureEXT") ) ++ glBindTextureEXT ( target, texture ) ; ++#else ++ fprintf ( xglTraceFd, " glBindTextureEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++} ++ ++void xglDeleteTexturesEXT ( GLsizei n, GLuint* textures ) ++{ ++ if ( xglTraceIsEnabled("glDeleteTexturesEXT") ) ++ fprintf ( xglTraceFd, " glDeleteTexturesEXT ( (GLsizei)%d, (GLuint *)0x%08x ) ;\n" , n, textures ) ; ++ ++#ifdef GL_TEXTURE_2D_BINDING_EXT ++ if ( xglExecuteIsEnabled("glDeleteTexturesEXT") ) ++ glDeleteTexturesEXT ( n, textures ) ; ++#else ++ fprintf ( xglTraceFd, " glDeleteTextures isn't supported on this OpenGL!\n" ) ; ++#endif ++} ++ ++void xglGenTexturesEXT ( GLsizei n, GLuint* textures ) ++{ ++ if ( xglTraceIsEnabled("glGenTexturesEXT") ) ++ fprintf ( xglTraceFd, " glGenTexturesEXT ( (GLsizei)%d, (GLuint *)0x%08x ) ;\n" , n, textures ) ; ++ ++#ifdef GL_TEXTURE_2D_BINDING_EXT ++ if ( xglExecuteIsEnabled("glGenTexturesEXT") ) ++ glGenTexturesEXT ( n, textures ) ; ++#else ++ fprintf ( xglTraceFd, " glDeleteTexturesEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++} ++ ++void xglPrioritizeTexturesEXT ( GLsizei n, GLuint* textures, GLclampf* priorities ) ++{ ++ if ( xglTraceIsEnabled("glPrioritizeTexturesEXT") ) ++ fprintf ( xglTraceFd, " glPrioritizeTexturesEXT ( (GLsizei)%d, (GLuint *)0x%08x, (GLclampf *)0x%08x ) ;\n" , n, textures, priorities ) ; ++ ++#ifdef GL_TEXTURE_2D_BINDING_EXT ++ if ( xglExecuteIsEnabled("glPrioritizeTexturesEXT") ) ++ glPrioritizeTexturesEXT ( n, textures, priorities ) ; ++#else ++ fprintf ( xglTraceFd, " glPrioritizeTexturesEXT isn't supported on this OpenGL!\n" ) ; ++#endif ++} ++ ++ ++GLboolean xglAreTexturesResident ( GLsizei n, GLuint* textures, GLboolean* residences ) ++{ ++ if ( xglTraceIsEnabled("glAreTexturesResident") ) ++ fprintf ( xglTraceFd, " /* glAreTexturesResident ( (GLsizei)%d, (GLuint *)0x%08x, (GLboolean *)0x%08x ) ; */\n" , n, textures, residences ) ; ++ ++#ifdef GL_VERSION_1_1 ++ if ( xglExecuteIsEnabled("glAreTexturesResident") ) ++ return glAreTexturesResident ( n, textures, residences ) ; ++#else ++ fprintf ( xglTraceFd, " glAreTexturesResident isn't supported on this OpenGL!\n" ) ; ++#endif ++ ++ return TRUE ; ++} ++ ++GLboolean xglIsTexture ( GLuint texture ) ++{ ++ if ( xglTraceIsEnabled("glIsTexture") ) ++ fprintf ( xglTraceFd, " /* glIsTexture ( (GLuint)%u ) ; */\n" , texture ) ; ++ ++#ifdef GL_VERSION_1_1 ++ if ( xglExecuteIsEnabled("glIsTexture") ) ++ return glIsTexture ( texture ) ; ++#else ++ fprintf ( xglTraceFd, " glIsTexture isn't supported on this OpenGL!\n" ) ; ++#endif ++ ++ return TRUE ; ++} ++ ++void xglBindTexture ( GLenum target, GLuint texture ) ++{ ++ if ( xglTraceIsEnabled("glBindTexture") ) ++ fprintf ( xglTraceFd, " glBindTexture ( (GLenum)%s, (GLuint)%u ) ;\n" , xglExpandGLenum ( (GLenum) target ), texture ) ; ++ ++#ifdef GL_VERSION_1_1 ++ if ( xglExecuteIsEnabled("glBindTexture") ) ++ glBindTexture ( target, texture ) ; ++#else ++ fprintf ( xglTraceFd, " glBindTexture isn't supported on this OpenGL!\n" ) ; ++#endif ++} ++ ++void xglDeleteTextures ( GLsizei n, GLuint* textures ) ++{ ++ if ( xglTraceIsEnabled("glDeleteTextures") ) ++ fprintf ( xglTraceFd, " glDeleteTextures ( (GLsizei)%d, (GLuint *)0x%08x ) ;\n" , n, textures ) ; ++ ++#ifdef GL_VERSION_1_1 ++ if ( xglExecuteIsEnabled("glDeleteTextures") ) ++ glDeleteTextures ( n, textures ) ; ++#else ++ fprintf ( xglTraceFd, " glDeleteTextures isn't supported on this OpenGL!\n" ) ; ++#endif ++} ++ ++void xglGenTextures ( GLsizei n, GLuint* textures ) ++{ ++ if ( xglTraceIsEnabled("glGenTextures") ) ++ fprintf ( xglTraceFd, " glGenTextures ( (GLsizei)%d, (GLuint *)0x%08x ) ;\n" , n, textures ) ; ++ ++#ifdef GL_VERSION_1_1 ++ if ( xglExecuteIsEnabled("glGenTextures") ) ++ glGenTextures ( n, textures ) ; ++#else ++ fprintf ( xglTraceFd, " glDeleteTextures isn't supported on this OpenGL!\n" ) ; ++#endif ++} ++ ++void xglPrioritizeTextures ( GLsizei n, GLuint* textures, GLclampf* priorities ) ++{ ++ if ( xglTraceIsEnabled("glPrioritizeTextures") ) ++ fprintf ( xglTraceFd, " glPrioritizeTextures ( (GLsizei)%d, (GLuint *)0x%08x, (GLclampf *)0x%08x ) ;\n" , n, textures, priorities ) ; ++ ++#ifdef GL_VERSION_1_1 ++ if ( xglExecuteIsEnabled("glPrioritizeTextures") ) ++ glPrioritizeTextures ( n, textures, priorities ) ; ++#else ++ fprintf ( xglTraceFd, " glPrioritizeTextures isn't supported on this OpenGL!\n" ) ; ++#endif ++} ++ ++#endif ++ diff --cc simgear/xgl/xgl.h index 00000000,00000000..434ab09d new file mode 100644 --- /dev/null +++ b/simgear/xgl/xgl.h @@@ -1,0 -1,0 +1,837 @@@ ++#ifndef _XGL_H ++#define _XGL_H ++ ++ ++#ifdef HAVE_WINDOWS_H ++# include ++#endif ++ ++#include ++#include ++#include ++ ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++ ++/* xgl Utilities */ ++ ++extern FILE *xglTraceFd ; ++ ++int xglTraceIsEnabled ( char *gl_function_name ) ; ++int xglExecuteIsEnabled ( char *gl_function_name ) ; ++char *xglExpandGLenum ( GLenum x ) ; ++ ++GLdouble *xglBuild1dv ( GLdouble v ) ; ++GLfloat *xglBuild1fv ( GLfloat v ) ; ++GLbyte *xglBuild1bv ( GLbyte v ) ; ++GLint *xglBuild1iv ( GLint v ) ; ++GLshort *xglBuild1sv ( GLshort v ) ; ++GLubyte *xglBuild1ubv ( GLubyte v ) ; ++GLuint *xglBuild1uiv ( GLuint v ) ; ++GLushort *xglBuild1usv ( GLushort v ) ; ++ ++GLdouble *xglBuild2dv ( GLdouble v0, GLdouble v1 ) ; ++GLfloat *xglBuild2fv ( GLfloat v0, GLfloat v1 ) ; ++GLbyte *xglBuild2bv ( GLbyte v0, GLbyte v1 ) ; ++GLint *xglBuild2iv ( GLint v0, GLint v1 ) ; ++GLshort *xglBuild2sv ( GLshort v0, GLshort v1 ) ; ++GLubyte *xglBuild2ubv ( GLubyte v0, GLubyte v1 ) ; ++GLuint *xglBuild2uiv ( GLuint v0, GLuint v1 ) ; ++GLushort *xglBuild2usv ( GLushort v0, GLushort v1 ) ; ++ ++GLdouble *xglBuild3dv ( GLdouble v0, GLdouble v1, GLdouble v2 ) ; ++GLfloat *xglBuild3fv ( GLfloat v0, GLfloat v1, GLfloat v2 ) ; ++GLbyte *xglBuild3bv ( GLbyte v0, GLbyte v1, GLbyte v2 ) ; ++GLint *xglBuild3iv ( GLint v0, GLint v1, GLint v2 ) ; ++GLshort *xglBuild3sv ( GLshort v0, GLshort v1, GLshort v2 ) ; ++GLubyte *xglBuild3ubv ( GLubyte v0, GLubyte v1, GLubyte v2 ) ; ++GLuint *xglBuild3uiv ( GLuint v0, GLuint v1, GLuint v2 ) ; ++GLushort *xglBuild3usv ( GLushort v0, GLushort v1, GLushort v2 ) ; ++ ++GLdouble *xglBuild4dv ( GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3 ) ; ++GLfloat *xglBuild4fv ( GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3 ) ; ++GLbyte *xglBuild4bv ( GLbyte v0, GLbyte v1, GLbyte v2, GLbyte v3 ) ; ++GLint *xglBuild4iv ( GLint v0, GLint v1, GLint v2, GLint v3 ) ; ++GLshort *xglBuild4sv ( GLshort v0, GLshort v1, GLshort v2, GLshort v3 ) ; ++GLubyte *xglBuild4ubv ( GLubyte v0, GLubyte v1, GLubyte v2, GLubyte v3 ) ; ++GLuint *xglBuild4uiv ( GLuint v0, GLuint v1, GLuint v2, GLuint v3 ) ; ++GLushort *xglBuild4usv ( GLushort v0, GLushort v1, GLushort v2, GLushort v3 ) ; ++ ++GLfloat *xglBuildMatrixf ( GLfloat m0 , GLfloat m1 , GLfloat m2 , GLfloat m3 , ++ GLfloat m4 , GLfloat m5 , GLfloat m6 , GLfloat m7 , ++ GLfloat m8 , GLfloat m9 , GLfloat m10, GLfloat m11, ++ GLfloat m12, GLfloat m13, GLfloat m14, GLfloat m15 ) ; ++ ++GLdouble *xglBuildMatrixd ( GLdouble m0 , GLdouble m1 , GLdouble m2 , GLdouble m3 , ++ GLdouble m4 , GLdouble m5 , GLdouble m6 , GLdouble m7 , ++ GLdouble m8 , GLdouble m9 , GLdouble m10, GLdouble m11, ++ GLdouble m12, GLdouble m13, GLdouble m14, GLdouble m15 ) ; ++ ++/* ++ Conditionally compile all 'xgl' calls into standard 'gl' calls... ++ ++ OR ++ ++ Declare all possible 'xgl' calls as 'extern'. ++*/ ++ ++#ifndef XGL_TRACE ++ ++#define xglAccum glAccum ++#define xglAlphaFunc glAlphaFunc ++#ifdef GL_EXT_vertex_array ++#define xglArrayElementEXT glArrayElementEXT ++#endif ++#define xglBegin glBegin ++#define xglBitmap glBitmap ++#ifdef GL_EXT_blend_color ++#define xglBlendColorEXT glBlendColorEXT ++#endif ++#ifdef GL_EXT_blend_minmax ++#define xglBlendEquationEXT glBlendEquationEXT ++#endif ++#define xglBlendFunc glBlendFunc ++#define xglCallList glCallList ++#define xglCallLists glCallLists ++#define xglClear glClear ++#define xglClearAccum glClearAccum ++#define xglClearColor glClearColor ++#define xglClearDepth glClearDepth ++#define xglClearIndex glClearIndex ++#define xglClearStencil glClearStencil ++#define xglClipPlane glClipPlane ++#define xglColor3b glColor3b ++#define xglColor3bv glColor3bv ++#define xglColor3d glColor3d ++#define xglColor3dv glColor3dv ++#define xglColor3f glColor3f ++#define xglColor3fv glColor3fv ++#define xglColor3i glColor3i ++#define xglColor3iv glColor3iv ++#define xglColor3s glColor3s ++#define xglColor3sv glColor3sv ++#define xglColor3ub glColor3ub ++#define xglColor3ubv glColor3ubv ++#define xglColor3ui glColor3ui ++#define xglColor3uiv glColor3uiv ++#define xglColor3us glColor3us ++#define xglColor3usv glColor3usv ++#define xglColor4b glColor4b ++#define xglColor4bv glColor4bv ++#define xglColor4d glColor4d ++#define xglColor4dv glColor4dv ++#define xglColor4f glColor4f ++#define xglColor4fv glColor4fv ++#define xglColor4i glColor4i ++#define xglColor4iv glColor4iv ++#define xglColor4s glColor4s ++#define xglColor4sv glColor4sv ++#define xglColor4ub glColor4ub ++#define xglColor4ubv glColor4ubv ++#define xglColor4ui glColor4ui ++#define xglColor4uiv glColor4uiv ++#define xglColor4us glColor4us ++#define xglColor4usv glColor4usv ++#define xglColorMask glColorMask ++#define xglColorMaterial glColorMaterial ++#ifdef GL_EXT_vertex_array ++#define xglColorPointerEXT glColorPointerEXT ++#endif ++#define xglCopyPixels glCopyPixels ++#define xglCullFace glCullFace ++#define xglDeleteLists glDeleteLists ++#define xglDepthFunc glDepthFunc ++#define xglDepthMask glDepthMask ++#define xglDepthRange glDepthRange ++#define xglDisable glDisable ++#ifdef GL_EXT_vertex_array ++#define xglDrawArraysEXT glDrawArraysEXT ++#endif ++#define xglDrawBuffer glDrawBuffer ++#define xglDrawPixels glDrawPixels ++#define xglEdgeFlag glEdgeFlag ++#ifdef GL_EXT_vertex_array ++#define xglEdgeFlagPointerEXT glEdgeFlagPointerEXT ++#endif ++#define xglEdgeFlagv glEdgeFlagv ++#define xglEnable glEnable ++#define xglEnd glEnd ++#define xglEndList glEndList ++#define xglEvalCoord1d glEvalCoord1d ++#define xglEvalCoord1dv glEvalCoord1dv ++#define xglEvalCoord1f glEvalCoord1f ++#define xglEvalCoord1fv glEvalCoord1fv ++#define xglEvalCoord2d glEvalCoord2d ++#define xglEvalCoord2dv glEvalCoord2dv ++#define xglEvalCoord2f glEvalCoord2f ++#define xglEvalCoord2fv glEvalCoord2fv ++#define xglEvalMesh1 glEvalMesh1 ++#define xglEvalMesh2 glEvalMesh2 ++#define xglEvalPoint1 glEvalPoint1 ++#define xglEvalPoint2 glEvalPoint2 ++#define xglFeedbackBuffer glFeedbackBuffer ++#define xglFinish glFinish ++#define xglFlush glFlush ++#define xglFogf glFogf ++#define xglFogfv glFogfv ++#define xglFogi glFogi ++#define xglFogiv glFogiv ++#define xglFrontFace glFrontFace ++#define xglFrustum glFrustum ++#define xglGenLists glGenLists ++#define xglGetBooleanv glGetBooleanv ++#define xglGetClipPlane glGetClipPlane ++#define xglGetDoublev glGetDoublev ++#define xglGetError glGetError ++#define xglGetFloatv glGetFloatv ++#define xglGetIntegerv glGetIntegerv ++#define xglGetLightfv glGetLightfv ++#define xglGetLightiv glGetLightiv ++#define xglGetMapdv glGetMapdv ++#define xglGetMapfv glGetMapfv ++#define xglGetMapiv glGetMapiv ++#define xglGetMaterialfv glGetMaterialfv ++#define xglGetMaterialiv glGetMaterialiv ++#define xglGetPixelMapfv glGetPixelMapfv ++#define xglGetPixelMapuiv glGetPixelMapuiv ++#define xglGetPixelMapusv glGetPixelMapusv ++#ifdef GL_EXT_vertex_array ++#define xglGetPointervEXT glGetPointervEXT ++#endif ++#define xglGetPolygonStipple glGetPolygonStipple ++#define xglGetString glGetString ++#define xglGetTexEnvfv glGetTexEnvfv ++#define xglGetTexEnviv glGetTexEnviv ++#define xglGetTexGendv glGetTexGendv ++#define xglGetTexGenfv glGetTexGenfv ++#define xglGetTexGeniv glGetTexGeniv ++#define xglGetTexImage glGetTexImage ++#define xglGetTexLevelParameterfv glGetTexLevelParameterfv ++#define xglGetTexLevelParameteriv glGetTexLevelParameteriv ++#define xglGetTexParameterfv glGetTexParameterfv ++#define xglGetTexParameteriv glGetTexParameteriv ++#define xglHint glHint ++#define xglIndexMask glIndexMask ++#ifdef GL_EXT_vertex_array ++#define xglIndexPointerEXT glIndexPointerEXT ++#endif ++#define xglIndexd glIndexd ++#define xglIndexdv glIndexdv ++#define xglIndexf glIndexf ++#define xglIndexfv glIndexfv ++#define xglIndexi glIndexi ++#define xglIndexiv glIndexiv ++#define xglIndexs glIndexs ++#define xglIndexsv glIndexsv ++#define xglInitNames glInitNames ++#define xglIsEnabled glIsEnabled ++#define xglIsList glIsList ++#define xglLightModelf glLightModelf ++#define xglLightModelfv glLightModelfv ++#define xglLightModeli glLightModeli ++#define xglLightModeliv glLightModeliv ++#define xglLightf glLightf ++#define xglLightfv glLightfv ++#define xglLighti glLighti ++#define xglLightiv glLightiv ++#define xglLineStipple glLineStipple ++#define xglLineWidth glLineWidth ++#define xglListBase glListBase ++#define xglLoadIdentity glLoadIdentity ++#define xglLoadMatrixd glLoadMatrixd ++#define xglLoadMatrixf glLoadMatrixf ++#define xglLoadName glLoadName ++#define xglLogicOp glLogicOp ++#define xglMap1d glMap1d ++#define xglMap1f glMap1f ++#define xglMap2d glMap2d ++#define xglMap2f glMap2f ++#define xglMapGrid1d glMapGrid1d ++#define xglMapGrid1f glMapGrid1f ++#define xglMapGrid2d glMapGrid2d ++#define xglMapGrid2f glMapGrid2f ++#define xglMaterialf glMaterialf ++#define xglMaterialfv glMaterialfv ++#define xglMateriali glMateriali ++#define xglMaterialiv glMaterialiv ++#define xglMatrixMode glMatrixMode ++#define xglMultMatrixd glMultMatrixd ++#define xglMultMatrixf glMultMatrixf ++#define xglNewList glNewList ++#define xglNormal3b glNormal3b ++#define xglNormal3bv glNormal3bv ++#define xglNormal3d glNormal3d ++#define xglNormal3dv glNormal3dv ++#define xglNormal3f glNormal3f ++#ifdef DEBUGGING_NORMALS ++#define xglNormal3fv(f) {\ ++float ff = (f)[0]*(f)[0]+(f)[1]*(f)[1]+(f)[2]*(f)[2];\ ++if ( ff < 0.9 || ff > 1.1 )\ ++{\ ++fprintf(stderr,"glNormal3fv Overflow: %f, %f, %f -> %f [%s,%s,%s]\n",\ ++(f)[0],(f)[1],(f)[2],ff,str1,str2,str3);\ ++normal_bombed = 1 ;\ ++}\ ++glNormal3fv(f);\ ++} ++#else ++#define xglNormal3fv glNormal3fv ++#endif ++#define xglNormal3i glNormal3i ++#define xglNormal3iv glNormal3iv ++#define xglNormal3s glNormal3s ++#define xglNormal3sv glNormal3sv ++#ifdef GL_EXT_vertex_array ++#define xglNormalPointerEXT glNormalPointerEXT ++#endif ++#define xglOrtho glOrtho ++#define xglPassThrough glPassThrough ++#define xglPixelMapfv glPixelMapfv ++#define xglPixelMapuiv glPixelMapuiv ++#define xglPixelMapusv glPixelMapusv ++#define xglPixelStoref glPixelStoref ++#define xglPixelStorei glPixelStorei ++#define xglPixelTransferf glPixelTransferf ++#define xglPixelTransferi glPixelTransferi ++#define xglPixelZoom glPixelZoom ++#define xglPointSize glPointSize ++#define xglPolygonMode glPolygonMode ++#ifdef GL_EXT_polygon_offset ++#define xglPolygonOffsetEXT glPolygonOffsetEXT ++#endif ++#define xglPolygonOffset glPolygonOffset ++#define xglPolygonStipple glPolygonStipple ++#define xglPopAttrib glPopAttrib ++#define xglPopMatrix glPopMatrix ++#define xglPopName glPopName ++#define xglPushAttrib glPushAttrib ++#define xglPushMatrix glPushMatrix ++#define xglPushName glPushName ++#define xglRasterPos2d glRasterPos2d ++#define xglRasterPos2dv glRasterPos2dv ++#define xglRasterPos2f glRasterPos2f ++#define xglRasterPos2fv glRasterPos2fv ++#define xglRasterPos2i glRasterPos2i ++#define xglRasterPos2iv glRasterPos2iv ++#define xglRasterPos2s glRasterPos2s ++#define xglRasterPos2sv glRasterPos2sv ++#define xglRasterPos3d glRasterPos3d ++#define xglRasterPos3dv glRasterPos3dv ++#define xglRasterPos3f glRasterPos3f ++#define xglRasterPos3fv glRasterPos3fv ++#define xglRasterPos3i glRasterPos3i ++#define xglRasterPos3iv glRasterPos3iv ++#define xglRasterPos3s glRasterPos3s ++#define xglRasterPos3sv glRasterPos3sv ++#define xglRasterPos4d glRasterPos4d ++#define xglRasterPos4dv glRasterPos4dv ++#define xglRasterPos4f glRasterPos4f ++#define xglRasterPos4fv glRasterPos4fv ++#define xglRasterPos4i glRasterPos4i ++#define xglRasterPos4iv glRasterPos4iv ++#define xglRasterPos4s glRasterPos4s ++#define xglRasterPos4sv glRasterPos4sv ++#define xglReadBuffer glReadBuffer ++#define xglReadPixels glReadPixels ++#define xglRectd glRectd ++#define xglRectdv glRectdv ++#define xglRectf glRectf ++#define xglRectfv glRectfv ++#define xglRecti glRecti ++#define xglRectiv glRectiv ++#define xglRects glRects ++#define xglRectsv glRectsv ++#define xglRenderMode glRenderMode ++#define xglRotated glRotated ++#define xglRotatef glRotatef ++#define xglScaled glScaled ++#define xglScalef glScalef ++#define xglScissor glScissor ++#define xglSelectBuffer glSelectBuffer ++#define xglShadeModel glShadeModel ++#define xglStencilFunc glStencilFunc ++#define xglStencilMask glStencilMask ++#define xglStencilOp glStencilOp ++#define xglTexCoord1d glTexCoord1d ++#define xglTexCoord1dv glTexCoord1dv ++#define xglTexCoord1f glTexCoord1f ++#define xglTexCoord1fv glTexCoord1fv ++#define xglTexCoord1i glTexCoord1i ++#define xglTexCoord1iv glTexCoord1iv ++#define xglTexCoord1s glTexCoord1s ++#define xglTexCoord1sv glTexCoord1sv ++#define xglTexCoord2d glTexCoord2d ++#define xglTexCoord2dv glTexCoord2dv ++#define xglTexCoord2f glTexCoord2f ++#define xglTexCoord2fv glTexCoord2fv ++#define xglTexCoord2i glTexCoord2i ++#define xglTexCoord2iv glTexCoord2iv ++#define xglTexCoord2s glTexCoord2s ++#define xglTexCoord2sv glTexCoord2sv ++#define xglTexCoord3d glTexCoord3d ++#define xglTexCoord3dv glTexCoord3dv ++#define xglTexCoord3f glTexCoord3f ++#define xglTexCoord3fv glTexCoord3fv ++#define xglTexCoord3i glTexCoord3i ++#define xglTexCoord3iv glTexCoord3iv ++#define xglTexCoord3s glTexCoord3s ++#define xglTexCoord3sv glTexCoord3sv ++#define xglTexCoord4d glTexCoord4d ++#define xglTexCoord4dv glTexCoord4dv ++#define xglTexCoord4f glTexCoord4f ++#define xglTexCoord4fv glTexCoord4fv ++#define xglTexCoord4i glTexCoord4i ++#define xglTexCoord4iv glTexCoord4iv ++#define xglTexCoord4s glTexCoord4s ++#define xglTexCoord4sv glTexCoord4sv ++#ifdef GL_EXT_vertex_array ++#define xglTexCoordPointerEXT glTexCoordPointerEXT ++#endif ++#define xglTexEnvf glTexEnvf ++#define xglTexEnvfv glTexEnvfv ++#define xglTexEnvi glTexEnvi ++#define xglTexEnviv glTexEnviv ++#define xglTexGend glTexGend ++#define xglTexGendv glTexGendv ++#define xglTexGenf glTexGenf ++#define xglTexGenfv glTexGenfv ++#define xglTexGeni glTexGeni ++#define xglTexGeniv glTexGeniv ++#define xglTexImage1D glTexImage1D ++#define xglTexImage2D glTexImage2D ++#define xglTexParameterf glTexParameterf ++#define xglTexParameterfv glTexParameterfv ++#define xglTexParameteri glTexParameteri ++#define xglTexParameteriv glTexParameteriv ++#define xglTranslated glTranslated ++#define xglTranslatef glTranslatef ++#define xglVertex2d glVertex2d ++#define xglVertex2dv glVertex2dv ++#define xglVertex2f glVertex2f ++#define xglVertex2fv glVertex2fv ++#define xglVertex2i glVertex2i ++#define xglVertex2iv glVertex2iv ++#define xglVertex2s glVertex2s ++#define xglVertex2sv glVertex2sv ++#define xglVertex3d glVertex3d ++#define xglVertex3dv glVertex3dv ++#define xglVertex3f glVertex3f ++#define xglVertex3fv glVertex3fv ++#define xglVertex3i glVertex3i ++#define xglVertex3iv glVertex3iv ++#define xglVertex3s glVertex3s ++#define xglVertex3sv glVertex3sv ++#define xglVertex4d glVertex4d ++#define xglVertex4dv glVertex4dv ++#define xglVertex4f glVertex4f ++#define xglVertex4fv glVertex4fv ++#define xglVertex4i glVertex4i ++#define xglVertex4iv glVertex4iv ++#define xglVertex4s glVertex4s ++#define xglVertex4sv glVertex4sv ++#ifdef GL_EXT_vertex_array ++#define xglVertexPointerEXT glVertexPointerEXT ++#endif ++#define xglViewport glViewport ++ ++#ifdef GL_VERSION_1_1 ++#define xglAreTexturesResident glAreTexturesResident ++#define xglIsTexture glIsTexture ++#define xglBindTexture glBindTexture ++#define xglDeleteTextures glDeleteTextures ++#define xglGenTextures glGenTextures ++#define xglPrioritizeTextures glPrioritizeTextures ++#endif ++ ++#ifdef GL_EXT_texture_object ++#define xglAreTexturesResidentEXT glAreTexturesResidentEXT ++#define xglIsTextureEXT glIsTextureEXT ++#define xglBindTextureEXT glBindTextureEXT ++#define xglDeleteTexturesEXT glDeleteTexturesEXT ++#define xglGenTexturesEXT glGenTexturesEXT ++#define xglPrioritizeTexturesEXT glPrioritizeTexturesEXT ++#endif ++ ++#define xglutAddMenuEntry glutAddMenuEntry ++#define xglutAttachMenu glutAttachMenu ++#define xglutCreateMenu glutCreateMenu ++#define xglutCreateWindow glutCreateWindow ++#define xglutDisplayFunc glutDisplayFunc ++#define xglutIdleFunc glutIdleFunc ++#define xglutInit glutInit ++#define xglutInitDisplayMode glutInitDisplayMode ++#define xglutInitWindowPosition glutInitWindowPosition ++#define xglutInitWindowSize glutInitWindowSize ++#define xglutKeyboardFunc glutKeyboardFunc ++#define xglutMainLoopUpdate glutMainLoopUpdate ++#define xglutPostRedisplay glutPostRedisplay ++#define xglutPreMainLoop glutPreMainLoop ++#define xglutReshapeFunc glutReshapeFunc ++#define xglutSwapBuffers glutSwapBuffers ++ ++#else ++ ++GLboolean xglIsEnabled ( GLenum cap ) ; ++GLboolean xglIsList ( GLuint list ) ; ++GLenum xglGetError () ; ++GLint xglRenderMode ( GLenum mode ) ; ++GLuint xglGenLists ( GLsizei range ) ; ++const GLubyte *xglGetString ( GLenum name ) ; ++ ++void xglAccum ( GLenum op, GLfloat value ) ; ++void xglAlphaFunc ( GLenum func, GLclampf ref ) ; ++void xglArrayElementEXT ( GLint i ) ; ++void xglBegin ( GLenum mode ) ; ++void xglBitmap ( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, GLubyte *bitmap ) ; ++void xglBlendColorEXT ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) ; ++void xglBlendEquationEXT( GLenum mode ) ; ++void xglBlendFunc ( GLenum sfactor, GLenum dfactor ) ; ++void xglCallList ( GLuint list ) ; ++void xglCallLists ( GLsizei n, GLenum type, GLvoid *lists ) ; ++void xglClear ( GLbitfield mask ) ; ++void xglClearAccum ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) ; ++void xglClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) ; ++void xglClearDepth ( GLclampd depth ) ; ++void xglClearIndex ( GLfloat c ) ; ++void xglClearStencil ( GLint s ) ; ++void xglClipPlane ( GLenum plane, GLdouble *equation ) ; ++void xglColor3b ( GLbyte red, GLbyte green, GLbyte blue ) ; ++void xglColor3bv ( GLbyte *v ) ; ++void xglColor3d ( GLdouble red, GLdouble green, GLdouble blue ) ; ++void xglColor3dv ( GLdouble *v ) ; ++void xglColor3f ( GLfloat red, GLfloat green, GLfloat blue ) ; ++void xglColor3fv ( GLfloat *v ) ; ++void xglColor3i ( GLint red, GLint green, GLint blue ) ; ++void xglColor3iv ( GLint *v ) ; ++void xglColor3s ( GLshort red, GLshort green, GLshort blue ) ; ++void xglColor3sv ( GLshort *v ) ; ++void xglColor3ub ( GLubyte red, GLubyte green, GLubyte blue ) ; ++void xglColor3ubv ( GLubyte *v ) ; ++void xglColor3ui ( GLuint red, GLuint green, GLuint blue ) ; ++void xglColor3uiv ( GLuint *v ) ; ++void xglColor3us ( GLushort red, GLushort green, GLushort blue ) ; ++void xglColor3usv ( GLushort *v ) ; ++void xglColor4b ( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ) ; ++void xglColor4bv ( GLbyte *v ) ; ++void xglColor4d ( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ) ; ++void xglColor4dv ( GLdouble *v ) ; ++void xglColor4f ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) ; ++void xglColor4fv ( GLfloat *v ) ; ++void xglColor4i ( GLint red, GLint green, GLint blue, GLint alpha ) ; ++void xglColor4iv ( GLint *v ) ; ++void xglColor4s ( GLshort red, GLshort green, GLshort blue, GLshort alpha ) ; ++void xglColor4sv ( GLshort *v ) ; ++void xglColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) ; ++void xglColor4ubv ( GLubyte *v ) ; ++void xglColor4ui ( GLuint red, GLuint green, GLuint blue, GLuint alpha ) ; ++void xglColor4uiv ( GLuint *v ) ; ++void xglColor4us ( GLushort red, GLushort green, GLushort blue, GLushort alpha ) ; ++void xglColor4usv ( GLushort *v ) ; ++void xglColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) ; ++void xglColorMaterial ( GLenum face, GLenum mode ) ; ++void xglColorPointerEXT ( GLint size, GLenum type, GLsizei stride, GLsizei count, void *ptr ) ; ++void xglCopyPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) ; ++void xglCullFace ( GLenum mode ) ; ++void xglDeleteLists ( GLuint list, GLsizei range ) ; ++void xglDepthFunc ( GLenum func ) ; ++void xglDepthMask ( GLboolean flag ) ; ++void xglDepthRange ( GLclampd near_val, GLclampd far_val ) ; ++void xglDisable ( GLenum cap ) ; ++void xglDrawArraysEXT ( GLenum mode, GLint first, GLsizei count ) ; ++void xglDrawBuffer ( GLenum mode ) ; ++void xglDrawPixels ( GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) ; ++void xglEdgeFlag ( GLboolean flag ) ; ++void xglEdgeFlagPointerEXT( GLsizei stride, GLsizei count, GLboolean *ptr ) ; ++void xglEdgeFlagv ( GLboolean *flag ) ; ++void xglEnable ( GLenum cap ) ; ++void xglEnd () ; ++void xglEndList () ; ++void xglEvalCoord1d ( GLdouble u ) ; ++void xglEvalCoord1dv ( GLdouble *u ) ; ++void xglEvalCoord1f ( GLfloat u ) ; ++void xglEvalCoord1fv ( GLfloat *u ) ; ++void xglEvalCoord2d ( GLdouble u, GLdouble v ) ; ++void xglEvalCoord2dv ( GLdouble *u ) ; ++void xglEvalCoord2f ( GLfloat u, GLfloat v ) ; ++void xglEvalCoord2fv ( GLfloat *u ) ; ++void xglEvalMesh1 ( GLenum mode, GLint i1, GLint i2 ) ; ++void xglEvalMesh2 ( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) ; ++void xglEvalPoint1 ( GLint i ) ; ++void xglEvalPoint2 ( GLint i, GLint j ) ; ++void xglFeedbackBuffer ( GLsizei size, GLenum type, GLfloat *buffer ) ; ++void xglFinish () ; ++void xglFlush () ; ++void xglFogf ( GLenum pname, GLfloat param ) ; ++void xglFogfv ( GLenum pname, GLfloat *params ) ; ++void xglFogi ( GLenum pname, GLint param ) ; ++void xglFogiv ( GLenum pname, GLint *params ) ; ++void xglFrontFace ( GLenum mode ) ; ++void xglFrustum ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ) ; ++void xglGetBooleanv ( GLenum pname, GLboolean *params ) ; ++void xglGetClipPlane ( GLenum plane, GLdouble *equation ) ; ++void xglGetDoublev ( GLenum pname, GLdouble *params ) ; ++void xglGetFloatv ( GLenum pname, GLfloat *params ) ; ++void xglGetIntegerv ( GLenum pname, GLint *params ) ; ++void xglGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) ; ++void xglGetLightiv ( GLenum light, GLenum pname, GLint *params ) ; ++void xglGetMapdv ( GLenum target, GLenum query, GLdouble *v ) ; ++void xglGetMapfv ( GLenum target, GLenum query, GLfloat *v ) ; ++void xglGetMapiv ( GLenum target, GLenum query, GLint *v ) ; ++void xglGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) ; ++void xglGetMaterialiv ( GLenum face, GLenum pname, GLint *params ) ; ++void xglGetPixelMapfv ( GLenum map, GLfloat *values ) ; ++void xglGetPixelMapuiv ( GLenum map, GLuint *values ) ; ++void xglGetPixelMapusv ( GLenum map, GLushort *values ) ; ++void xglGetPointervEXT ( GLenum pname, void **params ) ; ++void xglGetPolygonStipple( GLubyte *mask ) ; ++void xglGetTexEnvfv ( GLenum target, GLenum pname, GLfloat *params ) ; ++void xglGetTexEnviv ( GLenum target, GLenum pname, GLint *params ) ; ++void xglGetTexGendv ( GLenum coord, GLenum pname, GLdouble *params ) ; ++void xglGetTexGenfv ( GLenum coord, GLenum pname, GLfloat *params ) ; ++void xglGetTexGeniv ( GLenum coord, GLenum pname, GLint *params ) ; ++void xglGetTexImage ( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ) ; ++void xglGetTexLevelParameterfv ( GLenum target, GLint level, GLenum pname, GLfloat *params ) ; ++void xglGetTexLevelParameteriv ( GLenum target, GLint level, GLenum pname, GLint *params ) ; ++void xglGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params) ; ++void xglGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) ; ++void xglHint ( GLenum target, GLenum mode ) ; ++void xglIndexMask ( GLuint mask ) ; ++void xglIndexPointerEXT ( GLenum type, GLsizei stride, GLsizei count, void *ptr ) ; ++void xglIndexd ( GLdouble c ) ; ++void xglIndexdv ( GLdouble *c ) ; ++void xglIndexf ( GLfloat c ) ; ++void xglIndexfv ( GLfloat *c ) ; ++void xglIndexi ( GLint c ) ; ++void xglIndexiv ( GLint *c ) ; ++void xglIndexs ( GLshort c ) ; ++void xglIndexsv ( GLshort *c ) ; ++void xglInitNames () ; ++void xglLightModelf ( GLenum pname, GLfloat param ) ; ++void xglLightModelfv ( GLenum pname, GLfloat *params ) ; ++void xglLightModeli ( GLenum pname, GLint param ) ; ++void xglLightModeliv ( GLenum pname, GLint *params ) ; ++void xglLightf ( GLenum light, GLenum pname, GLfloat param ) ; ++void xglLightfv ( GLenum light, GLenum pname, GLfloat *params ) ; ++void xglLighti ( GLenum light, GLenum pname, GLint param ) ; ++void xglLightiv ( GLenum light, GLenum pname, GLint *params ) ; ++void xglLineStipple ( GLint factor, GLushort pattern ) ; ++void xglLineWidth ( GLfloat width ) ; ++void xglListBase ( GLuint base ) ; ++void xglLoadIdentity () ; ++void xglLoadMatrixd ( GLdouble *m ) ; ++void xglLoadMatrixf ( GLfloat *m ) ; ++void xglLoadName ( GLuint name ) ; ++void xglLogicOp ( GLenum opcode ) ; ++void xglMap1d ( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, GLdouble *points ) ; ++void xglMap1f ( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, GLfloat *points ) ; ++void xglMap2d ( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble *points ) ; ++void xglMap2f ( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat *points ) ; ++void xglMapGrid1d ( GLint un, GLdouble u1, GLdouble u2 ) ; ++void xglMapGrid1f ( GLint un, GLfloat u1, GLfloat u2 ) ; ++void xglMapGrid2d ( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) ; ++void xglMapGrid2f ( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) ; ++void xglMaterialf ( GLenum face, GLenum pname, GLfloat param ) ; ++void xglMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) ; ++void xglMateriali ( GLenum face, GLenum pname, GLint param ) ; ++void xglMaterialiv ( GLenum face, GLenum pname, GLint *params ) ; ++void xglMatrixMode ( GLenum mode ) ; ++void xglMultMatrixd ( GLdouble *m ) ; ++void xglMultMatrixf ( GLfloat *m ) ; ++void xglNewList ( GLuint list, GLenum mode ) ; ++void xglNormal3b ( GLbyte nx, GLbyte ny, GLbyte nz ) ; ++void xglNormal3bv ( GLbyte *v ) ; ++void xglNormal3d ( GLdouble nx, GLdouble ny, GLdouble nz ) ; ++void xglNormal3dv ( GLdouble *v ) ; ++void xglNormal3f ( GLfloat nx, GLfloat ny, GLfloat nz ) ; ++void xglNormal3fv ( GLfloat *v ) ; ++void xglNormal3i ( GLint nx, GLint ny, GLint nz ) ; ++void xglNormal3iv ( GLint *v ) ; ++void xglNormal3s ( GLshort nx, GLshort ny, GLshort nz ) ; ++void xglNormal3sv ( GLshort *v ) ; ++void xglNormalPointerEXT( GLenum type, GLsizei stride, GLsizei count, void *ptr ) ; ++void xglOrtho ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ) ; ++void xglPassThrough ( GLfloat token ) ; ++void xglPixelMapfv ( GLenum map, GLint mapsize, GLfloat *values ) ; ++void xglPixelMapuiv ( GLenum map, GLint mapsize, GLuint *values ) ; ++void xglPixelMapusv ( GLenum map, GLint mapsize, GLushort *values ) ; ++void xglPixelStoref ( GLenum pname, GLfloat param ) ; ++void xglPixelStorei ( GLenum pname, GLint param ) ; ++void xglPixelTransferf ( GLenum pname, GLfloat param ) ; ++void xglPixelTransferi ( GLenum pname, GLint param ) ; ++void xglPixelZoom ( GLfloat xfactor, GLfloat yfactor ) ; ++void xglPointSize ( GLfloat size ) ; ++void xglPolygonMode ( GLenum face, GLenum mode ) ; ++void xglPolygonOffsetEXT( GLfloat factor, GLfloat bias ) ; ++void xglPolygonOffset ( GLfloat factor, GLfloat bias ) ; ++void xglPolygonStipple ( GLubyte *mask ) ; ++void xglPopAttrib () ; ++void xglPopMatrix () ; ++void xglPopName () ; ++void xglPushAttrib ( GLbitfield mask ) ; ++void xglPushMatrix () ; ++void xglPushName ( GLuint name ) ; ++void xglRasterPos2d ( GLdouble x, GLdouble y ) ; ++void xglRasterPos2dv ( GLdouble *v ) ; ++void xglRasterPos2f ( GLfloat x, GLfloat y ) ; ++void xglRasterPos2fv ( GLfloat *v ) ; ++void xglRasterPos2i ( GLint x, GLint y ) ; ++void xglRasterPos2iv ( GLint *v ) ; ++void xglRasterPos2s ( GLshort x, GLshort y ) ; ++void xglRasterPos2sv ( GLshort *v ) ; ++void xglRasterPos3d ( GLdouble x, GLdouble y, GLdouble z ) ; ++void xglRasterPos3dv ( GLdouble *v ) ; ++void xglRasterPos3f ( GLfloat x, GLfloat y, GLfloat z ) ; ++void xglRasterPos3fv ( GLfloat *v ) ; ++void xglRasterPos3i ( GLint x, GLint y, GLint z ) ; ++void xglRasterPos3iv ( GLint *v ) ; ++void xglRasterPos3s ( GLshort x, GLshort y, GLshort z ) ; ++void xglRasterPos3sv ( GLshort *v ) ; ++void xglRasterPos4d ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) ; ++void xglRasterPos4dv ( GLdouble *v ) ; ++void xglRasterPos4f ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) ; ++void xglRasterPos4fv ( GLfloat *v ) ; ++void xglRasterPos4i ( GLint x, GLint y, GLint z, GLint w ) ; ++void xglRasterPos4iv ( GLint *v ) ; ++void xglRasterPos4s ( GLshort x, GLshort y, GLshort z, GLshort w ) ; ++void xglRasterPos4sv ( GLshort *v ) ; ++void xglReadBuffer ( GLenum mode ) ; ++void xglReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) ; ++void xglRectd ( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ) ; ++void xglRectdv ( GLdouble *v1, GLdouble *v2 ) ; ++void xglRectf ( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) ; ++void xglRectfv ( GLfloat *v1, GLfloat *v2 ) ; ++void xglRecti ( GLint x1, GLint y1, GLint x2, GLint y2 ) ; ++void xglRectiv ( GLint *v1, GLint *v2 ) ; ++void xglRects ( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ) ; ++void xglRectsv ( GLshort *v1, GLshort *v2 ) ; ++void xglRotated ( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ) ; ++void xglRotatef ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) ; ++void xglScaled ( GLdouble x, GLdouble y, GLdouble z ) ; ++void xglScalef ( GLfloat x, GLfloat y, GLfloat z ) ; ++void xglScissor ( GLint x, GLint y, GLsizei width, GLsizei height) ; ++void xglSelectBuffer ( GLsizei size, GLuint *buffer ) ; ++void xglShadeModel ( GLenum mode ) ; ++void xglStencilFunc ( GLenum func, GLint ref, GLuint mask ) ; ++void xglStencilMask ( GLuint mask ) ; ++void xglStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) ; ++void xglTexCoord1d ( GLdouble s ) ; ++void xglTexCoord1dv ( GLdouble *v ) ; ++void xglTexCoord1f ( GLfloat s ) ; ++void xglTexCoord1fv ( GLfloat *v ) ; ++void xglTexCoord1i ( GLint s ) ; ++void xglTexCoord1iv ( GLint *v ) ; ++void xglTexCoord1s ( GLshort s ) ; ++void xglTexCoord1sv ( GLshort *v ) ; ++void xglTexCoord2d ( GLdouble s, GLdouble t ) ; ++void xglTexCoord2dv ( GLdouble *v ) ; ++void xglTexCoord2f ( GLfloat s, GLfloat t ) ; ++void xglTexCoord2fv ( GLfloat *v ) ; ++void xglTexCoord2i ( GLint s, GLint t ) ; ++void xglTexCoord2iv ( GLint *v ) ; ++void xglTexCoord2s ( GLshort s, GLshort t ) ; ++void xglTexCoord2sv ( GLshort *v ) ; ++void xglTexCoord3d ( GLdouble s, GLdouble t, GLdouble r ) ; ++void xglTexCoord3dv ( GLdouble *v ) ; ++void xglTexCoord3f ( GLfloat s, GLfloat t, GLfloat r ) ; ++void xglTexCoord3fv ( GLfloat *v ) ; ++void xglTexCoord3i ( GLint s, GLint t, GLint r ) ; ++void xglTexCoord3iv ( GLint *v ) ; ++void xglTexCoord3s ( GLshort s, GLshort t, GLshort r ) ; ++void xglTexCoord3sv ( GLshort *v ) ; ++void xglTexCoord4d ( GLdouble s, GLdouble t, GLdouble r, GLdouble q ) ; ++void xglTexCoord4dv ( GLdouble *v ) ; ++void xglTexCoord4f ( GLfloat s, GLfloat t, GLfloat r, GLfloat q ) ; ++void xglTexCoord4fv ( GLfloat *v ) ; ++void xglTexCoord4i ( GLint s, GLint t, GLint r, GLint q ) ; ++void xglTexCoord4iv ( GLint *v ) ; ++void xglTexCoord4s ( GLshort s, GLshort t, GLshort r, GLshort q ) ; ++void xglTexCoord4sv ( GLshort *v ) ; ++void xglTexCoordPointerEXT( GLint size, GLenum type, GLsizei stride, GLsizei count, void *ptr ) ; ++void xglTexEnvf ( GLenum target, GLenum pname, GLfloat param ) ; ++void xglTexEnvfv ( GLenum target, GLenum pname, GLfloat *params ) ; ++void xglTexEnvi ( GLenum target, GLenum pname, GLint param ) ; ++void xglTexEnviv ( GLenum target, GLenum pname, GLint *params ) ; ++void xglTexGend ( GLenum coord, GLenum pname, GLdouble param ) ; ++void xglTexGendv ( GLenum coord, GLenum pname, GLdouble *params ) ; ++void xglTexGenf ( GLenum coord, GLenum pname, GLfloat param ) ; ++void xglTexGenfv ( GLenum coord, GLenum pname, GLfloat *params ) ; ++void xglTexGeni ( GLenum coord, GLenum pname, GLint param ) ; ++void xglTexGeniv ( GLenum coord, GLenum pname, GLint *params ) ; ++void xglTexImage1D ( GLenum target, GLint level, GLint components, GLsizei width, GLint border, GLenum format, GLenum type, GLvoid *pixels ) ; ++void xglTexImage2D ( GLenum target, GLint level, GLint components, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid *pixels ) ; ++void xglTexParameterf ( GLenum target, GLenum pname, GLfloat param ) ; ++void xglTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) ; ++void xglTexParameteri ( GLenum target, GLenum pname, GLint param ) ; ++void xglTexParameteriv ( GLenum target, GLenum pname, GLint *params ) ; ++void xglTranslated ( GLdouble x, GLdouble y, GLdouble z ) ; ++void xglTranslatef ( GLfloat x, GLfloat y, GLfloat z ) ; ++void xglVertex2d ( GLdouble x, GLdouble y ) ; ++void xglVertex2dv ( GLdouble *v ) ; ++void xglVertex2f ( GLfloat x, GLfloat y ) ; ++void xglVertex2fv ( GLfloat *v ) ; ++void xglVertex2i ( GLint x, GLint y ) ; ++void xglVertex2iv ( GLint *v ) ; ++void xglVertex2s ( GLshort x, GLshort y ) ; ++void xglVertex2sv ( GLshort *v ) ; ++void xglVertex3d ( GLdouble x, GLdouble y, GLdouble z ) ; ++void xglVertex3dv ( GLdouble *v ) ; ++void xglVertex3f ( GLfloat x, GLfloat y, GLfloat z ) ; ++void xglVertex3fv ( GLfloat *v ) ; ++void xglVertex3i ( GLint x, GLint y, GLint z ) ; ++void xglVertex3iv ( GLint *v ) ; ++void xglVertex3s ( GLshort x, GLshort y, GLshort z ) ; ++void xglVertex3sv ( GLshort *v ) ; ++void xglVertex4d ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ) ; ++void xglVertex4dv ( GLdouble *v ) ; ++void xglVertex4f ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) ; ++void xglVertex4fv ( GLfloat *v ) ; ++void xglVertex4i ( GLint x, GLint y, GLint z, GLint w ) ; ++void xglVertex4iv ( GLint *v ) ; ++void xglVertex4s ( GLshort x, GLshort y, GLshort z, GLshort w ) ; ++void xglVertex4sv ( GLshort *v ) ; ++void xglVertexPointerEXT( GLint size, GLenum type, GLsizei stride, GLsizei count, void *ptr ) ; ++void xglViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) ; ++ ++void xglutAddMenuEntry ( char *label, int value ) ; ++void xglutAttachMenu ( int button ) ; ++int xglutCreateMenu ( void (*)(int) ) ; ++int xglutCreateWindow ( char *title ) ; ++void xglutDisplayFunc ( void (*)(void) ) ; ++void xglutIdleFunc ( void (*)(void) ) ; ++void xglutInit ( int *argcp, char **argv ) ; ++void xglutInitDisplayMode ( unsigned int mode ) ; ++void xglutInitWindowPosition ( int x, int y ) ; ++void xglutInitWindowSize ( int width, int height ) ; ++void xglutKeyboardFunc ( void (*)(unsigned char key, int x, int y) ) ; ++void xglutMainLoopUpdate () ; ++void xglutPostRedisplay () ; ++void xglutPreMainLoop () ; ++void xglutReshapeFunc ( void (*)(int width, int height) ) ; ++void xglutSwapBuffers () ; ++ ++GLboolean xglAreTexturesResident( GLsizei n, GLuint *textures, GLboolean *residences ) ; ++GLboolean xglIsTexture ( GLuint texture ) ; ++void xglBindTexture ( GLenum target, GLuint texture ) ; ++void xglDeleteTextures ( GLsizei n, GLuint *textures ) ; ++void xglGenTextures ( GLsizei n, GLuint *textures ) ; ++void xglPrioritizeTextures ( GLsizei n, GLuint *textures, GLclampf *priorities ) ; ++ ++GLboolean xglAreTexturesResidentEXT ( GLsizei n, GLuint *textures, GLboolean *residences ) ; ++GLboolean xglIsTextureEXT ( GLuint texture ) ; ++void xglBindTextureEXT ( GLenum target, GLuint texture ) ; ++void xglDeleteTexturesEXT ( GLsizei n, GLuint *textures ) ; ++void xglGenTexturesEXT ( GLsizei n, GLuint *textures ) ; ++void xglPrioritizeTexturesEXT ( GLsizei n, GLuint *textures, GLclampf *priorities ) ; ++ ++#endif ++ ++ ++#ifdef __cplusplus ++} ++#endif ++ ++ ++#endif /* _XGL_H */ diff --cc simgear/xgl/xglUtils.c index 00000000,00000000..d781fa23 new file mode 100644 --- /dev/null +++ b/simgear/xgl/xglUtils.c @@@ -1,0 -1,0 +1,682 @@@ ++ ++#ifdef HAVE_CONFIG_H ++# include ++#endif ++ ++#include ++#include ++#include ++ ++#if !defined( WIN32 ) ++# if !defined( HAVE_STL_SGI_PORT ) && !defined( __MWERKS__ ) ++// Avoid malloc with STLport and MSL ++# include ++# endif ++#endif ++ ++#ifdef HAVE_UNISTD_H ++# include ++#endif ++ ++ ++#include "xgl.h" ++ ++#ifndef TRUE ++#define TRUE 1 ++#define FALSE 0 ++#endif ++ ++int xglTraceOn = TRUE ; ++ ++FILE *xglTraceFd = NULL; ++ ++struct GLenumLookup ++{ ++ GLenum val ; ++ char *name ; ++} ; ++ ++static struct GLenumLookup glenum_string [] = ++{ ++/* ++ Due to ambiguity - these are not in the table... ++ ++ GL_NONE = , GL_ZERO = GL_FALSE = GL_POINTS = 0 ++ GL_ONE = , GL_TRUE = GL_LINES = 1 ++*/ ++ { GL_2D ,"GL_2D" }, ++ { GL_2_BYTES ,"GL_2_BYTES" }, ++ { GL_3D ,"GL_3D" }, ++ { GL_3D_COLOR ,"GL_3D_COLOR" }, ++ { GL_3D_COLOR_TEXTURE ,"GL_3D_COLOR_TEXTURE" }, ++ { GL_3_BYTES ,"GL_3_BYTES" }, ++ { GL_4D_COLOR_TEXTURE ,"GL_4D_COLOR_TEXTURE" }, ++ { GL_4_BYTES ,"GL_4_BYTES" }, ++ { GL_ACCUM ,"GL_ACCUM" }, ++ { GL_ACCUM_ALPHA_BITS ,"GL_ACCUM_ALPHA_BITS" }, ++ { GL_ACCUM_BLUE_BITS ,"GL_ACCUM_BLUE_BITS" }, ++ { GL_ACCUM_CLEAR_VALUE ,"GL_ACCUM_CLEAR_VALUE" }, ++ { GL_ACCUM_GREEN_BITS ,"GL_ACCUM_GREEN_BITS" }, ++ { GL_ACCUM_RED_BITS ,"GL_ACCUM_RED_BITS" }, ++ { GL_ADD ,"GL_ADD" }, ++ { GL_ALPHA ,"GL_ALPHA" }, ++ { GL_ALPHA_BIAS ,"GL_ALPHA_BIAS" }, ++ { GL_ALPHA_BITS ,"GL_ALPHA_BITS" }, ++ { GL_ALPHA_SCALE ,"GL_ALPHA_SCALE" }, ++ { GL_ALPHA_TEST ,"GL_ALPHA_TEST" }, ++ { GL_ALPHA_TEST_FUNC ,"GL_ALPHA_TEST_FUNC" }, ++ { GL_ALPHA_TEST_REF ,"GL_ALPHA_TEST_REF" }, ++ { GL_ALWAYS ,"GL_ALWAYS" }, ++ { GL_AMBIENT ,"GL_AMBIENT" }, ++ { GL_AMBIENT_AND_DIFFUSE ,"GL_AMBIENT_AND_DIFFUSE" }, ++ { GL_AND ,"GL_AND" }, ++ { GL_AND_INVERTED ,"GL_AND_INVERTED" }, ++ { GL_AND_REVERSE ,"GL_AND_REVERSE" }, ++ { GL_ATTRIB_STACK_DEPTH ,"GL_ATTRIB_STACK_DEPTH" }, ++ { GL_AUTO_NORMAL ,"GL_AUTO_NORMAL" }, ++ { GL_AUX0 ,"GL_AUX0" }, ++ { GL_AUX1 ,"GL_AUX1" }, ++ { GL_AUX2 ,"GL_AUX2" }, ++ { GL_AUX3 ,"GL_AUX3" }, ++ { GL_AUX_BUFFERS ,"GL_AUX_BUFFERS" }, ++ { GL_BACK ,"GL_BACK" }, ++ { GL_BACK_LEFT ,"GL_BACK_LEFT" }, ++ { GL_BACK_RIGHT ,"GL_BACK_RIGHT" }, ++ { GL_BITMAP ,"GL_BITMAP" }, ++ { GL_BITMAP_TOKEN ,"GL_BITMAP_TOKEN" }, ++ { GL_BLEND ,"GL_BLEND" }, ++ { GL_BLEND_DST ,"GL_BLEND_DST" }, ++#ifdef GL_BLEND_COLOR_EXT ++ { GL_BLEND_COLOR_EXT ,"GL_BLEND_COLOR_EXT" }, ++#endif ++#ifdef GL_BLEND_EQUATION_EXT ++ { GL_BLEND_EQUATION_EXT ,"GL_BLEND_EQUATION_EXT" }, ++#endif ++ { GL_BLEND_SRC ,"GL_BLEND_SRC" }, ++ { GL_BLUE ,"GL_BLUE" }, ++ { GL_BLUE_BIAS ,"GL_BLUE_BIAS" }, ++ { GL_BLUE_BITS ,"GL_BLUE_BITS" }, ++ { GL_BLUE_SCALE ,"GL_BLUE_SCALE" }, ++ { GL_BYTE ,"GL_BYTE" }, ++ { GL_CCW ,"GL_CCW" }, ++ { GL_CLAMP ,"GL_CLAMP" }, ++ { GL_CLEAR ,"GL_CLEAR" }, ++ { GL_CLIP_PLANE0 ,"GL_CLIP_PLANE0" }, ++ { GL_CLIP_PLANE1 ,"GL_CLIP_PLANE1" }, ++ { GL_CLIP_PLANE2 ,"GL_CLIP_PLANE2" }, ++ { GL_CLIP_PLANE3 ,"GL_CLIP_PLANE3" }, ++ { GL_CLIP_PLANE4 ,"GL_CLIP_PLANE4" }, ++ { GL_CLIP_PLANE5 ,"GL_CLIP_PLANE5" }, ++ { GL_COEFF ,"GL_COEFF" }, ++ { GL_COLOR ,"GL_COLOR" }, ++#ifdef GL_COLOR_ARRAY_EXT ++ { GL_COLOR_ARRAY_COUNT_EXT ,"GL_COLOR_ARRAY_COUNT_EXT" }, ++ { GL_COLOR_ARRAY_EXT ,"GL_COLOR_ARRAY_EXT" }, ++ { GL_COLOR_ARRAY_POINTER_EXT ,"GL_COLOR_ARRAY_POINTER_EXT" }, ++ { GL_COLOR_ARRAY_SIZE_EXT ,"GL_COLOR_ARRAY_SIZE_EXT" }, ++ { GL_COLOR_ARRAY_STRIDE_EXT ,"GL_COLOR_ARRAY_STRIDE_EXT" }, ++ { GL_COLOR_ARRAY_TYPE_EXT ,"GL_COLOR_ARRAY_TYPE_EXT" }, ++#endif ++ { GL_COLOR_CLEAR_VALUE ,"GL_COLOR_CLEAR_VALUE" }, ++ { GL_COLOR_INDEX ,"GL_COLOR_INDEX" }, ++ { GL_COLOR_INDEXES ,"GL_COLOR_INDEXES" }, ++ { GL_COLOR_MATERIAL ,"GL_COLOR_MATERIAL" }, ++ { GL_COLOR_MATERIAL_FACE ,"GL_COLOR_MATERIAL_FACE" }, ++ { GL_COLOR_MATERIAL_PARAMETER ,"GL_COLOR_MATERIAL_PARAMETER" }, ++ { GL_COLOR_WRITEMASK ,"GL_COLOR_WRITEMASK" }, ++ { GL_COMPILE ,"GL_COMPILE" }, ++ { GL_COMPILE_AND_EXECUTE ,"GL_COMPILE_AND_EXECUTE" }, ++#ifdef GL_CONSTANT_ALPHA_EXT ++ { GL_CONSTANT_ALPHA_EXT ,"GL_CONSTANT_ALPHA_EXT" }, ++#endif ++ { GL_CONSTANT_ATTENUATION ,"GL_CONSTANT_ATTENUATION" }, ++#ifdef GL_CONSTANT_COLOR_EXT ++ { GL_CONSTANT_COLOR_EXT ,"GL_CONSTANT_COLOR_EXT" }, ++#endif ++ { GL_COPY ,"GL_COPY" }, ++ { GL_COPY_INVERTED ,"GL_COPY_INVERTED" }, ++ { GL_COPY_PIXEL_TOKEN ,"GL_COPY_PIXEL_TOKEN" }, ++ { GL_CULL_FACE ,"GL_CULL_FACE" }, ++ { GL_CULL_FACE_MODE ,"GL_CULL_FACE_MODE" }, ++ { GL_CURRENT_COLOR ,"GL_CURRENT_COLOR" }, ++ { GL_CURRENT_INDEX ,"GL_CURRENT_INDEX" }, ++ { GL_CURRENT_NORMAL ,"GL_CURRENT_NORMAL" }, ++ { GL_CURRENT_RASTER_COLOR ,"GL_CURRENT_RASTER_COLOR" }, ++ { GL_CURRENT_RASTER_DISTANCE ,"GL_CURRENT_RASTER_DISTANCE" }, ++ { GL_CURRENT_RASTER_INDEX ,"GL_CURRENT_RASTER_INDEX" }, ++ { GL_CURRENT_RASTER_POSITION ,"GL_CURRENT_RASTER_POSITION" }, ++ { GL_CURRENT_RASTER_POSITION_VALID,"GL_CURRENT_RASTER_POSITION_VALID" }, ++ { GL_CURRENT_RASTER_TEXTURE_COORDS,"GL_CURRENT_RASTER_TEXTURE_COORDS" }, ++ { GL_CURRENT_TEXTURE_COORDS ,"GL_CURRENT_TEXTURE_COORDS" }, ++ { GL_CW ,"GL_CW" }, ++ { GL_DECAL ,"GL_DECAL" }, ++ { GL_DECR ,"GL_DECR" }, ++ { GL_DEPTH ,"GL_DEPTH" }, ++ { GL_DEPTH_BIAS ,"GL_DEPTH_BIAS" }, ++ { GL_DEPTH_BITS ,"GL_DEPTH_BITS" }, ++ { GL_DEPTH_CLEAR_VALUE ,"GL_DEPTH_CLEAR_VALUE" }, ++ { GL_DEPTH_COMPONENT ,"GL_DEPTH_COMPONENT" }, ++ { GL_DEPTH_FUNC ,"GL_DEPTH_FUNC" }, ++ { GL_DEPTH_RANGE ,"GL_DEPTH_RANGE" }, ++ { GL_DEPTH_SCALE ,"GL_DEPTH_SCALE" }, ++ { GL_DEPTH_TEST ,"GL_DEPTH_TEST" }, ++ { GL_DEPTH_WRITEMASK ,"GL_DEPTH_WRITEMASK" }, ++ { GL_DIFFUSE ,"GL_DIFFUSE" }, ++ { GL_DITHER ,"GL_DITHER" }, ++ { GL_DOMAIN ,"GL_DOMAIN" }, ++ { GL_DONT_CARE ,"GL_DONT_CARE" }, ++ { GL_DOUBLEBUFFER ,"GL_DOUBLEBUFFER" }, ++#ifdef GL_DOUBLE_EXT ++ { GL_DOUBLE_EXT ,"GL_DOUBLE_EXT" }, ++#endif ++ { GL_DRAW_BUFFER ,"GL_DRAW_BUFFER" }, ++ { GL_DRAW_PIXEL_TOKEN ,"GL_DRAW_PIXEL_TOKEN" }, ++ { GL_DST_ALPHA ,"GL_DST_ALPHA" }, ++ { GL_DST_COLOR ,"GL_DST_COLOR" }, ++ { GL_EDGE_FLAG ,"GL_EDGE_FLAG" }, ++#ifdef GL_EDGE_FLAG_ARRAY_EXT ++ { GL_EDGE_FLAG_ARRAY_COUNT_EXT,"GL_EDGE_FLAG_ARRAY_COUNT_EXT" }, ++ { GL_EDGE_FLAG_ARRAY_EXT ,"GL_EDGE_FLAG_ARRAY_EXT" }, ++ { GL_EDGE_FLAG_ARRAY_POINTER_EXT,"GL_EDGE_FLAG_ARRAY_POINTER_EXT" }, ++ { GL_EDGE_FLAG_ARRAY_STRIDE_EXT,"GL_EDGE_FLAG_ARRAY_STRIDE_EXT" }, ++#endif ++ { GL_EMISSION ,"GL_EMISSION" }, ++ { GL_EQUAL ,"GL_EQUAL" }, ++ { GL_EQUIV ,"GL_EQUIV" }, ++ { GL_EXP ,"GL_EXP" }, ++ { GL_EXP2 ,"GL_EXP2" }, ++ { GL_EXTENSIONS ,"GL_EXTENSIONS" }, ++ { GL_EYE_LINEAR ,"GL_EYE_LINEAR" }, ++ { GL_EYE_PLANE ,"GL_EYE_PLANE" }, ++ { GL_FASTEST ,"GL_FASTEST" }, ++ { GL_FEEDBACK ,"GL_FEEDBACK" }, ++ { GL_FILL ,"GL_FILL" }, ++ { GL_FLAT ,"GL_FLAT" }, ++ { GL_FLOAT ,"GL_FLOAT" }, ++ { GL_FOG ,"GL_FOG" }, ++ { GL_FOG_COLOR ,"GL_FOG_COLOR" }, ++ { GL_FOG_DENSITY ,"GL_FOG_DENSITY" }, ++ { GL_FOG_END ,"GL_FOG_END" }, ++ { GL_FOG_HINT ,"GL_FOG_HINT" }, ++ { GL_FOG_INDEX ,"GL_FOG_INDEX" }, ++ { GL_FOG_MODE ,"GL_FOG_MODE" }, ++ { GL_FOG_START ,"GL_FOG_START" }, ++ { GL_FRONT ,"GL_FRONT" }, ++ { GL_FRONT_AND_BACK ,"GL_FRONT_AND_BACK" }, ++ { GL_FRONT_FACE ,"GL_FRONT_FACE" }, ++ { GL_FRONT_LEFT ,"GL_FRONT_LEFT" }, ++ { GL_FRONT_RIGHT ,"GL_FRONT_RIGHT" }, ++#ifdef GL_FUNC_ADD_EXT ++ { GL_FUNC_ADD_EXT ,"GL_FUNC_ADD_EXT" }, ++ { GL_FUNC_REVERSE_SUBTRACT_EXT,"GL_FUNC_REVERSE_SUBTRACT_EXT" }, ++ { GL_FUNC_SUBTRACT_EXT ,"GL_FUNC_SUBTRACT_EXT" }, ++#endif ++ { GL_GEQUAL ,"GL_GEQUAL" }, ++ { GL_GREATER ,"GL_GREATER" }, ++ { GL_GREEN ,"GL_GREEN" }, ++ { GL_GREEN_BIAS ,"GL_GREEN_BIAS" }, ++ { GL_GREEN_BITS ,"GL_GREEN_BITS" }, ++ { GL_GREEN_SCALE ,"GL_GREEN_SCALE" }, ++ { GL_INCR ,"GL_INCR" }, ++#ifdef GL_INDEX_ARRAY_EXT ++ { GL_INDEX_ARRAY_COUNT_EXT ,"GL_INDEX_ARRAY_COUNT_EXT" }, ++ { GL_INDEX_ARRAY_EXT ,"GL_INDEX_ARRAY_EXT" }, ++ { GL_INDEX_ARRAY_POINTER_EXT ,"GL_INDEX_ARRAY_POINTER_EXT" }, ++ { GL_INDEX_ARRAY_STRIDE_EXT ,"GL_INDEX_ARRAY_STRIDE_EXT" }, ++ { GL_INDEX_ARRAY_TYPE_EXT ,"GL_INDEX_ARRAY_TYPE_EXT" }, ++#endif ++ { GL_INDEX_BITS ,"GL_INDEX_BITS" }, ++ { GL_INDEX_CLEAR_VALUE ,"GL_INDEX_CLEAR_VALUE" }, ++ { GL_INDEX_MODE ,"GL_INDEX_MODE" }, ++ { GL_INDEX_OFFSET ,"GL_INDEX_OFFSET" }, ++ { GL_INDEX_SHIFT ,"GL_INDEX_SHIFT" }, ++ { GL_INDEX_WRITEMASK ,"GL_INDEX_WRITEMASK" }, ++ { GL_INT ,"GL_INT" }, ++ { GL_INVALID_ENUM ,"GL_INVALID_ENUM" }, ++ { GL_INVALID_OPERATION ,"GL_INVALID_OPERATION" }, ++ { GL_INVALID_VALUE ,"GL_INVALID_VALUE" }, ++ { GL_INVERT ,"GL_INVERT" }, ++ { GL_KEEP ,"GL_KEEP" }, ++ { GL_LEFT ,"GL_LEFT" }, ++ { GL_LEQUAL ,"GL_LEQUAL" }, ++ { GL_LESS ,"GL_LESS" }, ++ { GL_LIGHT0 ,"GL_LIGHT0" }, ++ { GL_LIGHT1 ,"GL_LIGHT1" }, ++ { GL_LIGHT2 ,"GL_LIGHT2" }, ++ { GL_LIGHT3 ,"GL_LIGHT3" }, ++ { GL_LIGHT4 ,"GL_LIGHT4" }, ++ { GL_LIGHT5 ,"GL_LIGHT5" }, ++ { GL_LIGHT6 ,"GL_LIGHT6" }, ++ { GL_LIGHT7 ,"GL_LIGHT7" }, ++ { GL_LIGHTING ,"GL_LIGHTING" }, ++ { GL_LIGHT_MODEL_AMBIENT ,"GL_LIGHT_MODEL_AMBIENT" }, ++ { GL_LIGHT_MODEL_LOCAL_VIEWER ,"GL_LIGHT_MODEL_LOCAL_VIEWER" }, ++ { GL_LIGHT_MODEL_TWO_SIDE ,"GL_LIGHT_MODEL_TWO_SIDE" }, ++ { GL_LINE ,"GL_LINE" }, ++ { GL_LINEAR ,"GL_LINEAR" }, ++ { GL_LINEAR_ATTENUATION ,"GL_LINEAR_ATTENUATION" }, ++ { GL_LINEAR_MIPMAP_LINEAR ,"GL_LINEAR_MIPMAP_LINEAR" }, ++ { GL_LINEAR_MIPMAP_NEAREST ,"GL_LINEAR_MIPMAP_NEAREST" }, ++ { GL_LINE_LOOP ,"GL_LINE_LOOP" }, ++ { GL_LINE_RESET_TOKEN ,"GL_LINE_RESET_TOKEN" }, ++ { GL_LINE_SMOOTH ,"GL_LINE_SMOOTH" }, ++ { GL_LINE_SMOOTH_HINT ,"GL_LINE_SMOOTH_HINT" }, ++ { GL_LINE_STIPPLE ,"GL_LINE_STIPPLE" }, ++ { GL_LINE_STIPPLE_PATTERN ,"GL_LINE_STIPPLE_PATTERN" }, ++ { GL_LINE_STIPPLE_REPEAT ,"GL_LINE_STIPPLE_REPEAT" }, ++ { GL_LINE_STRIP ,"GL_LINE_STRIP" }, ++ { GL_LINE_TOKEN ,"GL_LINE_TOKEN" }, ++ { GL_LINE_WIDTH ,"GL_LINE_WIDTH" }, ++ { GL_LINE_WIDTH_GRANULARITY ,"GL_LINE_WIDTH_GRANULARITY" }, ++ { GL_LINE_WIDTH_RANGE ,"GL_LINE_WIDTH_RANGE" }, ++ { GL_LIST_BASE ,"GL_LIST_BASE" }, ++ { GL_LIST_INDEX ,"GL_LIST_INDEX" }, ++ { GL_LIST_MODE ,"GL_LIST_MODE" }, ++ { GL_LOAD ,"GL_LOAD" }, ++ { GL_LOGIC_OP ,"GL_LOGIC_OP" }, ++ { GL_LOGIC_OP_MODE ,"GL_LOGIC_OP_MODE" }, ++ { GL_LUMINANCE ,"GL_LUMINANCE" }, ++ { GL_LUMINANCE_ALPHA ,"GL_LUMINANCE_ALPHA" }, ++ { GL_MAP1_COLOR_4 ,"GL_MAP1_COLOR_4" }, ++ { GL_MAP1_GRID_DOMAIN ,"GL_MAP1_GRID_DOMAIN" }, ++ { GL_MAP1_GRID_SEGMENTS ,"GL_MAP1_GRID_SEGMENTS" }, ++ { GL_MAP1_INDEX ,"GL_MAP1_INDEX" }, ++ { GL_MAP1_NORMAL ,"GL_MAP1_NORMAL" }, ++ { GL_MAP1_TEXTURE_COORD_1 ,"GL_MAP1_TEXTURE_COORD_1" }, ++ { GL_MAP1_TEXTURE_COORD_2 ,"GL_MAP1_TEXTURE_COORD_2" }, ++ { GL_MAP1_TEXTURE_COORD_3 ,"GL_MAP1_TEXTURE_COORD_3" }, ++ { GL_MAP1_TEXTURE_COORD_4 ,"GL_MAP1_TEXTURE_COORD_4" }, ++ { GL_MAP1_VERTEX_3 ,"GL_MAP1_VERTEX_3" }, ++ { GL_MAP1_VERTEX_4 ,"GL_MAP1_VERTEX_4" }, ++ { GL_MAP2_COLOR_4 ,"GL_MAP2_COLOR_4" }, ++ { GL_MAP2_GRID_DOMAIN ,"GL_MAP2_GRID_DOMAIN" }, ++ { GL_MAP2_GRID_SEGMENTS ,"GL_MAP2_GRID_SEGMENTS" }, ++ { GL_MAP2_INDEX ,"GL_MAP2_INDEX" }, ++ { GL_MAP2_NORMAL ,"GL_MAP2_NORMAL" }, ++ { GL_MAP2_TEXTURE_COORD_1 ,"GL_MAP2_TEXTURE_COORD_1" }, ++ { GL_MAP2_TEXTURE_COORD_2 ,"GL_MAP2_TEXTURE_COORD_2" }, ++ { GL_MAP2_TEXTURE_COORD_3 ,"GL_MAP2_TEXTURE_COORD_3" }, ++ { GL_MAP2_TEXTURE_COORD_4 ,"GL_MAP2_TEXTURE_COORD_4" }, ++ { GL_MAP2_VERTEX_3 ,"GL_MAP2_VERTEX_3" }, ++ { GL_MAP2_VERTEX_4 ,"GL_MAP2_VERTEX_4" }, ++ { GL_MAP_COLOR ,"GL_MAP_COLOR" }, ++ { GL_MAP_STENCIL ,"GL_MAP_STENCIL" }, ++ { GL_MATRIX_MODE ,"GL_MATRIX_MODE" }, ++ { GL_MAX_ATTRIB_STACK_DEPTH ,"GL_MAX_ATTRIB_STACK_DEPTH" }, ++ { GL_MAX_CLIP_PLANES ,"GL_MAX_CLIP_PLANES" }, ++ { GL_MAX_EVAL_ORDER ,"GL_MAX_EVAL_ORDER" }, ++#ifdef GL_MAX_EXT ++ { GL_MAX_EXT ,"GL_MAX_EXT" }, ++#endif ++ { GL_MAX_LIGHTS ,"GL_MAX_LIGHTS" }, ++ { GL_MAX_LIST_NESTING ,"GL_MAX_LIST_NESTING" }, ++ { GL_MAX_MODELVIEW_STACK_DEPTH,"GL_MAX_MODELVIEW_STACK_DEPTH" }, ++ { GL_MAX_NAME_STACK_DEPTH ,"GL_MAX_NAME_STACK_DEPTH" }, ++ { GL_MAX_PIXEL_MAP_TABLE ,"GL_MAX_PIXEL_MAP_TABLE" }, ++ { GL_MAX_PROJECTION_STACK_DEPTH,"GL_MAX_PROJECTION_STACK_DEPTH" }, ++ { GL_MAX_TEXTURE_SIZE ,"GL_MAX_TEXTURE_SIZE" }, ++ { GL_MAX_TEXTURE_STACK_DEPTH ,"GL_MAX_TEXTURE_STACK_DEPTH" }, ++ { GL_MAX_VIEWPORT_DIMS ,"GL_MAX_VIEWPORT_DIMS" }, ++#ifdef GL_MIN_EXT ++ { GL_MIN_EXT ,"GL_MIN_EXT" }, ++#endif ++ { GL_MODELVIEW ,"GL_MODELVIEW" }, ++ { GL_MODELVIEW_MATRIX ,"GL_MODELVIEW_MATRIX" }, ++ { GL_MODELVIEW_STACK_DEPTH ,"GL_MODELVIEW_STACK_DEPTH" }, ++ { GL_MODULATE ,"GL_MODULATE" }, ++ { GL_MULT ,"GL_MULT" }, ++ { GL_NAME_STACK_DEPTH ,"GL_NAME_STACK_DEPTH" }, ++ { GL_NAND ,"GL_NAND" }, ++ { GL_NEAREST ,"GL_NEAREST" }, ++ { GL_NEAREST_MIPMAP_LINEAR ,"GL_NEAREST_MIPMAP_LINEAR" }, ++ { GL_NEAREST_MIPMAP_NEAREST ,"GL_NEAREST_MIPMAP_NEAREST" }, ++ { GL_NEVER ,"GL_NEVER" }, ++ { GL_NICEST ,"GL_NICEST" }, ++ { GL_NOOP ,"GL_NOOP" }, ++ { GL_NOR ,"GL_NOR" }, ++ { GL_NORMALIZE ,"GL_NORMALIZE" }, ++#ifdef GL_NORMAL_ARRAY_EXT ++ { GL_NORMAL_ARRAY_COUNT_EXT ,"GL_NORMAL_ARRAY_COUNT_EXT" }, ++ { GL_NORMAL_ARRAY_EXT ,"GL_NORMAL_ARRAY_EXT" }, ++ { GL_NORMAL_ARRAY_POINTER_EXT ,"GL_NORMAL_ARRAY_POINTER_EXT" }, ++ { GL_NORMAL_ARRAY_STRIDE_EXT ,"GL_NORMAL_ARRAY_STRIDE_EXT" }, ++ { GL_NORMAL_ARRAY_TYPE_EXT ,"GL_NORMAL_ARRAY_TYPE_EXT" }, ++#endif ++ { GL_NOTEQUAL ,"GL_NOTEQUAL" }, ++ { GL_OBJECT_LINEAR ,"GL_OBJECT_LINEAR" }, ++ { GL_OBJECT_PLANE ,"GL_OBJECT_PLANE" }, ++#ifdef GL_ONE_MINUS_CONSTANT_ALPHA_EXT ++ { GL_ONE_MINUS_CONSTANT_ALPHA_EXT,"GL_ONE_MINUS_CONSTANT_ALPHA_EXT" }, ++ { GL_ONE_MINUS_CONSTANT_COLOR_EXT,"GL_ONE_MINUS_CONSTANT_COLOR_EXT" }, ++#endif ++ { GL_ONE_MINUS_DST_ALPHA ,"GL_ONE_MINUS_DST_ALPHA" }, ++ { GL_ONE_MINUS_DST_COLOR ,"GL_ONE_MINUS_DST_COLOR" }, ++ { GL_ONE_MINUS_SRC_ALPHA ,"GL_ONE_MINUS_SRC_ALPHA" }, ++ { GL_ONE_MINUS_SRC_COLOR ,"GL_ONE_MINUS_SRC_COLOR" }, ++ { GL_OR ,"GL_OR" }, ++ { GL_ORDER ,"GL_ORDER" }, ++ { GL_OR_INVERTED ,"GL_OR_INVERTED" }, ++ { GL_OR_REVERSE ,"GL_OR_REVERSE" }, ++ { GL_OUT_OF_MEMORY ,"GL_OUT_OF_MEMORY" }, ++ { GL_PACK_ALIGNMENT ,"GL_PACK_ALIGNMENT" }, ++ { GL_PACK_LSB_FIRST ,"GL_PACK_LSB_FIRST" }, ++ { GL_PACK_ROW_LENGTH ,"GL_PACK_ROW_LENGTH" }, ++ { GL_PACK_SKIP_PIXELS ,"GL_PACK_SKIP_PIXELS" }, ++ { GL_PACK_SKIP_ROWS ,"GL_PACK_SKIP_ROWS" }, ++ { GL_PACK_SWAP_BYTES ,"GL_PACK_SWAP_BYTES" }, ++ { GL_PASS_THROUGH_TOKEN ,"GL_PASS_THROUGH_TOKEN" }, ++ { GL_PERSPECTIVE_CORRECTION_HINT,"GL_PERSPECTIVE_CORRECTION_HINT" }, ++ { GL_PIXEL_MAP_A_TO_A ,"GL_PIXEL_MAP_A_TO_A" }, ++ { GL_PIXEL_MAP_A_TO_A_SIZE ,"GL_PIXEL_MAP_A_TO_A_SIZE" }, ++ { GL_PIXEL_MAP_B_TO_B ,"GL_PIXEL_MAP_B_TO_B" }, ++ { GL_PIXEL_MAP_B_TO_B_SIZE ,"GL_PIXEL_MAP_B_TO_B_SIZE" }, ++ { GL_PIXEL_MAP_G_TO_G ,"GL_PIXEL_MAP_G_TO_G" }, ++ { GL_PIXEL_MAP_G_TO_G_SIZE ,"GL_PIXEL_MAP_G_TO_G_SIZE" }, ++ { GL_PIXEL_MAP_I_TO_A ,"GL_PIXEL_MAP_I_TO_A" }, ++ { GL_PIXEL_MAP_I_TO_A_SIZE ,"GL_PIXEL_MAP_I_TO_A_SIZE" }, ++ { GL_PIXEL_MAP_I_TO_B ,"GL_PIXEL_MAP_I_TO_B" }, ++ { GL_PIXEL_MAP_I_TO_B_SIZE ,"GL_PIXEL_MAP_I_TO_B_SIZE" }, ++ { GL_PIXEL_MAP_I_TO_G ,"GL_PIXEL_MAP_I_TO_G" }, ++ { GL_PIXEL_MAP_I_TO_G_SIZE ,"GL_PIXEL_MAP_I_TO_G_SIZE" }, ++ { GL_PIXEL_MAP_I_TO_I ,"GL_PIXEL_MAP_I_TO_I" }, ++ { GL_PIXEL_MAP_I_TO_I_SIZE ,"GL_PIXEL_MAP_I_TO_I_SIZE" }, ++ { GL_PIXEL_MAP_I_TO_R ,"GL_PIXEL_MAP_I_TO_R" }, ++ { GL_PIXEL_MAP_I_TO_R_SIZE ,"GL_PIXEL_MAP_I_TO_R_SIZE" }, ++ { GL_PIXEL_MAP_R_TO_R ,"GL_PIXEL_MAP_R_TO_R" }, ++ { GL_PIXEL_MAP_R_TO_R_SIZE ,"GL_PIXEL_MAP_R_TO_R_SIZE" }, ++ { GL_PIXEL_MAP_S_TO_S ,"GL_PIXEL_MAP_S_TO_S" }, ++ { GL_PIXEL_MAP_S_TO_S_SIZE ,"GL_PIXEL_MAP_S_TO_S_SIZE" }, ++ { GL_POINT ,"GL_POINT" }, ++ { GL_POINT_SIZE ,"GL_POINT_SIZE" }, ++ { GL_POINT_SIZE_GRANULARITY ,"GL_POINT_SIZE_GRANULARITY" }, ++ { GL_POINT_SIZE_RANGE ,"GL_POINT_SIZE_RANGE" }, ++ { GL_POINT_SMOOTH ,"GL_POINT_SMOOTH" }, ++ { GL_POINT_SMOOTH_HINT ,"GL_POINT_SMOOTH_HINT" }, ++ { GL_POINT_TOKEN ,"GL_POINT_TOKEN" }, ++ { GL_POLYGON ,"GL_POLYGON" }, ++ { GL_POLYGON_MODE ,"GL_POLYGON_MODE" }, ++ { GL_POLYGON_SMOOTH ,"GL_POLYGON_SMOOTH" }, ++ { GL_POLYGON_SMOOTH_HINT ,"GL_POLYGON_SMOOTH_HINT" }, ++ { GL_POLYGON_STIPPLE ,"GL_POLYGON_STIPPLE" }, ++#ifdef GL_POLYGON_OFFSET_EXT ++ { GL_POLYGON_OFFSET_BIAS_EXT ,"GL_POLYGON_OFFSET_BIAS_EXT" }, ++ { GL_POLYGON_OFFSET_EXT ,"GL_POLYGON_OFFSET_EXT" }, ++ { GL_POLYGON_OFFSET_FACTOR_EXT,"GL_POLYGON_OFFSET_FACTOR_EXT" }, ++#endif ++ { GL_POLYGON_TOKEN ,"GL_POLYGON_TOKEN" }, ++ { GL_POSITION ,"GL_POSITION" }, ++ { GL_PROJECTION ,"GL_PROJECTION" }, ++ { GL_PROJECTION_MATRIX ,"GL_PROJECTION_MATRIX" }, ++ { GL_PROJECTION_STACK_DEPTH ,"GL_PROJECTION_STACK_DEPTH" }, ++ { GL_Q ,"GL_Q" }, ++ { GL_QUADRATIC_ATTENUATION ,"GL_QUADRATIC_ATTENUATION" }, ++ { GL_QUADS ,"GL_QUADS" }, ++ { GL_QUAD_STRIP ,"GL_QUAD_STRIP" }, ++ { GL_R ,"GL_R" }, ++ { GL_READ_BUFFER ,"GL_READ_BUFFER" }, ++ { GL_RED ,"GL_RED" }, ++ { GL_RED_BIAS ,"GL_RED_BIAS" }, ++ { GL_RED_BITS ,"GL_RED_BITS" }, ++ { GL_RED_SCALE ,"GL_RED_SCALE" }, ++ { GL_RENDER ,"GL_RENDER" }, ++ { GL_RENDERER ,"GL_RENDERER" }, ++ { GL_RENDER_MODE ,"GL_RENDER_MODE" }, ++ { GL_REPEAT ,"GL_REPEAT" }, ++ { GL_REPLACE ,"GL_REPLACE" }, ++#ifdef GL_REPLACE_EXT ++ { GL_REPLACE_EXT ,"GL_REPLACE_EXT" }, ++#endif ++ { GL_RETURN ,"GL_RETURN" }, ++ { GL_RGB ,"GL_RGB" }, ++ { GL_RGBA ,"GL_RGBA" }, ++ { GL_RGBA_MODE ,"GL_RGBA_MODE" }, ++ { GL_RIGHT ,"GL_RIGHT" }, ++ { GL_S ,"GL_S" }, ++ { GL_SCISSOR_BOX ,"GL_SCISSOR_BOX" }, ++ { GL_SCISSOR_TEST ,"GL_SCISSOR_TEST" }, ++ { GL_SELECT ,"GL_SELECT" }, ++ { GL_SET ,"GL_SET" }, ++ { GL_SHADE_MODEL ,"GL_SHADE_MODEL" }, ++ { GL_SHININESS ,"GL_SHININESS" }, ++ { GL_SHORT ,"GL_SHORT" }, ++ { GL_SMOOTH ,"GL_SMOOTH" }, ++ { GL_SPECULAR ,"GL_SPECULAR" }, ++ { GL_SPHERE_MAP ,"GL_SPHERE_MAP" }, ++ { GL_SPOT_CUTOFF ,"GL_SPOT_CUTOFF" }, ++ { GL_SPOT_DIRECTION ,"GL_SPOT_DIRECTION" }, ++ { GL_SPOT_EXPONENT ,"GL_SPOT_EXPONENT" }, ++ { GL_SRC_ALPHA ,"GL_SRC_ALPHA" }, ++ { GL_SRC_ALPHA_SATURATE ,"GL_SRC_ALPHA_SATURATE" }, ++ { GL_SRC_COLOR ,"GL_SRC_COLOR" }, ++ { GL_STACK_OVERFLOW ,"GL_STACK_OVERFLOW" }, ++ { GL_STACK_UNDERFLOW ,"GL_STACK_UNDERFLOW" }, ++ { GL_STENCIL ,"GL_STENCIL" }, ++ { GL_STENCIL_BITS ,"GL_STENCIL_BITS" }, ++ { GL_STENCIL_CLEAR_VALUE ,"GL_STENCIL_CLEAR_VALUE" }, ++ { GL_STENCIL_FAIL ,"GL_STENCIL_FAIL" }, ++ { GL_STENCIL_FUNC ,"GL_STENCIL_FUNC" }, ++ { GL_STENCIL_INDEX ,"GL_STENCIL_INDEX" }, ++ { GL_STENCIL_PASS_DEPTH_FAIL ,"GL_STENCIL_PASS_DEPTH_FAIL" }, ++ { GL_STENCIL_PASS_DEPTH_PASS ,"GL_STENCIL_PASS_DEPTH_PASS" }, ++ { GL_STENCIL_REF ,"GL_STENCIL_REF" }, ++ { GL_STENCIL_TEST ,"GL_STENCIL_TEST" }, ++ { GL_STENCIL_VALUE_MASK ,"GL_STENCIL_VALUE_MASK" }, ++ { GL_STENCIL_WRITEMASK ,"GL_STENCIL_WRITEMASK" }, ++ { GL_STEREO ,"GL_STEREO" }, ++ { GL_SUBPIXEL_BITS ,"GL_SUBPIXEL_BITS" }, ++ { GL_T ,"GL_T" }, ++ { GL_TEXTURE ,"GL_TEXTURE" }, ++ { GL_TEXTURE_1D ,"GL_TEXTURE_1D" }, ++ { GL_TEXTURE_2D ,"GL_TEXTURE_2D" }, ++ { GL_TEXTURE_BORDER ,"GL_TEXTURE_BORDER" }, ++ { GL_TEXTURE_BORDER_COLOR ,"GL_TEXTURE_BORDER_COLOR" }, ++ { GL_TEXTURE_COMPONENTS ,"GL_TEXTURE_COMPONENTS" }, ++#ifdef GL_TEXTURE_COORD_ARRAY_EXT ++ { GL_TEXTURE_COORD_ARRAY_COUNT_EXT,"GL_TEXTURE_COORD_ARRAY_COUNT_EXT" }, ++ { GL_TEXTURE_COORD_ARRAY_EXT ,"GL_TEXTURE_COORD_ARRAY_EXT" }, ++ { GL_TEXTURE_COORD_ARRAY_POINTER_EXT,"GL_TEXTURE_COORD_ARRAY_POINTER_EXT" }, ++ { GL_TEXTURE_COORD_ARRAY_SIZE_EXT,"GL_TEXTURE_COORD_ARRAY_SIZE_EXT" }, ++ { GL_TEXTURE_COORD_ARRAY_STRIDE_EXT,"GL_TEXTURE_COORD_ARRAY_STRIDE_EXT" }, ++ { GL_TEXTURE_COORD_ARRAY_TYPE_EXT,"GL_TEXTURE_COORD_ARRAY_TYPE_EXT" }, ++#endif ++ { GL_TEXTURE_ENV ,"GL_TEXTURE_ENV" }, ++ { GL_TEXTURE_ENV_COLOR ,"GL_TEXTURE_ENV_COLOR" }, ++ { GL_TEXTURE_ENV_MODE ,"GL_TEXTURE_ENV_MODE" }, ++ { GL_TEXTURE_GEN_MODE ,"GL_TEXTURE_GEN_MODE" }, ++ { GL_TEXTURE_GEN_Q ,"GL_TEXTURE_GEN_Q" }, ++ { GL_TEXTURE_GEN_R ,"GL_TEXTURE_GEN_R" }, ++ { GL_TEXTURE_GEN_S ,"GL_TEXTURE_GEN_S" }, ++ { GL_TEXTURE_GEN_T ,"GL_TEXTURE_GEN_T" }, ++ { GL_TEXTURE_HEIGHT ,"GL_TEXTURE_HEIGHT" }, ++ { GL_TEXTURE_MAG_FILTER ,"GL_TEXTURE_MAG_FILTER" }, ++ { GL_TEXTURE_MATRIX ,"GL_TEXTURE_MATRIX" }, ++ { GL_TEXTURE_MIN_FILTER ,"GL_TEXTURE_MIN_FILTER" }, ++ { GL_TEXTURE_STACK_DEPTH ,"GL_TEXTURE_STACK_DEPTH" }, ++ { GL_TEXTURE_WIDTH ,"GL_TEXTURE_WIDTH" }, ++ { GL_TEXTURE_WRAP_S ,"GL_TEXTURE_WRAP_S" }, ++ { GL_TEXTURE_WRAP_T ,"GL_TEXTURE_WRAP_T" }, ++ { GL_TRIANGLES ,"GL_TRIANGLES" }, ++ { GL_TRIANGLE_FAN ,"GL_TRIANGLE_FAN" }, ++ { GL_TRIANGLE_STRIP ,"GL_TRIANGLE_STRIP" }, ++ { GL_UNPACK_ALIGNMENT ,"GL_UNPACK_ALIGNMENT" }, ++ { GL_UNPACK_LSB_FIRST ,"GL_UNPACK_LSB_FIRST" }, ++ { GL_UNPACK_ROW_LENGTH ,"GL_UNPACK_ROW_LENGTH" }, ++ { GL_UNPACK_SKIP_PIXELS ,"GL_UNPACK_SKIP_PIXELS" }, ++ { GL_UNPACK_SKIP_ROWS ,"GL_UNPACK_SKIP_ROWS" }, ++ { GL_UNPACK_SWAP_BYTES ,"GL_UNPACK_SWAP_BYTES" }, ++ { GL_UNSIGNED_BYTE ,"GL_UNSIGNED_BYTE" }, ++ { GL_UNSIGNED_INT ,"GL_UNSIGNED_INT" }, ++ { GL_UNSIGNED_SHORT ,"GL_UNSIGNED_SHORT" }, ++ { GL_VENDOR ,"GL_VENDOR" }, ++ { GL_VERSION ,"GL_VERSION" }, ++#ifdef GL_VERTEX_ARRAY_EXT ++ { GL_VERTEX_ARRAY_COUNT_EXT ,"GL_VERTEX_ARRAY_COUNT_EXT" }, ++ { GL_VERTEX_ARRAY_EXT ,"GL_VERTEX_ARRAY_EXT" }, ++ { GL_VERTEX_ARRAY_POINTER_EXT ,"GL_VERTEX_ARRAY_POINTER_EXT" }, ++ { GL_VERTEX_ARRAY_SIZE_EXT ,"GL_VERTEX_ARRAY_SIZE_EXT" }, ++ { GL_VERTEX_ARRAY_STRIDE_EXT ,"GL_VERTEX_ARRAY_STRIDE_EXT" }, ++ { GL_VERTEX_ARRAY_TYPE_EXT ,"GL_VERTEX_ARRAY_TYPE_EXT" }, ++#endif ++ { GL_VIEWPORT ,"GL_VIEWPORT" }, ++ { GL_XOR ,"GL_XOR" }, ++ { GL_ZOOM_X ,"GL_ZOOM_X" }, ++ { GL_ZOOM_Y ,"GL_ZOOM_Y" }, ++ ++ /* Magic end-marker - do not remove! */ ++ { GL_ZERO, NULL } ++} ; ++ ++ ++int xglTraceIsEnabled ( char *gl_function_name ) ++{ ++ static int frameno = 0 ; ++ static int countdown = 0 ; ++ ++ if ( strcmp ( gl_function_name, "glutSwapBuffers" ) == 0 ) ++ { ++ if ( countdown == 0 ) ++ { ++ char s [ 100 ] ; ++ ++ fprintf ( stderr, "\nContinue Tracing after frame %d [Yes,No,Countdown,eXit] ?", ++frameno ) ; ++ gets ( s ) ; ++ ++ if ( s[0] == 'x' ) ++ exit ( 1 ) ; ++ ++ xglTraceOn = ( s[0] != 'n' && s[0] != 'c' ) ; ++ ++ if ( s[0] == 'c' ) ++ { ++ fprintf ( stderr, "\nHow many frames should I wait until I ask again?" ) ; ++ gets ( s ) ; ++ countdown = atoi(s) ; ++ } ++ ++ fprintf ( xglTraceFd, "/* Frame %d - tracing %s */\n", frameno, xglTraceOn ? "ON" : "OFF" ) ; ++ } ++ else ++ countdown-- ; ++ } ++ ++ return xglTraceOn ; ++} ++ ++ ++int xglExecuteIsEnabled ( char *gl_function_name ) ++{ ++ return TRUE ; ++} ++ ++char *xglExpandGLenum ( GLenum x ) ++{ ++ static GLenum last_val = GL_NONE ; ++ static char *last_str = NULL ; ++ char *error_message; ++ int i; ++ ++ /* Due to ambiguity - these are output as numbers... ++ ++ GL_NONE = , GL_ZERO = GL_FALSE = GL_POINTS = 0 ++ GL_ONE = , GL_TRUE = GL_LINES = 1 ++ */ ++ ++ if ( (int) x == 0 ) return "(GLenum) 0" ; ++ if ( (int) x == 1 ) return "(GLenum) 1" ; ++ ++ if ( last_val == x ) return last_str ; ++ ++ for ( i = 0 ; glenum_string [i].name != NULL ; i++ ) ++ if ( glenum_string [i].val == x ) ++ return glenum_string [i].name ; ++ ++ /* ++ WARNING - this will leak memory - but it is an error condition, ++ so I suppose it's acceptable. ++ You can't declare the 'error_message' string as a ++ static - or else double errors will go mis-reported. ++ */ ++ ++ error_message = (char *)malloc( 100 * sizeof(char) ) ; ++ ++ sprintf ( error_message, "(GLenum) 0x%04x /* Illegal? */", (int) x ) ; ++ ++ return error_message ; ++} ++ ++static GLbyte b1 [ 1 ], b2 [ 2 ], b3 [ 3 ], b4 [ 4 ] ; ++static GLdouble d1 [ 1 ], d2 [ 2 ], d3 [ 3 ], d4 [ 4 ] ; ++static GLfloat f1 [ 1 ], f2 [ 2 ], f3 [ 3 ], f4 [ 4 ] ; ++static GLint i1 [ 1 ], i2 [ 2 ], i3 [ 3 ], i4 [ 4 ] ; ++static GLshort s1 [ 1 ], s2 [ 2 ], s3 [ 3 ], s4 [ 4 ] ; ++static GLubyte ub1 [ 1 ], ub2 [ 2 ], ub3 [ 3 ], ub4 [ 4 ] ; ++static GLuint ui1 [ 1 ], ui2 [ 2 ], ui3 [ 3 ], ui4 [ 4 ] ; ++static GLushort us1 [ 1 ], us2 [ 2 ], us3 [ 3 ], us4 [ 4 ] ; ++ ++static GLdouble md [ 16 ] ; ++static GLfloat mf [ 16 ] ; ++ ++GLdouble *xglBuild1dv ( GLdouble v ) { d1[0] = v ; return d1 ; } ++GLfloat *xglBuild1fv ( GLfloat v ) { f1[0] = v ; return f1 ; } ++GLbyte *xglBuild1bv ( GLbyte v ) { b1[0] = v ; return b1 ; } ++GLint *xglBuild1iv ( GLint v ) { i1[0] = v ; return i1 ; } ++GLshort *xglBuild1sv ( GLshort v ) { s1[0] = v ; return s1 ; } ++GLubyte *xglBuild1ubv ( GLubyte v ) { ub1[0] = v ; return ub1 ; } ++GLuint *xglBuild1uiv ( GLuint v ) { ui1[0] = v ; return ui1 ; } ++GLushort *xglBuild1usv ( GLushort v ) { us1[0] = v ; return us1 ; } ++ ++GLdouble *xglBuild2dv ( GLdouble v0, GLdouble v1 ) { d2[0] = v0 ; d2[1] = v1 ; return d2 ; } ++GLfloat *xglBuild2fv ( GLfloat v0, GLfloat v1 ) { f2[0] = v0 ; f2[1] = v1 ; return f2 ; } ++GLbyte *xglBuild2bv ( GLbyte v0, GLbyte v1 ) { b2[0] = v0 ; b2[1] = v1 ; return b2 ; } ++GLint *xglBuild2iv ( GLint v0, GLint v1 ) { i2[0] = v0 ; i2[1] = v1 ; return i2 ; } ++GLshort *xglBuild2sv ( GLshort v0, GLshort v1 ) { s2[0] = v0 ; s2[1] = v1 ; return s2 ; } ++GLubyte *xglBuild2ubv ( GLubyte v0, GLubyte v1 ) { ub2[0] = v0 ; ub2[1] = v1 ; return ub2 ; } ++GLuint *xglBuild2uiv ( GLuint v0, GLuint v1 ) { ui2[0] = v0 ; ui2[1] = v1 ; return ui2 ; } ++GLushort *xglBuild2usv ( GLushort v0, GLushort v1 ) { us2[0] = v0 ; us2[1] = v1 ; return us2 ; } ++ ++GLdouble *xglBuild3dv ( GLdouble v0, GLdouble v1, GLdouble v2 ) { d3[0] = v0 ; d3[1] = v1 ; d3[2] = v2 ; return d3 ; } ++GLfloat *xglBuild3fv ( GLfloat v0, GLfloat v1, GLfloat v2 ) { f3[0] = v0 ; f3[1] = v1 ; f3[2] = v2 ; return f3 ; } ++GLbyte *xglBuild3bv ( GLbyte v0, GLbyte v1, GLbyte v2 ) { b3[0] = v0 ; b3[1] = v1 ; b3[2] = v2 ; return b3 ; } ++GLint *xglBuild3iv ( GLint v0, GLint v1, GLint v2 ) { i3[0] = v0 ; i3[1] = v1 ; i3[2] = v2 ; return i3 ; } ++GLshort *xglBuild3sv ( GLshort v0, GLshort v1, GLshort v2 ) { s3[0] = v0 ; s3[1] = v1 ; s3[2] = v2 ; return s3 ; } ++GLubyte *xglBuild3ubv ( GLubyte v0, GLubyte v1, GLubyte v2 ) { ub3[0] = v0 ; ub3[1] = v1 ; ub3[2] = v2 ; return ub3 ; } ++GLuint *xglBuild3uiv ( GLuint v0, GLuint v1, GLuint v2 ) { ui3[0] = v0 ; ui3[1] = v1 ; ui3[2] = v2 ; return ui3 ; } ++GLushort *xglBuild3usv ( GLushort v0, GLushort v1, GLushort v2 ) { us3[0] = v0 ; us3[1] = v1 ; us3[2] = v2 ; return us3 ; } ++ ++ ++GLdouble *xglBuild4dv ( GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3 ) { d4[0] = v0 ; d4[1] = v1 ; d4[2] = v2 ; d4[3] = v3 ; return d4 ; } ++GLfloat *xglBuild4fv ( GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3 ) { f4[0] = v0 ; f4[1] = v1 ; f4[2] = v2 ; f4[3] = v3 ; return f4 ; } ++GLbyte *xglBuild4bv ( GLbyte v0, GLbyte v1, GLbyte v2, GLbyte v3 ) { b4[0] = v0 ; b4[1] = v1 ; b4[2] = v2 ; b4[3] = v3 ; return b4 ; } ++GLint *xglBuild4iv ( GLint v0, GLint v1, GLint v2, GLint v3 ) { i4[0] = v0 ; i4[1] = v1 ; i4[2] = v2 ; i4[3] = v3 ; return i4 ; } ++GLshort *xglBuild4sv ( GLshort v0, GLshort v1, GLshort v2, GLshort v3 ) { s4[0] = v0 ; s4[1] = v1 ; s4[2] = v2 ; s4[3] = v3 ; return s4 ; } ++GLubyte *xglBuild4ubv ( GLubyte v0, GLubyte v1, GLubyte v2, GLubyte v3 ) { ub4[0] = v0 ; ub4[1] = v1 ; ub4[2] = v2 ; ub4[3] = v3 ; return ub4 ; } ++GLuint *xglBuild4uiv ( GLuint v0, GLuint v1, GLuint v2, GLuint v3 ) { ui4[0] = v0 ; ui4[1] = v1 ; ui4[2] = v2 ; ui4[3] = v3 ; return ui4 ; } ++GLushort *xglBuild4usv ( GLushort v0, GLushort v1, GLushort v2, GLushort v3 ) { us4[0] = v0 ; us4[1] = v1 ; us4[2] = v2 ; us4[3] = v3 ; return us4 ; } ++ ++GLdouble *xglBuildMatrixd ( GLdouble m0 , GLdouble m1 , GLdouble m2 , GLdouble m3 , ++ GLdouble m4 , GLdouble m5 , GLdouble m6 , GLdouble m7 , ++ GLdouble m8 , GLdouble m9 , GLdouble m10, GLdouble m11, ++ GLdouble m12, GLdouble m13, GLdouble m14, GLdouble m15 ) ++{ ++ md[ 0] = m0 ; md[ 1] = m1 ; md[ 2] = m2 ; md[ 3] = m3 ; ++ md[ 4] = m4 ; md[ 5] = m5 ; md[ 6] = m6 ; md[ 7] = m7 ; ++ md[ 8] = m8 ; md[ 9] = m9 ; md[10] = m10 ; md[11] = m11 ; ++ md[12] = m12 ; md[13] = m13 ; md[14] = m14 ; md[15] = m15 ; ++ ++ return md ; ++} ++ ++ ++GLfloat *xglBuildMatrixf ( GLfloat m0 , GLfloat m1 , GLfloat m2 , GLfloat m3 , ++ GLfloat m4 , GLfloat m5 , GLfloat m6 , GLfloat m7 , ++ GLfloat m8 , GLfloat m9 , GLfloat m10, GLfloat m11, ++ GLfloat m12, GLfloat m13, GLfloat m14, GLfloat m15 ) ++{ ++ mf[ 0] = m0 ; mf[ 1] = m1 ; mf[ 2] = m2 ; mf[ 3] = m3 ; ++ mf[ 4] = m4 ; mf[ 5] = m5 ; mf[ 6] = m6 ; mf[ 7] = m7 ; ++ mf[ 8] = m8 ; mf[ 9] = m9 ; mf[10] = m10 ; mf[11] = m11 ; ++ mf[12] = m12 ; mf[13] = m13 ; mf[14] = m14 ; mf[15] = m15 ; ++ ++ return mf ; ++} ++