Compare commits

..

39 Commits

Author SHA1 Message Date
curt
bb882a1239 Borland C++ tweaks.
MacOS/Metrowerks tweaks.
Fix for fgText default constructor.
1999-06-20 01:52:31 +00:00
curt
6b2bf2fa8e Fixed a bug in handling windoze driver letter ":" notation. 1999-06-15 19:55:10 +00:00
curt
2640b43355 Add a method to return pointer to data array. 1999-06-12 21:09:41 +00:00
curt
d201e9b5c5 The next round of MacOS changes contributed by Darrell Walisser.
Starting work on fixing tringle slivers in scenery generation tools.
1999-06-05 12:45:40 +00:00
curt
8f0f79506c Mac portability changes contributed by "Darrell Walisser" <dwaliss1@purdue.edu> 1999-06-02 22:22:47 +00:00
curt
121d2f92cb Fixed an IRIX warning message where an inline function is referenced
before it is defined.
1999-06-01 21:16:33 +00:00
curt
87e641aeda Update README.plib with clearer wording.
Fixed the == compare in point3d.hxx.
1999-06-01 21:01:03 +00:00
curt
27403e2fef Whups, fixed a simple bug so you can now fly across the lon = +/-180
boundary without any problems.
1999-05-25 11:54:21 +00:00
curt
b5ceef5e68 Moved material property and texture management back to Simulator/Objects/ 1999-05-13 02:10:52 +00:00
curt
5d68470c95 Major shuffling to push basic material management out into FlightGear/Lib/
so it can be accessible from the scenery tools.
Also implimented JIT texture loading to save start time and memory.
1999-05-12 04:24:55 +00:00
curt
e176b4d8b6 Borland portability fixes contributed by Charlie Hotchkiss. 1999-05-08 02:33:13 +00:00
curt
218821f694 Tweaks for poles. 1999-05-06 02:27:24 +00:00
curt
a8f4a61dc2 Removed the test program for now ... 1999-04-27 19:37:09 +00:00
curt
9221604424 Changes for the MacOS port contributed by Darrell Walisser. 1999-04-27 19:27:45 +00:00
curt
5bddbd0ca9 MacOS portability improvements.
Added a class to encapsulate Mac vs. Unix path separator differences.
1999-04-27 15:56:22 +00:00
curt
f8dde93e05 MacOS portability improvements. 1999-04-27 15:54:39 +00:00
curt
489b562232 Borland tweak. 1999-04-22 18:46:40 +00:00
curt
294a0dde63 MAT3mat.c: Borland tweaks.
mat3.h:  Some inline assembly from Norman.
1999-04-22 18:46:27 +00:00
curt
53fbb98d4f Removed plib from the source distribution. It must be built and installed
separately before fgfs can be built and installed.
1999-04-12 02:03:32 +00:00
curt
8a2c08a0c1 Fixes for compiling with native Irix compilers. 1999-04-07 20:58:02 +00:00
curt
b15b40ea10 Initial revision. 1999-04-07 04:09:55 +00:00
curt
0c865f540f Removed in-src cvs logs. 1999-04-06 23:37:07 +00:00
curt
ef4a92859c Removed ... 1999-04-06 22:29:19 +00:00
curt
2a7b06f648 Tweaks to configure script so it can be run from the top level
configure script.
1999-04-06 02:42:10 +00:00
curt
6c2ca22b3f Initial revision. 1999-04-05 22:18:39 +00:00
curt
592690f8f2 Initial revision 1999-04-05 22:14:10 +00:00
curt
1eb87e7c73 Initial revision 1999-04-05 21:32:32 +00:00
curt
a0e40c1fc1 Integrated Steve's new "plib" conglomeration. 1999-04-03 04:19:39 +00:00
curt
2c920ae1df Added is_open() so we can check if the open() succeeded. 1999-03-27 14:04:25 +00:00
curt
bbde3b36bf Elimitated some const warnings from the compiler. 1999-03-27 05:34:05 +00:00
curt
88a016c516 Minor optimization tweaks. 1999-03-25 19:02:28 +00:00
curt
22d4058564 Jettisoned old bucketutils.[ch] for newbucket.[ch]xx 1999-03-25 19:01:47 +00:00
curt
79e6c529ea MSVC++ portability tweaks contributed by Bernie Bright.
Added using std::ostream declaration.
  Added forward declarations to work around a MSVC bug.
1999-03-15 17:58:41 +00:00
curt
7b22b8cd92 Moved to math subdirectory. 1999-03-13 17:34:44 +00:00
curt
bc2ae82e81 Added some informational methods. 1999-03-12 22:51:18 +00:00
curt
764f4037b0 Tweak for native SGI compilers. 1999-03-08 22:00:12 +00:00
curt
a60454a786 Tweaks for compiling with native SGI compilers. 1999-03-02 01:01:42 +00:00
curt
d136ad3e57 Added initial support for native SGI compilers. 1999-02-26 22:07:53 +00:00
curt
739588f9c3 Renamed bucketutils.c -> bucketutils.cxx 1999-02-17 20:52:02 +00:00
210 changed files with 12284 additions and 7821 deletions

View File

@@ -1,139 +0,0 @@
/**********************************************\
* *
* W A R N I N G *
* *
* This file is now kept in reverse chronolog- *
* ical order so recent changes are now at the *
* top. *
* *
\**********************************************/
* 28th Sept 1889 -- Fixed a bug associated with exiting the
program with sounds still playing.
Fixed a bug associated with using the
package in the absence of a sound card.
Added a new member function "working"
which is the opposite of "not_working",
(as demanded by a bunch of rabid optimists)!
Fixed a couple of typo's in the manual.
* 23rd Sept 1998 -- The Good News: Finally got around to
getting the pitch envelope working. (Hooray)
The Bad News: This costs quite a bit in
performance - and it was a MAJOR rewrite
of significant parts of the internals,
so we may need some bug fixes.
This version is 0.5
* 7th July 1998 -- Fixed some error checking in slSample.cxx and
a missing declaration in sl.h
* 6th July 1998 -- Fixed an initialisation problem when
slScheduler was not a static/global.
Tom Knienieder's port to SGI/IRIX is now
working, documentation updated to reflect that.
* 16th June 1998 -- Added some slPortability.h fixes for
FreeBSD and the Cygnus WIN32 compiler.
Many thanks to Curt.
* 14th June 1998 -- Tom Knienieder's port to OpenBSD is now
working, documentation updated to reflect that.
Tom's improved Makefiles included, also some
example sound samples that were accidentally
left out of the release are now present.
A couple of typo's in the WIN32 section
have been fixed. The top level Makefile
now requires you to type 'make linux',
'make win' or 'make openbsd'.
* 13th June 1998 -- Tom Knienieder's port to WIN32 engine is now
working, documentation updated to reflect that
revised status. Some default constructor parameters
have changed, slDSP no longer supports setRate/setBps/setStereo.
You now have to delete the slDSP and recreate it with
new parameters. This makes porting a little easier.
'sound_test' renamed 'example'.
* 7th June 1998 -- Volume envelopes (and inverse volume envelopes)
now work correctly. Pan envelopes won't work
until stereo is implemented. Pitch and filter
envelopes turn out to be a major pain to implement
with the present slSceduler/slSamplePlayer interface,
so some significant internal changes are to be
expected.
Changed the CHANGES file to be in reverse
chronological order.
This version is officially SL v0.3 (beta)
* 3rd June 1998 -- Moved sample program and it's data files into
'example', moved documents into 'doc' and sources
into 'src'. Final library goes into 'lib'.
The entire preempting mechanism was broken -
now it's fixed.
Added a callback mechanism that allows
applications to know when a sound
loops, finishes playing, is pre-empted, etc.
New mechanisms added to stop/pause/resume a
playing sample.
All the documentation - and some of the code -
for slEnvelopes has been added, they don't
work yet - so don't bother with them for now.
Made some code a little more bullet-proof.
slSample's are now reference-counted so you
can't accidentally delete one while it's
playing without getting a FATAL error.
* 2nd June 1998 -- Fixed bug in initialisation that prevented SL
from functioning correctly in the case were there
is no sound card present.
This version is officially SL v0.2 (beta)
* 1st June 1998 -- Split library into two parts - libsm and
libsl. libsm contains only the Mixer class
since it is likely to be hard to port to
a lot of non-OSS systems - and most programs
won't need it anyway. Hence the documentation
has blossomed into three files and all the
'slMixer' references have turned into 'smMixer'.
Also, I finally got a hold of the OSS documentation,
which is a lot more complete - and straightened
me out on a few points. slDSP has changed
(internally) somewhat as a result and in particular,
you can no longer mess with the sampling rate,
stereo and bps settings after the slDSP or
slScheduler has been created. This also allows the
scheduler to enforce it's rule about only mono/8bps
operations.
I also added an 'autoMatch' function to the slSample
class to automagically match incoming samples to the
current slDSP/slScheduler. This makes using the library
a lot less painful and error-prone.
This version is officially SL v0.1 (beta)
We need a better name!
* 30th May 1998 -- Almost total rewrite, library can now
play multiple sounds without interruption,
supports '.WAV' and '.AU' file formats as
well as raw binary files. Able to copy with
much shorter safetyMargin on sound buffers,
and play without using the 'stop' call.
All class and external symbols now begin
with 'sl' or 'SL'. HTML documentation now
available.
* 27th May 1998 -- First hack

View File

@@ -1 +0,0 @@
SUBDIRS = src example

View File

@@ -1,9 +0,0 @@
NOTICE: This Sound Library (SL) distribution contains source code that is
placed into the public domain without copyright. These programs are freely
distributable without licensing fees. These programs are provided without
guarantee or warrantee expressed or implied.
If you use SL in a commercial or shareware product, it would be nice if you
gave credit where it is due. If you make any modifications or improvements
to SL, I would greatly appreciate a copy of the improved code.

View File

@@ -1,9 +0,0 @@
Hi!
This is the fifth prototype of Steve's 'SL' sound library.
Check out 'CHANGES' and the new HTML documentation.
Steve

View File

@@ -1,13 +0,0 @@
Building SL for Linux.
~~~~~~~~~~~~~~~~~~~~~~
% make freebsd
% su root
% make install
...that's all folks.
Header files go into /usr/include/SL (analogous to /usr/include/GL for graphics)
Library file(s) go into /usr/lib

View File

@@ -1,13 +0,0 @@
Building SL for Linux.
~~~~~~~~~~~~~~~~~~~~~~
% make linux
% su root
% make install
...that's all folks.
Header files go into /usr/include/SL (analogous to /usr/include/GL for graphics)
Library file(s) go into /usr/lib

View File

@@ -1,13 +0,0 @@
Building SL for OpenBSD.
~~~~~~~~~~~~~~~~~~~~~~~~
% make openbsd
% su root
% make install
...that's all folks.
Header files go into /usr/include/SL (analogous to /usr/include/GL for graphics)
Library file(s) go into /usr/lib

View File

@@ -1,27 +0,0 @@
Building SL for SGI.
~~~~~~~~~~~~~~~~~~~~~~
There are two options, depending on whether you want to use GCC or
the standard SGI C++ compiler.
GNU G++:
% make sgigcc
% su root
% make install
SGI C++:
% make sgi
% su root
% make install
...that's all folks.
Header files go into /usr/include/SL (analogous to /usr/include/GL for graphics)
Library file(s) go into /usr/lib
When you link, be sure to include to -laudio

View File

@@ -1,20 +0,0 @@
Building SL for UNIX
~~~~~~~~~~~~~~~~~~~~
If your UNIX box is Linux or OpenBSD then
check out README.linux or README.openbsd.
If your UNIX box supports OSS (the Open
Sound System) then in principal, you should
only need to type:
% make oss
% su root
% make install
...however, your milage may vary. If you succeed
in getting a non-Linux, non-OpenBSD version to
work, I'd like to hear about it.
Steve Baker <sjbaker1@airmail.net>

View File

@@ -1,15 +0,0 @@
Building SL for win32 (msvc)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:>nmake win32
don't forget to set the environment !
example:
set include=c:\msdev\include;
set lib=c:\msdev\lib
path c:\msdev\bin;c:\bin;c:\winnt;......

View File

@@ -1,12 +0,0 @@
noinst_LIBRARIES = libBucket.a
libBucket_a_SOURCES = bucketutils.c bucketutils.h bucketutils.hxx \
newbucket.cxx newbucket.hxx
bin_PROGRAMS = testbucket
testbucket_SOURCES = testbucket.cxx
testbucket_LDADD = $(top_builddir)/Lib/Bucket/libBucket.a
INCLUDES += -I$(top_builddir)

View File

@@ -1,326 +0,0 @@
// bucketutils.c -- support routines to handle fgBUCKET operations
//
// Written by Curtis Olson, started January 1998.
//
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#include <math.h>
#include <stdio.h>
#include <Include/fg_constants.h>
#include "bucketutils.h"
/* Generate the unique scenery tile index containing the specified
lon/lat parameters.
The index is constructed as follows:
9 bits - to represent 360 degrees of longitude (-180 to 179)
8 bits - to represent 180 degrees of latitude (-90 to 89)
Each 1 degree by 1 degree tile is further broken down into an 8x8
grid. So we also need:
3 bits - to represent x (0 to 7)
3 bits - to represent y (0 to 7) */
long int fgBucketGenIndex( const fgBUCKET *p) {
long index = 0;
index = ((p->lon + 180) << 14) + ((p->lat + 90) << 6) + (p->y << 3) + p->x;
// printf(" generated index = %ld\n", index);
return(index);
}
// Parse a unique scenery tile index and find the lon, lat, x, and y
void fgBucketParseIndex(long int index, fgBUCKET *p) {
p->lon = index >> 14;
index -= p->lon << 14;
p->lon -= 180;
p->lat = index >> 6;
index -= p->lat << 6;
p->lat -= 90;
p->y = index >> 3;
index -= p->y << 3;
p->x = index;
}
// Build a path name from an tile index
void fgBucketGenBasePath( const fgBUCKET *p, char *path) {
long int index;
int top_lon, top_lat, main_lon, main_lat;
char hem, pole;
index = fgBucketGenIndex(p);
path[0] = '\0';
top_lon = p->lon / 10;
main_lon = p->lon;
if ( (p->lon < 0) && (top_lon * 10 != p->lon) ) {
top_lon -= 1;
}
top_lon *= 10;
if ( top_lon >= 0 ) {
hem = 'e';
} else {
hem = 'w';
top_lon *= -1;
}
if ( main_lon < 0 ) {
main_lon *= -1;
}
top_lat = p->lat / 10;
main_lat = p->lat;
if ( (p->lat < 0) && (top_lat * 10 != p->lat) ) {
top_lat -= 1;
}
top_lat *= 10;
if ( top_lat >= 0 ) {
pole = 'n';
} else {
pole = 's';
top_lat *= -1;
}
if ( main_lat < 0 ) {
main_lat *= -1;
}
sprintf(path, "%c%03d%c%03d/%c%03d%c%03d",
hem, top_lon, pole, top_lat,
hem, main_lon, pole, main_lat);
}
// offset an bucket struct by the specified amounts in the X & Y direction
void fgBucketOffset(fgBUCKET *in, fgBUCKET *out, int x, int y) {
int diff, temp;
int dist_lat;
out->lon = in->lon;
out->lat = in->lat;
out->x = in->x;
out->y = in->y;
// do X direction
diff = out->x + x;
// printf(" reducing x (%d)\n", diff);
if ( diff >= 0 ) {
temp = diff / 8;
} else if ( diff < -7 ) {
temp = (diff + 1) / 8 - 1;
} else {
temp = diff / 8 - 1;
}
out->x = ((diff % 8) + 8) % 8;
out->lon = ( (out->lon + 180 + 360 + temp) % 360 ) - 180;
// do Y direction
diff = out->y + y;
// printf(" reducing x (%d)\n", diff);
if ( diff >= 0 ) {
temp = diff / 8;
} else if ( diff < -7 ) {
temp = (diff + 1) / 8 - 1;
} else {
temp = diff / 8 - 1;
}
out->y = ((diff % 8) + 8) % 8;
out->lat = out->lat + temp;
if ( out->lat >= 90 ) {
dist_lat = out->lat - 90;
// printf(" +lat = %d +y = %d\n", dist_lat, out->y);
out->lat = 90 - (dist_lat + 1);
out->lon = ( (out->lon + 180 + 180) % 360 ) - 180;
out->y = 7 - out->y;
}
if ( out->lat < -90 ) {
dist_lat = -90 - out->lat;
// printf(" +lat = %d +y = %d\n", dist_lat, out->y);
out->lat = -90 + (dist_lat - 1);
out->lon = ( (out->lon + 180 + 180) % 360 ) - 180;
out->y = 7 - out->y;
}
}
// Given a lat/lon in degrees, find the "bucket" or tile that it falls
// within
void fgBucketFind(double lon, double lat, fgBUCKET *p) {
double diff;
diff = lon - (double)(int)lon;
// printf("diff = %.2f\n", diff);
if ( (lon >= 0) || (fabs(diff) < FG_EPSILON) ) {
p->lon = (int)lon;
} else {
p->lon = (int)lon - 1;
}
// printf(" p->lon = %d\n", p->lon);
diff = lat - (double)(int)lat;
// printf("diff = %.2f\n", diff);
if ( (lat >= 0) || (fabs(diff) < FG_EPSILON) ) {
p->lat = (int)lat;
} else {
p->lat = (int)lat - 1;
}
// printf(" p->lat = %d\n", p->lat);
p->x = (int)((lon - p->lon) * 8);
p->y = (int)((lat - p->lat) * 8);
// printf( "Bucket = lon,lat = %d,%d x,y index = %d,%d\n",
// p->lon, p->lat, p->x, p->y);
}
// Given a lat/lon, fill in the local tile index array
void fgBucketGenIdxArray(fgBUCKET *p1, fgBUCKET *tiles, int width, int height) {
fgBUCKET *p2;
int dw, dh, i, j;
dh = height / 2;
dw = width / 2;
for ( j = 0; j < height; j++ ) {
for ( i = 0; i < width; i++ ) {
fgBucketOffset(p1, &tiles[(j*width)+i], i - dw, j - dh);
p2 = &tiles[(j*width)+i];
/* printf( " bucket = %d %d %d %d index = %ld\n",
p2->lon, p2->lat, p2->x, p2->y,
fgBucketGenIndex(&tiles[(j*width)+i])); */
}
}
}
/* sample main for testing
int main() {
fgBUCKET p1;
long int tile[49];
char path[256];
double lon, lat;
int i, j;
p1.lon = 180;
p1.lat = 90;
p1.x = 7;
p1.y = 7;
printf("Max index = %ld\n", gen_index(&p1));
lon = -50.0;
lat = -50.0;
find_bucket(lon, lat, &p1);
gen_idx_array(&p1, tile, 7, 7);
for ( j = 0; j < 7; j++ ) {
for ( i = 0; i < 7; i++ ) {
gen_path(tile[(j*7)+i], path);
printf(" path = %s\n", path);
}
}
lon = 50.0;
lat = 50.0;
find_bucket(lon, lat, &p1);
gen_idx_array(&p1, tile, 7, 7);
for ( j = 0; j < 7; j++ ) {
for ( i = 0; i < 7; i++ ) {
gen_path(tile[(j*7)+i], path);
printf(" path = %s\n", path);
}
}
return(1);
} */
// $Log$
// Revision 1.5 1998/12/09 18:48:08 curt
// Use C++ style comments.
//
// Revision 1.4 1998/12/07 21:08:01 curt
// Added a const in a couple places to get rid of annoying compiler warnings.
//
// Revision 1.3 1998/07/04 00:46:47 curt
// typedef'd struct fgBUCKET.
//
// Revision 1.2 1998/04/25 22:06:22 curt
// Edited cvs log messages in source files ... bad bad bad!
//
// Revision 1.1 1998/04/08 23:28:58 curt
// Adopted Gnu automake/autoconf system.
//
// Revision 1.6 1998/02/09 15:07:51 curt
// Minor tweaks.
//
// Revision 1.5 1998/01/29 00:51:38 curt
// First pass at tile cache, dynamic tile loading and tile unloading now works.
//
// Revision 1.4 1998/01/27 03:26:41 curt
// Playing with new fgPrintf command.
//
// Revision 1.3 1998/01/27 00:48:01 curt
// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
// system and commandline/config file processing code.
//
// Revision 1.2 1998/01/24 00:03:28 curt
// Initial revision.
//
// Revision 1.1 1998/01/23 20:06:51 curt
// tileutils.* renamed to bucketutils.*
//
// Revision 1.6 1998/01/19 19:27:18 curt
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
// This should simplify things tremendously.
//
// Revision 1.5 1998/01/14 02:19:04 curt
// Makde offset_bucket visible to outside.
//
// Revision 1.4 1998/01/13 00:23:12 curt
// Initial changes to support loading and management of scenery tiles. Note,
// there's still a fair amount of work left to be done.
//
// Revision 1.3 1998/01/10 00:01:47 curt
// Misc api changes and tweaks.
//
// Revision 1.2 1998/01/08 02:22:28 curt
// Continue working on basic features.
//
// Revision 1.1 1998/01/07 23:50:52 curt
// "area" renamed to "tile"
//
// Revision 1.1 1998/01/07 23:23:40 curt
// Initial revision.
//

