Compare commits
44 Commits
RELEASE_0_
...
RELEASE_0_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
@@ -5,11 +5,9 @@ EXTRA_DIST = \
|
||||
README.metakit \
|
||||
README.zlib \
|
||||
SimGear.dsp \
|
||||
SimGear.dsw \
|
||||
metakit-2.4.2-32.tar.gz \
|
||||
zlib-1.1.3.tar.gz
|
||||
SimGear.dsw
|
||||
|
||||
SUBDIRS = simgear
|
||||
SUBDIRS = src-libs simgear
|
||||
|
||||
#
|
||||
# Rule to build RPM distribution package
|
||||
|
||||
36
NEWS
36
NEWS
@@ -1,10 +1,32 @@
|
||||
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
|
||||
|
||||
* Converted some cout's to SG_LOG's.
|
||||
* xplicitely reset the glBlendFunc() after drawing the moon for the
|
||||
* 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
|
||||
|
||||
@@ -60,6 +82,7 @@ New in 0.0.16
|
||||
ultra-hires tiled screen dumps suitable for large format printers.
|
||||
(Norman Vine)
|
||||
|
||||
|
||||
New in 0.0.15
|
||||
* June 20, 2001
|
||||
* Various bug fixes, tweaks, and optimizations.
|
||||
@@ -88,6 +111,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
|
||||
@@ -109,6 +133,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)
|
||||
@@ -119,6 +144,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.
|
||||
@@ -128,6 +154,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
|
||||
@@ -136,6 +163,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
|
||||
@@ -148,18 +176,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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
For your convenience (and with the author's permission) a copy of the
|
||||
MetaKit source is bundled with SimGear. You must have metakit
|
||||
installed before you can build SimGear.
|
||||
MetaKit source is bundled with SimGear in $(top_srcdir)/src-libs/.
|
||||
You must have metakit installed before you can build SimGear.
|
||||
|
||||
- Most linux distributions have a metakit package. For linux
|
||||
developers, we recommend ysou install your distributions package
|
||||
|
||||
66
README.zlib
66
README.zlib
@@ -1,7 +1,7 @@
|
||||
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. You must have zlib installed before you can
|
||||
build SimGear.
|
||||
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
|
||||
@@ -23,10 +23,11 @@ We now send you to the official zlib README ...
|
||||
|
||||
=============================================================================
|
||||
|
||||
zlib 1.1.3 is a general purpose data compression library. All the code
|
||||
|
||||
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
|
||||
ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate
|
||||
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
|
||||
|
||||
@@ -39,51 +40,50 @@ 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"
|
||||
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@quest.jpl.nasa.gov>, or to
|
||||
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.cdrom.com/pub/infozip/zlib/
|
||||
The official zlib ftp site is ftp://ftp.cdrom.com/pub/infozip/zlib/
|
||||
Before reporting a problem, please check those sites to verify that
|
||||
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.
|
||||
|
||||
Mark Nelson <markn@tiny.com> wrote an article about zlib for the Jan. 1997
|
||||
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://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm
|
||||
http://dogma.net/markn/articles/zlibtool/zlibtool.htm
|
||||
|
||||
The changes made in version 1.1.3 are documented in the file ChangeLog.
|
||||
The main changes since 1.1.2 are:
|
||||
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:
|
||||
|
||||
- fix "an inflate input buffer bug that shows up on rare but persistent
|
||||
occasions" (Mark)
|
||||
- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
|
||||
- fix gzseek(..., SEEK_SET) in write mode
|
||||
- fix crc check after a gzeek (Frank Faubert)
|
||||
- fix miniunzip when the last entry in a zip file is itself a zip file
|
||||
(J Lillge)
|
||||
- add contrib/asm586 and contrib/asm686 (Brian Raiter)
|
||||
See http://www.muppetlabs.com/~breadbox/software/assembly.html
|
||||
- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
|
||||
- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
|
||||
- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
|
||||
- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
|
||||
- added a FAQ file
|
||||
- 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.
|
||||
|
||||
plus many changes for portability.
|
||||
|
||||
Unsupported third party contributions are provided in directory "contrib".
|
||||
|
||||
A Java implementation of zlib is available in the Java Development Kit 1.1
|
||||
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.cdrom.com/pub/infozip/zlib/ for details.
|
||||
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, such as:
|
||||
ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib*
|
||||
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
|
||||
@@ -142,7 +142,7 @@ Acknowledgments:
|
||||
|
||||
Copyright notice:
|
||||
|
||||
(C) 1995-1998 Jean-loup Gailly and Mark Adler
|
||||
(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
|
||||
|
||||
@@ -9,7 +9,7 @@ AC_INIT(simgear/bucket/newbucket.cxx)
|
||||
AC_PREREQ(2.13)
|
||||
|
||||
dnl Initialize the automake stuff
|
||||
AM_INIT_AUTOMAKE(SimGear, 0.0.17pre2)
|
||||
AM_INIT_AUTOMAKE(SimGear, 0.0.18pre1)
|
||||
|
||||
dnl Specify KAI C++ compiler and flags.
|
||||
dnl Borrowed with slight modification from blitz distribution.
|
||||
@@ -292,6 +292,7 @@ fi
|
||||
dnl Check for system installed metakit
|
||||
AC_CHECK_HEADER(mk4.h)
|
||||
if test "x$ac_cv_header_mk4_h" != "xyes"; then
|
||||
echo
|
||||
echo "Metakit not found, you will need to install this first."
|
||||
echo "Please read the README.metakit for more information."
|
||||
exit
|
||||
@@ -303,6 +304,7 @@ 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
|
||||
echo
|
||||
echo "zlib not found, you will need to install this first."
|
||||
echo "Please read the README.zlib for more information."
|
||||
exit
|
||||
@@ -335,6 +337,7 @@ AM_CONFIG_HEADER(simgear/simgear_config.h)
|
||||
AC_OUTPUT( \
|
||||
Makefile \
|
||||
SimGear.spec \
|
||||
src-libs/Makefile \
|
||||
simgear/Makefile \
|
||||
simgear/version.h \
|
||||
simgear/bucket/Makefile \
|
||||
|
||||
Binary file not shown.
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -49,17 +49,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 +157,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,15 +293,27 @@ 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();
|
||||
|
||||
@@ -177,8 +321,8 @@ bool SGBinObject::read_bin( const string& file ) {
|
||||
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;
|
||||
}
|
||||
@@ -307,6 +451,41 @@ bool SGBinObject::read_bin( const string& file ) {
|
||||
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;
|
||||
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]) );
|
||||
}
|
||||
p = Point3D( fptr[0], fptr[1], fptr[2] );
|
||||
// cout << "node = " << p << endl;
|
||||
colors.push_back( p );
|
||||
fptr += 4;
|
||||
}
|
||||
}
|
||||
} else if ( obj_type == SG_NORMAL_LIST ) {
|
||||
// read normal list properties
|
||||
for ( j = 0; j < nproperties; ++j ) {
|
||||
@@ -375,138 +554,23 @@ bool SGBinObject::read_bin( const string& file ) {
|
||||
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
|
||||
|
||||
@@ -554,7 +618,10 @@ 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;
|
||||
@@ -575,6 +642,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 = "
|
||||
@@ -582,7 +651,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
|
||||
@@ -597,9 +668,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;
|
||||
@@ -667,6 +753,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
|
||||
@@ -692,6 +792,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;
|
||||
@@ -710,20 +870,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] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,20 +931,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] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,20 +991,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] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,18 +91,35 @@ 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:
|
||||
|
||||
@@ -117,14 +134,32 @@ public:
|
||||
inline point_list get_wgs84_nodes() const { return wgs84_nodes; }
|
||||
inline void set_wgs84_nodes( point_list n ) { wgs84_nodes = n; }
|
||||
|
||||
inline point_list get_colors() const { return colors; }
|
||||
inline void set_colors( point_list c ) { colors = c; }
|
||||
|
||||
inline point_list get_normals() const { return normals; }
|
||||
inline void set_normals( point_list n ) { normals = n; }
|
||||
|
||||
inline point_list get_texcoords() const { return texcoords; }
|
||||
inline void set_texcoords( point_list t ) { texcoords = t; }
|
||||
|
||||
inline group_list get_pts_v() const { return pts_v; }
|
||||
inline void set_pts_v( group_list g ) { pts_v = g; }
|
||||
inline group_list get_pts_n() const { return pts_n; }
|
||||
inline void set_pts_n( group_list g ) { pts_n = g; }
|
||||
inline group_list get_pts_c() const { return pts_c; }
|
||||
inline void set_pts_c( group_list g ) { pts_c = g; }
|
||||
inline group_list get_pts_tc() const { return pts_tc; }
|
||||
inline void set_pts_tc( group_list g ) { pts_tc = g; }
|
||||
inline string_list get_pt_materials() const { return pt_materials; }
|
||||
inline void set_pt_materials( string_list s ) { pt_materials = s; }
|
||||
|
||||
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_n() const { return tris_n; }
|
||||
inline void set_tris_n( group_list g ) { tris_n = g; }
|
||||
inline group_list get_tris_c() const { return tris_c; }
|
||||
inline void set_tris_c( group_list g ) { tris_c = 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; }
|
||||
@@ -132,6 +167,10 @@ public:
|
||||
|
||||
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_n() const { return strips_n; }
|
||||
inline void set_strips_n( group_list g ) { strips_n = g; }
|
||||
inline group_list get_strips_c() const { return strips_c; }
|
||||
inline void set_strips_c( group_list g ) { strips_c = 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; }
|
||||
@@ -139,6 +178,10 @@ public:
|
||||
|
||||
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_n() const { return fans_n; }
|
||||
inline void set_fans_n( group_list g ) { fans_n = g; }
|
||||
inline group_list get_fans_c() const { return fans_c; }
|
||||
inline void set_fans_c( group_list g ) { fans_c = 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; }
|
||||
|
||||
@@ -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,7 +1293,6 @@ static bool isVisibility( char **visblty, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool vrblVsby( char *string1, char *string2,
|
||||
Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
@@ -1431,9 +1370,6 @@ static bool vrblVsby( char *string1, char *string2,
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isMinMaxWinDir */
|
||||
@@ -1455,7 +1391,6 @@ static bool vrblVsby( char *string1, char *string2,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
static bool isMinMaxWinDir( char *string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -1488,9 +1423,6 @@ static bool isMinMaxWinDir( char *string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isRVR */
|
||||
@@ -1512,7 +1444,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 +1506,6 @@ static bool isRVR( char *token, Decoded_METAR *Mptr, int *NDEX,
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isAltimStng */
|
||||
@@ -1599,7 +1527,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 +1575,6 @@ static bool isAltimStng( char *token, Decoded_METAR *Mptr, int *NDEX )
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTempGroup */
|
||||
@@ -1672,7 +1596,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 +1691,6 @@ static bool isTempGroup( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isWxToken */
|
||||
@@ -1792,9 +1712,8 @@ 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;
|
||||
|
||||
@@ -1807,12 +1726,9 @@ static bool isWxToken( char *token )
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPresentWX */
|
||||
@@ -1834,7 +1750,6 @@ static bool isWxToken( char *token )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isPresentWX( char *token, Decoded_METAR *Mptr,
|
||||
int *NDEX, int *next )
|
||||
@@ -1929,9 +1844,6 @@ static bool isPresentWX( char *token, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isStnID */
|
||||
@@ -1953,7 +1865,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 +1887,6 @@ static bool isStnId( char *stnID, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isCodeName */
|
||||
@@ -2000,7 +1908,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 +1927,6 @@ static bool isCodeName( char *codename, Decoded_METAR *Mptr, int *NDEX)
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isNIL */
|
||||
@@ -2044,7 +1948,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 +1966,6 @@ static bool isNIL( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isAUTO */
|
||||
@@ -2087,7 +1987,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 +2005,6 @@ static bool isAUTO( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isCOR */
|
||||
@@ -2130,7 +2026,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 +2044,6 @@ static bool isCOR ( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTimeUTC */
|
||||
@@ -2173,7 +2065,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 +2119,6 @@ static bool isTimeUTC( char *UTC, Decoded_METAR *Mptr, int *NDEX )
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isWindData */
|
||||
@@ -2252,7 +2140,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 +2209,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 +2233,6 @@ static bool isWindData( char *wind, Decoded_METAR *Mptr, int *NDEX )
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
|
||||
int DcdMETAR( char *string , Decoded_METAR *Mptr )
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
#define SKY1_len 50
|
||||
float fracPart( char * );
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTS_LOC */
|
||||
@@ -48,7 +45,6 @@ float fracPart( char * );
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
static bool isTS_LOC( char **string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
@@ -134,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 */
|
||||
@@ -158,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 )
|
||||
{
|
||||
@@ -217,9 +209,6 @@ static bool isDVR( char *token, Decoded_METAR *Mptr, int *NDEX )
|
||||
}
|
||||
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTornadicActiv */
|
||||
@@ -260,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 )
|
||||
@@ -531,9 +519,6 @@ static bool isTornadicActiv( char **string, Decoded_METAR *Mptr,
|
||||
}
|
||||
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPartObscur */
|
||||
@@ -576,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 )
|
||||
{
|
||||
@@ -677,9 +661,6 @@ static bool isPartObscur( char **string, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isA0indicator */
|
||||
@@ -720,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 )
|
||||
@@ -763,9 +743,6 @@ static bool isA0indicator( char *indicator, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPeakWind */
|
||||
@@ -805,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 )
|
||||
{
|
||||
@@ -898,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 */
|
||||
@@ -940,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)
|
||||
{
|
||||
@@ -1030,9 +1002,6 @@ static bool isWindShift( char **string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTowerVsby */
|
||||
@@ -1071,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)
|
||||
{
|
||||
|
||||
@@ -1186,9 +1154,6 @@ static bool isTowerVsby( char **token, Decoded_METAR *Mptr, int *NDEX)
|
||||
}
|
||||
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isSurfaceVsby */
|
||||
@@ -1227,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)
|
||||
{
|
||||
@@ -1344,9 +1308,6 @@ static bool isSurfaceVsby( char **token, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isVariableVsby */
|
||||
@@ -1386,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 )
|
||||
{
|
||||
@@ -1596,9 +1556,6 @@ static bool isVariableVsby( char **string, Decoded_METAR *Mptr,
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isVsby2ndSite */
|
||||
@@ -1642,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)
|
||||
{
|
||||
@@ -1801,9 +1757,6 @@ static bool isVsby2ndSite( char **token, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isLTGfreq */
|
||||
@@ -1847,7 +1800,6 @@ static bool isVsby2ndSite( char **token, Decoded_METAR *Mptr,
|
||||
/* */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
|
||||
bool static isLTGfreq( char **string, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
@@ -2088,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 */
|
||||
@@ -2141,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 )
|
||||
{
|
||||
@@ -2478,9 +2421,6 @@ static bool isRecentWX( char **token, Decoded_METAR *Mptr,
|
||||
}
|
||||
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isVariableCIG */
|
||||
@@ -2511,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 )
|
||||
{
|
||||
@@ -2544,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 */
|
||||
@@ -2581,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)
|
||||
{
|
||||
@@ -2620,9 +2555,6 @@ static bool isCIG2ndSite( char **token, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPRESFR */
|
||||
@@ -2671,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)
|
||||
{
|
||||
@@ -2688,9 +2619,6 @@ static bool isPRESFR( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
}
|
||||
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPRESRR */
|
||||
@@ -2739,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)
|
||||
{
|
||||
@@ -2757,9 +2684,6 @@ static bool isPRESRR( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isSLP */
|
||||
@@ -2781,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 )
|
||||
{
|
||||
@@ -2855,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 )
|
||||
{
|
||||
@@ -2933,9 +2855,6 @@ static bool isSectorVsby( char **string, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isGR */
|
||||
@@ -2984,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;
|
||||
@@ -3067,9 +2985,6 @@ static bool isGR( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
}
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isVIRGA */
|
||||
@@ -3118,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)
|
||||
{
|
||||
@@ -3154,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 )
|
||||
{
|
||||
@@ -3242,7 +3155,6 @@ static bool isSfcObscuration( char *string, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma page(1)
|
||||
static bool isCeiling( char *string, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
|
||||
@@ -3282,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 };
|
||||
@@ -3386,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 )
|
||||
{
|
||||
@@ -3470,7 +3380,6 @@ static bool isObscurAloft( char **string, Decoded_METAR *Mptr,
|
||||
}
|
||||
|
||||
}
|
||||
#pragma page(1)
|
||||
static bool isNOSPECI( char *string, Decoded_METAR *Mptr, int *NDEX )
|
||||
{
|
||||
|
||||
@@ -3485,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 )
|
||||
{
|
||||
|
||||
@@ -3500,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 */
|
||||
@@ -3524,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 )
|
||||
{
|
||||
@@ -3557,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 )
|
||||
{
|
||||
|
||||
@@ -3596,9 +3499,6 @@ static bool isSNINCR( char **string, Decoded_METAR *Mptr, int *NDEX )
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isSnowDepth */
|
||||
@@ -3620,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 )
|
||||
{
|
||||
@@ -3644,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 )
|
||||
@@ -3666,7 +3564,6 @@ static bool isWaterEquivSnow( char *string,
|
||||
}
|
||||
|
||||
}
|
||||
#pragma page(1)
|
||||
static bool isSunshineDur( char *string, Decoded_METAR *Mptr,
|
||||
int *NDEX )
|
||||
{
|
||||
@@ -3692,9 +3589,6 @@ static bool isSunshineDur( char *string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isHourlyPrecip */
|
||||
@@ -3743,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)
|
||||
@@ -3790,9 +3683,6 @@ static bool isHourlyPrecip( char **string, Decoded_METAR *Mptr,
|
||||
}
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isP6Precip */
|
||||
@@ -3841,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 )
|
||||
@@ -3869,9 +3758,6 @@ static bool isP6Precip( char *string, Decoded_METAR *Mptr,
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isP24Precip */
|
||||
@@ -3920,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 )
|
||||
@@ -3946,9 +3831,6 @@ static bool isP24Precip( char *string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTTdTenths */
|
||||
@@ -3997,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)
|
||||
{
|
||||
@@ -4058,9 +3939,6 @@ static bool isTTdTenths( char *token, Decoded_METAR *Mptr, int *NDEX)
|
||||
}
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isMaxTemp */
|
||||
@@ -4082,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 ];
|
||||
@@ -4122,9 +3999,6 @@ static bool isMaxTemp(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isMinTemp */
|
||||
@@ -4146,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 ];
|
||||
@@ -4185,9 +4058,6 @@ static bool isMinTemp(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isT24MaxMinTemp */
|
||||
@@ -4209,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 )
|
||||
{
|
||||
@@ -4265,9 +4134,6 @@ static bool isT24MaxMinTemp( char *string, Decoded_METAR *Mptr,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPtendency */
|
||||
@@ -4289,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)
|
||||
{
|
||||
@@ -4330,9 +4195,6 @@ static bool isPtendency(char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPWINO */
|
||||
@@ -4354,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)
|
||||
{
|
||||
@@ -4373,9 +4234,6 @@ static bool isPWINO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isPNO */
|
||||
@@ -4397,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)
|
||||
{
|
||||
@@ -4416,9 +4273,6 @@ static bool isPNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isRVRNO */
|
||||
@@ -4440,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)
|
||||
{
|
||||
@@ -4458,9 +4311,6 @@ static bool isRVRNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isCHINO */
|
||||
@@ -4482,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)
|
||||
{
|
||||
@@ -4520,9 +4369,6 @@ static bool isCHINO( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isVISNO */
|
||||
@@ -4544,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)
|
||||
{
|
||||
@@ -4581,9 +4426,6 @@ static bool isVISNO( char **string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isFZRANO */
|
||||
@@ -4605,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)
|
||||
{
|
||||
@@ -4624,9 +4465,6 @@ static bool isFZRANO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isTSNO */
|
||||
@@ -4675,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)
|
||||
{
|
||||
@@ -4693,9 +4530,6 @@ static bool isTSNO( char *string, Decoded_METAR *Mptr, int *NDEX)
|
||||
|
||||
}
|
||||
|
||||
#pragma subtitle(" ")
|
||||
#pragma page(1)
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: isDollarSign */
|
||||
@@ -4717,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 )
|
||||
@@ -4736,9 +4569,6 @@ static bool isDollarSign( char *indicator, Decoded_METAR *Mptr,
|
||||
}
|
||||
}
|
||||
|
||||
#pragma page(1)
|
||||
#pragma subtitle(" ")
|
||||
#pragma subtitle("subtitle - description ")
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Title: DcdMTRmk */
|
||||
@@ -4768,7 +4598,6 @@ static bool isDollarSign( char *indicator, Decoded_METAR *Mptr,
|
||||
/* None. */
|
||||
/* */
|
||||
/********************************************************************/
|
||||
#pragma page(1)
|
||||
void DcdMTRmk( char **token, Decoded_METAR *Mptr )
|
||||
{
|
||||
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -6,6 +6,7 @@ include_HEADERS = \
|
||||
commands.hxx \
|
||||
exception.hxx \
|
||||
props.hxx \
|
||||
props_io.hxx \
|
||||
sg_path.hxx \
|
||||
sgstream.hxx \
|
||||
stopwatch.hxx \
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// $Id$
|
||||
|
||||
#include "commands.hxx"
|
||||
#include "props_io.hxx"
|
||||
|
||||
|
||||
|
||||
@@ -90,74 +91,4 @@ SGCommandMgr::execute (const string &name, const SGPropertyNode * arg,
|
||||
return (*command)(arg, state);
|
||||
}
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
@@ -150,104 +150,6 @@ public:
|
||||
const SGPropertyNode * arg,
|
||||
SGCommandState ** state) 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;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,23 +12,38 @@
|
||||
#ifndef __PROPS_HXX
|
||||
#define __PROPS_HXX
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#ifndef PROPS_STANDALONE
|
||||
#define PROPS_STANDALONE 0
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include STL_STRING
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include STL_IOSTREAM
|
||||
|
||||
#if PROPS_STANDALONE
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::istream;
|
||||
using std::ostream;
|
||||
|
||||
#else
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include STL_STRING
|
||||
#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
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NONE
|
||||
#pragma warn A sloppy coder has defined NONE as a macro!
|
||||
#undef NONE
|
||||
@@ -82,40 +97,50 @@ SG_USING_STD(ostream);
|
||||
// This is the mechanism that information-providing routines can
|
||||
// use to link their own values to the property manager. Any
|
||||
// SGValue can be tied to a raw value and then untied again.
|
||||
//
|
||||
// Note: we are forced to use inlined methods here to ensure
|
||||
// that the templates will be instantiated. We're probably taking
|
||||
// a small performance hit for that.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* Abstract base class for a raw value.
|
||||
*
|
||||
* The property manager is implemented in three layers. The {@link
|
||||
* <p>The property manager is implemented in two layers. The {@link
|
||||
* SGPropertyNode} is the highest and most abstract layer,
|
||||
* representing * an LValue/RValue pair: it * records the position
|
||||
* of the property in the property tree and * contains facilities
|
||||
* for navigation to other nodes. Each node * may contain an {@link
|
||||
* SGValue}, which is guaranteed persistent: the * {@link SGValue}
|
||||
* will not change during a session, even if the * property is bound
|
||||
* and unbound multiple times. The SGValue is the * abstraction of
|
||||
* an RValue: it allows for conversion among all of the different
|
||||
* types, and can be bound to external pointers, functions, methods,
|
||||
* or other data sources. Every SGValue contains an SGRawValue of
|
||||
* a specific type. The SGRawValue (this class) may change frequently
|
||||
* during a session as a value is retyped or bound and unbound to
|
||||
* various data source, but the abstract SGValue layer insulates
|
||||
* the application from those changes. The raw value contains no
|
||||
* facilities for data binding or for type conversion: it is simply
|
||||
* the abstraction of a primitive data type (or a compound data
|
||||
* type, in the case of a string).
|
||||
* representing an LValue/RValue pair: it records the position of the
|
||||
* property in the property tree and contains facilities for
|
||||
* navigation to other nodes. It is guaranteed to be persistent: the
|
||||
* {@link SGPropertyNode} will not change during a session, even if
|
||||
* the property is bound and unbound multiple times.</p>
|
||||
*
|
||||
* The SGValue class always keeps a *copy* of a raw value, not the
|
||||
* original one passed to it; if you override a derived class but do
|
||||
* not replace the {@link #clone} method, strange things will happen.
|
||||
* <p>When the property value is not managed internally in the
|
||||
* SGPropertyNode, the SGPropertyNode will contain a reference to an
|
||||
* SGRawValue (this class), which provides an abstract way to get,
|
||||
* set, and clone the underlying value. The SGRawValue may change
|
||||
* frequently during a session as a value is retyped or bound and
|
||||
* unbound to various data source, but the abstract SGPropertyNode
|
||||
* layer insulates the application from those changes. The raw value
|
||||
* contains no facilities for data binding or for type conversion: it
|
||||
* is simply the abstraction of a primitive data type (or a compound
|
||||
* data type, in the case of a string).</p>
|
||||
*
|
||||
* All raw values must implement {@link #getValue}, {@link #setValue},
|
||||
* and {@link #clone} for the appropriate type.
|
||||
* <p>The SGPropertyNode class always keeps a *copy* of a raw value,
|
||||
* not the original one passed to it; if you override a derived class
|
||||
* but do not replace the {@link #clone} method, strange things will
|
||||
* happen.</p>
|
||||
*
|
||||
* @see SGValue
|
||||
* @see SGPropertyNode */
|
||||
* <p>All derived SGRawValue classes must implement {@link #getValue},
|
||||
* {@link #setValue}, and {@link #clone} for the appropriate type.</p>
|
||||
*
|
||||
* @see SGPropertyNode
|
||||
* @see SGRawValuePointer
|
||||
* @see SGRawValueFunctions
|
||||
* @see SGRawValueFunctionsIndexed
|
||||
* @see SGRawValueMethods
|
||||
* @see SGRawValueMethodsIndexed
|
||||
*/
|
||||
template <class T>
|
||||
class SGRawValue
|
||||
{
|
||||
@@ -183,61 +208,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* An unbound raw value, stored internally.
|
||||
*
|
||||
* Instances of this class are created automatically, by default,
|
||||
* by the SGValue class; ordinarily the application should not
|
||||
* need to touch it.
|
||||
*/
|
||||
template <class T>
|
||||
class SGRawValueInternal : public SGRawValue<T>
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*
|
||||
* Initialize with the default value for this type.
|
||||
*/
|
||||
SGRawValueInternal () {}
|
||||
|
||||
/**
|
||||
* Explicit value constructor.
|
||||
*
|
||||
* Initialize with the underlying value provided.
|
||||
*
|
||||
* @param value The initial value for this property.
|
||||
*/
|
||||
SGRawValueInternal (T value) : _value(value) {}
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
virtual ~SGRawValueInternal () {}
|
||||
|
||||
/**
|
||||
* Get the underlying value.
|
||||
*/
|
||||
virtual T getValue () const { return _value; }
|
||||
|
||||
/**
|
||||
* Set the underlying value.
|
||||
*/
|
||||
virtual bool setValue (T value) { _value = value; return true; }
|
||||
|
||||
/**
|
||||
* Create a deep copy of this raw value.
|
||||
*/
|
||||
virtual SGRawValue<T> * clone () const {
|
||||
return new SGRawValueInternal<T>(_value);
|
||||
}
|
||||
|
||||
private:
|
||||
T _value;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A raw value bound to a pointer.
|
||||
*
|
||||
@@ -382,6 +352,8 @@ private:
|
||||
* not have a getter. An indexed value is useful for binding one
|
||||
* of a list of possible values (such as multiple engines for a
|
||||
* plane). The index is hard-coded at creation time.
|
||||
*
|
||||
* @see SGRawValue
|
||||
*/
|
||||
template <class T>
|
||||
class SGRawValueFunctionsIndexed : public SGRawValue<T>
|
||||
@@ -484,9 +456,14 @@ private:
|
||||
*/
|
||||
class SGPropertyNode
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Public constants.
|
||||
*/
|
||||
enum {
|
||||
MAX_STRING_LEN = 1024
|
||||
};
|
||||
|
||||
/**
|
||||
* Property value types.
|
||||
@@ -551,7 +528,7 @@ public:
|
||||
/**
|
||||
* Get the node's simple (XML) name.
|
||||
*/
|
||||
const string &getName () const { return _name; }
|
||||
const char * getName () const { return _name; }
|
||||
|
||||
|
||||
/**
|
||||
@@ -598,26 +575,26 @@ public:
|
||||
/**
|
||||
* Get a child node by name and index.
|
||||
*/
|
||||
SGPropertyNode * getChild (const string &name, int index = 0,
|
||||
SGPropertyNode * getChild (const char * name, int index = 0,
|
||||
bool create = false);
|
||||
|
||||
|
||||
/**
|
||||
* Get a const child node by name and index.
|
||||
*/
|
||||
const SGPropertyNode * getChild (const string &name, int index = 0) const;
|
||||
const SGPropertyNode * getChild (const char * name, int index = 0) const;
|
||||
|
||||
|
||||
/**
|
||||
* Get a vector of all children with the specified name.
|
||||
*/
|
||||
vector<SGPropertyNode *> getChildren (const string &name);
|
||||
vector<SGPropertyNode *> getChildren (const char * name);
|
||||
|
||||
|
||||
/**
|
||||
* Get a vector all all children (const) with the specified name.
|
||||
*/
|
||||
vector<const SGPropertyNode *> getChildren (const string &name) const;
|
||||
vector<const SGPropertyNode *> getChildren (const char * name) const;
|
||||
|
||||
|
||||
//
|
||||
@@ -634,7 +611,7 @@ public:
|
||||
/**
|
||||
* Alias this node's leaf value to another's by relative path.
|
||||
*/
|
||||
bool alias (const string &path);
|
||||
bool alias (const char * path);
|
||||
|
||||
|
||||
/**
|
||||
@@ -669,7 +646,7 @@ public:
|
||||
/**
|
||||
* Get the path to this node from the root.
|
||||
*/
|
||||
string getPath (bool simplify = false) const;
|
||||
const char * getPath (bool simplify = false) const;
|
||||
|
||||
|
||||
/**
|
||||
@@ -687,7 +664,7 @@ public:
|
||||
/**
|
||||
* Get a pointer to another node by relative path.
|
||||
*/
|
||||
SGPropertyNode * getNode (const string &relative_path, bool create = false);
|
||||
SGPropertyNode * getNode (const char * relative_path, bool create = false);
|
||||
|
||||
|
||||
/**
|
||||
@@ -700,14 +677,14 @@ public:
|
||||
* provided overrides any given in the path itself for the last
|
||||
* component.
|
||||
*/
|
||||
SGPropertyNode * getNode (const string &relative_path, int index,
|
||||
SGPropertyNode * getNode (const char * relative_path, int index,
|
||||
bool create = false);
|
||||
|
||||
|
||||
/**
|
||||
* Get a const pointer to another node by relative path.
|
||||
*/
|
||||
const SGPropertyNode * getNode (const string &relative_path) const;
|
||||
const SGPropertyNode * getNode (const char * relative_path) const;
|
||||
|
||||
|
||||
/**
|
||||
@@ -716,7 +693,7 @@ public:
|
||||
* This method leaves the index off the last member of the path,
|
||||
* so that the user can specify it separate.
|
||||
*/
|
||||
const SGPropertyNode * getNode (const string &relative_path,
|
||||
const SGPropertyNode * getNode (const char * relative_path,
|
||||
int index) const;
|
||||
|
||||
|
||||
@@ -794,7 +771,7 @@ public:
|
||||
/**
|
||||
* Get a string value for this node.
|
||||
*/
|
||||
string getStringValue () const;
|
||||
const char * getStringValue () const;
|
||||
|
||||
|
||||
|
||||
@@ -831,13 +808,13 @@ public:
|
||||
/**
|
||||
* Set a string value for this node.
|
||||
*/
|
||||
bool setStringValue (string value);
|
||||
bool setStringValue (const char * value);
|
||||
|
||||
|
||||
/**
|
||||
* Set a value of unspecified type for this node.
|
||||
*/
|
||||
bool setUnspecifiedValue (string value);
|
||||
bool setUnspecifiedValue (const char * value);
|
||||
|
||||
|
||||
//
|
||||
@@ -884,7 +861,7 @@ public:
|
||||
/**
|
||||
* Bind this node to an external string source.
|
||||
*/
|
||||
bool tie (const SGRawValue<string> &rawValue, bool useDefault = true);
|
||||
bool tie (const SGRawValue<const char *> &rawValue, bool useDefault = true);
|
||||
|
||||
|
||||
/**
|
||||
@@ -902,151 +879,151 @@ public:
|
||||
/**
|
||||
* Get another node's type.
|
||||
*/
|
||||
Type getType (const string &relative_path) const;
|
||||
Type getType (const char * relative_path) const;
|
||||
|
||||
|
||||
/**
|
||||
* Test whether another node has a leaf value.
|
||||
*/
|
||||
bool hasValue (const string &relative_path) const;
|
||||
bool hasValue (const char * relative_path) const;
|
||||
|
||||
|
||||
/**
|
||||
* Get another node's value as a bool.
|
||||
*/
|
||||
bool getBoolValue (const string &relative_path,
|
||||
bool getBoolValue (const char * relative_path,
|
||||
bool defaultValue = false) const;
|
||||
|
||||
|
||||
/**
|
||||
* Get another node's value as an int.
|
||||
*/
|
||||
int getIntValue (const string &relative_path,
|
||||
int getIntValue (const char * relative_path,
|
||||
int defaultValue = 0) const;
|
||||
|
||||
|
||||
/**
|
||||
* Get another node's value as a long int.
|
||||
*/
|
||||
long getLongValue (const string &relative_path,
|
||||
long getLongValue (const char * relative_path,
|
||||
long defaultValue = 0L) const;
|
||||
|
||||
|
||||
/**
|
||||
* Get another node's value as a float.
|
||||
*/
|
||||
float getFloatValue (const string &relative_path,
|
||||
float getFloatValue (const char * relative_path,
|
||||
float defaultValue = 0.0) const;
|
||||
|
||||
|
||||
/**
|
||||
* Get another node's value as a double.
|
||||
*/
|
||||
double getDoubleValue (const string &relative_path,
|
||||
double getDoubleValue (const char * relative_path,
|
||||
double defaultValue = 0.0L) const;
|
||||
|
||||
|
||||
/**
|
||||
* Get another node's value as a string.
|
||||
*/
|
||||
string getStringValue (const string &relative_path,
|
||||
string defaultValue = "") const;
|
||||
const char * getStringValue (const char * relative_path,
|
||||
const char * defaultValue = "") const;
|
||||
|
||||
|
||||
/**
|
||||
* Set another node's value as a bool.
|
||||
*/
|
||||
bool setBoolValue (const string &relative_path, bool value);
|
||||
bool setBoolValue (const char * relative_path, bool value);
|
||||
|
||||
|
||||
/**
|
||||
* Set another node's value as an int.
|
||||
*/
|
||||
bool setIntValue (const string &relative_path, int value);
|
||||
bool setIntValue (const char * relative_path, int value);
|
||||
|
||||
|
||||
/**
|
||||
* Set another node's value as a long int.
|
||||
*/
|
||||
bool setLongValue (const string &relative_path, long value);
|
||||
bool setLongValue (const char * relative_path, long value);
|
||||
|
||||
|
||||
/**
|
||||
* Set another node's value as a float.
|
||||
*/
|
||||
bool setFloatValue (const string &relative_path, float value);
|
||||
bool setFloatValue (const char * relative_path, float value);
|
||||
|
||||
|
||||
/**
|
||||
* Set another node's value as a double.
|
||||
*/
|
||||
bool setDoubleValue (const string &relative_path, double value);
|
||||
bool setDoubleValue (const char * relative_path, double value);
|
||||
|
||||
|
||||
/**
|
||||
* Set another node's value as a string.
|
||||
*/
|
||||
bool setStringValue (const string &relative_path, string value);
|
||||
bool setStringValue (const char * relative_path, const char * value);
|
||||
|
||||
|
||||
/**
|
||||
* Set another node's value with no specified type.
|
||||
*/
|
||||
bool setUnspecifiedValue (const string &relative_path, string value);
|
||||
bool setUnspecifiedValue (const char * relative_path, const char * value);
|
||||
|
||||
|
||||
/**
|
||||
* Test whether another node is bound to an external data source.
|
||||
*/
|
||||
bool isTied (const string &relative_path) const;
|
||||
bool isTied (const char * relative_path) const;
|
||||
|
||||
|
||||
/**
|
||||
* Bind another node to an external bool source.
|
||||
*/
|
||||
bool tie (const string &relative_path, const SGRawValue<bool> &rawValue,
|
||||
bool tie (const char * relative_path, const SGRawValue<bool> &rawValue,
|
||||
bool useDefault = true);
|
||||
|
||||
|
||||
/**
|
||||
* Bind another node to an external int source.
|
||||
*/
|
||||
bool tie (const string &relative_path, const SGRawValue<int> &rawValue,
|
||||
bool tie (const char * relative_path, const SGRawValue<int> &rawValue,
|
||||
bool useDefault = true);
|
||||
|
||||
|
||||
/**
|
||||
* Bind another node to an external long int source.
|
||||
*/
|
||||
bool tie (const string &relative_path, const SGRawValue<long> &rawValue,
|
||||
bool tie (const char * relative_path, const SGRawValue<long> &rawValue,
|
||||
bool useDefault = true);
|
||||
|
||||
|
||||
/**
|
||||
* Bind another node to an external float source.
|
||||
*/
|
||||
bool tie (const string &relative_path, const SGRawValue<float> &rawValue,
|
||||
bool tie (const char * relative_path, const SGRawValue<float> &rawValue,
|
||||
bool useDefault = true);
|
||||
|
||||
|
||||
/**
|
||||
* Bind another node to an external double source.
|
||||
*/
|
||||
bool tie (const string &relative_path, const SGRawValue<double> &rawValue,
|
||||
bool tie (const char * relative_path, const SGRawValue<double> &rawValue,
|
||||
bool useDefault = true);
|
||||
|
||||
|
||||
/**
|
||||
* Bind another node to an external string source.
|
||||
*/
|
||||
bool tie (const string &relative_path, const SGRawValue<string> &rawValue,
|
||||
bool tie (const char * relative_path, const SGRawValue<const char *> &rawValue,
|
||||
bool useDefault = true);
|
||||
|
||||
|
||||
/**
|
||||
* Unbind another node from any external data source.
|
||||
*/
|
||||
bool untie (const string &relative_path);
|
||||
bool untie (const char * relative_path);
|
||||
|
||||
|
||||
protected:
|
||||
@@ -1055,11 +1032,27 @@ protected:
|
||||
/**
|
||||
* Protected constructor for making new nodes on demand.
|
||||
*/
|
||||
SGPropertyNode (const string &name, int index, SGPropertyNode * parent);
|
||||
SGPropertyNode (const char * name, int index, SGPropertyNode * parent);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Get the raw value
|
||||
bool get_bool () const;
|
||||
int get_int () const;
|
||||
long get_long () const;
|
||||
float get_float () const;
|
||||
double get_double () const;
|
||||
const char * get_string () const;
|
||||
|
||||
// Set the raw value
|
||||
bool set_bool (bool value);
|
||||
bool set_int (int value);
|
||||
bool set_long (long value);
|
||||
bool set_float (float value);
|
||||
bool set_double (double value);
|
||||
bool set_string (const char * value);
|
||||
|
||||
|
||||
/**
|
||||
* Clear any existing value and set the type to NONE.
|
||||
@@ -1070,26 +1063,29 @@ private:
|
||||
/**
|
||||
* Get the value as a string.
|
||||
*/
|
||||
string get_string () const;
|
||||
const char * make_string () const;
|
||||
|
||||
|
||||
/**
|
||||
* Trace a read access.
|
||||
*/
|
||||
void trace_read (Type accessType) const;
|
||||
void trace_read () const;
|
||||
|
||||
|
||||
/**
|
||||
* Trace a write access.
|
||||
*/
|
||||
void trace_write (Type accessType) const;
|
||||
void trace_write () const;
|
||||
|
||||
string _name;
|
||||
mutable char _buffer[MAX_STRING_LEN+1];
|
||||
|
||||
class hash_table;
|
||||
|
||||
char * _name;
|
||||
int _index;
|
||||
SGPropertyNode * _parent;
|
||||
vector<SGPropertyNode *> _children;
|
||||
typedef map<const string,SGPropertyNode *> cache_map;
|
||||
cache_map * _path_cache;
|
||||
hash_table * _path_cache;
|
||||
Type _type;
|
||||
bool _tied;
|
||||
int _attr;
|
||||
@@ -1102,49 +1098,70 @@ private:
|
||||
SGRawValue<long> * long_val;
|
||||
SGRawValue<float> * float_val;
|
||||
SGRawValue<double> * double_val;
|
||||
SGRawValue<string> * string_val;
|
||||
SGRawValue<const char *> * string_val;
|
||||
} _value;
|
||||
|
||||
|
||||
};
|
||||
union {
|
||||
bool bool_val;
|
||||
int int_val;
|
||||
long long_val;
|
||||
float float_val;
|
||||
double double_val;
|
||||
char * string_val;
|
||||
} _local_val;
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// I/O functions.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* A very simple hash table with no remove functionality.
|
||||
*/
|
||||
class hash_table {
|
||||
public:
|
||||
|
||||
/**
|
||||
* An entry in a bucket in a hash table.
|
||||
*/
|
||||
class entry {
|
||||
public:
|
||||
entry ();
|
||||
virtual ~entry ();
|
||||
virtual const char * get_key () { return _key; }
|
||||
virtual void set_key (const char * key);
|
||||
virtual SGPropertyNode * get_value () { return _value; }
|
||||
virtual void set_value (SGPropertyNode * value);
|
||||
private:
|
||||
char * _key;
|
||||
SGPropertyNode * _value;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Read properties from an XML input stream.
|
||||
*/
|
||||
void readProperties (istream &input, SGPropertyNode * start_node,
|
||||
const string &base = "");
|
||||
/**
|
||||
* A bucket in a hash table.
|
||||
*/
|
||||
class bucket {
|
||||
public:
|
||||
bucket ();
|
||||
virtual ~bucket ();
|
||||
virtual entry * get_entry (const char * key, bool create = false);
|
||||
private:
|
||||
int _length;
|
||||
entry ** _entries;
|
||||
};
|
||||
|
||||
friend class bucket;
|
||||
|
||||
/**
|
||||
* Read properties from an XML file.
|
||||
*/
|
||||
void readProperties (const string &file, SGPropertyNode * start_node);
|
||||
hash_table ();
|
||||
virtual ~hash_table ();
|
||||
virtual SGPropertyNode * get (const char * key);
|
||||
virtual void put (const char * key, SGPropertyNode * value);
|
||||
|
||||
private:
|
||||
unsigned int hashcode (const char * key);
|
||||
unsigned int _data_length;
|
||||
bucket ** _data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Write properties to an XML output stream.
|
||||
*/
|
||||
void writeProperties (ostream &output, const SGPropertyNode * start_node);
|
||||
|
||||
|
||||
/**
|
||||
* Write properties to an XML file.
|
||||
*/
|
||||
void writeProperties (const string &file, const SGPropertyNode * start_node);
|
||||
|
||||
|
||||
/**
|
||||
* Copy properties from one node to another.
|
||||
*/
|
||||
bool copyProperties (const SGPropertyNode *in, SGPropertyNode *out);
|
||||
|
||||
};
|
||||
|
||||
#endif // __PROPS_HXX
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -234,9 +235,9 @@ 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);
|
||||
ret = st.node->setStringValue(_data.c_str());
|
||||
} else if (st.type == "unspecified") {
|
||||
ret = st.node->setUnspecifiedValue(_data);
|
||||
ret = st.node->setUnspecifiedValue(_data.c_str());
|
||||
} else {
|
||||
string message = "Unrecognized data type '";
|
||||
message += st.type;
|
||||
@@ -343,6 +344,9 @@ getTypeName (SGPropertyNode::Type type)
|
||||
return "double";
|
||||
case SGPropertyNode::STRING:
|
||||
return "string";
|
||||
case SGPropertyNode::ALIAS:
|
||||
case SGPropertyNode::NONE:
|
||||
return "unspecified";
|
||||
}
|
||||
|
||||
// keep the compiler from squawking
|
||||
@@ -425,21 +429,21 @@ isArchivable (const SGPropertyNode * node)
|
||||
|
||||
|
||||
static bool
|
||||
writeNode (ostream &output, const SGPropertyNode * node, int indent)
|
||||
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 (!isArchivable(node))
|
||||
if (!write_all && !isArchivable(node))
|
||||
return true; // Everything's OK, but we won't write.
|
||||
|
||||
const string &name = node->getName();
|
||||
int index = node->getIndex();
|
||||
const string name = node->getName();
|
||||
int nChildren = node->nChildren();
|
||||
|
||||
// If there is a literal value,
|
||||
// write it first.
|
||||
if (node->hasValue() && node->getAttribute(SGPropertyNode::ARCHIVE)) {
|
||||
if (node->hasValue() && (write_all || node->getAttribute(SGPropertyNode::ARCHIVE))) {
|
||||
doIndent(output, indent);
|
||||
output << '<' << name;
|
||||
writeAtts(output, node);
|
||||
@@ -455,15 +459,14 @@ 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;
|
||||
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;
|
||||
}
|
||||
@@ -473,7 +476,8 @@ writeNode (ostream &output, const SGPropertyNode * node, int indent)
|
||||
|
||||
|
||||
void
|
||||
writeProperties (ostream &output, const SGPropertyNode * start_node)
|
||||
writeProperties (ostream &output, const SGPropertyNode * start_node,
|
||||
bool write_all)
|
||||
{
|
||||
int nChildren = start_node->nChildren();
|
||||
|
||||
@@ -481,7 +485,7 @@ 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;
|
||||
@@ -489,11 +493,12 @@ writeProperties (ostream &output, const SGPropertyNode * start_node)
|
||||
|
||||
|
||||
void
|
||||
writeProperties (const string &file, const SGPropertyNode * start_node)
|
||||
writeProperties (const string &file, const SGPropertyNode * start_node,
|
||||
bool write_all)
|
||||
{
|
||||
ofstream output(file.c_str());
|
||||
if (output.good()) {
|
||||
writeProperties(output, start_node);
|
||||
writeProperties(output, start_node, write_all);
|
||||
} else {
|
||||
throw sg_io_exception("Cannot open file", sg_location(file));
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -52,7 +53,7 @@ static double getNum (int index) { return 1.0 / index; }
|
||||
static void
|
||||
show_values (const SGPropertyNode * node)
|
||||
{
|
||||
cout << "Bool: " << node->getBoolValue() << endl;
|
||||
cout << "Bool: " << (node->getBoolValue() ? "true" : "false") << endl;
|
||||
cout << "Int: " << node->getIntValue() << endl;
|
||||
cout << "Float: " << node->getFloatValue() << endl;
|
||||
cout << "Double: " << node->getDoubleValue() << endl;
|
||||
@@ -274,7 +275,7 @@ test_value ()
|
||||
static void
|
||||
dump_node (const SGPropertyNode * node)
|
||||
{
|
||||
writeProperties(cout, node);
|
||||
writeProperties(cout, node, true);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -332,11 +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;
|
||||
readProperties(av[i], &root);
|
||||
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;
|
||||
|
||||
@@ -224,8 +224,8 @@ ssgBranch * SGSkyDome::build( ) {
|
||||
lower_ring_cl->add( color );
|
||||
|
||||
// force a repaint of the sky colors with ugly defaults
|
||||
sgVec3 fog_color;
|
||||
sgSetVec3( fog_color, 1.0, 1.0, 1.0 );
|
||||
sgVec4 fog_color;
|
||||
sgSetVec4( fog_color, 1.0, 1.0, 1.0, 1.0 );
|
||||
repaint( color, fog_color, 0.0, 5000.0 );
|
||||
|
||||
// build the ssg scene graph sub tree for the sky and connected
|
||||
@@ -342,6 +342,7 @@ bool SGSkyDome::repaint( sgVec4 sky_color, sgVec4 fog_color, double sun_angle,
|
||||
diff = sky_color[j] - fog_color[j];
|
||||
center_color[j] = sky_color[j] - diff * ( 1.0 - vis_factor );
|
||||
}
|
||||
center_color[3] = 1.0;
|
||||
|
||||
for ( i = 0; i < 6; i++ ) {
|
||||
for ( j = 0; j < 3; j++ ) {
|
||||
|
||||
@@ -88,7 +88,7 @@ void SGTime::init( double lon, double lat,
|
||||
cout << "Current local time = "
|
||||
<< asctime(localtime(&cur_time)) << endl;
|
||||
|
||||
if ( root != (string)"" ) {
|
||||
if ( !root.empty()) {
|
||||
SGPath zone( root );
|
||||
zone.append( "zone.tab" );
|
||||
SG_LOG( SG_EVENT, SG_INFO, "Reading timezone info from: "
|
||||
@@ -136,7 +136,7 @@ SGTime::~SGTime()
|
||||
if ( zonename != NULL ) {
|
||||
char *tmp = zonename;
|
||||
zonename = NULL;
|
||||
delete tmp;
|
||||
free(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ void SGTime::updateLocal( double lon, double lat, const string& root ) {
|
||||
if ( zonename ) {
|
||||
char *ptr = zonename;
|
||||
zonename = NULL;
|
||||
delete ptr;
|
||||
free(ptr);
|
||||
}
|
||||
zonename = strdup( zone.c_str() );
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ void SGTimeStamp::stamp() {
|
||||
|
||||
// increment the time stamp by the number of microseconds (usec)
|
||||
SGTimeStamp operator + (const SGTimeStamp& t, const long& m) {
|
||||
#ifdef WIN32
|
||||
#if defined( WIN32 )
|
||||
return SGTimeStamp( 0, t.usec + m );
|
||||
#else
|
||||
return SGTimeStamp( t.seconds + ( t.usec + m ) / 1000000,
|
||||
|
||||
@@ -62,13 +62,16 @@ Timezone::Timezone(const char *infoString) :
|
||||
char sign;
|
||||
sign = latlon[0];
|
||||
strncpy(buffer, &latlon[1], 2);
|
||||
buffer[2] = 0;
|
||||
lat = atof(buffer);
|
||||
strncpy(buffer, &latlon[3], 2);
|
||||
buffer[2] = 0;
|
||||
lat += (atof(buffer) / 60);
|
||||
int nextPos;
|
||||
if (strlen(latlon) > 12) {
|
||||
nextPos = 7;
|
||||
strncpy(buffer, &latlon[5], 2);
|
||||
buffer[2] = 0;
|
||||
lat += (atof(buffer) / 3600.0);
|
||||
} else {
|
||||
nextPos = 5;
|
||||
@@ -80,6 +83,7 @@ Timezone::Timezone(const char *infoString) :
|
||||
sign = latlon[nextPos];
|
||||
nextPos++;
|
||||
strncpy(buffer, &latlon[nextPos], 3);
|
||||
buffer[3] = 0;
|
||||
lon = atof(buffer);
|
||||
nextPos += 3;
|
||||
strncpy(buffer, &latlon[nextPos], 2);
|
||||
@@ -89,6 +93,7 @@ Timezone::Timezone(const char *infoString) :
|
||||
if (strlen(latlon) > 12) {
|
||||
nextPos += 2;
|
||||
strncpy(buffer, &latlon[nextPos], 2);
|
||||
buffer[2] = 0;
|
||||
lon += (atof (buffer) / 3600.00);
|
||||
}
|
||||
if (sign == '-') {
|
||||
@@ -136,10 +141,11 @@ TimezoneContainer::TimezoneContainer(const char *filename)
|
||||
if( buffer[0] == '#' )
|
||||
continue;
|
||||
#else
|
||||
for (int i = 0; i < 256; i++) {
|
||||
if (buffer[i] == '#') {
|
||||
buffer[i] = 0;
|
||||
}
|
||||
for (char *p = buffer; *p; p++) {
|
||||
if (*p == '#') {
|
||||
*p = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (buffer[0]) {
|
||||
|
||||
@@ -190,7 +190,6 @@ static Processor prologInitProcessor;
|
||||
static Processor contentProcessor;
|
||||
static Processor cdataSectionProcessor;
|
||||
static Processor epilogProcessor;
|
||||
static Processor errorProcessor;
|
||||
static Processor externalEntityInitProcessor;
|
||||
static Processor externalEntityInitProcessor2;
|
||||
static Processor externalEntityInitProcessor3;
|
||||
@@ -2333,15 +2332,6 @@ enum XML_Error epilogProcessor(XML_Parser parser,
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
enum XML_Error errorProcessor(XML_Parser parser,
|
||||
const char *s,
|
||||
const char *end,
|
||||
const char **nextPtr)
|
||||
{
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
static enum XML_Error
|
||||
storeAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
|
||||
const char *ptr, const char *end,
|
||||
@@ -2483,7 +2473,6 @@ enum XML_Error storeEntityValue(XML_Parser parser,
|
||||
const char *entityTextPtr,
|
||||
const char *entityTextEnd)
|
||||
{
|
||||
const ENCODING *internalEnc = ns ? XmlGetInternalEncodingNS() : XmlGetInternalEncoding();
|
||||
STRING_POOL *pool = &(dtd.pool);
|
||||
entityTextPtr += encoding->minBytesPerChar;
|
||||
entityTextEnd -= encoding->minBytesPerChar;
|
||||
|
||||
@@ -1491,7 +1491,7 @@ int initScan(const ENCODING **encodingTable,
|
||||
break;
|
||||
}
|
||||
}
|
||||
*encPtr = encodingTable[INIT_ENC_INDEX(enc)];
|
||||
*encPtr = encodingTable[(int)INIT_ENC_INDEX(enc)];
|
||||
return XmlTok(*encPtr, state, ptr, end, nextTokPtr);
|
||||
}
|
||||
|
||||
|
||||
4
src-libs/Makefile.am
Normal file
4
src-libs/Makefile.am
Normal file
@@ -0,0 +1,4 @@
|
||||
EXTRA_DIST = \
|
||||
boost.tar.gz \
|
||||
metakit-2.4.3-33.tar.gz \
|
||||
zlib-1.1.4.tar.gz
|
||||
BIN
src-libs/metakit-2.4.3-33.tar.gz
Normal file
BIN
src-libs/metakit-2.4.3-33.tar.gz
Normal file
Binary file not shown.
BIN
src-libs/zlib-1.1.4.tar.gz
Normal file
BIN
src-libs/zlib-1.1.4.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user