stdlibs/libz/zlib/libzcore.h
changeset 65 c4aad78f92f5
parent 50 79045913e4e9
child 66 38bdaa106551
equal deleted inserted replaced
50:79045913e4e9 65:c4aad78f92f5
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef LIBZCORE_H
       
    21 #define LIBZCORE_H
       
    22 
       
    23 
       
    24 #if (defined(__TOOLS2__) ||defined(__TOOLS__))
       
    25 	// A tools build picks up the zconf.h file from the user include path
       
    26 	#include "zlib.h"
       
    27 #else	
       
    28 	#include <e32def.h>
       
    29 	// Any other build picks up zconf.h from stdapis system include directory
       
    30 	#include <zlib.h>
       
    31 #endif
       
    32 
       
    33 
       
    34 
       
    35 #ifdef __cplusplus
       
    36 extern "C" {
       
    37 #endif
       
    38 
       
    39 
       
    40 //=========================================================================
       
    41 // The application can compare zlibVersion and ZLIB_VERSION for consistency.
       
    42 //=========================================================================
       
    43 ZEXTERN const char * ZEXPORT zlibVersion_r OF((void));
       
    44 
       
    45 
       
    46 
       
    47 //=========================================================================
       
    48 // This function shall compresses as much as possible.
       
    49 //=========================================================================
       
    50 ZEXTERN int ZEXPORT deflate_r OF((z_streamp strm, int flush));
       
    51 
       
    52 
       
    53 
       
    54 //=========================================================================
       
    55 // This function shall deallocate all the dynamically allocated data 
       
    56 // structures.
       
    57 //=========================================================================
       
    58 ZEXTERN int ZEXPORT deflateEnd_r OF((z_streamp strm));
       
    59 
       
    60 
       
    61 
       
    62 //=========================================================================
       
    63 // This function shall decompresses as much as possible.
       
    64 //=========================================================================
       
    65 ZEXTERN int ZEXPORT inflate_r OF((z_streamp strm, int flush));
       
    66 
       
    67 
       
    68 
       
    69 //=========================================================================
       
    70 // This function shall deallocate all the dynamically allocated data 
       
    71 // structures.
       
    72 //=========================================================================
       
    73 ZEXTERN int ZEXPORT inflateEnd_r OF((z_streamp strm));
       
    74 
       
    75 
       
    76 
       
    77 
       
    78 
       
    79 //=========================================================================
       
    80 // This function shall Initializes the compression dictionary from the given 
       
    81 // byte sequence without producing any compressed output.
       
    82 //=========================================================================
       
    83 ZEXTERN int ZEXPORT deflateSetDictionary_r OF((z_streamp strm,
       
    84                                              const Bytef *dictionary,
       
    85                                              uInt  dictLength));
       
    86 
       
    87 
       
    88 //=========================================================================
       
    89 // This function shall sets the destination stream as a complete copy of 
       
    90 // the source stream
       
    91 //=========================================================================
       
    92 ZEXTERN int ZEXPORT deflateCopy_r OF((z_streamp dest,
       
    93                                     z_streamp source));
       
    94 
       
    95 
       
    96 //=========================================================================
       
    97 // This function does not free and reallocate all the internal compression
       
    98 // state.
       
    99 //=========================================================================
       
   100 ZEXTERN int ZEXPORT deflateReset_r OF((z_streamp strm));
       
   101 
       
   102 
       
   103 
       
   104 //=========================================================================
       
   105 // This function shall update the compression level and compression strategy.
       
   106 //=========================================================================
       
   107 ZEXTERN int ZEXPORT deflateParams_r OF((z_streamp strm,
       
   108                                       int level,
       
   109                                       int strategy));
       
   110                                       
       
   111                                   
       
   112 //=========================================================================
       
   113 // This function shall fine tune deflate's internal compression parameters.
       
   114 //=========================================================================
       
   115 ZEXTERN int ZEXPORT deflateTune_r OF((z_streamp strm,
       
   116                                     int good_length,
       
   117                                     int max_lazy,
       
   118                                     int nice_length,
       
   119                                     int max_chain));    
       
   120 
       
   121 
       
   122 
       
   123 //=========================================================================
       
   124 // This function shall an upper bound on the compressed size after deflation
       
   125 // of sourceLen bytes.
       
   126 //=========================================================================
       
   127 ZEXTERN uLong ZEXPORT deflateBound_r OF((z_streamp strm,
       
   128                                        uLong sourceLen));
       
   129                                       
       
   130 
       
   131 //=========================================================================
       
   132 // This function shall insert bits in the deflate output stream.
       
   133 //=========================================================================
       
   134 ZEXTERN int ZEXPORT deflatePrime_r OF((z_streamp strm,
       
   135                                      int bits,
       
   136                                      int value));
       
   137 
       
   138 //=========================================================================
       
   139 // This function shall provides gzip header information for when a gzip
       
   140 // stream is requested by deflateInit2().
       
   141 //=========================================================================
       
   142 ZEXTERN int ZEXPORT deflateSetHeader_r OF((z_streamp strm,
       
   143                                          gz_headerp head));
       
   144                                                                              
       
   145                                      
       
   146 
       
   147                                      
       
   148 //=========================================================================
       
   149 // This function initializes the decompression dictionary from the given 
       
   150 // uncompressed byte sequence.
       
   151 //=========================================================================
       
   152 ZEXTERN int ZEXPORT inflateSetDictionary_r OF((z_streamp strm,
       
   153                                              const Bytef *dictionary,
       
   154                                              uInt  dictLength));
       
   155                                              
       
   156 
       
   157 //=========================================================================
       
   158 // This function shall skips invalid coompressed data until a full flush 
       
   159 // point can be found, or unil all the available input is skipped.
       
   160 //=========================================================================
       
   161 ZEXTERN int ZEXPORT inflateSync_r OF((z_streamp strm));
       
   162 
       
   163 
       
   164 //=========================================================================
       
   165 // This function shall set the destination stream as a complete copy of 
       
   166 // the source stream.
       
   167 //=========================================================================
       
   168 ZEXTERN int ZEXPORT inflateCopy_r OF((z_streamp dest,
       
   169                                     z_streamp source));
       
   170 
       
   171 
       
   172 
       
   173 //=========================================================================
       
   174 // This function shall not free and reallocate all the internal decompression
       
   175 // state.
       
   176 //=========================================================================
       
   177 ZEXTERN int ZEXPORT inflateReset_r OF((z_streamp strm));
       
   178 
       
   179 
       
   180 //=========================================================================
       
   181 // This function inserts bits in the inflate input stream.
       
   182 //=========================================================================
       
   183 ZEXTERN int ZEXPORT inflatePrime_r OF((z_streamp strm,
       
   184                                      int bits,
       
   185                                      int value));
       
   186 
       
   187 //=========================================================================
       
   188 // This function requests that gzip header information be stored in the
       
   189 // provided gz_header structure.
       
   190 //=========================================================================
       
   191 ZEXTERN int ZEXPORT inflateGetHeader_r OF((z_streamp strm,
       
   192                                          gz_headerp head));
       
   193 
       
   194 //=========================================================================
       
   195 // This function does a raw inflate with a single call using a call-back
       
   196 // interface for input and output.
       
   197 //=========================================================================                                         
       
   198 ZEXTERN int ZEXPORT inflateBack_r OF((z_streamp strm,
       
   199                                     in_func in, void FAR *in_desc,
       
   200                                     out_func out, void FAR *out_desc));
       
   201                                     
       
   202 //=========================================================================
       
   203 // This function frees all memory allocated by inflateBackInit().
       
   204 //=========================================================================
       
   205 ZEXTERN int ZEXPORT inflateBackEnd_r OF((z_streamp strm));
       
   206 
       
   207 
       
   208 //=========================================================================
       
   209 // This function returns flags indicating compile-time options.
       
   210 //=========================================================================
       
   211 ZEXTERN uLong ZEXPORT zlibCompileFlags_r OF((void));
       
   212 
       
   213 
       
   214 
       
   215 
       
   216 //=========================================================================
       
   217 // This function compressed the source buffer into the destination buffer.
       
   218 //=========================================================================
       
   219 ZEXTERN int ZEXPORT compress_r OF((Bytef *dest,   uLongf *destLen,
       
   220                                  const Bytef *source, uLong sourceLen));
       
   221                                  
       
   222 
       
   223 
       
   224 //=========================================================================
       
   225 // This function compresses the source buffer into the destination buffer.
       
   226 //=========================================================================
       
   227 ZEXTERN int ZEXPORT compress2_r OF((Bytef *dest,   uLongf *destLen,
       
   228                                   const Bytef *source, uLong sourceLen, int level));
       
   229 
       
   230 
       
   231 //=========================================================================
       
   232 // This function returns an upper bound on the compressed size after the 
       
   233 // compress or compress2 on the sourceLen bytes.
       
   234 //=========================================================================
       
   235 ZEXTERN uLong ZEXPORT compressBound_r OF((uLong sourceLen));
       
   236 
       
   237 
       
   238 //=========================================================================
       
   239 // This function decompresses the source buffer into the destination buffer.
       
   240 //=========================================================================
       
   241 ZEXTERN int ZEXPORT uncompress_r OF((Bytef *dest,   uLongf *destLen,
       
   242                                    const Bytef *source, uLong sourceLen));
       
   243 
       
   244 
       
   245 //=========================================================================
       
   246 // Update a running Adler-32 checksum with the bytes buf[0..len-1] and 
       
   247 // return the updated checksum.
       
   248 //=========================================================================
       
   249 ZEXTERN uLong ZEXPORT adler32_r OF((uLong adler, const Bytef *buf, uInt len));
       
   250 
       
   251 //=========================================================================
       
   252 // This function combines two Adler-32 checksums into one.
       
   253 //=========================================================================
       
   254 ZEXTERN uLong ZEXPORT adler32_combine_r OF((uLong adler1, uLong adler2,
       
   255                                           z_off_t len2));
       
   256                                                                                 
       
   257 
       
   258 //=========================================================================
       
   259 // Update a running CRC-32 checksum with the bytes buf[0..len-1] and 
       
   260 // return the updated CRC-32.
       
   261 //=========================================================================
       
   262 ZEXTERN uLong ZEXPORT crc32_r OF((uLong crc, const Bytef *buf, uInt len));
       
   263 
       
   264 
       
   265 //=========================================================================
       
   266 // This function combines two CRC-32 check values into one.
       
   267 //=========================================================================
       
   268 ZEXTERN uLong ZEXPORT crc32_combine_r OF((uLong crc1, uLong crc2, 
       
   269 										z_off_t len2));
       
   270 										
       
   271 
       
   272 
       
   273 /* deflateInit and inflateInit are macros to allow checking the zlib version
       
   274  * and the compiler's view of z_stream:
       
   275  */
       
   276 ZEXTERN int ZEXPORT deflateInit__r OF((z_streamp strm, int level,
       
   277                                      const char *version, int stream_size));
       
   278 ZEXTERN int ZEXPORT inflateInit__r OF((z_streamp strm,
       
   279                                      const char *version, int stream_size));
       
   280 ZEXTERN int ZEXPORT deflateInit2__r OF((z_streamp strm, int  level, int  method,
       
   281                                       int windowBits, int memLevel,
       
   282                                       int strategy, const char *version,
       
   283                                       int stream_size));
       
   284 ZEXTERN int ZEXPORT inflateInit2__r OF((z_streamp strm, int  windowBits,
       
   285                                       const char *version, int stream_size));                                     
       
   286 ZEXTERN int ZEXPORT inflateBackInit__r OF((z_streamp strm, int windowBits,
       
   287                                          unsigned char FAR *window,
       
   288                                          const char *version,
       
   289                                          int stream_size));
       
   290                                       
       
   291 
       
   292 #define deflateInit_r(strm, level) \
       
   293         deflateInit__r((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
       
   294 #define inflateInit_r(strm) \
       
   295         inflateInit__r((strm),                ZLIB_VERSION, sizeof(z_stream))
       
   296 #define deflateInit2_r(strm, level, method, windowBits, memLevel, strategy) \
       
   297         deflateInit2__r((strm),(level),(method),(windowBits),(memLevel),\
       
   298                       (strategy),           ZLIB_VERSION, sizeof(z_stream))
       
   299 #define inflateInit2_r(strm, windowBits) \
       
   300         inflateInit2__r((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
       
   301         
       
   302 #define inflateBackInit_r(strm, windowBits, window) \
       
   303         inflateBackInit__r((strm), (windowBits), (window), \
       
   304         ZLIB_VERSION, sizeof(z_stream))        
       
   305 
       
   306 
       
   307 ZEXTERN const char   * ZEXPORT zError_r           OF((int));
       
   308 ZEXTERN int            ZEXPORT inflateSyncPoint_r OF((z_streamp z));
       
   309 ZEXTERN const uLongf * ZEXPORT get_crc_table_r    OF((void));
       
   310 
       
   311 
       
   312 #ifdef __cplusplus
       
   313 }
       
   314 #endif
       
   315 
       
   316 #endif /* LIBZCORE_H */