OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [zlib/] [zutil.h] - Diff between revs 745 and 783

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 745 Rev 783
/* zutil.h -- internal interface and configuration of the compression library
/* zutil.h -- internal interface and configuration of the compression library
 * Copyright (C) 1995-2005 Jean-loup Gailly.
 * Copyright (C) 1995-2005 Jean-loup Gailly.
 * For conditions of distribution and use, see copyright notice in zlib.h
 * For conditions of distribution and use, see copyright notice in zlib.h
 */
 */
 
 
/* WARNING: this file should *not* be used by applications. It is
/* WARNING: this file should *not* be used by applications. It is
   part of the implementation of the compression library and is
   part of the implementation of the compression library and is
   subject to change. Applications should only use zlib.h.
   subject to change. Applications should only use zlib.h.
 */
 */
 
 
/* @(#) $Id: zutil.h,v 1.1.1.2 2002/03/11 21:53:28 tromey Exp $ */
/* @(#) $Id: zutil.h,v 1.1.1.2 2002/03/11 21:53:28 tromey Exp $ */
 
 
#ifndef ZUTIL_H
#ifndef ZUTIL_H
#define ZUTIL_H
#define ZUTIL_H
 
 
#define ZLIB_INTERNAL
#define ZLIB_INTERNAL
#include "zlib.h"
#include "zlib.h"
 
 
#ifdef STDC
#ifdef STDC
#  ifndef _WIN32_WCE
#  ifndef _WIN32_WCE
#    include <stddef.h>
#    include <stddef.h>
#  endif
#  endif
#  include <string.h>
#  include <string.h>
#  include <stdlib.h>
#  include <stdlib.h>
#endif
#endif
#ifdef NO_ERRNO_H
#ifdef NO_ERRNO_H
#   ifdef _WIN32_WCE
#   ifdef _WIN32_WCE
      /* The Microsoft C Run-Time Library for Windows CE doesn't have
      /* The Microsoft C Run-Time Library for Windows CE doesn't have
       * errno.  We define it as a global variable to simplify porting.
       * errno.  We define it as a global variable to simplify porting.
       * Its value is always 0 and should not be used.  We rename it to
       * Its value is always 0 and should not be used.  We rename it to
       * avoid conflict with other libraries that use the same workaround.
       * avoid conflict with other libraries that use the same workaround.
       */
       */
#     define errno z_errno
#     define errno z_errno
#   endif
#   endif
    extern int errno;
    extern int errno;
#else
#else
#  ifndef _WIN32_WCE
#  ifndef _WIN32_WCE
#    include <errno.h>
#    include <errno.h>
#  endif
#  endif
#endif
#endif
 
 
#ifndef local
#ifndef local
#  define local static
#  define local static
#endif
#endif
/* compile with -Dlocal if your debugger can't find static symbols */
/* compile with -Dlocal if your debugger can't find static symbols */
 
 
typedef unsigned char  uch;
typedef unsigned char  uch;
typedef uch FAR uchf;
typedef uch FAR uchf;
typedef unsigned short ush;
typedef unsigned short ush;
typedef ush FAR ushf;
typedef ush FAR ushf;
typedef unsigned long  ulg;
typedef unsigned long  ulg;
 
 
extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */
/* (size given to avoid silly warnings with Visual C++) */
 
 
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
 
 
#define ERR_RETURN(strm,err) \
#define ERR_RETURN(strm,err) \
  return (strm->msg = (char*)ERR_MSG(err), (err))
  return (strm->msg = (char*)ERR_MSG(err), (err))
/* To be used only when the state is known to be valid */
/* To be used only when the state is known to be valid */
 
 
        /* common constants */
        /* common constants */
 
 
#ifndef DEF_WBITS
#ifndef DEF_WBITS
#  define DEF_WBITS MAX_WBITS
#  define DEF_WBITS MAX_WBITS
#endif
#endif
/* default windowBits for decompression. MAX_WBITS is for compression only */
/* default windowBits for decompression. MAX_WBITS is for compression only */
 
 
#if MAX_MEM_LEVEL >= 8
#if MAX_MEM_LEVEL >= 8
#  define DEF_MEM_LEVEL 8
#  define DEF_MEM_LEVEL 8
#else
#else
#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
#endif
#endif
/* default memLevel */
/* default memLevel */
 
 
#define STORED_BLOCK 0
#define STORED_BLOCK 0
#define STATIC_TREES 1
#define STATIC_TREES 1
#define DYN_TREES    2
#define DYN_TREES    2
/* The three kinds of block type */
/* The three kinds of block type */
 
 
#define MIN_MATCH  3
#define MIN_MATCH  3
#define MAX_MATCH  258
#define MAX_MATCH  258
/* The minimum and maximum match lengths */
/* The minimum and maximum match lengths */
 
 
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
 
 
        /* target dependencies */
        /* target dependencies */
 
 
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
#  define OS_CODE  0x00
#  define OS_CODE  0x00
#  if defined(__TURBOC__) || defined(__BORLANDC__)
#  if defined(__TURBOC__) || defined(__BORLANDC__)
#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
       /* Allow compilation with ANSI keywords only enabled */
       /* Allow compilation with ANSI keywords only enabled */
       void _Cdecl farfree( void *block );
       void _Cdecl farfree( void *block );
       void *_Cdecl farmalloc( unsigned long nbytes );
       void *_Cdecl farmalloc( unsigned long nbytes );