View File

@@ -1,135 +0,0 @@
// bucketutils.h -- support routines to handle fgBUCKET operations
//
// Written by Curtis Olson, started January 1998.
//
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifndef _BUCKETUTILS_H
#define _BUCKETUTILS_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int lon; // longitude (-180 to 179)
int lat; // latitude (-90 to 89)
int x; // x (0 to 7)
int y; // y (0 to 7)
} fgBUCKET;
/* Generate the unique scenery tile index containing the specified
lon/lat parameters.
The index is constructed as follows:
9 bits - to represent 360 degrees of longitude (-180 to 179)
8 bits - to represent 180 degrees of latitude (-90 to 89)
Each 1 degree by 1 degree tile is further broken down into an 8x8
grid. So we also need:
3 bits - to represent x (0 to 7)
3 bits - to represent y (0 to 7) */
long int fgBucketGenIndex( const fgBUCKET *p);
// Parse a unique scenery tile index and find the lon, lat, x, and y
void fgBucketParseIndex(long int index, fgBUCKET *p);
// Build a path name from an tile index
void fgBucketGenBasePath( const fgBUCKET *p, char *path);
// offset a bucket struct by the specified amounts in the X & Y direction
void fgBucketOffset(fgBUCKET *in, fgBUCKET *out, int x, int y);
// Given a lat/lon in degrees, find the "bucket" or tile that it falls
// within
void fgBucketFind(double lon, double lat, fgBUCKET *p);
// Given a lat/lon, fill in the local tile index array
void fgBucketGenIdxArray(fgBUCKET *p1, fgBUCKET *tiles, int width, int height);
#ifdef __cplusplus
}
#endif
#endif // _BUCKETUTILS_H
// $Log$
// Revision 1.5 1999/02/08 23:52:15 curt
// Added a new "newbucket.[ch]xx" FGBucket class to replace the old
// fgBUCKET struct and C routines. This FGBucket class adjusts the tile
// width towards the poles to ensure the tiles are at least 8 miles wide.
//
// Revision 1.4 1998/12/09 18:48:09 curt
// Use C++ style comments.
//
// Revision 1.3 1998/12/07 21:08:03 curt
// Added a const in a couple places to get rid of annoying compiler warnings.
//
// Revision 1.2 1998/07/04 00:46:48 curt
// typedef'd struct fgBUCKET.
//
// Revision 1.1 1998/04/08 23:28:59 curt
// Adopted Gnu automake/autoconf system.
//
// Revision 1.2 1998/01/24 00:03:28 curt
// Initial revision.
//
// Revision 1.1 1998/01/23 20:06:52 curt
// tileutils.* renamed to bucketutils.*
//
// Revision 1.6 1998/01/22 02:59:42 curt
// Changed #ifdef FILE_H to #ifdef _FILE_H
//
// Revision 1.5 1998/01/14 02:19:05 curt
// Makde offset_bucket visible to outside.
//
// Revision 1.4 1998/01/13 00:23:12 curt
// Initial changes to support loading and management of scenery tiles. Note,
// there's still a fair amount of work left to be done.
//
// Revision 1.3 1998/01/10 00:01:48 curt
// Misc api changes and tweaks.
//
// Revision 1.2 1998/01/08 02:22:28 curt
// Continue working on basic features.
//
// Revision 1.1 1998/01/07 23:50:52 curt
// "area" renamed to "tile"
//
// Revision 1.1 1998/01/07 23:23:40 curt
// Initial revision.
//

View File

@@ -1,81 +0,0 @@
/**************************************************************************
* bucketutils.hxx -- support routines to handle fgBUCKET operations
*
* Written by Bernie Bright, started January 1998.
*
* Copyright (C) 1998 Bernie Bright - bbright@c031.aone.net.au
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
* (Log is kept at end of this file)
**************************************************************************/
#ifndef _BUCKETUTILS_HXX
#define _BUCKETUTILS_HXX
#include <string>
FG_USING_NAMESPACE(std);
#include "bucketutils.h"
#include <Include/compiler.h>
FG_USING_STD(string);
inline bool
operator== ( const fgBUCKET& b1, const fgBUCKET& b2 )
{
return ( b1.lon == b2.lon &&
b1.lat == b2.lat &&
b1.x == b2.x &&
b1.y == b2.y );
}
inline string
fgBucketGenIndex( const fgBUCKET& p )
{
char index_str[256];
sprintf( index_str, "%ld", fgBucketGenIndex( &p ) );
return string( index_str );
}
inline string
fgBucketGenBasePath( const fgBUCKET& p )
{
char base_path[256];
fgBucketGenBasePath( &p, base_path );
return string( base_path );
}
inline ostream&
operator<< ( ostream& out, const fgBUCKET& b )
{
return out << b.lon << "," << b.lat << " " << b.x << "," << b.y;
}
#endif /* _BUCKETUTILS_HXX */
// $Log$
// Revision 1.2 1999/01/19 20:56:53 curt
// MacOS portability changes contributed by "Robert Puyol" <puyol@abvent.fr>
//
// Revision 1.1 1998/11/09 23:42:12 curt
// Initial revision.
//

View File

@@ -1,13 +0,0 @@
# The "checkoutlist" file is used to support additional version controlled
# administrative files in $CVSROOT/CVSROOT, such as template files.
#
# The first entry on a line is a filename which will be checked out from
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
# The remainder of the line is an error message to use if the file cannot
# be checked out.
#
# File format:
#
# [<whitespace>]<filename><whitespace><error message><end-of-line>
#
# comment lines begin with '#'

View File

@@ -1,15 +0,0 @@
# The "commitinfo" file is used to control pre-commit checks.
# The filter on the right is invoked with the repository and a list
# of files to check. A non-zero exit of the filter program will
# cause the commit to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

View File

@@ -1,22 +0,0 @@
# This file describes wrappers and other binary files to CVS.
#
# Wrappers are the concept where directories of files are to be
# treated as a single file. The intended use is to wrap up a wrapper
# into a single tar such that the tar archive can be treated as a
# single binary file in CVS.
#
# To solve the problem effectively, it was also necessary to be able to
# prevent rcsmerge from merging these files.
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
# wildcard [option value][option value]...
#
# where option is one of
# -f from cvs filter value: path to filter
# -t to cvs filter value: path to filter
# -m update methodology value: MERGE or COPY
#
# and value is a single-quote delimited value.
#
# For example:

View File

@@ -1,21 +0,0 @@
# The "editinfo" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.

View File

@@ -1,19 +0,0 @@
# The "loginfo" file is used to control where "cvs commit" log information is
# sent. The first entry on a line is a regular expression which is tested
# against the directory that the change is being made to, relative to the
# $CVSROOT. For the first match that is found, the remainder of the line is a
# filter program that should expect log information on its standard input
#
# If the repository name does not match any of the regular expressions in the
# first field of this file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
#
# The filter program may use one and only one "%s" modifier (ala printf). If
# such a "%s" is specified in the filter program, a brief title is included
# (as one argument, enclosed in single quotes) showing the relative directory
# name and listing the modified file names.
#
# For example:
#DEFAULT (echo ""; who am i; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog

View File

@@ -1,26 +0,0 @@
# Three different line formats are valid:
# key -a aliases...
# key [options] directory
# key [options] directory files...
#
# Where "options" are composed of:
# -i prog Run "prog" on "cvs commit" from top-level of module.
# -o prog Run "prog" on "cvs checkout" of module.
# -e prog Run "prog" on "cvs export" of module.
# -t prog Run "prog" on "cvs rtag" of module.
# -u prog Run "prog" on "cvs update" of module.
# -d dir Place module in directory "dir" instead of module name.
# -l Top-level directory only -- do not recurse.
#
# NOTE: If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias. An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module. This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.

View File

@@ -1,12 +0,0 @@
# The "notify" file controls where notifications from watches set by
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
# a regular expression which is tested against the directory that the
# change is being made to, relative to the $CVSROOT. If it matches,
# then the remainder of the line is a filter program that should contain
# one occurrence of %s for the user to notify, and information on its
# standard input.
#
# "ALL" or "DEFAULT" can be used in place of the regular expression.
#
# For example:
#ALL mail %s -s "CVS notification"

View File

@@ -1,13 +0,0 @@
# The "rcsinfo" file is used to control templates with which the editor
# is invoked on commit and import.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being made to, relative to the
# $CVSROOT. For the first match that is found, then the remainder of the
# line is the name of the file that contains the template.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

View File

@@ -1,20 +0,0 @@
# The "taginfo" file is used to control pre-tag checks.
# The filter on the right is invoked with the following arguments:
#
# $1 -- tagname
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
# $3 -- repository
# $4-> file revision [file revision ...]
#
# A non-zero exit of the filter program will cause the tag to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".

13
Lib/Bucket/Makefile.am Normal file
View File

@@ -0,0 +1,13 @@
noinst_LIBRARIES = libBucket.a
libBucket_a_SOURCES = newbucket.cxx newbucket.hxx
# bin_PROGRAMS = testbucket
# testbucket_SOURCES = testbucket.cxx
# testbucket_LDADD = \
# $(top_builddir)/Lib/Bucket/libBucket.a \
# $(top_builddir)/Lib/Misc/libMisc.a
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib

View File

