⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zlibh.pas

📁 East make Tray Icon in delphi
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{**************************************************************************************************}
{  WARNING:  JEDI preprocessor generated unit.  Do not edit.                                       }
{**************************************************************************************************}

{ zlib.h -- interface of the 'zlib' general purpose compression library
  version 1.2.1, November 17th, 2003

  Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

  Jean-loup Gailly        Mark Adler
  jloup@gzip.org          madler@alumni.caltech.edu


  The data format used by the zlib library is described by RFCs (Request for
  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
}

{$I jedi.inc}

{* Set this DEFINE to allow this unit to be linked against a .SO/.DLL
 * The name "DLL" was used because e.g. the wxWidgets projects also uses
 * this name to refer to dynamic libraries (even on *nix systems).
 *}

{ $DEFINE ZLIB_DLL}

{ $DEFINE STATIC_GZIO}

{ TODO: cdecl = zlib1.dll calling convention? }

{$HPPEMIT '#define ZEXPORT __fastcall'}

{$IFDEF ZEXPORT_CDECL}
{$HPPEMIT '#define ZEXPORT __cdecl'}
{$ENDIF ZEXPORT_CDECL}

{$HPPEMIT '#define ZEXPORTVA __cdecl'}

{$HPPEMIT '#include <zutil.h>'}

unit zlibh;

interface

uses
  Windows;
type
  uShort = Word;
  {$EXTERNALSYM uShort}
  size_t = Longint;
  {$EXTERNALSYM size_t}

//-----------------------------------------------------------------------------
// START of the contents of the converted ZCONF.H
//-----------------------------------------------------------------------------
{* zconf.h -- configuration of the zlib compression library
 * Copyright (C) 1995-2003 Jean-loup Gailly.
 * For conditions of distribution and use, see copyright notice in zlib.h

 * If you *really* need a unique prefix for all types and library functions,
 * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
 *}

type
  {$EXTERNALSYM Bytef}
  Bytef  = Byte;
  {$EXTERNALSYM PBytef}
  PBytef = ^Bytef;
  {$EXTERNALSYM UnsignedInt}
  UnsignedInt = LongWord;
  {$EXTERNALSYM uLongf}
  uLongf = ULONG;
  {$EXTERNALSYM PuLongf}
  PuLongf = ^uLongf;

{* Maximum value for windowBits in deflateInit2 and inflateInit2.
 * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
 * created by gzip. (Files created by minigzip can still be extracted by
 * gzip.)
 *}

const
  {$EXTERNALSYM MAX_WBITS}
  MAX_WBITS   = 15; // 32K LZ77 window

{* The memory requirements for deflate are (in bytes):
            (1 << (windowBits+2)) +  (1 << (memLevel+9))
 that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
 plus a few kilobytes for small objects. For example, if you want to reduce
 the default memory requirements from 256K to 128K, compile with
     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
 Of course this will generally degrade compression (there's no free lunch).

   The memory requirements for inflate are (in bytes) 1 << windowBits
 that is, 32K for windowBits=15 (default value) plus a few kilobytes
 for small objects.
*}

                        {* Type declarations *}

{* The following definitions for FAR are needed only for MSDOS mixed
 * model programming (small or medium model with some far allocations).
 * This was tested only with MSC; for other MSDOS compilers you may have
 * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
 * just define FAR to be empty.
 *}

{* If building or using zlib with the WINAPI/WINAPIV calling convention,
 * define ZLIB_WINAPI.
 * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
 *}

{ $HPPEMIT '#define ZEXPORT   __stdcall'} // OS: CHECKTHIS
{ $HPPEMIT '#define ZEXPORTVA __cdecl'} // OS: CHECKTHIS

// type
//   uInt = UINT; --> already defined in Windows.pas /* 16 bits or more
//   uLong = ULONG; --> already defined in Windows.pas /* 32 bits or more

type
  {$EXTERNALSYM voidpc}
   voidpc = Pointer;
  {$EXTERNALSYM voidpf}
   voidpf = Pointer;
  {$EXTERNALSYM voidp}
   voidp = Pointer;
  {$EXTERNALSYM z_off_t}
   z_off_t = LongInt;

const
  {$EXTERNALSYM SEEK_SET}
  SEEK_SET        =0;       // Seek from beginning of file.
  {$EXTERNALSYM SEEK_CUR}
  SEEK_CUR        =1;       // Seek from current position.
  {$EXTERNALSYM SEEK_END}
  SEEK_END        =2;       // Set file pointer to EOF plus "offset" 

//-----------------------------------------------------------------------------
// END of the contents of the converted ZCONF.H
//-----------------------------------------------------------------------------

const
  {$EXTERNALSYM ZLIB_VERSION}
  ZLIB_VERSION = '1.2.2';
  {$EXTERNALSYM ZLIB_VERNUM}
  ZLIB_VERNUM =$1210;

{*
     The 'zlib' compression library provides in-memory compression and
  decompression functions, including integrity checks of the uncompressed
  data.  This version of the library supports only one compression method
  (deflation) but other algorithms will be added later and will have the same
  stream interface.

     Compression can be done in a single step if the buffers are large
  enough (for example if an input file is mmap'ed), or can be done by
  repeated calls of the compression function.  In the latter case, the
  application must provide more input and/or consume the output
  (providing more output space) before each call.

     The compressed data format used by the in-memory functions is the zlib
  format, which is a zlib wrapper documented in RFC 1950, wrapped around a
  deflate stream, which is itself documented in RFC 1951.

     The library also supports reading and writing files in gzip (.gz) format
  with an interface similar to that of stdio using the functions that start
  with "gz".  The gzip format is different from the zlib format.  gzip is a
  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.

     The zlib format was designed to be compact and fast for use in memory
  and on communications channels.  The gzip format was designed for single-
  file compression on file systems, has a larger header than zlib to maintain
  directory information, and uses a different, slower check method than zlib.

     This library does not provide any functions to write gzip files in memory.
  However such functions could be easily written using zlib's deflate function,
  the documentation in the gzip RFC, and the examples in gzio.c.

     The library does not install any signal handler. The decoder checks
  the consistency of the compressed data, so the library should never
  crash even in case of corrupted input.
*}

type
  {$EXTERNALSYM alloc_func}
  alloc_func = function(opaque:voidpf; items:uInt; size:uInt):voidpf;
  {$EXTERNALSYM free_func}
  free_func = procedure(opaque:voidpf; address:voidpf);
  TFNAllocFunc = alloc_func;
  TFNFreeFunc = free_func;

type
  {$EXTERNALSYM internal_state}
  internal_state = packed record end;
  TInternalState = internal_state; // backward compatibility
  PInternalState = ^internal_state; // backward compatibility

type
  {$EXTERNALSYM z_stream_s}
  z_stream_s = packed record
      next_in: PBytef;       // next input byte
      avail_in: uInt;        // number of bytes available at next_in 
      total_in: uLong;       // total nb of input bytes read so far 

      next_out: PBytef;       // next output byte should be put there 
      avail_out:uInt;        // remaining free space at next_out
      total_out:uLong;       // total nb of bytes output so far

      msg:     PChar;        // last error message, NULL if no error
      state:PInternalState;  // not visible by applications 

      zalloc:   TFNAllocFunc;// used to allocate the internal state 
      zfree:    TFNFreeFunc; // used to free the internal state 
      opaque:   voidpf;      // private data object passed to zalloc and zfree 

      data_type: Integer;     // best guess about the data type: ascii or binary 
      adler:    uLong;       // adler32 value of the uncompressed data 
      reserved: uLong;       // reserved for future use 
  end;

  {$EXTERNALSYM z_stream}
  z_stream = z_stream_s;
  {$EXTERNALSYM z_streamp}
  z_streamp = ^z_stream_s;

  TZStreamRec = z_stream_s;
  PZStreamRec = ^z_stream_s;

{*
   The application must update next_in and avail_in when avail_in has
   dropped to zero. It must update next_out and avail_out when avail_out
   has dropped to zero. The application must initialize zalloc, zfree and
   opaque before calling the init function. All other fields are set by the
   compression library and must not be updated by the application.

   The opaque value provided by the application will be passed as the first
   parameter for calls of zalloc and zfree. This can be useful for custom
   memory management. The compression library attaches no meaning to the
   opaque value.

   zalloc must return Z_NULL if there is not enough memory for the object.
   If zlib is used in a multi-threaded application, zalloc and zfree must be
   thread safe.

   On 16-bit systems, the functions zalloc and zfree must be able to allocate
   exactly 65536 bytes, but will not be required to allocate more than this
   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
   pointers returned by zalloc for objects of exactly 65536 bytes *must*
   have their offset normalized to zero. The default allocation function
   provided by this library ensures this (see zutil.c). To reduce memory
   requirements and avoid any allocation of 64K objects, at the expense of
   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).

   The fields total_in and total_out can be used for statistics or
   progress reports. After compression, total_in holds the total size of
   the uncompressed data and may be saved for use in the decompressor
   (particularly if the decompressor wants to decompress everything in
   a single step).
*}

                        {* constants *}

const
  {$EXTERNALSYM Z_NO_FLUSH}
  Z_NO_FLUSH      = 0;
  {$EXTERNALSYM Z_PARTIAL_FLUSH}
  Z_PARTIAL_FLUSH = 1; // will be removed, use Z_SYNC_FLUSH instead
  {$EXTERNALSYM Z_SYNC_FLUSH}
  Z_SYNC_FLUSH    = 2;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -