Compare commits
250 Commits
RELEASE_0_
...
RELEASE_0_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c363758449 | ||
|
|
dfdeb8be9b | ||
|
|
d1c8f60ca9 | ||
|
|
2fb961c922 | ||
|
|
2e17b28994 | ||
|
|
c3f558b034 | ||
|
|
65ce1a04b2 | ||
|
|
3af4a19f76 | ||
|
|
5178f69f18 | ||
|
|
52e2005b3e | ||
|
|
94fa51e3f7 | ||
|
|
590547e12d | ||
|
|
c6832d2513 | ||
|
|
1fd63c30e9 | ||
|
|
f08ae9f2ea | ||
|
|
5c61e97358 | ||
|
|
87e38e2617 | ||
|
|
92e1856caa | ||
|
|
20c099b7ef | ||
|
|
7eb74c7e2a | ||
|
|
8d63c300e2 | ||
|
|
01ccdd3ae1 | ||
|
|
ab074726df | ||
|
|
ed26458a24 | ||
|
|
fcf1d34e55 | ||
|
|
19f99ea273 | ||
|
|
fe5bb76def | ||
|
|
7ecf508453 | ||
|
|
83e6e44eab | ||
|
|
69a93342c0 | ||
|
|
e17338622a | ||
|
|
a67fd7ea99 | ||
|
|
cf2b8afbe9 | ||
|
|
a1e7761384 | ||
|
|
d068915b42 | ||
|
|
adeb0d48fc | ||
|
|
55c89ea865 | ||
|
|
8bd07e358f | ||
|
|
01113e82f3 | ||
|
|
6d79582890 | ||
|
|
2ae3c89406 | ||
|
|
1818102ffe | ||
|
|
406d6dd6fc | ||
|
|
c8ef854f01 | ||
|
|
87dcaf5a00 | ||
|
|
c3bdd0e537 | ||
|
|
c23fd6e66f | ||
|
|
e809eee896 | ||
|
|
c44ef2126c | ||
|
|
e2bfb5633b | ||
|
|
064ee8ba8f | ||
|
|
a5c130446e | ||
|
|
4162817c0b | ||
|
|
81cab6e089 | ||
|
|
d78204d147 | ||
|
|
d8b523d067 | ||
|
|
c4cfad6069 | ||
|
|
5bddb88ce2 | ||
|
|
8c4ee69aeb | ||
|
|
b3a533f8ce | ||
|
|
a885314a39 | ||
|
|
0567a76445 | ||
|
|
d6dc2d6eab | ||
|
|
b75a694682 | ||
|
|
2e7e9b73a0 | ||
|
|
7a11523692 | ||
|
|
f85a9866fe | ||
|
|
9b05c27938 | ||
|
|
fd96729362 | ||
|
|
c57cc096f8 | ||
|
|
c8efd0a465 | ||
|
|
db60139845 | ||
|
|
cadefd323a | ||
|
|
baab88f42a | ||
|
|
767b74dd35 | ||
|
|
90e8287f43 | ||
|
|
d8b7e5b8fd | ||
|
|
7769447283 | ||
|
|
d6a790cf13 | ||
|
|
033c66363d | ||
|
|
3ff1789963 | ||
|
|
9737c0c4dd | ||
|
|
b201383a80 | ||
|
|
2253b82304 | ||
|
|
2581446d85 | ||
|
|
a6291b286c | ||
|
|
96a396bfcb | ||
|
|
0833a11686 | ||
|
|
9c7f7f3d32 | ||
|
|
7847fe8074 | ||
|
|
c57d25ac51 | ||
|
|
1341b5b9f8 | ||
|
|
fb54e9e103 | ||
|
|
3a835dde7d | ||
|
|
128a4a36ca | ||
|
|
255bb6dd07 | ||
|
|
786b1e3a30 | ||
|
|
d5f38a558e | ||
|
|
ce5d4b7db8 | ||
|
|
8c0b36fe9e | ||
|
|
c7e6459c64 | ||
|
|
86e31e696d | ||
|
|
be0b1bb994 | ||
|
|
03e74bfeb4 | ||
|
|
972223cd50 | ||
|
|
761b7b9354 | ||
|
|
6a3d1895d9 | ||
|
|
d1178a26ce | ||
|
|
8ffdfa3cb1 | ||
|
|
384e56b9b4 | ||
|
|
d198e962b0 | ||
|
|
0136fdadbb | ||
|
|
c616568830 | ||
|
|
995d2c1ede | ||
|
|
051a5e9a38 | ||
|
|
60d89097de | ||
|
|
6c35255549 | ||
|
|
c985d8846d | ||
|
|
9a8ab26381 | ||
|
|
711622fd5b | ||
|
|
96474823b5 | ||
|
|
bbf4b54613 | ||
|
|
9795c5dd6b | ||
|
|
addcace80d | ||
|
|
77e43a5fa8 | ||
|
|
b751188e56 | ||
|
|
1ad9a15864 | ||
|
|
d0d7878e0a | ||
|
|
be5d365348 | ||
|
|
a8e0002a64 | ||
|
|
bf75cf7225 | ||
|
|
c024b680bc | ||
|
|
c896475765 | ||
|
|
101fdb3598 | ||
|
|
b13505afdf | ||
|
|
9d96b171a0 | ||
|
|
8b5a0cde69 | ||
|
|
bed7593cdd | ||
|
|
9fed946567 | ||
|
|
4d0bc0ae39 | ||
|
|
f9824aa7de | ||
|
|
4d2522964a | ||
|
|
dbe4a59b8e | ||
|
|
918f8a3ed4 | ||
|
|
f645596606 | ||
|
|
d778dd081d | ||
|
|
f6ed02c3fb | ||
|
|
7fa5dd7a35 | ||
|
|
a3186af099 | ||
|
|
a2d95ac742 | ||
|
|
10715bbea7 | ||
|
|
89fcb12556 | ||
|
|
cc3d7ddee5 | ||
|
|
cc01f99acb | ||
|
|
62b75190bb | ||
|
|
520124c1be | ||
|
|
e251bfcbaf | ||
|
|
aef809348f | ||
|
|
2d4a8774b8 | ||
|
|
b55c8fd828 | ||
|
|
dfff091b5f | ||
|
|
47eb7efafa | ||
|
|
b2a7fff26e | ||
|
|
5f70123723 | ||
|
|
dd629da8d3 | ||
|
|
74f7d52d95 | ||
|
|
7a65a990ba | ||
|
|
fe0076e291 | ||
|
|
1a8bc06cc6 | ||
|
|
8c41081a5c | ||
|
|
5b40eed554 | ||
|
|
b1c4d34eef | ||
|
|
0152b607f8 | ||
|
|
ab6e72047b | ||
|
|
15399bfe95 | ||
|
|
0ff748987b | ||
|
|
58e0e7736b | ||
|
|
2d1b2ca938 | ||
|
|
9a4152eb2d | ||
|
|
6ab443545f | ||
|
|
98a9b4a10c | ||
|
|
a6251606dd | ||
|
|
c3b21e143c | ||
|
|
b496593883 | ||
|
|
4ef4b019ca | ||
|
|
a8021531ab | ||
|
|
93fd948978 | ||
|
|
a1b3740dc6 | ||
|
|
40920457cb | ||
|
|
5039c84fd0 | ||
|
|
220a43bf46 | ||
|
|
45d3e19c38 | ||
|
|
5bab565cfe | ||
|
|
319a4282c8 | ||
|
|
c6aa8bc8e9 | ||
|
|
6f1bfa202e | ||
|
|
6fa9f86d1c | ||
|
|
019a9527d2 | ||
|
|
d100ca485f | ||
|
|
35ab6900ee | ||
|
|
c8570302f5 | ||
|
|
74f10486bc | ||
|
|
2b12425a62 | ||
|
|
c600aad7a7 | ||
|
|
67b2f0a977 | ||
|
|
70c6b48a07 | ||
|
|
76084f8538 | ||
|
|
64c408d2b7 | ||
|
|
73b050ae34 | ||
|
|
59991393ca | ||
|
|
69b2717b62 | ||
|
|
f2a323e048 | ||
|
|
7d07e6ea51 | ||
|
|
7c846972bf | ||
|
|
4f76c258af | ||
|
|
eca2afb982 | ||
|
|
9ff6934c83 | ||
|
|
e04839765d | ||
|
|
d0c655109f | ||
|
|
b28b55abb1 | ||
|
|
c3a0db1aba | ||
|
|
5e929d7d01 | ||
|
|
17f113f8cd | ||
|
|
445cd4ccda | ||
|
|
55845bbbb9 | ||
|
|
1976481ba2 | ||
|
|
5f17edbc72 | ||
|
|
6f7fe4b481 | ||
|
|
66ebe6e690 | ||
|
|
a9cd67e0ce | ||
|
|
994a470fbf | ||
|
|
0ce0684dae | ||
|
|
377eb4782a | ||
|
|
f1a79e6b9f | ||
|
|
007a1e4659 | ||
|
|
fcb873b6dd | ||
|
|
a66d1ad855 | ||
|
|
76a5950f19 | ||
|
|
b7a91bdb03 | ||
|
|
e4bbc5c50b | ||
|
|
b481ccd749 | ||
|
|
e7b9e55599 | ||
|
|
05eaa7135f | ||
|
|
d063b319e8 | ||
|
|
be4fd56660 | ||
|
|
a406a3c00b | ||
|
|
c7295da5eb | ||
|
|
505f561e1c | ||
|
|
7bd8477fa1 | ||
|
|
36ef15940e |
9
.cvsignore
Normal file
9
.cvsignore
Normal file
@@ -0,0 +1,9 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
SimGear.spec
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
config.cache
|
||||
config.log
|
||||
config.status
|
||||
configure
|
||||
2
Doxyfile
2
Doxyfile
@@ -22,7 +22,7 @@ PROJECT_NAME = SimGear
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 0.0.15
|
||||
PROJECT_NUMBER = 0.3.0
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
|
||||
107
Makefile.am
107
Makefile.am
@@ -1,105 +1,20 @@
|
||||
EXTRA_DIST = mksymlinks.sh acsite.m4 acconfig.h SimGear.dsp SimGear.dsw
|
||||
EXTRA_DIST = \
|
||||
acinclude.m4 \
|
||||
autogen.sh \
|
||||
README.MSVC \
|
||||
README.metakit \
|
||||
README.zlib \
|
||||
SimGear.dsp \
|
||||
SimGear.dsw
|
||||
|
||||
SUBDIRS = simgear
|
||||
|
||||
#
|
||||
# Additional all, clean, and distclean rules for additional packages.
|
||||
# We can't just include the additional package dirs in SUBDIRS (which
|
||||
# would be nice because there are then problems with make dist
|
||||
#
|
||||
|
||||
all:
|
||||
@list='@subdirs@'; \
|
||||
target=`echo $@`; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done
|
||||
|
||||
install:
|
||||
@list='@subdirs@'; \
|
||||
target=`echo $@`; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done
|
||||
|
||||
clean:
|
||||
@list='@subdirs@'; \
|
||||
target=`echo $@`; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done
|
||||
|
||||
distclean:
|
||||
@list='@subdirs@'; \
|
||||
target=`echo $@`; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done
|
||||
|
||||
#
|
||||
# distclean the associated packages and include them in the dist
|
||||
#
|
||||
SUBDIRS = src-libs simgear
|
||||
|
||||
dist-hook:
|
||||
(cd $(top_srcdir); \
|
||||
$(HOME)/projects/FlightGear-0.7/admin/am2dsp.pl --lib)
|
||||
pwd
|
||||
echo "copying simgear/metar"
|
||||
(cd $(top_srcdir); tar cf - simgear/metar) | (cd $(distdir); tar xvf -)
|
||||
echo "other stuff"
|
||||
@list='@subdirs@'; \
|
||||
target=distclean; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) echo "distclean error ignored...";; *k*) fail=yes;; *) echo "distclean error ignored...";; esac; \
|
||||
done
|
||||
(cd $(top_srcdir); tar cf - simgear/metakit) | \
|
||||
(cd $(distdir); tar xvf -)
|
||||
|
||||
(cd $(top_srcdir); $(HOME)/projects/FlightGear-0.7/admin/am2dsp.pl)
|
||||
|
||||
#
|
||||
# Rule to build RPM distribution package
|
||||
#
|
||||
rpm: dist
|
||||
cp $(PACKAGE)-$(VERSION).tar.gz /usr/src/packages/SOURCES
|
||||
rpm -ba @PACKAGE@.spec
|
||||
rpm -ta $(PACKAGE)-$(VERSION).tar.gz
|
||||
|
||||
|
||||
132
NEWS
132
NEWS
@@ -1,5 +1,126 @@
|
||||
New in 0.3.0
|
||||
* December 3, 2002
|
||||
|
||||
* removed interpreter subdir
|
||||
* NOMINAX fix for Cygwin/gcc-3.2
|
||||
* Added some prototype 3d clouds based on Mark Harris's demos.
|
||||
* Simplified the command manager interface
|
||||
* Allow an "include" attribute on root PropertyList element.
|
||||
|
||||
|
||||
New in 0.2.0
|
||||
* September 6, 2002
|
||||
|
||||
* Modernized the autoconf/make scripts, plus lots of tweaks and enhancements.
|
||||
* Removed efence support (in favor of valgrind.)
|
||||
|
||||
* Added a javascript interpreter.
|
||||
* SGSocket reimplimented on top of plib/net libs.
|
||||
* Added a new random number generation algorithm.
|
||||
* Total rewrite of the strutils package.
|
||||
|
||||
* Patch for the random number seed.
|
||||
* IA-64 w/ Intel compiler fixes.
|
||||
* MSVC/MINGW fixes.
|
||||
* Mac OS X fixes.
|
||||
* Irix fixes.
|
||||
* Code clean ups to remove warning messages.
|
||||
* Optimizations in sg_binobj to reduce the amout of memory copying
|
||||
needed when loading a binobj format file.
|
||||
* Fixed a couple places where variables could be used before they were
|
||||
initialized.
|
||||
* Various property manager fixes and improvements.
|
||||
* Fixes to cloud layer management code.
|
||||
* Made the sky dome more flexible to facilitate use in other applications.
|
||||
|
||||
|
||||
New in 0.0.18
|
||||
* April 20, 2002
|
||||
|
||||
* Created a src/libs subdirectory for several packages that need to be
|
||||
installed by the user but are used by many other packages and may already
|
||||
be installed. So we just bundle the source separately as a convenience
|
||||
if the user needs to build and install these.
|
||||
* Upgrade to zlib-1.1.4 (security fix)
|
||||
* Upgrade to metakit-2.4.2-32.tar.gz (latest upstream release)
|
||||
* Added support for point objects in the scenery file format.
|
||||
* Additions to the binary file format to make it *much* more flexible.
|
||||
For each major primative type: points, triangles, fans, and strips, you
|
||||
can specify an index list of vertices, normals, colors, and texture
|
||||
coordinates. You can skip any of these you like to save on space.
|
||||
* Added support for new file features in the binary -> ascii scenery file
|
||||
decoder.
|
||||
* Various code clean ups.
|
||||
* Separate XML I/O operations into a separate header file.
|
||||
* Major property manager rewrite, then lots of followup cleaning and
|
||||
improvements.
|
||||
|
||||
|
||||
New in 0.0.17 (final)
|
||||
* February 16, 2002
|
||||
|
||||
* Explicitely reset the glBlendFunc() after drawing the moon for the
|
||||
Voodoo2 linux driver since it seems to have a bug in glPopAttrib().
|
||||
|
||||
|
||||
New in 0.0.17pre2
|
||||
* February 13, 2002
|
||||
|
||||
* Replaced some cout's with SG_LOG's
|
||||
|
||||
|
||||
New in 0.0.17pre1
|
||||
* February 12, 2002
|
||||
|
||||
* Removed metakit and zlib from build process. Tarballs are still included
|
||||
for those who's systems don't provide these packages.
|
||||
* MSVC fixes.
|
||||
* IRIX fixes.
|
||||
* Mingwin fixes.
|
||||
* Mac OS X fixes.
|
||||
* FreeBSD fixes.
|
||||
* Added support for Intel's C++ compiler under Linux.
|
||||
* Attempt to build in support for various non-compatible automake/autoconf
|
||||
versions.
|
||||
* Fix for a problem that could lead to a bogus build for people with voodoo
|
||||
cards.
|
||||
* Added Norman's jpegfactory code which can create jpeg format screen shots
|
||||
of a live running application.
|
||||
* implemented set/get_log_classes and set/get_log_priority.
|
||||
* Socket library improvements.
|
||||
* Added a C++ exception abstraction.
|
||||
* Property manager fixes and improvements including node path caching
|
||||
and debug tracing of property reads/writes.
|
||||
* Updates/fixes to xml handling.
|
||||
|
||||
|
||||
New in 0.0.16
|
||||
* July 12, 2001
|
||||
* Various changes to the property manager implimentation to better support
|
||||
dumping out the desired portions of the property tree to file.
|
||||
* Don't compile the metakit demos by default (causes problems for Irix)'
|
||||
* Other various tweaks for Irix.
|
||||
* Added a virtual destructor to XMLVisitor to fix a warning message.
|
||||
* Check for valid hostname lookup in sg_socket.cxx
|
||||
* Add a function to return modified julian date without creating an
|
||||
entire SGTime class. This avoids an extraneous warning about not
|
||||
being able to find a timezone.
|
||||
* Created a mailing list for cvs commit messages.
|
||||
* Fixed a potential array under/over run bug in interpolator.cxx
|
||||
* Removed all references to SGValue from the property manager. Added
|
||||
support for an "archive" bit in the property manager to control
|
||||
which values get written out.
|
||||
* Added SGCommandState class so that commands can compile and save
|
||||
copies of their arguments for efficiency if they are called multiple
|
||||
times.
|
||||
* Added Brian Baul's "tr" tiled rendering low level support library.
|
||||
This along with some higher level code in flightgear allows us to do
|
||||
ultra-hires tiled screen dumps suitable for large format printers.
|
||||
(Norman Vine)
|
||||
|
||||
|
||||
New in 0.0.15
|
||||
* June 22, 2001
|
||||
* June 20, 2001
|
||||
* Various bug fixes, tweaks, and optimizations.
|
||||
* Added a command manager (analogous to the property manager)
|
||||
* Better Irix Mips support.
|
||||
@@ -26,6 +147,7 @@ New in 0.0.15
|
||||
* Fixed some critical null pointer bugs in property manager.
|
||||
* Magnetic variation can now be fetched for any arbitrary location.
|
||||
|
||||
|
||||
New in 0.0.14
|
||||
* December 14, 2000
|
||||
* Added a module to manage waypoints and routes, calculate bearing and
|
||||
@@ -47,6 +169,7 @@ New in 0.0.14
|
||||
* MacOS tweaks.
|
||||
* FreeBSD tweaks.
|
||||
|
||||
|
||||
New in 0.0.13
|
||||
* September 14, 2000
|
||||
* Added support for reading and writing xml files (easyxml)
|
||||
@@ -57,6 +180,7 @@ New in 0.0.13
|
||||
* MacOS tweaks.
|
||||
* MSVC tweaks.
|
||||
|
||||
|
||||
New in 0.0.12
|
||||
* July 19, 2000
|
||||
* Converted project license from GPL to LGPL.
|
||||
@@ -66,6 +190,7 @@ New in 0.0.12
|
||||
* Added a property manager (registry)
|
||||
* Some documentation added.
|
||||
|
||||
|
||||
New in 0.0.11
|
||||
* July 3, 2000
|
||||
* Replaced gdbm with metakit
|
||||
@@ -74,6 +199,7 @@ New in 0.0.11
|
||||
* MSVC5 fixes
|
||||
* Math/bucket/tiling tweaks from Norman Vine
|
||||
|
||||
|
||||
New in 0.0.7
|
||||
* March 29, 2000
|
||||
* Added support for RedHat package building contributed by Habibie
|
||||
@@ -86,18 +212,22 @@ New in 0.0.7
|
||||
* Optimizations and bullet proofing of magnetic variation code by Norman
|
||||
Vine and Ed Williams
|
||||
|
||||
|
||||
New in 0.0.6
|
||||
* March 27, 2000
|
||||
* Added Nima World Magnetic Model 2000 contributed by Ed Williams
|
||||
* Fixes for MSVC++
|
||||
|
||||
|
||||
New in 0.0.5
|
||||
* March 17, 2000
|
||||
* Restructured directory layout to facilitate windows/mac IDE builds.
|
||||
|
||||
|
||||
New in 0.0.4
|
||||
* Removed mat3.h and friends (we now use plib's sg lib for these sorts of
|
||||
things.)
|
||||
|
||||
|
||||
New in 0.0.3
|
||||
* Release that conincides with FlightGear-0.7.2
|
||||
|
||||
4
README
4
README
@@ -1,3 +1 @@
|
||||
MSVC5 users:
|
||||
|
||||
Copy simgear/config.h.vc5 to simgear/config.h before building.
|
||||
[ Nothing here at this time. ]
|
||||
|
||||
24
README.MSVC
Normal file
24
README.MSVC
Normal file
@@ -0,0 +1,24 @@
|
||||
This document describes how to build SimGear using the supplied workspace and
|
||||
project files.
|
||||
|
||||
Unpack the SimGear source file into your work directory. This creates a new
|
||||
subdirectory called SimGear-X.Y.Z. Rename this to SimGear. Before we can
|
||||
build SimGear you must unpack and build the third party libraries metakit and
|
||||
zlib. Sources for these are included in the SimGear/src-libs directory.
|
||||
Unpack these into the top level SimGear directory. At this point your
|
||||
directory structure should look something like this:
|
||||
|
||||
<work_dir>/
|
||||
SimGear/
|
||||
metakit-x.y.z/
|
||||
simgear/
|
||||
src-libs/
|
||||
zlib-x.y.z/
|
||||
|
||||
Now open the SimGear workspace. This workspace file contains projects for
|
||||
building metakit(mklib), SimGear and zlib. Select each project as the active
|
||||
project and build all. Order is unimportant since there are no dependencies
|
||||
between the projects.
|
||||
|
||||
The workspace and project files are generated by a perl script with extra
|
||||
input from the am2dsp.cfg file.
|
||||
@@ -1,6 +1,23 @@
|
||||
With the author's permission, SimGear now bundles MetaKit.
|
||||
For your convenience (and with the author's permission) a copy of the
|
||||
MetaKit source is bundled with SimGear in $(top_srcdir)/src-libs/.
|
||||
You must have metakit installed before you can build SimGear.
|
||||
|
||||
Important build note:
|
||||
- Most linux distributions have a metakit package. For linux
|
||||
developers, we recommend ysou install your distributions package
|
||||
rather than building from source.
|
||||
|
||||
- For developers on most other platforms, you will have to build
|
||||
metakit from source and install it yourself. For your convenience a
|
||||
tar ball of the metakit source is included with the simgear source
|
||||
distribution. Untar the metakit source, and follow the included
|
||||
build and installation instructions.
|
||||
|
||||
Once metakit is installed you can return to configuring and building
|
||||
Simgear.
|
||||
|
||||
=============================================================================
|
||||
|
||||
Potentially important build note:
|
||||
|
||||
Later on when you are linking programs with -lmk4 (i.e. FlightGear or one
|
||||
of it's associated programs) if you come across an error similar to the
|
||||
|
||||
16
README.plib
Normal file
16
README.plib
Normal file
@@ -0,0 +1,16 @@
|
||||
[This file is mirrored in both the FlightGear and SimGear packages.]
|
||||
|
||||
You *must* have plib version 1.6.0 or later installed on your system
|
||||
to build FlightGear!" Flight Gear is no longer compatible with the
|
||||
earlier versions of the library.
|
||||
|
||||
You can get the latest version of plib from:
|
||||
|
||||
http://plib.sourceforge.net
|
||||
|
||||
Build notes:
|
||||
|
||||
You should be able to just run "./configure" to configure the package
|
||||
and use all of plib's defaults. Then run "make" followed by "make
|
||||
install". By default, plib installs itself into /usr so if you don't
|
||||
like this, be sure to specify an alternate prefix such as --prefix=/usr/local
|
||||
173
README.zlib
Normal file
173
README.zlib
Normal file
@@ -0,0 +1,173 @@
|
||||
For your convenience and allowed by zlib's license terms:
|
||||
http://www.gzip.org/zlib/zlib_license.html a copy of the zlib source
|
||||
is bundled with SimGear in $(top_srcdir)/src-libs/. You must have
|
||||
zlib installed before you can build SimGear.
|
||||
|
||||
- Most linux distributions have a zlib package. For linux
|
||||
developers, we recommend ysou install your distributions package
|
||||
rather than building from source.
|
||||
|
||||
- Cygwin installs zlib automatically.
|
||||
|
||||
- For developers on most other platforms, you will have to build
|
||||
zlib from source and install it yourself. For your convenience a
|
||||
tar ball of the zlib source is included with the simgear source
|
||||
distribution. Untar the zlib source, and follow the included
|
||||
build and installation instructions.
|
||||
|
||||
Once zlib is installed you can return to configuring and building
|
||||
Simgear.
|
||||
|
||||
We now send you to the official zlib README ...
|
||||
|
||||
|
||||
=============================================================================
|
||||
|
||||
|
||||
zlib 1.1.4 is a general purpose data compression library. All the code
|
||||
is thread safe. The data format used by the zlib library
|
||||
is described by RFCs (Request for Comments) 1950 to 1952 in the files
|
||||
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate
|
||||
format) and rfc1952.txt (gzip format). These documents are also available in
|
||||
other formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
|
||||
|
||||
All functions of the compression library are documented in the file zlib.h
|
||||
(volunteer to write man pages welcome, contact jloup@gzip.org). A usage
|
||||
example of the library is given in the file example.c which also tests that
|
||||
the library is working correctly. Another example is given in the file
|
||||
minigzip.c. The compression library itself is composed of all source files
|
||||
except example.c and minigzip.c.
|
||||
|
||||
To compile all files and run the test program, follow the instructions
|
||||
given at the top of Makefile. In short "make test; make install"
|
||||
should work for most machines. For Unix: "./configure; make test; make install"
|
||||
For MSDOS, use one of the special makefiles such as Makefile.msc.
|
||||
For VMS, use Make_vms.com or descrip.mms.
|
||||
|
||||
Questions about zlib should be sent to <zlib@gzip.org>, or to
|
||||
Gilles Vollant <info@winimage.com> for the Windows DLL version.
|
||||
The zlib home page is http://www.zlib.org or http://www.gzip.org/zlib/
|
||||
Before reporting a problem, please check this site to verify that
|
||||
you have the latest version of zlib; otherwise get the latest version and
|
||||
check whether the problem still exists or not.
|
||||
|
||||
PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html
|
||||
before asking for help.
|
||||
|
||||
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
||||
issue of Dr. Dobb's Journal; a copy of the article is available in
|
||||
http://dogma.net/markn/articles/zlibtool/zlibtool.htm
|
||||
|
||||
The changes made in version 1.1.4 are documented in the file ChangeLog.
|
||||
The only changes made since 1.1.3 are bug corrections:
|
||||
|
||||
- ZFREE was repeated on same allocation on some error conditions.
|
||||
This creates a security problem described in
|
||||
http://www.zlib.org/advisory-2002-03-11.txt
|
||||
- Returned incorrect error (Z_MEM_ERROR) on some invalid data
|
||||
- Avoid accesses before window for invalid distances with inflate window
|
||||
less than 32K.
|
||||
- force windowBits > 8 to avoid a bug in the encoder for a window size
|
||||
of 256 bytes. (A complete fix will be available in 1.1.5).
|
||||
|
||||
The beta version 1.1.5beta includes many more changes. A new official
|
||||
version 1.1.5 will be released as soon as extensive testing has been
|
||||
completed on it.
|
||||
|
||||
|
||||
Unsupported third party contributions are provided in directory "contrib".
|
||||
|
||||
A Java implementation of zlib is available in the Java Development Kit
|
||||
http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html
|
||||
See the zlib home page http://www.zlib.org for details.
|
||||
|
||||
A Perl interface to zlib written by Paul Marquess <pmarquess@bfsec.bt.co.uk>
|
||||
is in the CPAN (Comprehensive Perl Archive Network) sites
|
||||
http://www.cpan.org/modules/by-module/Compress/
|
||||
|
||||
A Python interface to zlib written by A.M. Kuchling <amk@magnet.com>
|
||||
is available in Python 1.5 and later versions, see
|
||||
http://www.python.org/doc/lib/module-zlib.html
|
||||
|
||||
A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com>
|
||||
is availlable at http://www.westend.com/~kupries/doc/trf/man/man.html
|
||||
|
||||
An experimental package to read and write files in .zip format,
|
||||
written on top of zlib by Gilles Vollant <info@winimage.com>, is
|
||||
available at http://www.winimage.com/zLibDll/unzip.html
|
||||
and also in the contrib/minizip directory of zlib.
|
||||
|
||||
|
||||
Notes for some targets:
|
||||
|
||||
- To build a Windows DLL version, include in a DLL project zlib.def, zlib.rc
|
||||
and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL
|
||||
The zlib DLL support was initially done by Alessandro Iacopetti and is
|
||||
now maintained by Gilles Vollant <info@winimage.com>. Check the zlib DLL
|
||||
home page at http://www.winimage.com/zLibDll
|
||||
|
||||
From Visual Basic, you can call the DLL functions which do not take
|
||||
a structure as argument: compress, uncompress and all gz* functions.
|
||||
See contrib/visual-basic.txt for more information, or get
|
||||
http://www.tcfb.com/dowseware/cmp-z-it.zip
|
||||
|
||||
- For 64-bit Irix, deflate.c must be compiled without any optimization.
|
||||
With -O, one libpng test fails. The test works in 32 bit mode (with
|
||||
the -n32 compiler flag). The compiler bug has been reported to SGI.
|
||||
|
||||
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1
|
||||
it works when compiled with cc.
|
||||
|
||||
- on Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1
|
||||
is necessary to get gzprintf working correctly. This is done by configure.
|
||||
|
||||
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works
|
||||
with other compilers. Use "make test" to check your compiler.
|
||||
|
||||
- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
|
||||
|
||||
- For Turbo C the small model is supported only with reduced performance to
|
||||
avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
|
||||
|
||||
- For PalmOs, see http://www.cs.uit.no/~perm/PASTA/pilot/software.html
|
||||
Per Harald Myrvang <perm@stud.cs.uit.no>
|
||||
|
||||
|
||||
Acknowledgments:
|
||||
|
||||
The deflate format used by zlib was defined by Phil Katz. The deflate
|
||||
and zlib specifications were written by L. Peter Deutsch. Thanks to all the
|
||||
people who reported problems and suggested various improvements in zlib;
|
||||
they are too numerous to cite here.
|
||||
|
||||
Copyright notice:
|
||||
|
||||
(C) 1995-2002 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
||||
|
||||
If you use the zlib library in a product, we would appreciate *not*
|
||||
receiving lengthy legal documents to sign. The sources are provided
|
||||
for free but without warranty of any kind. The library has been
|
||||
entirely written by Jean-loup Gailly and Mark Adler; it does not
|
||||
include third-party code.
|
||||
|
||||
If you redistribute modified sources, we would appreciate that you include
|
||||
in the file ChangeLog history information documenting your changes.
|
||||
737
SimGear.dsp
737
SimGear.dsp
@@ -30,19 +30,12 @@ RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "SimGear - 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" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "\usr\include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "HAVE_CONFIG_H" /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_MBCS" /FD /c /MT /I "." /I ".." /I ".\SimGear" /I ".\SimGear\metakit-2.4.3\include" /I "..\SimGear\zlib-1.1.4" /D "HAVE_CONFIG_H"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
@@ -53,19 +46,12 @@ LINK32=link.exe -lib
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - 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" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /GX /ZI /Od /I "\usr\include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "HAVE_CONFIG_H" /FR /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD CPP /nologo /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_MBCS" /FR /FD /GZ /c /MT /I "." /I ".." /I ".\SimGear" /I ".\SimGear\metakit-2.4.3\include" /I "..\SimGear\zlib-1.1.4" /D "HAVE_CONFIG_H"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
@@ -80,18 +66,6 @@ LINK32=link.exe -lib
|
||||
|
||||
# Name "SimGear - Win32 Release"
|
||||
# Name "SimGear - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# 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
|
||||
# Begin Group "Lib_sgbucket"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
@@ -421,6 +395,21 @@ SOURCE=.\simgear\io\sg_socket.cxx
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\io\sg_socket_udp.cxx
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgio"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgio"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Lib_sgmagvar"
|
||||
@@ -785,6 +774,21 @@ SOURCE=.\simgear\misc\commands.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\misc\exception.cxx
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgmisc"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgmisc"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\misc\props.cxx
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
@@ -973,6 +977,21 @@ SOURCE=.\simgear\screen\screen-dump.cxx
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\screen\tr.cxx
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgscreen"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgscreen"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\screen\win32-printer.h
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
@@ -1115,20 +1134,320 @@ SOURCE=.\simgear\sky\stars.cxx
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Lib_sgthreads"
|
||||
# Begin Group "Lib_sgclouds3d"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\threads\SGThread.cxx
|
||||
SOURCE=.\simgear\sky\clouds3d\vec3fv.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgthreads"
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgthreads"
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\mat16fv.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\tri.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\plane.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\camera.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\camutils.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\minmaxbox.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyMinMaxBox.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyLight.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyMaterial.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyTextureManager.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyTextureState.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyDynamicTextureManager.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyRenderableInstanceCloud.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyRenderableInstanceGroup.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyCloud.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyArchive.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyUtil.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkyContext.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkySceneManager.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\sky\clouds3d\SkySceneLoader.cpp
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_sgclouds3d"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_sgclouds3d"
|
||||
|
||||
!ENDIF
|
||||
|
||||
@@ -1491,354 +1810,32 @@ SOURCE=.\simgear\xml\xmltok_impl.h
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Lib_z"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\adler32.c
|
||||
SOURCE=.\simgear\simgear_config.h.vc5
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
# Begin Custom Build - Creating config.h
|
||||
InputPath=.\simgear\simgear_config.h.vc5
|
||||
|
||||
".\simgear\simgear_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
copy .\simgear\simgear_config.h.vc5 .\simgear\simgear_config.h
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
# Begin Custom Build - Creating config.h
|
||||
InputPath=.\simgear\simgear_config.h.vc5
|
||||
|
||||
!ENDIF
|
||||
".\simgear\simgear_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
copy .\simgear\simgear_config.h.vc5 .\simgear\simgear_config.h
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\compress.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\crc32.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\deflate.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\deflate.h
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\gzio.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\infblock.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\infblock.h
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\infcodes.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\infcodes.h
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\inffast.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\inffast.h
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\inffixed.h
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\inflate.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\inftrees.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\inftrees.h
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\infutil.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\infutil.h
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\trees.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\trees.h
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\uncompr.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\zutil.c
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\simgear\zlib\zutil.h
|
||||
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"
|
||||
|
||||
# PROP Intermediate_Dir "Release\Lib_z"
|
||||
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"
|
||||
|
||||
# PROP Intermediate_Dir "Debug\Lib_z"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
|
||||
24
SimGear.dsw
24
SimGear.dsw
@@ -15,6 +15,30 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "mklib"=".\SimGear\metakit-2.4.3\win\msvc60\mklib.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "zlib"=".\SimGear\zlib.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
|
||||
1
TODO
Normal file
1
TODO
Normal file
@@ -0,0 +1 @@
|
||||
03/25/2001 - Resolve location of Sky dome implimentation documentation.
|
||||
333
acconfig.h
333
acconfig.h
@@ -1,333 +0,0 @@
|
||||
/* 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 <sys/dg_sys_info.h>. */
|
||||
#undef DGUX
|
||||
|
||||
/* Define if you have <dirent.h>. */
|
||||
#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 <sys/types.h> doesn't define. */
|
||||
#undef gid_t
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Define if you have <alloca.h> 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 stdint.h include. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define if you have the strftime function. */
|
||||
#undef HAVE_STRFTIME
|
||||
|
||||
/* Define if you have <sys/param.h> */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have <sys/stat.h> that is POSIX.1 compatible. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define if you have <sys/wait.h> 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 <unistd.h>. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if utime(file, NULL) sets file's timestamp to the present. */
|
||||
#undef HAVE_UTIME_NULL
|
||||
|
||||
/* Define if you have <vfork.h>. */
|
||||
#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 if you have gdbm installed system wide. */
|
||||
/* #undef HAVE_GDBM */
|
||||
|
||||
/* Define if you have zlib installed system wide. */
|
||||
#undef HAVE_ZLIB
|
||||
|
||||
/* 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 <mkdev.h>. */
|
||||
#undef MAJOR_IN_MKDEV
|
||||
|
||||
/* Define if major, minor, and makedev are declared in <sysmacros.h>. */
|
||||
#undef MAJOR_IN_SYSMACROS
|
||||
|
||||
/* Define if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef mode_t
|
||||
|
||||
/* Define if you don't have <dirent.h>, but have <ndir.h>. */
|
||||
#undef NDIR
|
||||
|
||||
/* Define if you have <memory.h>, and <string.h> 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 <nlist.h>. */
|
||||
#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 <sys/types.h> doesn't define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define to package name */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to `int' if <sys/types.h> 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 <sys/types.h> 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 <sys/stat.h> 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 <dirent.h>, but have <sys/dir.h>. */
|
||||
#undef SYSDIR
|
||||
|
||||
/* Define if you don't have <dirent.h>, but have <sys/ndir.h>. */
|
||||
#undef SYSNDIR
|
||||
|
||||
/* Define if `sys_siglist' is declared by <signal.h>. */
|
||||
#undef SYS_SIGLIST_DECLARED
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef uid_t
|
||||
|
||||
/* Define for Encore UMAX. */
|
||||
#undef UMAX
|
||||
|
||||
/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
|
||||
instead of <sys/cpustats.h>. */
|
||||
#undef UMAX4_3
|
||||
|
||||
/* Define if you do not have <strings.h>, 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). */
|
||||
|
||||
@@ -102,7 +102,7 @@ for exdir in $exdirs ; do
|
||||
mylibdir="${exdir}/lib${subexdir}"
|
||||
wi_EXTRA_LDIR($mylibdir)
|
||||
|
||||
progdir="${exdir}/bin${subexdirr}"
|
||||
progdir="${exdir}/bin${subexdir}"
|
||||
wi_EXTRA_PDIR($progdir)
|
||||
fi
|
||||
done
|
||||
140
aclocal.m4
vendored
140
aclocal.m4
vendored
@@ -1,140 +0,0 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.4
|
||||
|
||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
dnl This file 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([AC_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", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
|
||||
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])])
|
||||
|
||||
#
|
||||
# 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>>, <<[^ ]>>, <<>>), <<>>,
|
||||
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
|
||||
<<am_indx=1
|
||||
for am_file in <<$1>>; 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([,]))])
|
||||
|
||||
39
am2dsp.cfg
Normal file
39
am2dsp.cfg
Normal file
@@ -0,0 +1,39 @@
|
||||
type = StaticLibrary,Multithreaded,
|
||||
exclude_dir = threads
|
||||
|
||||
include_path = .
|
||||
include_path = ..
|
||||
include_path = .\SimGear
|
||||
include_path = .\SimGear\metakit-2.4.3\include
|
||||
include_path = ..\SimGear\zlib-1.1.4
|
||||
|
||||
define = HAVE_CONFIG_H
|
||||
|
||||
add_project = .\SimGear\metakit-2.4.3\win\msvc60\mklib.dsp,mklib
|
||||
add_project = .\SimGear\zlib.dsp,zlib
|
||||
|
||||
# Rule to create simgear_config.h
|
||||
add_source_file = SOURCE=.\simgear\simgear_config.h.vc5\
|
||||
\
|
||||
!IF "$(CFG)" == "SimGear - Win32 Release"\
|
||||
\
|
||||
# Begin Custom Build - Creating config.h\
|
||||
InputPath=.\simgear\simgear_config.h.vc5\
|
||||
\
|
||||
".\simgear\simgear_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\
|
||||
copy .\simgear\simgear_config.h.vc5 .\simgear\simgear_config.h\
|
||||
\
|
||||
# End Custom Build\
|
||||
\
|
||||
!ELSEIF "$(CFG)" == "SimGear - Win32 Debug"\
|
||||
\
|
||||
# Begin Custom Build - Creating config.h\
|
||||
InputPath=.\simgear\simgear_config.h.vc5\
|
||||
\
|
||||
".\simgear\simgear_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\
|
||||
copy .\simgear\simgear_config.h.vc5 .\simgear\simgear_config.h\
|
||||
\
|
||||
# End Custom Build\
|
||||
\
|
||||
!ENDIF\
|
||||
|
||||
52
autogen.sh
Executable file
52
autogen.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
|
||||
OSTYPE=`uname -s`
|
||||
MACHINE=`uname -m`
|
||||
AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\.\([0-9]*\).*/\1/'`
|
||||
if test $AUTO_MAKE_VERSION -lt 15; then
|
||||
echo ""
|
||||
echo "You need to upgrade to automake version 1.5 or greater."
|
||||
echo "Most distributions have packages available to install or you can"
|
||||
echo "find the source for the most recent version at"
|
||||
echo "ftp://ftp.gnu.org/gnu/automake"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Host info: $OSTYPE $MACHINE"
|
||||
echo -n " automake: `automake --version | head -1 | awk '{print $4}'`"
|
||||
echo " ($AUTO_MAKE_VERSION)"
|
||||
echo ""
|
||||
|
||||
echo "Running aclocal"
|
||||
aclocal
|
||||
|
||||
echo "Running autoheader"
|
||||
autoheader
|
||||
if [ ! -e simgear/simgear_config.h.in ]; then
|
||||
echo "ERROR: autoheader didn't create simgear/simgear_config.h.in!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Running automake --add-missing"
|
||||
automake --add-missing
|
||||
|
||||
echo "Running autoconf"
|
||||
autoconf
|
||||
|
||||
if [ ! -e configure ]; then
|
||||
echo "ERROR: configure was not created!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "======================================"
|
||||
|
||||
if [ -f config.cache ]; then
|
||||
echo "config.cache exists. Removing the config.cache file will force"
|
||||
echo "the ./configure script to rerun all it's tests rather than using"
|
||||
echo "the previously cached values."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo "Now you are ready to run './configure'"
|
||||
echo "======================================"
|
||||
@@ -3,10 +3,14 @@ dnl working configure script.
|
||||
dnl
|
||||
dnl $Id$
|
||||
|
||||
AC_INIT(simgear/bucket/newbucket.cxx)
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
|
||||
|
||||
# Require at least automake 2.52
|
||||
AC_PREREQ(2.52)
|
||||
|
||||
dnl Initialize the automake stuff
|
||||
AM_INIT_AUTOMAKE(SimGear, 0.0.15)
|
||||
AM_INIT_AUTOMAKE(SimGear, 0.3.0)
|
||||
|
||||
dnl Specify KAI C++ compiler and flags.
|
||||
dnl Borrowed with slight modification from blitz distribution.
|
||||
@@ -34,14 +38,20 @@ AC_PROG_RANLIB
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
|
||||
|
||||
# Used on the Irix platform
|
||||
AR="ar"
|
||||
ARFLAGS="cru"
|
||||
OS=`uname -s`
|
||||
if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
|
||||
if test "$CXX" = "CC"; then
|
||||
AR="CC -ar"
|
||||
AC_SUBST(AR)
|
||||
ARFLAGS="-o"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(AR)
|
||||
AC_SUBST(ARFLAGS)
|
||||
|
||||
|
||||
if echo $includedir | egrep "simgear$" > /dev/null; then
|
||||
echo "includedir is" $includedir "libdir is" $libdir
|
||||
@@ -49,38 +59,67 @@ else
|
||||
includedir="${includedir}/simgear"
|
||||
echo "includedir changed to" $includedir "libdir is" $libdir
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# 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)
|
||||
AC_DEFINE([FG_NDEBUG], 1, [Define for no logging output])
|
||||
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"
|
||||
# Specify if we want to build with Norman's jpeg image server support.
|
||||
# This requires libjpeg to be installed and available.
|
||||
# Default to with_jpeg_server=no
|
||||
JPEGLIB=''
|
||||
AC_ARG_WITH(jpeg_factory, [ --with-jpeg-factory Include Norman's jpeg image factory support code])
|
||||
if test "x$with_jpeg_factory" = "xyes" ; then
|
||||
echo "Building with Norman's jpeg image factory support"
|
||||
AC_CHECK_LIB(jpeg, jpeg_start_compress)
|
||||
if test "x$ac_cv_lib_jpeg_jpeg_start_compress" != "xyes" ; then
|
||||
echo
|
||||
echo "In order to build the jpeg factory code you need libjpeg installed."
|
||||
echo "otherwise please configure with the --with-jpeg-sever=no option"
|
||||
echo
|
||||
echo "libjpeg is available at :"
|
||||
echo " ftp://ftp.uu.net in the directory graphics/jpeg"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Building without Norman's jpeg image server support"
|
||||
fi
|
||||
AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
|
||||
|
||||
|
||||
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"
|
||||
AC_EGREP_CPP(yes,
|
||||
[#ifdef __MINGW32__
|
||||
yes
|
||||
#endif
|
||||
],is_mingw=yes, is_mingw=no)
|
||||
|
||||
if test -d /opt/X11R6 ; then
|
||||
EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
|
||||
echo "IS_MINGW = $is_mingw"
|
||||
AM_CONDITIONAL(IS_MINGW, test "x$is_mingw" = "xyes")
|
||||
|
||||
AC_EGREP_CPP(yes,
|
||||
[#ifdef __CYGWIN__
|
||||
yes
|
||||
#endif
|
||||
],is_cygwin=yes, is_cygwin=no)
|
||||
|
||||
echo "IS_CYGWIN = $is_cygwin"
|
||||
AM_CONDITIONAL(IS_CYGWIN, test "x$is_cygwin" = "xyes")
|
||||
|
||||
if test "x$HOSTTYPE" != "xmacintosh" -a "x$is_mingw" != "xyes"; then
|
||||
dnl extra library and include directories
|
||||
EXTRA_DIRS="/usr/X11R6"
|
||||
|
||||
if test -d /opt/X11R6 ; then
|
||||
EXTRA_DIRS="$EXTRA_DIRS /opt/X11R6"
|
||||
fi
|
||||
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
|
||||
@@ -90,11 +129,11 @@ 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 X11 might be installed on Mac OS X, don't want to use it if it is.
|
||||
if test "x$HOSTTYPE" != "xmacintosh" ; then
|
||||
dnl Check for X11 (fancy)
|
||||
AC_PATH_XTRA
|
||||
fi
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
@@ -114,18 +153,27 @@ fi
|
||||
AM_CONDITIONAL(HAVE_THREADS, test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes")
|
||||
|
||||
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 X11 might be installed, but we don't want to use it for OSX -dw-
|
||||
if test "x$HOSTTYPE" != "xmacintosh" ; then
|
||||
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)
|
||||
fi
|
||||
|
||||
dnl check for OpenGL related libraries
|
||||
|
||||
if test "x$ac_cv_header_windows_h" != "xyes" ; then
|
||||
dnl Reasonable stuff for non-windoze variants ... :-)
|
||||
AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
|
||||
|
||||
if test "x$HOSTTYPE" = "xmacintosh" ; then
|
||||
dnl Macintosh OSX
|
||||
LIBS="$LIBS -framework OpenGL -framework GLUT"
|
||||
elif test "x$ac_cv_header_windows_h" != "xyes" ; then
|
||||
dnl Reasonable stuff for X-Windows based machines
|
||||
|
||||
AC_CHECK_LIB(GLcore, glNewList)
|
||||
if test "x$ac_cv_lib_GLcore_glNewList" = "xno" ; then
|
||||
@@ -142,10 +190,10 @@ if test "x$ac_cv_header_windows_h" != "xyes" ; then
|
||||
|
||||
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 )
|
||||
AC_CHECK_HEADER(GL/fxmesa.h)
|
||||
if test "x$ac_cv_header_GL_fxmesa_h" = "xyes"; then
|
||||
AC_DEFINE([XMESA], 1, [Define for fxmesa])
|
||||
AC_DEFINE([FX], 1, [Define for fxmesa])
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -164,14 +212,11 @@ if test "x$ac_cv_header_windows_h" != "xyes" ; then
|
||||
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.
|
||||
dnl Win32 libs
|
||||
|
||||
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")
|
||||
AC_DEFINE([WIN32], 1, [Define for Win32 platforms])
|
||||
AC_DEFINE([NOMINMAX], 1, [Define for Win32 platforms])
|
||||
|
||||
dnl just define these to true and hope for the best
|
||||
ac_cv_lib_glut_glutGetModifiers="yes"
|
||||
@@ -191,6 +236,9 @@ else
|
||||
|
||||
LIBS="$LIBS -l${WIN32_GLUT} -l${WIN32_GLU} -l${WIN32_OPENGL}"
|
||||
LIBS="$LIBS -luser32 -lgdi32"
|
||||
if test "x$is_mingw" = "xyes" ; then
|
||||
EXTRA_DIRS="${EXTRA_DIRS}"
|
||||
fi
|
||||
echo "Will link apps with $LIBS"
|
||||
fi
|
||||
|
||||
@@ -204,7 +252,9 @@ 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 "You need to install the latest version of glut. If your"
|
||||
echo "distribution doesn't provide a newer version, you can get the source"
|
||||
echo "code from:"
|
||||
echo
|
||||
echo " http://reality.sgi.com/opengl/glut3/glut3.html"
|
||||
exit 1
|
||||
@@ -218,12 +268,17 @@ AC_SUBST(opengl_LIBS)
|
||||
|
||||
AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
|
||||
|
||||
# The following are C++ items that need to be tested for with the c++
|
||||
# compiler
|
||||
|
||||
AC_LANG_PUSH(C++)
|
||||
|
||||
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
|
||||
AC_CHECK_HEADER(plib/ul.h)
|
||||
if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
|
||||
echo
|
||||
echo "You *must* have the plib library installed on your system to build"
|
||||
echo "the FGFS simulator!"
|
||||
echo "SimGear!"
|
||||
echo
|
||||
echo "Please see README.plib for more details."
|
||||
echo
|
||||
@@ -231,35 +286,50 @@ if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# dnl Check for system installed gdbm
|
||||
# AC_CHECK_HEADER(gdbm.h)
|
||||
# if test "x$ac_cv_header_gdbm_h" = "xyes"; then
|
||||
# AC_DEFINE( HAVE_GDBM )
|
||||
# else
|
||||
# echo "no gdbm found, configuring and building."
|
||||
# fi
|
||||
# AM_CONDITIONAL(HAVE_GDBM, test "x$ac_cv_header_gdbm_h" = "xyes" )
|
||||
AC_MSG_CHECKING([for plib 1.6.0 or newer])
|
||||
AC_TRY_RUN([
|
||||
#include <plib/ul.h>
|
||||
|
||||
#define MIN_PLIB_VERSION 160
|
||||
|
||||
int main() {
|
||||
int major, minor, micro;
|
||||
|
||||
if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
],
|
||||
AC_MSG_RESULT(yes),
|
||||
[AC_MSG_RESULT(wrong version);
|
||||
AC_MSG_ERROR([Install plib 1.6.0 or later first...])],
|
||||
AC_MSG_RESULT(yes)
|
||||
)
|
||||
|
||||
dnl Check for system installed metakit
|
||||
AC_CHECK_HEADER(mk4.h)
|
||||
if test "x$ac_cv_header_mk4_h" != "xyes"; then
|
||||
echo "no metakit found, configuring and building."
|
||||
# Run configure in the metakit subdir
|
||||
AC_CONFIG_SUBDIRS( simgear/metakit/unix )
|
||||
echo
|
||||
echo "Metakit not found, you will need to install this first."
|
||||
echo "Please read the README.metakit for more information."
|
||||
exit
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_METAKIT, test "x$ac_cv_header_mk4_h" = "xyes" )
|
||||
|
||||
AC_LANG_POP
|
||||
|
||||
dnl Specify if we want logging (testing build) or not (release build)
|
||||
|
||||
dnl Check for system installed zlib
|
||||
AC_CHECK_HEADER(zlib.h)
|
||||
if test "x$ac_cv_header_zlib_h" = "xyes"; then
|
||||
AC_DEFINE( HAVE_ZLIB )
|
||||
else
|
||||
echo "no zlib found, building."
|
||||
if test "x$ac_cv_header_zlib_h" != "xyes"; then
|
||||
echo
|
||||
echo "zlib not found, you will need to install this first."
|
||||
echo "Please read the README.zlib for more information."
|
||||
exit
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_ZLIB, test "x$ac_cv_header_zlib_h" = "xyes" )
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
@@ -268,7 +338,7 @@ AC_CHECK_HEADERS( \
|
||||
sys/stat.h sys/time.h sys/timeb.h unistd.h windows.h winbase.h values.h )
|
||||
|
||||
if test "x$ac_cv_header_stdint_h" = "xyes"; then
|
||||
AC_DEFINE( HAVE_STDINT_H )
|
||||
AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
|
||||
fi
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
@@ -281,13 +351,14 @@ 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 )
|
||||
random drand48 setitimer getitimer signal GetLocalTime rint getrusage )
|
||||
|
||||
AM_CONFIG_HEADER(simgear/simgear_config.h)
|
||||
|
||||
AC_OUTPUT( \
|
||||
AC_CONFIG_FILES([ \
|
||||
Makefile \
|
||||
SimGear.spec \
|
||||
src-libs/Makefile \
|
||||
simgear/Makefile \
|
||||
simgear/version.h \
|
||||
simgear/bucket/Makefile \
|
||||
@@ -302,18 +373,14 @@ AC_OUTPUT( \
|
||||
simgear/screen/Makefile \
|
||||
simgear/serial/Makefile \
|
||||
simgear/sky/Makefile \
|
||||
simgear/sky/clouds3d/Makefile \
|
||||
simgear/threads/Makefile \
|
||||
simgear/timing/Makefile \
|
||||
simgear/xgl/Makefile \
|
||||
simgear/xml/Makefile \
|
||||
simgear/zlib/Makefile \
|
||||
)
|
||||
|
||||
AC_OUTPUT_COMMANDS([
|
||||
# if test "x$ac_cv_header_windows_h" = "xyes" ; then
|
||||
# cp simgear/gdbm/autoconf.h.cygwin32 simgear/gdbm/autoconf.h
|
||||
# fi
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
||||
|
||||
echo ""
|
||||
echo "Configure Summary"
|
||||
@@ -327,22 +394,13 @@ else
|
||||
echo "Debug messages: yes"
|
||||
fi
|
||||
|
||||
if test "x$with_efence" != "x"; then
|
||||
echo "Electric fence: $with_efence"
|
||||
echo -n "Automake version: ($AUTO_MAKE_VERSION) "
|
||||
automake --version | head -1
|
||||
|
||||
if test "x$with_jpeg_factory" = "xyes"; then
|
||||
echo "With JPEG Factory support"
|
||||
else
|
||||
echo "Electric fence: no"
|
||||
fi
|
||||
|
||||
# if test "x$ac_cv_header_gdbm_h" != "xyes"; then
|
||||
# echo "Building gdbm"
|
||||
# fi
|
||||
|
||||
if test "x$ac_cv_header_mk4_h" != "xyes"; then
|
||||
echo "Building metakit"
|
||||
fi
|
||||
|
||||
if test "x$ac_cv_header_zlib_h" != "xyes"; then
|
||||
echo "Building zlib"
|
||||
echo "Without JPEG Factory support"
|
||||
fi
|
||||
|
||||
if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h" = "xyes"; then
|
||||
@@ -350,9 +408,3 @@ if test "x$ac_cv_lib_pthread_pthread_exit" = "xyes" -a "x$ac_cv_header_pthread_h
|
||||
else
|
||||
echo "Threads: no threads (pthread lib not found.)"
|
||||
fi
|
||||
|
||||
if test "$OS" = "IRIX" -o "$OS" = "IRIX64"; then
|
||||
if test "$CXX" = "CC"; then
|
||||
echo "\nRemember to run: sh ../FlightGear/irix-hack.sh!\07\n"
|
||||
fi
|
||||
fi
|
||||
@@ -1,42 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
echo ""
|
||||
echo "running $0 to rebuild simgear include links"
|
||||
|
||||
# toast the old directory
|
||||
rm -rf src/simgear
|
||||
mkdir src/simgear
|
||||
mkdir src/simgear/bucket
|
||||
mkdir src/simgear/debug
|
||||
mkdir src/simgear/math
|
||||
mkdir src/simgear/misc
|
||||
mkdir src/simgear/screen
|
||||
mkdir src/simgear/serial
|
||||
mkdir src/simgear/xgl
|
||||
mkdir src/simgear/zlib
|
||||
|
||||
# build new links
|
||||
ln -s ../include/compiler.h src/simgear/compiler.h
|
||||
ln -s ../include/constants.h src/simgear/constants.h
|
||||
ln -s ../include/fg_traits.hxx src/simgear/fg_traits.hxx
|
||||
ln -s ../include/fg_zlib.h src/simgear/fg_zlib.h
|
||||
ln -s ../include/version.h src/simgear/version.h
|
||||
|
||||
ln -s ../../bucket/newbucket.hxx src/simgear/bucket/newbucket.hxx
|
||||
|
||||
ln -s ../../debug/debug_types.h src/simgear/debug/debug_types.h
|
||||
ln -s ../../debug/logstream.hxx src/simgear/debug/logstream.hxx
|
||||
|
||||
ln -s ../../math/fg_memory.h src/simgear/math/fg_memory.h
|
||||
ln -s ../../math/fg_types.hxx src/simgear/math/fg_types.hxx
|
||||
ln -s ../../math/point3d.hxx src/simgear/math/point3d.hxx
|
||||
ln -s ../../math/polar3d.hxx src/simgear/math/polar3d.hxx
|
||||
|
||||
ln -s ../../misc/fgpath.hxx src/simgear/misc/fgpath.hxx
|
||||
ln -s ../../misc/fgstream.hxx src/simgear/misc/fgstream.hxx
|
||||
ln -s ../../misc/zfstream.hxx src/simgear/misc/zfstream.hxx
|
||||
|
||||
ln -s ../../xgl/xgl.h src/simgear/xgl/xgl.h
|
||||
|
||||
ln -s ../../zlib/zlib.h src/simgear/zlib/zlib.h
|
||||
ln -s ../../zlib/zconf.h src/simgear/zlib/zconf.h
|
||||
8
simgear/.cvsignore
Normal file
8
simgear/.cvsignore
Normal file
@@ -0,0 +1,8 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
simgear_config.h
|
||||
simgear_config.h.in
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
stamp-h1
|
||||
version.h
|
||||
@@ -1,21 +1,3 @@
|
||||
if ENABLE_UNIX_SERIAL
|
||||
SERIAL_DIRS = serial
|
||||
else
|
||||
SERIAL_DIRS =
|
||||
endif
|
||||
|
||||
# if HAVE_GDBM
|
||||
# GDBM_DIRS =
|
||||
# else
|
||||
# GDBM_DIRS = gdbm
|
||||
# endif
|
||||
|
||||
if HAVE_ZLIB
|
||||
ZLIB_DIRS =
|
||||
else
|
||||
ZLIB_DIRS = zlib
|
||||
endif
|
||||
|
||||
if HAVE_THREADS
|
||||
SGTHREAD_DIR = threads
|
||||
else
|
||||
@@ -25,13 +7,12 @@ endif
|
||||
# METAR_DIRS =
|
||||
METAR_DIRS = metar
|
||||
|
||||
EXTRA_DIST = version.h.in
|
||||
EXTRA_DIST = simgear_config.h.vc5 version.h.in
|
||||
|
||||
include_HEADERS = \
|
||||
compiler.h constants.h sg_inlines.h sg_traits.hxx sg_zlib.h version.h
|
||||
|
||||
SUBDIRS = \
|
||||
$(ZLIB_DIRS) \
|
||||
xml \
|
||||
debug \
|
||||
misc \
|
||||
@@ -43,9 +24,10 @@ SUBDIRS = \
|
||||
$(METAR_DIRS) \
|
||||
route \
|
||||
screen \
|
||||
$(SERIAL_DIRS) \
|
||||
serial \
|
||||
sky \
|
||||
$(SGTHREAD_DIR) \
|
||||
timing \
|
||||
xgl
|
||||
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
|
||||
3
simgear/bucket/.cvsignore
Normal file
3
simgear/bucket/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -14,4 +14,4 @@ libsgbucket_a_SOURCES = newbucket.cxx
|
||||
# $(top_builddir)/bucket/libsgbucket.a \
|
||||
# $(top_builddir)/misc/libsgmisc.a
|
||||
|
||||
INCLUDES += -I$(top_srcdir)
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
@@ -71,6 +71,14 @@
|
||||
#ifndef _SG_COMPILER_H
|
||||
#define _SG_COMPILER_H
|
||||
|
||||
/*
|
||||
* Helper macro SG_STRINGIZE:
|
||||
* Converts the parameter X to a string after macro replacement
|
||||
* on X has been performed.
|
||||
*/
|
||||
#define SG_STRINGIZE(X) SG_DO_STRINGIZE(X)
|
||||
#define SG_DO_STRINGIZE(X) #X
|
||||
|
||||
#ifdef __GNUC__
|
||||
# if __GNUC__ == 2
|
||||
# if __GNUC_MINOR__ < 8
|
||||
@@ -133,10 +141,18 @@
|
||||
# define STL_STDEXCEPT <stdexcept>
|
||||
# define STL_STRING <string>
|
||||
# define STL_STRSTREAM <strstream>
|
||||
|
||||
# else
|
||||
# error Time to upgrade. GNU compilers < 2.7 not supported
|
||||
# endif
|
||||
|
||||
# define SG_COMPILER_STR "GNU C++ version " SG_STRINGIZE(__GNUC__) "." SG_STRINGIZE(__GNUC_MINOR__)
|
||||
|
||||
#endif // __GNUC__
|
||||
|
||||
#if defined( __MINGW32__ )
|
||||
# define bcopy(from, to, n) memcpy(to, from, n)
|
||||
# define FG_MEM_COPY(to,from,n) memcpy(to, from, n)
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
/* KAI C++ */
|
||||
@@ -157,7 +173,10 @@
|
||||
# define STL_STDEXCEPT <stdexcept>
|
||||
# define STL_STRING <string>
|
||||
# define STL_STRSTREAM <strstream>
|
||||
#endif
|
||||
|
||||
# define SG_COMPILER_STR "Kai C++ version " SG_STRINGIZE(__KCC_VERSION)
|
||||
|
||||
#endif // __KCC
|
||||
|
||||
//
|
||||
// Metrowerks
|
||||
@@ -188,7 +207,10 @@
|
||||
|
||||
// -dw- currently used glut has no game mode stuff
|
||||
# define GLUT_WRONG_VERSION
|
||||
#endif
|
||||
|
||||
# define SG_COMPILER_STR "Metrowerks CodeWarrior C++ version " SG_STRINGIZE(__MWERKS__)
|
||||
|
||||
#endif // __MWERKS__
|
||||
|
||||
//
|
||||
// Microsoft compilers.
|
||||
@@ -213,13 +235,19 @@
|
||||
# define STL_STRING <string>
|
||||
# define STL_STRSTREAM <strstream>
|
||||
|
||||
# define snprintf _snprintf
|
||||
|
||||
# pragma warning(disable: 4786) // identifier was truncated to '255' characters
|
||||
# pragma warning(disable: 4244) // conversion from double to float
|
||||
# pragma warning(disable: 4305) //
|
||||
|
||||
# else
|
||||
# error What version of MSVC++ is this?
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# define SG_COMPILER_STR "Microsoft Visual C++ version " SG_STRINGIZE(_MSC_VER)
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
# if defined(HAVE_SGI_STL_PORT)
|
||||
@@ -251,6 +279,8 @@
|
||||
# define SG_NAMESPACES
|
||||
// # define SG_HAVE_STD
|
||||
|
||||
# define SG_COMPILER_STR "Borland C++ version " SG_STRINGIZE(__BORLANDC__)
|
||||
|
||||
#endif // __BORLANDC__
|
||||
|
||||
//
|
||||
@@ -278,6 +308,21 @@
|
||||
# define STL_STRING <string>
|
||||
# define STL_STRSTREAM <strstream.h>
|
||||
|
||||
// # define __STL_FUNCTION_TMPL_PARTIAL_ORDER
|
||||
// typedef void PFNGLPOINTPARAMETERFEXTPROC
|
||||
|
||||
#define glPointParameterfEXT glPointParameterfSGIS
|
||||
#define glPointParameterfvEXT glPointParameterfvSGIS
|
||||
|
||||
#pragma set woff 1001,1012,1014,1116,1155,1172,1174
|
||||
#pragma set woff 1401,1460,1551,1552,1681
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma set woff 1682,3303
|
||||
#endif
|
||||
|
||||
# define SG_COMPILER_STR "SGI Irix compiler version " SG_STRINGIZE(_COMPILER_VERSION)
|
||||
|
||||
#endif // Native SGI compilers
|
||||
|
||||
|
||||
@@ -292,8 +337,35 @@
|
||||
# else
|
||||
extern void *memmove(void *, const void *, size_t);
|
||||
# endif // __cplusplus
|
||||
|
||||
# define SG_COMPILER_STR "Sun compiler version " SG_STRINGIZE(__SUNPRO_CC)
|
||||
|
||||
#endif // sun
|
||||
|
||||
//
|
||||
// Intel C++ Compiler
|
||||
//
|
||||
#if defined(__ICC) || defined (__ECC)
|
||||
# define SG_NAMESPACES
|
||||
# define SG_HAVE_STD
|
||||
# define SG_HAVE_STREAMBUF
|
||||
# define SG_HAVE_TRAITS
|
||||
# define SG_HAVE_STD_INCLUDES
|
||||
|
||||
# define STL_ALGORITHM <algorithm>
|
||||
# define STL_FUNCTIONAL <functional>
|
||||
# define STL_IOMANIP <iomanip>
|
||||
# define STL_IOSTREAM <iostream>
|
||||
# define STL_ITERATOR <iterator>
|
||||
# define STL_FSTREAM <fstream>
|
||||
# define STL_STDEXCEPT <stdexcept>
|
||||
# define STL_STRING <string>
|
||||
# define STL_STRSTREAM <strstream>
|
||||
|
||||
# define SG_COMPILER_STR "Intel C++ version " SG_STRINGIZE(__ICC)
|
||||
|
||||
#endif // __ICC
|
||||
|
||||
//
|
||||
// No user modifiable definitions beyond here.
|
||||
//
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
|
||||
/** Highest binobj format version we know how to read/write. This starts at
|
||||
* 0 and can go up to 65535 */
|
||||
#define SG_BINOBJ_VERSION 5
|
||||
#define SG_BINOBJ_VERSION 6
|
||||
|
||||
/** for backwards compatibility */
|
||||
#define SG_SCENERY_FILE_FORMAT "0.4"
|
||||
|
||||
3
simgear/debug/.cvsignore
Normal file
3
simgear/debug/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -8,4 +8,4 @@ include_HEADERS = debug_types.h logstream.hxx
|
||||
|
||||
libsgdebug_a_SOURCES = logstream.cxx
|
||||
|
||||
INCLUDES += -I$(top_srcdir)
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "logstream.hxx"
|
||||
|
||||
logstream *global_logstream = NULL;
|
||||
|
||||
bool logbuf::logging_enabled = true;
|
||||
sgDebugClass logbuf::logClass = SG_NONE;
|
||||
sgDebugPriority logbuf::logPriority = SG_INFO;
|
||||
@@ -56,6 +58,30 @@ logbuf::set_log_level( sgDebugClass c, sgDebugPriority p )
|
||||
logPriority = p;
|
||||
}
|
||||
|
||||
void
|
||||
logbuf::set_log_classes (sgDebugClass c)
|
||||
{
|
||||
logClass = c;
|
||||
}
|
||||
|
||||
sgDebugClass
|
||||
logbuf::get_log_classes ()
|
||||
{
|
||||
return logClass;
|
||||
}
|
||||
|
||||
void
|
||||
logbuf::set_log_priority (sgDebugPriority p)
|
||||
{
|
||||
logPriority = p;
|
||||
}
|
||||
|
||||
sgDebugPriority
|
||||
logbuf::get_log_priority ()
|
||||
{
|
||||
return logPriority;
|
||||
}
|
||||
|
||||
void
|
||||
logstream::setLogLevels( sgDebugClass c, sgDebugPriority p )
|
||||
{
|
||||
|
||||
@@ -105,6 +105,35 @@ public:
|
||||
*/
|
||||
static void set_log_level( sgDebugClass c, sgDebugPriority p );
|
||||
|
||||
|
||||
/**
|
||||
* Set the allowed logging classes.
|
||||
* @param c All enabled logging classes anded together.
|
||||
*/
|
||||
static void set_log_classes (sgDebugClass c);
|
||||
|
||||
|
||||
/**
|
||||
* Get the logging classes currently enabled.
|
||||
* @return All enabled debug logging anded together.
|
||||
*/
|
||||
static sgDebugClass get_log_classes ();
|
||||
|
||||
|
||||
/**
|
||||
* Set the logging priority.
|
||||
* @param c The priority cutoff for logging messages.
|
||||
*/
|
||||
static void set_log_priority (sgDebugPriority p);
|
||||
|
||||
|
||||
/**
|
||||
* Get the current logging priority.
|
||||
* @return The priority cutoff for logging messages.
|
||||
*/
|
||||
static sgDebugPriority get_log_priority ();
|
||||
|
||||
|
||||
/**
|
||||
* Set the stream buffer
|
||||
* @param sb stream buffer
|
||||
@@ -227,6 +256,7 @@ logstream::operator<< ( const loglevel& l )
|
||||
return *this;
|
||||
}
|
||||
|
||||
extern logstream *global_logstream;
|
||||
|
||||
/**
|
||||
* \relates logstream
|
||||
@@ -238,8 +268,22 @@ logstream::operator<< ( const loglevel& l )
|
||||
inline logstream&
|
||||
sglog()
|
||||
{
|
||||
static logstream logstrm( cerr );
|
||||
return logstrm;
|
||||
if (global_logstream == NULL) {
|
||||
|
||||
#ifdef __APPLE__
|
||||
/**
|
||||
* There appears to be a bug in the C++ runtime in Mac OS X that
|
||||
* will crash if certain funtions are called (in this case
|
||||
* cerr.rdbuf()) during static initialization of a class. This
|
||||
* print statement is hack to kick the library in the pants so it
|
||||
* won't crash when cerr.rdbuf() is first called -DW
|
||||
**/
|
||||
cout << "Using Mac OS X hack for initializing C++ stdio..." << endl;
|
||||
#endif
|
||||
global_logstream = new logstream (cerr);
|
||||
}
|
||||
|
||||
return *global_logstream;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,32 @@
|
||||
#include <string>
|
||||
#include "Debug/logstream.hxx"
|
||||
|
||||
class Test {
|
||||
|
||||
public:
|
||||
Test() {
|
||||
//cout << "Cout seems to work" << endl;
|
||||
//cerr << "Cerr seems to work" << endl;
|
||||
|
||||
sglog().setLogLevels( SG_ALL, SG_INFO );
|
||||
|
||||
SG_LOG(SG_EVENT, SG_INFO, "Test::Test" << "foo");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Test test;
|
||||
|
||||
int
|
||||
main( int argc, char* argv[] )
|
||||
{
|
||||
fglog().setLogLevels( SG_ALL, SG_INFO );
|
||||
sglog().setLogLevels( SG_ALL, SG_INFO );
|
||||
|
||||
SG_LOG( FG_TERRAIN, FG_BULK, "terrain::bulk" ); // shouldnt appear
|
||||
SG_LOG( FG_TERRAIN, SG_DEBUG, "terrain::debug" ); // shouldnt appear
|
||||
SG_LOG( FG_TERRAIN, SG_INFO, "terrain::info" );
|
||||
SG_LOG( FG_TERRAIN, FG_WARN, "terrain::warn" );
|
||||
SG_LOG( FG_TERRAIN, SG_ALERT, "terrain::alert" );
|
||||
//SG_LOG( FG_TERRAIN, FG_BULK, "terrain::bulk" ); // shouldnt appear
|
||||
//SG_LOG( FG_TERRAIN, SG_DEBUG, "terrain::debug" ); // shouldnt appear
|
||||
//SG_LOG( FG_TERRAIN, SG_INFO, "terrain::info" );
|
||||
//SG_LOG( FG_TERRAIN, FG_WARN, "terrain::warn" );
|
||||
//SG_LOG( FG_TERRAIN, SG_ALERT, "terrain::alert" );
|
||||
|
||||
int i = 12345;
|
||||
long l = 54321L;
|
||||
|
||||
3
simgear/ephemeris/.cvsignore
Normal file
3
simgear/ephemeris/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -31,4 +31,4 @@ libsgephem_a_SOURCES = \
|
||||
uranus.cxx \
|
||||
venus.cxx
|
||||
|
||||
INCLUDES += -I$(top_srcdir)
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
@@ -158,22 +158,112 @@ double CelestialBody::sgCalcEccAnom(double M, double e)
|
||||
return eccAnom;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* inline CelestialBody::CelestialBody
|
||||
* public constructor for a generic celestialBody object.
|
||||
* initializes the 6 primary orbital elements. The elements are:
|
||||
* N: longitude of the ascending node
|
||||
* i: inclination to the ecliptic
|
||||
* w: argument of perihelion
|
||||
* a: semi-major axis, or mean distance from the sun
|
||||
* e: eccenticity
|
||||
* M: mean anomaly
|
||||
* Each orbital element consists of a constant part and a variable part that
|
||||
* gradually changes over time.
|
||||
*
|
||||
* Argumetns:
|
||||
* the 13 arguments to the constructor constitute the first, constant
|
||||
* ([NiwaeM]f) and the second variable ([NiwaeM]s) part of the orbital
|
||||
* elements. The 13th argument is the current time. Note that the inclination
|
||||
* is written with a capital (If, Is), because 'if' is a reserved word in the
|
||||
* C/C++ programming language.
|
||||
***************************************************************************/
|
||||
CelestialBody::CelestialBody(double Nf, double Ns,
|
||||
double If, double Is,
|
||||
double wf, double ws,
|
||||
double af, double as,
|
||||
double ef, double es,
|
||||
double Mf, double Ms, double mjd)
|
||||
{
|
||||
NFirst = Nf; NSec = Ns;
|
||||
iFirst = If; iSec = Is;
|
||||
wFirst = wf; wSec = ws;
|
||||
aFirst = af; aSec = as;
|
||||
eFirst = ef; eSec = es;
|
||||
MFirst = Mf; MSec = Ms;
|
||||
updateOrbElements(mjd);
|
||||
}
|
||||
|
||||
CelestialBody::CelestialBody(double Nf, double Ns,
|
||||
double If, double Is,
|
||||
double wf, double ws,
|
||||
double af, double as,
|
||||
double ef, double es,
|
||||
double Mf, double Ms)
|
||||
{
|
||||
NFirst = Nf; NSec = Ns;
|
||||
iFirst = If; iSec = Is;
|
||||
wFirst = wf; wSec = ws;
|
||||
aFirst = af; aSec = as;
|
||||
eFirst = ef; eSec = es;
|
||||
MFirst = Mf; MSec = Ms;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* inline void CelestialBody::updateOrbElements(double mjd)
|
||||
* given the current time, this private member calculates the actual
|
||||
* orbital elements
|
||||
*
|
||||
* Arguments: double mjd: the current modified julian date:
|
||||
*
|
||||
* return value: none
|
||||
***************************************************************************/
|
||||
void CelestialBody::updateOrbElements(double mjd)
|
||||
{
|
||||
double actTime = sgCalcActTime(mjd);
|
||||
M = SGD_DEGREES_TO_RADIANS * (MFirst + (MSec * actTime));
|
||||
w = SGD_DEGREES_TO_RADIANS * (wFirst + (wSec * actTime));
|
||||
N = SGD_DEGREES_TO_RADIANS * (NFirst + (NSec * actTime));
|
||||
i = SGD_DEGREES_TO_RADIANS * (iFirst + (iSec * actTime));
|
||||
e = eFirst + (eSec * actTime);
|
||||
a = aFirst + (aSec * actTime);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* inline double CelestialBody::sgCalcActTime(double mjd)
|
||||
* this private member function returns the offset in days from the epoch for
|
||||
* wich the orbital elements are calculated (Jan, 1st, 2000).
|
||||
*
|
||||
* Argument: the current time
|
||||
*
|
||||
* return value: the (fractional) number of days until Jan 1, 2000.
|
||||
****************************************************************************/
|
||||
double CelestialBody::sgCalcActTime(double mjd)
|
||||
{
|
||||
return (mjd - 36523.5);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* inline void CelestialBody::getPos(double* ra, double* dec)
|
||||
* gives public access to Right Ascension and declination
|
||||
*
|
||||
****************************************************************************/
|
||||
void CelestialBody::getPos(double* ra, double* dec)
|
||||
{
|
||||
*ra = rightAscension;
|
||||
*dec = declination;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* inline void CelestialBody::getPos(double* ra, double* dec, double* magnitude
|
||||
* gives public acces to the current Right ascension, declination, and
|
||||
* magnitude
|
||||
****************************************************************************/
|
||||
void CelestialBody::getPos(double* ra, double* dec, double* magn)
|
||||
{
|
||||
*ra = rightAscension;
|
||||
*dec = declination;
|
||||
*magn = magnitude;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -87,113 +87,6 @@ public:
|
||||
void updatePosition(double mjd, Star *ourSun);
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* inline CelestialBody::CelestialBody
|
||||
* public constructor for a generic celestialBody object.
|
||||
* initializes the 6 primary orbital elements. The elements are:
|
||||
* N: longitude of the ascending node
|
||||
* i: inclination to the ecliptic
|
||||
* w: argument of perihelion
|
||||
* a: semi-major axis, or mean distance from the sun
|
||||
* e: eccenticity
|
||||
* M: mean anomaly
|
||||
* Each orbital element consists of a constant part and a variable part that
|
||||
* gradually changes over time.
|
||||
*
|
||||
* Argumetns:
|
||||
* the 13 arguments to the constructor constitute the first, constant
|
||||
* ([NiwaeM]f) and the second variable ([NiwaeM]s) part of the orbital
|
||||
* elements. The 13th argument is the current time. Note that the inclination
|
||||
* is written with a capital (If, Is), because 'if' is a reserved word in the
|
||||
* C/C++ programming language.
|
||||
***************************************************************************/
|
||||
inline CelestialBody::CelestialBody(double Nf, double Ns,
|
||||
double If, double Is,
|
||||
double wf, double ws,
|
||||
double af, double as,
|
||||
double ef, double es,
|
||||
double Mf, double Ms, double mjd)
|
||||
{
|
||||
NFirst = Nf; NSec = Ns;
|
||||
iFirst = If; iSec = Is;
|
||||
wFirst = wf; wSec = ws;
|
||||
aFirst = af; aSec = as;
|
||||
eFirst = ef; eSec = es;
|
||||
MFirst = Mf; MSec = Ms;
|
||||
updateOrbElements(mjd);
|
||||
}
|
||||
|
||||
inline CelestialBody::CelestialBody(double Nf, double Ns,
|
||||
double If, double Is,
|
||||
double wf, double ws,
|
||||
double af, double as,
|
||||
double ef, double es,
|
||||
double Mf, double Ms)
|
||||
{
|
||||
NFirst = Nf; NSec = Ns;
|
||||
iFirst = If; iSec = Is;
|
||||
wFirst = wf; wSec = ws;
|
||||
aFirst = af; aSec = as;
|
||||
eFirst = ef; eSec = es;
|
||||
MFirst = Mf; MSec = Ms;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* inline void CelestialBody::updateOrbElements(double mjd)
|
||||
* given the current time, this private member calculates the actual
|
||||
* orbital elements
|
||||
*
|
||||
* Arguments: double mjd: the current modified julian date:
|
||||
*
|
||||
* return value: none
|
||||
***************************************************************************/
|
||||
inline void CelestialBody::updateOrbElements(double mjd)
|
||||
{
|
||||
double actTime = sgCalcActTime(mjd);
|
||||
M = SGD_DEGREES_TO_RADIANS * (MFirst + (MSec * actTime));
|
||||
w = SGD_DEGREES_TO_RADIANS * (wFirst + (wSec * actTime));
|
||||
N = SGD_DEGREES_TO_RADIANS * (NFirst + (NSec * actTime));
|
||||
i = SGD_DEGREES_TO_RADIANS * (iFirst + (iSec * actTime));
|
||||
e = eFirst + (eSec * actTime);
|
||||
a = aFirst + (aSec * actTime);
|
||||
}
|
||||
/*****************************************************************************
|
||||
* inline double CelestialBody::sgCalcActTime(double mjd)
|
||||
* this private member function returns the offset in days from the epoch for
|
||||
* wich the orbital elements are calculated (Jan, 1st, 2000).
|
||||
*
|
||||
* Argument: the current time
|
||||
*
|
||||
* return value: the (fractional) number of days until Jan 1, 2000.
|
||||
****************************************************************************/
|
||||
inline double CelestialBody::sgCalcActTime(double mjd)
|
||||
{
|
||||
return (mjd - 36523.5);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* inline void CelestialBody::getPos(double* ra, double* dec)
|
||||
* gives public access to Right Ascension and declination
|
||||
*
|
||||
****************************************************************************/
|
||||
inline void CelestialBody::getPos(double* ra, double* dec)
|
||||
{
|
||||
*ra = rightAscension;
|
||||
*dec = declination;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* inline void CelestialBody::getPos(double* ra, double* dec, double* magnitude
|
||||
* gives public acces to the current Right ascension, declination, and
|
||||
* magnitude
|
||||
****************************************************************************/
|
||||
inline void CelestialBody::getPos(double* ra, double* dec, double* magn)
|
||||
{
|
||||
*ra = rightAscension;
|
||||
*dec = declination;
|
||||
*magn = magnitude;
|
||||
}
|
||||
|
||||
inline double CelestialBody::getRightAscension() { return rightAscension; }
|
||||
inline double CelestialBody::getDeclination() { return declination; }
|
||||
inline double CelestialBody::getMagnitude() { return magnitude; }
|
||||
@@ -210,14 +103,3 @@ inline double CelestialBody::getLat()
|
||||
|
||||
#endif // _CELESTIALBODY_H_
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -32,10 +32,14 @@
|
||||
#endif
|
||||
|
||||
// Constructor
|
||||
SGStarData::SGStarData() {
|
||||
SGStarData::SGStarData() :
|
||||
nstars(0)
|
||||
{
|
||||
}
|
||||
|
||||
SGStarData::SGStarData( SGPath path ) {
|
||||
SGStarData::SGStarData( SGPath path ) :
|
||||
nstars(0)
|
||||
{
|
||||
data_path = SGPath( path );
|
||||
load();
|
||||
}
|
||||
|
||||
8
simgear/io/.cvsignore
Normal file
8
simgear/io/.cvsignore
Normal file
@@ -0,0 +1,8 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
decode_binobj
|
||||
lowtest
|
||||
socktest
|
||||
tcp_client
|
||||
tcp_server
|
||||
@@ -8,7 +8,8 @@ include_HEADERS = \
|
||||
sg_binobj.hxx \
|
||||
sg_file.hxx \
|
||||
sg_serial.hxx \
|
||||
sg_socket.hxx
|
||||
sg_socket.hxx \
|
||||
sg_socket_udp.hxx
|
||||
|
||||
libsgio_a_SOURCES = \
|
||||
iochannel.cxx \
|
||||
@@ -16,11 +17,38 @@ libsgio_a_SOURCES = \
|
||||
sg_binobj.cxx \
|
||||
sg_file.cxx \
|
||||
sg_serial.cxx \
|
||||
sg_socket.cxx
|
||||
sg_socket.cxx \
|
||||
sg_socket_udp.cxx
|
||||
|
||||
INCLUDES += -I$(top_srcdir)
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
noinst_PROGRAMS = decode_binobj socktest lowtest
|
||||
if IS_MINGW
|
||||
NETWORK_LIB = -lwsock32
|
||||
else
|
||||
NETWORK_LIB =
|
||||
endif
|
||||
|
||||
noinst_PROGRAMS = decode_binobj socktest lowtest tcp_server tcp_client
|
||||
|
||||
tcp_server_SOURCES = tcp_server.cxx
|
||||
|
||||
tcp_server_LDADD = \
|
||||
$(top_builddir)/simgear/io/libsgio.a \
|
||||
$(top_builddir)/simgear/debug/libsgdebug.a \
|
||||
$(top_builddir)/simgear/bucket/libsgbucket.a \
|
||||
$(top_builddir)/simgear/misc/libsgmisc.a \
|
||||
$(top_builddir)/simgear/xml/libsgxml.a \
|
||||
-lplibnet -lplibul -lz $(NETWORK_LIB)
|
||||
|
||||
tcp_client_SOURCES = tcp_client.cxx
|
||||
|
||||
tcp_client_LDADD = \
|
||||
$(top_builddir)/simgear/io/libsgio.a \
|
||||
$(top_builddir)/simgear/debug/libsgdebug.a \
|
||||
$(top_builddir)/simgear/bucket/libsgbucket.a \
|
||||
$(top_builddir)/simgear/misc/libsgmisc.a \
|
||||
$(top_builddir)/simgear/xml/libsgxml.a \
|
||||
-lplibnet -lplibul -lz $(NETWORK_LIB)
|
||||
|
||||
socktest_SOURCES = socktest.cxx
|
||||
|
||||
@@ -29,7 +57,8 @@ socktest_LDADD = \
|
||||
$(top_builddir)/simgear/io/libsgio.a \
|
||||
$(top_builddir)/simgear/debug/libsgdebug.a \
|
||||
$(top_builddir)/simgear/misc/libsgmisc.a \
|
||||
-lz
|
||||
$(top_builddir)/simgear/xml/libsgxml.a \
|
||||
-lplibnet -lplibul -lz $(NETWORK_LIB)
|
||||
|
||||
lowtest_SOURCES = lowtest.cxx
|
||||
|
||||
@@ -43,4 +72,5 @@ decode_binobj_LDADD = \
|
||||
$(top_builddir)/simgear/bucket/libsgbucket.a \
|
||||
$(top_builddir)/simgear/misc/libsgmisc.a \
|
||||
$(top_builddir)/simgear/debug/libsgdebug.a \
|
||||
-lz
|
||||
$(top_builddir)/simgear/xml/libsgxml.a \
|
||||
-lz
|
||||
|
||||
@@ -58,25 +58,49 @@ int main( int argc, char **argv ) {
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
cout << "# triangle groups" << endl;
|
||||
cout << "# geometry groups" << endl;
|
||||
cout << endl;
|
||||
|
||||
string material;
|
||||
int_list vertex_index;
|
||||
int_list normal_index;
|
||||
int_list tex_index;
|
||||
|
||||
// generate points
|
||||
string_list pt_materials = obj.get_pt_materials();
|
||||
group_list pts_v = obj.get_pts_v();
|
||||
group_list pts_n = obj.get_pts_n();
|
||||
for ( i = 0; i < (int)pts_v.size(); ++i ) {
|
||||
material = pt_materials[i];
|
||||
vertex_index = pts_v[i];
|
||||
normal_index = pts_n[i];
|
||||
cout << "# usemtl " << material << endl;
|
||||
cout << "pt ";
|
||||
for ( j = 0; j < (int)vertex_index.size(); ++j ) {
|
||||
cout << vertex_index[j] << "/" << normal_index[j] << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
// generate triangles
|
||||
string_list tri_materials = obj.get_tri_materials();
|
||||
group_list tris_v = obj.get_tris_v();
|
||||
group_list tris_n = obj.get_tris_n();
|
||||
group_list tris_tc = obj.get_tris_tc();
|
||||
for ( i = 0; i < (int)tris_v.size(); ++i ) {
|
||||
material = tri_materials[i];
|
||||
vertex_index = tris_v[i];
|
||||
normal_index = tris_n[i];
|
||||
tex_index = tris_tc[i];
|
||||
cout << "# usemtl " << material << endl;
|
||||
cout << "f ";
|
||||
for ( j = 0; j < (int)vertex_index.size(); ++j ) {
|
||||
cout << vertex_index[j] << "/" << tex_index[j] << " ";
|
||||
cout << vertex_index[j];
|
||||
if ( normal_index.size() ) {
|
||||
cout << "/" << normal_index[j];
|
||||
}
|
||||
cout << "/" << tex_index[j];
|
||||
cout << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
@@ -84,15 +108,21 @@ int main( int argc, char **argv ) {
|
||||
// generate strips
|
||||
string_list strip_materials = obj.get_strip_materials();
|
||||
group_list strips_v = obj.get_strips_v();
|
||||
group_list strips_n = obj.get_strips_n();
|
||||
group_list strips_tc = obj.get_strips_tc();
|
||||
for ( i = 0; i < (int)strips_v.size(); ++i ) {
|
||||
material = strip_materials[i];
|
||||
vertex_index = strips_v[i];
|
||||
normal_index = strips_n[i];
|
||||
tex_index = strips_tc[i];
|
||||
cout << "# usemtl " << material << endl;
|
||||
cout << "ts ";
|
||||
for ( j = 0; j < (int)vertex_index.size(); ++j ) {
|
||||
cout << vertex_index[j] << "/" << tex_index[j] << " ";
|
||||
cout << vertex_index[j];
|
||||
if ( normal_index.size() ) {
|
||||
cout << "/" << normal_index[j];
|
||||
}
|
||||
cout << "/" << tex_index[j] << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
@@ -100,15 +130,21 @@ int main( int argc, char **argv ) {
|
||||
// generate fans
|
||||
string_list fan_materials = obj.get_fan_materials();
|
||||
group_list fans_v = obj.get_fans_v();
|
||||
group_list fans_n = obj.get_fans_n();
|
||||
group_list fans_tc = obj.get_fans_tc();
|
||||
for ( i = 0; i < (int)fans_v.size(); ++i ) {
|
||||
material = fan_materials[i];
|
||||
vertex_index = fans_v[i];
|
||||
normal_index = fans_n[i];
|
||||
tex_index = fans_tc[i];
|
||||
cout << "# usemtl " << material << endl;
|
||||
cout << "tf ";
|
||||
for ( j = 0; j < (int)vertex_index.size(); ++j ) {
|
||||
cout << vertex_index[j] << "/" << tex_index[j] << " ";
|
||||
cout << vertex_index[j];
|
||||
if ( normal_index.size() ) {
|
||||
cout << "/" << normal_index[j];
|
||||
}
|
||||
cout << "/" << tex_index[j] << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
|
||||
#include "iochannel.hxx"
|
||||
// #include "garmin.hxx"
|
||||
// #include "nmea.hxx"
|
||||
|
||||
|
||||
// constructor
|
||||
|
||||
@@ -158,6 +158,7 @@ public:
|
||||
inline void set_dir( const SGProtocolDir d ) { dir = d; }
|
||||
inline SGProtocolDir get_dir() const { return dir; }
|
||||
inline bool isvalid() const { return valid; }
|
||||
inline void set_valid( const bool v ) { valid = v; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
// $Id$
|
||||
|
||||
|
||||
#include <string.h> // for memcpy()
|
||||
|
||||
#include "lowlevel.hxx"
|
||||
|
||||
|
||||
|
||||
@@ -29,12 +29,7 @@
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
# include <zlib.h>
|
||||
#else
|
||||
# include <simgear/zlib/zlib.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#include <plib/sg.h>
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ int main() {
|
||||
}
|
||||
cout << "endian" << endl;
|
||||
|
||||
cout << "sizeof(short) = " << sizeof(short) << endl;
|
||||
|
||||
short s = 1111;
|
||||
cout << "short s = " << s << endl;
|
||||
sgEndianSwap((unsigned short *)&s);
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
//
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -49,17 +53,29 @@ enum {
|
||||
SG_BOUNDING_SPHERE = 0,
|
||||
|
||||
SG_VERTEX_LIST = 1,
|
||||
SG_COLOR_LIST = 4,
|
||||
SG_NORMAL_LIST = 2,
|
||||
SG_TEXCOORD_LIST = 3,
|
||||
|
||||
SG_POINTS = 9,
|
||||
|
||||
SG_TRIANGLE_FACES = 10,
|
||||
SG_TRIANGLE_STRIPS = 11,
|
||||
SG_TRIANGLE_FANS = 12
|
||||
} tgObjectTypes;
|
||||
} sgObjectTypes;
|
||||
|
||||
enum {
|
||||
SG_MATERIAL = 0
|
||||
} tgPropertyTypes;
|
||||
SG_IDX_VERTICES = 0x01,
|
||||
SG_IDX_NORMALS = 0x02,
|
||||
SG_IDX_COLORS = 0x04,
|
||||
SG_IDX_TEXCOORDS = 0x08
|
||||
} sgIndexTypes;
|
||||
|
||||
enum {
|
||||
SG_MATERIAL = 0,
|
||||
SG_INDEX_TYPES = 1
|
||||
} sgPropertyTypes;
|
||||
|
||||
|
||||
|
||||
class sgSimpleBuffer {
|
||||
@@ -145,11 +161,131 @@ double sgCalcBoundingRadius( Point3D center, point_list& wgs84_nodes ) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// read object properties
|
||||
static void read_object( gzFile fp,
|
||||
int obj_type,
|
||||
int nproperties,
|
||||
int nelements,
|
||||
group_list *vertices,
|
||||
group_list *normals,
|
||||
group_list *colors,
|
||||
group_list *texcoords,
|
||||
string_list *materials )
|
||||
{
|
||||
unsigned int nbytes;
|
||||
unsigned char idx_mask;
|
||||
int idx_size;
|
||||
bool do_vertices, do_normals, do_colors, do_texcoords;
|
||||
int j, k, idx;
|
||||
static sgSimpleBuffer buf( 32768 ); // 32 Kb
|
||||
char material[256];
|
||||
|
||||
// default values
|
||||
if ( obj_type == SG_POINTS ) {
|
||||
idx_size = 1;
|
||||
idx_mask = SG_IDX_VERTICES;
|
||||
do_vertices = true;
|
||||
do_normals = false;
|
||||
do_colors = false;
|
||||
do_texcoords = false;
|
||||
} else {
|
||||
idx_size = 2;
|
||||
idx_mask = (char)(SG_IDX_VERTICES | SG_IDX_TEXCOORDS);
|
||||
do_vertices = true;
|
||||
do_normals = false;
|
||||
do_colors = false;
|
||||
do_texcoords = true;
|
||||
}
|
||||
|
||||
for ( j = 0; j < nproperties; ++j ) {
|
||||
char prop_type;
|
||||
sgReadChar( fp, &prop_type );
|
||||
|
||||
sgReadUInt( fp, &nbytes );
|
||||
// cout << "property size = " << nbytes << endl;
|
||||
if ( nbytes > buf.get_size() ) { buf.resize( nbytes ); }
|
||||
char *ptr = buf.get_ptr();
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
if ( prop_type == SG_MATERIAL ) {
|
||||
strncpy( material, ptr, nbytes );
|
||||
material[nbytes] = '\0';
|
||||
// cout << "material type = " << material << endl;
|
||||
} else if ( prop_type == SG_INDEX_TYPES ) {
|
||||
idx_mask = ptr[0];
|
||||
// cout << "idx_mask = " << (int)idx_mask << endl;
|
||||
idx_size = 0;
|
||||
do_vertices = false;
|
||||
do_normals = false;
|
||||
do_colors = false;
|
||||
do_texcoords = false;
|
||||
if ( idx_mask & SG_IDX_VERTICES ) {
|
||||
do_vertices = true;
|
||||
++idx_size;
|
||||
}
|
||||
if ( idx_mask & SG_IDX_NORMALS ) {
|
||||
do_normals = true;
|
||||
++idx_size;
|
||||
}
|
||||
if ( idx_mask & SG_IDX_COLORS ) {
|
||||
do_colors = true;
|
||||
++idx_size;
|
||||
}
|
||||
if ( idx_mask & SG_IDX_TEXCOORDS ) {
|
||||
do_texcoords = true;
|
||||
++idx_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( j = 0; j < nelements; ++j ) {
|
||||
sgReadUInt( fp, &nbytes );
|
||||
// cout << "element size = " << nbytes << endl;
|
||||
if ( nbytes > buf.get_size() ) { buf.resize( nbytes ); }
|
||||
char *ptr = buf.get_ptr();
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
int count = nbytes / (idx_size * sizeof(short));
|
||||
short *sptr = (short *)ptr;
|
||||
int_list vs; vs.clear();
|
||||
int_list ns; ns.clear();
|
||||
int_list cs; cs.clear();
|
||||
int_list tcs; tcs.clear();
|
||||
for ( k = 0; k < count; ++k ) {
|
||||
if ( sgIsBigEndian() ) {
|
||||
for ( idx = 0; idx < idx_size; ++idx ) {
|
||||
sgEndianSwap( (unsigned short *)&(sptr[idx]) );
|
||||
}
|
||||
}
|
||||
idx = 0;
|
||||
if ( do_vertices ) {
|
||||
vs.push_back( sptr[idx++] );
|
||||
}
|
||||
if ( do_normals ) {
|
||||
ns.push_back( sptr[idx++] );
|
||||
}
|
||||
if ( do_colors ) {
|
||||
cs.push_back( sptr[idx++] );
|
||||
}
|
||||
if ( do_texcoords ) {
|
||||
tcs.push_back( sptr[idx++] );
|
||||
}
|
||||
// cout << sptr[0] << " ";
|
||||
sptr += idx_size;
|
||||
}
|
||||
// cout << endl;
|
||||
vertices->push_back( vs );
|
||||
normals->push_back( ns );
|
||||
colors->push_back( cs );
|
||||
texcoords->push_back( tcs );
|
||||
materials->push_back( material );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// read a binary file and populate the provided structures.
|
||||
bool SGBinObject::read_bin( const string& file ) {
|
||||
Point3D p;
|
||||
int i, j, k;
|
||||
char material[256];
|
||||
unsigned int nbytes;
|
||||
static sgSimpleBuffer buf( 32768 ); // 32 Kb
|
||||
|
||||
@@ -161,24 +297,36 @@ bool SGBinObject::read_bin( const string& file ) {
|
||||
normals.clear();
|
||||
texcoords.clear();
|
||||
|
||||
pts_v.clear();
|
||||
pts_n.clear();
|
||||
pts_c.clear();
|
||||
pts_tc.clear();
|
||||
pt_materials.clear();
|
||||
|
||||
tris_v.clear();
|
||||
tris_n.clear();
|
||||
tris_c.clear();
|
||||
tris_tc.clear();
|
||||
tri_materials.clear();
|
||||
|
||||
strips_v.clear();
|
||||
strips_n.clear();
|
||||
strips_c.clear();
|
||||
strips_tc.clear();
|
||||
strip_materials.clear();
|
||||
|
||||
fans_v.clear();
|
||||
fans_n.clear();
|
||||
fans_c.clear();
|
||||
fans_tc.clear();
|
||||
fan_materials.clear();
|
||||
|
||||
|
||||
gzFile fp;
|
||||
if ( (fp = gzopen( file.c_str(), "rb" )) == NULL ) {
|
||||
string filegz = file + ".gz";
|
||||
if ( (fp = gzopen( filegz.c_str(), "rb" )) == NULL ) {
|
||||
// cout << "ERROR: opening " << file << " or " << filegz
|
||||
// << "for reading!" << endl;
|
||||
cout << "ERROR: opening " << file << " or " << filegz
|
||||
<< "for reading!" << endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -203,13 +351,21 @@ bool SGBinObject::read_bin( const string& file ) {
|
||||
}
|
||||
|
||||
// read creation time
|
||||
time_t calendar_time;
|
||||
sgReadLong( fp, &calendar_time );
|
||||
unsigned int foo_calendar_time;
|
||||
sgReadUInt( fp, &foo_calendar_time );
|
||||
|
||||
#if 0
|
||||
time_t calendar_time = foo_calendar_time;
|
||||
// The following code has a global effect on the host application
|
||||
// and can screws up the time elsewhere. It should be avoided
|
||||
// unless you need this for debugging in which case you should
|
||||
// disable it again once the debugging task is finished.
|
||||
struct tm *local_tm;
|
||||
local_tm = localtime( &calendar_time );
|
||||
char time_str[256];
|
||||
strftime( time_str, 256, "%a %b %d %H:%M:%S %Z %Y", local_tm);
|
||||
// cout << "File created on " << time_str << endl;
|
||||
cout << "File created on " << time_str << endl;
|
||||
#endif
|
||||
|
||||
// read number of top level objects
|
||||
short nobjects;
|
||||
@@ -288,18 +444,51 @@ bool SGBinObject::read_bin( const string& file ) {
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
int count = nbytes / (sizeof(float) * 3);
|
||||
float *fptr = (float *)ptr;
|
||||
wgs84_nodes.reserve( count );
|
||||
for ( k = 0; k < count; ++k ) {
|
||||
if ( sgIsBigEndian() ) {
|
||||
sgEndianSwap( (unsigned int *)&(fptr[0]) );
|
||||
sgEndianSwap( (unsigned int *)&(fptr[1]) );
|
||||
sgEndianSwap( (unsigned int *)&(fptr[2]) );
|
||||
}
|
||||
p = Point3D( fptr[0], fptr[1], fptr[2] );
|
||||
// cout << "node = " << p << endl;
|
||||
wgs84_nodes.push_back( p );
|
||||
wgs84_nodes.push_back( Point3D(fptr[0], fptr[1], fptr[2]) );
|
||||
fptr += 3;
|
||||
}
|
||||
}
|
||||
} else if ( obj_type == SG_COLOR_LIST ) {
|
||||
// read color list properties
|
||||
for ( j = 0; j < nproperties; ++j ) {
|
||||
char prop_type;
|
||||
sgReadChar( fp, &prop_type );
|
||||
|
||||
sgReadUInt( fp, &nbytes );
|
||||
// cout << "property size = " << nbytes << endl;
|
||||
if ( nbytes > buf.get_size() ) { buf.resize( nbytes ); }
|
||||
char *ptr = buf.get_ptr();
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
}
|
||||
|
||||
// read color list elements
|
||||
for ( j = 0; j < nelements; ++j ) {
|
||||
sgReadUInt( fp, &nbytes );
|
||||
// cout << "element size = " << nbytes << endl;
|
||||
if ( nbytes > buf.get_size() ) { buf.resize( nbytes ); }
|
||||
char *ptr = buf.get_ptr();
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
int count = nbytes / (sizeof(float) * 4);
|
||||
float *fptr = (float *)ptr;
|
||||
colors.reserve(count);
|
||||
for ( k = 0; k < count; ++k ) {
|
||||
if ( sgIsBigEndian() ) {
|
||||
sgEndianSwap( (unsigned int *)&(fptr[0]) );
|
||||
sgEndianSwap( (unsigned int *)&(fptr[1]) );
|
||||
sgEndianSwap( (unsigned int *)&(fptr[2]) );
|
||||
sgEndianSwap( (unsigned int *)&(fptr[3]) );
|
||||
}
|
||||
colors.push_back( Point3D( fptr[0], fptr[1], fptr[2] ) );
|
||||
fptr += 4;
|
||||
}
|
||||
}
|
||||
} else if ( obj_type == SG_NORMAL_LIST ) {
|
||||
// read normal list properties
|
||||
for ( j = 0; j < nproperties; ++j ) {
|
||||
@@ -321,6 +510,7 @@ bool SGBinObject::read_bin( const string& file ) {
|
||||
unsigned char *ptr = (unsigned char *)(buf.get_ptr());
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
int count = nbytes / 3;
|
||||
normals.reserve( count );
|
||||
for ( k = 0; k < count; ++k ) {
|
||||
sgdVec3 normal;
|
||||
sgdSetVec3( normal,
|
||||
@@ -329,9 +519,7 @@ bool SGBinObject::read_bin( const string& file ) {
|
||||
(ptr[2]) / 127.5 - 1.0 );
|
||||
sgdNormalizeVec3( normal );
|
||||
|
||||
p = Point3D( normal[0], normal[1], normal[2] );
|
||||
// cout << "normal = " << p << endl;
|
||||
normals.push_back( p );
|
||||
normals.push_back(Point3D(normal[0], normal[1], normal[2]));
|
||||
ptr += 3;
|
||||
}
|
||||
}
|
||||
@@ -357,149 +545,33 @@ bool SGBinObject::read_bin( const string& file ) {
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
int count = nbytes / (sizeof(float) * 2);
|
||||
float *fptr = (float *)ptr;
|
||||
texcoords.reserve(count);
|
||||
for ( k = 0; k < count; ++k ) {
|
||||
if ( sgIsBigEndian() ) {
|
||||
sgEndianSwap( (unsigned int *)&(fptr[0]) );
|
||||
sgEndianSwap( (unsigned int *)&(fptr[1]) );
|
||||
}
|
||||
p = Point3D( fptr[0], fptr[1], 0 );
|
||||
// cout << "texcoord = " << p << endl;
|
||||
texcoords.push_back( p );
|
||||
texcoords.push_back( Point3D( fptr[0], fptr[1], 0 ) );
|
||||
fptr += 2;
|
||||
}
|
||||
}
|
||||
} else if ( obj_type == SG_POINTS ) {
|
||||
// read point elements
|
||||
read_object( fp, SG_POINTS, nproperties, nelements,
|
||||
&pts_v, &pts_n, &pts_c, &pts_tc, &pt_materials );
|
||||
} else if ( obj_type == SG_TRIANGLE_FACES ) {
|
||||
// read triangle face properties
|
||||
for ( j = 0; j < nproperties; ++j ) {
|
||||
char prop_type;
|
||||
sgReadChar( fp, &prop_type );
|
||||
|
||||
sgReadUInt( fp, &nbytes );
|
||||
// cout << "property size = " << nbytes << endl;
|
||||
if ( nbytes > buf.get_size() ) { buf.resize( nbytes ); }
|
||||
char *ptr = buf.get_ptr();
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
if ( prop_type == SG_MATERIAL ) {
|
||||
strncpy( material, ptr, nbytes );
|
||||
material[nbytes] = '\0';
|
||||
// cout << "material type = " << material << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// read triangle face elements
|
||||
for ( j = 0; j < nelements; ++j ) {
|
||||
sgReadUInt( fp, &nbytes );
|
||||
// cout << "element size = " << nbytes << endl;
|
||||
if ( nbytes > buf.get_size() ) { buf.resize( nbytes ); }
|
||||
char *ptr = buf.get_ptr();
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
int count = nbytes / (sizeof(short) * 2);
|
||||
short *sptr = (short *)ptr;
|
||||
int_list vs, tcs;
|
||||
vs.clear(); tcs.clear();
|
||||
for ( k = 0; k < count; ++k ) {
|
||||
if ( sgIsBigEndian() ) {
|
||||
sgEndianSwap( (unsigned short *)&(sptr[0]) );
|
||||
sgEndianSwap( (unsigned short *)&(sptr[1]) );
|
||||
}
|
||||
vs.push_back( sptr[0] );
|
||||
tcs.push_back( sptr[1] );
|
||||
// cout << sptr[0] << "/" << sptr[1] << " ";
|
||||
sptr += 2;
|
||||
}
|
||||
// cout << endl;
|
||||
tris_v.push_back( vs );
|
||||
tris_tc.push_back( tcs );
|
||||
tri_materials.push_back( material );
|
||||
}
|
||||
read_object( fp, SG_TRIANGLE_FACES, nproperties, nelements,
|
||||
&tris_v, &tris_n, &tris_c, &tris_tc, &tri_materials );
|
||||
} else if ( obj_type == SG_TRIANGLE_STRIPS ) {
|
||||
// read triangle strip properties
|
||||
for ( j = 0; j < nproperties; ++j ) {
|
||||
char prop_type;
|
||||
sgReadChar( fp, &prop_type );
|
||||
|
||||
sgReadUInt( fp, &nbytes );
|
||||
// cout << "property size = " << nbytes << endl;
|
||||
if ( nbytes > buf.get_size() ) { buf.resize( nbytes ); }
|
||||
char *ptr = buf.get_ptr();
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
if ( prop_type == SG_MATERIAL ) {
|
||||
strncpy( material, ptr, nbytes );
|
||||
material[nbytes] = '\0';
|
||||
// cout << "material type = " << material << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// read triangle strip elements
|
||||
for ( j = 0; j < nelements; ++j ) {
|
||||
sgReadUInt( fp, &nbytes );
|
||||
// cout << "element size = " << nbytes << endl;
|
||||
if ( nbytes > buf.get_size() ) { buf.resize( nbytes ); }
|
||||
char *ptr = buf.get_ptr();
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
int count = nbytes / (sizeof(short) * 2);
|
||||
short *sptr = (short *)ptr;
|
||||
int_list vs, tcs;
|
||||
vs.clear(); tcs.clear();
|
||||
for ( k = 0; k < count; ++k ) {
|
||||
if ( sgIsBigEndian() ) {
|
||||
sgEndianSwap( (unsigned short *)&(sptr[0]) );
|
||||
sgEndianSwap( (unsigned short *)&(sptr[1]) );
|
||||
}
|
||||
vs.push_back( sptr[0] );
|
||||
tcs.push_back( sptr[1] );
|
||||
// cout << sptr[0] << "/" << sptr[1] << " ";
|
||||
sptr += 2;
|
||||
}
|
||||
// cout << endl;
|
||||
strips_v.push_back( vs );
|
||||
strips_tc.push_back( tcs );
|
||||
strip_materials.push_back( material );
|
||||
}
|
||||
read_object( fp, SG_TRIANGLE_STRIPS, nproperties, nelements,
|
||||
&strips_v, &strips_n, &strips_c, &strips_tc,
|
||||
&strip_materials );
|
||||
} else if ( obj_type == SG_TRIANGLE_FANS ) {
|
||||
// read triangle fan properties
|
||||
for ( j = 0; j < nproperties; ++j ) {
|
||||
char prop_type;
|
||||
sgReadChar( fp, &prop_type );
|
||||
|
||||
sgReadUInt( fp, &nbytes );
|
||||
// cout << "property size = " << nbytes << endl;
|
||||
if ( nbytes > buf.get_size() ) { buf.resize( nbytes ); }
|
||||
char *ptr = buf.get_ptr();
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
if ( prop_type == SG_MATERIAL ) {
|
||||
strncpy( material, ptr, nbytes );
|
||||
material[nbytes] = '\0';
|
||||
// cout << "material type = " << material << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// read triangle fan elements
|
||||
for ( j = 0; j < nelements; ++j ) {
|
||||
sgReadUInt( fp, &nbytes );
|
||||
// cout << "element size = " << nbytes << endl;
|
||||
if ( nbytes > buf.get_size() ) { buf.resize( nbytes ); }
|
||||
char *ptr = buf.get_ptr();
|
||||
sgReadBytes( fp, nbytes, ptr );
|
||||
int count = nbytes / (sizeof(short) * 2);
|
||||
short *sptr = (short *)ptr;
|
||||
int_list vs, tcs;
|
||||
vs.clear(); tcs.clear();
|
||||
for ( k = 0; k < count; ++k ) {
|
||||
if ( sgIsBigEndian() ) {
|
||||
sgEndianSwap( (unsigned short *)&(sptr[0]) );
|
||||
sgEndianSwap( (unsigned short *)&(sptr[1]) );
|
||||
}
|
||||
vs.push_back( sptr[0] );
|
||||
tcs.push_back( sptr[1] );
|
||||
// cout << sptr[0] << "/" << sptr[1] << " ";
|
||||
sptr += 2;
|
||||
}
|
||||
// cout << endl;
|
||||
fans_v.push_back( vs );
|
||||
fans_tc.push_back( tcs );
|
||||
fan_materials.push_back( material );
|
||||
}
|
||||
read_object( fp, SG_TRIANGLE_FANS, nproperties, nelements,
|
||||
&fans_v, &fans_n, &fans_c, &fans_tc, &fan_materials );
|
||||
} else {
|
||||
// unknown object type, just skip
|
||||
|
||||
@@ -547,11 +619,14 @@ bool SGBinObject::write_bin( const string& base, const string& name,
|
||||
Point3D p;
|
||||
sgVec2 t;
|
||||
sgVec3 pt;
|
||||
sgVec4 color;
|
||||
int i, j;
|
||||
unsigned char idx_mask;
|
||||
int idx_size;
|
||||
|
||||
string dir = base + "/" + b.gen_base_path();
|
||||
string command = "mkdir -p " + dir;
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
system( (string("mkdir ") + dir).c_str() );
|
||||
#else
|
||||
system(command.c_str());
|
||||
@@ -568,6 +643,8 @@ bool SGBinObject::write_bin( const string& base, const string& name,
|
||||
|
||||
sgClearWriteError();
|
||||
|
||||
cout << "points size = " << pts_v.size() << " pt_materials = "
|
||||
<< pt_materials.size() << endl;
|
||||
cout << "triangles size = " << tris_v.size() << " tri_materials = "
|
||||
<< tri_materials.size() << endl;
|
||||
cout << "strips size = " << strips_v.size() << " strip_materials = "
|
||||
@@ -575,7 +652,9 @@ bool SGBinObject::write_bin( const string& base, const string& name,
|
||||
cout << "fans size = " << fans_v.size() << " fan_materials = "
|
||||
<< fan_materials.size() << endl;
|
||||
|
||||
cout << "points = " << wgs84_nodes.size() << endl;
|
||||
cout << "nodes = " << wgs84_nodes.size() << endl;
|
||||
cout << "colors = " << colors.size() << endl;
|
||||
cout << "normals = " << normals.size() << endl;
|
||||
cout << "tex coords = " << texcoords.size() << endl;
|
||||
|
||||
// write header magic
|
||||
@@ -590,9 +669,24 @@ bool SGBinObject::write_bin( const string& base, const string& name,
|
||||
short nobjects = 0;
|
||||
nobjects++; // for gbs
|
||||
nobjects++; // for vertices
|
||||
nobjects++; // for colors
|
||||
nobjects++; // for normals
|
||||
nobjects++; // for texcoords
|
||||
|
||||
// points
|
||||
short npts = 0;
|
||||
start = 0; end = 1;
|
||||
while ( start < (int)pt_materials.size() ) {
|
||||
material = pt_materials[start];
|
||||
while ( (end < (int)pt_materials.size()) &&
|
||||
(material == pt_materials[end]) ) {
|
||||
end++;
|
||||
}
|
||||
npts++;
|
||||
start = end; end = start + 1;
|
||||
}
|
||||
nobjects += npts;
|
||||
|
||||
// tris
|
||||
short ntris = 0;
|
||||
start = 0; end = 1;
|
||||
@@ -660,6 +754,20 @@ bool SGBinObject::write_bin( const string& base, const string& name,
|
||||
sgWriteVec3( fp, pt );
|
||||
}
|
||||
|
||||
// dump vertex color list
|
||||
sgWriteChar( fp, (char)SG_COLOR_LIST ); // type
|
||||
sgWriteShort( fp, 0 ); // nproperties
|
||||
sgWriteShort( fp, 1 ); // nelements
|
||||
sgWriteUInt( fp, colors.size() * sizeof(float) * 4 ); // nbytes
|
||||
for ( i = 0; i < (int)colors.size(); ++i ) {
|
||||
p = colors[i];
|
||||
// Right now we have a place holder for color alpha but we
|
||||
// need to update the interface so the calling program can
|
||||
// provide the info.
|
||||
sgSetVec4( color, p.x(), p.y(), p.z(), 1.0 );
|
||||
sgWriteVec4( fp, color );
|
||||
}
|
||||
|
||||
// dump vertex normal list
|
||||
sgWriteChar( fp, (char)SG_NORMAL_LIST ); // type
|
||||
sgWriteShort( fp, 0 ); // nproperties
|
||||
@@ -685,6 +793,66 @@ bool SGBinObject::write_bin( const string& base, const string& name,
|
||||
sgWriteVec2( fp, t );
|
||||
}
|
||||
|
||||
// dump point groups if they exist
|
||||
if ( pts_v.size() > 0 ) {
|
||||
int start = 0;
|
||||
int end = 1;
|
||||
string material;
|
||||
while ( start < (int)pt_materials.size() ) {
|
||||
// find next group
|
||||
material = pt_materials[start];
|
||||
while ( (end < (int)pt_materials.size()) &&
|
||||
(material == pt_materials[end]) )
|
||||
{
|
||||
// cout << "end = " << end << endl;
|
||||
end++;
|
||||
}
|
||||
// cout << "group = " << start << " to " << end - 1 << endl;
|
||||
|
||||
// write group headers
|
||||
sgWriteChar( fp, (char)SG_POINTS ); // type
|
||||
sgWriteShort( fp, 2 ); // nproperties
|
||||
sgWriteShort( fp, end - start ); // nelements
|
||||
|
||||
sgWriteChar( fp, (char)SG_MATERIAL ); // property
|
||||
sgWriteUInt( fp, material.length() ); // nbytes
|
||||
sgWriteBytes( fp, material.length(), material.c_str() );
|
||||
|
||||
idx_mask = 0;
|
||||
idx_size = 0;
|
||||
if ( pts_v.size() ) { idx_mask |= SG_IDX_VERTICES; ++idx_size; }
|
||||
if ( pts_n.size() ) { idx_mask |= SG_IDX_NORMALS; ++idx_size; }
|
||||
if ( pts_c.size() ) { idx_mask |= SG_IDX_COLORS; ++idx_size; }
|
||||
if ( pts_tc.size() ) { idx_mask |= SG_IDX_TEXCOORDS; ++idx_size; }
|
||||
sgWriteChar( fp, (char)SG_INDEX_TYPES ); // property
|
||||
sgWriteUInt( fp, 1 ); // nbytes
|
||||
sgWriteChar( fp, idx_mask );
|
||||
|
||||
// write strips
|
||||
for ( i = start; i < end; ++i ) {
|
||||
// nbytes
|
||||
sgWriteUInt( fp, pts_v[i].size() * idx_size * sizeof(short) );
|
||||
for ( j = 0; j < (int)pts_v[i].size(); ++j ) {
|
||||
if ( pts_v.size() ) {
|
||||
sgWriteShort( fp, (short)pts_v[i][j] );
|
||||
}
|
||||
if ( pts_n.size() ) {
|
||||
sgWriteShort( fp, (short)pts_n[i][j] );
|
||||
}
|
||||
if ( pts_c.size() ) {
|
||||
sgWriteShort( fp, (short)pts_c[i][j] );
|
||||
}
|
||||
if ( pts_tc.size() ) {
|
||||
sgWriteShort( fp, (short)pts_tc[i][j] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
start = end;
|
||||
end = start + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// dump individual triangles if they exist
|
||||
if ( tris_v.size() > 0 ) {
|
||||
int start = 0;
|
||||
@@ -703,20 +871,41 @@ bool SGBinObject::write_bin( const string& base, const string& name,
|
||||
|
||||
// write group headers
|
||||
sgWriteChar( fp, (char)SG_TRIANGLE_FACES ); // type
|
||||
sgWriteShort( fp, 1 ); // nproperties
|
||||
sgWriteShort( fp, 2 ); // nproperties
|
||||
sgWriteShort( fp, 1 ); // nelements
|
||||
|
||||
sgWriteChar( fp, (char)SG_MATERIAL ); // property
|
||||
sgWriteUInt( fp, material.length() ); // nbytes
|
||||
sgWriteBytes( fp, material.length(), material.c_str() );
|
||||
|
||||
sgWriteUInt( fp, (end - start) * 3 * 2 * sizeof(short) ); // nbytes
|
||||
idx_mask = 0;
|
||||
idx_size = 0;
|
||||
if ( tris_v.size() ) { idx_mask |= SG_IDX_VERTICES; ++idx_size; }
|
||||
if ( tris_n.size() ) { idx_mask |= SG_IDX_NORMALS; ++idx_size; }
|
||||
if ( tris_c.size() ) { idx_mask |= SG_IDX_COLORS; ++idx_size; }
|
||||
if ( tris_tc.size() ) { idx_mask |= SG_IDX_TEXCOORDS; ++idx_size; }
|
||||
sgWriteChar( fp, (char)SG_INDEX_TYPES ); // property
|
||||
sgWriteUInt( fp, 1 ); // nbytes
|
||||
sgWriteChar( fp, idx_mask );
|
||||
|
||||
// nbytes
|
||||
sgWriteUInt( fp, (end - start) * 3 * idx_size * sizeof(short) );
|
||||
|
||||
// write group
|
||||
for ( i = start; i < end; ++i ) {
|
||||
for ( j = 0; j < 3; ++j ) {
|
||||
sgWriteShort( fp, (short)tris_v[i][j] );
|
||||
sgWriteShort( fp, (short)tris_tc[i][j] );
|
||||
if ( tris_v.size() ) {
|
||||
sgWriteShort( fp, (short)tris_v[i][j] );
|
||||
}
|
||||
if ( tris_n.size() ) {
|
||||
sgWriteShort( fp, (short)tris_n[i][j] );
|
||||
}
|
||||
if ( tris_c.size() ) {
|
||||
sgWriteShort( fp, (short)tris_c[i][j] );
|
||||
}
|
||||
if ( tris_tc.size() ) {
|
||||
sgWriteShort( fp, (short)tris_tc[i][j] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -743,20 +932,40 @@ bool SGBinObject::write_bin( const string& base, const string& name,
|
||||
|
||||
// write group headers
|
||||
sgWriteChar( fp, (char)SG_TRIANGLE_STRIPS ); // type
|
||||
sgWriteShort( fp, 1 ); // nproperties
|
||||
sgWriteShort( fp, 2 ); // nproperties
|
||||
sgWriteShort( fp, end - start ); // nelements
|
||||
|
||||
sgWriteChar( fp, (char)SG_MATERIAL ); // property
|
||||
sgWriteUInt( fp, material.length() ); // nbytes
|
||||
sgWriteBytes( fp, material.length(), material.c_str() );
|
||||
|
||||
idx_mask = 0;
|
||||
idx_size = 0;
|
||||
if ( strips_v.size() ) { idx_mask |= SG_IDX_VERTICES; ++idx_size; }
|
||||
if ( strips_n.size() ) { idx_mask |= SG_IDX_NORMALS; ++idx_size; }
|
||||
if ( strips_c.size() ) { idx_mask |= SG_IDX_COLORS; ++idx_size; }
|
||||
if ( strips_tc.size() ) { idx_mask |= SG_IDX_TEXCOORDS; ++idx_size;}
|
||||
sgWriteChar( fp, (char)SG_INDEX_TYPES ); // property
|
||||
sgWriteUInt( fp, 1 ); // nbytes
|
||||
sgWriteChar( fp, idx_mask );
|
||||
|
||||
// write strips
|
||||
for ( i = start; i < end; ++i ) {
|
||||
// nbytes
|
||||
sgWriteUInt( fp, strips_v[i].size() * 2 * sizeof(short) );
|
||||
sgWriteUInt( fp, strips_v[i].size() * idx_size * sizeof(short));
|
||||
for ( j = 0; j < (int)strips_v[i].size(); ++j ) {
|
||||
sgWriteShort( fp, (short)strips_v[i][j] );
|
||||
sgWriteShort( fp, (short)strips_tc[i][j] );
|
||||
if ( strips_v.size() ) {
|
||||
sgWriteShort( fp, (short)strips_v[i][j] );
|
||||
}
|
||||
if ( strips_n.size() ) {
|
||||
sgWriteShort( fp, (short)strips_n[i][j] );
|
||||
}
|
||||
if ( strips_c.size() ) {
|
||||
sgWriteShort( fp, (short)strips_c[i][j] );
|
||||
}
|
||||
if ( strips_tc.size() ) {
|
||||
sgWriteShort( fp, (short)strips_tc[i][j] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -783,20 +992,40 @@ bool SGBinObject::write_bin( const string& base, const string& name,
|
||||
|
||||
// write group headers
|
||||
sgWriteChar( fp, (char)SG_TRIANGLE_FANS ); // type
|
||||
sgWriteShort( fp, 1 ); // nproperties
|
||||
sgWriteShort( fp, 2 ); // nproperties
|
||||
sgWriteShort( fp, end - start ); // nelements
|
||||
|
||||
sgWriteChar( fp, (char)SG_MATERIAL ); // property
|
||||
sgWriteUInt( fp, material.length() ); // nbytes
|
||||
sgWriteBytes( fp, material.length(), material.c_str() );
|
||||
|
||||
idx_mask = 0;
|
||||
idx_size = 0;
|
||||
if ( fans_v.size() ) { idx_mask |= SG_IDX_VERTICES; ++idx_size; }
|
||||
if ( fans_n.size() ) { idx_mask |= SG_IDX_NORMALS; ++idx_size; }
|
||||
if ( fans_c.size() ) { idx_mask |= SG_IDX_COLORS; ++idx_size; }
|
||||
if ( fans_tc.size() ) { idx_mask |= SG_IDX_TEXCOORDS; ++idx_size; }
|
||||
sgWriteChar( fp, (char)SG_INDEX_TYPES ); // property
|
||||
sgWriteUInt( fp, 1 ); // nbytes
|
||||
sgWriteChar( fp, idx_mask );
|
||||
|
||||
// write fans
|
||||
for ( i = start; i < end; ++i ) {
|
||||
// nbytes
|
||||
sgWriteUInt( fp, fans_v[i].size() * 2 * sizeof(short) );
|
||||
sgWriteUInt( fp, fans_v[i].size() * idx_size * sizeof(short) );
|
||||
for ( j = 0; j < (int)fans_v[i].size(); ++j ) {
|
||||
sgWriteShort( fp, (short)fans_v[i][j] );
|
||||
sgWriteShort( fp, (short)fans_tc[i][j] );
|
||||
if ( fans_v.size() ) {
|
||||
sgWriteShort( fp, (short)fans_v[i][j] );
|
||||
}
|
||||
if ( fans_n.size() ) {
|
||||
sgWriteShort( fp, (short)fans_n[i][j] );
|
||||
}
|
||||
if ( fans_c.size() ) {
|
||||
sgWriteShort( fp, (short)fans_c[i][j] );
|
||||
}
|
||||
if ( fans_tc.size() ) {
|
||||
sgWriteShort( fp, (short)fans_tc[i][j] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -828,7 +1057,7 @@ bool SGBinObject::write_ascii( const string& base, const string& name,
|
||||
|
||||
string dir = base + "/" + b.gen_base_path();
|
||||
string command = "mkdir -p " + dir;
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
system( (string("mkdir ") + dir).c_str() );
|
||||
#else
|
||||
system(command.c_str());
|
||||
|
||||
@@ -70,7 +70,7 @@ typedef group_list::const_iterator const_group_list_iterator;
|
||||
* - property: prop_typecode, nbytes, BYTE+
|
||||
*
|
||||
* - obj_typecode: bounding sphere | vertices | normals | texcoords |
|
||||
* triangles | fans | strips
|
||||
* points | triangles | fans | strips
|
||||
*
|
||||
* - prop_typecode: material_name | ???
|
||||
*
|
||||
@@ -91,58 +91,103 @@ class SGBinObject {
|
||||
|
||||
Point3D gbs_center;
|
||||
float gbs_radius;
|
||||
point_list wgs84_nodes;
|
||||
point_list normals;
|
||||
point_list texcoords;
|
||||
group_list tris_v;
|
||||
group_list tris_tc;
|
||||
string_list tri_materials;
|
||||
group_list strips_v;
|
||||
group_list strips_tc;
|
||||
string_list strip_materials;
|
||||
group_list fans_v;
|
||||
group_list fans_tc;
|
||||
string_list fan_materials;
|
||||
|
||||
point_list wgs84_nodes; // vertex list
|
||||
point_list colors; // color list
|
||||
point_list normals; // normal list
|
||||
point_list texcoords; // texture coordinate list
|
||||
|
||||
group_list pts_v; // points vertex index
|
||||
group_list pts_n; // points normal index
|
||||
group_list pts_c; // points color index
|
||||
group_list pts_tc; // points texture coordinate index
|
||||
string_list pt_materials; // points materials
|
||||
|
||||
group_list tris_v; // triangles vertex index
|
||||
group_list tris_n; // triangles normal index
|
||||
group_list tris_c; // triangles color index
|
||||
group_list tris_tc; // triangles texture coordinate index
|
||||
string_list tri_materials; // triangles materials
|
||||
|
||||
group_list strips_v; // tristrips vertex index
|
||||
group_list strips_n; // tristrips normal index
|
||||
group_list strips_c; // tristrips color index
|
||||
group_list strips_tc; // tristrips texture coordinate index
|
||||
string_list strip_materials;// tristrips materials
|
||||
|
||||
group_list fans_v; // fans vertex index
|
||||
group_list fans_n; // fans normal index
|
||||
group_list fans_c; // fans color index
|
||||
group_list fans_tc; // fans texture coordinate index
|
||||
string_list fan_materials; // fans materials
|
||||
|
||||
public:
|
||||
|
||||
inline unsigned short get_version() const { return version; }
|
||||
|
||||
inline Point3D get_gbs_center() const { return gbs_center; }
|
||||
inline void set_gbs_center( Point3D p ) { gbs_center = p; }
|
||||
inline const Point3D& get_gbs_center() const { return gbs_center; }
|
||||
inline void set_gbs_center( const Point3D& p ) { gbs_center = p; }
|
||||
|
||||
inline float get_gbs_radius() const { return gbs_radius; }
|
||||
inline void set_gbs_radius( float r ) { gbs_radius = r; }
|
||||
|
||||
inline point_list get_wgs84_nodes() const { return wgs84_nodes; }
|
||||
inline void set_wgs84_nodes( point_list n ) { wgs84_nodes = n; }
|
||||
inline const point_list& get_wgs84_nodes() const { return wgs84_nodes; }
|
||||
inline void set_wgs84_nodes( const point_list& n ) { wgs84_nodes = n; }
|
||||
|
||||
inline point_list get_normals() const { return normals; }
|
||||
inline void set_normals( point_list n ) { normals = n; }
|
||||
inline const point_list& get_colors() const { return colors; }
|
||||
inline void set_colors( const point_list& c ) { colors = c; }
|
||||
|
||||
inline point_list get_texcoords() const { return texcoords; }
|
||||
inline void set_texcoords( point_list t ) { texcoords = t; }
|
||||
inline const point_list& get_normals() const { return normals; }
|
||||
inline void set_normals( const point_list& n ) { normals = n; }
|
||||
|
||||
inline group_list get_tris_v() const { return tris_v; }
|
||||
inline void set_tris_v( group_list g ) { tris_v = g; }
|
||||
inline group_list get_tris_tc() const { return tris_tc; }
|
||||
inline void set_tris_tc( group_list g ) { tris_tc = g; }
|
||||
inline string_list get_tri_materials() const { return tri_materials; }
|
||||
inline void set_tri_materials( string_list s ) { tri_materials = s; }
|
||||
inline const point_list& get_texcoords() const { return texcoords; }
|
||||
inline void set_texcoords( const point_list& t ) { texcoords = t; }
|
||||
|
||||
inline const group_list& get_pts_v() const { return pts_v; }
|
||||
inline void set_pts_v( const group_list& g ) { pts_v = g; }
|
||||
inline const group_list& get_pts_n() const { return pts_n; }
|
||||
inline void set_pts_n( const group_list& g ) { pts_n = g; }
|
||||
inline const group_list& get_pts_c() const { return pts_c; }
|
||||
inline void set_pts_c( const group_list& g ) { pts_c = g; }
|
||||
inline const group_list& get_pts_tc() const { return pts_tc; }
|
||||
inline void set_pts_tc( const group_list& g ) { pts_tc = g; }
|
||||
inline const string_list& get_pt_materials() const { return pt_materials; }
|
||||
inline void set_pt_materials( const string_list& s ) { pt_materials = s; }
|
||||
|
||||
inline const group_list& get_tris_v() const { return tris_v; }
|
||||
inline void set_tris_v( const group_list& g ) { tris_v = g; }
|
||||
inline const group_list& get_tris_n() const { return tris_n; }
|
||||
inline void set_tris_n( const group_list& g ) { tris_n = g; }
|
||||
inline const group_list& get_tris_c() const { return tris_c; }
|
||||
inline void set_tris_c( const group_list& g ) { tris_c = g; }
|
||||
inline const group_list& get_tris_tc() const { return tris_tc; }
|
||||
inline void set_tris_tc( const group_list& g ) { tris_tc = g; }
|
||||
inline const string_list& get_tri_materials() const { return tri_materials; }
|
||||
inline void set_tri_materials( const string_list& s ) { tri_materials = s; }
|
||||
|
||||
inline group_list get_strips_v() const { return strips_v; }
|
||||
inline void set_strips_v( group_list g ) { strips_v = g; }
|
||||
inline group_list get_strips_tc() const { return strips_tc; }
|
||||
inline void set_strips_tc( group_list g ) { strips_tc = g; }
|
||||
inline string_list get_strip_materials() const { return strip_materials; }
|
||||
inline void set_strip_materials( string_list s ) { strip_materials = s; }
|
||||
inline const group_list& get_strips_v() const { return strips_v; }
|
||||
inline void set_strips_v( const group_list& g ) { strips_v = g; }
|
||||
inline const group_list& get_strips_n() const { return strips_n; }
|
||||
inline void set_strips_n( const group_list& g ) { strips_n = g; }
|
||||
inline const group_list& get_strips_c() const { return strips_c; }
|
||||
inline void set_strips_c( const group_list& g ) { strips_c = g; }
|
||||
|
||||
inline const group_list& get_strips_tc() const { return strips_tc; }
|
||||
inline void set_strips_tc( const group_list& g ) { strips_tc = g; }
|
||||
inline const string_list& get_strip_materials() const { return strip_materials; }
|
||||
inline void set_strip_materials( const string_list& s ) { strip_materials = s; }
|
||||
|
||||
inline group_list get_fans_v() const { return fans_v; }
|
||||
inline void set_fans_v( group_list g ) { fans_v = g; }
|
||||
inline group_list get_fans_tc() const { return fans_tc; }
|
||||
inline void set_fans_tc( group_list g ) { fans_tc = g; }
|
||||
inline string_list get_fan_materials() const { return fan_materials; }
|
||||
inline void set_fan_materials( string_list s ) { fan_materials = s; }
|
||||
inline const group_list& get_fans_v() const { return fans_v; }
|
||||
inline void set_fans_v( const group_list& g ) { fans_v = g; }
|
||||
inline const group_list& get_fans_n() const { return fans_n; }
|
||||
inline void set_fans_n( const group_list& g ) { fans_n = g; }
|
||||
inline const group_list& get_fans_c() const { return fans_c; }
|
||||
inline void set_fans_c( const group_list& g ) { fans_c = g; }
|
||||
|
||||
inline const group_list& get_fans_tc() const { return fans_tc; }
|
||||
inline void set_fans_tc( const group_list& g ) { fans_tc = g; }
|
||||
inline const string_list& get_fan_materials() const { return fan_materials; }
|
||||
inline void set_fan_materials( const string_list& s ) { fan_materials = s; }
|
||||
|
||||
/**
|
||||
* Read a binary file object and populate the provided structures.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include STL_STRING
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
@@ -51,7 +51,7 @@ bool SGFile::open( const SGProtocolDir d ) {
|
||||
set_dir( d );
|
||||
|
||||
if ( get_dir() == SG_IO_OUT ) {
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
int mode = 00666;
|
||||
#else
|
||||
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// sg_socket.cxx -- Socket I/O routines
|
||||
//
|
||||
// Written by Curtis Olson, started November 1999.
|
||||
// Modified by Bernie Bright <bbright@bigpond.net.au>, May 2002.
|
||||
//
|
||||
// Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org
|
||||
//
|
||||
@@ -23,16 +24,6 @@
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
# include <sys/time.h> // select()
|
||||
# include <sys/types.h> // socket(), bind(), select(), accept()
|
||||
# include <sys/socket.h> // socket(), bind(), listen(), accept()
|
||||
# include <netinet/in.h> // struct sockaddr_in
|
||||
# include <netdb.h> // gethostbyname()
|
||||
# include <unistd.h> // select(), fsync()/fdatasync(), fcntl()
|
||||
# include <fcntl.h> // fcntl()
|
||||
#endif
|
||||
|
||||
#if defined( sgi )
|
||||
#include <strings.h>
|
||||
#endif
|
||||
@@ -41,25 +32,30 @@
|
||||
|
||||
#include "sg_socket.hxx"
|
||||
|
||||
bool SGSocket::init = false;
|
||||
|
||||
SGSocket::SGSocket( const string& host, const string& port,
|
||||
SGSocket::SGSocket( const string& host, const string& port_,
|
||||
const string& style ) :
|
||||
hostname(host),
|
||||
port_str(port),
|
||||
save_len(0)
|
||||
port_str(port_),
|
||||
save_len(0),
|
||||
client(0),
|
||||
is_tcp(false),
|
||||
is_server(false),
|
||||
first_read(false)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
if (!wsock_init && !wsastartup()) {
|
||||
SG_LOG( SG_IO, SG_ALERT, "Winsock not available");
|
||||
if (!init)
|
||||
{
|
||||
netInit(NULL, NULL); // plib-1.4.2 compatible
|
||||
init = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( style == "udp" ) {
|
||||
sock_style = SOCK_DGRAM;
|
||||
} else if ( style == "tcp" ) {
|
||||
sock_style = SOCK_STREAM;
|
||||
} else {
|
||||
sock_style = SOCK_DGRAM;
|
||||
if ( style == "tcp" )
|
||||
{
|
||||
is_tcp = true;
|
||||
}
|
||||
else if ( style != (string)"udp" )
|
||||
{
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: SGSocket() unknown style = " << style );
|
||||
}
|
||||
@@ -68,122 +64,65 @@ SGSocket::SGSocket( const string& host, const string& port,
|
||||
}
|
||||
|
||||
|
||||
SGSocket::~SGSocket() {
|
||||
SGSocket::~SGSocket()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
SGSocket::SocketType SGSocket::make_server_socket () {
|
||||
struct sockaddr_in name;
|
||||
|
||||
#if defined( __CYGWIN__ ) || defined( __CYGWIN32__ ) || defined( sgi ) || defined( _MSC_VER )
|
||||
int length;
|
||||
#else
|
||||
socklen_t length;
|
||||
#endif
|
||||
|
||||
// Create the socket.
|
||||
sock = socket (PF_INET, sock_style, 0);
|
||||
if (sock == INVALID_SOCKET) {
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: socket() failed in make_server_socket()" );
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
// Give the socket a name.
|
||||
name.sin_family = AF_INET;
|
||||
name.sin_addr.s_addr = INADDR_ANY;
|
||||
name.sin_port = htons(port); // set port to zero to let system pick
|
||||
name.sin_addr.s_addr = htonl (INADDR_ANY);
|
||||
if (bind (sock, (struct sockaddr *) &name, sizeof (name)) != 0) {
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: bind() failed in make_server_socket()" );
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
// Find the assigned port number
|
||||
length = sizeof(struct sockaddr_in);
|
||||
if ( getsockname(sock, (struct sockaddr *) &name, &length) ) {
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: getsockname() failed in make_server_socket()" );
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
port = ntohs(name.sin_port);
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
|
||||
SGSocket::SocketType SGSocket::make_client_socket () {
|
||||
struct sockaddr_in name;
|
||||
struct hostent *hp;
|
||||
|
||||
SG_LOG( SG_IO, SG_INFO, "Make client socket()" );
|
||||
|
||||
// Create the socket.
|
||||
sock = socket (PF_INET, sock_style, 0);
|
||||
if (sock == INVALID_SOCKET) {
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: socket() failed in make_server_socket()" );
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
// specify address family
|
||||
name.sin_family = AF_INET;
|
||||
|
||||
// get the hosts official name/info
|
||||
hp = gethostbyname( hostname.c_str() );
|
||||
|
||||
// Connect this socket to the host and the port specified on the
|
||||
// command line
|
||||
#if defined( __CYGWIN__ ) || defined( __CYGWIN32__ )
|
||||
bcopy(hp->h_addr, (char *)(&(name.sin_addr.s_addr)), hp->h_length);
|
||||
#else
|
||||
bcopy(hp->h_addr, &(name.sin_addr.s_addr), hp->h_length);
|
||||
#endif
|
||||
name.sin_port = htons(port);
|
||||
|
||||
if ( connect(sock, (struct sockaddr *) &name,
|
||||
sizeof(struct sockaddr_in)) != 0 )
|
||||
bool
|
||||
SGSocket::make_server_socket()
|
||||
{
|
||||
if (!sock.open( is_tcp ))
|
||||
{
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: socket() failed in make_server_socket()" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sock.bind( "", port ) < 0)
|
||||
{
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: bind() failed in make_server_socket()" );
|
||||
sock.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SGSocket::make_client_socket()
|
||||
{
|
||||
if (!sock.open( is_tcp ))
|
||||
{
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: socket() failed in make_client_socket()" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sock.connect( hostname.c_str(), port ) < 0)
|
||||
{
|
||||
closesocket(sock);
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: connect() failed in make_client_socket()" );
|
||||
return INVALID_SOCKET;
|
||||
sock.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
return sock;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Wrapper functions
|
||||
size_t SGSocket::readsocket( int fd, void *buf, size_t count ) {
|
||||
#if defined(_MSC_VER)
|
||||
return ::recv( fd, (char *)buf, count, 0 );
|
||||
#else
|
||||
return ::read( fd, buf, count );
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t SGSocket::writesocket( int fd, const void *buf, size_t count ) {
|
||||
#if defined(_MSC_VER)
|
||||
return ::send( fd, (const char*)buf, count, 0 );
|
||||
#else
|
||||
return ::write( fd, buf, count );
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
int SGSocket::closesocket( int fd ) {
|
||||
return ::close( fd );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// If specified as a server (in direction for now) open the master
|
||||
// listening socket. If specified as a client (out direction), open a
|
||||
// connection to a server.
|
||||
bool SGSocket::open( const SGProtocolDir d ) {
|
||||
set_dir( d );
|
||||
bool
|
||||
SGSocket::open( SGProtocolDir direction )
|
||||
{
|
||||
set_dir( direction );
|
||||
|
||||
is_server = is_tcp &&
|
||||
(direction == SG_IO_IN || direction == SG_IO_BI);
|
||||
|
||||
if ( port_str == "" || port_str == "any" ) {
|
||||
port = 0;
|
||||
@@ -191,69 +130,71 @@ bool SGSocket::open( const SGProtocolDir d ) {
|
||||
port = atoi( port_str.c_str() );
|
||||
}
|
||||
|
||||
// client_connections.clear();
|
||||
|
||||
if ( get_dir() == SG_IO_IN ) {
|
||||
if (direction == SG_IO_IN)
|
||||
{
|
||||
// this means server for now
|
||||
|
||||
// Setup socket to listen on. Set "port" before making this
|
||||
// call. A port of "0" indicates that we want to let the os
|
||||
// pick any available port.
|
||||
sock = make_server_socket();
|
||||
if ( sock == INVALID_SOCKET ) {
|
||||
SG_LOG( SG_IO, SG_ALERT, "socket creation failed" );
|
||||
if (!make_server_socket())
|
||||
{
|
||||
SG_LOG( SG_IO, SG_ALERT, "SG_IO_IN socket creation failed" );
|
||||
return false;
|
||||
}
|
||||
|
||||
SG_LOG( SG_IO, SG_INFO, "socket is connected to port = " << port );
|
||||
|
||||
if ( sock_style == SOCK_DGRAM ) {
|
||||
if ( !is_tcp )
|
||||
{
|
||||
// Non-blocking UDP
|
||||
nonblock();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Blocking TCP
|
||||
// Specify the maximum length of the connection queue
|
||||
listen( sock, SG_MAX_SOCKET_QUEUE );
|
||||
sock.listen( SG_MAX_SOCKET_QUEUE );
|
||||
}
|
||||
|
||||
} else if ( get_dir() == SG_IO_OUT ) {
|
||||
}
|
||||
else if (direction == SG_IO_OUT)
|
||||
{
|
||||
// this means client for now
|
||||
|
||||
sock = make_client_socket();
|
||||
// TODO: check for error.
|
||||
if (!make_client_socket())
|
||||
{
|
||||
SG_LOG( SG_IO, SG_ALERT, "SG_IO_OUT socket creation failed" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( sock_style == SOCK_DGRAM ) {
|
||||
if ( !is_tcp )
|
||||
{
|
||||
// Non-blocking UDP
|
||||
nonblock();
|
||||
}
|
||||
} else if ( get_dir() == SG_IO_BI && sock_style == SOCK_STREAM ) {
|
||||
}
|
||||
else if (direction == SG_IO_BI && is_tcp)
|
||||
{
|
||||
// this means server for TCP sockets
|
||||
|
||||
// Setup socket to listen on. Set "port" before making this
|
||||
// call. A port of "0" indicates that we want to let the os
|
||||
// pick any available port.
|
||||
sock = make_server_socket();
|
||||
// TODO: check for error.
|
||||
|
||||
SG_LOG( SG_IO, SG_INFO, "socket is connected to port = " << port );
|
||||
|
||||
if (!make_server_socket())
|
||||
{
|
||||
SG_LOG( SG_IO, SG_ALERT, "SG_IO_BI socket creation failed" );
|
||||
return false;
|
||||
}
|
||||
// Blocking TCP
|
||||
// Specify the maximum length of the connection queue
|
||||
listen( sock, SG_MAX_SOCKET_QUEUE );
|
||||
} else {
|
||||
sock.listen( SG_MAX_SOCKET_QUEUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: bidirection mode not available for UDP sockets." );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( sock < 0 ) {
|
||||
SG_LOG( SG_IO, SG_ALERT, "Error opening socket: " << hostname
|
||||
<< ":" << port );
|
||||
return false;
|
||||
}
|
||||
|
||||
// extra SOCK_STREAM stuff
|
||||
msgsock = INVALID_SOCKET;
|
||||
first_read = false;
|
||||
|
||||
return true;
|
||||
@@ -262,40 +203,25 @@ bool SGSocket::open( const SGProtocolDir d ) {
|
||||
|
||||
// read data from socket (server)
|
||||
// read a block of data of specified size
|
||||
int SGSocket::read( char *buf, int length ) {
|
||||
if ( sock == INVALID_SOCKET ) {
|
||||
int
|
||||
SGSocket::read( char *buf, int length )
|
||||
{
|
||||
if (sock.getHandle() == -1 &&
|
||||
(client == 0 || client->getHandle() == -1))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int result = 0;
|
||||
// check for potential input
|
||||
fd_set ready;
|
||||
FD_ZERO(&ready);
|
||||
FD_SET(sock, &ready);
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
// test for any input available on sock (returning immediately, even if
|
||||
// nothing)
|
||||
select(32, &ready, 0, 0, &tv);
|
||||
int result = poll();
|
||||
|
||||
if ( FD_ISSET(sock, &ready) ) {
|
||||
// cout << "data ready" << endl;
|
||||
if (result > 0)
|
||||
{
|
||||
result = sock.recv( buf, length );
|
||||
|
||||
if ( sock_style == SOCK_STREAM ) {
|
||||
if ( msgsock == INVALID_SOCKET ) {
|
||||
msgsock = accept(sock, 0, 0);
|
||||
closesocket(sock);
|
||||
sock = msgsock;
|
||||
} else {
|
||||
result = readsocket( sock, buf, length );
|
||||
}
|
||||
} else {
|
||||
result = readsocket( sock, buf, length );
|
||||
}
|
||||
|
||||
if ( result != length ) {
|
||||
if ( result != length )
|
||||
{
|
||||
SG_LOG( SG_IO, SG_INFO,
|
||||
"Warning: read() not enough bytes." );
|
||||
}
|
||||
@@ -306,94 +232,74 @@ int SGSocket::read( char *buf, int length ) {
|
||||
|
||||
|
||||
// read a line of data, length is max size of input buffer
|
||||
int SGSocket::readline( char *buf, int length ) {
|
||||
if ( sock == INVALID_SOCKET ) {
|
||||
int
|
||||
SGSocket::readline( char *buf, int length )
|
||||
{
|
||||
if (sock.getHandle() == -1 &&
|
||||
(client == 0 || client->getHandle() == -1))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// cout << "sock = " << sock << endl;
|
||||
|
||||
// check for potential input
|
||||
fd_set ready;
|
||||
FD_ZERO(&ready);
|
||||
FD_SET(sock, &ready);
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
// test for any input read on sock (returning immediately, even if
|
||||
// nothing)
|
||||
int result = select(32, &ready, 0, 0, &tv);
|
||||
// cout << "result = " << result << endl;
|
||||
int result = this->poll();
|
||||
|
||||
if ( FD_ISSET(sock, &ready) ) {
|
||||
// cout << "fd change state\n";
|
||||
if (result > 0)
|
||||
{
|
||||
// read a chunk, keep in the save buffer until we have the
|
||||
// requested amount read
|
||||
|
||||
if ( sock_style == SOCK_STREAM ) {
|
||||
// cout << "sock_stream\n";
|
||||
if ( msgsock == INVALID_SOCKET ) {
|
||||
// cout << "msgsock == invalid\n";
|
||||
msgsock = accept(sock, 0, 0);
|
||||
closesocket(sock);
|
||||
sock = msgsock;
|
||||
} else {
|
||||
// cout << "ready to read\n";
|
||||
char *buf_ptr = save_buf + save_len;
|
||||
result = readsocket( sock, buf_ptr, SG_IO_MAX_MSG_SIZE
|
||||
- save_len );
|
||||
// cout << "read result = " << result << endl;
|
||||
|
||||
if ( result > 0 ) {
|
||||
first_read = true;
|
||||
}
|
||||
|
||||
save_len += result;
|
||||
|
||||
// Try and detect that the remote end died. This
|
||||
// could cause problems so if you see connections
|
||||
// dropping for unexplained reasons, LOOK HERE!
|
||||
if ( result == 0 && save_len == 0 && first_read == true ) {
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Connection closed by foreign host." );
|
||||
closesocket(sock);
|
||||
open( get_dir() );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (is_tcp)
|
||||
{
|
||||
char *buf_ptr = save_buf + save_len;
|
||||
result = readsocket( sock, buf_ptr, SG_IO_MAX_MSG_SIZE - save_len );
|
||||
result = client->recv( buf_ptr, SG_IO_MAX_MSG_SIZE - save_len );
|
||||
|
||||
if ( result > 0 )
|
||||
{
|
||||
first_read = true;
|
||||
}
|
||||
|
||||
save_len += result;
|
||||
|
||||
// Try and detect that the remote end died. This
|
||||
// could cause problems so if you see connections
|
||||
// dropping for unexplained reasons, LOOK HERE!
|
||||
if (result == 0 && save_len == 0 && first_read == true)
|
||||
{
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Connection closed by foreign host." );
|
||||
delete client;
|
||||
client = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char *buf_ptr = save_buf + save_len;
|
||||
result = sock.recv( buf_ptr, SG_IO_MAX_MSG_SIZE - save_len );
|
||||
save_len += result;
|
||||
}
|
||||
|
||||
// cout << "current read = " << buf_ptr << endl;
|
||||
// cout << "current save_buf = " << save_buf << endl;
|
||||
// cout << "save_len = " << save_len << endl;
|
||||
} else {
|
||||
// cout << "no data ready\n";
|
||||
}
|
||||
|
||||
// look for the end of line in save_buf
|
||||
int i;
|
||||
for ( i = 0; i < save_len && save_buf[i] != '\n'; ++i );
|
||||
for ( i = 0; i < save_len && save_buf[i] != '\n'; ++i )
|
||||
;
|
||||
if ( save_buf[i] == '\n' ) {
|
||||
result = i + 1;
|
||||
} else {
|
||||
// no end of line yet
|
||||
// cout << "no eol found" << endl;
|
||||
return 0;
|
||||
}
|
||||
// cout << "line length = " << result << endl;
|
||||
|
||||
// we found an end of line
|
||||
|
||||
// copy to external buffer
|
||||
strncpy( buf, save_buf, result );
|
||||
buf[result] = '\0';
|
||||
// cout << "sg_socket line = " << buf << endl;
|
||||
|
||||
|
||||
// shift save buffer
|
||||
//memmove( save_buf+, save_buf+, ? );
|
||||
for ( i = result; i < save_len; ++i ) {
|
||||
save_buf[ i - result ] = save_buf[i];
|
||||
}
|
||||
@@ -404,66 +310,23 @@ int SGSocket::readline( char *buf, int length ) {
|
||||
|
||||
|
||||
// write data to socket (client)
|
||||
int SGSocket::write( const char *buf, const int length ) {
|
||||
if ( sock == INVALID_SOCKET ) {
|
||||
int
|
||||
SGSocket::write( const char *buf, const int length )
|
||||
{
|
||||
netSocket* s = client == 0 ? &sock : client;
|
||||
if (s->getHandle() == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool error_condition = false;
|
||||
|
||||
if ( writesocket(sock, buf, length) < 0 ) {
|
||||
if ( s->send( buf, length ) < 0 )
|
||||
{
|
||||
SG_LOG( SG_IO, SG_ALERT, "Error writing to socket: " << port );
|
||||
error_condition = true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// check for any new client connection requests
|
||||
fd_set ready;
|
||||
FD_ZERO(&ready);
|
||||
FD_SET(sock, &ready);
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
// test for any input on sock (returning immediately, even if
|
||||
// nothing)
|
||||
select(32, &ready, 0, 0, &tv);
|
||||
|
||||
// any new connections?
|
||||
if ( FD_ISSET(sock, &ready) ) {
|
||||
int msgsock = accept(sock, 0, 0);
|
||||
if ( msgsock < 0 ) {
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: accept() failed in write()" );
|
||||
return 0;
|
||||
} else {
|
||||
client_connections.push_back( msgsock );
|
||||
}
|
||||
}
|
||||
|
||||
SG_LOG( SG_IO, SG_INFO, "Client connections = " <<
|
||||
client_connections.size() );
|
||||
for ( int i = 0; i < (int)client_connections.size(); ++i ) {
|
||||
int msgsock = client_connections[i];
|
||||
|
||||
// read and junk any possible incoming messages.
|
||||
// char junk[ SG_IO_MAX_MSG_SIZE ];
|
||||
// std::read( msgsock, junk, SG_IO_MAX_MSG_SIZE );
|
||||
|
||||
// write the interesting data to the socket
|
||||
if ( writesocket(msgsock, buf, length) == SOCKET_ERROR ) {
|
||||
SG_LOG( SG_IO, SG_ALERT, "Error writing to socket: " << port );
|
||||
error_condition = true;
|
||||
} else {
|
||||
#ifdef _POSIX_SYNCHRONIZED_IO
|
||||
// fdatasync(msgsock);
|
||||
#else
|
||||
// fsync(msgsock);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( error_condition ) {
|
||||
return 0;
|
||||
}
|
||||
@@ -473,75 +336,62 @@ int SGSocket::write( const char *buf, const int length ) {
|
||||
|
||||
|
||||
// write null terminated string to socket (server)
|
||||
int SGSocket::writestring( const char *str ) {
|
||||
if ( sock == INVALID_SOCKET ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
SGSocket::writestring( const char *str )
|
||||
{
|
||||
int length = strlen( str );
|
||||
return write( str, length );
|
||||
return this->write( str, length );
|
||||
}
|
||||
|
||||
|
||||
// close the port
|
||||
bool SGSocket::close() {
|
||||
if ( sock == INVALID_SOCKET ) {
|
||||
return 0;
|
||||
}
|
||||
bool
|
||||
SGSocket::close()
|
||||
{
|
||||
delete client;
|
||||
client = 0;
|
||||
|
||||
closesocket( sock );
|
||||
sock.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// configure the socket as non-blocking
|
||||
bool SGSocket::nonblock() {
|
||||
if ( sock == INVALID_SOCKET ) {
|
||||
bool
|
||||
SGSocket::nonblock()
|
||||
{
|
||||
if (sock.getHandle() == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sock.setBlocking( false );
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
SGSocket::poll()
|
||||
{
|
||||
netSocket* readers[2];
|
||||
|
||||
readers[0] = client != 0 ? client : &sock;
|
||||
readers[1] = 0;
|
||||
|
||||
netSocket* writers[1];
|
||||
writers[0] = 0;
|
||||
|
||||
int result = netSocket::select( readers, writers, 0 );
|
||||
|
||||
if (result > 0 && is_server && client == 0)
|
||||
{
|
||||
// Accept a new client connection
|
||||
netAddress addr;
|
||||
int new_fd = sock.accept( &addr );
|
||||
SG_LOG( SG_IO, SG_INFO, "Accepted connection from "
|
||||
<< addr.getHost() << ":" << addr.getPort() );
|
||||
client = new netSocket();
|
||||
client->setHandle( new_fd );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
u_long arg = 1;
|
||||
if (ioctlsocket( sock, FIONBIO, &arg ) != 0) {
|
||||
int error_code = WSAGetLastError();
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error " << error_code << ": unable to set non-blocking mode"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
fcntl( sock, F_SETFL, O_NONBLOCK );
|
||||
#endif
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
bool SGSocket::wsock_init = false;
|
||||
|
||||
bool
|
||||
SGSocket::wsastartup() {
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
|
||||
//wVersionRequested = MAKEWORD( 2, 2 );
|
||||
wVersionRequested = MAKEWORD( 1, 1 );
|
||||
int err = WSAStartup( wVersionRequested, &wsaData );
|
||||
if (err != 0)
|
||||
{
|
||||
SG_LOG( SG_IO, SG_ALERT, "Error: Couldn't load winsock" );
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if ( LOBYTE( wsaData.wVersion ) != 2 ||
|
||||
HIBYTE( wsaData.wVersion ) != 2 ) {
|
||||
SG_LOG( SG_IO, SG_ALERT, "Couldn't load a suitable winsock");
|
||||
WSACleanup( );
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
wsock_init = true;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -39,11 +39,9 @@
|
||||
#include <simgear/math/sg_types.hxx>
|
||||
#include <simgear/io/iochannel.hxx>
|
||||
|
||||
SG_USING_STD(string);
|
||||
#include <plib/netSocket.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# include <winsock.h>
|
||||
#endif
|
||||
SG_USING_STD(string);
|
||||
|
||||
#define SG_MAX_SOCKET_QUEUE 32
|
||||
|
||||
@@ -53,13 +51,6 @@ SG_USING_STD(string);
|
||||
*/
|
||||
class SGSocket : public SGIOChannel {
|
||||
public:
|
||||
#if defined(_MSC_VER)
|
||||
typedef SOCKET SocketType;
|
||||
#else
|
||||
typedef int SocketType;
|
||||
# define INVALID_SOCKET (-1)
|
||||
#endif
|
||||
|
||||
private:
|
||||
string hostname;
|
||||
string port_str;
|
||||
@@ -67,31 +58,23 @@ private:
|
||||
char save_buf[ 2 * SG_IO_MAX_MSG_SIZE ];
|
||||
int save_len;
|
||||
|
||||
SocketType sock;
|
||||
SocketType msgsock;
|
||||
short unsigned int port;
|
||||
int sock_style; // SOCK_STREAM or SOCK_DGRAM
|
||||
|
||||
netSocket sock;
|
||||
netSocket* client;
|
||||
unsigned short port;
|
||||
bool is_tcp;
|
||||
bool is_server;
|
||||
bool first_read;
|
||||
|
||||
static bool init;
|
||||
|
||||
// make a server (master listening) socket
|
||||
SocketType make_server_socket();
|
||||
bool make_server_socket();
|
||||
|
||||
// make a client socket
|
||||
SocketType make_client_socket();
|
||||
bool make_client_socket();
|
||||
|
||||
// wrapper functions
|
||||
size_t readsocket( int fd, void *buf, size_t count );
|
||||
size_t writesocket( int fd, const void *buf, size_t count );
|
||||
#if !defined(_MSC_VER)
|
||||
int closesocket(int fd);
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// Ensure winsock has been initialised.
|
||||
static bool wsock_init;
|
||||
static bool wsastartup();
|
||||
#endif
|
||||
// Poll for new connections or data to read.
|
||||
int poll();
|
||||
|
||||
public:
|
||||
|
||||
|
||||
202
simgear/io/sg_socket_udp.cxx
Normal file
202
simgear/io/sg_socket_udp.cxx
Normal file
@@ -0,0 +1,202 @@
|
||||
// sg_socket.cxx -- Socket I/O routines
|
||||
//
|
||||
// Written by Curtis Olson, started November 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 <simgear/compiler.h>
|
||||
|
||||
#if defined( sgi )
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
|
||||
#include "sg_socket_udp.hxx"
|
||||
|
||||
|
||||
SGSocketUDP::SGSocketUDP( const string& host, const string& port ) :
|
||||
hostname(host),
|
||||
port_str(port),
|
||||
save_len(0)
|
||||
{
|
||||
set_valid( false );
|
||||
}
|
||||
|
||||
|
||||
SGSocketUDP::~SGSocketUDP() {
|
||||
}
|
||||
|
||||
|
||||
// If specified as a server (in direction for now) open the master
|
||||
// listening socket. If specified as a client (out direction), open a
|
||||
// connection to a server.
|
||||
bool SGSocketUDP::open( const SGProtocolDir d ) {
|
||||
set_dir( d );
|
||||
|
||||
if ( ! sock.open( false ) ) { // open a UDP socket
|
||||
SG_LOG( SG_IO, SG_ALERT, "error opening socket" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( port_str == "" || port_str == "any" ) {
|
||||
port = 0;
|
||||
} else {
|
||||
port = atoi( port_str.c_str() );
|
||||
}
|
||||
|
||||
// client_connections.clear();
|
||||
|
||||
if ( get_dir() == SG_IO_IN ) {
|
||||
// this means server
|
||||
|
||||
// bind ...
|
||||
if ( sock.bind( hostname.c_str(), port ) == -1 ) {
|
||||
SG_LOG( SG_IO, SG_ALERT, "error binding to port" << port_str );
|
||||
return false;
|
||||
}
|
||||
} else if ( get_dir() == SG_IO_OUT ) {
|
||||
// this means client
|
||||
|
||||
// connect ...
|
||||
if ( sock.connect( hostname.c_str(), port ) == -1 ) {
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"error connecting to " << hostname << port_str );
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
SG_LOG( SG_IO, SG_ALERT,
|
||||
"Error: bidirection mode not available for UDP sockets." );
|
||||
return false;
|
||||
}
|
||||
|
||||
set_valid( true );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// read data from socket (server)
|
||||
// read a block of data of specified size
|
||||
int SGSocketUDP::read( char *buf, int length ) {
|
||||
if ( ! isvalid() ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int result;
|
||||
|
||||
if ( (result = sock.recv(buf, SG_IO_MAX_MSG_SIZE, 0)) >= 0 ) {
|
||||
buf[result] = '\0';
|
||||
// printf("msg received = %s\n", buf);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// read a line of data, length is max size of input buffer
|
||||
int SGSocketUDP::readline( char *buf, int length ) {
|
||||
if ( ! isvalid() ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// cout << "sock = " << sock << endl;
|
||||
|
||||
char *buf_ptr = save_buf + save_len;
|
||||
int result = sock.recv(buf_ptr, SG_IO_MAX_MSG_SIZE, 0);
|
||||
// printf("msg received = %s\n", buf);
|
||||
save_len += result;
|
||||
|
||||
// look for the end of line in save_buf
|
||||
int i;
|
||||
for ( i = 0; i < save_len && save_buf[i] != '\n'; ++i );
|
||||
if ( save_buf[i] == '\n' ) {
|
||||
result = i + 1;
|
||||
} else {
|
||||
// no end of line yet
|
||||
// cout << "no eol found" << endl;
|
||||
return 0;
|
||||
}
|
||||
// cout << "line length = " << result << endl;
|
||||
|
||||
// we found an end of line
|
||||
|
||||
// copy to external buffer
|
||||
strncpy( buf, save_buf, result );
|
||||
buf[result] = '\0';
|
||||
// cout << "sg_socket line = " << buf << endl;
|
||||
|
||||
// shift save buffer
|
||||
for ( i = result; i < save_len; ++i ) {
|
||||
save_buf[ i - result ] = save_buf[i];
|
||||
}
|
||||
save_len -= result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// write data to socket (client)
|
||||
int SGSocketUDP::write( const char *buf, const int length ) {
|
||||
if ( ! isvalid() ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool error_condition = false;
|
||||
|
||||
if ( sock.send( buf, length, 0 ) < 0 ) {
|
||||
SG_LOG( SG_IO, SG_ALERT, "Error writing to socket: " << port );
|
||||
error_condition = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
// write null terminated string to socket (server)
|
||||
int SGSocketUDP::writestring( const char *str ) {
|
||||
if ( !isvalid() ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int length = strlen( str );
|
||||
return write( str, length );
|
||||
}
|
||||
|
||||
|
||||
// close the port
|
||||
bool SGSocketUDP::close() {
|
||||
if ( !isvalid() ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
sock.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// configure the socket as non-blocking
|
||||
bool SGSocketUDP::setBlocking( bool value ) {
|
||||
sock.setBlocking( value );
|
||||
|
||||
return true;
|
||||
}
|
||||
138
simgear/io/sg_socket_udp.hxx
Normal file
138
simgear/io/sg_socket_udp.hxx
Normal file
@@ -0,0 +1,138 @@
|
||||
/**
|
||||
* \file sg_socket_udp.hxx
|
||||
* UDP Socket I/O routines.
|
||||
*/
|
||||
|
||||
// Written by Curtis Olson, started November 2001.
|
||||
//
|
||||
// Copyright (C) 2001 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 _SG_SOCKET_UDP_HXX
|
||||
#define _SG_SOCKET_UDP_HXX
|
||||
|
||||
|
||||
#ifndef __cplusplus
|
||||
# error This library requires C++
|
||||
#endif
|
||||
|
||||
#include <plib/netSocket.h>
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include STL_STRING
|
||||
|
||||
#include <simgear/math/sg_types.hxx>
|
||||
#include <simgear/io/iochannel.hxx>
|
||||
|
||||
SG_USING_STD(string);
|
||||
|
||||
/**
|
||||
* A UDP socket I/O class based on SGIOChannel and plib/net.
|
||||
*/
|
||||
class SGSocketUDP : public SGIOChannel {
|
||||
|
||||
private:
|
||||
|
||||
netSocket sock;
|
||||
|
||||
string hostname;
|
||||
string port_str;
|
||||
|
||||
char save_buf[ 2 * SG_IO_MAX_MSG_SIZE ];
|
||||
int save_len;
|
||||
|
||||
short unsigned int port;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Create an instance of SGSocketUDP.
|
||||
*
|
||||
* When calling the constructor you need to provide a host name, and a
|
||||
* port number. The convention used by the
|
||||
* SGSocketUDP class is that the server side listens and the client
|
||||
* side sends. For a server socket, the host name should be
|
||||
* empty. For a server, the port number is optional, if you do not
|
||||
* specify a port, the system will assign one. For a client
|
||||
* socket, you need to specify both a destination host and
|
||||
* destination port.
|
||||
*
|
||||
* UDP sockets are a lower level protocol than TCP sockets and are
|
||||
* "connectionless" in the sense that either client or server can
|
||||
* exist, or not exist, startup, quit, etc. in any order and
|
||||
* whenever both ends are alive, the communication succeeds. With
|
||||
* UDP sockets, the server end just sits and listens for incoming
|
||||
* packets from anywhere. The client end sends it's message and
|
||||
* forgets about it. It doesn't care if there isn't even a server
|
||||
* out there listening and all the packets are getting
|
||||
* lost. Although systems/networks usually do a pretty good job
|
||||
* (statistically) of getting your UDP packets to their
|
||||
* destination, there is no guarantee that any particular packet
|
||||
* will make it. But, because of this low level implementation and
|
||||
* lack of error checking, UDP packets are much faster and
|
||||
* efficient. UDP packets are good for sending positional
|
||||
* information to synchronize two applications. In this case, you
|
||||
* want the information to arrive as quickly as possible, and if
|
||||
* you lose a packet, you'd rather get new updated information
|
||||
* rather than have the system waste time resending a packet that
|
||||
* is becoming older and older with every retry.
|
||||
* @param host name of host if direction is SG_IO_OUT or SG_IO_BI
|
||||
* @param port port number if we care to choose one.
|
||||
* @param style specify "udp" or "tcp" */
|
||||
SGSocketUDP( const string& host, const string& port );
|
||||
|
||||
/** Destructor */
|
||||
~SGSocketUDP();
|
||||
|
||||
// If specified as a server (in direction for now) open the master
|
||||
// listening socket. If specified as a client (out direction),
|
||||
// open a connection to a server.
|
||||
bool open( const SGProtocolDir d );
|
||||
|
||||
// read data from socket
|
||||
int read( char *buf, int length );
|
||||
|
||||
// read data from socket
|
||||
int readline( char *buf, int length );
|
||||
|
||||
// write data to a socket
|
||||
int write( const char *buf, const int length );
|
||||
|
||||
// write null terminated string to a socket
|
||||
int writestring( const char *str );
|
||||
|
||||
// close file
|
||||
bool close();
|
||||
|
||||
/**
|
||||
* Set blocking true or false
|
||||
* @return success/failure
|
||||
*/
|
||||
bool setBlocking( bool value );
|
||||
|
||||
/** @return the remote host name */
|
||||
inline string get_hostname() const { return hostname; }
|
||||
|
||||
/** @return the port number (in string form) */
|
||||
inline string get_port_str() const { return port_str; }
|
||||
};
|
||||
|
||||
|
||||
#endif // _SG_SOCKET_UDP_HXX
|
||||
@@ -41,6 +41,10 @@ int main() {
|
||||
if ( s.readline( buf, 256 ) > 0 ) {
|
||||
cout << "result = " << buf;
|
||||
}
|
||||
#ifdef __MINGW32__
|
||||
Sleep(100);
|
||||
#else
|
||||
sleep(1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
89
simgear/io/tcp_client.cxx
Normal file
89
simgear/io/tcp_client.cxx
Normal file
@@ -0,0 +1,89 @@
|
||||
#include <simgear/compiler.h>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
|
||||
#include "sg_socket.hxx"
|
||||
|
||||
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS
|
||||
using std::cout;
|
||||
#endif
|
||||
|
||||
class TcpClient
|
||||
{
|
||||
public:
|
||||
TcpClient( const char* host, const char* port );
|
||||
~TcpClient();
|
||||
|
||||
bool open();
|
||||
bool process();
|
||||
bool close();
|
||||
|
||||
private:
|
||||
SGIOChannel* channel;
|
||||
};
|
||||
|
||||
TcpClient::TcpClient( const char* host, const char* port )
|
||||
{
|
||||
channel = new SGSocket( host, port, "tcp" );
|
||||
}
|
||||
|
||||
TcpClient::~TcpClient()
|
||||
{
|
||||
delete channel;
|
||||
}
|
||||
|
||||
bool
|
||||
TcpClient::open()
|
||||
{
|
||||
return channel->open( SG_IO_OUT );
|
||||
}
|
||||
|
||||
bool
|
||||
TcpClient::process()
|
||||
{
|
||||
char wbuf[1024];
|
||||
|
||||
sprintf( wbuf, "hello world\n" );
|
||||
int length = channel->writestring( wbuf );
|
||||
cout << "writestring returned " << length << "\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TcpClient::close()
|
||||
{
|
||||
return channel->close();
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
sglog().setLogLevels( SG_ALL, SG_INFO );
|
||||
TcpClient client( "localhost", "5500" );
|
||||
if (!client.open())
|
||||
{
|
||||
cout << "client open failed\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
client.process();
|
||||
#ifdef _WIN32
|
||||
Sleep(1000);
|
||||
#else
|
||||
sleep(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
//client.close();
|
||||
return 0;
|
||||
}
|
||||
72
simgear/io/tcp_server.cxx
Normal file
72
simgear/io/tcp_server.cxx
Normal file
@@ -0,0 +1,72 @@
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include STL_STRING
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#include "sg_socket.hxx"
|
||||
|
||||
using std::string;
|
||||
#ifndef SG_HAVE_NATIVE_SGI_COMPILERS
|
||||
using std::cout;
|
||||
#endif
|
||||
|
||||
class TcpServer
|
||||
{
|
||||
public:
|
||||
TcpServer();
|
||||
bool open();
|
||||
bool process();
|
||||
bool close();
|
||||
|
||||
private:
|
||||
SGIOChannel* channel;
|
||||
};
|
||||
|
||||
TcpServer::TcpServer()
|
||||
{
|
||||
channel = new SGSocket( "", "5500", "tcp" );
|
||||
}
|
||||
|
||||
bool
|
||||
TcpServer::open()
|
||||
{
|
||||
channel->open( SG_IO_BI );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TcpServer::process()
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
int len;
|
||||
while ((len = channel->readline( buf, sizeof(buf) )) > 0)
|
||||
{
|
||||
cout << len << ": " << buf;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TcpServer::close()
|
||||
{
|
||||
return channel->close();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
sglog().setLogLevels( SG_ALL, SG_INFO );
|
||||
TcpServer server;
|
||||
server.open();
|
||||
SG_LOG( SG_IO, SG_INFO, "Created TCP server" );
|
||||
|
||||
while (1)
|
||||
{
|
||||
server.process();
|
||||
}
|
||||
|
||||
server.close();
|
||||
return 0;
|
||||
}
|
||||
4
simgear/magvar/.cvsignore
Normal file
4
simgear/magvar/.cvsignore
Normal file
@@ -0,0 +1,4 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
testmagvar
|
||||
@@ -14,4 +14,4 @@ testmagvar_SOURCES = testmagvar.cxx
|
||||
|
||||
testmagvar_LDADD = $(top_builddir)/simgear/magvar/libsgmagvar.a
|
||||
|
||||
INCLUDES += -I$(top_srcdir)
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
@@ -29,7 +29,10 @@
|
||||
#include "magvar.hxx"
|
||||
|
||||
|
||||
SGMagVar::SGMagVar() {
|
||||
SGMagVar::SGMagVar()
|
||||
: magvar(0.0),
|
||||
magdip(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
SGMagVar::~SGMagVar() {
|
||||
|
||||
@@ -45,9 +45,9 @@ if (argc == 8){
|
||||
var = calc_magvar( SGD_DEGREES_TO_RADIANS * lat_deg, SGD_DEGREES_TO_RADIANS * lon_deg, h,
|
||||
yymmdd_to_julian_days(yy,mm,dd), field );
|
||||
|
||||
fprintf(stdout,"%6.0lf %6.0lf %6.0lf\n", field[0], field[1], field[2] );
|
||||
fprintf(stdout,"%6.0lf %6.0lf %6.0lf\n", field[3], field[4], field[5] );
|
||||
fprintf(stdout,"%6.0lf %6.0lf %6.0lf %4.2lf %4.2lf \n",
|
||||
fprintf(stdout,"%6.0f %6.0f %6.0f\n", field[0], field[1], field[2] );
|
||||
fprintf(stdout,"%6.0f %6.0f %6.0f\n", field[3], field[4], field[5] );
|
||||
fprintf(stdout,"%6.0f %6.0f %6.0f %4.2f %4.2f \n",
|
||||
field[3],field[4],field[5],
|
||||
SGD_RADIANS_TO_DEGREES * (atan(field[5]/pow(field[3]*field[3]+field[4]*field[4],0.5))),
|
||||
SGD_RADIANS_TO_DEGREES * var);
|
||||
|
||||
3
simgear/math/.cvsignore
Normal file
3
simgear/math/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,11 +1,5 @@
|
||||
includedir = @includedir@/math
|
||||
|
||||
if HAVE_ZLIB
|
||||
ZLIB_INCL =
|
||||
else
|
||||
ZLIB_INCL = -I$(top_srcdir)/src/zlib
|
||||
endif
|
||||
|
||||
lib_LIBRARIES = libsgmath.a
|
||||
|
||||
include_HEADERS = \
|
||||
@@ -30,4 +24,4 @@ libsgmath_a_SOURCES = \
|
||||
sg_random.c \
|
||||
vector.cxx
|
||||
|
||||
INCLUDES += -I$(top_srcdir) $(ZLIB_INCL)
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
@@ -83,8 +83,9 @@ double SGInterpTable::interpolate(double x) const
|
||||
int i;
|
||||
double y;
|
||||
|
||||
if (size == 0.0)
|
||||
if (size == 0.0) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
|
||||
@@ -96,14 +97,14 @@ double SGInterpTable::interpolate(double x) const
|
||||
|
||||
// printf ("i = %d ", i);
|
||||
|
||||
if ( (i == 0) && (x < table[0].ind) ) {
|
||||
if ( i <= 0 ) {
|
||||
SG_LOG( SG_MATH, SG_DEBUG,
|
||||
"interpolate(): lookup error, x to small = " << x );
|
||||
return table[0].dep;
|
||||
}
|
||||
|
||||
// cout << " table[size-1].ind = " << table[size-1].ind << endl;
|
||||
if ( x > table[size-1].ind ) {
|
||||
if ( i >= size ) {
|
||||
SG_LOG( SG_MATH, SG_DEBUG,
|
||||
"interpolate(): lookup error, x to big = " << x );
|
||||
return table[size-1].dep;
|
||||
|
||||
@@ -22,6 +22,51 @@
|
||||
// $Id$
|
||||
|
||||
|
||||
/*
|
||||
A C-program for MT19937, with initialization improved 2002/2/10.
|
||||
Coded by Takuji Nishimura and Makoto Matsumoto.
|
||||
This is a faster version by taking Shawn Cokus's optimization,
|
||||
Matthe Bellew's simplification, Isaku Wada's real version.
|
||||
|
||||
Before using, initialize the state by using init_genrand(seed)
|
||||
or init_by_array(init_key, key_length).
|
||||
|
||||
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The names of its contributors may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Any feedback is very welcome.
|
||||
http://www.math.keio.ac.jp/matumoto/emt.html
|
||||
email: matumoto@math.keio.ac.jp
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <simgear_config.h>
|
||||
#endif
|
||||
@@ -32,50 +77,87 @@
|
||||
|
||||
#include "sg_random.h"
|
||||
|
||||
#ifndef HAVE_RAND
|
||||
# ifdef sgi
|
||||
# undef RAND_MAX
|
||||
# define RAND_MAX 2147483647
|
||||
# endif
|
||||
#endif
|
||||
/* Period parameters */
|
||||
#define N 624
|
||||
#define M 397
|
||||
#define MATRIX_A 0x9908b0dfUL /* constant vector a */
|
||||
#define UMASK 0x80000000UL /* most significant w-r bits */
|
||||
#define LMASK 0x7fffffffUL /* least significant r bits */
|
||||
#define MIXBITS(u,v) ( ((u) & UMASK) | ((v) & LMASK) )
|
||||
#define TWIST(u,v) ((MIXBITS(u,v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL))
|
||||
|
||||
#ifdef __SUNPRO_CC
|
||||
extern "C" {
|
||||
long int random();
|
||||
void srandom(unsigned int seed);
|
||||
static unsigned long state[N]; /* the array for the state vector */
|
||||
static int left = 1;
|
||||
static int initf = 0;
|
||||
static unsigned long *next;
|
||||
|
||||
/* initializes state[N] with a seed */
|
||||
void init_genrand(unsigned long s)
|
||||
{
|
||||
int j;
|
||||
state[0]= s & 0xffffffffUL;
|
||||
for (j=1; j<N; j++) {
|
||||
state[j] = (1812433253UL * (state[j-1] ^ (state[j-1] >> 30)) + j);
|
||||
/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
|
||||
/* In the previous versions, MSBs of the seed affect */
|
||||
/* only MSBs of the array state[]. */
|
||||
/* 2002/01/09 modified by Makoto Matsumoto */
|
||||
state[j] &= 0xffffffffUL; /* for >32 bit machines */
|
||||
}
|
||||
#endif
|
||||
left = 1; initf = 1;
|
||||
}
|
||||
|
||||
static void next_state(void)
|
||||
{
|
||||
unsigned long *p=state;
|
||||
int j;
|
||||
|
||||
/* if init_genrand() has not been called, */
|
||||
/* a default initial seed is used */
|
||||
if (initf==0) init_genrand(5489UL);
|
||||
|
||||
left = N;
|
||||
next = state;
|
||||
|
||||
for (j=N-M+1; --j; p++)
|
||||
*p = p[M] ^ TWIST(p[0], p[1]);
|
||||
|
||||
for (j=M; --j; p++)
|
||||
*p = p[M-N] ^ TWIST(p[0], p[1]);
|
||||
|
||||
*p = p[M-N] ^ TWIST(p[0], state[0]);
|
||||
}
|
||||
|
||||
// Seed the random number generater with time() so we don't see the
|
||||
// same sequence every time
|
||||
void sg_srandom_time() {
|
||||
#ifdef HAVE_RAND
|
||||
srand(time(NULL));
|
||||
#else
|
||||
srandom(time(NULL));
|
||||
#endif
|
||||
init_genrand(time(NULL));
|
||||
}
|
||||
|
||||
|
||||
// Seed the random number generater with your own seed so can set up
|
||||
// repeatable randomization.
|
||||
void sg_srandom( unsigned int seed ) {
|
||||
#ifdef HAVE_RAND
|
||||
srand( seed );
|
||||
#else
|
||||
srandom( seed );
|
||||
#endif
|
||||
init_genrand( seed );
|
||||
}
|
||||
|
||||
|
||||
// return a random number between [0.0, 1.0)
|
||||
double sg_random() {
|
||||
#ifdef HAVE_RAND
|
||||
return(rand() / (double)RAND_MAX);
|
||||
#else
|
||||
return(random() / (double)RAND_MAX);
|
||||
#endif
|
||||
unsigned long y;
|
||||
|
||||
if (--left == 0)
|
||||
next_state();
|
||||
y = *next++;
|
||||
|
||||
/* Tempering */
|
||||
y ^= (y >> 11);
|
||||
y ^= (y << 7) & 0x9d2c5680UL;
|
||||
y ^= (y << 15) & 0xefc60000UL;
|
||||
y ^= (y >> 18);
|
||||
|
||||
return (double)y * (1.0/4294967295.0);
|
||||
/* divided by 2^32-1 */
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ typedef vector < int > int_list;
|
||||
typedef int_list::iterator int_list_iterator;
|
||||
typedef int_list::const_iterator const_int_list_iterator;
|
||||
|
||||
/** STL vector list of doubles */
|
||||
typedef vector < double > double_list;
|
||||
typedef double_list::iterator double_list_iterator;
|
||||
typedef double_list::const_iterator const_double_list_iterator;
|
||||
|
||||
/** STL vector list of Point3D */
|
||||
typedef vector < Point3D > point_list;
|
||||
typedef point_list::iterator point_list_iterator;
|
||||
|
||||
3
simgear/metar/.cvsignore
Normal file
3
simgear/metar/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,13 +1,5 @@
|
||||
#pragma comment(compiler)
|
||||
#pragma comment(date)
|
||||
#pragma comment(timestamp)
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#pragma title("antoi - char array to integer")
|
||||
#pragma pagesize (80)
|
||||
|
||||
#pragma page(1)
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: antoi */
|
||||
@@ -78,4 +70,3 @@ int antoi(char * string, int len)
|
||||
|
||||
} /* end antoi */
|
||||
|
||||
#pragma page(1)
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
#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 */
|
||||
@@ -34,7 +26,6 @@
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
bool charcmp(char *str, char *pattern)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
#pragma comment (compiler)
|
||||
//#pragma comment (date)
|
||||
//#pragma comment (timestamp)
|
||||
#pragma pagesize(80)
|
||||
|
||||
|
||||
#include "Local.h" /* standard header file */
|
||||
#include "Metar.h" /* standard header file */
|
||||
|
||||
@@ -11,9 +5,6 @@ float fracPart( char * );
|
||||
void DcdMTRmk( char **, Decoded_METAR * );
|
||||
|
||||
|
||||
#pragma page(1)
|
||||
#pragma subtitle(" ")
|
||||
#pragma subtitle("subtitle - Decode METAR report. ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: SaveTokenString */
|
||||
@@ -46,7 +37,6 @@ void DcdMTRmk( char **, Decoded_METAR * );
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static char **SaveTokenString ( char *string , char *delimeters )
|
||||
{
|
||||
@@ -99,9 +89,6 @@ static char **SaveTokenString ( char *string , char *delimeters )
|
||||
return token;
|
||||
|
||||
}
|
||||
#pragma page(1)
|
||||
#pragma subtitle(" ")
|
||||
#pragma subtitle("subtitle - Decode METAR report. ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: freeTokens */
|
||||
@@ -124,7 +111,6 @@ static char **SaveTokenString ( char *string , char *delimeters )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static void freeTokens( char **token )
|
||||
{
|
||||
@@ -138,9 +124,6 @@ static void freeTokens( char **token )
|
||||
}
|
||||
return;
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: InitDcdMETAR */
|
||||
@@ -163,7 +146,6 @@ static void freeTokens( char **token )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static void InitDcdMETAR( Decoded_METAR *Mptr )
|
||||
{
|
||||
|
||||
@@ -439,9 +421,6 @@ static void InitDcdMETAR( Decoded_METAR *Mptr )
|
||||
return;
|
||||
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: ResetMETARGroup */
|
||||
@@ -475,8 +454,7 @@ static void InitDcdMETAR( Decoded_METAR *Mptr )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static int ResetMETARGroup( int StartGroup,
|
||||
/*static int ResetMETARGroup( int StartGroup,
|
||||
int SaveStartGroup )
|
||||
{
|
||||
|
||||
@@ -495,11 +473,8 @@ static int ResetMETARGroup( int StartGroup,
|
||||
return (++SaveStartGroup);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
#pragma page(1)
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: CodedHgt2Meters */
|
||||
@@ -523,7 +498,6 @@ static int ResetMETARGroup( int StartGroup,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static int CodedHgt2Meters( char *token, Decoded_METAR *Mptr )
|
||||
{
|
||||
@@ -537,10 +511,6 @@ static int CodedHgt2Meters( char *token, Decoded_METAR *Mptr )
|
||||
return (hgt*30);
|
||||
}
|
||||
|
||||
#pragma page(1)
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPartObscur */
|
||||
@@ -574,7 +544,6 @@ static int CodedHgt2Meters( char *token, Decoded_METAR *Mptr )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isPartObscur( char **string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -617,10 +586,6 @@ static bool isPartObscur( char **string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma page(1)
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isCldLayer */
|
||||
@@ -650,7 +615,6 @@ static bool isPartObscur( char **string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isCldLayer( char *token )
|
||||
{
|
||||
@@ -671,10 +635,6 @@ static bool isCldLayer( char *token )
|
||||
nisdigit((token+3),3)) ? TRUE:FALSE;
|
||||
}
|
||||
|
||||
#pragma page(1)
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isCAVOK */
|
||||
@@ -701,7 +661,6 @@ static bool isCldLayer( char *token )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isCAVOK( char *token, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
@@ -718,9 +677,6 @@ static bool isCAVOK( char *token, Decoded_METAR *Mptr, int *NDEX )
|
||||
}
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: parseCldData */
|
||||
@@ -742,7 +698,6 @@ static bool isCAVOK( char *token, Decoded_METAR *Mptr, int *NDEX )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static void parseCldData( char *token, Decoded_METAR *Mptr, int next)
|
||||
{
|
||||
@@ -766,9 +721,6 @@ static void parseCldData( char *token, Decoded_METAR *Mptr, int next)
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isSkyCond */
|
||||
@@ -790,7 +742,6 @@ static void parseCldData( char *token, Decoded_METAR *Mptr, int next)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isSkyCond( char **skycond, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -989,9 +940,6 @@ static bool isSkyCond( char **skycond, Decoded_METAR *Mptr,
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: prevailVSBY */
|
||||
@@ -1013,7 +961,6 @@ static bool isSkyCond( char **skycond, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static float prevailVSBY( char *visibility )
|
||||
{
|
||||
float Miles_vsby;
|
||||
@@ -1061,9 +1008,6 @@ static float prevailVSBY( char *visibility )
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isVisibility */
|
||||
@@ -1086,7 +1030,6 @@ static float prevailVSBY( char *visibility )
|
||||
/* */
|
||||
/********************************************************************/
|
||||
|
||||
#pragma page(1)
|
||||
|
||||
static bool isVisibility( char **visblty, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
@@ -1329,9 +1272,6 @@ static bool isVisibility( char **visblty, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: vrblVsby */
|
||||
@@ -1353,13 +1293,13 @@ static bool isVisibility( char **visblty, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
#if 0
|
||||
static bool vrblVsby( char *string1, char *string2,
|
||||
Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
char buf[ 6 ];
|
||||
int numerator,
|
||||
denominator;
|
||||
/* int numerator,
|
||||
denominator; */
|
||||
char *slash,
|
||||
*V_char,
|
||||
*temp;
|
||||
@@ -1429,11 +1369,9 @@ static bool vrblVsby( char *string1, char *string2,
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isMinMaxWinDir */
|
||||
@@ -1455,7 +1393,6 @@ static bool vrblVsby( char *string1, char *string2,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isMinMaxWinDir( char *string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -1488,9 +1425,6 @@ static bool isMinMaxWinDir( char *string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isRVR */
|
||||
@@ -1512,7 +1446,6 @@ static bool isMinMaxWinDir( char *string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isRVR( char *token, Decoded_METAR *Mptr, int *NDEX,
|
||||
int ndex )
|
||||
@@ -1575,9 +1508,6 @@ static bool isRVR( char *token, Decoded_METAR *Mptr, int *NDEX,
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isAltimStng */
|
||||
@@ -1599,7 +1529,6 @@ static bool isRVR( char *token, Decoded_METAR *Mptr, int *NDEX,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isAltimStng( char *token, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
@@ -1648,9 +1577,6 @@ static bool isAltimStng( char *token, Decoded_METAR *Mptr, int *NDEX )
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTempGroup */
|
||||
@@ -1672,7 +1598,6 @@ static bool isAltimStng( char *token, Decoded_METAR *Mptr, int *NDEX )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isTempGroup( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -1768,9 +1693,6 @@ static bool isTempGroup( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isWxToken */
|
||||
@@ -1792,27 +1714,23 @@ static bool isTempGroup( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isWxToken( char *token )
|
||||
/*static bool isWxToken( char *token )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( token == NULL )
|
||||
return FALSE;
|
||||
for( i = 0; i < strlen(token); i++ )
|
||||
for( i = 0; i < (int)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 */
|
||||
@@ -1834,7 +1752,6 @@ static bool isWxToken( char *token )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isPresentWX( char *token, Decoded_METAR *Mptr,
|
||||
int *NDEX, int *next )
|
||||
@@ -1929,9 +1846,6 @@ static bool isPresentWX( char *token, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isStnID */
|
||||
@@ -1953,7 +1867,6 @@ static bool isPresentWX( char *token, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isStnId( char *stnID, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -1976,9 +1889,6 @@ static bool isStnId( char *stnID, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isCodeName */
|
||||
@@ -2000,7 +1910,6 @@ static bool isStnId( char *stnID, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isCodeName( char *codename, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -2020,9 +1929,6 @@ static bool isCodeName( char *codename, Decoded_METAR *Mptr, int *NDEX)
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isNIL */
|
||||
@@ -2044,7 +1950,6 @@ static bool isCodeName( char *codename, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isNIL( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -2063,9 +1968,6 @@ static bool isNIL( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isAUTO */
|
||||
@@ -2087,7 +1989,6 @@ static bool isNIL( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isAUTO( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -2106,9 +2007,6 @@ static bool isAUTO( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isCOR */
|
||||
@@ -2130,7 +2028,6 @@ static bool isAUTO( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isCOR ( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -2149,9 +2046,6 @@ static bool isCOR ( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTimeUTC */
|
||||
@@ -2173,7 +2067,6 @@ static bool isCOR ( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isTimeUTC( char *UTC, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
@@ -2228,9 +2121,6 @@ static bool isTimeUTC( char *UTC, Decoded_METAR *Mptr, int *NDEX )
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isWindData */
|
||||
@@ -2252,7 +2142,6 @@ static bool isTimeUTC( char *UTC, Decoded_METAR *Mptr, int *NDEX )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isWindData( char *wind, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
@@ -2322,9 +2211,6 @@ static bool isWindData( char *wind, Decoded_METAR *Mptr, int *NDEX )
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
#pragma page(1)
|
||||
#pragma subtitle(" ")
|
||||
#pragma subtitle("subtitle - Decode METAR report. ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: DcdMETAR */
|
||||
@@ -2349,7 +2235,6 @@ static bool isWindData( char *wind, Decoded_METAR *Mptr, int *NDEX )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
|
||||
int DcdMETAR( char *string , Decoded_METAR *Mptr )
|
||||
@@ -2365,17 +2250,14 @@ int DcdMETAR( char *string , Decoded_METAR *Mptr )
|
||||
CAVOK, visibility,
|
||||
RVR, presentWX, PartialObscur,
|
||||
skyCond, tempGroup,
|
||||
altimStng, NotIDed = 99} StartGroup,
|
||||
SaveStartGroup,
|
||||
MetarGroup;
|
||||
altimStng, NotIDed = 99 }
|
||||
StartGroup, SaveStartGroup, MetarGroup;
|
||||
|
||||
WindStruct *WinDataPtr;
|
||||
// WindStruct *WinDataPtr;
|
||||
|
||||
int ndex,
|
||||
NDEX,
|
||||
i,
|
||||
jkj,
|
||||
j;
|
||||
int ndex;
|
||||
int NDEX;
|
||||
// int i, jkj, j;
|
||||
|
||||
|
||||
char **token,
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#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 */
|
||||
@@ -46,7 +45,6 @@ float fracPart( char * );
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isTS_LOC( char **string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
@@ -132,9 +130,6 @@ static bool isTS_LOC( char **string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isDVR */
|
||||
@@ -156,7 +151,6 @@ static bool isTS_LOC( char **string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isDVR( char *token, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
@@ -215,9 +209,6 @@ static bool isDVR( char *token, Decoded_METAR *Mptr, int *NDEX )
|
||||
}
|
||||
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTornadicActiv */
|
||||
@@ -258,7 +249,6 @@ static bool isDVR( char *token, Decoded_METAR *Mptr, int *NDEX )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isTornadicActiv( char **string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
@@ -529,9 +519,6 @@ static bool isTornadicActiv( char **string, Decoded_METAR *Mptr,
|
||||
}
|
||||
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPartObscur */
|
||||
@@ -574,7 +561,6 @@ static bool isTornadicActiv( char **string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isPartObscur( char **string, Decoded_METAR *Mptr,
|
||||
int ndex, int *NDEX )
|
||||
{
|
||||
@@ -675,9 +661,6 @@ static bool isPartObscur( char **string, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isA0indicator */
|
||||
@@ -718,7 +701,6 @@ static bool isPartObscur( char **string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isA0indicator( char *indicator, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
@@ -761,9 +743,6 @@ static bool isA0indicator( char *indicator, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPeakWind */
|
||||
@@ -803,7 +782,6 @@ static bool isA0indicator( char *indicator, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isPeakWind( char **string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -896,9 +874,6 @@ static bool isPeakWind( char **string, Decoded_METAR *Mptr,
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isWindShift */
|
||||
@@ -938,7 +913,6 @@ static bool isPeakWind( char **string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isWindShift( char **string, Decoded_METAR *Mptr,
|
||||
int *NDEX)
|
||||
{
|
||||
@@ -1028,9 +1002,6 @@ static bool isWindShift( char **string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTowerVsby */
|
||||
@@ -1069,7 +1040,6 @@ static bool isWindShift( char **string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isTowerVsby( char **token, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
|
||||
@@ -1184,9 +1154,6 @@ static bool isTowerVsby( char **token, Decoded_METAR *Mptr, int *NDEX)
|
||||
}
|
||||
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isSurfaceVsby */
|
||||
@@ -1225,7 +1192,6 @@ static bool isTowerVsby( char **token, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isSurfaceVsby( char **token, Decoded_METAR *Mptr,
|
||||
int *NDEX)
|
||||
{
|
||||
@@ -1342,9 +1308,6 @@ static bool isSurfaceVsby( char **token, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isVariableVsby */
|
||||
@@ -1384,7 +1347,6 @@ static bool isSurfaceVsby( char **token, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isVariableVsby( char **string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -1393,9 +1355,9 @@ static bool isVariableVsby( char **string, Decoded_METAR *Mptr,
|
||||
/* DECLARE LOCAL VARIABLES */
|
||||
/***************************/
|
||||
|
||||
char *slash,
|
||||
*slash1,
|
||||
*slash2,
|
||||
char *slash = NULL,
|
||||
*slash1 = NULL,
|
||||
*slash2 = NULL,
|
||||
buf[ 5 ],
|
||||
*V_char;
|
||||
float minimumVsby,
|
||||
@@ -1594,9 +1556,6 @@ static bool isVariableVsby( char **string, Decoded_METAR *Mptr,
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isVsby2ndSite */
|
||||
@@ -1640,7 +1599,6 @@ static bool isVariableVsby( char **string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isVsby2ndSite( char **token, Decoded_METAR *Mptr,
|
||||
int *NDEX)
|
||||
{
|
||||
@@ -1799,9 +1757,6 @@ static bool isVsby2ndSite( char **token, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isLTGfreq */
|
||||
@@ -1845,7 +1800,6 @@ static bool isVsby2ndSite( char **token, Decoded_METAR *Mptr,
|
||||
/* */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
bool static isLTGfreq( char **string, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
@@ -2086,16 +2040,8 @@ bool static isLTGfreq( char **string, Decoded_METAR *Mptr, int *NDEX )
|
||||
|
||||
|
||||
|
||||
#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 */
|
||||
@@ -2139,7 +2085,6 @@ bool static isLTGfreq( char **string, Decoded_METAR *Mptr, int *NDEX )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isRecentWX( char **token, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -2476,9 +2421,6 @@ static bool isRecentWX( char **token, Decoded_METAR *Mptr,
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isVariableCIG */
|
||||
@@ -2509,7 +2451,6 @@ static bool isRecentWX( char **token, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isVariableCIG( char **token, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -2542,9 +2483,6 @@ static bool isVariableCIG( char **token, Decoded_METAR *Mptr,
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isCeil2ndSite */
|
||||
@@ -2579,7 +2517,6 @@ static bool isVariableCIG( char **token, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isCIG2ndSite( char **token, Decoded_METAR *Mptr,
|
||||
int *NDEX)
|
||||
{
|
||||
@@ -2618,9 +2555,6 @@ static bool isCIG2ndSite( char **token, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPRESFR */
|
||||
@@ -2669,7 +2603,6 @@ static bool isCIG2ndSite( char **token, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isPRESFR( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -2686,9 +2619,6 @@ static bool isPRESFR( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
}
|
||||
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPRESRR */
|
||||
@@ -2737,7 +2667,6 @@ static bool isPRESFR( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isPRESRR( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -2755,9 +2684,6 @@ static bool isPRESRR( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isSLP */
|
||||
@@ -2779,7 +2705,6 @@ static bool isPRESRR( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isSLP( char **token, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
@@ -2788,8 +2713,8 @@ static bool isSLP( char **token, Decoded_METAR *Mptr, int *NDEX )
|
||||
/* DECLARE LOCAL VARIABLES */
|
||||
/***************************/
|
||||
|
||||
int pressure,
|
||||
ndex;
|
||||
int pressure;
|
||||
// int ndex;
|
||||
|
||||
/*************************/
|
||||
/* BEGIN BODY OF ROUTINE */
|
||||
@@ -2853,7 +2778,6 @@ static bool isSLP( char **token, Decoded_METAR *Mptr, int *NDEX )
|
||||
}
|
||||
|
||||
}
|
||||
#pragma page(1)
|
||||
static bool isSectorVsby( char **string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -2861,7 +2785,7 @@ static bool isSectorVsby( char **string, Decoded_METAR *Mptr,
|
||||
/* DECLARE LOCAL VARIABLES */
|
||||
/***************************/
|
||||
|
||||
float vsby;
|
||||
float vsby = 0.0f;
|
||||
char dd[3],
|
||||
*slash;
|
||||
|
||||
@@ -2931,9 +2855,6 @@ static bool isSectorVsby( char **string, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isGR */
|
||||
@@ -2982,7 +2903,6 @@ static bool isSectorVsby( char **string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isGR( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
char *slash;
|
||||
@@ -3065,9 +2985,6 @@ static bool isGR( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
}
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isVIRGA */
|
||||
@@ -3116,7 +3033,6 @@ static bool isGR( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isVIRGA( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -3152,7 +3068,6 @@ static bool isVIRGA( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma page(1)
|
||||
static bool isSfcObscuration( char *string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -3240,7 +3155,6 @@ static bool isSfcObscuration( char *string, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma page(1)
|
||||
static bool isCeiling( char *string, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
|
||||
@@ -3280,7 +3194,6 @@ static bool isCeiling( char *string, Decoded_METAR *Mptr, int *NDEX )
|
||||
}
|
||||
|
||||
}
|
||||
#pragma page(1)
|
||||
static bool isVrbSky( char **string, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
static char *cldPtr[] = {"FEW", "SCT", "BKN", "OVC", NULL };
|
||||
@@ -3384,7 +3297,6 @@ static bool isVrbSky( char **string, Decoded_METAR *Mptr, int *NDEX )
|
||||
|
||||
}
|
||||
|
||||
#pragma page(1)
|
||||
static bool isObscurAloft( char **string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -3468,7 +3380,6 @@ static bool isObscurAloft( char **string, Decoded_METAR *Mptr,
|
||||
}
|
||||
|
||||
}
|
||||
#pragma page(1)
|
||||
static bool isNOSPECI( char *string, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
|
||||
@@ -3483,7 +3394,6 @@ static bool isNOSPECI( char *string, Decoded_METAR *Mptr, int *NDEX )
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
#pragma page(1)
|
||||
static bool isLAST( char *string, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
|
||||
@@ -3498,9 +3408,6 @@ static bool isLAST( char *string, Decoded_METAR *Mptr, int *NDEX )
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isSynopClouds */
|
||||
@@ -3522,7 +3429,6 @@ static bool isLAST( char *string, Decoded_METAR *Mptr, int *NDEX )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isSynopClouds( char *token, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -3555,7 +3461,6 @@ static bool isSynopClouds( char *token, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma page(1)
|
||||
static bool isSNINCR( char **string, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
|
||||
@@ -3594,9 +3499,6 @@ static bool isSNINCR( char **string, Decoded_METAR *Mptr, int *NDEX )
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isSnowDepth */
|
||||
@@ -3618,7 +3520,6 @@ static bool isSNINCR( char **string, Decoded_METAR *Mptr, int *NDEX )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isSnowDepth( char *token, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -3642,7 +3543,6 @@ static bool isSnowDepth( char *token, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma page(1)
|
||||
static bool isWaterEquivSnow( char *string,
|
||||
Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
@@ -3664,7 +3564,6 @@ static bool isWaterEquivSnow( char *string,
|
||||
}
|
||||
|
||||
}
|
||||
#pragma page(1)
|
||||
static bool isSunshineDur( char *string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -3690,9 +3589,6 @@ static bool isSunshineDur( char *string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isHourlyPrecip */
|
||||
@@ -3741,7 +3637,6 @@ static bool isSunshineDur( char *string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isHourlyPrecip( char **string, Decoded_METAR *Mptr,
|
||||
int *NDEX)
|
||||
@@ -3788,9 +3683,6 @@ static bool isHourlyPrecip( char **string, Decoded_METAR *Mptr,
|
||||
}
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isP6Precip */
|
||||
@@ -3839,7 +3731,6 @@ static bool isHourlyPrecip( char **string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isP6Precip( char *string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
@@ -3867,9 +3758,6 @@ static bool isP6Precip( char *string, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isP24Precip */
|
||||
@@ -3918,7 +3806,6 @@ static bool isP6Precip( char *string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isP24Precip( char *string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
@@ -3944,9 +3831,6 @@ static bool isP24Precip( char *string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTTdTenths */
|
||||
@@ -3995,7 +3879,6 @@ static bool isP24Precip( char *string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isTTdTenths( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -4056,9 +3939,6 @@ static bool isTTdTenths( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
}
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isMaxTemp */
|
||||
@@ -4080,7 +3960,6 @@ static bool isTTdTenths( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isMaxTemp(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
char buf[ 6 ];
|
||||
@@ -4120,9 +3999,6 @@ static bool isMaxTemp(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isMinTemp */
|
||||
@@ -4144,7 +4020,6 @@ static bool isMaxTemp(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isMinTemp(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
char buf[ 6 ];
|
||||
@@ -4183,9 +4058,6 @@ static bool isMinTemp(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isT24MaxMinTemp */
|
||||
@@ -4207,7 +4079,6 @@ static bool isMinTemp(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isT24MaxMinTemp( char *string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -4263,9 +4134,6 @@ static bool isT24MaxMinTemp( char *string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPtendency */
|
||||
@@ -4287,7 +4155,6 @@ static bool isT24MaxMinTemp( char *string, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isPtendency(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -4328,9 +4195,6 @@ static bool isPtendency(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPWINO */
|
||||
@@ -4352,7 +4216,6 @@ static bool isPtendency(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isPWINO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -4371,9 +4234,6 @@ static bool isPWINO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPNO */
|
||||
@@ -4395,7 +4255,6 @@ static bool isPWINO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isPNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -4414,9 +4273,6 @@ static bool isPNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isRVRNO */
|
||||
@@ -4438,7 +4294,6 @@ static bool isPNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isRVRNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -4456,9 +4311,6 @@ static bool isRVRNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isCHINO */
|
||||
@@ -4480,7 +4332,6 @@ static bool isRVRNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isCHINO( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -4518,9 +4369,6 @@ static bool isCHINO( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isVISNO */
|
||||
@@ -4542,7 +4390,6 @@ static bool isCHINO( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isVISNO( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -4579,9 +4426,6 @@ static bool isVISNO( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isFZRANO */
|
||||
@@ -4603,7 +4447,6 @@ static bool isVISNO( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isFZRANO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -4622,9 +4465,6 @@ static bool isFZRANO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTSNO */
|
||||
@@ -4673,7 +4513,6 @@ static bool isFZRANO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isTSNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
{
|
||||
@@ -4691,9 +4530,6 @@ static bool isTSNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isDollarSign */
|
||||
@@ -4715,7 +4551,6 @@ static bool isTSNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isDollarSign( char *indicator, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
@@ -4734,9 +4569,6 @@ static bool isDollarSign( char *indicator, Decoded_METAR *Mptr,
|
||||
}
|
||||
}
|
||||
|
||||
#pragma page(1)
|
||||
#pragma subtitle(" ")
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: DcdMTRmk */
|
||||
@@ -4766,7 +4598,6 @@ static bool isDollarSign( char *indicator, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
void DcdMTRmk( char **token, Decoded_METAR *Mptr )
|
||||
{
|
||||
|
||||
@@ -4791,18 +4622,18 @@ void DcdMTRmk( char **token, Decoded_METAR *Mptr )
|
||||
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;
|
||||
int NDEX;
|
||||
// int ndex;
|
||||
int i;
|
||||
// char *slash;
|
||||
// char *tokenX;
|
||||
// char *V_char;
|
||||
// char *temp_token;
|
||||
|
||||
bool extra_token,
|
||||
IS_NOT_RMKS;
|
||||
// bool extra_token;
|
||||
bool IS_NOT_RMKS;
|
||||
|
||||
float T_vsby;
|
||||
// float T_vsby;
|
||||
|
||||
/*************************/
|
||||
/* START BODY OF ROUTINE */
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
#include "Metar.h"
|
||||
|
||||
#pragma page(1)
|
||||
#pragma subtitle(" ")
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: dRVMETAR */
|
||||
@@ -29,10 +26,8 @@
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
main()
|
||||
int main()
|
||||
{
|
||||
char bltn_prefix[20];
|
||||
static char *string[] =
|
||||
{
|
||||
"KAST 221156Z COR 09005KT 7SM -RA OVC026 09/08 A2996 RMK "
|
||||
@@ -516,7 +511,6 @@ NULL,
|
||||
Decoded_METAR *Mptr = &Metar;
|
||||
int j,
|
||||
ErReturn;
|
||||
static char *synopRTRN = NULL;
|
||||
|
||||
|
||||
/***************************************************/
|
||||
@@ -541,4 +535,5 @@ NULL,
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
#include "Local.h" /* standard header file */
|
||||
#include "Metar.h"
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: fracPart */
|
||||
@@ -26,7 +23,6 @@
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
float fracPart( char *string )
|
||||
{
|
||||
|
||||
@@ -1106,8 +1106,10 @@ char *strlwr(char *);
|
||||
char *rptstrip(char *);
|
||||
char *rptfmt(char *);
|
||||
char *rptfmti(char *, unsigned short int);
|
||||
|
||||
|
||||
#ifndef __FreeBSD__ // strnstr is already defined on FreeBSD
|
||||
char *strnstr(char *, char *, size_t);
|
||||
#endif
|
||||
|
||||
int stregion(int);
|
||||
int ccregion(char *);
|
||||
|
||||
@@ -11,4 +11,4 @@ libsgmetar_a_SOURCES = \
|
||||
MetarStation.cpp \
|
||||
Prtdmetr.cpp Stspack2.cpp Stspack3.cpp
|
||||
|
||||
INCLUDES += -I$(top_srcdir)
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "Local.h" /* standard header file */
|
||||
#include "Metar.h"
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: prtDMETR */
|
||||
@@ -25,7 +23,6 @@
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
void prtDMETR( Decoded_METAR *Mptr )
|
||||
{
|
||||
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
#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 */
|
||||
@@ -75,7 +67,6 @@
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
int nisalnum(char *s, int n) {
|
||||
|
||||
@@ -208,4 +199,3 @@ int nisxdigi(char *s, int n) {
|
||||
|
||||
} /* end nisxdigi */
|
||||
|
||||
#pragma page(1)
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
#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 */
|
||||
@@ -75,7 +67,6 @@
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
char *nxtalnum(char *s) {
|
||||
|
||||
for (; !isalnum(*s) && *s; s++) ;
|
||||
@@ -208,4 +199,3 @@ char *nxtxdigi(char *s) {
|
||||
} /* end nxtxdigi */
|
||||
|
||||
|
||||
#pragma page(1)
|
||||
|
||||
4
simgear/misc/.cvsignore
Normal file
4
simgear/misc/.cvsignore
Normal file
@@ -0,0 +1,4 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
props_test
|
||||
@@ -1,16 +1,12 @@
|
||||
includedir = @includedir@/misc
|
||||
|
||||
if HAVE_ZLIB
|
||||
ZLIB_INCL =
|
||||
else
|
||||
ZLIB_INCL = -I$(top_srcdir)/src/zlib
|
||||
endif
|
||||
|
||||
lib_LIBRARIES = libsgmisc.a
|
||||
|
||||
include_HEADERS = \
|
||||
commands.hxx \
|
||||
exception.hxx \
|
||||
props.hxx \
|
||||
props_io.hxx \
|
||||
sg_path.hxx \
|
||||
sgstream.hxx \
|
||||
stopwatch.hxx \
|
||||
@@ -20,6 +16,7 @@ include_HEADERS = \
|
||||
|
||||
libsgmisc_a_SOURCES = \
|
||||
commands.cxx \
|
||||
exception.cxx \
|
||||
props.cxx \
|
||||
props_io.cxx \
|
||||
sg_path.cxx \
|
||||
@@ -33,4 +30,4 @@ noinst_PROGRAMS = props_test
|
||||
props_test_SOURCES = props_test.cxx
|
||||
props_test_LDADD = libsgmisc.a ../xml/libsgxml.a ../debug/libsgdebug.a
|
||||
|
||||
INCLUDES += -I$(top_srcdir) $(ZLIB_INCL)
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// $Id$
|
||||
|
||||
#include "commands.hxx"
|
||||
#include "props_io.hxx"
|
||||
|
||||
|
||||
|
||||
@@ -59,74 +60,4 @@ SGCommandMgr::execute (const string &name, const SGPropertyNode * arg) const
|
||||
return (*command)(arg);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SGCommandMgr::execute (const string &name) const
|
||||
{
|
||||
// FIXME
|
||||
SGPropertyNode node;
|
||||
return execute(name, &node);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SGCommandMgr::execute (const string &name, bool value) const
|
||||
{
|
||||
// FIXME
|
||||
SGPropertyNode node;
|
||||
node.setBoolValue(value);
|
||||
return execute(name, &node);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SGCommandMgr::execute (const string &name, int value) const
|
||||
{
|
||||
// FIXME
|
||||
SGPropertyNode node;
|
||||
node.setIntValue(value);
|
||||
return execute(name, &node);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SGCommandMgr::execute (const string &name, long value) const
|
||||
{
|
||||
// FIXME
|
||||
SGPropertyNode node;
|
||||
node.setLongValue(value);
|
||||
return execute(name, &node);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SGCommandMgr::execute (const string &name, float value) const
|
||||
{
|
||||
// FIXME
|
||||
SGPropertyNode node;
|
||||
node.setFloatValue(value);
|
||||
return execute(name, &node);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SGCommandMgr::execute (const string &name, double value) const
|
||||
{
|
||||
// FIXME
|
||||
SGPropertyNode node;
|
||||
node.setDoubleValue(value);
|
||||
return execute(name, &node);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SGCommandMgr::execute (const string &name, string value) const
|
||||
{
|
||||
// FIXME
|
||||
SGPropertyNode node;
|
||||
node.setStringValue(value);
|
||||
return execute(name, &node);
|
||||
}
|
||||
|
||||
|
||||
// end of commands.cxx
|
||||
|
||||
@@ -28,14 +28,9 @@ SG_USING_STD(vector);
|
||||
* Manage commands.
|
||||
*
|
||||
* <p>This class allows the application to register and unregister
|
||||
* commands, and provides shortcuts for executing them. Commands
|
||||
* are simple functions that take a const pointer to an SGPropertyNode
|
||||
* as an argument and return a bool value indicating success or failure.
|
||||
* The property node may be ignored, or it may contain values that
|
||||
* the command uses as parameters.</p>
|
||||
*
|
||||
* <p>There are convenience methods for invoking a command function
|
||||
* with no arguments or with a single, primitive argument.</p>
|
||||
* commands, and provides shortcuts for executing them. Commands are
|
||||
* simple functions that take a const pointer to an SGPropertyNode:
|
||||
* the function may use the nodes children as parameters.</p>
|
||||
*
|
||||
* @author David Megginson, david@megginson.com
|
||||
*/
|
||||
@@ -95,9 +90,6 @@ public:
|
||||
/**
|
||||
* Execute a command.
|
||||
*
|
||||
* This is the primary method for invoking a command; the others
|
||||
* are convenience methods that invoke this one indirectly.
|
||||
*
|
||||
* @param name The name of the command.
|
||||
* @param arg A const pointer to an SGPropertyNode. The node
|
||||
* may have a value and/or children, etc., so that it is possible
|
||||
@@ -107,104 +99,6 @@ public:
|
||||
*/
|
||||
virtual bool execute (const string &name, const SGPropertyNode * arg) const;
|
||||
|
||||
|
||||
/**
|
||||
* Execute a command with no argument.
|
||||
*
|
||||
* The command function will receive a pointer to a property node
|
||||
* with no value and no children.
|
||||
*
|
||||
* @param name The name of the command.
|
||||
* @return true if the command is present and executes successfully,
|
||||
* false otherwise.
|
||||
*/
|
||||
virtual bool execute (const string &name) const;
|
||||
|
||||
|
||||
/**
|
||||
* Execute a command with a single bool argument.
|
||||
*
|
||||
* The command function will receive a pointer to a property node
|
||||
* with a bool value and no children.
|
||||
*
|
||||
* @param name The name of the command.
|
||||
* @param arg The bool argument to the command.
|
||||
* @return true if the command is present and executes successfully,
|
||||
* false otherwise.
|
||||
*/
|
||||
virtual bool execute (const string &name, bool arg) const;
|
||||
|
||||
|
||||
/**
|
||||
* Execute a command with a single int argument.
|
||||
*
|
||||
* The command function will receive a pointer to a property node
|
||||
* with a int value and no children.
|
||||
*
|
||||
* @param name The name of the command.
|
||||
* @param arg The int argument to the command.
|
||||
* @return true if the command is present and executes successfully,
|
||||
* false otherwise.
|
||||
*/
|
||||
virtual bool execute (const string &name, int arg) const;
|
||||
|
||||
|
||||
/**
|
||||
* Execute a command with a single long argument.
|
||||
*
|
||||
* The command function will receive a pointer to a property node
|
||||
* with a long value and no children.
|
||||
*
|
||||
* @param name The name of the command.
|
||||
* @param arg The long argument to the command.
|
||||
* @return true if the command is present and executes successfully,
|
||||
* false otherwise.
|
||||
*/
|
||||
virtual bool execute (const string &name, long arg) const;
|
||||
|
||||
|
||||
/**
|
||||
* Execute a command with a single float argument.
|
||||
*
|
||||
* The command function will receive a pointer to a property node
|
||||
* with a float value and no children.
|
||||
*
|
||||
* @param name The name of the command.
|
||||
* @param arg The float argument to the command.
|
||||
* @return true if the command is present and executes successfully,
|
||||
* false otherwise.
|
||||
*/
|
||||
virtual bool execute (const string &name, float arg) const;
|
||||
|
||||
|
||||
/**
|
||||
* Execute a command with a single double argument.
|
||||
*
|
||||
* The command function will receive a pointer to a property node
|
||||
* with a double value and no children.
|
||||
*
|
||||
* @param name The name of the command.
|
||||
* @param arg The double argument to the command.
|
||||
* @return true if the command is present and executes successfully,
|
||||
* false otherwise.
|
||||
*/
|
||||
virtual bool execute (const string &name, double arg) const;
|
||||
|
||||
|
||||
/**
|
||||
* Execute a command with a single string argument.
|
||||
*
|
||||
* The command function will receive a pointer to a property node
|
||||
* with a string value and no children.
|
||||
*
|
||||
* @param name The name of the command.
|
||||
* @param arg The string argument to the command.
|
||||
* @return true if the command is present and executes successfully,
|
||||
* false otherwise.
|
||||
*/
|
||||
virtual bool execute (const string &name, string arg) const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
typedef map<string,command_t> command_map;
|
||||
|
||||
307
simgear/misc/exception.cxx
Normal file
307
simgear/misc/exception.cxx
Normal file
@@ -0,0 +1,307 @@
|
||||
// exception.cxx - implementation of SimGear base exceptions.
|
||||
// Started Summer 2001 by David Megginson, david@megginson.com
|
||||
// This code is released into the Public Domain.
|
||||
//
|
||||
// $Id$
|
||||
|
||||
|
||||
#include "exception.hxx"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of sg_location class.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sg_location::sg_location ()
|
||||
: _path(""),
|
||||
_line(-1),
|
||||
_column(-1),
|
||||
_byte(-1)
|
||||
{
|
||||
}
|
||||
|
||||
sg_location::sg_location (const string &path, int line, int column)
|
||||
: _path(path),
|
||||
_line(line),
|
||||
_column(column),
|
||||
_byte(-1)
|
||||
{
|
||||
}
|
||||
|
||||
sg_location::~sg_location ()
|
||||
{
|
||||
}
|
||||
|
||||
const string &
|
||||
sg_location::getPath () const
|
||||
{
|
||||
return _path;
|
||||
}
|
||||
|
||||
void
|
||||
sg_location::setPath (const string &path)
|
||||
{
|
||||
_path = path;
|
||||
}
|
||||
|
||||
int
|
||||
sg_location::getLine () const
|
||||
{
|
||||
return _line;
|
||||
}
|
||||
|
||||
void
|
||||
sg_location::setLine (int line)
|
||||
{
|
||||
_line = line;
|
||||
}
|
||||
|
||||
int
|
||||
sg_location::getColumn () const
|
||||
{
|
||||
return _column;
|
||||
}
|
||||
|
||||
void
|
||||
sg_location::setColumn (int column)
|
||||
{
|
||||
_column = column;
|
||||
}
|
||||
|
||||
int
|
||||
sg_location::getByte () const
|
||||
{
|
||||
return _byte;
|
||||
}
|
||||
|
||||
void
|
||||
sg_location::setByte (int byte)
|
||||
{
|
||||
_byte = byte;
|
||||
}
|
||||
|
||||
string
|
||||
sg_location::asString () const
|
||||
{
|
||||
char buf[128];
|
||||
string out = "";
|
||||
if (_path != (string)"") {
|
||||
out += _path;
|
||||
if (_line != -1 || _column != -1)
|
||||
out += ",\n";
|
||||
}
|
||||
if (_line != -1) {
|
||||
sprintf(buf, "line %d", _line);
|
||||
out += buf;
|
||||
if (_column != -1)
|
||||
out += ", ";
|
||||
}
|
||||
if (_column != -1) {
|
||||
sprintf(buf, "column %d", _column);
|
||||
out += buf;
|
||||
}
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of sg_throwable class.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sg_throwable::sg_throwable ()
|
||||
: _message(""),
|
||||
_origin("")
|
||||
{
|
||||
}
|
||||
|
||||
sg_throwable::sg_throwable (const string &message, const string &origin)
|
||||
: _message(message),
|
||||
_origin(origin)
|
||||
{
|
||||
}
|
||||
|
||||
sg_throwable::~sg_throwable ()
|
||||
{
|
||||
}
|
||||
|
||||
const string &
|
||||
sg_throwable::getMessage () const
|
||||
{
|
||||
return _message;
|
||||
}
|
||||
|
||||
const string
|
||||
sg_throwable::getFormattedMessage () const
|
||||
{
|
||||
return getMessage();
|
||||
}
|
||||
|
||||
void
|
||||
sg_throwable::setMessage (const string &message)
|
||||
{
|
||||
_message = message;
|
||||
}
|
||||
|
||||
const string &
|
||||
sg_throwable::getOrigin () const
|
||||
{
|
||||
return _origin;
|
||||
}
|
||||
|
||||
void
|
||||
sg_throwable::setOrigin (const string &origin)
|
||||
{
|
||||
_origin = origin;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of sg_error class.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sg_error::sg_error ()
|
||||
: sg_throwable ()
|
||||
{
|
||||
}
|
||||
|
||||
sg_error::sg_error (const string &message, const string &origin)
|
||||
: sg_throwable(message, origin)
|
||||
{
|
||||
}
|
||||
|
||||
sg_error::~sg_error ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of sg_exception class.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sg_exception::sg_exception ()
|
||||
: sg_throwable ()
|
||||
{
|
||||
}
|
||||
|
||||
sg_exception::sg_exception (const string &message, const string &origin)
|
||||
: sg_throwable(message, origin)
|
||||
{
|
||||
}
|
||||
|
||||
sg_exception::~sg_exception ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of sg_io_exception.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sg_io_exception::sg_io_exception ()
|
||||
: sg_exception()
|
||||
{
|
||||
}
|
||||
|
||||
sg_io_exception::sg_io_exception (const string &message, const string &origin)
|
||||
: sg_exception(message, origin)
|
||||
{
|
||||
}
|
||||
|
||||
sg_io_exception::sg_io_exception (const string &message,
|
||||
const sg_location &location,
|
||||
const string &origin)
|
||||
: sg_exception(message, origin),
|
||||
_location(location)
|
||||
{
|
||||
}
|
||||
|
||||
sg_io_exception::~sg_io_exception ()
|
||||
{
|
||||
}
|
||||
|
||||
const string
|
||||
sg_io_exception::getFormattedMessage () const
|
||||
{
|
||||
string ret = getMessage();
|
||||
ret += "\n at ";
|
||||
ret += getLocation().asString();
|
||||
return ret;
|
||||
}
|
||||
|
||||
const sg_location &
|
||||
sg_io_exception::getLocation () const
|
||||
{
|
||||
return _location;
|
||||
}
|
||||
|
||||
void
|
||||
sg_io_exception::setLocation (const sg_location &location)
|
||||
{
|
||||
_location = location;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of sg_format_exception.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sg_format_exception::sg_format_exception ()
|
||||
: sg_exception(),
|
||||
_text("")
|
||||
{
|
||||
}
|
||||
|
||||
sg_format_exception::sg_format_exception (const string &message,
|
||||
const string &text,
|
||||
const string &origin)
|
||||
: sg_exception(message, origin),
|
||||
_text(text)
|
||||
{
|
||||
}
|
||||
|
||||
sg_format_exception::~sg_format_exception ()
|
||||
{
|
||||
}
|
||||
|
||||
const string &
|
||||
sg_format_exception::getText () const
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
void
|
||||
sg_format_exception::setText (const string &text)
|
||||
{
|
||||
_text = text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implementation of sg_range_exception.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sg_range_exception::sg_range_exception ()
|
||||
: sg_exception()
|
||||
{
|
||||
}
|
||||
|
||||
sg_range_exception::sg_range_exception (const string &message,
|
||||
const string &origin)
|
||||
: sg_exception(message, origin)
|
||||
{
|
||||
}
|
||||
|
||||
sg_range_exception::~sg_range_exception ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// end of exception.cxx
|
||||
182
simgear/misc/exception.hxx
Normal file
182
simgear/misc/exception.hxx
Normal file
@@ -0,0 +1,182 @@
|
||||
/**
|
||||
* \file exception.hxx
|
||||
* Interface definition for SimGear base exceptions.
|
||||
* Started Spring 2001 by David Megginson, david@megginson.com
|
||||
* This code is released into the Public Domain.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __SIMGEAR_MISC_EXCEPTION_HXX
|
||||
#define __SIMGEAR_MISC_EXCEPTION_HXX 1
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include STL_STRING
|
||||
|
||||
SG_USING_STD(string);
|
||||
|
||||
|
||||
/**
|
||||
* Information encapsulating a single location in an external resource
|
||||
*
|
||||
* A position in the resource my optionally be provided, either by
|
||||
* line number, line number and column number, or byte offset from the
|
||||
* beginning of the resource.
|
||||
*/
|
||||
class sg_location
|
||||
{
|
||||
public:
|
||||
sg_location ();
|
||||
sg_location (const string &path, int line = -1, int column = -1);
|
||||
virtual ~sg_location ();
|
||||
virtual const string &getPath () const;
|
||||
virtual void setPath (const string &path);
|
||||
virtual int getLine () const;
|
||||
virtual void setLine (int line);
|
||||
virtual int getColumn () const;
|
||||
virtual void setColumn (int column);
|
||||
virtual int getByte () const;
|
||||
virtual void setByte (int byte);
|
||||
virtual string asString () const;
|
||||
private:
|
||||
string _path;
|
||||
int _line;
|
||||
int _column;
|
||||
int _byte;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Abstract base class for all throwables.
|
||||
*/
|
||||
class sg_throwable
|
||||
{
|
||||
public:
|
||||
sg_throwable ();
|
||||
sg_throwable (const string &message, const string &origin = "");
|
||||
virtual ~sg_throwable ();
|
||||
virtual const string &getMessage () const;
|
||||
virtual const string getFormattedMessage () const;
|
||||
virtual void setMessage (const string &message);
|
||||
virtual const string &getOrigin () const;
|
||||
virtual void setOrigin (const string &origin);
|
||||
private:
|
||||
string _message;
|
||||
string _origin;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* An unexpected fatal error.
|
||||
*
|
||||
* Methods and functions show throw this exception when something
|
||||
* very bad has happened (such as memory corruption or
|
||||
* a totally unexpected internal value). Applications should catch
|
||||
* this exception only at the top level if at all, and should
|
||||
* normally terminate execution soon afterwards.
|
||||
*/
|
||||
class sg_error : public sg_throwable
|
||||
{
|
||||
public:
|
||||
sg_error ();
|
||||
sg_error (const string &message, const string &origin = "");
|
||||
virtual ~sg_error ();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Base class for all SimGear exceptions.
|
||||
*
|
||||
* SimGear-based code should throw this exception only when no
|
||||
* more specific exception applies. It may not be caught until
|
||||
* higher up in the application, where it is not possible to
|
||||
* resume normal operations if desired.
|
||||
*
|
||||
* A caller can catch sg_exception by default to ensure that
|
||||
* all exceptions are caught. Every SimGear exception can contain
|
||||
* a human-readable error message and a human-readable string
|
||||
* indicating the part of the application causing the exception
|
||||
* (as an aid to debugging, only).
|
||||
*/
|
||||
class sg_exception : public sg_throwable
|
||||
{
|
||||
public:
|
||||
sg_exception ();
|
||||
sg_exception (const string &message, const string &origin = "");
|
||||
virtual ~sg_exception ();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* An I/O-related SimGear exception.
|
||||
*
|
||||
* SimGear-based code should throw this exception when it fails
|
||||
* to read from or write to an external resource, such as a file,
|
||||
* socket, URL, or database.
|
||||
*
|
||||
* In addition to the functionality of sg_exception, an
|
||||
* sg_io_exception may contain location information, such as the name
|
||||
* of a file or URL, and possible also a location in that file or URL.
|
||||
*/
|
||||
class sg_io_exception : public sg_exception
|
||||
{
|
||||
public:
|
||||
sg_io_exception ();
|
||||
sg_io_exception (const string &message, const string &origin = "");
|
||||
sg_io_exception (const string &message, const sg_location &location,
|
||||
const string &origin = "");
|
||||
virtual ~sg_io_exception ();
|
||||
virtual const string getFormattedMessage () const;
|
||||
virtual const sg_location &getLocation () const;
|
||||
virtual void setLocation (const sg_location &location);
|
||||
private:
|
||||
sg_location _location;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A format-related SimGear exception.
|
||||
*
|
||||
* SimGear-based code should throw this exception when a string
|
||||
* does not appear in the expected format (for example, a date
|
||||
* string does not conform to ISO 8601).
|
||||
*
|
||||
* In addition to the functionality of sg_exception, an
|
||||
* sg_format_exception can contain a copy of the original malformated
|
||||
* text.
|
||||
*/
|
||||
class sg_format_exception : public sg_exception
|
||||
{
|
||||
public:
|
||||
sg_format_exception ();
|
||||
sg_format_exception (const string &message, const string &text,
|
||||
const string &origin = "");
|
||||
virtual ~sg_format_exception ();
|
||||
virtual const string &getText () const;
|
||||
virtual void setText (const string &text);
|
||||
private:
|
||||
string _text;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A range-related SimGear exception.
|
||||
*
|
||||
* SimGear-based code should throw this exception when a value falls
|
||||
* outside the range where it can reasonably be handled; examples
|
||||
* include longitude outside the range -180:180, unrealistically high
|
||||
* forces or velocities, an illegal airport code, etc. A range
|
||||
* exception usually means that something has gone wrong internally.
|
||||
*/
|
||||
class sg_range_exception : public sg_exception
|
||||
{
|
||||
public:
|
||||
sg_range_exception ();
|
||||
sg_range_exception (const string &message, const string &origin = "");
|
||||
virtual ~sg_range_exception ();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// end of exception.hxx
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "sg_path.hxx"
|
||||
#include "props.hxx"
|
||||
#include "props_io.hxx"
|
||||
|
||||
#include STL_IOSTREAM
|
||||
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
|
||||
@@ -30,6 +31,8 @@ SG_USING_STD(string);
|
||||
SG_USING_STD(vector);
|
||||
SG_USING_STD(map);
|
||||
|
||||
#define DEFAULT_MODE (SGPropertyNode::READ|SGPropertyNode::WRITE)
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -41,7 +44,9 @@ class PropsVisitor : public XMLVisitor
|
||||
public:
|
||||
|
||||
PropsVisitor (SGPropertyNode * root, const string &base)
|
||||
: _ok(true), _root(root), _level(0), _base(base) {}
|
||||
: _root(root), _level(0), _base(base), _hasException(false) {}
|
||||
|
||||
virtual ~PropsVisitor () {}
|
||||
|
||||
void startXML ();
|
||||
void endXML ();
|
||||
@@ -49,29 +54,34 @@ public:
|
||||
void endElement (const char * name);
|
||||
void data (const char * s, int length);
|
||||
void warning (const char * message, int line, int column);
|
||||
void error (const char * message, int line, int column);
|
||||
|
||||
bool isOK () const { return _ok; }
|
||||
bool hasException () const { return _hasException; }
|
||||
sg_io_exception &getException () { return _exception; }
|
||||
void setException (const sg_io_exception &exception) {
|
||||
_exception = exception;
|
||||
_hasException = true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct State
|
||||
{
|
||||
State () : node(0), type("") {}
|
||||
State (SGPropertyNode * _node, const char * _type)
|
||||
: node(_node), type(_type) {}
|
||||
State () : node(0), type(""), mode(DEFAULT_MODE) {}
|
||||
State (SGPropertyNode * _node, const char * _type, int _mode)
|
||||
: node(_node), type(_type), mode(_mode) {}
|
||||
SGPropertyNode * node;
|
||||
string type;
|
||||
int mode;
|
||||
map<string,int> counters;
|
||||
};
|
||||
|
||||
State &state () { return _state_stack[_state_stack.size() - 1]; }
|
||||
|
||||
void push_state (SGPropertyNode * node, const char * type) {
|
||||
void push_state (SGPropertyNode * node, const char * type, int mode) {
|
||||
if (type == 0)
|
||||
_state_stack.push_back(State(node, "unknown"));
|
||||
_state_stack.push_back(State(node, "unspecified", mode));
|
||||
else
|
||||
_state_stack.push_back(State(node, type));
|
||||
_state_stack.push_back(State(node, type, mode));
|
||||
_level++;
|
||||
_data = "";
|
||||
}
|
||||
@@ -81,12 +91,13 @@ private:
|
||||
_level--;
|
||||
}
|
||||
|
||||
bool _ok;
|
||||
string _data;
|
||||
SGPropertyNode * _root;
|
||||
int _level;
|
||||
vector<State> _state_stack;
|
||||
string _base;
|
||||
sg_io_exception _exception;
|
||||
bool _hasException;
|
||||
};
|
||||
|
||||
void
|
||||
@@ -103,55 +114,113 @@ PropsVisitor::endXML ()
|
||||
_state_stack.resize(0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check a yes/no flag, with default.
|
||||
*/
|
||||
static bool
|
||||
checkFlag (const char * flag, bool defaultState = true)
|
||||
{
|
||||
if (flag == 0)
|
||||
return defaultState;
|
||||
else if (string(flag) == "y")
|
||||
return true;
|
||||
else if (string(flag) == "n")
|
||||
return false;
|
||||
else {
|
||||
string message = "Unrecognized flag value '";
|
||||
message += flag;
|
||||
message += '\'';
|
||||
// FIXME: add location info
|
||||
throw sg_io_exception(message, "SimGear Property Reader");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PropsVisitor::startElement (const char * name, const XMLAttributes &atts)
|
||||
{
|
||||
State &st = state();
|
||||
const char * attval;
|
||||
|
||||
if (_level == 0) {
|
||||
if (string(name) != (string)"PropertyList") {
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Root element name is " <<
|
||||
name << "; expected PropertyList");
|
||||
_ok = false;
|
||||
string message = "Root element name is ";
|
||||
message += name;
|
||||
message += "; expected PropertyList";
|
||||
throw sg_io_exception(message, "SimGear Property Reader");
|
||||
}
|
||||
push_state(_root, "");
|
||||
|
||||
// Check for an include.
|
||||
attval = atts.getValue("include");
|
||||
if (attval != 0) {
|
||||
SGPath path(SGPath(_base).dir());
|
||||
path.append(attval);
|
||||
try {
|
||||
readProperties(path.str(), _root);
|
||||
} catch (sg_io_exception &e) {
|
||||
setException(e);
|
||||
}
|
||||
}
|
||||
|
||||
push_state(_root, "", DEFAULT_MODE);
|
||||
}
|
||||
|
||||
else {
|
||||
// Get the index.
|
||||
const char * att_n = atts.getValue("n");
|
||||
attval = atts.getValue("n");
|
||||
int index = 0;
|
||||
if (att_n != 0) {
|
||||
index = atoi(att_n);
|
||||
if (attval != 0) {
|
||||
index = atoi(attval);
|
||||
st.counters[name] = SG_MAX2(st.counters[name], index+1);
|
||||
} else {
|
||||
index = st.counters[name];
|
||||
st.counters[name]++;
|
||||
}
|
||||
|
||||
// Check for an alias.
|
||||
// Got the index, so grab the node.
|
||||
SGPropertyNode * node = st.node->getChild(name, index, true);
|
||||
const char * att_alias = atts.getValue("alias");
|
||||
if (att_alias != 0) {
|
||||
if (!node->alias(att_alias))
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Failed to set alias to " << att_alias);
|
||||
|
||||
// Get the access-mode attributes,
|
||||
// but don't set yet (in case they
|
||||
// prevent us from recording the value).
|
||||
int mode = 0;
|
||||
|
||||
attval = atts.getValue("read");
|
||||
if (checkFlag(attval, true))
|
||||
mode |= SGPropertyNode::READ;
|
||||
attval = atts.getValue("write");
|
||||
if (checkFlag(attval, true))
|
||||
mode |= SGPropertyNode::WRITE;
|
||||
attval = atts.getValue("archive");
|
||||
if (checkFlag(attval, false))
|
||||
mode |= SGPropertyNode::ARCHIVE;
|
||||
attval = atts.getValue("trace-read");
|
||||
if (checkFlag(attval, false))
|
||||
mode |= SGPropertyNode::TRACE_READ;
|
||||
attval = atts.getValue("trace-write");
|
||||
if (checkFlag(attval, false))
|
||||
mode |= SGPropertyNode::TRACE_WRITE;
|
||||
|
||||
// Check for an alias.
|
||||
attval = atts.getValue("alias");
|
||||
if (attval != 0) {
|
||||
if (!node->alias(attval))
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Failed to set alias to " << attval);
|
||||
}
|
||||
|
||||
// Check for an include.
|
||||
const char * att_include = atts.getValue("include");
|
||||
if (att_include != 0) {
|
||||
attval = atts.getValue("include");
|
||||
if (attval != 0) {
|
||||
SGPath path(SGPath(_base).dir());
|
||||
cerr << "Base is " << _base << endl;
|
||||
cerr << "Dir is " << SGPath(_base).dir() << endl;
|
||||
path.append(att_include);
|
||||
if (!readProperties(path.str(), node)) {
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Failed to read include file "
|
||||
<< att_include);
|
||||
_ok = false;
|
||||
path.append(attval);
|
||||
try {
|
||||
readProperties(path.str(), node);
|
||||
} catch (sg_io_exception &e) {
|
||||
setException(e);
|
||||
}
|
||||
}
|
||||
|
||||
push_state(node, atts.getValue("type"));
|
||||
push_state(node, atts.getValue("type"), mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,13 +247,15 @@ PropsVisitor::endElement (const char * name)
|
||||
} else if (st.type == "double") {
|
||||
ret = st.node->setDoubleValue(strtod(_data.c_str(), 0));
|
||||
} else if (st.type == "string") {
|
||||
ret = st.node->setStringValue(_data);
|
||||
} else if (st.type == "unknown") {
|
||||
ret = st.node->setUnknownValue(_data);
|
||||
ret = st.node->setStringValue(_data.c_str());
|
||||
} else if (st.type == "unspecified") {
|
||||
ret = st.node->setUnspecifiedValue(_data.c_str());
|
||||
} else {
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Unknown data type " << st.type
|
||||
<< " assuming 'unknown'");
|
||||
ret = st.node->setUnknownValue(_data);
|
||||
string message = "Unrecognized data type '";
|
||||
message += st.type;
|
||||
message += '\'';
|
||||
// FIXME: add location information
|
||||
throw sg_io_exception(message, "SimGear Property Reader");
|
||||
}
|
||||
if (!ret)
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "readProperties: Failed to set "
|
||||
@@ -192,6 +263,11 @@ PropsVisitor::endElement (const char * name)
|
||||
<< _data << "\" with type " << st.type);
|
||||
}
|
||||
|
||||
// Set the access-mode attributes now,
|
||||
// once the value has already been
|
||||
// assigned.
|
||||
st.node->setAttributes(st.mode);
|
||||
|
||||
pop_state();
|
||||
}
|
||||
|
||||
@@ -209,14 +285,6 @@ PropsVisitor::warning (const char * message, int line, int column)
|
||||
<< message << " at line " << line << ", column " << column);
|
||||
}
|
||||
|
||||
void
|
||||
PropsVisitor::error (const char * message, int line, int column)
|
||||
{
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "readProperties: FATAL: " <<
|
||||
message << " at line " << line << ", column " << column);
|
||||
_ok = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -232,12 +300,14 @@ PropsVisitor::error (const char * message, int line, int column)
|
||||
* @param base A base path for resolving external include references.
|
||||
* @return true if the read succeeded, false otherwise.
|
||||
*/
|
||||
bool
|
||||
void
|
||||
readProperties (istream &input, SGPropertyNode * start_node,
|
||||
const string &base)
|
||||
{
|
||||
PropsVisitor visitor(start_node, base);
|
||||
return readXML(input, visitor) && visitor.isOK();
|
||||
readXML(input, visitor, base);
|
||||
if (visitor.hasException())
|
||||
throw visitor.getException();
|
||||
}
|
||||
|
||||
|
||||
@@ -248,18 +318,13 @@ readProperties (istream &input, SGPropertyNode * start_node,
|
||||
* @param start_node The root node for reading properties.
|
||||
* @return true if the read succeeded, false otherwise.
|
||||
*/
|
||||
bool
|
||||
void
|
||||
readProperties (const string &file, SGPropertyNode * start_node)
|
||||
{
|
||||
cerr << "Reading properties from " << file << endl;
|
||||
ifstream input(file.c_str());
|
||||
if (input.good()) {
|
||||
return readProperties(input, start_node, file);
|
||||
} else {
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Error reading property list from file "
|
||||
<< file);
|
||||
return false;
|
||||
}
|
||||
PropsVisitor visitor(start_node, file);
|
||||
readXML(file, visitor);
|
||||
if (visitor.hasException())
|
||||
throw visitor.getException();
|
||||
}
|
||||
|
||||
|
||||
@@ -277,24 +342,27 @@ static const char *
|
||||
getTypeName (SGPropertyNode::Type type)
|
||||
{
|
||||
switch (type) {
|
||||
case SGValue::UNKNOWN:
|
||||
return "unknown";
|
||||
case SGValue::BOOL:
|
||||
case SGPropertyNode::UNSPECIFIED:
|
||||
return "unspecified";
|
||||
case SGPropertyNode::BOOL:
|
||||
return "bool";
|
||||
case SGValue::INT:
|
||||
case SGPropertyNode::INT:
|
||||
return "int";
|
||||
case SGValue::LONG:
|
||||
case SGPropertyNode::LONG:
|
||||
return "long";
|
||||
case SGValue::FLOAT:
|
||||
case SGPropertyNode::FLOAT:
|
||||
return "float";
|
||||
case SGValue::DOUBLE:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
return "double";
|
||||
case SGValue::STRING:
|
||||
case SGPropertyNode::STRING:
|
||||
return "string";
|
||||
case SGPropertyNode::ALIAS:
|
||||
case SGPropertyNode::NONE:
|
||||
return "unspecified";
|
||||
}
|
||||
|
||||
// keep the compiler from squawking
|
||||
return "unknown";
|
||||
return "unspecified";
|
||||
}
|
||||
|
||||
|
||||
@@ -331,22 +399,71 @@ doIndent (ostream &output, int indent)
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
writeNode (ostream &output, const SGPropertyNode * node, int indent)
|
||||
static void
|
||||
writeAtts (ostream &output, const SGPropertyNode * node)
|
||||
{
|
||||
const string &name = node->getName();
|
||||
int index = node->getIndex();
|
||||
|
||||
if (index != 0)
|
||||
output << " n=\"" << index << '"';
|
||||
|
||||
#if 0
|
||||
if (!node->getAttribute(SGPropertyNode::READ))
|
||||
output << " read=\"n\"";
|
||||
|
||||
if (!node->getAttribute(SGPropertyNode::WRITE))
|
||||
output << " write=\"n\"";
|
||||
|
||||
if (node->getAttribute(SGPropertyNode::ARCHIVE))
|
||||
output << " archive=\"y\"";
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test whether a node is archivable or has archivable descendants.
|
||||
*/
|
||||
static bool
|
||||
isArchivable (const SGPropertyNode * node)
|
||||
{
|
||||
// FIXME: it's inefficient to do this all the time
|
||||
if (node->getAttribute(SGPropertyNode::ARCHIVE))
|
||||
return true;
|
||||
else {
|
||||
int nChildren = node->nChildren();
|
||||
for (int i = 0; i < nChildren; i++)
|
||||
if (isArchivable(node->getChild(i)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
writeNode (ostream &output, const SGPropertyNode * node,
|
||||
bool write_all, int indent)
|
||||
{
|
||||
// Don't write the node or any of
|
||||
// its descendants unless it is
|
||||
// allowed to be archived.
|
||||
if (!write_all && !isArchivable(node))
|
||||
return true; // Everything's OK, but we won't write.
|
||||
|
||||
const string name = node->getName();
|
||||
int nChildren = node->nChildren();
|
||||
|
||||
// If there is a literal value,
|
||||
// write it first.
|
||||
if (node->hasValue()) {
|
||||
if (node->hasValue() && (write_all || node->getAttribute(SGPropertyNode::ARCHIVE))) {
|
||||
doIndent(output, indent);
|
||||
output << '<' << name << " n=\"" << index << '"';
|
||||
if (node->isAlias() && node->getAliasTarget() != 0)
|
||||
output << " alias=\"" << node->getAliasTarget()->getPath() << "\"/>";
|
||||
else {
|
||||
if (node->getType() != SGPropertyNode::UNKNOWN)
|
||||
output << '<' << name;
|
||||
writeAtts(output, node);
|
||||
if (node->isAlias() && node->getAliasTarget() != 0) {
|
||||
output << " alias=\"" << node->getAliasTarget()->getPath()
|
||||
<< "\"/>" << endl;
|
||||
} else {
|
||||
if (node->getType() != SGPropertyNode::UNSPECIFIED)
|
||||
output << " type=\"" << getTypeName(node->getType()) << '"';
|
||||
output << '>';
|
||||
writeData(output, node->getStringValue());
|
||||
@@ -354,41 +471,25 @@ writeNode (ostream &output, const SGPropertyNode * node, int indent)
|
||||
}
|
||||
}
|
||||
|
||||
// If there are children, write them
|
||||
// next.
|
||||
// If there are children, write them next.
|
||||
if (nChildren > 0 || node->isAlias()) {
|
||||
doIndent(output, indent);
|
||||
output << '<' << name << " n=\"" << index << '"';
|
||||
if (node->isAlias() && node->getAliasTarget() != 0)
|
||||
output << " alias=\"" << node->getAliasTarget()->getPath() << '"';
|
||||
output << '<' << name;
|
||||
writeAtts(output, node);
|
||||
output << '>' << endl;
|
||||
for (int i = 0; i < nChildren; i++)
|
||||
writeNode(output, node->getChild(i), indent + INDENT_STEP);
|
||||
writeNode(output, node->getChild(i), write_all, indent + INDENT_STEP);
|
||||
doIndent(output, indent);
|
||||
output << "</" << name << '>' << endl;
|
||||
}
|
||||
|
||||
// If there were no children and no
|
||||
// value, at least note the presence
|
||||
// of the node.
|
||||
// if (nChildren == 0 && !node->isAlias() && !node->hasValue()) {
|
||||
// doIndent(output, indent);
|
||||
// output << '<' << name << " n=\"" << index << "\"/>" << endl;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write a property tree to an output stream in XML format.
|
||||
*
|
||||
* @param output The output stream.
|
||||
* @param start_node The root node to write.
|
||||
* @return true if the write succeeded, false otherwise.
|
||||
*/
|
||||
bool
|
||||
writeProperties (ostream &output, const SGPropertyNode * start_node)
|
||||
void
|
||||
writeProperties (ostream &output, const SGPropertyNode * start_node,
|
||||
bool write_all)
|
||||
{
|
||||
int nChildren = start_node->nChildren();
|
||||
|
||||
@@ -396,32 +497,22 @@ writeProperties (ostream &output, const SGPropertyNode * start_node)
|
||||
output << "<PropertyList>" << endl;
|
||||
|
||||
for (int i = 0; i < nChildren; i++) {
|
||||
writeNode(output, start_node->getChild(i), INDENT_STEP);
|
||||
writeNode(output, start_node->getChild(i), write_all, INDENT_STEP);
|
||||
}
|
||||
|
||||
output << "</PropertyList>" << endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write a property tree to a file in XML format.
|
||||
*
|
||||
* @param file The destination file.
|
||||
* @param start_node The root node to write.
|
||||
* @return true if the write succeeded, false otherwise.
|
||||
*/
|
||||
bool
|
||||
writeProperties (const string &file, const SGPropertyNode * start_node)
|
||||
void
|
||||
writeProperties (const string &file, const SGPropertyNode * start_node,
|
||||
bool write_all)
|
||||
{
|
||||
ofstream output(file.c_str());
|
||||
if (output.good()) {
|
||||
return writeProperties(output, start_node);
|
||||
writeProperties(output, start_node, write_all);
|
||||
} else {
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "Cannot write properties to file "
|
||||
<< file);
|
||||
return false;
|
||||
throw sg_io_exception("Cannot open file", sg_location(file));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,36 +540,38 @@ copyProperties (const SGPropertyNode *in, SGPropertyNode *out)
|
||||
// if any.
|
||||
if (in->hasValue()) {
|
||||
switch (in->getType()) {
|
||||
case SGValue::BOOL:
|
||||
case SGPropertyNode::BOOL:
|
||||
if (!out->setBoolValue(in->getBoolValue()))
|
||||
retval = false;
|
||||
break;
|
||||
case SGValue::INT:
|
||||
case SGPropertyNode::INT:
|
||||
if (!out->setIntValue(in->getIntValue()))
|
||||
retval = false;
|
||||
break;
|
||||
case SGValue::LONG:
|
||||
case SGPropertyNode::LONG:
|
||||
if (!out->setLongValue(in->getLongValue()))
|
||||
retval = false;
|
||||
break;
|
||||
case SGValue::FLOAT:
|
||||
case SGPropertyNode::FLOAT:
|
||||
if (!out->setFloatValue(in->getFloatValue()))
|
||||
retval = false;
|
||||
break;
|
||||
case SGValue::DOUBLE:
|
||||
case SGPropertyNode::DOUBLE:
|
||||
if (!out->setDoubleValue(in->getDoubleValue()))
|
||||
retval = false;
|
||||
break;
|
||||
case SGValue::STRING:
|
||||
case SGPropertyNode::STRING:
|
||||
if (!out->setStringValue(in->getStringValue()))
|
||||
retval = false;
|
||||
break;
|
||||
case SGValue::UNKNOWN:
|
||||
if (!out->setUnknownValue(in->getStringValue()))
|
||||
case SGPropertyNode::UNSPECIFIED:
|
||||
if (!out->setUnspecifiedValue(in->getStringValue()))
|
||||
retval = false;
|
||||
break;
|
||||
default:
|
||||
throw string("Unknown SGValue type");
|
||||
string message = "Unknown internal SGPropertyNode type";
|
||||
message += in->getType();
|
||||
throw sg_error(message, "SimGear Property Reader");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
68
simgear/misc/props_io.hxx
Normal file
68
simgear/misc/props_io.hxx
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* \file props_io.hxx
|
||||
* Interface definition for property list io.
|
||||
* Started Fall 2000 by David Megginson, david@megginson.com
|
||||
* This code is released into the Public Domain.
|
||||
*
|
||||
* See props.html for documentation [replace with URL when available].
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __PROPS_IO_HXX
|
||||
#define __PROPS_IO_HXX
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/misc/props.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include STL_STRING
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
SG_USING_STD(string);
|
||||
SG_USING_STD(vector);
|
||||
SG_USING_STD(map);
|
||||
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
|
||||
SG_USING_STD(istream);
|
||||
SG_USING_STD(ostream);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Read properties from an XML input stream.
|
||||
*/
|
||||
void readProperties (istream &input, SGPropertyNode * start_node,
|
||||
const string &base = "");
|
||||
|
||||
|
||||
/**
|
||||
* Read properties from an XML file.
|
||||
*/
|
||||
void readProperties (const string &file, SGPropertyNode * start_node);
|
||||
|
||||
|
||||
/**
|
||||
* Write properties to an XML output stream.
|
||||
*/
|
||||
void writeProperties (ostream &output, const SGPropertyNode * start_node,
|
||||
bool write_all = false);
|
||||
|
||||
|
||||
/**
|
||||
* Write properties to an XML file.
|
||||
*/
|
||||
void writeProperties (const string &file, const SGPropertyNode * start_node,
|
||||
bool write_all = false);
|
||||
|
||||
|
||||
/**
|
||||
* Copy properties from one node to another.
|
||||
*/
|
||||
bool copyProperties (const SGPropertyNode *in, SGPropertyNode *out);
|
||||
|
||||
|
||||
#endif // __PROPS_IO_HXX
|
||||
|
||||
// end of props_io.hxx
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include STL_IOSTREAM
|
||||
#include "props.hxx"
|
||||
#include "props_io.hxx"
|
||||
|
||||
#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
|
||||
SG_USING_STD(cout);
|
||||
@@ -50,13 +51,13 @@ static double getNum (int index) { return 1.0 / index; }
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void
|
||||
show_values (const SGValue * value)
|
||||
show_values (const SGPropertyNode * node)
|
||||
{
|
||||
cout << "Bool: " << value->getBoolValue() << endl;
|
||||
cout << "Int: " << value->getIntValue() << endl;
|
||||
cout << "Float: " << value->getFloatValue() << endl;
|
||||
cout << "Double: " << value->getDoubleValue() << endl;
|
||||
cout << "String: " << value->getStringValue() << endl;
|
||||
cout << "Bool: " << (node->getBoolValue() ? "true" : "false") << endl;
|
||||
cout << "Int: " << node->getIntValue() << endl;
|
||||
cout << "Float: " << node->getFloatValue() << endl;
|
||||
cout << "Double: " << node->getDoubleValue() << endl;
|
||||
cout << "String: " << node->getStringValue() << endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +69,7 @@ show_values (const SGValue * value)
|
||||
static void
|
||||
test_value ()
|
||||
{
|
||||
SGValue * value;
|
||||
SGPropertyNode * node;
|
||||
|
||||
cout << endl << "Value" << endl << endl;
|
||||
|
||||
@@ -77,81 +78,81 @@ test_value ()
|
||||
//
|
||||
|
||||
cout << "Testing coercion from bool (expect true)" << endl;
|
||||
value = new SGValue;
|
||||
value->setBoolValue(true);
|
||||
show_values(value);
|
||||
delete value;
|
||||
node = new SGPropertyNode;
|
||||
node->setBoolValue(true);
|
||||
show_values(node);
|
||||
delete node;
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing coercion from int (expect 128)" << endl;
|
||||
value = new SGValue;
|
||||
value->setIntValue(128);
|
||||
show_values(value);
|
||||
delete value;
|
||||
node = new SGPropertyNode;
|
||||
node->setIntValue(128);
|
||||
show_values(node);
|
||||
delete node;
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing coercion from float (expect 1.0/3.0)" << endl;
|
||||
value = new SGValue;
|
||||
value->setFloatValue(1.0/3.0);
|
||||
show_values(value);
|
||||
delete value;
|
||||
node = new SGPropertyNode;
|
||||
node->setFloatValue(1.0/3.0);
|
||||
show_values(node);
|
||||
delete node;
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing coercion from double (expect 1.0/3.0)" << endl;
|
||||
value = new SGValue;
|
||||
value->setDoubleValue(1.0/3.0);
|
||||
show_values(value);
|
||||
delete value;
|
||||
node = new SGPropertyNode;
|
||||
node->setDoubleValue(1.0/3.0);
|
||||
show_values(node);
|
||||
delete node;
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing coercion from string (expect 10e4)" << endl;
|
||||
value = new SGValue;
|
||||
value->setStringValue("10e4");
|
||||
show_values(value);
|
||||
delete value;
|
||||
node = new SGPropertyNode;
|
||||
node->setStringValue("10e4");
|
||||
show_values(node);
|
||||
delete node;
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing coercion from unknown (expect -10e-4)" << endl;
|
||||
value = new SGValue;
|
||||
value->setUnknownValue("-10e-4");
|
||||
show_values(value);
|
||||
delete value;
|
||||
cout << "Testing coercion from unspecified (expect -10e-4)" << endl;
|
||||
node = new SGPropertyNode;
|
||||
node->setUnspecifiedValue("-10e-4");
|
||||
show_values(node);
|
||||
delete node;
|
||||
cout << endl;
|
||||
|
||||
//
|
||||
// Test coercion for setters.
|
||||
//
|
||||
|
||||
value = new SGValue;
|
||||
node = new SGPropertyNode;
|
||||
|
||||
cout << "Testing coercion to bool from bool (expect false)" << endl;
|
||||
value->setBoolValue(false);
|
||||
show_values(value);
|
||||
node->setBoolValue(false);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing coercion to bool from int (expect 1)" << endl;
|
||||
value->setIntValue(1);
|
||||
show_values(value);
|
||||
node->setIntValue(1);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing coercion to bool from float (expect 1.1)" << endl;
|
||||
value->setFloatValue(1.1);
|
||||
show_values(value);
|
||||
node->setFloatValue(1.1);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing coercion to bool from double (expect 1.1)" << endl;
|
||||
value->setDoubleValue(1.1);
|
||||
show_values(value);
|
||||
node->setDoubleValue(1.1);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing coercion to bool from string (expect 1e10)" << endl;
|
||||
value->setStringValue("1e10");
|
||||
show_values(value);
|
||||
node->setStringValue("1e10");
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing coercion to bool from unknown (expect 1e10)" << endl;
|
||||
value->setUnknownValue("1e10");
|
||||
show_values(value);
|
||||
cout << "Testing coercion to bool from unspecified (expect 1e10)" << endl;
|
||||
node->setUnspecifiedValue("1e10");
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
// Test tying to a pointer.
|
||||
@@ -159,67 +160,67 @@ test_value ()
|
||||
static int myValue = 10;
|
||||
|
||||
cout << "Testing tying to a pointer (expect 10)" << endl;
|
||||
if (!value->tie(SGRawValuePointer<int>(&myValue)))
|
||||
if (!node->tie(SGRawValuePointer<int>(&myValue), false))
|
||||
cout << "*** FAILED TO TIE VALUE!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Changing base variable (expect -5)" << endl;
|
||||
myValue = -5;
|
||||
show_values(value);
|
||||
if (!value->untie())
|
||||
cout << "*** FAIELD TO UNTIE VALUE!!!" << endl;
|
||||
show_values(node);
|
||||
if (!node->untie())
|
||||
cout << "*** FAILED TO UNTIE VALUE!!!" << endl;
|
||||
cout << endl;
|
||||
|
||||
|
||||
// Test tying to static functions.
|
||||
|
||||
cout << "Create a new int value (expect 10)" << endl;
|
||||
value->setIntValue(10);
|
||||
show_values(value);
|
||||
node->setIntValue(10);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing tying to static getter (expect 100)" << endl;
|
||||
if (!value->tie(SGRawValueFunctions<int>(get100)))
|
||||
if (!node->tie(SGRawValueFunctions<int>(get100)))
|
||||
cout << "*** FAILED TO TIE VALUE!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Try changing value with no setter (expect 100)" << endl;
|
||||
if (value->setIntValue(200))
|
||||
if (node->setIntValue(200))
|
||||
cout << "*** setIntValue did not return false!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Untie value (expect 100)" << endl;
|
||||
if (!value->untie())
|
||||
if (!node->untie())
|
||||
cout << "*** FAILED TO UNTIE VALUE!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Try changing value (expect 200)" << endl;
|
||||
if (!value->setIntValue(200))
|
||||
if (!node->setIntValue(200))
|
||||
cout << "*** setIntValue RETURNED FALSE!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
// Test tying to indexed static functions.
|
||||
|
||||
cout << "Create a new int value (expect 10)" << endl;
|
||||
value->setIntValue(10);
|
||||
show_values(value);
|
||||
node->setIntValue(10);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Testing tying to indexed static getter (0.3333...)" << endl;
|
||||
if (!value->tie(SGRawValueFunctionsIndexed<double>(3, getNum)))
|
||||
if (!node->tie(SGRawValueFunctionsIndexed<double>(3, getNum)))
|
||||
cout << "*** FAILED TO TIE VALUE!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Untie value (expect 0.3333...)" << endl;
|
||||
if (!value->untie())
|
||||
if (!node->untie())
|
||||
cout << "*** FAILED TO UNTIE VALUE!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
|
||||
@@ -230,39 +231,39 @@ test_value ()
|
||||
SGRawValueMethods<class Stuff,float> tiedstuff(stuff,
|
||||
&Stuff::getStuff,
|
||||
&Stuff::setStuff);
|
||||
if (!value->tie(tiedstuff, false))
|
||||
if (!node->tie(tiedstuff, false))
|
||||
cout << "*** FAILED TO TIE VALUE!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Try untying from object (expect 199)" << endl;
|
||||
if (!value->untie())
|
||||
if (!node->untie())
|
||||
cout << "*** FAILED TO UNTIE VALUE!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Try tying to an indexed method (expect 199)" << endl;
|
||||
if (!value->tie(SGRawValueMethodsIndexed<class Stuff, float>
|
||||
if (!node->tie(SGRawValueMethodsIndexed<class Stuff, float>
|
||||
(stuff, 2, &Stuff::getStuff, &Stuff::setStuff)))
|
||||
cout << "*** FAILED TO TIE VALUE!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
value->untie();
|
||||
node->untie();
|
||||
|
||||
cout << "Change value (expect 50)" << endl;
|
||||
if (!value->setIntValue(50))
|
||||
if (!node->setIntValue(50))
|
||||
cout << "*** FAILED TO SET VALUE!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
cout << "Try tying to an object with defaults (expect 50)" << endl;
|
||||
if (!value->tie(tiedstuff, true))
|
||||
if (!node->tie(tiedstuff, true))
|
||||
cout << "*** FAILED TO TIE VALUE!!!" << endl;
|
||||
show_values(value);
|
||||
show_values(node);
|
||||
cout << endl;
|
||||
|
||||
delete value;
|
||||
delete node;
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +275,7 @@ test_value ()
|
||||
static void
|
||||
dump_node (const SGPropertyNode * node)
|
||||
{
|
||||
writeProperties(cout, node);
|
||||
writeProperties(cout, node, true);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -312,7 +313,7 @@ test_property_nodes ()
|
||||
cout << endl;
|
||||
|
||||
cout << "Looking for all /hack[0]/bar children" << endl;
|
||||
vector<SGPropertyNode *> bar = child->getChildren("bar");
|
||||
vector<SGPropertyNode_ptr> bar = child->getChildren("bar");
|
||||
cout << "There are " << bar.size() << " matches" << endl;
|
||||
for (int i = 0; i < (int)bar.size(); i++)
|
||||
cout << bar[i]->getName() << '[' << bar[i]->getIndex() << ']' << endl;
|
||||
@@ -332,13 +333,15 @@ int main (int ac, char ** av)
|
||||
test_property_nodes();
|
||||
|
||||
for (int i = 1; i < ac; i++) {
|
||||
cout << "Reading " << av[i] << endl;
|
||||
SGPropertyNode root;
|
||||
if (!readProperties(av[i], &root))
|
||||
cerr << "Failed to read properties from " << av[i] << endl;
|
||||
else
|
||||
writeProperties(cout, &root);
|
||||
cout << endl;
|
||||
try {
|
||||
cout << "Reading " << av[i] << endl;
|
||||
SGPropertyNode root;
|
||||
readProperties(av[i], &root);
|
||||
writeProperties(cout, &root, true);
|
||||
cout << endl;
|
||||
} catch (string &message) {
|
||||
cout << "Aborted with " << message << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
|
||||
#include <simgear_config.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sg_path.hxx"
|
||||
|
||||
@@ -33,34 +34,35 @@
|
||||
// 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 ) {
|
||||
void
|
||||
SGPath::fix()
|
||||
{
|
||||
for ( string::size_type i = 0; i < path.size(); ++i ) {
|
||||
#if defined( WIN32 )
|
||||
// for windoze, don't replace the ":" for the second character
|
||||
if ( i == 1 ) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if ( result[i] == SG_BAD_PATH_SEP ) {
|
||||
result[i] = SG_PATH_SEP;
|
||||
if ( path[i] == SG_BAD_PATH_SEP ) {
|
||||
path[i] = SG_PATH_SEP;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// default constructor
|
||||
SGPath::SGPath() {
|
||||
path = "";
|
||||
SGPath::SGPath()
|
||||
: path("")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// create a path based on "path"
|
||||
SGPath::SGPath( const string p ) {
|
||||
set( p );
|
||||
SGPath::SGPath( const std::string& p )
|
||||
: path(p)
|
||||
{
|
||||
fix();
|
||||
}
|
||||
|
||||
|
||||
@@ -70,36 +72,35 @@ SGPath::~SGPath() {
|
||||
|
||||
|
||||
// set path
|
||||
void SGPath::set( const string p ) {
|
||||
path = fix_path( p );
|
||||
void SGPath::set( const string& p ) {
|
||||
path = p;
|
||||
fix();
|
||||
}
|
||||
|
||||
|
||||
// append another piece to the existing path
|
||||
void SGPath::append( const string p ) {
|
||||
string part = fix_path( p );
|
||||
|
||||
void SGPath::append( const string& p ) {
|
||||
if ( path.size() == 0 ) {
|
||||
path = part;
|
||||
path = p;
|
||||
} else {
|
||||
if ( part[0] != SG_PATH_SEP ) {
|
||||
if ( p[0] != SG_PATH_SEP ) {
|
||||
path += SG_PATH_SEP;
|
||||
}
|
||||
path += part;
|
||||
path += p;
|
||||
}
|
||||
fix();
|
||||
}
|
||||
|
||||
|
||||
// concatenate a string to the end of the path without inserting a
|
||||
// path separator
|
||||
void SGPath::concat( const string p ) {
|
||||
string part = fix_path( p );
|
||||
|
||||
void SGPath::concat( const string& p ) {
|
||||
if ( path.size() == 0 ) {
|
||||
path = part;
|
||||
path = p;
|
||||
} else {
|
||||
path += part;
|
||||
path += p;
|
||||
}
|
||||
fix();
|
||||
}
|
||||
|
||||
|
||||
@@ -112,3 +113,12 @@ string SGPath::dir() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
bool SGPath::exists() const {
|
||||
FILE* fp = fopen( path.c_str(), "r");
|
||||
if (fp == 0) {
|
||||
return false;
|
||||
}
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
* Construct a path based on the starting path provided.
|
||||
* @param p initial path
|
||||
*/
|
||||
SGPath( const string p );
|
||||
SGPath( const string& p );
|
||||
|
||||
/** Destructor */
|
||||
~SGPath();
|
||||
@@ -78,20 +78,21 @@ public:
|
||||
* Set path to a new value
|
||||
* @param p new path
|
||||
*/
|
||||
void set( const string p );
|
||||
void set( const string& p );
|
||||
SGPath& operator= ( const char* p ) { this->set(p); return *this; }
|
||||
|
||||
/**
|
||||
* Append another piece to the existing path. Inserts a path
|
||||
* separator between the existing component and the new component.
|
||||
* @param p additional path component */
|
||||
void append( const string p );
|
||||
void append( const string& p );
|
||||
|
||||
/**
|
||||
* Concatenate a string to the end of the path without inserting a
|
||||
* path separator.
|
||||
* @param p addtional path suffix
|
||||
*/
|
||||
void concat( const string p );
|
||||
void concat( const string& p );
|
||||
|
||||
/**
|
||||
* Get the directory part of the path.
|
||||
@@ -102,12 +103,23 @@ public:
|
||||
/** Get the path string
|
||||
* @return path string
|
||||
*/
|
||||
inline string str() const { return path; }
|
||||
string str() const { return path; }
|
||||
|
||||
/** Get the path string
|
||||
* @return path in "C" string (ptr to char array) form.
|
||||
*/
|
||||
inline const char *c_str() { return path.c_str(); }
|
||||
const char* c_str() { return path.c_str(); }
|
||||
|
||||
/**
|
||||
* Determine if file exists by attempting to fopen it.
|
||||
* @return true if file exists, otherwise returns false.
|
||||
*/
|
||||
bool exists() const;
|
||||
|
||||
private:
|
||||
|
||||
void fix();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// String utilities.
|
||||
//
|
||||
// Written by Bernie Bright, 1998
|
||||
// Written by Bernie Bright, started 1998
|
||||
//
|
||||
// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au
|
||||
// Copyright (C) 1998 Bernie Bright - bbright@bigpond.net.au
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
@@ -21,48 +21,163 @@
|
||||
//
|
||||
// $Id$
|
||||
|
||||
#include <ctype.h>
|
||||
#include "strutils.hxx"
|
||||
|
||||
const string whitespace = " \n\r\t";
|
||||
namespace simgear {
|
||||
namespace strutils {
|
||||
|
||||
//
|
||||
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 ) );
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static vector<string>
|
||||
split_whitespace( const string& str, int maxsplit )
|
||||
{
|
||||
vector<string> result;
|
||||
string::size_type len = str.length();
|
||||
string::size_type i = 0;
|
||||
string::size_type j;
|
||||
int countsplit = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
while (i < len)
|
||||
{
|
||||
while (i < len && isspace(str[i]))
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
//
|
||||
string
|
||||
trimright( const string& s, const string& trimmings )
|
||||
{
|
||||
string result;
|
||||
j = i;
|
||||
|
||||
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 ) );
|
||||
}
|
||||
while (i < len && !isspace(str[i]))
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
if (j < i)
|
||||
{
|
||||
result.push_back( str.substr(j, i-j) );
|
||||
++countsplit;
|
||||
while (i < len && isspace(str[i]))
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
//
|
||||
string
|
||||
trim( const string& s, const string& trimmings )
|
||||
{
|
||||
return trimright( trimleft( s, trimmings ), trimmings );
|
||||
}
|
||||
if (maxsplit && (countsplit >= maxsplit) && i < len)
|
||||
{
|
||||
result.push_back( str.substr( i, len-i ) );
|
||||
i = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
vector<string>
|
||||
split( const string& str, const char* sep, int maxsplit )
|
||||
{
|
||||
if (sep == 0)
|
||||
return split_whitespace( str, maxsplit );
|
||||
|
||||
vector<string> result;
|
||||
int n = strlen( sep );
|
||||
if (n == 0)
|
||||
{
|
||||
// Error: empty separator string
|
||||
return result;
|
||||
}
|
||||
const char* s = str.c_str();
|
||||
string::size_type len = str.length();
|
||||
string::size_type i = 0;
|
||||
string::size_type j = 0;
|
||||
int splitcount = 0;
|
||||
|
||||
while (i+n <= len)
|
||||
{
|
||||
if (s[i] == sep[0] && (n == 1 || memcmp(s+i, sep, n) == 0))
|
||||
{
|
||||
result.push_back( str.substr(j,i-j) );
|
||||
i = j = i + n;
|
||||
++splitcount;
|
||||
if (maxsplit && (splitcount >= maxsplit))
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
result.push_back( str.substr(j,len-j) );
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The lstrip(), rstrip() and strip() functions are implemented
|
||||
* in do_strip() which uses an additional parameter to indicate what
|
||||
* type of strip should occur.
|
||||
*/
|
||||
const int LEFTSTRIP = 0;
|
||||
const int RIGHTSTRIP = 1;
|
||||
const int BOTHSTRIP = 2;
|
||||
|
||||
static string
|
||||
do_strip( const string& s, int striptype )
|
||||
{
|
||||
// if (s.empty())
|
||||
// return s;
|
||||
|
||||
string::size_type len = s.length();
|
||||
string::size_type i = 0;
|
||||
if (striptype != RIGHTSTRIP)
|
||||
{
|
||||
while (i < len && isspace(s[i]))
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
string::size_type j = len;
|
||||
if (striptype != LEFTSTRIP)
|
||||
{
|
||||
do
|
||||
{
|
||||
--j;
|
||||
}
|
||||
while (j >= 1 && isspace(s[j]));
|
||||
++j;
|
||||
}
|
||||
|
||||
if (i == 0 && j == len)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
else
|
||||
{
|
||||
return s.substr( i, j - i );
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
lstrip( const string& s )
|
||||
{
|
||||
return do_strip( s, LEFTSTRIP );
|
||||
}
|
||||
|
||||
string
|
||||
rstrip( const string& s )
|
||||
{
|
||||
return do_strip( s, RIGHTSTRIP );
|
||||
}
|
||||
|
||||
string
|
||||
strip( const string& s )
|
||||
{
|
||||
return do_strip( s, BOTHSTRIP );
|
||||
}
|
||||
|
||||
} // end namespace strutils
|
||||
} // end namespace simgear
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* String utilities.
|
||||
*/
|
||||
|
||||
// Written by Bernie Bright, 1998
|
||||
// Written by Bernie Bright, started 1998
|
||||
//
|
||||
// Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au
|
||||
// Copyright (C) 1998 Bernie Bright - bbright@bigpond.net.au
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
@@ -32,6 +32,9 @@
|
||||
|
||||
#include STL_STRING
|
||||
|
||||
#include <vector>
|
||||
SG_USING_STD(vector);
|
||||
|
||||
#ifdef SG_HAVE_STD_INCLUDES
|
||||
# include <cstdlib>
|
||||
#else
|
||||
@@ -40,32 +43,54 @@
|
||||
|
||||
SG_USING_STD(string);
|
||||
|
||||
namespace simgear {
|
||||
namespace strutils {
|
||||
|
||||
/** Default characters to remove. */
|
||||
extern const string whitespace;
|
||||
// /**
|
||||
// * atof() wrapper for "string" type
|
||||
// */
|
||||
// inline double
|
||||
// atof( const string& str )
|
||||
// {
|
||||
// return ::atof( str.c_str() );
|
||||
// }
|
||||
|
||||
/** Returns a string with trailing characters removed. */
|
||||
string trimleft( const string& s, const string& trimmings = whitespace );
|
||||
// /**
|
||||
// * atoi() wrapper for "string" type
|
||||
// */
|
||||
// inline int
|
||||
// atoi( const string& str )
|
||||
// {
|
||||
// return ::atoi( str.c_str() );
|
||||
// }
|
||||
|
||||
/** Returns a string with leading characters removed. */
|
||||
string trimright( const string& s, const string& trimmings = whitespace );
|
||||
/**
|
||||
* Strip leading and/or trailing whitespace from s.
|
||||
* @param s String to strip.
|
||||
* @return The stripped string.
|
||||
*/
|
||||
string lstrip( const string& s );
|
||||
string rstrip( const string& s );
|
||||
string strip( const string& s );
|
||||
|
||||
/** Returns a string with leading and trailing characters removed. */
|
||||
string trim( const string& s, const string& trimmings = whitespace );
|
||||
/**
|
||||
* Split a string into a words using 'sep' as the delimiter string.
|
||||
* Produces a result similar to the perl and python functions of the
|
||||
* same name.
|
||||
*
|
||||
* @param s The string to split into words,
|
||||
* @param sep Word delimiters. If not specified then any whitespace is a separator,
|
||||
* @param maxsplit If given, splits at no more than maxsplit places,
|
||||
* resulting in at most maxsplit+1 words.
|
||||
* @return Array of words.
|
||||
*/
|
||||
vector<string>
|
||||
split( const string& s,
|
||||
const char* sep = 0,
|
||||
int maxsplit = 0 );
|
||||
|
||||
/** atof() wrapper for "string" type */
|
||||
inline double
|
||||
atof( const string& str )
|
||||
{
|
||||
return ::atof( str.c_str() );
|
||||
}
|
||||
|
||||
/** atoi() wrapper for "string" type */
|
||||
inline int
|
||||
atoi( const string& str )
|
||||
{
|
||||
return ::atoi( str.c_str() );
|
||||
}
|
||||
} // end namespace strutils
|
||||
} // end namespace simgear
|
||||
|
||||
#endif // STRUTILS_H
|
||||
|
||||
|
||||
@@ -30,11 +30,7 @@
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
# include <zlib.h>
|
||||
#else
|
||||
# include <simgear/zlib/zlib.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
// At least Irix needs this
|
||||
#ifdef SG_HAVE_NATIVE_SGI_COMPILERS
|
||||
|
||||
5
simgear/route/.cvsignore
Normal file
5
simgear/route/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
routetest
|
||||
waytest
|
||||
@@ -8,7 +8,7 @@ libsgroute_a_SOURCES = \
|
||||
route.cxx \
|
||||
waypoint.cxx
|
||||
|
||||
INCLUDES += -I$(top_srcdir)
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
noinst_PROGRAMS = waytest routetest
|
||||
|
||||
@@ -19,6 +19,7 @@ waytest_LDADD = \
|
||||
$(top_builddir)/simgear/math/libsgmath.a \
|
||||
$(top_builddir)/simgear/debug/libsgdebug.a \
|
||||
$(top_builddir)/simgear/misc/libsgmisc.a \
|
||||
$(top_builddir)/simgear/xml/libsgxml.a \
|
||||
-lz
|
||||
|
||||
routetest_SOURCES = routetest.cxx
|
||||
@@ -26,4 +27,4 @@ routetest_SOURCES = routetest.cxx
|
||||
routetest_LDADD = \
|
||||
$(top_builddir)/simgear/route/libsgroute.a \
|
||||
$(top_builddir)/simgear/math/libsgmath.a \
|
||||
$(top_builddir)/simgear/debug/libsgdebug.a
|
||||
$(top_builddir)/simgear/debug/libsgdebug.a
|
||||
|
||||
@@ -38,11 +38,6 @@ SGWayPoint::SGWayPoint( const double lon, const double lat, const double alt,
|
||||
}
|
||||
|
||||
|
||||
SGWayPoint::SGWayPoint() {
|
||||
SGWayPoint( 0.0, 0.0, 0.0, WGS84, "" );
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
SGWayPoint::~SGWayPoint() {
|
||||
}
|
||||
|
||||
@@ -79,9 +79,6 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
/** Default constructor */
|
||||
SGWayPoint();
|
||||
|
||||
/**
|
||||
* Construct a waypoint
|
||||
* @param lon destination longitude
|
||||
@@ -90,8 +87,9 @@ public:
|
||||
* @param mode type of coordinates/math to use
|
||||
* @param s waypoint identifier
|
||||
*/
|
||||
SGWayPoint( const double lon, const double lat, const double alt,
|
||||
const modetype m = WGS84, const string s = "" );
|
||||
SGWayPoint( const double lon = 0.0, const double lat = 0.0,
|
||||
const double alt = 0.0, const modetype m = WGS84,
|
||||
const string s = "" );
|
||||
|
||||
/** Destructor */
|
||||
~SGWayPoint();
|
||||
|
||||
3
simgear/scene/sky/.cvsignore
Normal file
3
simgear/scene/sky/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -1,5 +1,7 @@
|
||||
includedir = @includedir@/sky
|
||||
|
||||
SUBDIRS = clouds3d
|
||||
|
||||
lib_LIBRARIES = libsgsky.a
|
||||
|
||||
include_HEADERS = \
|
||||
@@ -20,4 +22,4 @@ libsgsky_a_SOURCES = \
|
||||
sphere.cxx \
|
||||
stars.cxx
|
||||
|
||||
INCLUDES += -I$(top_srcdir)
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
@@ -27,35 +27,136 @@
|
||||
#include <simgear/math/point3d.hxx>
|
||||
#include <simgear/math/polar3d.hxx>
|
||||
#include <simgear/math/sg_random.h>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
#include "cloud.hxx"
|
||||
|
||||
ssgSimpleState *
|
||||
SGCloudLayer::layer_states[SGCloudLayer::SG_MAX_CLOUD_TYPES];
|
||||
|
||||
|
||||
// Constructor
|
||||
SGCloudLayer::SGCloudLayer( void ) {
|
||||
SGCloudLayer::SGCloudLayer( const string &tex_path )
|
||||
: layer_root(new ssgRoot),
|
||||
layer_transform(new ssgTransform),
|
||||
layer(0),
|
||||
texture_path(tex_path),
|
||||
layer_span(0),
|
||||
layer_asl(0),
|
||||
layer_thickness(0),
|
||||
layer_transition(0),
|
||||
layer_type(SG_CLOUD_CLEAR)
|
||||
{
|
||||
layer_root->addKid(layer_transform);
|
||||
rebuild();
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
SGCloudLayer::~SGCloudLayer( void ) {
|
||||
SGCloudLayer::~SGCloudLayer()
|
||||
{
|
||||
delete layer_root; // deletes layer_transform and layer as well
|
||||
}
|
||||
|
||||
float
|
||||
SGCloudLayer::getSpan_m () const
|
||||
{
|
||||
return layer_span;
|
||||
}
|
||||
|
||||
void
|
||||
SGCloudLayer::setSpan_m (float span_m)
|
||||
{
|
||||
if (span_m != layer_span) {
|
||||
layer_span = span_m;
|
||||
rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
float
|
||||
SGCloudLayer::getElevation_m () const
|
||||
{
|
||||
return layer_asl;
|
||||
}
|
||||
|
||||
void
|
||||
SGCloudLayer::setElevation_m (float elevation_m)
|
||||
{
|
||||
layer_asl = elevation_m;
|
||||
}
|
||||
|
||||
float
|
||||
SGCloudLayer::getThickness_m () const
|
||||
{
|
||||
return layer_thickness;
|
||||
}
|
||||
|
||||
void
|
||||
SGCloudLayer::setThickness_m (float thickness_m)
|
||||
{
|
||||
layer_thickness = thickness_m;
|
||||
}
|
||||
|
||||
float
|
||||
SGCloudLayer::getTransition_m () const
|
||||
{
|
||||
return layer_transition;
|
||||
}
|
||||
|
||||
void
|
||||
SGCloudLayer::setTransition_m (float transition_m)
|
||||
{
|
||||
layer_transition = transition_m;
|
||||
}
|
||||
|
||||
SGCloudLayer::Type
|
||||
SGCloudLayer::getType () const
|
||||
{
|
||||
return layer_type;
|
||||
}
|
||||
|
||||
void
|
||||
SGCloudLayer::setType (Type type)
|
||||
{
|
||||
if (type != layer_type) {
|
||||
layer_type = type;
|
||||
rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// build the cloud object
|
||||
void SGCloudLayer::build( double s, double asl, double thickness,
|
||||
double transition, ssgSimpleState *state )
|
||||
void
|
||||
SGCloudLayer::rebuild()
|
||||
{
|
||||
// Initialize states and sizes if necessary.
|
||||
if (layer_states[0] == 0) {
|
||||
SGPath cloud_path;
|
||||
|
||||
cloud_path.set(texture_path.str());
|
||||
cloud_path.append("overcast.rgb");
|
||||
layer_states[SG_CLOUD_OVERCAST] = SGCloudMakeState(cloud_path.str());
|
||||
|
||||
cloud_path.set(texture_path.str());
|
||||
cloud_path.append("mostlycloudy.rgba");
|
||||
layer_states[SG_CLOUD_MOSTLY_CLOUDY] =
|
||||
SGCloudMakeState(cloud_path.str());
|
||||
|
||||
cloud_path.set(texture_path.str());
|
||||
cloud_path.append("mostlysunny.rgba");
|
||||
layer_states[SG_CLOUD_MOSTLY_SUNNY] = SGCloudMakeState(cloud_path.str());
|
||||
|
||||
cloud_path.set(texture_path.str());
|
||||
cloud_path.append("cirrus.rgba");
|
||||
layer_states[SG_CLOUD_CIRRUS] = SGCloudMakeState(cloud_path.str());
|
||||
|
||||
layer_states[SG_CLOUD_CLEAR] = 0;
|
||||
}
|
||||
|
||||
scale = 4000.0;
|
||||
|
||||
layer_asl = asl;
|
||||
layer_thickness = thickness;
|
||||
layer_transition = transition;
|
||||
|
||||
size = s;
|
||||
last_lon = last_lat = -999.0f;
|
||||
|
||||
layer_state = state;
|
||||
|
||||
cl = new ssgColourArray( 4 );
|
||||
vl = new ssgVertexArray( 4 );
|
||||
tl = new ssgTexCoordArray( 4 );
|
||||
@@ -66,7 +167,7 @@ void SGCloudLayer::build( double s, double asl, double thickness,
|
||||
sgVec2 tc;
|
||||
sgSetVec4( color, 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
|
||||
sgSetVec3( vertex, -size, -size, 0.0f );
|
||||
sgSetVec3( vertex, -layer_span, -layer_span, 0.0f );
|
||||
sgVec2 base;
|
||||
sgSetVec2( base, sg_random(), sg_random() );
|
||||
sgSetVec2( tc, base[0], base[1] );
|
||||
@@ -74,40 +175,35 @@ void SGCloudLayer::build( double s, double asl, double thickness,
|
||||
vl->add( vertex );
|
||||
tl->add( tc );
|
||||
|
||||
sgSetVec3( vertex, size, -size, 0.0f );
|
||||
sgSetVec2( tc, base[0] + size / scale, base[1] );
|
||||
sgSetVec3( vertex, layer_span, -layer_span, 0.0f );
|
||||
sgSetVec2( tc, base[0] + layer_span / scale, base[1] );
|
||||
cl->add( color );
|
||||
vl->add( vertex );
|
||||
tl->add( tc );
|
||||
|
||||
sgSetVec3( vertex, -size, size, 0.0f );
|
||||
sgSetVec2( tc, base[0], base[1] + size / scale );
|
||||
sgSetVec3( vertex, -layer_span, layer_span, 0.0f );
|
||||
sgSetVec2( tc, base[0], base[1] + layer_span / scale );
|
||||
cl->add( color );
|
||||
vl->add( vertex );
|
||||
tl->add( tc );
|
||||
|
||||
sgSetVec3( vertex, size, size, 0.0f );
|
||||
sgSetVec2( tc, base[0] + size / scale, base[1] + size / scale );
|
||||
sgSetVec3( vertex, layer_span, layer_span, 0.0f );
|
||||
sgSetVec2( tc, base[0] + layer_span / scale, base[1] + layer_span / scale );
|
||||
cl->add( color );
|
||||
vl->add( vertex );
|
||||
tl->add( tc );
|
||||
|
||||
ssgLeaf *layer =
|
||||
new ssgVtxTable ( GL_TRIANGLE_STRIP, vl, NULL, tl, cl );
|
||||
layer->setState( layer_state );
|
||||
if (layer != 0)
|
||||
layer_transform->removeKid(layer); // automatic delete
|
||||
layer = new ssgVtxTable ( GL_TRIANGLE_STRIP, vl, NULL, tl, cl );
|
||||
if (layer_states[layer_type] != 0)
|
||||
layer->setState( layer_states[layer_type] );
|
||||
|
||||
// force a repaint of the moon colors with arbitrary defaults
|
||||
repaint( color );
|
||||
|
||||
// build the ssg scene graph sub tree for the sky and connected
|
||||
// into the provide scene graph branch
|
||||
layer_transform = new ssgTransform;
|
||||
|
||||
// moon_transform->addKid( halo );
|
||||
layer_transform->addKid( layer );
|
||||
|
||||
layer_root = new ssgRoot;
|
||||
layer_root->addKid( layer_transform );
|
||||
}
|
||||
|
||||
|
||||
@@ -204,23 +300,42 @@ bool SGCloudLayer::reposition( sgVec3 p, sgVec3 up, double lon, double lat,
|
||||
base = tl->get( 0 );
|
||||
|
||||
base[0] += xoff;
|
||||
while ( base[0] > 1.0 ) { base[0] -= 1.0; }
|
||||
while ( base[0] < 0.0 ) { base[0] += 1.0; }
|
||||
|
||||
// the while loops can lead to *long* pauses if base[0] comes
|
||||
// with a bogus value.
|
||||
// while ( base[0] > 1.0 ) { base[0] -= 1.0; }
|
||||
// while ( base[0] < 0.0 ) { base[0] += 1.0; }
|
||||
if ( base[0] > -10.0 && base[0] < 10.0 ) {
|
||||
base[0] -= (int)base[0];
|
||||
} else {
|
||||
base[0] = 0.0;
|
||||
SG_LOG(SG_ASTRO, SG_DEBUG,
|
||||
"Error: base = " << base[0] << "," << base[1]);
|
||||
}
|
||||
|
||||
base[1] += yoff;
|
||||
while ( base[1] > 1.0 ) { base[1] -= 1.0; }
|
||||
while ( base[1] < 0.0 ) { base[1] += 1.0; }
|
||||
// the while loops can lead to *long* pauses if base[0] comes
|
||||
// with a bogus value.
|
||||
// while ( base[1] > 1.0 ) { base[1] -= 1.0; }
|
||||
// while ( base[1] < 0.0 ) { base[1] += 1.0; }
|
||||
if ( base[1] > -10.0 && base[1] < 10.0 ) {
|
||||
base[1] -= (int)base[1];
|
||||
} else {
|
||||
base[1] = 0.0;
|
||||
SG_LOG(SG_ASTRO, SG_ALERT,
|
||||
"Error: base = " << base[0] << "," << base[1]);
|
||||
}
|
||||
|
||||
// cout << "base = " << base[0] << "," << base[1] << endl;
|
||||
|
||||
tc = tl->get( 1 );
|
||||
sgSetVec2( tc, base[0] + size / scale, base[1] );
|
||||
sgSetVec2( tc, base[0] + layer_span / scale, base[1] );
|
||||
|
||||
tc = tl->get( 2 );
|
||||
sgSetVec2( tc, base[0], base[1] + size / scale );
|
||||
sgSetVec2( tc, base[0], base[1] + layer_span / scale );
|
||||
|
||||
tc = tl->get( 3 );
|
||||
sgSetVec2( tc, base[0] + size / scale, base[1] + size / scale );
|
||||
sgSetVec2( tc, base[0] + layer_span / scale, base[1] + layer_span / scale );
|
||||
|
||||
last_lon = lon;
|
||||
last_lat = lat;
|
||||
@@ -231,7 +346,8 @@ bool SGCloudLayer::reposition( sgVec3 p, sgVec3 up, double lon, double lat,
|
||||
|
||||
|
||||
void SGCloudLayer::draw() {
|
||||
ssgCullAndDraw( layer_root );
|
||||
if (layer_type != SG_CLOUD_CLEAR)
|
||||
ssgCullAndDraw( layer_root );
|
||||
}
|
||||
|
||||
|
||||
@@ -252,5 +368,9 @@ ssgSimpleState *SGCloudMakeState( const string &path ) {
|
||||
state->enable( GL_ALPHA_TEST );
|
||||
state->setAlphaClamp( 0.01 );
|
||||
|
||||
// ref() the state so it doesn't get deleted if the last layer of
|
||||
// it's type is deleted.
|
||||
state->ref();
|
||||
|
||||
return state;
|
||||
}
|
||||
@@ -33,53 +33,42 @@
|
||||
SG_USING_STD(string);
|
||||
|
||||
|
||||
#define SG_MAX_CLOUD_TYPES 4 // change this if we add/remove cloud
|
||||
// types en the enum below
|
||||
|
||||
enum SGCloudType {
|
||||
SG_CLOUD_OVERCAST = 0,
|
||||
SG_CLOUD_MOSTLY_CLOUDY,
|
||||
SG_CLOUD_MOSTLY_SUNNY,
|
||||
SG_CLOUD_CIRRUS
|
||||
};
|
||||
|
||||
|
||||
class SGCloudLayer {
|
||||
|
||||
private:
|
||||
|
||||
ssgRoot *layer_root;
|
||||
ssgTransform *layer_transform;
|
||||
ssgSimpleState *layer_state;
|
||||
|
||||
ssgColourArray *cl;
|
||||
ssgVertexArray *vl;
|
||||
ssgTexCoordArray *tl;
|
||||
|
||||
// height above sea level (meters)
|
||||
float layer_asl;
|
||||
float layer_thickness;
|
||||
float layer_transition;
|
||||
float size;
|
||||
float scale;
|
||||
|
||||
// for handling texture coordinates to simulate cloud movement
|
||||
// from winds, and to simulate the clouds being tied to ground
|
||||
// position, not view position
|
||||
// double xoff, yoff;
|
||||
double last_lon, last_lat;
|
||||
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
SGCloudLayer( void );
|
||||
enum Type {
|
||||
SG_CLOUD_OVERCAST = 0,
|
||||
SG_CLOUD_MOSTLY_CLOUDY,
|
||||
SG_CLOUD_MOSTLY_SUNNY,
|
||||
SG_CLOUD_CIRRUS,
|
||||
SG_CLOUD_CLEAR,
|
||||
SG_MAX_CLOUD_TYPES
|
||||
};
|
||||
|
||||
// Constructors
|
||||
SGCloudLayer( const string &tex_path );
|
||||
|
||||
// Destructor
|
||||
~SGCloudLayer( void );
|
||||
|
||||
float getSpan_m () const;
|
||||
void setSpan_m (float span_m);
|
||||
|
||||
float getElevation_m () const;
|
||||
void setElevation_m (float elevation_m);
|
||||
|
||||
float getThickness_m () const;
|
||||
void setThickness_m (float thickness_m);
|
||||
|
||||
float getTransition_m () const;
|
||||
void setTransition_m (float transition_m);
|
||||
|
||||
Type getType () const;
|
||||
void setType (Type type);
|
||||
|
||||
// build the cloud object
|
||||
void build( double size, double asl, double thickness,
|
||||
double transition, ssgSimpleState *state );
|
||||
void rebuild();
|
||||
|
||||
// repaint the cloud colors based on current value of sun_angle,
|
||||
// sky, and fog colors. This updates the color arrays for
|
||||
@@ -101,9 +90,34 @@ public:
|
||||
// draw the cloud layer
|
||||
void draw();
|
||||
|
||||
inline float get_asl() const { return layer_asl; }
|
||||
inline float get_thickness() const { return layer_thickness; }
|
||||
inline float get_transition() const { return layer_transition; }
|
||||
private:
|
||||
|
||||
static ssgSimpleState *layer_states[SG_MAX_CLOUD_TYPES];
|
||||
static int layer_sizes[SG_MAX_CLOUD_TYPES];
|
||||
|
||||
ssgRoot *layer_root;
|
||||
ssgTransform *layer_transform;
|
||||
ssgLeaf * layer;
|
||||
|
||||
ssgColourArray *cl;
|
||||
ssgVertexArray *vl;
|
||||
ssgTexCoordArray *tl;
|
||||
|
||||
// height above sea level (meters)
|
||||
SGPath texture_path;
|
||||
float layer_span;
|
||||
float layer_asl;
|
||||
float layer_thickness;
|
||||
float layer_transition;
|
||||
Type layer_type;
|
||||
float scale;
|
||||
|
||||
// for handling texture coordinates to simulate cloud movement
|
||||
// from winds, and to simulate the clouds being tied to ground
|
||||
// position, not view position
|
||||
// double xoff, yoff;
|
||||
double last_lon, last_lat;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user