@@ -20,7 +20,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
* (Log is kept at end of this file)
**************************************************************************/
@@ -29,20 +28,20 @@
#endif
#include <math.h>
#include <Misc/fgpath.hxx>
#include "newbucket.hxx"
// Build the path name for this bucket
string FGBucket::gen_base_path() {
long int index;
string FGBucket::gen_base_path() const {
// long int index;
int top_lon, top_lat, main_lon, main_lat;
char hem, pole;
char path[256];
char raw_path[256];
index = gen_index();
path[0] = '\0';
top_lon = lon / 10;
main_lon = lon;
if ( (lon < 0) && (top_lon * 10 != lon) ) {
@@ -75,11 +74,13 @@ string FGBucket::gen_base_path() {
main_lat *= -1;
}
sprintf(path, "%c%03d%c%02d/%c%03d%c%02d",
hem, top_lon, pole, top_lat,
sprintf(raw_path, "%c%03d%c%02d/%c%03d%c%02d",
hem, top_lon, pole, top_lat,
hem, main_lon, pole, main_lat);
return path;
FGPath path( raw_path );
return path.str();
}
@@ -98,7 +99,14 @@ FGBucket fgBucketOffset( double dlon, double dlat, int dx, int dy ) {
double span = bucket_span( clat );
// walk dx units in the lon direction
result.set_bucket( dlon + dx * span, clat );
double tmp = dlon + dx * span;
while ( tmp < -180.0 ) {
tmp += 360.0;
}
while ( tmp >= 180.0 ) {
tmp -= 360.0;
}
result.set_bucket( tmp, clat );
return result;
}
@@ -145,12 +153,3 @@ void fgBucketDiff( const FGBucket& b1, const FGBucket& b2, int *dx, int *dy ) {
}
// $Log$
// Revision 1.2 1999/02/11 01:09:33 curt
// Added a routine to calculate the offset in bucket units between two buckets.
//
// Revision 1.1 1999/02/08 23:52:16 curt
// Added a new "newbucket.[ch]xx" FGBucket class to replace the old
// fgBUCKET struct and C routines. This FGBucket class adjusts the tile
// width towards the poles to ensure the tiles are at least 8 miles wide.
//

View File

@@ -20,7 +20,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
* (Log is kept at end of this file)
**************************************************************************/
@@ -29,12 +28,30 @@
#include <Include/compiler.h>
#include <string>
#ifdef FG_HAVE_STD_INCLUDES
# include <cmath>
# include <cstdio> // sprintf()
# include <iostream>
#else
# include <math.h>
# include <stdio.h> // sprintf()
# include <iostream.h>
#endif
// I don't understand ... <math.h> or <cmath> should be included
// already depending on how you defined FG_HAVE_STD_INCLUDES, but I
// can go ahead and add this -- CLO
#ifdef __MWERKS__
# include <math.h> // needed fabs()
#endif
#include STL_STRING
FG_USING_STD(string);
FG_USING_NAMESPACE(std);
#include <stdio.h> // sprintf()
#if ! defined( FG_HAVE_NATIVE_SGI_COMPILERS )
FG_USING_STD(ostream);
#endif
#include <Include/fg_constants.h>
@@ -42,6 +59,9 @@ FG_USING_NAMESPACE(std);
#define FG_BUCKET_SPAN 0.125 // 1/8 of a degree
#define FG_HALF_BUCKET_SPAN 0.0625 // 1/2 of 1/8 of a degree = 1/16 = 0.0625
class FGBucket;
ostream& operator<< ( ostream&, const FGBucket& );
bool operator== ( const FGBucket&, const FGBucket& );
class FGBucket {
@@ -63,23 +83,40 @@ public:
// create a bucket based on "long int" index
FGBucket(const long int bindex);
// create an impossible bucket if false
FGBucket(const bool is_good);
~FGBucket();
// Set the bucket params for the specified lat and lon
void set_bucket( double dlon, double dlat );
void make_bad ( void );
// Generate the unique scenery tile index for this bucket
long int gen_index();
string gen_index_str() const;
// Build the path name for this bucket
string gen_base_path();
string gen_base_path() const;
// return the center lon of a tile
double get_center_lon() const;
// return width of the tile
double get_width() const;
// return the center lat of a tile
double get_center_lat() const;
// return height of the tile
double get_height() const;
// Informational methods
inline int get_lon() const { return lon; }
inline int get_lat() const { return lat; }
inline int get_x() const { return x; }
inline int get_y() const { return y; }
// friends
friend ostream& operator<< ( ostream&, const FGBucket& );
friend bool operator== ( const FGBucket&, const FGBucket& );
@@ -89,7 +126,7 @@ public:
// return the horizontal tile span factor based on latitude
inline double bucket_span( double l ) {
if ( l >= 89.0 ) {
return 0.0;
return 360.0;
} else if ( l >= 88.0 ) {
return 8.0;
} else if ( l >= 86.0 ) {
@@ -117,7 +154,7 @@ inline double bucket_span( double l ) {
} else if ( l >= -89.0 ) {
return 8.0;
} else {
return 0.0;
return 360.0;
}
}
@@ -183,6 +220,15 @@ inline FGBucket::FGBucket(const double dlon, const double dlat) {
}
// create an impossible bucket if false
inline FGBucket::FGBucket(const bool is_good) {
set_bucket(0.0, 0.0);
if ( !is_good ) {
lon = -1000;
}
}
// Parse a unique scenery tile index and find the lon, lat, x, and y
inline FGBucket::FGBucket(const long int bindex) {
long int index = bindex;
@@ -223,6 +269,13 @@ inline long int FGBucket::gen_index() {
return ((lon + 180) << 14) + ((lat + 90) << 6) + (y << 3) + x;
}
inline string FGBucket::gen_index_str() const {
char tmp[20];
sprintf(tmp, "%ld",
(((long)lon + 180) << 14) + ((lat + 90) << 6) + (y << 3) + x);
return (string)tmp;
}
// return the center lon of a tile
inline double FGBucket::get_center_lon() const {
@@ -242,6 +295,25 @@ inline double FGBucket::get_center_lat() const {
}
// return width of the tile
inline double FGBucket::get_width() const {
return bucket_span( get_center_lat() );
}
// return height of the tile
inline double FGBucket::get_height() const {
return FG_BUCKET_SPAN;
}
// create an impossible bucket
inline void FGBucket::make_bad( void ) {
set_bucket(0.0, 0.0);
lon = -1000;
}
// offset a bucket struct by the specified tile units in the X & Y
// direction
FGBucket fgBucketOffset( double dlon, double dlat, int x, int y );
@@ -273,28 +345,7 @@ operator== ( const FGBucket& b1, const FGBucket& b2 )
b1.y == b2.y );
}
/*
inline string
fgBucketGenIndex( const fgBUCKET& p )
{
char index_str[256];
sprintf( index_str, "%ld", fgBucketGenIndex( &p ) );
return string( index_str );
}
*/
#endif // _NEWBUCKET_HXX
// $Log$
// Revision 1.2 1999/02/11 01:09:34 curt
// Added a routine to calculate the offset in bucket units between two buckets.
//
// Revision 1.1 1999/02/08 23:52:16 curt
// Added a new "newbucket.[ch]xx" FGBucket class to replace the old
// fgBUCKET struct and C routines. This FGBucket class adjusts the tile
// width towards the poles to ensure the tiles are at least 8 miles wide.
//

View File

@@ -21,7 +21,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
* (Log is kept at end of this file)
**************************************************************************/
@@ -281,30 +280,3 @@ int fgPrintf( fgDebugClass dbg_class, fgDebugPriority prio, char *fmt, ... ) {
}
/* $Log$
/* Revision 1.4 1998/06/01 17:49:44 curt
/* Rewrote a slightly ambiguous code fragment (contributed by Charlie Hotchkiss)
/*
* Revision 1.3 1998/05/07 23:03:54 curt
* Added an entry for AUTOPILOT.
*
* Revision 1.2 1998/04/21 17:03:45 curt
* Prepairing for C++ integration.
*
* Revision 1.1 1998/04/18 03:52:04 curt
* Moved to Lib directory and created a libDebug.
*
* Revision 1.10 1998/03/14 00:31:21 curt
* Beginning initial terrain texturing experiments.
*
* Revision 1.9 1998/03/09 22:44:58 curt
* Modified so that you can specify FG_DEBUGCLASS ***or*** FG_DEBUG_PRIORITY
*
* Revision 1.8 1998/03/09 22:11:00 curt
* Processed through the format-o-matic.
*
* Revision 1.7 1998/02/16 13:39:43 curt
* Miscellaneous weekend tweaks. Fixed? a cache problem that caused whole
* tiles to occasionally be missing.
*
*/

View File

@@ -20,7 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* (Log is kept at end of this file)
**************************************************************************/
#error "use logstream"

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#include "logstream.hxx"
@@ -62,10 +61,3 @@ logstream::setLogLevels( fgDebugClass c, fgDebugPriority p )
logbuf::set_log_level( c, p );
}
// $Log$
// Revision 1.2 1999/01/19 20:53:34 curt
// Portability updates by Bernie Bright.
//
// Revision 1.1 1998/11/06 21:20:41 curt
// Initial revision.
//

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifndef _LOGSTREAM_H
#define _LOGSTREAM_H
@@ -29,12 +28,11 @@
#endif
#include "Include/compiler.h"
#include <Include/compiler.h>
#ifdef FG_HAVE_STD_INCLUDES
# include <streambuf>
# include <iostream>
//# include <ostream>
#else
# include <iostream.h>
# include "Include/fg_traits.hxx"
@@ -42,10 +40,18 @@
#include "debug_types.h"
#ifndef FG_HAVE_NATIVE_SGI_COMPILERS
FG_USING_STD(streambuf);
FG_USING_STD(ostream);
FG_USING_STD(cerr);
FG_USING_STD(endl);
#endif
#ifdef __MWERKS__
# define cerr std::cerr and
# define endl std::endl
FG_USING_STD(iostream);
#endif
//
// TODO:
@@ -204,21 +210,11 @@ fglog()
#ifdef FG_NDEBUG
# define FG_LOG(C,P,M)
#elif defined( __MWERKS__ )
# define FG_LOG(C,P,M) ::fglog() << ::loglevel(C,P) << M << std::endl
#else
# define FG_LOG(C,P,M) fglog() << loglevel(C,P) << M << endl
#endif
#endif // _LOGSTREAM_H
// $Log$
// Revision 1.3 1999/01/19 20:53:35 curt
// Portability updates by Bernie Bright.
//
// Revision 1.2 1998/11/07 19:07:02 curt
// Enable release builds using the --without-logging option to the configure
// script. Also a couple log message cleanups, plus some C to C++ comment
// conversion.
//
// Revision 1.1 1998/11/06 21:20:42 curt
// Initial revision.
//

View File

@@ -1,9 +1,3 @@
if ENABLE_AUDIO_SUPPORT
AUDIO_DIRS = Audio
else
AUDIO_DIRS =
endif
if ENABLE_UNIX_SERIAL
SERIAL_DIRS = Serial
else
@@ -11,12 +5,10 @@ SERIAL_DIRS =
endif
SUBDIRS = \
$(AUDIO_DIRS) \
Bucket \
Debug \
Math \
Misc \
PUI \
$(SERIAL_DIRS) \
XGL\
zlib

View File

@@ -12,7 +12,11 @@
#ifdef WIN32
# ifndef HAVE_STL_SGI_PORT
# include <memory.h> /* required for memset() and memcpy() */
# ifdef __BORLANDC__
# include <mem.h>
# else
# include <memory.h> /* required for memset() and memcpy() */
# endif
# endif
#endif

View File

@@ -8,6 +8,7 @@ libMath_a_SOURCES = \
fg_geodesy.cxx fg_geodesy.hxx \
fg_random.c fg_random.h \
interpolater.cxx interpolater.hxx \
leastsqs.cxx leastsqs.hxx \
mat3.h mat3defs.h mat3err.h \
point3d.hxx \
polar3d.cxx polar3d.hxx \

View File

@@ -6,7 +6,6 @@
// See below for the complete original LaRCsim comments.
//
// $Id$
// (Log is kept at end of this file)
#include "Include/compiler.h"
#ifdef FG_HAVE_STD_INCLUDES
@@ -17,11 +16,14 @@
# include <errno.h>
#endif
#include <Debug/logstream.hxx>
#include <Include/fg_constants.h>
#include <Math/fg_geodesy.hxx>
#include <Math/point3d.hxx>
#ifndef FG_HAVE_NATIVE_SGI_COMPILERS
FG_USING_STD(cout);
#endif
// ONE_SECOND is pi/180/60/60, or about 100 feet at earths' equator
#define ONE_SECOND 4.848136811E-6
@@ -66,7 +68,7 @@ void fgGeocToGeod( double lat_geoc, double radius, double
// check for domain error
if ( errno == EDOM ) {
cout << "Domain ERROR in fgGeocToGeod!!!!\n";
FG_LOG( FG_GENERAL, FG_ALERT, "Domain ERROR in fgGeocToGeod!!!!" );
*alt = 0.0;
}
@@ -82,7 +84,7 @@ void fgGeocToGeod( double lat_geoc, double radius, double
// check for domain error
if ( errno == EDOM ) {
cout << "Domain ERROR in fgGeocToGeod!!!!\n";
FG_LOG( FG_GENERAL, FG_ALERT, "Domain ERROR in fgGeocToGeod!!!!" );
*sea_level_r = 0.0;
}
}
@@ -161,49 +163,6 @@ void fgGeodToGeoc( double lat_geod, double alt, double *sl_radius,
CURRENT RCS HEADER:
$Header$
$Log$
Revision 1.5 1999/01/27 04:46:14 curt
Portability tweaks by Bernie Bright.
Revision 1.4 1998/11/20 01:00:36 curt
Patch in fgGeoc2Geod() to avoid a floating explosion.
point3d.hxx include math.h for FreeBSD
Revision 1.3 1998/11/11 00:18:36 curt
Check for domain error in fgGeoctoGeod()
Revision 1.2 1998/10/16 23:36:36 curt
c++-ifying.
Revision 1.1 1998/10/16 19:30:40 curt
Renamed .c -> .h so we can start adding c++ supporting routines.
Revision 1.6 1998/07/08 14:40:07 curt
polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
Updated fg_geodesy comments to reflect that routines expect and produce
meters.
Revision 1.5 1998/04/25 22:06:23 curt
Edited cvs log messages in source files ... bad bad bad!
Revision 1.4 1998/01/27 00:47:59 curt
Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
system and commandline/config file processing code.
Revision 1.3 1998/01/19 19:27:12 curt
Merged in make system changes from Bob Kuehne <rpk@sgi.com>
This should simplify things tremendously.
Revision 1.2 1997/12/15 23:54:54 curt
Add xgl wrappers for debugging.
Generate terrain normals on the fly.
Revision 1.1 1997/07/31 23:13:14 curt
Initial revision.
Revision 1.1 1997/05/29 00:09:56 curt
Initial Flight Gear revision.
* Revision 1.5 1994/01/11 18:47:05 bjax
* Changed include files to use types and constants, not ls_eom.h
* Also changed DATA type to SCALAR type.
@@ -250,44 +209,3 @@ Initial Flight Gear revision.
--------------------------------------------------------------------------*/
// $Log$
// Revision 1.5 1999/01/27 04:46:14 curt
// Portability tweaks by Bernie Bright.
//
// Revision 1.4 1998/11/20 01:00:36 curt
// Patch in fgGeoc2Geod() to avoid a floating explosion.
// point3d.hxx include math.h for FreeBSD
//
// Revision 1.3 1998/11/11 00:18:36 curt
// Check for domain error in fgGeoctoGeod()
//
// Revision 1.2 1998/10/16 23:36:36 curt
// c++-ifying.
//
// Revision 1.1 1998/10/16 19:30:40 curt
// Renamed .c -> .h so we can start adding c++ supporting routines.
//
// Revision 1.6 1998/07/08 14:40:07 curt
// polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
// Updated fg_geodesy comments to reflect that routines expect and produce
// meters.
//
// Revision 1.5 1998/04/25 22:06:23 curt
// Edited cvs log messages in source files ... bad bad bad!
//
// Revision 1.4 1998/01/27 00:47:59 curt
// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
// system and commandline/config file processing code.
//
// Revision 1.3 1998/01/19 19:27:12 curt
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
// This should simplify things tremendously.
//
// Revision 1.2 1997/12/15 23:54:54 curt
// Add xgl wrappers for debugging.
// Generate terrain normals on the fly.
//
// Revision 1.1 1997/07/31 23:13:14 curt
// Initial revision.
//

View File

@@ -6,7 +6,6 @@
// See below for the complete original LaRCsim comments.
//
// $Id$
// (Log is kept at end of this file)
#ifndef _FG_GEODESY_HXX
@@ -113,35 +112,6 @@ inline Point3D fgGeodToCart(const Point3D& geod) {
CURRENT RCS HEADER:
$Header$
$Log$
Revision 1.4 1999/01/27 04:46:15 curt
Portability tweaks by Bernie Bright.
Revision 1.3 1998/10/18 01:17:11 curt
Point3D tweaks.
Revision 1.2 1998/10/16 23:36:37 curt
c++-ifying.
Revision 1.1 1998/10/16 19:30:42 curt
Renamed .c -> .h so we can start adding c++ supporting routines.
Revision 1.4 1998/07/08 14:40:08 curt
polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
Updated fg_geodesy comments to reflect that routines expect and produce
meters.
Revision 1.3 1998/04/21 17:03:48 curt
Prepairing for C++ integration.
Revision 1.2 1998/01/22 02:59:38 curt
Changed #ifdef FILE_H to #ifdef _FILE_H
Revision 1.1 1997/07/31 23:13:14 curt
Initial revision.
Revision 1.1 1997/05/29 00:09:56 curt
Initial Flight Gear revision.
* Revision 1.5 1994/01/11 18:47:05 bjax
* Changed include files to use types and constants, not ls_eom.h
@@ -190,33 +160,3 @@ Initial Flight Gear revision.
#endif // _FG_GEODESY_HXX
// $Log$
// Revision 1.4 1999/01/27 04:46:15 curt
// Portability tweaks by Bernie Bright.
//
// Revision 1.3 1998/10/18 01:17:11 curt
// Point3D tweaks.
//
// Revision 1.2 1998/10/16 23:36:37 curt
// c++-ifying.
//
// Revision 1.1 1998/10/16 19:30:42 curt
// Renamed .c -> .h so we can start adding c++ supporting routines.
//
// Revision 1.4 1998/07/08 14:40:08 curt
// polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
// Updated fg_geodesy comments to reflect that routines expect and produce
// meters.
//
// Revision 1.3 1998/04/21 17:03:48 curt
// Prepairing for C++ integration.
//
// Revision 1.2 1998/01/22 02:59:38 curt
// Changed #ifdef FILE_H to #ifdef _FILE_H
//
// Revision 1.1 1997/07/31 23:13:14 curt
// Initial revision.
//

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifdef HAVE_CONFIG_H
@@ -70,45 +69,3 @@ double fg_random(void) {
}
// $Log$
// Revision 1.10 1998/11/07 19:07:03 curt
// Enable release builds using the --without-logging option to the configure
// script. Also a couple log message cleanups, plus some C to C++ comment
// conversion.
//
// Revision 1.9 1998/11/06 21:17:26 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.8 1998/04/25 22:06:23 curt
// Edited cvs log messages in source files ... bad bad bad!
//
// Revision 1.7 1998/04/24 00:43:13 curt
// Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
//
// Revision 1.6 1998/04/18 03:53:42 curt
// Miscellaneous Tweaks.
//
// Revision 1.5 1998/04/03 22:10:29 curt
// Converting to Gnu autoconf system.
//
// Revision 1.4 1998/02/03 23:20:28 curt
// Lots of little tweaks to fix various consistency problems discovered by
// Solaris' CC. Fixed a bug in fg_debug.c with how the fgPrintf() wrapper
// passed arguments along to the real printf(). Also incorporated HUD changes
// by Michele America.
//
// Revision 1.3 1998/01/27 00:47:59 curt
// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
// system and commandline/config file processing code.
//
// Revision 1.2 1997/12/30 20:47:48 curt
// Integrated new event manager with subsystem initializations.
//
// Revision 1.1 1997/07/30 16:04:09 curt
// Moved random routines from Utils/ to Math/
//
// Revision 1.1 1997/07/19 22:31:57 curt
// Initial revision.
//

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifndef _FG_RANDOM_H
@@ -47,24 +46,3 @@ double fg_random(void);
#endif // _FG_RANDOM_H
// $Log$
// Revision 1.4 1998/11/07 19:07:04 curt
// Enable release builds using the --without-logging option to the configure
// script. Also a couple log message cleanups, plus some C to C++ comment
// conversion.
//
// Revision 1.3 1998/04/21 17:03:48 curt
// Prepairing for C++ integration.
//
// Revision 1.2 1998/01/22 02:59:38 curt
// Changed #ifdef FILE_H to #ifdef _FILE_H
//
// Revision 1.1 1997/07/30 16:04:09 curt
// Moved random routines from Utils/ to Math/
//
// Revision 1.2 1997/07/23 21:52:28 curt
// Put comments around the text after an #endif for increased portability.
//
// Revision 1.1 1997/07/19 22:31:57 curt
// Initial revision.
//

30
Lib/Math/geotest.c Normal file
View File

@@ -0,0 +1,30 @@
#include <Include/fg_constants.h>
#include <Math/fg_geodesy.h>
#include <stdio.h>
void
main( void )
{
double Lon, Alt, sl_radius;
double geodetic_Lat;
double geocentric_Lat;
Lon = -87.75 * DEG_TO_RAD;
geodetic_Lat = 41.83 * DEG_TO_RAD;
Alt = 1.5; /* km */
printf("Geodetic position = (%.8f, %.8f, %.8f)\n", Lon, geodetic_Lat, Alt);
fgGeodToGeoc( geodetic_Lat, Alt, &sl_radius, &geocentric_Lat );
printf("Geocentric position = (%.8f, %.8f, %.8f)\n", Lon, geocentric_Lat,
sl_radius + Alt);
printf("new sl_radius = %.8f\n", sl_radius);
fgGeocToGeod( geocentric_Lat, sl_radius + Alt, &geodetic_Lat,
&Alt, &sl_radius );
printf("Geodetic position = (%.8f, %.8f, %.8f)\n", Lon, geodetic_Lat, Alt);
printf("new sl_radius = %.8f\n", sl_radius);
}

View File

@@ -21,10 +21,15 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#include <string>
#include <Include/compiler.h>
#ifdef __MWERKS__
#include <stdlib.h> // for exit()
#endif
#include STL_STRING
#include <Debug/logstream.hxx>
#include <Include/fg_zlib.h>
@@ -46,7 +51,7 @@ fgINTERPTABLE::fgINTERPTABLE( const string& file ) {
size = 0;
in >> skipcomment;
while ( ! in.eof() ){
while ( in ) {
if ( size < MAX_TABLE_SIZE ) {
in >> table[size][0] >> table[size][1];
size++;
@@ -100,27 +105,3 @@ fgINTERPTABLE::~fgINTERPTABLE( void ) {
}
// $Log$
// Revision 1.6 1999/01/27 04:46:16 curt
// Portability tweaks by Bernie Bright.
//
// Revision 1.5 1998/11/06 21:17:27 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.4 1998/05/13 18:24:25 curt
// Wrapped zlib calls so zlib can be optionally disabled.
//
// Revision 1.3 1998/04/25 15:05:01 curt
// Changed "r" to "rb" in gzopen() options. This fixes bad behavior in win32.
//
// Revision 1.2 1998/04/22 13:18:10 curt
// C++ - ified comments. Make file open errors fatal.
//
// Revision 1.1 1998/04/21 19:14:23 curt
// Modified Files:
// Makefile.am Makefile.in
// Added Files:
// interpolater.cxx interpolater.hxx
//

View File

@@ -21,7 +21,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifndef _INTERPOLATER_H
@@ -32,10 +31,9 @@
# error This library requires C++
#endif
#include <string>
#include "Include/compiler.h"
#include STL_STRING
FG_USING_STD(string);
#define MAX_TABLE_SIZE 32
@@ -62,21 +60,3 @@ public:
#endif // _INTERPOLATER_H
// $Log$
// Revision 1.4 1999/01/27 04:46:17 curt
// Portability tweaks by Bernie Bright.
//
// Revision 1.3 1998/11/06 21:17:28 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.2 1998/04/22 13:18:10 curt
// C++ - ified comments. Make file open errors fatal.
//
// Revision 1.1 1998/04/21 19:14:23 curt
// Modified Files:
// Makefile.am Makefile.in
// Added Files:
// interpolater.cxx interpolater.hxx
//

23
Lib/Math/inttest.cxx Normal file
View File

@@ -0,0 +1,23 @@
#include <stdio.h>
#include <Debug/fg_debug.h>
#include "interpolater.hxx"
main() {
fgINTERPTABLE test("test.table");
fgInitDebug();
printf("-1.0 = %.2f\n", test.interpolate(-1.0));
printf("0.0 = %.2f\n", test.interpolate(0.0));
printf("2.9 = %.2f\n", test.interpolate(2.9));
printf("3.0 = %.2f\n", test.interpolate(3.0));
printf("3.5 = %.2f\n", test.interpolate(3.5));
printf("4.0 = %.2f\n", test.interpolate(4.0));
printf("4.5 = %.2f\n", test.interpolate(4.5));
printf("5.2 = %.2f\n", test.interpolate(5.2));
printf("8.0 = %.2f\n", test.interpolate(8.0));
printf("8.5 = %.2f\n", test.interpolate(8.5));
printf("9.0 = %.2f\n", test.interpolate(9.0));
printf("10.0 = %.2f\n", test.interpolate(10.0));
}

135
Lib/Math/leastsqs.cxx Normal file
View File

@@ -0,0 +1,135 @@
// leastsqs.c -- Implements a simple linear least squares best fit routine
//
// Written by Curtis Olson, started September 1997.
//
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
//
#include <stdio.h>
#include "leastsqs.hxx"
/*
Least squares fit:
y = b0 + b1x
n*sum(xi*yi) - (sum(xi)*sum(yi))
b1 = --------------------------------
n*sum(xi^2) - (sum(xi))^2
b0 = sum(yi)/n - b1*(sum(xi)/n)
*/
double sum_xi, sum_yi, sum_xi_2, sum_xi_yi;
int sum_n;
void least_squares(double *x, double *y, int n, double *m, double *b) {
int i;
sum_xi = sum_yi = sum_xi_2 = sum_xi_yi = 0.0;
sum_n = n;
for ( i = 0; i < n; i++ ) {
sum_xi += x[i];
sum_yi += y[i];
sum_xi_2 += x[i] * x[i];
sum_xi_yi += x[i] * y[i];
}
/* printf("sum(xi)=%.2f sum(yi)=%.2f sum(xi^2)=%.2f sum(xi*yi)=%.2f\n",
sum_xi, sum_yi, sum_xi_2, sum_xi_yi); */
*m = ( (double)sum_n * sum_xi_yi - sum_xi * sum_yi ) /
( (double)sum_n * sum_xi_2 - sum_xi * sum_xi );
*b = (sum_yi / (double)sum_n) - (*m) * (sum_xi / (double)sum_n);
/* printf("slope = %.2f intercept = %.2f\n", *m, *b); */
}
/* incrimentally update existing values with a new data point */
void least_squares_update(double x, double y, double *m, double *b) {
++sum_n;
sum_xi += x;
sum_yi += y;
sum_xi_2 += x * x;
sum_xi_yi += x * y;
/* printf("sum(xi)=%.2f sum(yi)=%.2f sum(xi^2)=%.2f sum(xi*yi)=%.2f\n",
sum_xi, sum_yi, sum_xi_2, sum_xi_yi); */
*m = ( (double)sum_n * sum_xi_yi - sum_xi * sum_yi ) /
( (double)sum_n * sum_xi_2 - sum_xi * sum_xi );
*b = (sum_yi / (double)sum_n) - (*m) * (sum_xi / (double)sum_n);
/* printf("slope = %.2f intercept = %.2f\n", *m, *b); */
}
/*
return the least squares error:
(y[i] - y_hat[i])^2
-------------------
n
*/
double least_squares_error(double *x, double *y, int n, double m, double b) {
int i;
double error, sum;
sum = 0.0;
for ( i = 0; i < n; i++ ) {
error = y[i] - (m * x[i] + b);
sum += error * error;
// printf("%.2f %.2f\n", error, sum);
}
return ( sum / (double)n );
}
/*
return the maximum least squares error:
(y[i] - y_hat[i])^2
*/
double least_squares_max_error(double *x, double *y, int n, double m, double b){
int i;
double error, max_error;
max_error = 0.0;
for ( i = 0; i < n; i++ ) {
error = y[i] - (m * x[i] + b);
error = error * error;
if ( error > max_error ) {
max_error = error;
}
}
return ( max_error );
}

73
Lib/Math/leastsqs.hxx Normal file
View File

@@ -0,0 +1,73 @@
// leastsqs.h -- Implements a simple linear least squares best fit routine
//
// Written by Curtis Olson, started September 1997.
//
// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
///
#ifndef _LEASTSQS_H
#define _LEASTSQS_H
#ifndef __cplusplus
# error This library requires C++
#endif
/*
Least squares fit:
y = b0 + b1x
n*sum(xi*yi) - (sum(xi)*sum(yi))
b1 = --------------------------------
n*sum(xi^2) - (sum(xi))^2
b0 = sum(yi)/n - b1*(sum(xi)/n)
*/
void least_squares(double *x, double *y, int n, double *m, double *b);
/* incrimentally update existing values with a new data point */
void least_squares_update(double x, double y, double *m, double *b);
/*
return the least squares error:
(y[i] - y_hat[i])^2
-------------------
n
*/
double least_squares_error(double *x, double *y, int n, double m, double b);
/*
return the maximum least squares error:
(y[i] - y_hat[i])^2
*/
double least_squares_max_error(double *x, double *y, int n, double m, double b);
#endif // _LEASTSQS_H

View File

@@ -37,6 +37,31 @@ extern "C" {
#define USE_XTRA_MAT3_INLINES
#if defined(i386)
#define USE_X86_ASM
#endif
#if defined(USE_X86_ASM)
static __inline__ int FloatToInt(float f)
{
int r;
__asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
return r;
}
#elif defined(__MSC__) && defined(__WIN32__)
static __inline int FloatToInt(float f)
{
int r;
_asm {
fld f
fistp r
}
return r;
}
#else
#define FloatToInt(F) ((int) ((F) < 0.0f ? (F)-0.5f : (F)+0.5f))
#endif
/* ------------------------------ Types --------------------------------- */
typedef double MAT3mat[4][4]; /* 4x4 matrix */

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifndef _POINT3D_HXX
@@ -30,7 +29,7 @@
# error This library requires C++
#endif
#include "Include/compiler.h"
#include <Include/compiler.h>
#ifdef FG_MATH_EXCEPTION_CLASH
# define exception c_exception
@@ -46,14 +45,24 @@
# include <math.h>
#endif
// I don't understand ... <math.h> or <cmath> should be included
// already depending on how you defined FG_HAVE_STD_INCLUDES, but I
// can go ahead and add this -- CLO
#ifdef __MWERKS__
# include <math.h> // needed fabs()
#endif
#ifndef FG_HAVE_NATIVE_SGI_COMPILERS
FG_USING_STD(ostream);
FG_USING_STD(istream);
// -rp- assert.h is buggy under MWCWP3, as multiple #include undef assert !
#ifdef __MWERKS__
# define assert(x)
#endif
// -dw- someone seems to have forgotten this...
#ifdef __MWERKS__
FG_USING_STD(std);
#endif
const double fgPoint3_Epsilon = 0.0000001;
enum {PX, PY, PZ}; // axes
@@ -104,6 +113,7 @@ public:
double& operator [] ( int i); // indexing
double operator[] (int i) const; // read-only indexing
inline const double *get_n() const { return n; };
double x() const; // cartesian x
double y() const; // cartesian y
double z() const; // cartesian z
@@ -293,9 +303,9 @@ inline Point3D operator / (const Point3D& a, const double d)
inline bool operator == (const Point3D& a, const Point3D& b)
{
return
(a.n[PX] - b.n[PX]) < fgPoint3_Epsilon &&
(a.n[PY] - b.n[PY]) < fgPoint3_Epsilon &&
(a.n[PZ] - b.n[PZ]) < fgPoint3_Epsilon;
fabs(a.n[PX] - b.n[PX]) < fgPoint3_Epsilon &&
fabs(a.n[PY] - b.n[PY]) < fgPoint3_Epsilon &&
fabs(a.n[PZ] - b.n[PZ]) < fgPoint3_Epsilon;
}
inline bool operator != (const Point3D& a, const Point3D& b)
@@ -334,33 +344,3 @@ Point3D::distance3Dsquared(const Point3D& a ) const
#endif // _POINT3D_HXX
// $Log$
// Revision 1.9 1999/02/01 21:08:28 curt
// Optimizations from Norman Vine.
//
// Revision 1.8 1999/01/27 04:46:18 curt
// Portability tweaks by Bernie Bright.
//
// Revision 1.7 1999/01/19 20:56:58 curt
// MacOS portability changes contributed by "Robert Puyol" <puyol@abvent.fr>
//
// Revision 1.6 1998/11/23 21:46:37 curt
// Borland portability tweaks.
//
// Revision 1.5 1998/11/20 01:00:38 curt
// Patch in fgGeoc2Geod() to avoid a floating explosion.
// point3d.hxx include math.h for FreeBSD
//
// Revision 1.4 1998/11/11 00:18:38 curt
// Check for domain error in fgGeoctoGeod()
//
// Revision 1.3 1998/10/20 18:21:49 curt
// Tweaks from Bernie Bright.
//
// Revision 1.2 1998/10/18 01:17:12 curt
// Point3D tweaks.
//
// Revision 1.1 1998/10/16 00:50:29 curt
// Added point3d.hxx to replace cheezy fgPoint3d struct.
//
//

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#include <math.h>
@@ -60,51 +59,3 @@ double fgGeodAltFromCart(const Point3D& cp)
}
// $Log$
// Revision 1.6 1999/01/27 04:46:19 curt
// Portability tweaks by Bernie Bright.
//
// Revision 1.5 1998/10/18 01:17:13 curt
// Point3D tweaks.
//
// Revision 1.4 1998/10/16 19:30:09 curt
// C++-ified the comments.
//
// Revision 1.3 1998/10/16 00:50:29 curt
// Added point3d.hxx to replace cheezy fgPoint3d struct.
//
// Revision 1.2 1998/08/24 20:04:11 curt
// Various "inline" code optimizations contributed by Norman Vine.
//
// Revision 1.1 1998/07/08 14:40:08 curt
// polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
// Updated fg_geodesy comments to reflect that routines expect and produce
// meters.
//
// Revision 1.2 1998/05/03 00:45:49 curt
// Commented out a debugging printf.
//
// Revision 1.1 1998/05/02 01:50:11 curt
// polar.[ch] renamed to polar3d.[ch]
//
// Revision 1.6 1998/04/25 22:06:23 curt
// Edited cvs log messages in source files ... bad bad bad!
//
// Revision 1.5 1998/01/27 00:48:00 curt
// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
// system and commandline/config file processing code.
//
// Revision 1.4 1998/01/19 19:27:12 curt
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
// This should simplify things tremendously.
//
// Revision 1.3 1997/12/15 23:54:54 curt
// Add xgl wrappers for debugging.
// Generate terrain normals on the fly.
//
// Revision 1.2 1997/07/31 22:52:27 curt
// Working on redoing internal coordinate systems & scenery transformations.
//
// Revision 1.1 1997/07/07 21:02:36 curt
// Initial revision.

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifndef _POLAR_HXX
@@ -66,55 +65,3 @@ inline Point3D fgCartToPolar3d(const Point3D& cp) {
#endif // _POLAR_HXX
// $Log$
// Revision 1.5 1999/01/27 04:46:20 curt
// Portability tweaks by Bernie Bright.
//
// Revision 1.4 1998/10/16 19:30:07 curt
// C++-ified the comments.
//
// Revision 1.3 1998/10/16 00:50:30 curt
// Added point3d.hxx to replace cheezy fgPoint3d struct.
//
// Revision 1.2 1998/08/24 20:04:12 curt
// Various "inline" code optimizations contributed by Norman Vine.
//
// Revision 1.1 1998/07/08 14:40:09 curt
// polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
// Updated fg_geodesy comments to reflect that routines expect and produce
// meters.
//
// Revision 1.1 1998/05/02 01:50:11 curt
// polar.[ch] renamed to polar3d.[ch]
//
// Revision 1.9 1998/04/25 22:06:23 curt
// Edited cvs log messages in source files ... bad bad bad!
//
// Revision 1.8 1998/04/21 17:03:50 curt
// Prepairing for C++ integration.
//
// Revision 1.7 1998/01/27 00:48:00 curt
// Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
// system and commandline/config file processing code.
//
// Revision 1.6 1998/01/22 02:59:39 curt
// Changed #ifdef FILE_H to #ifdef _FILE_H
//
// Revision 1.5 1998/01/19 19:27:13 curt
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
// This should simplify things tremendously.
//
// Revision 1.4 1997/12/15 23:54:55 curt
// Add xgl wrappers for debugging.
// Generate terrain normals on the fly.
//
// Revision 1.3 1997/07/31 22:52:28 curt
// Working on redoing internal coordinate systems & scenery transformations.
//
// Revision 1.2 1997/07/23 21:52:21 curt
// Put comments around the text after an #endif for increased portability.
//
// Revision 1.1 1997/07/07 21:02:37 curt
// Initial revision.
//

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#include <math.h>
@@ -82,7 +81,7 @@ void map_vec_onto_cur_surface_plane(MAT3vec normal, MAT3vec v0, MAT3vec vec,
// find the shortest distance from the point to the line
double fgPointLine(MAT3vec p, MAT3vec p0, MAT3vec d) {
MAT3vec u, u1, v;
double ud, dd, tmp, dist;
double ud, dd, tmp;
// u = p - p0
MAT3_SUB_VEC(u, p, p0);
@@ -99,9 +98,7 @@ double fgPointLine(MAT3vec p, MAT3vec p0, MAT3vec d) {
// original point, p.
MAT3_SUB_VEC(v, u, u1);
dist = sqrt(MAT3_DOT_PRODUCT(v, v));
return( dist );
return sqrt(MAT3_DOT_PRODUCT(v, v));
}
@@ -130,32 +127,3 @@ double fgPointLineSquared(MAT3vec p, MAT3vec p0, MAT3vec d) {
}
// $Log$
// Revision 1.5 1998/10/16 23:36:38 curt
// c++-ifying.
//
// Revision 1.4 1998/10/16 00:50:31 curt
// Added point3d.hxx to replace cheezy fgPoint3d struct.
//
// Revision 1.3 1998/08/24 20:04:12 curt
// Various "inline" code optimizations contributed by Norman Vine.
//
// Revision 1.2 1998/07/24 21:34:38 curt
// fgPointLine() rewritten into fgPointLineSquared() ... this ultimately saves
// us from doing a sqrt().
//
// Revision 1.1 1998/07/08 14:40:10 curt
// polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
// Updated fg_geodesy comments to reflect that routines expect and produce
// meters.
//
// Revision 1.3 1998/05/07 23:04:28 curt
// Added a blank formating line!
//
// Revision 1.2 1998/01/19 19:27:13 curt
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
// This should simplify things tremendously.
//
// Revision 1.1 1997/12/22 04:13:17 curt
// Initial revision.
//

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifndef _VECTOR_HXX
@@ -62,33 +61,3 @@ double fgPointLineSquared(MAT3vec p, MAT3vec p0, MAT3vec d);
#endif // _VECTOR_HXX
// $Log$
// Revision 1.4 1998/10/16 23:36:39 curt
// c++-ifying.
//
// Revision 1.3 1998/08/24 20:04:13 curt
// Various "inline" code optimizations contributed by Norman Vine.
//
// Revision 1.2 1998/07/24 21:34:38 curt
// fgPointLine() rewritten into fgPointLineSquared() ... this ultimately saves
// us from doing a sqrt().
//
// Revision 1.1 1998/07/08 14:40:10 curt
// polar3d.[ch] renamed to polar3d.[ch]xx, vector.[ch] renamed to vector.[ch]xx
// Updated fg_geodesy comments to reflect that routines expect and produce
// meters.
//
// Revision 1.4 1998/04/21 17:03:51 curt
// Prepairing for C++ integration.
//
// Revision 1.3 1998/01/22 02:59:39 curt
// Changed #ifdef FILE_H to #ifdef _FILE_H
//
// Revision 1.2 1998/01/19 19:27:14 curt
// Merged in make system changes from Bob Kuehne <rpk@sgi.com>
// This should simplify things tremendously.
//
// Revision 1.1 1997/12/22 04:13:18 curt
// Initial revision.
//

View File

@@ -3,6 +3,7 @@
noinst_LIBRARIES = libMisc.a
libMisc_a_SOURCES = \
fgpath.cxx fgpath.hxx \
fgstream.cxx fgstream.hxx \
stopwatch.hxx \
strutils.cxx strutils.hxx \

101
Lib/Misc/fgpath.cxx Normal file
View File

@@ -0,0 +1,101 @@
//
// fgpath.cxx -- routines to abstract out path separator differences
// between MacOS and the rest of the world
//
// Written by Curtis L. Olson, started April 1999.
//
// Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
#include "fgpath.hxx"
// If Unix, replace all ":" with "/". If MacOS, replace all "/" with
// ":" it should go without saying that neither of these characters
// should be used in file or directory names. In windoze, allow the
// second character to be a ":" for things like c:\foo\bar
static string fix_path( const string path ) {
string result = path;
for ( int i = 0; i < (int)path.size(); ++i ) {
#if defined( WIN32 )
// for windoze, don't replace the ":" for the second character
if ( i == 1 ) {
continue;
}
#endif
if ( result[i] == FG_BAD_PATH_SEP ) {
result[i] = FG_PATH_SEP;
}
}
return result;
}
// default constructor
FGPath::FGPath() {
path = "";
}
// create a path based on "path"
FGPath::FGPath( const string p ) {
set( p );
}
// destructor
FGPath::~FGPath() {
}
// set path
void FGPath::set( const string p ) {
path = fix_path( p );
}
// append another piece to the existing path
void FGPath::append( const string p ) {
string part = fix_path( p );
if ( path.size() == 0 ) {
path = part;
} else {
if ( part[0] != FG_PATH_SEP ) {
path += FG_PATH_SEP;
}
path += part;
}
}
// concatenate a string to the end of the path without inserting a
// path separator
void FGPath::concat( const string p ) {
string part = fix_path( p );
if ( path.size() == 0 ) {
path = part;
} else {
path += part;
}
}

85
Lib/Misc/fgpath.hxx Normal file
View File

@@ -0,0 +1,85 @@
//
// fgpath.hxx -- routines to abstract out path separator differences
// between MacOS and the rest of the world
//
// Written by Curtis L. Olson, started April 1999.
//
// Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
#ifndef _FGPATH_HXX
#define _FGPATH_HXX
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Include/compiler.h>
#include STL_STRING
FG_USING_STD(string);
#ifdef MACOS
# define FG_PATH_SEP ':'
# define FG_BAD_PATH_SEP '/'
#else
# define FG_PATH_SEP '/'
# define FG_BAD_PATH_SEP ':'
#endif
class FGPath {
private:
string path;
public:
// default constructor
FGPath();
// create a path based on "path"
FGPath( const string p );
// destructor
~FGPath();
// set path
void set( const string p );
// append another piece to the existing path
void append( const string p );
// concatenate a string to the end of the path without inserting a
// path separator
void concat( const string p );
// get the path string
inline string str() const { return path; }
inline const char *c_str() { return path.c_str(); }
};
#endif // _FGPATH_HXX

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#include <ctype.h> // isspace()
#include <Misc/fgstream.hxx>
@@ -96,25 +95,52 @@ skipeol( istream& in )
{
char c = 0;
// skip to end of line.
while ( in.get(c) && (c != '\n' && c != '\r') )
;
while ( in.get(c) ) {
if ( (c == '\n') || (c == '\r') ) {
break;
}
#ifdef __MWERKS__
// also break on '\0'
if ( c == '\0' ) {
break;
}
#endif
}
// \r\n ?
return in;
}
istream&
skipws( istream& in )
{
skipws( istream& in ) {
char c;
while ( in.get(c) )
{
if ( ! isspace( c ) )
{
while ( in.get(c) ) {
#ifdef __MWERKS__
// -dw- for unix file compatibility
// -clo- this causes problems for unix
if ( (c == '\n') || (c == '\r') || (c == '\0') ) {
break;
}
if ( ! isspace( c ) && c != '\n' ) {
// put pack the non-space character
in.putback(c);
break;
}
#else
if ( ! isspace( c ) ) {
// put pack the non-space character
in.putback(c);
break;
}
#endif
}
return in;
}
@@ -125,7 +151,11 @@ skipcomment( istream& in )
while ( in )
{
// skip whitespace
#ifdef __MWERKS__
in >> ::skipws;
#else
in >> skipws;
#endif
char c;
if ( in.get( c ) && c != '#' )
@@ -139,13 +169,3 @@ skipcomment( istream& in )
return in;
}
// $Log$
// Revision 1.3 1998/11/06 14:05:12 curt
// More portability improvements by Bernie Bright.
//
// Revision 1.2 1998/09/24 15:22:17 curt
// Additional enhancements.
//
// Revision 1.1 1998/09/01 19:06:29 curt
// Initial revision.
//

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifndef _FGSTREAM_HXX
#define _FGSTREAM_HXX
@@ -32,21 +31,29 @@
# include "Include/config.h"
#endif
#include <string>
#include <Include/compiler.h>
#include "Include/compiler.h"
#ifdef FG_HAVE_STD_INCLUDES
#if defined( FG_HAVE_STD_INCLUDES )
# include <istream>
#elif defined ( FG_HAVE_NATIVE_SGI_COMPILERS )
# include <CC/stream.h>
#elif defined ( __BORLANDC__ )
# include <iostream>
#else
# include <istream.h>
#endif
FG_USING_STD(string);
FG_USING_STD(istream);
#include STL_STRING
#include "zfstream.hxx"
FG_USING_STD(string);
#ifndef FG_HAVE_NATIVE_SGI_COMPILERS
FG_USING_STD(istream);
#endif
//-----------------------------------------------------------------------------
//
// Envelope class for gzifstream.
@@ -72,6 +79,8 @@ public:
void close() { gzbuf.close(); }
bool is_open() { return gzbuf.is_open(); }
private:
// Not defined!
fg_gzifstream( const fg_gzifstream& );
@@ -91,22 +100,3 @@ istream& skipcomment( istream& in );
#endif /* _FGSTREAM_HXX */
// $Log$
// Revision 1.6 1999/01/19 20:41:46 curt
// Portability updates contributed by Bernie Bright.
//
// Revision 1.5 1998/11/06 14:05:13 curt
// More portability improvements by Bernie Bright.
//
// Revision 1.4 1998/10/16 00:50:56 curt
// Remove leading _ from a couple defines.
//
// Revision 1.3 1998/10/13 00:10:06 curt
// More portability changes to help with windoze compilation problems.
//
// Revision 1.2 1998/09/24 15:22:18 curt
// Additional enhancements.
//
// Revision 1.1 1998/09/01 19:06:29 curt
// Initial revision.
//

View File

@@ -23,26 +23,6 @@
* For more information, please see the Blitz++ Home Page:
* http://seurat.uwaterloo.ca/blitz/
*
***************************************************************************
* $Log$
* Revision 1.3 1998/11/20 01:01:03 curt
* FreeBSD support.
*
* Revision 1.2 1998/11/02 18:28:31 curt
* Additional win32 support.
*
* Revision 1.1 1998/09/01 19:06:30 curt
* Initial revision.
*
* Revision 1.4 1998/03/14 00:04:47 tveldhui
* 0.2-alpha-05
*
* Revision 1.3 1997/07/16 14:51:20 tveldhui
* Update: Alpha release 0.2 (Arrays)
*
* Revision 1.2 1997/01/24 14:42:00 tveldhui
* Periodic RCS update
*
*/
// This class is not portable to non System V platforms.

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -70,10 +69,3 @@ trim( const string& s, const string& trimmings )
return trimright( trimleft( s, trimmings ), trimmings );
}
// $Log$
// Revision 1.2 1998/10/18 01:17:15 curt
// Point3D tweaks.
//
// Revision 1.1 1998/09/01 19:06:30 curt
// Initial revision.
//

View File

@@ -19,13 +19,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifndef STRUTILS_H
#define STRUTILS_H
#include <string>
#include "Include/compiler.h"
#include <Include/compiler.h>
#include STL_STRING
#ifdef FG_HAVE_STD_INCLUDES
# include <cstdlib>
@@ -63,16 +62,3 @@ atoi( const string& str )
#endif // STRUTILS_H
// $Log$
// Revision 1.4 1999/01/19 20:41:47 curt
// Portability updates contributed by Bernie Bright.
//
// Revision 1.3 1998/10/16 00:50:57 curt
// Remove leading _ from a couple defines.
//
// Revision 1.2 1998/10/13 00:10:07 curt
// More portability changes to help with windoze compilation problems.
//
// Revision 1.1 1998/09/01 19:06:31 curt
// Initial revision.
//

View File

@@ -20,7 +20,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#include <memory.h>
#include "zfstream.hxx"
@@ -308,10 +307,3 @@ gzifstream::close()
}
#endif
// $Log$
// Revision 1.3 1999/01/19 20:41:48 curt
// Portability updates contributed by Bernie Bright.
//
// Revision 1.2 1998/11/06 14:05:14 curt
// More portability improvements by Bernie Bright.
//

View File

@@ -20,7 +20,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifndef _zfstream_hxx
#define _zfstream_hxx
@@ -66,6 +65,8 @@ FG_USING_STD(streamoff);
#if defined(__GNUC__) && __GNUC_MINOR__ < 8
# define ios_binary ios::bin
#elif defined( FG_HAVE_NATIVE_SGI_COMPILERS )
# define ios_binary 0
#else
# define ios_binary ios::binary
#endif
@@ -151,19 +152,3 @@ struct gzifstream_base
#endif // _zfstream_hxx
// $Log$
// Revision 1.7 1999/01/19 20:41:49 curt
// Portability updates contributed by Bernie Bright.
//
// Revision 1.6 1998/12/07 21:10:26 curt
// Portability improvements.
//
// Revision 1.5 1998/11/06 21:17:29 curt
// Converted to new logstream debugging facility. This allows release
// builds with no messages at all (and no performance impact) by using
// the -DFG_NDEBUG flag.
//
// Revision 1.4 1998/11/06 14:05:16 curt
// More portability improvements by Bernie Bright.
//

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifdef HAVE_CONFIG_H
@@ -335,47 +334,3 @@ int fgSERIAL::write_port(const string& value) {
}
// $Log$
// Revision 1.9 1999/02/02 20:13:23 curt
// MSVC++ portability changes by Bernie Bright:
//
// Lib/Serial/serial.[ch]xx: Initial Windows support - incomplete.
// Simulator/Astro/stars.cxx: typo? included <stdio> instead of <cstdio>
// Simulator/Cockpit/hud.cxx: Added Standard headers
// Simulator/Cockpit/panel.cxx: Redefinition of default parameter
// Simulator/Flight/flight.cxx: Replaced cout with FG_LOG. Deleted <stdio.h>
// Simulator/Main/fg_init.cxx:
// Simulator/Main/GLUTmain.cxx:
// Simulator/Main/options.hxx: Shuffled <fg_serial.hxx> dependency
// Simulator/Objects/material.hxx:
// Simulator/Time/timestamp.hxx: VC++ friend kludge
// Simulator/Scenery/tile.[ch]xx: Fixed using std::X declarations
// Simulator/Main/views.hxx: Added a constant
//
// Revision 1.8 1999/01/20 13:42:21 curt
// Tweaked FDM interface.
// Testing check sum support for NMEA serial output.
//
// Revision 1.7 1998/12/04 01:24:35 curt
// Tweak for SGI portability.
//
// Revision 1.6 1998/11/30 17:15:29 curt
// Having the class destructor close the fd was a bad idea ... especially if you
// ever make a copy of the instance and then subsequently destroy either.
// close_port() is now a separate member function.
//
// Revision 1.5 1998/11/25 01:33:23 curt
// Remove call to cfmakeraw()
//
// Revision 1.4 1998/11/23 21:47:00 curt
// Cygnus tools compatibility tweaks.
//
// Revision 1.3 1998/11/19 13:52:54 curt
// port configuration tweaks & experiments.
//
// Revision 1.2 1998/11/19 03:35:43 curt
// Updates ...
//
// Revision 1.1 1998/11/16 13:53:02 curt
// Initial revision.
//

View File

@@ -19,7 +19,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id$
// (Log is kept at end of this file)
#ifndef _SERIAL_HXX
@@ -34,14 +33,14 @@
# include <config.h>
#endif
#include "Include/compiler.h"
#include <string>
FG_USING_STD(string);
#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined( __CYGWIN32__ )
# include <windows.h>
#endif
#include <Include/compiler.h>
#include STL_STRING
FG_USING_STD(string);
// if someone know how to do this all with C++ streams let me know
// #include <stdio.h>
@@ -79,28 +78,3 @@ public:
#endif // _SERIAL_HXX
// $Log$
// Revision 1.3 1999/02/02 20:13:24 curt
// MSVC++ portability changes by Bernie Bright:
//
// Lib/Serial/serial.[ch]xx: Initial Windows support - incomplete.
// Simulator/Astro/stars.cxx: typo? included <stdio> instead of <cstdio>
// Simulator/Cockpit/hud.cxx: Added Standard headers
// Simulator/Cockpit/panel.cxx: Redefinition of default parameter
// Simulator/Flight/flight.cxx: Replaced cout with FG_LOG. Deleted <stdio.h>
// Simulator/Main/fg_init.cxx:
// Simulator/Main/GLUTmain.cxx:
// Simulator/Main/options.hxx: Shuffled <fg_serial.hxx> dependency
// Simulator/Objects/material.hxx:
// Simulator/Time/timestamp.hxx: VC++ friend kludge
// Simulator/Scenery/tile.[ch]xx: Fixed using std::X declarations
// Simulator/Main/views.hxx: Added a constant
//
// Revision 1.2 1998/11/30 17:15:30 curt
// Having the class destructor close the fd was a bad idea ... especially if you
// ever make a copy of the instance and then subsequently destroy either.
// close_port() is now a separate member function.
//
// Revision 1.1 1998/11/16 13:53:02 curt
// Initial revision.
//

View File

@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <string.h>
#if !defined( __CYGWIN__ ) && !defined( __CYGWIN32__ )
#if !defined( WIN32 )
# if !defined( HAVE_STL_SGI_PORT ) && !defined( __MWERKS__ )
// Avoid malloc with STLport and MSL
# include <malloc.h>
@@ -28,12 +28,7 @@
int xglTraceOn = TRUE ;
#ifndef WIN32
FILE *xglTraceFd = stdout ;
#else /* WIN32 */
/* Bail for now, we just want it to compile I guess */
FILE *xglTraceFd = NULL;
#endif /* WIN32 */
FILE *xglTraceFd = NULL;
struct GLenumLookup
{

72
Lib/zlib/FAQ Normal file
View File

@@ -0,0 +1,72 @@
Frequently Asked Questions about zlib
If your question is not there, please check the zlib home page
http://www.cdrom.com/pub/infozip/zlib/ which may have more recent information.
1) I need a Windows DLL
2) I need a Visual Basic interface to zlib
3) compress() returns Z_BUF_ERROR
4) deflate or inflate returns Z_BUF_ERROR
5) Where is the zlib documentation (man pages, etc...)?
6) Why don't you use GNU autoconf, libtool, etc...?
7) There is a bug in zlib.
8) I get "undefined reference to gzputc"
1) I need a Windows DLL
The zlib sources can be compiled without change to produce a DLL.
If you want a precompiled DLL, see http://www.winimage.com/zLibDll
2) I need a Visual Basic interface to zlib
See http://www.tcfb.com/dowseware/cmp-z-it.zip
http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm
and contrib/visual-basic.txt
3) compress() returns Z_BUF_ERROR
Make sure that before the call of compress, the length of the
compressed buffer is equal to the total size of the compressed buffer
and not zero. For Visual Basic, check that this parameter is passed
by reference ("as any"), not by value ("as long").
4) deflate or inflate returns Z_BUF_ERROR
Make sure that before the call avail_in and avail_out are not zero.
5) Where is the zlib documentation (man pages, etc...)?
It's in zlib.h for the moment. Volunteers to transform this
to man pages, please contact jloup@gzip.org. Examples of zlib usage
are in the files example.c and minigzip.c.
6) Why don't you use GNU autoconf, libtool, etc...?
Because we would like to keep zlib as a very small and simple package.
zlib is rather portable and doesn't need much configuration.
7) There is a bug in zlib.
Most of the time, such problems are due to an incorrect usage
of zlib. Please try to reproduce the problem with a small
program and send us the corresponding source at zlib@quest.jpl.nasa.gov
Do not send multi-megabyte data files without prior agreement.
8) I get "undefined reference to gzputc"
If "make test" produces something like
example.o(.text+0x174):
check that you don't have old files libz.* in /usr/lib, /usr/local/lib
or /usr/X11R6/lib. Remove old versions then do "make install".

