GPS4Palm

Source Code Documentation


SysZLib.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  *
00003  * $RCSfile: SysZLib_8h-source.html,v $
00004  *
00005  * SysZLib Header File
00006  *
00007  * Copyright notice:
00008  * 
00009  *  (C) 1995-1998 Jean-loup Gailly and Mark Adler
00010  * 
00011  *   This software is provided 'as-is', without any express or implied
00012  *   warranty.  In no event will the authors be held liable for any damages
00013  *   arising from the use of this software.
00014  * 
00015  *   Permission is granted to anyone to use this software for any purpose,
00016  *   including commercial applications, and to alter it and redistribute it
00017  *   freely, subject to the following restrictions:
00018  * 
00019  *   1. The origin of this software must not be misrepresented; you must not
00020  *      claim that you wrote the original software. If you use this software
00021  *      in a product, an acknowledgment in the product documentation would be
00022  *      appreciated but is not required.
00023  *   2. Altered source versions must be plainly marked as such, and must not be
00024  *      misrepresented as being the original software.
00025  *   3. This notice may not be removed or altered from any source distribution.
00026  * 
00027  *   Jean-loup Gailly        Mark Adler
00028  *   jloup@gzip.org          madler@alumni.caltech.edu
00029  * 
00030  * If you use the zlib library in a product, we would appreciate *not*
00031  * receiving lengthy legal documents to sign. The sources are provided
00032  * for free but without warranty of any kind.  The library has been
00033  * entirely written by Jean-loup Gailly and Mark Adler; it does not
00034  * include third-party code.
00035  * 
00036  * If you redistribute modified sources, we would appreciate that you include
00037  * in the file ChangeLog history information documenting your changes.
00038  *
00039  * $Author: mp $
00040  *
00041  * $Date: 2007-10-08 20:40:34 $
00042  *
00043  * $Revision: 1.7.2.1 $
00044  *
00045  * $Log: SysZLib_8h-source.html,v $
00045  * Revision 1.7.2.1  2007-10-08 20:40:34  mp
00045  * updated for gps4palm V0.9.5 beta
00045  *
00046  * Revision 1.1.1.1  2003-07-14 18:59:29  mp
00047  * Imported GPS4Palm to CVS revision control.
00048  *
00049  *
00050  ****************************************************************************/
00051 #ifndef __ZLIB_H__
00052 #define __ZLIB_H__
00053 
00054 #define ZLIB_VERSION "1.1.3"
00055 
00056 #define PALMOS
00057 #include "zconf.h"
00058 
00059 /* constants */
00060 #define Z_NO_FLUSH      0
00061 #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
00062 #define Z_SYNC_FLUSH    2
00063 #define Z_FULL_FLUSH    3
00064 #define Z_FINISH        4
00065 /* Allowed flush values; see deflate() below for details */
00066 #define Z_OK            0
00067 #define Z_STREAM_END    1
00068 #define Z_NEED_DICT     2
00069 #define Z_ERRNO        (-1)
00070 #define Z_STREAM_ERROR (-2)
00071 #define Z_DATA_ERROR   (-3)
00072 #define Z_MEM_ERROR    (-4)
00073 #define Z_BUF_ERROR    (-5)
00074 #define Z_VERSION_ERROR (-6)
00075 /* Return codes for the compression/decompression functions. Negative
00076  * values are errors, positive values are used for special but normal events.
00077  */
00078 
00079 #define Z_NO_COMPRESSION         0
00080 #define Z_BEST_SPEED             1
00081 #define Z_BEST_COMPRESSION       9
00082 #define Z_DEFAULT_COMPRESSION  (-1)
00083 /* compression levels */
00084 
00085 #define Z_FILTERED            1
00086 #define Z_HUFFMAN_ONLY        2
00087 #define Z_DEFAULT_STRATEGY    0
00088 /* compression strategy; see deflateInit2() below for details */
00089 
00090 #define Z_BINARY   0
00091 #define Z_ASCII    1
00092 #define Z_UNKNOWN  2
00093 /* Possible values of the data_type field */
00094 
00095 #define Z_DEFLATED   8
00096 /* The deflate compression method (the only one supported in this version) */
00097 
00098 #define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
00099 
00100 typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
00101 typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
00102 
00103 struct internal_state;
00104 
00105 typedef struct z_stream_s {
00106     Bytef    *next_in;  /* next input byte */
00107     uInt     avail_in;  /* number of bytes available at next_in */
00108     uLong    total_in;  /* total nb of input bytes read so far */
00109 
00110     Bytef    *next_out; /* next output byte should be put there */
00111     uInt     avail_out; /* remaining free space at next_out */
00112     uLong    total_out; /* total nb of bytes output so far */
00113 
00114     char     *msg;      /* last error message, NULL if no error */
00115     struct internal_state FAR *state; /* not visible by applications */
00116 
00117     alloc_func zalloc;  /* used to allocate the internal state */
00118     free_func  zfree;   /* used to free the internal state */
00119     voidpf     opaque;  /* private data object passed to zalloc and zfree */
00120 
00121     int     data_type;  /* best guess about the data type: ascii or binary */
00122     uLong   adler;      /* adler32 value of the uncompressed data */
00123     uLong   reserved;   /* reserved for future use */
00124 } z_stream;
00125 
00126 typedef z_stream FAR *z_streamp;
00127 
00128     /* Function declarations */
00129 Err ZLibOpen(UInt refNum) SYS_TRAP(sysLibTrapOpen);
00130 Err ZLibClose(UInt refNum, UIntPtr numappsP) SYS_TRAP(sysLibTrapClose);
00131 Err ZLibSleep(UInt refNum) SYS_TRAP(sysLibTrapSleep);
00132 Err ZLibWake(UInt refNum) SYS_TRAP(sysLibTrapWake);
00133 
00134 Err ZLibdeflateinit2(UInt refnum, z_streamp strm, int level, int method,
00135                       int windowBits, int memLevel,
00136                       int strategy, const char *version, int stream_size)
00137         SYS_TRAP(sysLibTrapCustom);
00138 
00139 Err ZLibdeflate(UInt refnum, z_streamp strm, int flush)
00140         SYS_TRAP(sysLibTrapCustom+1);
00141 
00142 Err ZLibdeflateend(UInt refnum, z_streamp strm)
00143         SYS_TRAP(sysLibTrapCustom+2);
00144 
00145 Err ZLibinflateinit2(UInt refnum, z_streamp strm,
00146                       int windowBits, const char *version, int stream_size)
00147         SYS_TRAP(sysLibTrapCustom+3);
00148 
00149 Err ZLibinflate(UInt refnum, z_streamp strm, int flush)
00150         SYS_TRAP(sysLibTrapCustom+4);
00151 
00152 Err ZLibinflateend(UInt refnum, z_streamp strm)
00153         SYS_TRAP(sysLibTrapCustom+5);
00154 
00155 uLong ZLibcrc32(UInt refnum, uLong crc, const Bytef * buf, uInt len)
00156         SYS_TRAP(sysLibTrapCustom+6);
00157 
00158 uLong ZLibadler32(UInt refnum, uLong adler, const Bytef * buf, uInt len)
00159         SYS_TRAP(sysLibTrapCustom+7);
00160 
00161 Err ZLibcompress2(UInt refnum, Bytef * dest, uLongf * destLen,
00162                    const Bytef * source, uLong sourceLen, int level)
00163         SYS_TRAP(sysLibTrapCustom+8);
00164 
00165 Err ZLibuncompress(UInt refnum, Bytef * dest, uLongf * destLen,
00166                     const Bytef * source, uLong sourceLen)
00167         SYS_TRAP(sysLibTrapCustom+9);
00168 
00169 #ifndef NOZLIBDEFS
00170 UInt ZLibRef = 0;
00171 #else
00172 extern UInt ZLibRef;
00173 #endif
00174 
00175 
00176 #define ZLSetup  !ZLibRef && SysLibFind("Z.lib", &ZLibRef) && SysLibLoad('libr', 'ZLib', &ZLibRef) \
00177                    && SysLibFind("Z.lib", &ZLibRef) && ZLibOpen(ZLibRef) && (ErrFatalDisplay("No ZLib"),0)
00178 
00179 #define ZLTeardown  if(ZLibRef){\
00180                       UInt zltmp;\
00181                       ZLibClose(ZLibRef,&zltmp);\
00182                       if(!zltmp)\
00183                         SysLibRemove(ZLibRef);\
00184                       ZLibRef = 0;}
00185 
00186 
00187 #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
00188         ZLibdeflateinit2((ZLibRef),(strm),(level),(method),(windowBits),(memLevel),\
00189                       (strategy), ZLIB_VERSION, sizeof(z_stream))
00190 #define inflateInit2(strm, windowBits) \
00191         ZLibinflateinit2((ZLibRef), (strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
00192 
00193 /* 13 bits requires 32k, Memlevel 6 requires 32k.  Each increment doubles (for each) */
00194 #define deflateInit(a,b) ZLibdeflateinit2((ZLibRef), a, b, Z_DEFLATED, 13, 6, Z_DEFAULT_STRATEGY, ZLIB_VERSION, sizeof(z_stream))
00195 #define deflateInit_(a,b,c,d) ZLibdeflateinit2((ZLibRef), a, b, Z_DEFLATED, 13, 6, Z_DEFAULT_STRATEGY, c, d)
00196 
00197 #define inflateInit(a) ZLibinflateinit2((ZLibRef), a, 15, ZLIB_VERSION, sizeof(z_stream))
00198 #define inflateInit_(a,b,c) ZLibinflateinit2((ZLibRef), a, 15, b, c)
00199 
00200 #define inflate(x,y) ZLibinflate(ZLibRef,x,y)
00201 #define deflate(x,y) ZLibdeflate(ZLibRef,x,y)
00202 #define inflateEnd(x) ZLibinflateend(ZLibRef,x)
00203 #define deflateEnd(x) ZLibdeflateend(ZLibRef,x)
00204 #define crc32(a,b,c) ZLibcrc32(ZLibRef,a,b,c)
00205 #define adler32(a,b,c) ZLibadler32(ZLibRef,a,b,c)
00206 
00207 #endif

Created: Mon, 08 Oct 2007 22:33:16 +0200
Copyright ©2004 M. Prinke