#    else
#    else
#      include <alloc.h>
#      include <alloc.h>
#    endif
#    endif
#  else /* MSC or DJGPP */
#  else /* MSC or DJGPP */
#    include <malloc.h>
#    include <malloc.h>
#  endif
#  endif
#endif
#endif
 
 
#ifdef AMIGA
#ifdef AMIGA
#  define OS_CODE  0x01
#  define OS_CODE  0x01
#endif
#endif
 
 
#if defined(VAXC) || defined(VMS)
#if defined(VAXC) || defined(VMS)
#  define OS_CODE  0x02
#  define OS_CODE  0x02
#  define F_OPEN(name, mode) \
#  define F_OPEN(name, mode) \
     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
#endif
#endif
 
 
#if defined(ATARI) || defined(atarist)
#if defined(ATARI) || defined(atarist)
#  define OS_CODE  0x05
#  define OS_CODE  0x05
#endif
#endif
 
 
#ifdef OS2
#ifdef OS2
#  define OS_CODE  0x06
#  define OS_CODE  0x06
#  ifdef M_I86
#  ifdef M_I86
     #include <malloc.h>
     #include <malloc.h>
#  endif
#  endif
#endif
#endif
 
 
#if defined(MACOS) || defined(TARGET_OS_MAC)
#if defined(MACOS) || defined(TARGET_OS_MAC)
#  define OS_CODE  0x07
#  define OS_CODE  0x07
#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
#    include <unix.h> /* for fdopen */
#    include <unix.h> /* for fdopen */
#  else
#  else
#    ifndef fdopen
#    ifndef fdopen
#      define fdopen(fd,mode) NULL /* No fdopen() */
#      define fdopen(fd,mode) NULL /* No fdopen() */
#    endif
#    endif
#  endif
#  endif
#endif
#endif
 
 
#ifdef TOPS20
#ifdef TOPS20
#  define OS_CODE  0x0a
#  define OS_CODE  0x0a
#endif
#endif
 
 
#ifdef WIN32
#ifdef WIN32
#  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */
#  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */
#    define OS_CODE  0x0b
#    define OS_CODE  0x0b
#  endif
#  endif
#endif
#endif
 
 
#ifdef __50SERIES /* Prime/PRIMOS */
#ifdef __50SERIES /* Prime/PRIMOS */
#  define OS_CODE  0x0f
#  define OS_CODE  0x0f
#endif
#endif
 
 
#if defined(_BEOS_) || defined(RISCOS)
#if defined(_BEOS_) || defined(RISCOS)
#  define fdopen(fd,mode) NULL /* No fdopen() */
#  define fdopen(fd,mode) NULL /* No fdopen() */
#endif
#endif
 
 
#if (defined(_MSC_VER) && (_MSC_VER > 600))
#if (defined(_MSC_VER) && (_MSC_VER > 600))
#  if defined(_WIN32_WCE)
#  if defined(_WIN32_WCE)
#    define fdopen(fd,mode) NULL /* No fdopen() */
#    define fdopen(fd,mode) NULL /* No fdopen() */
#    ifndef _PTRDIFF_T_DEFINED
#    ifndef _PTRDIFF_T_DEFINED
       typedef int ptrdiff_t;
       typedef int ptrdiff_t;
#      define _PTRDIFF_T_DEFINED
#      define _PTRDIFF_T_DEFINED
#    endif
#    endif
#  else
#  else
#    define fdopen(fd,type)  _fdopen(fd,type)
#    define fdopen(fd,type)  _fdopen(fd,type)
#  endif
#  endif
#endif
#endif
 
 
        /* common defaults */
        /* common defaults */
 
 
#ifndef OS_CODE
#ifndef OS_CODE
#  define OS_CODE  0x03  /* assume Unix */
#  define OS_CODE  0x03  /* assume Unix */
#endif
#endif
 
 
#ifndef F_OPEN
#ifndef F_OPEN
#  define F_OPEN(name, mode) fopen((name), (mode))
#  define F_OPEN(name, mode) fopen((name), (mode))
#endif
#endif
 
 
         /* functions */
         /* functions */
 
 