115
Lib/zlib/Make_vms.com Normal file
View File

@@ -0,0 +1,115 @@
$! make libz under VMS
$! written by Martin P.J. Zinser <m.zinser@gsi.de>
$!
$! Look for the compiler used
$!
$ ccopt = ""
$ if f$getsyi("HW_MODEL").ge.1024
$ then
$ ccopt = "/prefix=all"+ccopt
$ comp = "__decc__=1"
$ if f$trnlnm("SYS").eqs."" then define sys sys$library:
$ else
$ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs.""
$ then
$ comp = "__vaxc__=1"
$ if f$trnlnm("SYS").eqs."" then define sys sys$library:
$ else
$ if f$trnlnm("SYS").eqs."" then define sys decc$library_include:
$ ccopt = "/decc/prefix=all"+ccopt
$ comp = "__decc__=1"
$ endif
$ endif
$!
$! Build the thing plain or with mms
$!
$ write sys$output "Compiling Zlib sources ..."
$ if f$search("SYS$SYSTEM:MMS.EXE").eqs.""
$ then
$ dele example.obj;*,minigzip.obj;*
$ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -
adler32.c zlib.h zconf.h
$ CALL MAKE compress.OBJ "CC ''CCOPT' compress" -
compress.c zlib.h zconf.h
$ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -
crc32.c zlib.h zconf.h
$ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -
deflate.c deflate.h zutil.h zlib.h zconf.h
$ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" -
gzio.c zutil.h zlib.h zconf.h
$ CALL MAKE infblock.OBJ "CC ''CCOPT' infblock" -
infblock.c zutil.h zlib.h zconf.h infblock.h
$ CALL MAKE infcodes.OBJ "CC ''CCOPT' infcodes" -
infcodes.c zutil.h zlib.h zconf.h inftrees.h
$ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -
inffast.c zutil.h zlib.h zconf.h inffast.h
$ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -
inflate.c zutil.h zlib.h zconf.h infblock.h
$ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -
inftrees.c zutil.h zlib.h zconf.h inftrees.h
$ CALL MAKE infutil.OBJ "CC ''CCOPT' infutil" -
infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h
$ CALL MAKE trees.OBJ "CC ''CCOPT' trees" -
trees.c deflate.h zutil.h zlib.h zconf.h
$ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -
uncompr.c zlib.h zconf.h
$ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
zutil.c zutil.h zlib.h zconf.h
$ write sys$output "Building Zlib ..."
$ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ
$ write sys$output "Building example..."
$ CALL MAKE example.OBJ "CC ''CCOPT' example" -
example.c zlib.h zconf.h
$ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb
$ write sys$output "Building minigzip..."
$ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" -
minigzip.c zlib.h zconf.h
$ call make minigzip.exe -
"LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" -
minigzip.obj libz.olb
$ else
$ mms/macro=('comp')
$ endif
$ write sys$output "Zlib build completed"
$ exit
$!
$!
$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
$ V = 'F$Verify(0)
$! P1 = What we are trying to make
$! P2 = Command to make it
$! P3 - P8 What it depends on
$
$ If F$Search(P1) .Eqs. "" Then Goto Makeit
$ Time = F$CvTime(F$File(P1,"RDT"))
$arg=3
$Loop:
$ Argument = P'arg
$ If Argument .Eqs. "" Then Goto Exit
$ El=0
$Loop2:
$ File = F$Element(El," ",Argument)
$ If File .Eqs. " " Then Goto Endl
$ AFile = ""
$Loop3:
$ OFile = AFile
$ AFile = F$Search(File)
$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
$ Goto Loop3
$NextEL:
$ El = El + 1
$ Goto Loop2
$EndL:
$ arg=arg+1
$ If arg .Le. 8 Then Goto Loop
$ Goto Exit
$
$Makeit:
$ VV=F$VERIFY(0)
$ write sys$output P2
$ 'P2
$ VV='F$Verify(VV)
$Exit:
$ If V Then Set Verify
$ENDSUBROUTINE

151
Lib/zlib/Makefile.riscos Normal file
View File

@@ -0,0 +1,151 @@
# Project: zlib_1_03
# Patched for zlib 1.1.2 rw@shadow.org.uk 19980430
# test works out-of-the-box, installs `somewhere' on demand
# Toolflags:
CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah
C++flags = -c -depend !Depend -IC: -throwback
Linkflags = -aif -c++ -o $@
ObjAsmflags = -throwback -NoCache -depend !Depend
CMHGflags =
LibFileflags = -c -l -o $@
Squeezeflags = -o $@
# change the line below to where _you_ want the library installed.
libdest = lib:zlib
# Final targets:
@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \
@.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \
@.o.uncompr @.o.zutil
LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \
@.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \
@.o.trees @.o.uncompr @.o.zutil
test: @.minigzip @.example @.lib
@copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV
@echo running tests: hang on.
@/@.minigzip -f -9 libc
@/@.minigzip -d libc-gz
@/@.minigzip -f -1 libc
@/@.minigzip -d libc-gz
@/@.minigzip -h -9 libc
@/@.minigzip -d libc-gz
@/@.minigzip -h -1 libc
@/@.minigzip -d libc-gz
@/@.minigzip -9 libc
@/@.minigzip -d libc-gz
@/@.minigzip -1 libc
@/@.minigzip -d libc-gz
@diff @.lib @.libc
@echo that should have reported '@.lib and @.libc identical' if you have diff.
@/@.example @.fred @.fred
@echo that will have given lots of hello!'s.
@.minigzip: @.o.minigzip @.lib C:o.Stubs
Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs
@.example: @.o.example @.lib C:o.Stubs
Link $(Linkflags) @.o.example @.lib C:o.Stubs
install: @.lib
cdir $(libdest)
cdir $(libdest).h
@copy @.h.zlib $(libdest).h.zlib A~C~DF~L~N~P~Q~RS~TV
@copy @.h.zconf $(libdest).h.zconf A~C~DF~L~N~P~Q~RS~TV
@copy @.lib $(libdest).lib A~C~DF~L~N~P~Q~RS~TV
@echo okay, installed zlib in $(libdest)
clean:; remove @.minigzip
remove @.example
remove @.libc
-wipe @.o.* F~r~cV
remove @.fred
# User-editable dependencies:
.c.o:
cc $(ccflags) -o $@ $<
# Static dependencies:
# Dynamic dependencies:
o.example: c.example
o.example: h.zlib
o.example: h.zconf
o.minigzip: c.minigzip
o.minigzip: h.zlib
o.minigzip: h.zconf
o.adler32: c.adler32
o.adler32: h.zlib
o.adler32: h.zconf
o.compress: c.compress
o.compress: h.zlib
o.compress: h.zconf
o.crc32: c.crc32
o.crc32: h.zlib
o.crc32: h.zconf
o.deflate: c.deflate
o.deflate: h.deflate
o.deflate: h.zutil
o.deflate: h.zlib
o.deflate: h.zconf
o.gzio: c.gzio
o.gzio: h.zutil
o.gzio: h.zlib
o.gzio: h.zconf
o.infblock: c.infblock
o.infblock: h.zutil
o.infblock: h.zlib
o.infblock: h.zconf
o.infblock: h.infblock
o.infblock: h.inftrees
o.infblock: h.infcodes
o.infblock: h.infutil
o.infcodes: c.infcodes
o.infcodes: h.zutil
o.infcodes: h.zlib
o.infcodes: h.zconf
o.infcodes: h.inftrees
o.infcodes: h.infblock
o.infcodes: h.infcodes
o.infcodes: h.infutil
o.infcodes: h.inffast
o.inffast: c.inffast
o.inffast: h.zutil
o.inffast: h.zlib
o.inffast: h.zconf
o.inffast: h.inftrees
o.inffast: h.infblock
o.inffast: h.infcodes
o.inffast: h.infutil
o.inffast: h.inffast
o.inflate: c.inflate
o.inflate: h.zutil
o.inflate: h.zlib
o.inflate: h.zconf
o.inflate: h.infblock
o.inftrees: c.inftrees
o.inftrees: h.zutil
o.inftrees: h.zlib
o.inftrees: h.zconf
o.inftrees: h.inftrees
o.inftrees: h.inffixed
o.infutil: c.infutil
o.infutil: h.zutil
o.infutil: h.zlib
o.infutil: h.zconf
o.infutil: h.infblock
o.infutil: h.inftrees
o.infutil: h.infcodes
o.infutil: h.infutil
o.trees: c.trees
o.trees: h.deflate
o.trees: h.zutil
o.trees: h.zlib
o.trees: h.zconf
o.trees: h.trees
o.uncompr: c.uncompr
o.uncompr: h.zlib
o.uncompr: h.zconf
o.zutil: c.zutil
o.zutil: h.zutil
o.zutil: h.zlib
o.zutil: h.zconf