#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
#  ifndef HAVE_VSNPRINTF
#  ifndef HAVE_VSNPRINTF
#    define HAVE_VSNPRINTF
#    define HAVE_VSNPRINTF
#  endif
#  endif
#endif
#endif
#if defined(__CYGWIN__)
#if defined(__CYGWIN__)
#  ifndef HAVE_VSNPRINTF
#  ifndef HAVE_VSNPRINTF
#    define HAVE_VSNPRINTF
#    define HAVE_VSNPRINTF
#  endif
#  endif
#endif
#endif
#ifndef HAVE_VSNPRINTF
#ifndef HAVE_VSNPRINTF
#  ifdef MSDOS
#  ifdef MSDOS
     /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
     /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
        but for now we just assume it doesn't. */
        but for now we just assume it doesn't. */
#    define NO_vsnprintf
#    define NO_vsnprintf
#  endif
#  endif
#  ifdef __TURBOC__
#  ifdef __TURBOC__
#    define NO_vsnprintf
#    define NO_vsnprintf
#  endif
#  endif
#  ifdef WIN32
#  ifdef WIN32
     /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
     /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
#    if !defined(vsnprintf) && !defined(NO_vsnprintf)
#    if !defined(vsnprintf) && !defined(NO_vsnprintf)
#      define vsnprintf _vsnprintf
#      define vsnprintf _vsnprintf
#    endif
#    endif
#  endif
#  endif
#  ifdef __SASC
#  ifdef __SASC
#    define NO_vsnprintf
#    define NO_vsnprintf
#  endif
#  endif
#endif
#endif
#ifdef VMS
#ifdef VMS
#  define NO_vsnprintf
#  define NO_vsnprintf
#endif
#endif
 
 
#if defined(pyr)
#if defined(pyr)
#  define NO_MEMCPY
#  define NO_MEMCPY
#endif
#endif
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
 /* Use our own functions for small and medium model with MSC <= 5.0.
 /* Use our own functions for small and medium model with MSC <= 5.0.
  * You may have to use the same strategy for Borland C (untested).
  * You may have to use the same strategy for Borland C (untested).
  * The __SC__ check is for Symantec.
  * The __SC__ check is for Symantec.
  */
  */
#  define NO_MEMCPY
#  define NO_MEMCPY
#endif
#endif
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
#  define HAVE_MEMCPY
#  define HAVE_MEMCPY
#endif
#endif
#ifdef HAVE_MEMCPY
#ifdef HAVE_MEMCPY
#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
#    define zmemcpy _fmemcpy
#    define zmemcpy _fmemcpy
#    define zmemcmp _fmemcmp
#    define zmemcmp _fmemcmp
#    define zmemzero(dest, len) _fmemset(dest, 0, len)
#    define zmemzero(dest, len) _fmemset(dest, 0, len)
#  else
#  else
#    define zmemcpy memcpy
#    define zmemcpy memcpy
#    define zmemcmp memcmp
#    define zmemcmp memcmp
#    define zmemzero(dest, len) memset(dest, 0, len)
#    define zmemzero(dest, len) memset(dest, 0, len)
#  endif
#  endif
#else
#else
   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
   extern void zmemzero OF((Bytef* dest, uInt len));
   extern void zmemzero OF((Bytef* dest, uInt len));
#endif
#endif
 
 
/* Diagnostic functions */
/* Diagnostic functions */
#ifdef DEBUG
#ifdef DEBUG
#  include <stdio.h>
#  include <stdio.h>
   extern int z_verbose;
   extern int z_verbose;
   extern void z_error    OF((char *m));
   extern void z_error    OF((char *m));
#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
#else
#else
#  define Assert(cond,msg)
#  define Assert(cond,msg)
#  define Trace(x)
#  define Trace(x)
#  define Tracev(x)
#  define Tracev(x)
#  define Tracevv(x)
#  define Tracevv(x)
#  define Tracec(c,x)
#  define Tracec(c,x)
#  define Tracecv(c,x)
#  define Tracecv(c,x)
#endif
#endif
 
 
 
 
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
void   zcfree  OF((voidpf opaque, voidpf ptr));
void   zcfree  OF((voidpf opaque, voidpf ptr));
 
 
#define ZALLOC(strm, items, size) \
#define ZALLOC(strm, items, size) \
           (*((strm)->zalloc))((strm)->opaque, (items), (size))
           (*((strm)->zalloc))((strm)->opaque, (items), (size))
#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
 
 
#endif /* ZUTIL_H */
#endif /* ZUTIL_H */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.