View File

@@ -0,0 +1,66 @@
# Amiga powerUP (TM) Makefile
# makefile for libpng and SAS C V6.58/7.00 PPC compiler
# Copyright (C) 1998 by Andreas R. Kleinert
CC = scppc
CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \
OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8
LIBNAME = libzip.a
AR = ppc-amigaos-ar
AR_FLAGS = cr
RANLIB = ppc-amigaos-ranlib
LDFLAGS = -r -o
LDLIBS = LIB:scppc.a
LN = ppc-amigaos-ld
RM = delete quiet
OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
TEST_OBJS = example.o minigzip.o
all: example minigzip
test: all
example
echo hello world | minigzip | minigzip -d
$(LIBNAME): $(OBJS)
$(AR) $(AR_FLAGS) $@ $(OBJS)
$(RANLIB) $@
example: example.o $(LIBNAME)
$(LN) $(LDFLAGS) example LIB:c_ppc.o example.o $(LIBNAME) $(LDLIBS) LIB:end.o
minigzip: minigzip.o $(LIBNAME)
$(LN) $(LDFLAGS) minigzip LIB:c_ppc.o minigzip.o $(LIBNAME) $(LDLIBS) LIB:end.o
clean:
$(RM) *.o example minigzip $(LIBNAME) foo.gz
zip:
zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \
descrip.mms *.[ch]
tgz:
cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \
zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch]
# DO NOT DELETE THIS LINE -- make depend depends on it.
adler32.o: zutil.h zlib.h zconf.h
compress.o: zlib.h zconf.h
crc32.o: zutil.h zlib.h zconf.h
deflate.o: deflate.h zutil.h zlib.h zconf.h
example.o: zlib.h zconf.h
gzio.o: zutil.h zlib.h zconf.h
infblock.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
infcodes.o: zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
inflate.o: zutil.h zlib.h zconf.h infblock.h
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
infutil.o: zutil.h zlib.h zconf.h inftrees.h infutil.h
minigzip.o: zlib.h zconf.h
trees.o: deflate.h zutil.h zlib.h zconf.h
uncompr.o: zlib.h zconf.h
zutil.o: zutil.h zlib.h zconf.h

View File

@@ -0,0 +1,64 @@
# SMakefile for zlib
# Modified from the standard UNIX Makefile Copyright Jean-loup Gailly
# Osma Ahvenlampi <Osma.Ahvenlampi@hut.fi>
# Amiga, SAS/C 6.56 & Smake
CC=sc
CFLAGS=OPT
#CFLAGS=OPT CPU=68030
#CFLAGS=DEBUG=LINE
LDFLAGS=LIB z.lib
SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \
NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX
OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
TEST_OBJS = example.o minigzip.o
all: SCOPTIONS example minigzip
test: all
`cd`/example
echo hello world | minigzip | minigzip -d
install: z.lib
copy zlib.h zconf.h INCLUDE: clone
copy z.lib LIB: clone
z.lib: $(OBJS)
oml z.lib r $(OBJS)
example: example.o z.lib
$(CC) $(CFLAGS) LINK TO $@ example.o $(LDFLAGS)
minigzip: minigzip.o z.lib
$(CC) $(CFLAGS) LINK TO $@ minigzip.o $(LDFLAGS)
clean:
-delete force quiet *.o example minigzip z.lib foo.gz *.lnk SCOPTIONS
SCOPTIONS: Smakefile
copy to $@ <from <
$(SCOPTIONS)
<
# DO NOT DELETE THIS LINE -- make depend depends on it.
adler32.o: zutil.h zlib.h zconf.h
compress.o: zlib.h zconf.h
crc32.o: zutil.h zlib.h zconf.h
deflate.o: deflate.h zutil.h zlib.h zconf.h
example.o: zlib.h zconf.h
gzio.o: zutil.h zlib.h zconf.h
infblock.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
infcodes.o: zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
inflate.o: zutil.h zlib.h zconf.h infblock.h
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
infutil.o: zutil.h zlib.h zconf.h inftrees.h infutil.h
minigzip.o: zlib.h zconf.h
trees.o: deflate.h zutil.h zlib.h zconf.h
uncompr.o: zlib.h zconf.h
zutil.o: zutil.h zlib.h zconf.h

214
Lib/zlib/configure vendored Executable file
View File

@@ -0,0 +1,214 @@
#!/bin/sh
# configure script for zlib. This script is needed only if
# you wish to build a shared library and your system supports them,
# of if you need special compiler, flags or install directory.
# Otherwise, you can just use directly "make test; make install"
#
# To create a shared library, use "configure --shared"; by default a static
# library is created. If the primitive shared library support provided here
# does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz
#
# To impose specific compiler or flags or install directory, use for example:
# prefix=$HOME CC=cc CFLAGS="-O4" ./configure
# or for csh/tcsh users:
# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
# LDSHARED is the command to be used to create a shared library
# Incorrect settings of CC or CFLAGS may prevent creating a shared library.
# If you have problems, try without defining CC and CFLAGS before reporting
# an error.
LIBS=libz.a
SHAREDLIB=libz.so
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
AR=${AR-"ar rc"}
RANLIB=${RANLIB-"ranlib"}
prefix=${prefix-/usr/local}
exec_prefix=${exec_prefix-'${prefix}'}
libdir=${libdir-'${exec_prefix}/lib'}
includedir=${includedir-'${prefix}/include'}
shared_ext='.so'
shared=0
gcc=0
old_cc="$CC"
old_cflags="$CFLAGS"
while test $# -ge 1
do
case "$1" in
-p*=* | --p*=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
-e*=* | --e*=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
-l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
-i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;;
-p* | --p*) prefix="$2"; shift; shift;;
-e* | --e*) exec_prefix="$2"; shift; shift;;
-l* | --l*) libdir="$2"; shift; shift;;
-i* | --i*) includedir="$2"; shift; shift;;
-sh* | --sh*) shared=1; shift;;
--src*) shift;;
--c*) shift;;
*)
echo 'usage:'
echo ' configure [--shared] [--prefix=PREFIX] [--exec_prefix=EXPREFIX]'
echo ' [--libdir=LIBDIR] [--includedir=INCLUDEDIR]'
exit 0;;
esac
done
test=ztest$$
cat > $test.c <<EOF
extern int getchar();
int hello() {return getchar();}
EOF
test -z "$CC" && echo Checking for gcc...
cc=${CC-gcc}
cflags=${CFLAGS-"-O3"}
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
case "$cc" in
*gcc*) gcc=1;;
esac
if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
CC="$cc"
SFLAGS=${CFLAGS-"-fPIC -O3"}
CFLAGS="$cflags"
case `(uname -s || echo unknown) 2>/dev/null` in
Linux | linux) LDSHARED=${LDSHARED-"gcc -shared -Wl,-soname,libz.so.1"};;
*) LDSHARED=${LDSHARED-"gcc -shared"};;
esac
else
# find system name and corresponding cc options
CC=${CC-cc}
case `(uname -sr || echo unknown) 2>/dev/null` in
HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
CFLAGS=${CFLAGS-"-O"}
# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
LDSHARED=${LDSHARED-"ld -b"}
shared_ext='.sl'
SHAREDLIB='libz.sl';;
IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
CFLAGS=${CFLAGS-"-ansi -O2"}
LDSHARED=${LDSHARED-"cc -shared"};;
OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
CFLAGS=${CFLAGS-"-O -std1"}
LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,$SHAREDLIB -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};;
OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
CFLAGS=${CFLAGS-"-O -std1"}
LDSHARED=${LDSHARED-"cc -shared"};;
QNX*) SFLAGS=${CFLAGS-"-4 -O"}
CFLAGS=${CFLAGS-"-4 -O"}
LDSHARED=${LDSHARED-"cc"}
RANLIB=${RANLIB-"true"}
AR="cc -A";;
SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
CFLAGS=${CFLAGS-"-O3"}
LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};;
SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."}
CFLAGS=${CFLAGS-"-fast -xcg89"}
LDSHARED=${LDSHARED-"cc -G"};;
SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
CFLAGS=${CFLAGS-"-O2"}
LDSHARED=${LDSHARED-"ld"};;
UNIX_System_V\ 4.2.0)
SFLAGS=${CFLAGS-"-KPIC -O"}
CFLAGS=${CFLAGS-"-O"}
LDSHARED=${LDSHARED-"cc -G"};;
UNIX_SV\ 4.2MP)
SFLAGS=${CFLAGS-"-Kconform_pic -O"}
CFLAGS=${CFLAGS-"-O"}
LDSHARED=${LDSHARED-"cc -G"};;
# send working options for other systems to support@gzip.org
*) SFLAGS=${CFLAGS-"-O"}
CFLAGS=${CFLAGS-"-O"}
LDSHARED=${LDSHARED-"cc -shared"};;
esac
fi
if test $shared -eq 1; then
echo Checking for shared library support...
# we must test in two steps (cc then ld), required at least on SunOS 4.x
if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
CFLAGS="$SFLAGS"
LIBS="$SHAREDLIB.$VER"
echo Building shared library $SHAREDLIB.$VER with $CC.
elif test -z "$old_cc" -a -z "$old_cflags"; then
echo No shared library suppport.
shared=0;
else
echo 'No shared library suppport; try without defining CC and CFLAGS'
shared=0;
fi
fi
if test $shared -eq 0; then
LDSHARED="$CC"
echo Building static library $LIBS version $VER with $CC.
fi
cat > $test.c <<EOF
#include <unistd.h>
int main() { return 0; }
EOF
if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
CFLAGS="$CFLAGS -DHAVE_UNISTD_H"
echo "Checking for unistd.h... Yes."
else
echo "Checking for unistd.h... No."
fi
cat > $test.c <<EOF
#include <errno.h>
int main() { return 0; }
EOF
if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
echo "Checking for errno.h... Yes."
else
echo "Checking for errno.h... No."
CFLAGS="$CFLAGS -DNO_ERRNO_H"
fi
cat > $test.c <<EOF
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
caddr_t hello() {
return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0);
}
EOF
if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
CFLAGS="$CFLAGS -DUSE_MMAP"
echo Checking for mmap support... Yes.
else
echo Checking for mmap support... No.
fi
CPP=${CPP-"$CC -E"}
case $CFLAGS in
*ASMV*)
if test "`nm $test.o | grep _hello`" = ""; then
CPP="$CPP -DNO_UNDERLINE"
echo Checking for underline in external names... No.
else
echo Checking for underline in external names... Yes.
fi;;
esac
rm -f $test.[co] $test$shared_ext
# udpate Makefile
sed < Makefile.in "
/^CC *=/s%=.*%=$CC%
/^CFLAGS *=/s%=.*%=$CFLAGS%
/^CPP *=/s%=.*%=$CPP%
/^LDSHARED *=/s%=.*%=$LDSHARED%
/^LIBS *=/s%=.*%=$LIBS%
/^SHAREDLIB *=/s%=.*%=$SHAREDLIB%
/^AR *=/s%=.*%=$AR%
/^RANLIB *=/s%=.*%=$RANLIB%
/^VER *=/s%=.*%=$VER%
/^prefix *=/s%=.*%=$prefix%
/^exec_prefix *=/s%=.*%=$exec_prefix%
/^libdir *=/s%=.*%=$libdir%
/^includedir *=/s%=.*%=$includedir%
" > Makefile

View File

@@ -0,0 +1,34 @@
All files under this contrib directory are UNSUPPORTED. There were
provided by users of zlib and were not tested by the authors of zlib.
Use at your own risk. Please contact the authors of the contributions
for help about these, not the zlib authors. Thanks.
asm386/ by Gilles Vollant <info@winimage.com>
386 asm code replacing longest_match(), for Visual C++ 4.2 and ML 6.11c
asm586/ and asm686/ by Brian Raiter <breadbox@muppetlabs.com>
asm code for Pentium and Pentium Pro
See http://www.muppetlabs.com/~breadbox/software/assembly.html
delphi/ by Bob Dellaca <bobdl@xtra.co.nz>
Support for Delphi
delphi2/ by Davide Moretti <dave@rimini.com>
Another support for C++Builder and Delphi
minizip/ by Gilles Vollant <info@winimage.com>
Mini zip and unzip based on zlib
See http://www.winimage.com/zLibDll/unzip.html
iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
A C++ I/O streams interface to the zlib gz* functions
iostream2/ by Tyge L<>vset <Tyge.Lovset@cmr.no>
Another C++ I/O streams interface
untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
A very simple tar.gz file extractor using zlib
visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
How to use compress(), uncompress() and the gz* functions from VB.

View File

@@ -0,0 +1,559 @@
;
; gvmat32.asm -- Asm portion of the optimized longest_match for 32 bits x86
; Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant.
; File written by Gilles Vollant, by modifiying the longest_match
; from Jean-loup Gailly in deflate.c
; It need wmask == 0x7fff
; (assembly code is faster with a fixed wmask)
;
; For Visual C++ 4.2 and ML 6.11c (version in directory \MASM611C of Win95 DDK)
; I compile with : "ml /coff /Zi /c gvmat32.asm"
;
;uInt longest_match_7fff(s, cur_match)
; deflate_state *s;
; IPos cur_match; /* current match */
NbStack equ 76
cur_match equ dword ptr[esp+NbStack-0]
str_s equ dword ptr[esp+NbStack-4]
; 5 dword on top (ret,ebp,esi,edi,ebx)
adrret equ dword ptr[esp+NbStack-8]
pushebp equ dword ptr[esp+NbStack-12]
pushedi equ dword ptr[esp+NbStack-16]
pushesi equ dword ptr[esp+NbStack-20]
pushebx equ dword ptr[esp+NbStack-24]
chain_length equ dword ptr [esp+NbStack-28]
limit equ dword ptr [esp+NbStack-32]
best_len equ dword ptr [esp+NbStack-36]
window equ dword ptr [esp+NbStack-40]
prev equ dword ptr [esp+NbStack-44]
scan_start equ word ptr [esp+NbStack-48]
wmask equ dword ptr [esp+NbStack-52]
match_start_ptr equ dword ptr [esp+NbStack-56]
nice_match equ dword ptr [esp+NbStack-60]
scan equ dword ptr [esp+NbStack-64]
windowlen equ dword ptr [esp+NbStack-68]
match_start equ dword ptr [esp+NbStack-72]
strend equ dword ptr [esp+NbStack-76]
NbStackAdd equ (NbStack-24)
.386p
name gvmatch
.MODEL FLAT
; all the +4 offsets are due to the addition of pending_buf_size (in zlib
; in the deflate_state structure since the asm code was first written
; (if you compile with zlib 1.0.4 or older, remove the +4).
; Note : these value are good with a 8 bytes boundary pack structure
dep_chain_length equ 70h+4
dep_window equ 2ch+4
dep_strstart equ 60h+4
dep_prev_length equ 6ch+4
dep_nice_match equ 84h+4
dep_w_size equ 20h+4
dep_prev equ 34h+4
dep_w_mask equ 28h+4
dep_good_match equ 80h+4
dep_match_start equ 64h+4
dep_lookahead equ 68h+4
_TEXT segment
IFDEF NOUNDERLINE
public longest_match_7fff
; public match_init
ELSE
public _longest_match_7fff
; public _match_init
ENDIF
MAX_MATCH equ 258
MIN_MATCH equ 3
MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
IFDEF NOUNDERLINE
;match_init proc near
; ret
;match_init endp
ELSE
;_match_init proc near
; ret
;_match_init endp
ENDIF
IFDEF NOUNDERLINE
longest_match_7fff proc near
ELSE
_longest_match_7fff proc near
ENDIF
mov edx,[esp+4]
push ebp
push edi
push esi
push ebx
sub esp,NbStackAdd
; initialize or check the variables used in match.asm.
mov ebp,edx
; chain_length = s->max_chain_length
; if (prev_length>=good_match) chain_length >>= 2
mov edx,[ebp+dep_chain_length]
mov ebx,[ebp+dep_prev_length]
cmp [ebp+dep_good_match],ebx
ja noshr
shr edx,2
noshr:
; we increment chain_length because in the asm, the --chain_lenght is in the beginning of the loop
inc edx
mov edi,[ebp+dep_nice_match]
mov chain_length,edx
mov eax,[ebp+dep_lookahead]
cmp eax,edi
; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
jae nolookaheadnicematch
mov edi,eax
nolookaheadnicematch:
; best_len = s->prev_length
mov best_len,ebx
; window = s->window
mov esi,[ebp+dep_window]
mov ecx,[ebp+dep_strstart]
mov window,esi
mov nice_match,edi
; scan = window + strstart
add esi,ecx
mov scan,esi
; dx = *window
mov dx,word ptr [esi]
; bx = *(window+best_len-1)
mov bx,word ptr [esi+ebx-1]
add esi,MAX_MATCH-1
; scan_start = *scan
mov scan_start,dx
; strend = scan + MAX_MATCH-1
mov strend,esi
; bx = scan_end = *(window+best_len-1)
; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
; s->strstart - (IPos)MAX_DIST(s) : NIL;
mov esi,[ebp+dep_w_size]
sub esi,MIN_LOOKAHEAD
; here esi = MAX_DIST(s)
sub ecx,esi
ja nodist
xor ecx,ecx
nodist:
mov limit,ecx
; prev = s->prev
mov edx,[ebp+dep_prev]
mov prev,edx
;
mov edx,dword ptr [ebp+dep_match_start]
mov bp,scan_start
mov eax,cur_match
mov match_start,edx
mov edx,window
mov edi,edx
add edi,best_len
mov esi,prev
dec edi
; windowlen = window + best_len -1
mov windowlen,edi
jmp beginloop2
align 4
; here, in the loop
; eax = ax = cur_match
; ecx = limit
; bx = scan_end
; bp = scan_start
; edi = windowlen (window + best_len -1)
; esi = prev
;// here; chain_length <=16
normalbeg0add16:
add chain_length,16
jz exitloop
normalbeg0:
cmp word ptr[edi+eax],bx
je normalbeg2noroll
rcontlabnoroll:
; cur_match = prev[cur_match & wmask]
and eax,7fffh
mov ax,word ptr[esi+eax*2]
; if cur_match > limit, go to exitloop
cmp ecx,eax
jnb exitloop
; if --chain_length != 0, go to exitloop
dec chain_length
jnz normalbeg0
jmp exitloop
normalbeg2noroll:
; if (scan_start==*(cur_match+window)) goto normalbeg2
cmp bp,word ptr[edx+eax]
jne rcontlabnoroll
jmp normalbeg2
contloop3:
mov edi,windowlen
; cur_match = prev[cur_match & wmask]
and eax,7fffh
mov ax,word ptr[esi+eax*2]
; if cur_match > limit, go to exitloop
cmp ecx,eax
jnbexitloopshort1:
jnb exitloop
; if --chain_length != 0, go to exitloop
; begin the main loop
beginloop2:
sub chain_length,16+1
; if chain_length <=16, don't use the unrolled loop
jna normalbeg0add16
do16:
cmp word ptr[edi+eax],bx
je normalbeg2dc0
maccn MACRO lab
and eax,7fffh
mov ax,word ptr[esi+eax*2]
cmp ecx,eax
jnb exitloop
cmp word ptr[edi+eax],bx
je lab
ENDM
rcontloop0:
maccn normalbeg2dc1
rcontloop1:
maccn normalbeg2dc2
rcontloop2:
maccn normalbeg2dc3
rcontloop3:
maccn normalbeg2dc4
rcontloop4:
maccn normalbeg2dc5
rcontloop5:
maccn normalbeg2dc6
rcontloop6:
maccn normalbeg2dc7
rcontloop7:
maccn normalbeg2dc8
rcontloop8:
maccn normalbeg2dc9
rcontloop9:
maccn normalbeg2dc10
rcontloop10:
maccn short normalbeg2dc11
rcontloop11:
maccn short normalbeg2dc12
rcontloop12:
maccn short normalbeg2dc13
rcontloop13:
maccn short normalbeg2dc14
rcontloop14:
maccn short normalbeg2dc15
rcontloop15:
and eax,7fffh
mov ax,word ptr[esi+eax*2]
cmp ecx,eax
jnb exitloop
sub chain_length,16
ja do16
jmp normalbeg0add16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
normbeg MACRO rcontlab,valsub
; if we are here, we know that *(match+best_len-1) == scan_end
cmp bp,word ptr[edx+eax]
; if (match != scan_start) goto rcontlab
jne rcontlab
; calculate the good chain_length, and we'll compare scan and match string
add chain_length,16-valsub
jmp iseq
ENDM
normalbeg2dc11:
normbeg rcontloop11,11
normalbeg2dc12:
normbeg short rcontloop12,12
normalbeg2dc13:
normbeg short rcontloop13,13
normalbeg2dc14:
normbeg short rcontloop14,14
normalbeg2dc15:
normbeg short rcontloop15,15
normalbeg2dc10:
normbeg rcontloop10,10
normalbeg2dc9:
normbeg rcontloop9,9
normalbeg2dc8:
normbeg rcontloop8,8
normalbeg2dc7:
normbeg rcontloop7,7
normalbeg2dc6:
normbeg rcontloop6,6
normalbeg2dc5:
normbeg rcontloop5,5
normalbeg2dc4:
normbeg rcontloop4,4
normalbeg2dc3:
normbeg rcontloop3,3
normalbeg2dc2:
normbeg rcontloop2,2
normalbeg2dc1:
normbeg rcontloop1,1
normalbeg2dc0:
normbeg rcontloop0,0
; we go in normalbeg2 because *(ushf*)(match+best_len-1) == scan_end
normalbeg2:
mov edi,window
cmp bp,word ptr[edi+eax]
jne contloop3 ; if *(ushf*)match != scan_start, continue
iseq:
; if we are here, we know that *(match+best_len-1) == scan_end
; and (match == scan_start)
mov edi,edx
mov esi,scan ; esi = scan
add edi,eax ; edi = window + cur_match = match
mov edx,[esi+3] ; compare manually dword at match+3
xor edx,[edi+3] ; and scan +3
jz begincompare ; if equal, go to long compare
; we will determine the unmatch byte and calculate len (in esi)
or dl,dl
je eq1rr
mov esi,3
jmp trfinval
eq1rr:
or dx,dx
je eq1
mov esi,4
jmp trfinval
eq1:
and edx,0ffffffh
jz eq11
mov esi,5
jmp trfinval
eq11:
mov esi,6
jmp trfinval
begincompare:
; here we now scan and match begin same
add edi,6
add esi,6
mov ecx,(MAX_MATCH-(2+4))/4 ; scan for at most MAX_MATCH bytes
repe cmpsd ; loop until mismatch
je trfin ; go to trfin if not unmatch
; we determine the unmatch byte
sub esi,4
mov edx,[edi-4]
xor edx,[esi]
or dl,dl
jnz trfin
inc esi
or dx,dx
jnz trfin
inc esi
and edx,0ffffffh
jnz trfin
inc esi
trfin:
sub esi,scan ; esi = len
trfinval:
; here we have finised compare, and esi contain len of equal string
cmp esi,best_len ; if len > best_len, go newbestlen
ja short newbestlen
; now we restore edx, ecx and esi, for the big loop
mov esi,prev
mov ecx,limit
mov edx,window
jmp contloop3
newbestlen:
mov best_len,esi ; len become best_len
mov match_start,eax ; save new position as match_start
cmp esi,nice_match ; if best_len >= nice_match, exit
jae exitloop
mov ecx,scan
mov edx,window ; restore edx=window
add ecx,esi
add esi,edx
dec esi
mov windowlen,esi ; windowlen = window + best_len-1
mov bx,[ecx-1] ; bx = *(scan+best_len-1) = scan_end
; now we restore ecx and esi, for the big loop :
mov esi,prev
mov ecx,limit
jmp contloop3
exitloop:
; exit : s->match_start=match_start
mov ebx,match_start
mov ebp,str_s
mov ecx,best_len
mov dword ptr [ebp+dep_match_start],ebx
mov eax,dword ptr [ebp+dep_lookahead]
cmp ecx,eax
ja minexlo
mov eax,ecx
minexlo:
; return min(best_len,s->lookahead)
; restore stack and register ebx,esi,edi,ebp
add esp,NbStackAdd
pop ebx
pop esi
pop edi
pop ebp
ret
InfoAuthor:
; please don't remove this string !
; Your are free use gvmat32 in any fre or commercial apps if you don't remove the string in the binary!
db 0dh,0ah,"GVMat32 optimised assembly code written 1996-98 by Gilles Vollant",0dh,0ah
IFDEF NOUNDERLINE
longest_match_7fff endp
ELSE
_longest_match_7fff endp
ENDIF
IFDEF NOUNDERLINE
cpudetect32 proc near
ELSE
_cpudetect32 proc near
ENDIF
pushfd ; push original EFLAGS
pop eax ; get original EFLAGS
mov ecx, eax ; save original EFLAGS
xor eax, 40000h ; flip AC bit in EFLAGS
push eax ; save new EFLAGS value on stack
popfd ; replace current EFLAGS value
pushfd ; get new EFLAGS
pop eax ; store new EFLAGS in EAX
xor eax, ecx ; can<61>t toggle AC bit, processor=80386
jz end_cpu_is_386 ; jump if 80386 processor
push ecx
popfd ; restore AC bit in EFLAGS first
pushfd
pushfd
pop ecx
mov eax, ecx ; get original EFLAGS
xor eax, 200000h ; flip ID bit in EFLAGS
push eax ; save new EFLAGS value on stack
popfd ; replace current EFLAGS value
pushfd ; get new EFLAGS
pop eax ; store new EFLAGS in EAX
popfd ; restore original EFLAGS
xor eax, ecx ; can<61>t toggle ID bit,
je is_old_486 ; processor=old
mov eax,1
db 0fh,0a2h ;CPUID
exitcpudetect:
ret
end_cpu_is_386:
mov eax,0300h
jmp exitcpudetect
is_old_486:
mov eax,0400h
jmp exitcpudetect
IFDEF NOUNDERLINE
cpudetect32 endp
ELSE
_cpudetect32 endp
ENDIF
_TEXT ends
end

View File

@@ -0,0 +1,200 @@
/* gvmat32.c -- C portion of the optimized longest_match for 32 bits x86
* Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant.
* File written by Gilles Vollant, by modifiying the longest_match
* from Jean-loup Gailly in deflate.c
* it prepare all parameters and call the assembly longest_match_gvasm
* longest_match execute standard C code is wmask != 0x7fff
* (assembly code is faster with a fixed wmask)
*
*/
#include "deflate.h"
#undef FAR
#include <windows.h>
#ifdef ASMV
#define NIL 0
#define UNALIGNED_OK
/* if your C compiler don't add underline before function name,
define ADD_UNDERLINE_ASMFUNC */
#ifdef ADD_UNDERLINE_ASMFUNC
#define longest_match_7fff _longest_match_7fff
#endif
void match_init()
{
}
unsigned long cpudetect32();
uInt longest_match_c(
deflate_state *s,
IPos cur_match); /* current match */
uInt longest_match_7fff(
deflate_state *s,
IPos cur_match); /* current match */
uInt longest_match(
deflate_state *s,
IPos cur_match) /* current match */
{
static uInt iIsPPro=2;
if ((s->w_mask == 0x7fff) && (iIsPPro==0))
return longest_match_7fff(s,cur_match);
if (iIsPPro==2)
iIsPPro = (((cpudetect32()/0x100)&0xf)>=6) ? 1 : 0;
return longest_match_c(s,cur_match);
}
uInt longest_match_c(s, cur_match)
deflate_state *s;
IPos cur_match; /* current match */
{
unsigned chain_length = s->max_chain_length;/* max hash chain length */
register Bytef *scan = s->window + s->strstart; /* current string */
register Bytef *match; /* matched string */
register int len; /* length of current match */
int best_len = s->prev_length; /* best match length so far */
int nice_match = s->nice_match; /* stop if match long enough */
IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
s->strstart - (IPos)MAX_DIST(s) : NIL;
/* Stop when cur_match becomes <= limit. To simplify the code,
* we prevent matches with the string of window index 0.
*/
Posf *prev = s->prev;
uInt wmask = s->w_mask;
#ifdef UNALIGNED_OK
/* Compare two bytes at a time. Note: this is not always beneficial.
* Try with and without -DUNALIGNED_OK to check.
*/
register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
register ush scan_start = *(ushf*)scan;
register ush scan_end = *(ushf*)(scan+best_len-1);
#else
register Bytef *strend = s->window + s->strstart + MAX_MATCH;
register Byte scan_end1 = scan[best_len-1];
register Byte scan_end = scan[best_len];
#endif
/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
* It is easy to get rid of this optimization if necessary.
*/
Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
/* Do not waste too much time if we already have a good match: */
if (s->prev_length >= s->good_match) {
chain_length >>= 2;
}
/* Do not look for matches beyond the end of the input. This is necessary
* to make deflate deterministic.
*/
if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
do {
Assert(cur_match < s->strstart, "no future");
match = s->window + cur_match;
/* Skip to next match if the match length cannot increase
* or if the match length is less than 2:
*/
#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
/* This code assumes sizeof(unsigned short) == 2. Do not use
* UNALIGNED_OK if your compiler uses a different size.
*/
if (*(ushf*)(match+best_len-1) != scan_end ||
*(ushf*)match != scan_start) continue;
/* It is not necessary to compare scan[2] and match[2] since they are
* always equal when the other bytes match, given that the hash keys
* are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
* strstart+3, +5, ... up to strstart+257. We check for insufficient
* lookahead only every 4th comparison; the 128th check will be made
* at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
* necessary to put more guard bytes at the end of the window, or
* to check more often for insufficient lookahead.
*/
Assert(scan[2] == match[2], "scan[2]?");
scan++, match++;
do {
} while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
scan < strend);
/* The funny "do {}" generates better code on most compilers */
/* Here, scan <= window+strstart+257 */
Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
if (*scan == *match) scan++;
len = (MAX_MATCH - 1) - (int)(strend-scan);
scan = strend - (MAX_MATCH-1);
#else /* UNALIGNED_OK */
if (match[best_len] != scan_end ||
match[best_len-1] != scan_end1 ||
*match != *scan ||
*++match != scan[1]) continue;
/* The check at best_len-1 can be removed because it will be made
* again later. (This heuristic is not always a win.)
* It is not necessary to compare scan[2] and match[2] since they
* are always equal when the other bytes match, given that
* the hash keys are equal and that HASH_BITS >= 8.
*/
scan += 2, match++;
Assert(*scan == *match, "match[2]?");
/* We check for insufficient lookahead only every 8th comparison;
* the 256th check will be made at strstart+258.
*/
do {
} while (*++scan == *++match && *++scan == *++match &&
*++scan == *++match && *++scan == *++match &&
*++scan == *++match && *++scan == *++match &&
*++scan == *++match && *++scan == *++match &&
scan < strend);
Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
len = MAX_MATCH - (int)(strend - scan);
scan = strend - MAX_MATCH;
#endif /* UNALIGNED_OK */
if (len > best_len) {
s->match_start = cur_match;
best_len = len;
if (len >= nice_match) break;
#ifdef UNALIGNED_OK
scan_end = *(ushf*)(scan+best_len-1);
#else
scan_end1 = scan[best_len-1];
scan_end = scan[best_len];
#endif
}
} while ((cur_match = prev[cur_match & wmask]) > limit
&& --chain_length != 0);
if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
return s->lookahead;
}
#endif /* ASMV */

View File

@@ -0,0 +1 @@
c:\masm611\bin\ml /coff /Zi /c /Flgvmat32.lst gvmat32.asm

View File

@@ -0,0 +1,74 @@
LIBRARY "zlib"
DESCRIPTION '"""zlib data compression library"""'
VERSION 1.11
HEAPSIZE 1048576,8192
EXPORTS
adler32 @1
compress @2
crc32 @3
deflate @4
deflateCopy @5
deflateEnd @6
deflateInit2_ @7
deflateInit_ @8
deflateParams @9
deflateReset @10
deflateSetDictionary @11
gzclose @12
gzdopen @13
gzerror @14
gzflush @15
gzopen @16
gzread @17
gzwrite @18
inflate @19
inflateEnd @20
inflateInit2_ @21
inflateInit_ @22
inflateReset @23
inflateSetDictionary @24
inflateSync @25
uncompress @26
zlibVersion @27
gzprintf @28
gzputc @29
gzgetc @30
gzseek @31
gzrewind @32
gztell @33
gzeof @34
gzsetparams @35
zError @36
inflateSyncPoint @37
get_crc_table @38
compress2 @39
gzputs @40
gzgets @41
unzOpen @61
unzClose @62
unzGetGlobalInfo @63
unzGetCurrentFileInfo @64
unzGoToFirstFile @65
unzGoToNextFile @66
unzOpenCurrentFile @67
unzReadCurrentFile @68
unztell @70
unzeof @71
unzCloseCurrentFile @72
unzGetGlobalComment @73
unzStringFileNameCompare @74
unzLocateFile @75
unzGetLocalExtrafield @76
zipOpen @80
zipOpenNewFileInZip @81
zipWriteInFileInZip @82
zipCloseFileInZip @83
zipClose @84

View File

@@ -0,0 +1,651 @@
# Microsoft Developer Studio Project File - Name="zlibvc" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
# TARGTYPE "Win32 (ALPHA) Dynamic-Link Library" 0x0602
CFG=zlibvc - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "zlibvc.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "zlibvc.mak" CFG="zlibvc - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "zlibvc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "zlibvc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "zlibvc - Win32 ReleaseAxp" (based on\
"Win32 (ALPHA) Dynamic-Link Library")
!MESSAGE "zlibvc - Win32 ReleaseWithoutAsm" (based on\
"Win32 (x86) Dynamic-Link Library")
!MESSAGE "zlibvc - Win32 ReleaseWithoutCrtdll" (based on\
"Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
!IF "$(CFG)" == "zlibvc - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /FD /c
# SUBTRACT CPP /YX
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /FD /c
# SUBTRACT CPP /YX
MTL=midl.exe
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:".\Debug\zlib.dll"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "zlibvc__"
# PROP BASE Intermediate_Dir "zlibvc__"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "zlibvc__"
# PROP Intermediate_Dir "zlibvc__"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
CPP=cl.exe
# ADD BASE CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c
# ADD CPP /nologo /MT /Gt0 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /FD /c
# SUBTRACT CPP /YX
RSC=rc.exe
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:".\Release\zlib.dll"
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 crtdll.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /map /machine:ALPHA /nodefaultlib /out:"zlibvc__\zlib.dll"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "zlibvc_0"
# PROP BASE Intermediate_Dir "zlibvc_0"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "zlibvc_0"
# PROP Intermediate_Dir "zlibvc_0"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /FAcs /FR /FD /c
# SUBTRACT CPP /YX
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_0\zlib.dll"
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "zlibvc_1"
# PROP BASE Intermediate_Dir "zlibvc_1"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "zlibvc_1"
# PROP Intermediate_Dir "zlibvc_1"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_WIN32" /D "BUILD_ZLIBDLL" /D "ZLIB_DLL" /D "DYNAMIC_CRC_TABLE" /D "ASMV" /FAcs /FR /FD /c
# SUBTRACT CPP /YX
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\Release\zlib.dll"
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 gvmat32.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib crtdll.lib /nologo /subsystem:windows /dll /map /machine:I386 /nodefaultlib /out:".\zlibvc_1\zlib.dll"
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "zlibvc - Win32 Release"
# Name "zlibvc - Win32 Debug"
# Name "zlibvc - Win32 ReleaseAxp"
# Name "zlibvc - Win32 ReleaseWithoutAsm"
# Name "zlibvc - Win32 ReleaseWithoutCrtdll"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\adler32.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_ADLER=\
".\zconf.h"\
".\zlib.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\compress.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_COMPR=\
".\zconf.h"\
".\zlib.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\crc32.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_CRC32=\
".\zconf.h"\
".\zlib.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\deflate.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_DEFLA=\
".\deflate.h"\
".\zconf.h"\
".\zlib.h"\
".\zutil.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\gvmat32c.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\gzio.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_GZIO_=\
".\zconf.h"\
".\zlib.h"\
".\zutil.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\infblock.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_INFBL=\
".\infblock.h"\
".\infcodes.h"\
".\inftrees.h"\
".\infutil.h"\
".\zconf.h"\
".\zlib.h"\
".\zutil.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\infcodes.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_INFCO=\
".\infblock.h"\
".\infcodes.h"\
".\inffast.h"\
".\inftrees.h"\
".\infutil.h"\
".\zconf.h"\
".\zlib.h"\
".\zutil.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\inffast.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_INFFA=\
".\infblock.h"\
".\infcodes.h"\
".\inffast.h"\
".\inftrees.h"\
".\infutil.h"\
".\zconf.h"\
".\zlib.h"\
".\zutil.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\inflate.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_INFLA=\
".\infblock.h"\
".\zconf.h"\
".\zlib.h"\
".\zutil.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\inftrees.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_INFTR=\
".\inftrees.h"\
".\zconf.h"\
".\zlib.h"\
".\zutil.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\infutil.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_INFUT=\
".\infblock.h"\
".\infcodes.h"\
".\inftrees.h"\
".\infutil.h"\
".\zconf.h"\
".\zlib.h"\
".\zutil.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\trees.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_TREES=\
".\deflate.h"\
".\zconf.h"\
".\zlib.h"\
".\zutil.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\uncompr.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_UNCOM=\
".\zconf.h"\
".\zlib.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\unzip.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\zip.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\zlib.rc
# End Source File
# Begin Source File
SOURCE=.\zlibvc.def
# End Source File
# Begin Source File
SOURCE=.\zutil.c
!IF "$(CFG)" == "zlibvc - Win32 Release"
!ELSEIF "$(CFG)" == "zlibvc - Win32 Debug"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseAxp"
DEP_CPP_ZUTIL=\
".\zconf.h"\
".\zlib.h"\
".\zutil.h"\
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutAsm"
!ELSEIF "$(CFG)" == "zlibvc - Win32 ReleaseWithoutCrtdll"
!ENDIF
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\deflate.h
# End Source File
# Begin Source File
SOURCE=.\infblock.h
# End Source File
# Begin Source File
SOURCE=.\infcodes.h
# End Source File
# Begin Source File
SOURCE=.\inffast.h
# End Source File
# Begin Source File
SOURCE=.\inftrees.h
# End Source File
# Begin Source File
SOURCE=.\infutil.h
# End Source File
# Begin Source File
SOURCE=.\zconf.h
# End Source File
# Begin Source File
SOURCE=.\zlib.h
# End Source File
# Begin Source File
SOURCE=.\zutil.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,41 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "zlibstat"=.\zlibstat.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "zlibvc"=.\zlibvc.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,43 @@
This is a patched version of zlib modified to use
Pentium-optimized assembly code in the deflation algorithm. The files
changed/added by this patch are:
README.586
match.S
The effectiveness of these modifications is a bit marginal, as the the
program's bottleneck seems to be mostly L1-cache contention, for which
there is no real way to work around without rewriting the basic
algorithm. The speedup on average is around 5-10% (which is generally
less than the amount of variance between subsequent executions).
However, when used at level 9 compression, the cache contention can
drop enough for the assembly version to achieve 10-20% speedup (and
sometimes more, depending on the amount of overall redundancy in the
files). Even here, though, cache contention can still be the limiting
factor, depending on the nature of the program using the zlib library.
This may also mean that better improvements will be seen on a Pentium
with MMX, which suffers much less from L1-cache contention, but I have
not yet verified this.
Note that this code has been tailored for the Pentium in particular,
and will not perform well on the Pentium Pro (due to the use of a
partial register in the inner loop).
If you are using an assembler other than GNU as, you will have to
translate match.S to use your assembler's syntax. (Have fun.)
Brian Raiter
breadbox@muppetlabs.com
April, 1998
Added for zlib 1.1.3:
The patches come from
http://www.muppetlabs.com/~breadbox/software/assembly.html
To compile zlib with this asm file, copy match.S to the zlib directory
then do:
CFLAGS="-O3 -DASMV" ./configure
make OBJA=match.o

View File

@@ -0,0 +1,354 @@
/* match.s -- Pentium-optimized version of longest_match()
* Written for zlib 1.1.2
* Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License.
*/
#ifndef NO_UNDERLINE
#define match_init _match_init
#define longest_match _longest_match
#endif
#define MAX_MATCH (258)
#define MIN_MATCH (3)
#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
/* stack frame offsets */
#define wmask 0 /* local copy of s->wmask */
#define window 4 /* local copy of s->window */
#define windowbestlen 8 /* s->window + bestlen */
#define chainlenscanend 12 /* high word: current chain len */
/* low word: last bytes sought */
#define scanstart 16 /* first two bytes of string */
#define scanalign 20 /* dword-misalignment of string */
#define nicematch 24 /* a good enough match size */
#define bestlen 28 /* size of best match so far */
#define scan 32 /* ptr to string wanting match */
#define LocalVarsSize (36)
/* saved ebx 36 */
/* saved edi 40 */
/* saved esi 44 */
/* saved ebp 48 */
/* return address 52 */
#define deflatestate 56 /* the function arguments */
#define curmatch 60
/* Offsets for fields in the deflate_state structure. These numbers
* are calculated from the definition of deflate_state, with the
* assumption that the compiler will dword-align the fields. (Thus,
* changing the definition of deflate_state could easily cause this
* program to crash horribly, without so much as a warning at
* compile time. Sigh.)
*/
#define dsWSize 36
#define dsWMask 44
#define dsWindow 48
#define dsPrev 56
#define dsMatchLen 88
#define dsPrevMatch 92
#define dsStrStart 100
#define dsMatchStart 104
#define dsLookahead 108
#define dsPrevLen 112
#define dsMaxChainLen 116
#define dsGoodMatch 132
#define dsNiceMatch 136
.file "match.S"
.globl match_init, longest_match
.text
/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
longest_match:
/* Save registers that the compiler may be using, and adjust %esp to */
/* make room for our stack frame. */
pushl %ebp
pushl %edi
pushl %esi
pushl %ebx
subl $LocalVarsSize, %esp
/* Retrieve the function arguments. %ecx will hold cur_match */
/* throughout the entire function. %edx will hold the pointer to the */
/* deflate_state structure during the function's setup (before */
/* entering the main loop). */
movl deflatestate(%esp), %edx
movl curmatch(%esp), %ecx
/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
movl dsNiceMatch(%edx), %eax
movl dsLookahead(%edx), %ebx
cmpl %eax, %ebx
jl LookaheadLess
movl %eax, %ebx
LookaheadLess: movl %ebx, nicematch(%esp)
/* register Bytef *scan = s->window + s->strstart; */
movl dsWindow(%edx), %esi
movl %esi, window(%esp)
movl dsStrStart(%edx), %ebp
lea (%esi,%ebp), %edi
movl %edi, scan(%esp)
/* Determine how many bytes the scan ptr is off from being */
/* dword-aligned. */
movl %edi, %eax
negl %eax
andl $3, %eax
movl %eax, scanalign(%esp)
/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
movl dsWSize(%edx), %eax
subl $MIN_LOOKAHEAD, %eax
subl %eax, %ebp
jg LimitPositive
xorl %ebp, %ebp
LimitPositive:
/* unsigned chain_length = s->max_chain_length; */
/* if (s->prev_length >= s->good_match) { */
/* chain_length >>= 2; */
/* } */
movl dsPrevLen(%edx), %eax
movl dsGoodMatch(%edx), %ebx
cmpl %ebx, %eax
movl dsMaxChainLen(%edx), %ebx
jl LastMatchGood
shrl $2, %ebx
LastMatchGood:
/* chainlen is decremented once beforehand so that the function can */
/* use the sign flag instead of the zero flag for the exit test. */
/* It is then shifted into the high word, to make room for the scanend */
/* scanend value, which it will always accompany. */
decl %ebx
shll $16, %ebx
/* int best_len = s->prev_length; */
movl dsPrevLen(%edx), %eax
movl %eax, bestlen(%esp)
/* Store the sum of s->window + best_len in %esi locally, and in %esi. */
addl %eax, %esi
movl %esi, windowbestlen(%esp)
/* register ush scan_start = *(ushf*)scan; */
/* register ush scan_end = *(ushf*)(scan+best_len-1); */
movw (%edi), %bx
movw %bx, scanstart(%esp)
movw -1(%edi,%eax), %bx
movl %ebx, chainlenscanend(%esp)
/* Posf *prev = s->prev; */
/* uInt wmask = s->w_mask; */
movl dsPrev(%edx), %edi
movl dsWMask(%edx), %edx
mov %edx, wmask(%esp)
/* Jump into the main loop. */
jmp LoopEntry
.balign 16
/* do {
* match = s->window + cur_match;
* if (*(ushf*)(match+best_len-1) != scan_end ||
* *(ushf*)match != scan_start) continue;
* [...]
* } while ((cur_match = prev[cur_match & wmask]) > limit
* && --chain_length != 0);
*
* Here is the inner loop of the function. The function will spend the
* majority of its time in this loop, and majority of that time will
* be spent in the first ten instructions.
*
* Within this loop:
* %ebx = chainlenscanend - i.e., ((chainlen << 16) | scanend)
* %ecx = curmatch
* %edx = curmatch & wmask
* %esi = windowbestlen - i.e., (window + bestlen)
* %edi = prev
* %ebp = limit
*
* Two optimization notes on the choice of instructions:
*
* The first instruction uses a 16-bit address, which costs an extra,
* unpairable cycle. This is cheaper than doing a 32-bit access and
* zeroing the high word, due to the 3-cycle misalignment penalty which
* would occur half the time. This also turns out to be cheaper than
* doing two separate 8-bit accesses, as the memory is so rarely in the
* L1 cache.
*
* The window buffer, however, apparently spends a lot of time in the
* cache, and so it is faster to retrieve the word at the end of the
* match string with two 8-bit loads. The instructions that test the
* word at the beginning of the match string, however, are executed
* much less frequently, and there it was cheaper to use 16-bit
* instructions, which avoided the necessity of saving off and
* subsequently reloading one of the other registers.
*/
LookupLoop:
/* 1 U & V */
movw (%edi,%edx,2), %cx /* 2 U pipe */
movl wmask(%esp), %edx /* 2 V pipe */
cmpl %ebp, %ecx /* 3 U pipe */
jbe LeaveNow /* 3 V pipe */
subl $0x00010000, %ebx /* 4 U pipe */
js LeaveNow /* 4 V pipe */
LoopEntry: movb -1(%esi,%ecx), %al /* 5 U pipe */
andl %ecx, %edx /* 5 V pipe */
cmpb %bl, %al /* 6 U pipe */
jnz LookupLoop /* 6 V pipe */
movb (%esi,%ecx), %ah
cmpb %bh, %ah
jnz LookupLoop
movl window(%esp), %eax
movw (%eax,%ecx), %ax
cmpw scanstart(%esp), %ax
jnz LookupLoop
/* Store the current value of chainlen. */
movl %ebx, chainlenscanend(%esp)
/* Point %edi to the string under scrutiny, and %esi to the string we */
/* are hoping to match it up with. In actuality, %esi and %edi are */
/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
/* initialized to -(MAX_MATCH_8 - scanalign). */
movl window(%esp), %esi
movl scan(%esp), %edi
addl %ecx, %esi
movl scanalign(%esp), %eax
movl $(-MAX_MATCH_8), %edx
lea MAX_MATCH_8(%edi,%eax), %edi
lea MAX_MATCH_8(%esi,%eax), %esi
/* Test the strings for equality, 8 bytes at a time. At the end,
* adjust %edx so that it is offset to the exact byte that mismatched.
*
* We already know at this point that the first three bytes of the
* strings match each other, and they can be safely passed over before
* starting the compare loop. So what this code does is skip over 0-3
* bytes, as much as necessary in order to dword-align the %edi
* pointer. (%esi will still be misaligned three times out of four.)
*
* It should be confessed that this loop usually does not represent
* much of the total running time. Replacing it with a more
* straightforward "rep cmpsb" would not drastically degrade
* performance.
*/
LoopCmps:
movl (%esi,%edx), %eax
movl (%edi,%edx), %ebx
xorl %ebx, %eax
jnz LeaveLoopCmps
movl 4(%esi,%edx), %eax
movl 4(%edi,%edx), %ebx
xorl %ebx, %eax
jnz LeaveLoopCmps4
addl $8, %edx
jnz LoopCmps
jmp LenMaximum
LeaveLoopCmps4: addl $4, %edx
LeaveLoopCmps: testl $0x0000FFFF, %eax
jnz LenLower
addl $2, %edx
shrl $16, %eax
LenLower: subb $1, %al
adcl $0, %edx
/* Calculate the length of the match. If it is longer than MAX_MATCH, */
/* then automatically accept it as the best possible match and leave. */
lea (%edi,%edx), %eax
movl scan(%esp), %edi
subl %edi, %eax
cmpl $MAX_MATCH, %eax
jge LenMaximum
/* If the length of the match is not longer than the best match we */
/* have so far, then forget it and return to the lookup loop. */
movl deflatestate(%esp), %edx
movl bestlen(%esp), %ebx
cmpl %ebx, %eax
jg LongerMatch
movl chainlenscanend(%esp), %ebx
movl windowbestlen(%esp), %esi
movl dsPrev(%edx), %edi
movl wmask(%esp), %edx
andl %ecx, %edx
jmp LookupLoop
/* s->match_start = cur_match; */
/* best_len = len; */
/* if (len >= nice_match) break; */
/* scan_end = *(ushf*)(scan+best_len-1); */
LongerMatch: movl nicematch(%esp), %ebx
movl %eax, bestlen(%esp)
movl %ecx, dsMatchStart(%edx)
cmpl %ebx, %eax
jge LeaveNow
movl window(%esp), %esi
addl %eax, %esi
movl %esi, windowbestlen(%esp)
movl chainlenscanend(%esp), %ebx
movw -1(%edi,%eax), %bx
movl dsPrev(%edx), %edi
movl %ebx, chainlenscanend(%esp)
movl wmask(%esp), %edx
andl %ecx, %edx
jmp LookupLoop
/* Accept the current string, with the maximum possible length. */
LenMaximum: movl deflatestate(%esp), %edx
movl $MAX_MATCH, bestlen(%esp)
movl %ecx, dsMatchStart(%edx)
/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
/* return s->lookahead; */
LeaveNow:
movl deflatestate(%esp), %edx
movl bestlen(%esp), %ebx
movl dsLookahead(%edx), %eax
cmpl %eax, %ebx
jg LookaheadRet
movl %ebx, %eax
LookaheadRet:
/* Restore the stack and return from whence we came. */
addl $LocalVarsSize, %esp
popl %ebx
popl %esi
popl %edi
popl %ebp
match_init: ret

View File

@@ -0,0 +1,34 @@
This is a patched version of zlib, modified to use
Pentium-Pro-optimized assembly code in the deflation algorithm. The
files changed/added by this patch are:
README.686
match.S
The speedup that this patch provides varies, depending on whether the
compiler used to build the original version of zlib falls afoul of the
PPro's speed traps. My own tests show a speedup of around 10-20% at
the default compression level, and 20-30% using -9, against a version
compiled using gcc 2.7.2.3. Your mileage may vary.
Note that this code has been tailored for the PPro/PII in particular,
and will not perform particuarly well on a Pentium.
If you are using an assembler other than GNU as, you will have to
translate match.S to use your assembler's syntax. (Have fun.)
Brian Raiter
breadbox@muppetlabs.com
April, 1998
Added for zlib 1.1.3:
The patches come from
http://www.muppetlabs.com/~breadbox/software/assembly.html
To compile zlib with this asm file, copy match.S to the zlib directory
then do:
CFLAGS="-O3 -DASMV" ./configure
make OBJA=match.o

Some files were not shown because too many files have changed in this diff Show More