Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 106 → Rev 107

/shark/trunk/config/libdep.mk
9,6 → 9,18
LINK_LIB =
LIB_DEP =
 
 
# Dependencies
# -------------------------------------------------------
 
# these are the libraries the use wants to use
USELIB = $(SHARKOPT)
 
ifeq ($(findstring __PNG__,$(SHARKOPT)) , __PNG__)
USELIB += __ZLIB__
endif
 
 
# --------------------------------------------------------------------------
# Library File names
ifndef GRAPH_DRV
15,24 → 27,19
GRAPH_DRV=grx
endif
 
# PXC
# PXC (Framegrabber)
# ----------------------------------------------------------------
ifeq ($(findstring __PXC__,$(USELIB)) , __PXC__)
 
INCL += -I$(BASE)/drivers/pxc/include
 
ifeq ($(LIB_PATH)/libhpxc.a,$(wildcard $(LIB_PATH)/libhpxc.a))
LINK_LIB += -lhpxc
LIB_DEP += $(LIB_PATH)/libhpxc.a
endif
 
# FFTR
ifeq ($(LIB_PATH)/libfftr.a,$(wildcard $(LIB_PATH)/libfftr.a))
LINK_LIB += -lfftr
LIB_DEP += $(LIB_PATH)/libfftr.a
endif
 
# FFTC
ifeq ($(LIB_PATH)/libfftc.a,$(wildcard $(LIB_PATH)/libfftc.a))
LINK_LIB += -lfftc
LIB_DEP += $(LIB_PATH)/libfftc.a
endif
 
# HPCI
ifeq ($(LIB_PATH)/libhpci.a,$(wildcard $(LIB_PATH)/libhpci.a))
LINK_LIB += -lhpci
53,12 → 60,19
endif
endif
 
# hdev
ifeq ($(LIB_PATH)/libhdev.a,$(wildcard $(LIB_PATH)/libhdev.a))
LINK_LIB += -lhdev
LIB_DEP += $(LIB_PATH)/libhdev.a
# oldchar
# ----------------------------------------------------------------
ifeq ($(findstring __OLDCHAR__,$(USELIB)) , __OLDCHAR__)
 
INCL += -I$(BASE)/drivers/oldchar/include
 
ifeq ($(LIB_PATH)/liboldch.a,$(wildcard $(LIB_PATH)/liboldch.a))
LINK_LIB += -loldch
LIB_DEP += $(LIB_PATH)/liboldch.a
endif
 
endif
 
# hsnd
ifeq ($(LIB_PATH)/libhsnd.a,$(wildcard $(LIB_PATH)/libhsnd.a))
LINK_LIB += -lhsnd
156,17 → 170,31
endif
 
# 6025e
# ----------------------------------------------------------------
ifeq ($(findstring __6025E__,$(USELIB)) , __6025E__)
 
INCL += -I$(BASE)/drivers/pci6025e/include
 
ifeq ($(LIB_PATH)/lib6025e.a,$(wildcard $(LIB_PATH)/lib6025e.a))
LINK_LIB += -l6025e
LIB_DEP += $(LIB_PATH)/lib6025e.a
endif
 
endif
 
# Parport
# ----------------------------------------------------------------
ifeq ($(findstring __PPORT__,$(USELIB)) , __PPORT__)
 
INCL += -I$(BASE)/drivers/parport/include
 
ifeq ($(LIB_PATH)/libpport.a,$(wildcard $(LIB_PATH)/libpport.a))
LINK_LIB += -lpport
LIB_DEP += $(LIB_PATH)/libpport.a
endif
 
endif
 
# SVGA
ifeq ($(LIB_PATH)/libsvga.a,$(wildcard $(LIB_PATH)/libsvga.a))
ifeq ($(GRAPH_DRV),svga)
175,7 → 203,46
endif
endif
 
# PCLAB
# ----------------------------------------------------------------
ifeq ($(findstring __PCLAB__,$(USELIB)) , __PCLAB__)
 
INCL += -I$(BASE)/drivers/pcl812/include
 
ifeq ($(LIB_PATH)/libpclab.a,$(wildcard $(LIB_PATH)/libpclab.a))
LINK_LIB += -lpclab
LIB_DEP += $(LIB_PATH)/libpclab.a
endif
 
endif
 
 
# Ports
 
# FFT
# ----------------------------------------------------------------
ifeq ($(findstring __FFT__,$(USELIB)) , __FFT__)
 
INCL += -I$(BASE)/ports/fftw/include
 
#FFTR
ifeq ($(LIB_PATH)/libfftr.a,$(wildcard $(LIB_PATH)/libfftr.a))
LINK_LIB += -lfftr
LIB_DEP += $(LIB_PATH)/libfftr.a
endif
# FFTC
ifeq ($(LIB_PATH)/libfftc.a,$(wildcard $(LIB_PATH)/libfftc.a))
LINK_LIB += -lfftc
LIB_DEP += $(LIB_PATH)/libfftc.a
endif
endif
 
# OSMESA
# ----------------------------------------------------------------
ifeq ($(findstring __OSMESA__,$(USELIB)) , __OSMESA__)
 
INCL += -I$(BASE)/ports/mesa/include
 
ifeq ($(LIB_PATH)/libosmesa.a,$(wildcard $(LIB_PATH)/libosmesa.a))
LINK_LIB += -losmesa
LIB_DEP += $(LIB_PATH)/libosmesa.a
193,15 → 260,32
LIB_DEP += $(LIB_PATH)/libglu.a
endif
 
# PCL812
ifeq ($(LIB_PATH)/libpcl812.a,$(wildcard $(LIB_PATH)/libpcl812.a))
LINK_LIB += -lpcl812
LIB_DEP += $(LIB_PATH)/libpcl812.a
endif
 
# PNG
# ----------------------------------------------------------------
ifeq ($(findstring __PNG__,$(USELIB)) , __PNG__)
 
INCL += -I$(BASE)/ports/png/include
 
# PNG
ifeq ($(LIB_PATH)/libpng.a,$(wildcard $(LIB_PATH)/libpng.a))
LINK_LIB += -lpng
LIB_DEP += $(LIB_PATH)/libpng.a
endif
 
endif
 
# ZLIB
# ----------------------------------------------------------------
ifeq ($(findstring __ZLIB__,$(USELIB)) , __ZLIB__)
 
INCL += -I$(BASE)/ports/zlib/include
 
# PNG
ifeq ($(LIB_PATH)/libzlib.a,$(wildcard $(LIB_PATH)/libzlib.a))
LINK_LIB += -lzlib
LIB_DEP += $(LIB_PATH)/libzlib.a
endif
 
endif
/shark/trunk/ports/zlib/inffast.h
0,0 → 1,17
/* inffast.h -- header to use inffast.c
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
 
extern int inflate_fast OF((
uInt,
uInt,
inflate_huft *,
inflate_huft *,
inflate_blocks_statef *,
z_streamp ));
/shark/trunk/ports/zlib/infcodes.h
0,0 → 1,27
/* infcodes.h -- header to use infcodes.c
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
 
struct inflate_codes_state;
typedef struct inflate_codes_state FAR inflate_codes_statef;
 
extern inflate_codes_statef *inflate_codes_new OF((
uInt, uInt,
inflate_huft *, inflate_huft *,
z_streamp ));
 
extern int inflate_codes OF((
inflate_blocks_statef *,
z_streamp ,
int));
 
extern void inflate_codes_free OF((
inflate_codes_statef *,
z_streamp ));
 
/shark/trunk/ports/zlib/inffixed.h
0,0 → 1,151
/* inffixed.h -- table for decoding fixed codes
* Generated automatically by the maketree.c program
*/
 
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
 
local uInt fixed_bl = 9;
local uInt fixed_bd = 5;
local inflate_huft fixed_tl[] = {
{{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
{{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192},
{{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160},
{{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224},
{{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144},
{{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208},
{{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176},
{{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240},
{{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
{{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200},
{{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168},
{{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232},
{{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152},
{{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216},
{{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184},
{{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248},
{{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
{{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196},
{{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164},
{{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228},
{{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148},
{{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212},
{{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180},
{{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244},
{{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
{{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204},
{{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172},
{{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236},
{{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156},
{{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220},
{{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188},
{{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252},
{{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
{{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194},
{{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162},
{{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226},
{{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146},
{{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210},
{{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178},
{{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242},
{{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
{{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202},
{{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170},
{{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234},
{{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154},
{{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218},
{{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186},
{{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250},
{{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
{{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198},
{{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166},
{{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230},
{{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150},
{{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214},
{{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182},
{{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246},
{{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
{{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206},
{{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174},
{{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238},
{{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158},
{{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222},
{{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190},
{{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254},
{{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
{{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193},
{{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161},
{{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225},
{{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145},
{{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209},
{{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177},
{{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241},
{{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
{{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201},
{{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169},
{{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233},
{{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153},
{{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217},
{{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185},
{{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249},
{{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
{{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197},
{{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165},
{{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229},
{{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149},
{{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213},
{{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181},
{{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245},
{{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
{{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205},
{{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173},
{{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237},
{{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157},
{{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221},
{{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189},
{{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253},
{{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
{{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195},
{{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163},
{{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227},
{{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147},
{{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211},
{{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179},
{{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243},
{{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
{{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203},
{{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171},
{{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235},
{{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155},
{{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219},
{{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187},
{{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251},
{{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
{{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199},
{{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167},
{{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231},
{{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151},
{{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215},
{{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183},
{{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247},
{{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
{{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207},
{{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175},
{{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239},
{{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159},
{{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223},
{{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191},
{{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255}
};
local inflate_huft fixed_td[] = {
{{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097},
{{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385},
{{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193},
{{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577},
{{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145},
{{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577},
{{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289},
{{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577}
};
/shark/trunk/ports/zlib/include/zconf.h
0,0 → 1,279
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* @(#) $Id: zconf.h,v 1.1 2003-03-24 11:13:45 pj Exp $ */
 
#ifndef _ZCONF_H
#define _ZCONF_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.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateReset z_inflateReset
# define compress z_compress
# define compress2 z_compress2
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
 
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
 
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#endif
#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
# ifndef __32BIT__
# define __32BIT__
# endif
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
 
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#if defined(MSDOS) && !defined(__32BIT__)
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
 
#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
# define STDC
#endif
#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
# ifndef STDC
# define STDC
# endif
#endif
 
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const
# endif
#endif
 
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
# define NO_DUMMY_DECL
#endif
 
/* Old Borland C incorrectly complains about missing returns: */
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
# define NEED_DUMMY_RETURN
#endif
 
 
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
 
/* 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.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
 
/* 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 */
 
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
 
/* 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 (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
#endif
#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
# ifndef __32BIT__
# define SMALL_MEDIUM
# define FAR _far
# endif
#endif
 
/* Compile with -DZLIB_DLL for Windows DLL support */
#if defined(ZLIB_DLL)
# if defined(_WINDOWS) || defined(WINDOWS)
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR _cdecl _export
# endif
# endif
# if defined (__BORLANDC__)
# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
# include <windows.h>
# define ZEXPORT __declspec(dllexport) WINAPI
# define ZEXPORTRVA __declspec(dllexport) WINAPIV
# else
# if defined (_Windows) && defined (__DLL__)
# define ZEXPORT _export
# define ZEXPORTVA _export
# endif
# endif
# endif
#endif
 
#if defined (__BEOS__)
# if defined (ZLIB_DLL)
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
#endif
 
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
 
#ifndef FAR
# define FAR
#endif
 
#if !defined(MACOS) && !defined(TARGET_OS_MAC)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
 
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
 
#ifdef STDC
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
 
#ifdef HAVE_UNISTD_H
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
 
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
# pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND")
# pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(inflate_blocks,"INBL")
# pragma map(inflate_blocks_new,"INBLNE")
# pragma map(inflate_blocks_free,"INBLFR")
# pragma map(inflate_blocks_reset,"INBLRE")
# pragma map(inflate_codes_free,"INCOFR")
# pragma map(inflate_codes,"INCO")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_flush,"INFLU")
# pragma map(inflate_mask,"INMA")
# pragma map(inflate_set_dictionary,"INSEDI2")
# pragma map(inflate_copyright,"INCOPY")
# pragma map(inflate_trees_bits,"INTRBI")
# pragma map(inflate_trees_dynamic,"INTRDY")
# pragma map(inflate_trees_fixed,"INTRFI")
# pragma map(inflate_trees_free,"INTRFR")
#endif
 
#endif /* _ZCONF_H */
/shark/trunk/ports/zlib/include/zlib.h
0,0 → 1,893
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.1.4, March 11th, 2002
 
Copyright (C) 1995-2002 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 ftp://ds.internic.net/rfc/rfc1950.txt
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
*/
 
#ifndef _ZLIB_H
#define _ZLIB_H
 
#include "zconf.h"
 
#ifdef __cplusplus
extern "C" {
#endif
 
#define ZLIB_VERSION "1.1.4"
 
/*
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 library also supports reading and writing files in gzip (.gz) format
with an interface similar to that of stdio.
 
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.
*/
 
typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
typedef void (*free_func) OF((voidpf opaque, voidpf address));
 
struct internal_state;
 
typedef struct z_stream_s {
Bytef *next_in; /* next input byte */
uInt avail_in; /* number of bytes available at next_in */
uLong total_in; /* total nb of input bytes read so far */
 
Bytef *next_out; /* next output byte should be put there */
uInt avail_out; /* remaining free space at next_out */
uLong total_out; /* total nb of bytes output so far */
 
char *msg; /* last error message, NULL if no error */
struct internal_state FAR *state; /* not visible by applications */
 
alloc_func zalloc; /* used to allocate the internal state */
free_func zfree; /* used to free the internal state */
voidpf opaque; /* private data object passed to zalloc and zfree */
 
int data_type; /* best guess about the data type: ascii or binary */
uLong adler; /* adler32 value of the uncompressed data */
uLong reserved; /* reserved for future use */
} z_stream;
 
typedef z_stream FAR *z_streamp;
 
/*
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 */
 
#define Z_NO_FLUSH 0
#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
#define Z_SYNC_FLUSH 2
#define Z_FULL_FLUSH 3
#define Z_FINISH 4
/* Allowed flush values; see deflate() below for details */
 
#define Z_OK 0
#define Z_STREAM_END 1
#define Z_NEED_DICT 2
#define Z_ERRNO (-1)
#define Z_STREAM_ERROR (-2)
#define Z_DATA_ERROR (-3)
#define Z_MEM_ERROR (-4)
#define Z_BUF_ERROR (-5)
#define Z_VERSION_ERROR (-6)
/* Return codes for the compression/decompression functions. Negative
* values are errors, positive values are used for special but normal events.
*/
 
#define Z_NO_COMPRESSION 0
#define Z_BEST_SPEED 1
#define Z_BEST_COMPRESSION 9
#define Z_DEFAULT_COMPRESSION (-1)
/* compression levels */
 
#define Z_FILTERED 1
#define Z_HUFFMAN_ONLY 2
#define Z_DEFAULT_STRATEGY 0
/* compression strategy; see deflateInit2() below for details */
 
#define Z_BINARY 0
#define Z_ASCII 1
#define Z_UNKNOWN 2
/* Possible values of the data_type field */
 
#define Z_DEFLATED 8
/* The deflate compression method (the only one supported in this version) */
 
#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
 
#define zlib_version zlibVersion()
/* for compatibility with versions < 1.0.2 */
 
/* basic functions */
 
ZEXTERN const char * ZEXPORT zlibVersion OF((void));
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
If the first character differs, the library code actually used is
not compatible with the zlib.h header file used by the application.
This check is automatically made by deflateInit and inflateInit.
*/
 
/*
ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
 
Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller.
If zalloc and zfree are set to Z_NULL, deflateInit updates them to
use default allocation functions.
 
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
1 gives best speed, 9 gives best compression, 0 gives no compression at
all (the input data is simply copied a block at a time).
Z_DEFAULT_COMPRESSION requests a default compromise between speed and
compression (currently equivalent to level 6).
 
deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if level is not a valid compression level,
Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
with the version assumed by the caller (ZLIB_VERSION).
msg is set to null if there is no error message. deflateInit does not
perform any compression: this will be done by deflate().
*/
 
 
ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
/*
deflate compresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce some
output latency (reading input without producing any output) except when
forced to flush.
 
The detailed semantics are as follows. deflate performs one or both of the
following actions:
 
- Compress more input starting at next_in and update next_in and avail_in
accordingly. If not all input can be processed (because there is not
enough room in the output buffer), next_in and avail_in are updated and
processing will resume at this point for the next call of deflate().
 
- Provide more output starting at next_out and update next_out and avail_out
accordingly. This action is forced if the parameter flush is non zero.
Forcing flush frequently degrades the compression ratio, so this parameter
should be set only when necessary (in interactive applications).
Some output may be provided even if flush is not set.
 
Before the call of deflate(), the application should ensure that at least
one of the actions is possible, by providing more input and/or consuming
more output, and updating avail_in or avail_out accordingly; avail_out
should never be zero before the call. The application can consume the
compressed output when it wants, for example when the output buffer is full
(avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
and with zero avail_out, it must be called again after making room in the
output buffer because there might be more output pending.
 
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
flushed to the output buffer and the output is aligned on a byte boundary, so
that the decompressor can get all input data available so far. (In particular
avail_in is zero after the call if enough output space has been provided
before the call.) Flushing may degrade compression for some compression
algorithms and so it should be used only when necessary.
 
If flush is set to Z_FULL_FLUSH, all output is flushed as with
Z_SYNC_FLUSH, and the compression state is reset so that decompression can
restart from this point if previous compressed data has been damaged or if
random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
the compression.
 
If deflate returns with avail_out == 0, this function must be called again
with the same value of the flush parameter and more output space (updated
avail_out), until the flush is complete (deflate returns with non-zero
avail_out).
 
If the parameter flush is set to Z_FINISH, pending input is processed,
pending output is flushed and deflate returns with Z_STREAM_END if there
was enough output space; if deflate returns with Z_OK, this function must be
called again with Z_FINISH and more output space (updated avail_out) but no
more input data, until it returns with Z_STREAM_END or an error. After
deflate has returned Z_STREAM_END, the only possible operations on the
stream are deflateReset or deflateEnd.
Z_FINISH can be used immediately after deflateInit if all the compression
is to be done in a single step. In this case, avail_out must be at least
0.1% larger than avail_in plus 12 bytes. If deflate does not return
Z_STREAM_END, then it must be called again as described above.
 
deflate() sets strm->adler to the adler32 checksum of all input read
so far (that is, total_in bytes).
 
deflate() may update data_type if it can make a good guess about
the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
binary. This field is only for information purposes and does not affect
the compression algorithm in any manner.
 
deflate() returns Z_OK if some progress has been made (more input
processed or more output produced), Z_STREAM_END if all input has been
consumed and all output has been produced (only when flush is set to
Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
(for example avail_in or avail_out was zero).
*/
 
 
ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any
pending output.
 
deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
stream state was inconsistent, Z_DATA_ERROR if the stream was freed
prematurely (some input or output was discarded). In the error case,
msg may be set but then points to a static string (which must not be
deallocated).
*/
 
 
/*
ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
 
Initializes the internal stream state for decompression. The fields
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
value depends on the compression method), inflateInit determines the
compression method from the zlib header and allocates all data structures
accordingly; otherwise the allocation will be deferred to the first call of
inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
use default allocation functions.
 
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
version assumed by the caller. msg is set to null if there is no error
message. inflateInit does not perform any decompression apart from reading
the zlib header if present: this will be done by inflate(). (So next_in and
avail_in may be modified, but next_out and avail_out are unchanged.)
*/
 
 
ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
/*
inflate decompresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may some
introduce some output latency (reading input without producing any output)
except when forced to flush.
 
The detailed semantics are as follows. inflate performs one or both of the
following actions:
 
- Decompress more input starting at next_in and update next_in and avail_in
accordingly. If not all input can be processed (because there is not
enough room in the output buffer), next_in is updated and processing
will resume at this point for the next call of inflate().
 
- Provide more output starting at next_out and update next_out and avail_out
accordingly. inflate() provides as much output as possible, until there
is no more input data or no more space in the output buffer (see below
about the flush parameter).
 
Before the call of inflate(), the application should ensure that at least
one of the actions is possible, by providing more input and/or consuming
more output, and updating the next_* and avail_* values accordingly.
The application can consume the uncompressed output when it wants, for
example when the output buffer is full (avail_out == 0), or after each
call of inflate(). If inflate returns Z_OK and with zero avail_out, it
must be called again after making room in the output buffer because there
might be more output pending.
 
If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
output as possible to the output buffer. The flushing behavior of inflate is
not specified for values of the flush parameter other than Z_SYNC_FLUSH
and Z_FINISH, but the current implementation actually flushes as much output
as possible anyway.
 
inflate() should normally be called until it returns Z_STREAM_END or an
error. However if all decompression is to be performed in a single step
(a single call of inflate), the parameter flush should be set to
Z_FINISH. In this case all pending input is processed and all pending
output is flushed; avail_out must be large enough to hold all the
uncompressed data. (The size of the uncompressed data may have been saved
by the compressor for this purpose.) The next operation on this stream must
be inflateEnd to deallocate the decompression state. The use of Z_FINISH
is never required, but can be used to inform inflate that a faster routine
may be used for the single inflate() call.
 
If a preset dictionary is needed at this point (see inflateSetDictionary
below), inflate sets strm-adler to the adler32 checksum of the
dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
it sets strm->adler to the adler32 checksum of all output produced
so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
an error code as described below. At the end of the stream, inflate()
checks that its computed adler32 checksum is equal to that saved by the
compressor and returns Z_STREAM_END only if the checksum is correct.
 
inflate() returns Z_OK if some progress has been made (more input processed
or more output produced), Z_STREAM_END if the end of the compressed data has
been reached and all uncompressed output has been produced, Z_NEED_DICT if a
preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
corrupted (input stream not conforming to the zlib format or incorrect
adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
(for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if no progress is possible or if there was not
enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
case, the application may then call inflateSync to look for a good
compression block.
*/
 
 
ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any
pending output.
 
inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
was inconsistent. In the error case, msg may be set but then points to a
static string (which must not be deallocated).
*/
 
/* Advanced functions */
 
/*
The following functions are needed only in some special applications.
*/
 
/*
ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
int level,
int method,
int windowBits,
int memLevel,
int strategy));
 
This is another version of deflateInit with more compression options. The
fields next_in, zalloc, zfree and opaque must be initialized before by
the caller.
 
The method parameter is the compression method. It must be Z_DEFLATED in
this version of the library.
 
The windowBits parameter is the base two logarithm of the window size
(the size of the history buffer). It should be in the range 8..15 for this
version of the library. Larger values of this parameter result in better
compression at the expense of memory usage. The default value is 15 if
deflateInit is used instead.
 
The memLevel parameter specifies how much memory should be allocated
for the internal compression state. memLevel=1 uses minimum memory but
is slow and reduces compression ratio; memLevel=9 uses maximum memory
for optimal speed. The default value is 8. See zconf.h for total memory
usage as a function of windowBits and memLevel.
 
The strategy parameter is used to tune the compression algorithm. Use the
value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
string match). Filtered data consists mostly of small values with a
somewhat random distribution. In this case, the compression algorithm is
tuned to compress them better. The effect of Z_FILTERED is to force more
Huffman coding and less string matching; it is somewhat intermediate
between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
the compression ratio but not the correctness of the compressed output even
if it is not set appropriately.
 
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
method). msg is set to null if there is no error message. deflateInit2 does
not perform any compression: this will be done by deflate().
*/
ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
const Bytef *dictionary,
uInt dictLength));
/*
Initializes the compression dictionary from the given byte sequence
without producing any compressed output. This function must be called
immediately after deflateInit, deflateInit2 or deflateReset, before any
call of deflate. The compressor and decompressor must use exactly the same
dictionary (see inflateSetDictionary).
 
The dictionary should consist of strings (byte sequences) that are likely
to be encountered later in the data to be compressed, with the most commonly
used strings preferably put towards the end of the dictionary. Using a
dictionary is most useful when the data to be compressed is short and can be
predicted with good accuracy; the data can then be compressed better than
with the default empty dictionary.
 
Depending on the size of the compression data structures selected by
deflateInit or deflateInit2, a part of the dictionary may in effect be
discarded, for example if the dictionary is larger than the window size in
deflate or deflate2. Thus the strings most likely to be useful should be
put at the end of the dictionary, not at the front.
 
Upon return of this function, strm->adler is set to the Adler32 value
of the dictionary; the decompressor may later use this value to determine
which dictionary has been used by the compressor. (The Adler32 value
applies to the whole dictionary even if only a subset of the dictionary is
actually used by the compressor.)
 
deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
parameter is invalid (such as NULL dictionary) or the stream state is
inconsistent (for example if deflate has already been called for this stream
or if the compression method is bsort). deflateSetDictionary does not
perform any compression: this will be done by deflate().
*/
 
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
z_streamp source));
/*
Sets the destination stream as a complete copy of the source stream.
 
This function can be useful when several compression strategies will be
tried, for example when there are several ways of pre-processing the input
data with a filter. The streams that will be discarded should then be freed
by calling deflateEnd. Note that deflateCopy duplicates the internal
compression state which can be quite large, so this strategy is slow and
can consume lots of memory.
 
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
(such as zalloc being NULL). msg is left unchanged in both source and
destination.
*/
 
ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
/*
This function is equivalent to deflateEnd followed by deflateInit,
but does not free and reallocate all the internal compression state.
The stream will keep the same compression level and any other attributes
that may have been set by deflateInit2.
 
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being NULL).
*/
 
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
int level,
int strategy));
/*
Dynamically update the compression level and compression strategy. The
interpretation of level and strategy is as in deflateInit2. This can be
used to switch between compression and straight copy of the input data, or
to switch to a different kind of input data requiring a different
strategy. If the compression level is changed, the input available so far
is compressed with the old level (and may be flushed); the new level will
take effect only at the next call of deflate().
 
Before the call of deflateParams, the stream state must be set as for
a call of deflate(), since the currently available input may have to
be compressed and flushed. In particular, strm->avail_out must be non-zero.
 
deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
if strm->avail_out was zero.
*/
 
/*
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
int windowBits));
 
This is another version of inflateInit with an extra parameter. The
fields next_in, avail_in, zalloc, zfree and opaque must be initialized
before by the caller.
 
The windowBits parameter is the base two logarithm of the maximum window
size (the size of the history buffer). It should be in the range 8..15 for
this version of the library. The default value is 15 if inflateInit is used
instead. If a compressed stream with a larger window size is given as
input, inflate() will return with the error code Z_DATA_ERROR instead of
trying to allocate a larger window.
 
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
memLevel). msg is set to null if there is no error message. inflateInit2
does not perform any decompression apart from reading the zlib header if
present: this will be done by inflate(). (So next_in and avail_in may be
modified, but next_out and avail_out are unchanged.)
*/
 
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
const Bytef *dictionary,
uInt dictLength));
/*
Initializes the decompression dictionary from the given uncompressed byte
sequence. This function must be called immediately after a call of inflate
if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
can be determined from the Adler32 value returned by this call of
inflate. The compressor and decompressor must use exactly the same
dictionary (see deflateSetDictionary).
 
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
parameter is invalid (such as NULL dictionary) or the stream state is
inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
expected one (incorrect Adler32 value). inflateSetDictionary does not
perform any decompression: this will be done by subsequent calls of
inflate().
*/
 
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
/*
Skips invalid compressed data until a full flush point (see above the
description of deflate with Z_FULL_FLUSH) can be found, or until all
available input is skipped. No output is provided.
 
inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
if no more input was provided, Z_DATA_ERROR if no flush point has been found,
or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
case, the application may save the current current value of total_in which
indicates where valid compressed data was found. In the error case, the
application may repeatedly call inflateSync, providing more input each time,
until success or end of the input data.
*/
 
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
/*
This function is equivalent to inflateEnd followed by inflateInit,
but does not free and reallocate all the internal decompression state.
The stream will keep attributes that may have been set by inflateInit2.
 
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being NULL).
*/
 
 
/* utility functions */
 
/*
The following utility functions are implemented on top of the
basic stream-oriented functions. To simplify the interface, some
default options are assumed (compression level and memory usage,
standard memory allocation functions). The source code of these
utility functions can easily be modified if you need special options.
*/
 
ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen));
/*
Compresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be at least 0.1% larger than
sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
compressed buffer.
This function can be used to compress a whole file at once if the
input file is mmap'ed.
compress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer.
*/
 
ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen,
int level));
/*
Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte
length of the source buffer. Upon entry, destLen is the total size of the
destination buffer, which must be at least 0.1% larger than sourceLen plus
12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
 
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
 
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen));
/*
Decompresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be large enough to hold the
entire uncompressed data. (The size of the uncompressed data must have
been saved previously by the compressor and transmitted to the decompressor
by some mechanism outside the scope of this compression library.)
Upon exit, destLen is the actual size of the compressed buffer.
This function can be used to decompress a whole file at once if the
input file is mmap'ed.
 
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer, or Z_DATA_ERROR if the input data was corrupted.
*/
 
 
typedef voidp gzFile;
 
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
/*
Opens a gzip (.gz) file for reading or writing. The mode parameter
is as in fopen ("rb" or "wb") but can also include a compression level
("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
Huffman only compression as in "wb1h". (See the description
of deflateInit2 for more information about the strategy parameter.)
 
gzopen can be used to read a file which is not in gzip format; in this
case gzread will directly read from the file without decompression.
 
gzopen returns NULL if the file could not be opened or if there was
insufficient memory to allocate the (de)compression state; errno
can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR). */
 
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
/*
gzdopen() associates a gzFile with the file descriptor fd. File
descriptors are obtained from calls like open, dup, creat, pipe or
fileno (in the file has been previously opened with fopen).
The mode parameter is as in gzopen.
The next call of gzclose on the returned gzFile will also close the
file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
gzdopen returns NULL if there was insufficient memory to allocate
the (de)compression state.
*/
 
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
/*
Dynamically update the compression level or strategy. See the description
of deflateInit2 for the meaning of these parameters.
gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
opened for writing.
*/
 
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
/*
Reads the given number of uncompressed bytes from the compressed file.
If the input file was not in gzip format, gzread copies the given number
of bytes into the buffer.
gzread returns the number of uncompressed bytes actually read (0 for
end of file, -1 for error). */
 
ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
const voidp buf, unsigned len));
/*
Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of uncompressed bytes actually written
(0 in case of error).
*/
 
ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
/*
Converts, formats, and writes the args to the compressed file under
control of the format string, as in fprintf. gzprintf returns the number of
uncompressed bytes actually written (0 in case of error).
*/
 
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
/*
Writes the given null-terminated string to the compressed file, excluding
the terminating null character.
gzputs returns the number of characters written, or -1 in case of error.
*/
 
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
/*
Reads bytes from the compressed file until len-1 characters are read, or
a newline character is read and transferred to buf, or an end-of-file
condition is encountered. The string is then terminated with a null
character.
gzgets returns buf, or Z_NULL in case of error.
*/
 
ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
/*
Writes c, converted to an unsigned char, into the compressed file.
gzputc returns the value that was written, or -1 in case of error.
*/
 
ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
/*
Reads one byte from the compressed file. gzgetc returns this byte
or -1 in case of end of file or error.
*/
 
ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
/*
Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function. The return value is the zlib
error number (see function gzerror below). gzflush returns Z_OK if
the flush parameter is Z_FINISH and all output could be flushed.
gzflush should be called only when strictly necessary because it can
degrade compression.
*/
 
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
z_off_t offset, int whence));
/*
Sets the starting position for the next gzread or gzwrite on the
given compressed file. The offset represents a number of bytes in the
uncompressed data stream. The whence parameter is defined as in lseek(2);
the value SEEK_END is not supported.
If the file is opened for reading, this function is emulated but can be
extremely slow. If the file is opened for writing, only forward seeks are
supported; gzseek then compresses a sequence of zeroes up to the new
starting position.
 
gzseek returns the resulting offset location as measured in bytes from
the beginning of the uncompressed stream, or -1 in case of error, in
particular if the file is opened for writing and the new starting position
would be before the current position.
*/
 
ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
/*
Rewinds the given file. This function is supported only for reading.
 
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
*/
 
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
/*
Returns the starting position for the next gzread or gzwrite on the
given compressed file. This position represents a number of bytes in the
uncompressed data stream.
 
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
*/
 
ZEXTERN int ZEXPORT gzeof OF((gzFile file));
/*
Returns 1 when EOF has previously been detected reading the given
input stream, otherwise zero.
*/
 
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
/*
Flushes all pending output if necessary, closes the compressed file
and deallocates all the (de)compression state. The return value is the zlib
error number (see function gzerror below).
*/
 
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
/*
Returns the error message for the last error which occurred on the
given compressed file. errnum is set to zlib error number. If an
error occurred in the file system and not in the compression library,
errnum is set to Z_ERRNO and the application may consult errno
to get the exact error code.
*/
 
/* checksum functions */
 
/*
These functions are not related to compression but are exported
anyway because they might be useful in applications using the
compression library.
*/
 
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
 
/*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
return the updated checksum. If buf is NULL, this function returns
the required initial value for the checksum.
An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
much faster. Usage example:
 
uLong adler = adler32(0L, Z_NULL, 0);
 
while (read_buffer(buffer, length) != EOF) {
adler = adler32(adler, buffer, length);
}
if (adler != original_adler) error();
*/
 
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
/*
Update a running crc with the bytes buf[0..len-1] and return the updated
crc. If buf is NULL, this function returns the required initial value
for the crc. Pre- and post-conditioning (one's complement) is performed
within this function so it shouldn't be done by the application.
Usage example:
 
uLong crc = crc32(0L, Z_NULL, 0);
 
while (read_buffer(buffer, length) != EOF) {
crc = crc32(crc, buffer, length);
}
if (crc != original_crc) error();
*/
 
 
/* various hacks, don't look :) */
 
/* deflateInit and inflateInit are macros to allow checking the zlib version
* and the compiler's view of z_stream:
*/
ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
const char *version, int stream_size));
ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
const char *version, int stream_size));
ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
int windowBits, int memLevel,
int strategy, const char *version,
int stream_size));
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
const char *version, int stream_size));
#define deflateInit(strm, level) \
deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
#define inflateInit(strm) \
inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
(strategy), ZLIB_VERSION, sizeof(z_stream))
#define inflateInit2(strm, windowBits) \
inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
 
 
#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
struct internal_state {int dummy;}; /* hack for buggy compilers */
#endif
 
ZEXTERN const char * ZEXPORT zError OF((int err));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
 
#ifdef __cplusplus
}
#endif
 
#endif /* _ZLIB_H */
/shark/trunk/ports/zlib/deflate.c
0,0 → 1,1350
/* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/*
* ALGORITHM
*
* The "deflation" process depends on being able to identify portions
* of the input text which are identical to earlier input (within a
* sliding window trailing behind the input currently being processed).
*
* The most straightforward technique turns out to be the fastest for
* most input files: try all possible matches and select the longest.
* The key feature of this algorithm is that insertions into the string
* dictionary are very simple and thus fast, and deletions are avoided
* completely. Insertions are performed at each input character, whereas
* string matches are performed only when the previous match ends. So it
* is preferable to spend more time in matches to allow very fast string
* insertions and avoid deletions. The matching algorithm for small
* strings is inspired from that of Rabin & Karp. A brute force approach
* is used to find longer strings when a small match has been found.
* A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
* (by Leonid Broukhis).
* A previous version of this file used a more sophisticated algorithm
* (by Fiala and Greene) which is guaranteed to run in linear amortized
* time, but has a larger average cost, uses more memory and is patented.
* However the F&G algorithm may be faster for some highly redundant
* files if the parameter max_chain_length (described below) is too large.
*
* ACKNOWLEDGEMENTS
*
* The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
* I found it in 'freeze' written by Leonid Broukhis.
* Thanks to many people for bug reports and testing.
*
* REFERENCES
*
* Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
* Available in ftp://ds.internic.net/rfc/rfc1951.txt
*
* A description of the Rabin and Karp algorithm is given in the book
* "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
*
* Fiala,E.R., and Greene,D.H.
* Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
*
*/
 
/* @(#) $Id: deflate.c,v 1.1 2003-03-24 11:13:44 pj Exp $ */
 
#include "deflate.h"
 
const char deflate_copyright[] =
" deflate 1.1.4 Copyright 1995-2002 Jean-loup Gailly ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
include such an acknowledgment, I would appreciate that you keep this
copyright string in the executable of your product.
*/
 
/* ===========================================================================
* Function prototypes.
*/
typedef enum {
need_more, /* block not completed, need more input or more output */
block_done, /* block flush performed */
finish_started, /* finish started, need only more output at next deflate */
finish_done /* finish done, accept no more input or output */
} block_state;
 
typedef block_state (*compress_func) OF((deflate_state *s, int flush));
/* Compression function. Returns the block state after the call. */
 
local void fill_window OF((deflate_state *s));
local block_state deflate_stored OF((deflate_state *s, int flush));
local block_state deflate_fast OF((deflate_state *s, int flush));
local block_state deflate_slow OF((deflate_state *s, int flush));
local void lm_init OF((deflate_state *s));
local void putShortMSB OF((deflate_state *s, uInt b));
local void flush_pending OF((z_streamp strm));
local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
#ifdef ASMV
void match_init OF((void)); /* asm code initialization */
uInt longest_match OF((deflate_state *s, IPos cur_match));
#else
local uInt longest_match OF((deflate_state *s, IPos cur_match));
#endif
 
#ifdef DEBUG
local void check_match OF((deflate_state *s, IPos start, IPos match,
int length));
#endif
 
/* ===========================================================================
* Local data
*/
 
#define NIL 0
/* Tail of hash chains */
 
#ifndef TOO_FAR
# define TOO_FAR 4096
#endif
/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
 
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
/* Minimum amount of lookahead, except at the end of the input file.
* See deflate.c for comments about the MIN_MATCH+1.
*/
 
/* Values for max_lazy_match, good_match and max_chain_length, depending on
* the desired pack level (0..9). The values given below have been tuned to
* exclude worst case performance for pathological files. Better values may be
* found for specific files.
*/
typedef struct config_s {
ush good_length; /* reduce lazy search above this match length */
ush max_lazy; /* do not perform lazy search above this match length */
ush nice_length; /* quit search above this match length */
ush max_chain;
compress_func func;
} config;
 
local const config configuration_table[10] = {
/* good lazy nice chain */
/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
/* 1 */ {4, 4, 8, 4, deflate_fast}, /* maximum speed, no lazy matches */
/* 2 */ {4, 5, 16, 8, deflate_fast},
/* 3 */ {4, 6, 32, 32, deflate_fast},
 
/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */
/* 5 */ {8, 16, 32, 32, deflate_slow},
/* 6 */ {8, 16, 128, 128, deflate_slow},
/* 7 */ {8, 32, 128, 256, deflate_slow},
/* 8 */ {32, 128, 258, 1024, deflate_slow},
/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */
 
/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
* For deflate_fast() (levels <= 3) good is ignored and lazy has a different
* meaning.
*/
 
#define EQUAL 0
/* result of memcmp for equal strings */
 
struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
 
/* ===========================================================================
* Update a hash value with the given input byte
* IN assertion: all calls to to UPDATE_HASH are made with consecutive
* input characters, so that a running hash key can be computed from the
* previous key instead of complete recalculation each time.
*/
#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
 
 
/* ===========================================================================
* Insert string str in the dictionary and set match_head to the previous head
* of the hash chain (the most recent string with same hash key). Return
* the previous length of the hash chain.
* If this file is compiled with -DFASTEST, the compression level is forced
* to 1, and no hash chains are maintained.
* IN assertion: all calls to to INSERT_STRING are made with consecutive
* input characters and the first MIN_MATCH bytes of str are valid
* (except for the last MIN_MATCH-1 bytes of the input file).
*/
#ifdef FASTEST
#define INSERT_STRING(s, str, match_head) \
(UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
match_head = s->head[s->ins_h], \
s->head[s->ins_h] = (Pos)(str))
#else
#define INSERT_STRING(s, str, match_head) \
(UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \
s->head[s->ins_h] = (Pos)(str))
#endif
 
/* ===========================================================================
* Initialize the hash table (avoiding 64K overflow for 16 bit systems).
* prev[] will be initialized on the fly.
*/
#define CLEAR_HASH(s) \
s->head[s->hash_size-1] = NIL; \
zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
 
/* ========================================================================= */
int ZEXPORT deflateInit_(strm, level, version, stream_size)
z_streamp strm;
int level;
const char *version;
int stream_size;
{
return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
Z_DEFAULT_STRATEGY, version, stream_size);
/* To do: ignore strm->next_in if we use it as window */
}
 
/* ========================================================================= */
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
version, stream_size)
z_streamp strm;
int level;
int method;
int windowBits;
int memLevel;
int strategy;
const char *version;
int stream_size;
{
deflate_state *s;
int noheader = 0;
static const char* my_version = ZLIB_VERSION;
 
ushf *overlay;
/* We overlay pending_buf and d_buf+l_buf. This works since the average
* output size for (length,distance) codes is <= 24 bits.
*/
 
if (version == Z_NULL || version[0] != my_version[0] ||
stream_size != sizeof(z_stream)) {
return Z_VERSION_ERROR;
}
if (strm == Z_NULL) return Z_STREAM_ERROR;
 
strm->msg = Z_NULL;
if (strm->zalloc == Z_NULL) {
strm->zalloc = zcalloc;
strm->opaque = (voidpf)0;
}
if (strm->zfree == Z_NULL) strm->zfree = zcfree;
 
if (level == Z_DEFAULT_COMPRESSION) level = 6;
#ifdef FASTEST
level = 1;
#endif
 
if (windowBits < 0) { /* undocumented feature: suppress zlib header */
noheader = 1;
windowBits = -windowBits;
}
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
windowBits < 9 || windowBits > 15 || level < 0 || level > 9 ||
strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
return Z_STREAM_ERROR;
}
s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
if (s == Z_NULL) return Z_MEM_ERROR;
strm->state = (struct internal_state FAR *)s;
s->strm = strm;
 
s->noheader = noheader;
s->w_bits = windowBits;
s->w_size = 1 << s->w_bits;
s->w_mask = s->w_size - 1;
 
s->hash_bits = memLevel + 7;
s->hash_size = 1 << s->hash_bits;
s->hash_mask = s->hash_size - 1;
s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
 
s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
 
s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
 
overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
s->pending_buf = (uchf *) overlay;
s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
 
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
s->pending_buf == Z_NULL) {
strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
deflateEnd (strm);
return Z_MEM_ERROR;
}
s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
 
s->level = level;
s->strategy = strategy;
s->method = (Byte)method;
 
return deflateReset(strm);
}
 
/* ========================================================================= */
int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
z_streamp strm;
const Bytef *dictionary;
uInt dictLength;
{
deflate_state *s;
uInt length = dictLength;
uInt n;
IPos hash_head = 0;
 
if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
strm->state->status != INIT_STATE) return Z_STREAM_ERROR;
 
s = strm->state;
strm->adler = adler32(strm->adler, dictionary, dictLength);
 
if (length < MIN_MATCH) return Z_OK;
if (length > MAX_DIST(s)) {
length = MAX_DIST(s);
#ifndef USE_DICT_HEAD
dictionary += dictLength - length; /* use the tail of the dictionary */
#endif
}
zmemcpy(s->window, dictionary, length);
s->strstart = length;
s->block_start = (long)length;
 
/* Insert all strings in the hash table (except for the last two bytes).
* s->lookahead stays null, so s->ins_h will be recomputed at the next
* call of fill_window.
*/
s->ins_h = s->window[0];
UPDATE_HASH(s, s->ins_h, s->window[1]);
for (n = 0; n <= length - MIN_MATCH; n++) {
INSERT_STRING(s, n, hash_head);
}
if (hash_head) hash_head = 0; /* to make compiler happy */
return Z_OK;
}
 
/* ========================================================================= */
int ZEXPORT deflateReset (strm)
z_streamp strm;
{
deflate_state *s;
if (strm == Z_NULL || strm->state == Z_NULL ||
strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR;
 
strm->total_in = strm->total_out = 0;
strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
strm->data_type = Z_UNKNOWN;
 
s = (deflate_state *)strm->state;
s->pending = 0;
s->pending_out = s->pending_buf;
 
if (s->noheader < 0) {
s->noheader = 0; /* was set to -1 by deflate(..., Z_FINISH); */
}
s->status = s->noheader ? BUSY_STATE : INIT_STATE;
strm->adler = 1;
s->last_flush = Z_NO_FLUSH;
 
_tr_init(s);
lm_init(s);
 
return Z_OK;
}
 
/* ========================================================================= */
int ZEXPORT deflateParams(strm, level, strategy)
z_streamp strm;
int level;
int strategy;
{
deflate_state *s;
compress_func func;
int err = Z_OK;
 
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
s = strm->state;
 
if (level == Z_DEFAULT_COMPRESSION) {
level = 6;
}
if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
return Z_STREAM_ERROR;
}
func = configuration_table[s->level].func;
 
if (func != configuration_table[level].func && strm->total_in != 0) {
/* Flush the last buffer: */
err = deflate(strm, Z_PARTIAL_FLUSH);
}
if (s->level != level) {
s->level = level;
s->max_lazy_match = configuration_table[level].max_lazy;
s->good_match = configuration_table[level].good_length;
s->nice_match = configuration_table[level].nice_length;
s->max_chain_length = configuration_table[level].max_chain;
}
s->strategy = strategy;
return err;
}
 
/* =========================================================================
* Put a short in the pending buffer. The 16-bit value is put in MSB order.
* IN assertion: the stream state is correct and there is enough room in
* pending_buf.
*/
local void putShortMSB (s, b)
deflate_state *s;
uInt b;
{
put_byte(s, (Byte)(b >> 8));
put_byte(s, (Byte)(b & 0xff));
}
 
/* =========================================================================
* Flush as much pending output as possible. All deflate() output goes
* through this function so some applications may wish to modify it
* to avoid allocating a large strm->next_out buffer and copying into it.
* (See also read_buf()).
*/
local void flush_pending(strm)
z_streamp strm;
{
unsigned len = strm->state->pending;
 
if (len > strm->avail_out) len = strm->avail_out;
if (len == 0) return;
 
zmemcpy(strm->next_out, strm->state->pending_out, len);
strm->next_out += len;
strm->state->pending_out += len;
strm->total_out += len;
strm->avail_out -= len;
strm->state->pending -= len;
if (strm->state->pending == 0) {
strm->state->pending_out = strm->state->pending_buf;
}
}
 
/* ========================================================================= */
int ZEXPORT deflate (strm, flush)
z_streamp strm;
int flush;
{
int old_flush; /* value of flush param for previous deflate call */
deflate_state *s;
 
if (strm == Z_NULL || strm->state == Z_NULL ||
flush > Z_FINISH || flush < 0) {
return Z_STREAM_ERROR;
}
s = strm->state;
 
if (strm->next_out == Z_NULL ||
(strm->next_in == Z_NULL && strm->avail_in != 0) ||
(s->status == FINISH_STATE && flush != Z_FINISH)) {
ERR_RETURN(strm, Z_STREAM_ERROR);
}
if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
 
s->strm = strm; /* just in case */
old_flush = s->last_flush;
s->last_flush = flush;
 
/* Write the zlib header */
if (s->status == INIT_STATE) {
 
uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
uInt level_flags = (s->level-1) >> 1;
 
if (level_flags > 3) level_flags = 3;
header |= (level_flags << 6);
if (s->strstart != 0) header |= PRESET_DICT;
header += 31 - (header % 31);
 
s->status = BUSY_STATE;
putShortMSB(s, header);
 
/* Save the adler32 of the preset dictionary: */
if (s->strstart != 0) {
putShortMSB(s, (uInt)(strm->adler >> 16));
putShortMSB(s, (uInt)(strm->adler & 0xffff));
}
strm->adler = 1L;
}
 
/* Flush as much pending output as possible */
if (s->pending != 0) {
flush_pending(strm);
if (strm->avail_out == 0) {
/* Since avail_out is 0, deflate will be called again with
* more output space, but possibly with both pending and
* avail_in equal to zero. There won't be anything to do,
* but this is not an error situation so make sure we
* return OK instead of BUF_ERROR at next call of deflate:
*/
s->last_flush = -1;
return Z_OK;
}
 
/* Make sure there is something to do and avoid duplicate consecutive
* flushes. For repeated and useless calls with Z_FINISH, we keep
* returning Z_STREAM_END instead of Z_BUFF_ERROR.
*/
} else if (strm->avail_in == 0 && flush <= old_flush &&
flush != Z_FINISH) {
ERR_RETURN(strm, Z_BUF_ERROR);
}
 
/* User must not provide more input after the first FINISH: */
if (s->status == FINISH_STATE && strm->avail_in != 0) {
ERR_RETURN(strm, Z_BUF_ERROR);
}
 
/* Start a new block or continue the current one.
*/
if (strm->avail_in != 0 || s->lookahead != 0 ||
(flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
block_state bstate;
 
bstate = (*(configuration_table[s->level].func))(s, flush);
 
if (bstate == finish_started || bstate == finish_done) {
s->status = FINISH_STATE;
}
if (bstate == need_more || bstate == finish_started) {
if (strm->avail_out == 0) {
s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
}
return Z_OK;
/* If flush != Z_NO_FLUSH && avail_out == 0, the next call
* of deflate should use the same flush parameter to make sure
* that the flush is complete. So we don't have to output an
* empty block here, this will be done at next call. This also
* ensures that for a very small output buffer, we emit at most
* one empty block.
*/
}
if (bstate == block_done) {
if (flush == Z_PARTIAL_FLUSH) {
_tr_align(s);
} else { /* FULL_FLUSH or SYNC_FLUSH */
_tr_stored_block(s, (char*)0, 0L, 0);
/* For a full flush, this empty block will be recognized
* as a special marker by inflate_sync().
*/
if (flush == Z_FULL_FLUSH) {
CLEAR_HASH(s); /* forget history */
}
}
flush_pending(strm);
if (strm->avail_out == 0) {
s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
return Z_OK;
}
}
}
Assert(strm->avail_out > 0, "bug2");
 
if (flush != Z_FINISH) return Z_OK;
if (s->noheader) return Z_STREAM_END;
 
/* Write the zlib trailer (adler32) */
putShortMSB(s, (uInt)(strm->adler >> 16));
putShortMSB(s, (uInt)(strm->adler & 0xffff));
flush_pending(strm);
/* If avail_out is zero, the application will call deflate again
* to flush the rest.
*/
s->noheader = -1; /* write the trailer only once! */
return s->pending != 0 ? Z_OK : Z_STREAM_END;
}
 
/* ========================================================================= */
int ZEXPORT deflateEnd (strm)
z_streamp strm;
{
int status;
 
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 
status = strm->state->status;
if (status != INIT_STATE && status != BUSY_STATE &&
status != FINISH_STATE) {
return Z_STREAM_ERROR;
}
 
/* Deallocate in reverse order of allocations: */
TRY_FREE(strm, strm->state->pending_buf);
TRY_FREE(strm, strm->state->head);
TRY_FREE(strm, strm->state->prev);
TRY_FREE(strm, strm->state->window);
 
ZFREE(strm, strm->state);
strm->state = Z_NULL;
 
return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
}
 
/* =========================================================================
* Copy the source state to the destination state.
* To simplify the source, this is not supported for 16-bit MSDOS (which
* doesn't have enough memory anyway to duplicate compression states).
*/
int ZEXPORT deflateCopy (dest, source)
z_streamp dest;
z_streamp source;
{
#ifdef MAXSEG_64K
return Z_STREAM_ERROR;
#else
deflate_state *ds;
deflate_state *ss;
ushf *overlay;
 
 
if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
return Z_STREAM_ERROR;
}
 
ss = source->state;
 
*dest = *source;
 
ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
if (ds == Z_NULL) return Z_MEM_ERROR;
dest->state = (struct internal_state FAR *) ds;
*ds = *ss;
ds->strm = dest;
 
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
ds->pending_buf = (uchf *) overlay;
 
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
ds->pending_buf == Z_NULL) {
deflateEnd (dest);
return Z_MEM_ERROR;
}
/* following zmemcpy do not work for 16-bit MSDOS */
zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
 
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
 
ds->l_desc.dyn_tree = ds->dyn_ltree;
ds->d_desc.dyn_tree = ds->dyn_dtree;
ds->bl_desc.dyn_tree = ds->bl_tree;
 
return Z_OK;
#endif
}
 
/* ===========================================================================
* Read a new buffer from the current input stream, update the adler32
* and total number of bytes read. All deflate() input goes through
* this function so some applications may wish to modify it to avoid
* allocating a large strm->next_in buffer and copying from it.
* (See also flush_pending()).
*/
local int read_buf(strm, buf, size)
z_streamp strm;
Bytef *buf;
unsigned size;
{
unsigned len = strm->avail_in;
 
if (len > size) len = size;
if (len == 0) return 0;
 
strm->avail_in -= len;
 
if (!strm->state->noheader) {
strm->adler = adler32(strm->adler, strm->next_in, len);
}
zmemcpy(buf, strm->next_in, len);
strm->next_in += len;
strm->total_in += len;
 
return (int)len;
}
 
/* ===========================================================================
* Initialize the "longest match" routines for a new zlib stream
*/
local void lm_init (s)
deflate_state *s;
{
s->window_size = (ulg)2L*s->w_size;
 
CLEAR_HASH(s);
 
/* Set the default configuration parameters:
*/
s->max_lazy_match = configuration_table[s->level].max_lazy;
s->good_match = configuration_table[s->level].good_length;
s->nice_match = configuration_table[s->level].nice_length;
s->max_chain_length = configuration_table[s->level].max_chain;
 
s->strstart = 0;
s->block_start = 0L;
s->lookahead = 0;
s->match_length = s->prev_length = MIN_MATCH-1;
s->match_available = 0;
s->ins_h = 0;
#ifdef ASMV
match_init(); /* initialize the asm code */
#endif
}
 
/* ===========================================================================
* Set match_start to the longest match starting at the given string and
* return its length. Matches shorter or equal to prev_length are discarded,
* in which case the result is equal to prev_length and match_start is
* garbage.
* IN assertions: cur_match is the head of the hash chain for the current
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
* OUT assertion: the match length is not greater than s->lookahead.
*/
#ifndef ASMV
/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
* match.S. The code will be functionally equivalent.
*/
#ifndef FASTEST
local uInt longest_match(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;
}
 
#else /* FASTEST */
/* ---------------------------------------------------------------------------
* Optimized version for level == 1 only
*/
local uInt longest_match(s, cur_match)
deflate_state *s;
IPos cur_match; /* current match */
{
register Bytef *scan = s->window + s->strstart; /* current string */
register Bytef *match; /* matched string */
register int len; /* length of current match */
register Bytef *strend = s->window + s->strstart + MAX_MATCH;
 
/* 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");
 
Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
 
Assert(cur_match < s->strstart, "no future");
 
match = s->window + cur_match;
 
/* Return failure if the match length is less than 2:
*/
if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
 
/* 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 += 2;
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);
 
if (len < MIN_MATCH) return MIN_MATCH - 1;
 
s->match_start = cur_match;
return len <= s->lookahead ? len : s->lookahead;
}
#endif /* FASTEST */
#endif /* ASMV */
 
#ifdef DEBUG
/* ===========================================================================
* Check that the match at match_start is indeed a match.
*/
local void check_match(s, start, match, length)
deflate_state *s;
IPos start, match;
int length;
{
/* check that the match is indeed a match */
if (zmemcmp(s->window + match,
s->window + start, length) != EQUAL) {
cprintf(" start %u, match %u, length %d\n",
start, match, length);
do {
cprintf("%c%c", s->window[match++], s->window[start++]);
} while (--length != 0);
z_error("invalid match");
}
if (z_verbose > 1) {
cprintf("\\[%d,%d]", start-match, length);
do { putc(s->window[start++], stderr); } while (--length != 0);
}
}
#else
# define check_match(s, start, match, length)
#endif
 
/* ===========================================================================
* Fill the window when the lookahead becomes insufficient.
* Updates strstart and lookahead.
*
* IN assertion: lookahead < MIN_LOOKAHEAD
* OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
* At least one byte has been read, or avail_in == 0; reads are
* performed for at least two bytes (required for the zip translate_eol
* option -- not supported here).
*/
local void fill_window(s)
deflate_state *s;
{
register unsigned n, m;
register Posf *p;
unsigned more; /* Amount of free space at the end of the window. */
uInt wsize = s->w_size;
 
do {
more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
 
/* Deal with !@#$% 64K limit: */
if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
more = wsize;
 
} else if (more == (unsigned)(-1)) {
/* Very unlikely, but possible on 16 bit machine if strstart == 0
* and lookahead == 1 (input done one byte at time)
*/
more--;
 
/* If the window is almost full and there is insufficient lookahead,
* move the upper half to the lower one to make room in the upper half.
*/
} else if (s->strstart >= wsize+MAX_DIST(s)) {
 
zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
s->match_start -= wsize;
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
s->block_start -= (long) wsize;
 
/* Slide the hash table (could be avoided with 32 bit values
at the expense of memory usage). We slide even when level == 0
to keep the hash table consistent if we switch back to level > 0
later. (Using level 0 permanently is not an optimal usage of
zlib, so we don't care about this pathological case.)
*/
n = s->hash_size;
p = &s->head[n];
do {
m = *--p;
*p = (Pos)(m >= wsize ? m-wsize : NIL);
} while (--n);
 
n = wsize;
#ifndef FASTEST
p = &s->prev[n];
do {
m = *--p;
*p = (Pos)(m >= wsize ? m-wsize : NIL);
/* If n is not on any hash chain, prev[n] is garbage but
* its value will never be used.
*/
} while (--n);
#endif
more += wsize;
}
if (s->strm->avail_in == 0) return;
 
/* If there was no sliding:
* strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
* more == window_size - lookahead - strstart
* => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
* => more >= window_size - 2*WSIZE + 2
* In the BIG_MEM or MMAP case (not yet supported),
* window_size == input_size + MIN_LOOKAHEAD &&
* strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
* Otherwise, window_size == 2*WSIZE so more >= 2.
* If there was sliding, more >= WSIZE. So in all cases, more >= 2.
*/
Assert(more >= 2, "more < 2");
 
n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
s->lookahead += n;
 
/* Initialize the hash value now that we have some input: */
if (s->lookahead >= MIN_MATCH) {
s->ins_h = s->window[s->strstart];
UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
#if MIN_MATCH != 3
Call UPDATE_HASH() MIN_MATCH-3 more times
#endif
}
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
* but this is not important since only literal bytes will be emitted.
*/
 
} while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
}
 
/* ===========================================================================
* Flush the current block, with given end-of-file flag.
* IN assertion: strstart is set to the end of the current match.
*/
#define FLUSH_BLOCK_ONLY(s, eof) { \
_tr_flush_block(s, (s->block_start >= 0L ? \
(charf *)&s->window[(unsigned)s->block_start] : \
(charf *)Z_NULL), \
(ulg)((long)s->strstart - s->block_start), \
(eof)); \
s->block_start = s->strstart; \
flush_pending(s->strm); \
Tracev((stderr,"[FLUSH]")); \
}
 
/* Same but force premature exit if necessary. */
#define FLUSH_BLOCK(s, eof) { \
FLUSH_BLOCK_ONLY(s, eof); \
if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
}
 
/* ===========================================================================
* Copy without compression as much as possible from the input stream, return
* the current block state.
* This function does not insert new strings in the dictionary since
* uncompressible data is probably not useful. This function is used
* only for the level=0 compression option.
* NOTE: this function should be optimized to avoid extra copying from
* window to pending_buf.
*/
local block_state deflate_stored(s, flush)
deflate_state *s;
int flush;
{
/* Stored blocks are limited to 0xffff bytes, pending_buf is limited
* to pending_buf_size, and each stored block has a 5 byte header:
*/
ulg max_block_size = 0xffff;
ulg max_start;
 
if (max_block_size > s->pending_buf_size - 5) {
max_block_size = s->pending_buf_size - 5;
}
 
/* Copy as much as possible from input to output: */
for (;;) {
/* Fill the window as much as possible: */
if (s->lookahead <= 1) {
 
Assert(s->strstart < s->w_size+MAX_DIST(s) ||
s->block_start >= (long)s->w_size, "slide too late");
 
fill_window(s);
if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
 
if (s->lookahead == 0) break; /* flush the current block */
}
Assert(s->block_start >= 0L, "block gone");
 
s->strstart += s->lookahead;
s->lookahead = 0;
 
/* Emit a stored block if pending_buf will be full: */
max_start = s->block_start + max_block_size;
if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
/* strstart == 0 is possible when wraparound on 16-bit machine */
s->lookahead = (uInt)(s->strstart - max_start);
s->strstart = (uInt)max_start;
FLUSH_BLOCK(s, 0);
}
/* Flush if we may have to slide, otherwise block_start may become
* negative and the data will be gone:
*/
if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
FLUSH_BLOCK(s, 0);
}
}
FLUSH_BLOCK(s, flush == Z_FINISH);
return flush == Z_FINISH ? finish_done : block_done;
}
 
/* ===========================================================================
* Compress as much as possible from the input stream, return the current
* block state.
* This function does not perform lazy evaluation of matches and inserts
* new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options.
*/
local block_state deflate_fast(s, flush)
deflate_state *s;
int flush;
{
IPos hash_head = NIL; /* head of the hash chain */
int bflush; /* set if current block must be flushed */
 
for (;;) {
/* Make sure that we always have enough lookahead, except
* at the end of the input file. We need MAX_MATCH bytes
* for the next match, plus MIN_MATCH bytes to insert the
* string following the next match.
*/
if (s->lookahead < MIN_LOOKAHEAD) {
fill_window(s);
if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
return need_more;
}
if (s->lookahead == 0) break; /* flush the current block */
}
 
/* Insert the string window[strstart .. strstart+2] in the
* dictionary, and set hash_head to the head of the hash chain:
*/
if (s->lookahead >= MIN_MATCH) {
INSERT_STRING(s, s->strstart, hash_head);
}
 
/* Find the longest match, discarding those <= prev_length.
* At this point we have always match_length < MIN_MATCH
*/
if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
/* To simplify the code, we prevent matches with the string
* of window index 0 (in particular we have to avoid a match
* of the string with itself at the start of the input file).
*/
if (s->strategy != Z_HUFFMAN_ONLY) {
s->match_length = longest_match (s, hash_head);
}
/* longest_match() sets match_start */
}
if (s->match_length >= MIN_MATCH) {
check_match(s, s->strstart, s->match_start, s->match_length);
 
_tr_tally_dist(s, s->strstart - s->match_start,
s->match_length - MIN_MATCH, bflush);
 
s->lookahead -= s->match_length;
 
/* Insert new strings in the hash table only if the match length
* is not too large. This saves time but degrades compression.
*/
#ifndef FASTEST
if (s->match_length <= s->max_insert_length &&
s->lookahead >= MIN_MATCH) {
s->match_length--; /* string at strstart already in hash table */
do {
s->strstart++;
INSERT_STRING(s, s->strstart, hash_head);
/* strstart never exceeds WSIZE-MAX_MATCH, so there are
* always MIN_MATCH bytes ahead.
*/
} while (--s->match_length != 0);
s->strstart++;
} else
#endif
{
s->strstart += s->match_length;
s->match_length = 0;
s->ins_h = s->window[s->strstart];
UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
#if MIN_MATCH != 3
Call UPDATE_HASH() MIN_MATCH-3 more times
#endif
/* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
* matter since it will be recomputed at next deflate call.
*/
}
} else {
/* No match, output a literal byte */
Tracevv((stderr,"%c", s->window[s->strstart]));
_tr_tally_lit (s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
}
if (bflush) FLUSH_BLOCK(s, 0);
}
FLUSH_BLOCK(s, flush == Z_FINISH);
return flush == Z_FINISH ? finish_done : block_done;
}
 
/* ===========================================================================
* Same as above, but achieves better compression. We use a lazy
* evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position.
*/
local block_state deflate_slow(s, flush)
deflate_state *s;
int flush;
{
IPos hash_head = NIL; /* head of hash chain */
int bflush; /* set if current block must be flushed */
 
/* Process the input block. */
for (;;) {
/* Make sure that we always have enough lookahead, except
* at the end of the input file. We need MAX_MATCH bytes
* for the next match, plus MIN_MATCH bytes to insert the
* string following the next match.
*/
if (s->lookahead < MIN_LOOKAHEAD) {
fill_window(s);
if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
return need_more;
}
if (s->lookahead == 0) break; /* flush the current block */
}
 
/* Insert the string window[strstart .. strstart+2] in the
* dictionary, and set hash_head to the head of the hash chain:
*/
if (s->lookahead >= MIN_MATCH) {
INSERT_STRING(s, s->strstart, hash_head);
}
 
/* Find the longest match, discarding those <= prev_length.
*/
s->prev_length = s->match_length, s->prev_match = s->match_start;
s->match_length = MIN_MATCH-1;
 
if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
s->strstart - hash_head <= MAX_DIST(s)) {
/* To simplify the code, we prevent matches with the string
* of window index 0 (in particular we have to avoid a match
* of the string with itself at the start of the input file).
*/
if (s->strategy != Z_HUFFMAN_ONLY) {
s->match_length = longest_match (s, hash_head);
}
/* longest_match() sets match_start */
 
if (s->match_length <= 5 && (s->strategy == Z_FILTERED ||
(s->match_length == MIN_MATCH &&
s->strstart - s->match_start > TOO_FAR))) {
 
/* If prev_match is also MIN_MATCH, match_start is garbage
* but we will ignore the current match anyway.
*/
s->match_length = MIN_MATCH-1;
}
}
/* If there was a match at the previous step and the current
* match is not better, output the previous match:
*/
if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
/* Do not insert strings in hash table beyond this. */
 
check_match(s, s->strstart-1, s->prev_match, s->prev_length);
 
_tr_tally_dist(s, s->strstart -1 - s->prev_match,
s->prev_length - MIN_MATCH, bflush);
 
/* Insert in hash table all strings up to the end of the match.
* strstart-1 and strstart are already inserted. If there is not
* enough lookahead, the last two strings are not inserted in
* the hash table.
*/
s->lookahead -= s->prev_length-1;
s->prev_length -= 2;
do {
if (++s->strstart <= max_insert) {
INSERT_STRING(s, s->strstart, hash_head);
}
} while (--s->prev_length != 0);
s->match_available = 0;
s->match_length = MIN_MATCH-1;
s->strstart++;
 
if (bflush) FLUSH_BLOCK(s, 0);
 
} else if (s->match_available) {
/* If there was no match at the previous position, output a
* single literal. If there was a match but the current match
* is longer, truncate the previous match to a single literal.
*/
Tracevv((stderr,"%c", s->window[s->strstart-1]));
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
if (bflush) {
FLUSH_BLOCK_ONLY(s, 0);
}
s->strstart++;
s->lookahead--;
if (s->strm->avail_out == 0) return need_more;
} else {
/* There is no previous match to compare with, wait for
* the next step to decide.
*/
s->match_available = 1;
s->strstart++;
s->lookahead--;
}
}
Assert (flush != Z_NO_FLUSH, "no flush?");
if (s->match_available) {
Tracevv((stderr,"%c", s->window[s->strstart-1]));
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
s->match_available = 0;
}
FLUSH_BLOCK(s, flush == Z_FINISH);
return flush == Z_FINISH ? finish_done : block_done;
}
/shark/trunk/ports/zlib/zutil.c
0,0 → 1,225
/* zutil.c -- target dependent utility functions for the compression library
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* @(#) $Id: zutil.c,v 1.1 2003-03-24 11:13:45 pj Exp $ */
 
#include "zutil.h"
 
struct internal_state {int dummy;}; /* for buggy compilers */
 
#ifndef STDC
extern void exit OF((int));
#endif
 
const char *z_errmsg[10] = {
"need dictionary", /* Z_NEED_DICT 2 */
"stream end", /* Z_STREAM_END 1 */
"", /* Z_OK 0 */
"file error", /* Z_ERRNO (-1) */
"stream error", /* Z_STREAM_ERROR (-2) */
"data error", /* Z_DATA_ERROR (-3) */
"insufficient memory", /* Z_MEM_ERROR (-4) */
"buffer error", /* Z_BUF_ERROR (-5) */
"incompatible version",/* Z_VERSION_ERROR (-6) */
""};
 
 
const char * ZEXPORT zlibVersion()
{
return ZLIB_VERSION;
}
 
#ifdef DEBUG
 
# ifndef verbose
# define verbose 0
# endif
int z_verbose = verbose;
 
void z_error (m)
char *m;
{
cprintf("%s\n", m);
exit(1);
}
#endif
 
/* exported to allow conversion of error code to string for compress() and
* uncompress()
*/
const char * ZEXPORT zError(err)
int err;
{
return ERR_MSG(err);
}
 
 
#ifndef HAVE_MEMCPY
 
void zmemcpy(dest, source, len)
Bytef* dest;
const Bytef* source;
uInt len;
{
if (len == 0) return;
do {
*dest++ = *source++; /* ??? to be unrolled */
} while (--len != 0);
}
 
int zmemcmp(s1, s2, len)
const Bytef* s1;
const Bytef* s2;
uInt len;
{
uInt j;
 
for (j = 0; j < len; j++) {
if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
}
return 0;
}
 
void zmemzero(dest, len)
Bytef* dest;
uInt len;
{
if (len == 0) return;
do {
*dest++ = 0; /* ??? to be unrolled */
} while (--len != 0);
}
#endif
 
#ifdef __TURBOC__
#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
/* Small and medium model in Turbo C are for now limited to near allocation
* with reduced MAX_WBITS and MAX_MEM_LEVEL
*/
# define MY_ZCALLOC
 
/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
* and farmalloc(64K) returns a pointer with an offset of 8, so we
* must fix the pointer. Warning: the pointer must be put back to its
* original form in order to free it, use zcfree().
*/
 
#define MAX_PTR 10
/* 10*64K = 640K */
 
local int next_ptr = 0;
 
typedef struct ptr_table_s {
voidpf org_ptr;
voidpf new_ptr;
} ptr_table;
 
local ptr_table table[MAX_PTR];
/* This table is used to remember the original form of pointers
* to large buffers (64K). Such pointers are normalized with a zero offset.
* Since MSDOS is not a preemptive multitasking OS, this table is not
* protected from concurrent access. This hack doesn't work anyway on
* a protected system like OS/2. Use Microsoft C instead.
*/
 
voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
{
voidpf buf = opaque; /* just to make some compilers happy */
ulg bsize = (ulg)items*size;
 
/* If we allocate less than 65520 bytes, we assume that farmalloc
* will return a usable pointer which doesn't have to be normalized.
*/
if (bsize < 65520L) {
buf = farmalloc(bsize);
if (*(ush*)&buf != 0) return buf;
} else {
buf = farmalloc(bsize + 16L);
}
if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
table[next_ptr].org_ptr = buf;
 
/* Normalize the pointer to seg:0 */
*((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
*(ush*)&buf = 0;
table[next_ptr++].new_ptr = buf;
return buf;
}
 
void zcfree (voidpf opaque, voidpf ptr)
{
int n;
if (*(ush*)&ptr != 0) { /* object < 64K */
farfree(ptr);
return;
}
/* Find the original pointer */
for (n = 0; n < next_ptr; n++) {
if (ptr != table[n].new_ptr) continue;
 
farfree(table[n].org_ptr);
while (++n < next_ptr) {
table[n-1] = table[n];
}
next_ptr--;
return;
}
ptr = opaque; /* just to make some compilers happy */
Assert(0, "zcfree: ptr not found");
}
#endif
#endif /* __TURBOC__ */
 
 
#if defined(M_I86) && !defined(__32BIT__)
/* Microsoft C in 16-bit mode */
 
# define MY_ZCALLOC
 
#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
# define _halloc halloc
# define _hfree hfree
#endif
 
voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
{
if (opaque) opaque = 0; /* to make compiler happy */
return _halloc((long)items, size);
}
 
void zcfree (voidpf opaque, voidpf ptr)
{
if (opaque) opaque = 0; /* to make compiler happy */
_hfree(ptr);
}
 
#endif /* MSC */
 
 
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
 
#ifndef STDC
extern voidp calloc OF((uInt items, uInt size));
extern void free OF((voidpf ptr));
#endif
 
voidpf zcalloc (opaque, items, size)
voidpf opaque;
unsigned items;
unsigned size;
{
if (opaque) items += size - size; /* make compiler happy */
return (voidpf)calloc(items, size);
}
 
void zcfree (opaque, ptr)
voidpf opaque;
voidpf ptr;
{
free(ptr);
if (opaque) return; /* make compiler happy */
}
 
#endif /* MY_ZCALLOC */
/shark/trunk/ports/zlib/gzio.c
0,0 → 1,876
/* gzio.c -- IO on .gz files
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*
* Compile this file with -DNO_DEFLATE to avoid the compression code.
*/
 
/* @(#) $Id: gzio.c,v 1.1 2003-03-24 11:13:44 pj Exp $ */
 
#include <stdio.h>
 
#include "zutil.h"
 
struct internal_state {int dummy;}; /* for buggy compilers */
 
#ifndef Z_BUFSIZE
# ifdef MAXSEG_64K
# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
# else
# define Z_BUFSIZE 16384
# endif
#endif
#ifndef Z_PRINTF_BUFSIZE
# define Z_PRINTF_BUFSIZE 4096
#endif
 
#define ALLOC(size) malloc(size)
#define TRYFREE(p) {if (p) free(p);}
 
static int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
 
/* gzip flag byte */
#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */
#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
#define COMMENT 0x10 /* bit 4 set: file comment present */
#define RESERVED 0xE0 /* bits 5..7: reserved */
 
typedef struct gz_stream {
z_stream stream;
int z_err; /* error code for last stream operation */
int z_eof; /* set if end of input file */
FILE *file; /* .gz file */
Byte *inbuf; /* input buffer */
Byte *outbuf; /* output buffer */
uLong crc; /* crc32 of uncompressed data */
char *msg; /* error message */
char *path; /* path name for debugging only */
int transparent; /* 1 if input file is not a .gz file */
char mode; /* 'w' or 'r' */
long startpos; /* start of compressed data in file (header skipped) */
} gz_stream;
 
 
local gzFile gz_open OF((const char *path, const char *mode, int fd));
local int do_flush OF((gzFile file, int flush));
local int get_byte OF((gz_stream *s));
local void check_header OF((gz_stream *s));
local int destroy OF((gz_stream *s));
local void putLong OF((FILE *file, uLong x));
local uLong getLong OF((gz_stream *s));
 
/* ===========================================================================
Opens a gzip (.gz) file for reading or writing. The mode parameter
is as in fopen ("rb" or "wb"). The file is given either by file descriptor
or path name (if fd == -1).
gz_open return NULL if the file could not be opened or if there was
insufficient memory to allocate the (de)compression state; errno
can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR).
*/
local gzFile gz_open (path, mode, fd)
const char *path;
const char *mode;
int fd;
{
int err;
int level = Z_DEFAULT_COMPRESSION; /* compression level */
int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
char *p = (char*)mode;
gz_stream *s;
char fmode[80]; /* copy of mode, without the compression level */
char *m = fmode;
 
if (!path || !mode) return Z_NULL;
 
s = (gz_stream *)ALLOC(sizeof(gz_stream));
if (!s) return Z_NULL;
 
s->stream.zalloc = (alloc_func)0;
s->stream.zfree = (free_func)0;
s->stream.opaque = (voidpf)0;
s->stream.next_in = s->inbuf = Z_NULL;
s->stream.next_out = s->outbuf = Z_NULL;
s->stream.avail_in = s->stream.avail_out = 0;
s->file = NULL;
s->z_err = Z_OK;
s->z_eof = 0;
s->crc = crc32(0L, Z_NULL, 0);
s->msg = NULL;
s->transparent = 0;
 
s->path = (char*)ALLOC(strlen(path)+1);
if (s->path == NULL) {
return destroy(s), (gzFile)Z_NULL;
}
strcpy(s->path, path); /* do this early for debugging */
 
s->mode = '\0';
do {
if (*p == 'r') s->mode = 'r';
if (*p == 'w' || *p == 'a') s->mode = 'w';
if (*p >= '0' && *p <= '9') {
level = *p - '0';
} else if (*p == 'f') {
strategy = Z_FILTERED;
} else if (*p == 'h') {
strategy = Z_HUFFMAN_ONLY;
} else {
*m++ = *p; /* copy the mode */
}
} while (*p++ && m != fmode + sizeof(fmode));
if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
if (s->mode == 'w') {
#ifdef NO_DEFLATE
err = Z_STREAM_ERROR;
#else
err = deflateInit2(&(s->stream), level,
Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy);
/* windowBits is passed < 0 to suppress zlib header */
 
s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
#endif
if (err != Z_OK || s->outbuf == Z_NULL) {
return destroy(s), (gzFile)Z_NULL;
}
} else {
s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
 
err = inflateInit2(&(s->stream), -MAX_WBITS);
/* windowBits is passed < 0 to tell that there is no zlib header.
* Note that in this case inflate *requires* an extra "dummy" byte
* after the compressed stream in order to complete decompression and
* return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
* present after the compressed stream.
*/
if (err != Z_OK || s->inbuf == Z_NULL) {
return destroy(s), (gzFile)Z_NULL;
}
}
s->stream.avail_out = Z_BUFSIZE;
 
errno = 0;
s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
 
if (s->file == NULL) {
return destroy(s), (gzFile)Z_NULL;
}
if (s->mode == 'w') {
/* Write a very simple .gz header:
*/
fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
s->startpos = 10L;
/* We use 10L instead of ftell(s->file) to because ftell causes an
* fflush on some systems. This version of the library doesn't use
* startpos anyway in write mode, so this initialization is not
* necessary.
*/
} else {
check_header(s); /* skip the .gz header */
s->startpos = (ftell(s->file) - s->stream.avail_in);
}
return (gzFile)s;
}
 
/* ===========================================================================
Opens a gzip (.gz) file for reading or writing.
*/
gzFile ZEXPORT gzopen (path, mode)
const char *path;
const char *mode;
{
return gz_open (path, mode, -1);
}
 
/* ===========================================================================
Associate a gzFile with the file descriptor fd. fd is not dup'ed here
to mimic the behavio(u)r of fdopen.
*/
gzFile ZEXPORT gzdopen (fd, mode)
int fd;
const char *mode;
{
char name[20];
 
if (fd < 0) return (gzFile)Z_NULL;
sprintf(name, "<fd:%d>", fd); /* for debugging */
 
return gz_open (name, mode, fd);
}
 
/* ===========================================================================
* Update the compression level and strategy
*/
int ZEXPORT gzsetparams (file, level, strategy)
gzFile file;
int level;
int strategy;
{
gz_stream *s = (gz_stream*)file;
 
if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
 
/* Make room to allow flushing */
if (s->stream.avail_out == 0) {
 
s->stream.next_out = s->outbuf;
if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
s->z_err = Z_ERRNO;
}
s->stream.avail_out = Z_BUFSIZE;
}
 
return deflateParams (&(s->stream), level, strategy);
}
 
/* ===========================================================================
Read a byte from a gz_stream; update next_in and avail_in. Return EOF
for end of file.
IN assertion: the stream s has been sucessfully opened for reading.
*/
local int get_byte(s)
gz_stream *s;
{
if (s->z_eof) return EOF;
if (s->stream.avail_in == 0) {
errno = 0;
s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0) {
s->z_eof = 1;
if (ferror(s->file)) s->z_err = Z_ERRNO;
return EOF;
}
s->stream.next_in = s->inbuf;
}
s->stream.avail_in--;
return *(s->stream.next_in)++;
}
 
/* ===========================================================================
Check the gzip header of a gz_stream opened for reading. Set the stream
mode to transparent if the gzip magic header is not present; set s->err
to Z_DATA_ERROR if the magic header is present but the rest of the header
is incorrect.
IN assertion: the stream s has already been created sucessfully;
s->stream.avail_in is zero for the first time, but may be non-zero
for concatenated .gz files.
*/
local void check_header(s)
gz_stream *s;
{
int method; /* method byte */
int flags; /* flags byte */
uInt len;
int c;
 
/* Check the gzip magic header */
for (len = 0; len < 2; len++) {
c = get_byte(s);
if (c != gz_magic[len]) {
if (len != 0) s->stream.avail_in++, s->stream.next_in--;
if (c != EOF) {
s->stream.avail_in++, s->stream.next_in--;
s->transparent = 1;
}
s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END;
return;
}
}
method = get_byte(s);
flags = get_byte(s);
if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
s->z_err = Z_DATA_ERROR;
return;
}
 
/* Discard time, xflags and OS code: */
for (len = 0; len < 6; len++) (void)get_byte(s);
 
if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
len = (uInt)get_byte(s);
len += ((uInt)get_byte(s))<<8;
/* len is garbage if EOF but the loop below will quit anyway */
while (len-- != 0 && get_byte(s) != EOF) ;
}
if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
while ((c = get_byte(s)) != 0 && c != EOF) ;
}
if ((flags & COMMENT) != 0) { /* skip the .gz file comment */
while ((c = get_byte(s)) != 0 && c != EOF) ;
}
if ((flags & HEAD_CRC) != 0) { /* skip the header crc */
for (len = 0; len < 2; len++) (void)get_byte(s);
}
s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
}
 
/* ===========================================================================
* Cleanup then free the given gz_stream. Return a zlib error code.
Try freeing in the reverse order of allocations.
*/
local int destroy (s)
gz_stream *s;
{
int err = Z_OK;
 
if (!s) return Z_STREAM_ERROR;
 
TRYFREE(s->msg);
 
if (s->stream.state != NULL) {
if (s->mode == 'w') {
#ifdef NO_DEFLATE
err = Z_STREAM_ERROR;
#else
err = deflateEnd(&(s->stream));
#endif
} else if (s->mode == 'r') {
err = inflateEnd(&(s->stream));
}
}
if (s->file != NULL && fclose(s->file)) {
#ifdef ESPIPE
if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */
#endif
err = Z_ERRNO;
}
if (s->z_err < 0) err = s->z_err;
 
TRYFREE(s->inbuf);
TRYFREE(s->outbuf);
TRYFREE(s->path);
TRYFREE(s);
return err;
}
 
/* ===========================================================================
Reads the given number of uncompressed bytes from the compressed file.
gzread returns the number of bytes actually read (0 for end of file).
*/
int ZEXPORT gzread (file, buf, len)
gzFile file;
voidp buf;
unsigned len;
{
gz_stream *s = (gz_stream*)file;
Bytef *start = (Bytef*)buf; /* starting point for crc computation */
Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */
 
if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
 
if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
if (s->z_err == Z_STREAM_END) return 0; /* EOF */
 
next_out = (Byte*)buf;
s->stream.next_out = (Bytef*)buf;
s->stream.avail_out = len;
 
while (s->stream.avail_out != 0) {
 
if (s->transparent) {
/* Copy first the lookahead bytes: */
uInt n = s->stream.avail_in;
if (n > s->stream.avail_out) n = s->stream.avail_out;
if (n > 0) {
zmemcpy(s->stream.next_out, s->stream.next_in, n);
next_out += n;
s->stream.next_out = next_out;
s->stream.next_in += n;
s->stream.avail_out -= n;
s->stream.avail_in -= n;
}
if (s->stream.avail_out > 0) {
s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out,
s->file);
}
len -= s->stream.avail_out;
s->stream.total_in += (uLong)len;
s->stream.total_out += (uLong)len;
if (len == 0) s->z_eof = 1;
return (int)len;
}
if (s->stream.avail_in == 0 && !s->z_eof) {
 
errno = 0;
s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0) {
s->z_eof = 1;
if (ferror(s->file)) {
s->z_err = Z_ERRNO;
break;
}
}
s->stream.next_in = s->inbuf;
}
s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
 
if (s->z_err == Z_STREAM_END) {
/* Check CRC and original size */
s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
start = s->stream.next_out;
 
if (getLong(s) != s->crc) {
s->z_err = Z_DATA_ERROR;
} else {
(void)getLong(s);
/* The uncompressed length returned by above getlong() may
* be different from s->stream.total_out) in case of
* concatenated .gz files. Check for such files:
*/
check_header(s);
if (s->z_err == Z_OK) {
uLong total_in = s->stream.total_in;
uLong total_out = s->stream.total_out;
 
inflateReset(&(s->stream));
s->stream.total_in = total_in;
s->stream.total_out = total_out;
s->crc = crc32(0L, Z_NULL, 0);
}
}
}
if (s->z_err != Z_OK || s->z_eof) break;
}
s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
 
return (int)(len - s->stream.avail_out);
}
 
 
/* ===========================================================================
Reads one byte from the compressed file. gzgetc returns this byte
or -1 in case of end of file or error.
*/
int ZEXPORT gzgetc(file)
gzFile file;
{
unsigned char c;
 
return gzread(file, &c, 1) == 1 ? c : -1;
}
 
 
/* ===========================================================================
Reads bytes from the compressed file until len-1 characters are
read, or a newline character is read and transferred to buf, or an
end-of-file condition is encountered. The string is then terminated
with a null character.
gzgets returns buf, or Z_NULL in case of error.
 
The current implementation is not optimized at all.
*/
char * ZEXPORT gzgets(file, buf, len)
gzFile file;
char *buf;
int len;
{
char *b = buf;
if (buf == Z_NULL || len <= 0) return Z_NULL;
 
while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
*buf = '\0';
return b == buf && len > 0 ? Z_NULL : b;
}
 
 
#ifndef NO_DEFLATE
/* ===========================================================================
Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of bytes actually written (0 in case of error).
*/
int ZEXPORT gzwrite (file, buf, len)
gzFile file;
const voidp buf;
unsigned len;
{
gz_stream *s = (gz_stream*)file;
 
if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
 
s->stream.next_in = (Bytef*)buf;
s->stream.avail_in = len;
 
while (s->stream.avail_in != 0) {
 
if (s->stream.avail_out == 0) {
 
s->stream.next_out = s->outbuf;
if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
s->z_err = Z_ERRNO;
break;
}
s->stream.avail_out = Z_BUFSIZE;
}
s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
if (s->z_err != Z_OK) break;
}
s->crc = crc32(s->crc, (const Bytef *)buf, len);
 
return (int)(len - s->stream.avail_in);
}
 
/* ===========================================================================
Converts, formats, and writes the args to the compressed file under
control of the format string, as in fprintf. gzprintf returns the number of
uncompressed bytes actually written (0 in case of error).
*/
#ifdef STDC
#include <stdarg.h>
 
int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
{
char buf[Z_PRINTF_BUFSIZE];
va_list va;
int len;
 
va_start(va, format);
#ifdef HAS_vsnprintf
//(void)vsnprintf(buf, sizeof(buf), format, va);
#else
//(void)vsprintf(buf, format, va);
#endif
sprintf(buf,"%s",format);
va_end(va);
len = strlen(buf); /* some *sprintf don't return the nb of bytes written */
if (len <= 0) return 0;
 
return gzwrite(file, buf, (unsigned)len);
}
#else /* not ANSI C */
 
int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
gzFile file;
const char *format;
int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
{
char buf[Z_PRINTF_BUFSIZE];
int len;
 
#ifdef HAS_snprintf
snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
#else
sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
#endif
len = strlen(buf); /* old sprintf doesn't return the nb of bytes written */
if (len <= 0) return 0;
 
return gzwrite(file, buf, len);
}
#endif
 
/* ===========================================================================
Writes c, converted to an unsigned char, into the compressed file.
gzputc returns the value that was written, or -1 in case of error.
*/
int ZEXPORT gzputc(file, c)
gzFile file;
int c;
{
unsigned char cc = (unsigned char) c; /* required for big endian systems */
 
return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1;
}
 
 
/* ===========================================================================
Writes the given null-terminated string to the compressed file, excluding
the terminating null character.
gzputs returns the number of characters written, or -1 in case of error.
*/
int ZEXPORT gzputs(file, s)
gzFile file;
const char *s;
{
return gzwrite(file, (char*)s, (unsigned)strlen(s));
}
 
 
/* ===========================================================================
Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function.
*/
local int do_flush (file, flush)
gzFile file;
int flush;
{
uInt len;
int done = 0;
gz_stream *s = (gz_stream*)file;
 
if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
 
s->stream.avail_in = 0; /* should be zero already anyway */
 
for (;;) {
len = Z_BUFSIZE - s->stream.avail_out;
 
if (len != 0) {
if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
s->z_err = Z_ERRNO;
return Z_ERRNO;
}
s->stream.next_out = s->outbuf;
s->stream.avail_out = Z_BUFSIZE;
}
if (done) break;
s->z_err = deflate(&(s->stream), flush);
 
/* Ignore the second of two consecutive flushes: */
if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
 
/* deflate has finished flushing only when it hasn't used up
* all the available space in the output buffer:
*/
done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
}
return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
}
 
int ZEXPORT gzflush (file, flush)
gzFile file;
int flush;
{
gz_stream *s = (gz_stream*)file;
int err = do_flush (file, flush);
 
if (err) return err;
fflush(s->file);
return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
}
#endif /* NO_DEFLATE */
 
/* ===========================================================================
Sets the starting position for the next gzread or gzwrite on the given
compressed file. The offset represents a number of bytes in the
gzseek returns the resulting offset location as measured in bytes from
the beginning of the uncompressed stream, or -1 in case of error.
SEEK_END is not implemented, returns error.
In this version of the library, gzseek can be extremely slow.
*/
z_off_t ZEXPORT gzseek (file, offset, whence)
gzFile file;
z_off_t offset;
int whence;
{
gz_stream *s = (gz_stream*)file;
 
if (s == NULL || whence == SEEK_END ||
s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
return -1L;
}
if (s->mode == 'w') {
#ifdef NO_DEFLATE
return -1L;
#else
if (whence == SEEK_SET) {
offset -= s->stream.total_in;
}
if (offset < 0) return -1L;
 
/* At this point, offset is the number of zero bytes to write. */
if (s->inbuf == Z_NULL) {
s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */
zmemzero(s->inbuf, Z_BUFSIZE);
}
while (offset > 0) {
uInt size = Z_BUFSIZE;
if (offset < Z_BUFSIZE) size = (uInt)offset;
 
size = gzwrite(file, s->inbuf, size);
if (size == 0) return -1L;
 
offset -= size;
}
return (z_off_t)s->stream.total_in;
#endif
}
/* Rest of function is for reading only */
 
/* compute absolute position */
if (whence == SEEK_CUR) {
offset += s->stream.total_out;
}
if (offset < 0) return -1L;
 
if (s->transparent) {
/* map to fseek */
s->stream.avail_in = 0;
s->stream.next_in = s->inbuf;
if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
 
s->stream.total_in = s->stream.total_out = (uLong)offset;
return offset;
}
 
/* For a negative seek, rewind and use positive seek */
if ((uLong)offset >= s->stream.total_out) {
offset -= s->stream.total_out;
} else if (gzrewind(file) < 0) {
return -1L;
}
/* offset is now the number of bytes to skip. */
 
if (offset != 0 && s->outbuf == Z_NULL) {
s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
}
while (offset > 0) {
int size = Z_BUFSIZE;
if (offset < Z_BUFSIZE) size = (int)offset;
 
size = gzread(file, s->outbuf, (uInt)size);
if (size <= 0) return -1L;
offset -= size;
}
return (z_off_t)s->stream.total_out;
}
 
/* ===========================================================================
Rewinds input file.
*/
int ZEXPORT gzrewind (file)
gzFile file;
{
gz_stream *s = (gz_stream*)file;
if (s == NULL || s->mode != 'r') return -1;
 
s->z_err = Z_OK;
s->z_eof = 0;
s->stream.avail_in = 0;
s->stream.next_in = s->inbuf;
s->crc = crc32(0L, Z_NULL, 0);
if (s->startpos == 0) { /* not a compressed file */
rewind(s->file);
return 0;
}
 
(void) inflateReset(&s->stream);
return fseek(s->file, s->startpos, SEEK_SET);
}
 
/* ===========================================================================
Returns the starting position for the next gzread or gzwrite on the
given compressed file. This position represents a number of bytes in the
uncompressed data stream.
*/
z_off_t ZEXPORT gztell (file)
gzFile file;
{
return gzseek(file, 0L, SEEK_CUR);
}
 
/* ===========================================================================
Returns 1 when EOF has previously been detected reading the given
input stream, otherwise zero.
*/
int ZEXPORT gzeof (file)
gzFile file;
{
gz_stream *s = (gz_stream*)file;
return (s == NULL || s->mode != 'r') ? 0 : s->z_eof;
}
 
/* ===========================================================================
Outputs a long in LSB order to the given file
*/
local void putLong (file, x)
FILE *file;
uLong x;
{
int n;
for (n = 0; n < 4; n++) {
fputc((int)(x & 0xff), file);
x >>= 8;
}
}
 
/* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets z_err in case
of error.
*/
local uLong getLong (s)
gz_stream *s;
{
uLong x = (uLong)get_byte(s);
int c;
 
x += ((uLong)get_byte(s))<<8;
x += ((uLong)get_byte(s))<<16;
c = get_byte(s);
if (c == EOF) s->z_err = Z_DATA_ERROR;
x += ((uLong)c)<<24;
return x;
}
 
/* ===========================================================================
Flushes all pending output if necessary, closes the compressed file
and deallocates all the (de)compression state.
*/
int ZEXPORT gzclose (file)
gzFile file;
{
int err;
gz_stream *s = (gz_stream*)file;
 
if (s == NULL) return Z_STREAM_ERROR;
 
if (s->mode == 'w') {
#ifdef NO_DEFLATE
return Z_STREAM_ERROR;
#else
err = do_flush (file, Z_FINISH);
if (err != Z_OK) return destroy((gz_stream*)file);
 
putLong (s->file, s->crc);
putLong (s->file, s->stream.total_in);
#endif
}
return destroy((gz_stream*)file);
}
 
/* ===========================================================================
Returns the error message for the last error which occured on the
given compressed file. errnum is set to zlib error number. If an
error occured in the file system and not in the compression library,
errnum is set to Z_ERRNO and the application may consult errno
to get the exact error code.
*/
const char* ZEXPORT gzerror (file, errnum)
gzFile file;
int *errnum;
{
char *m;
gz_stream *s = (gz_stream*)file;
 
if (s == NULL) {
*errnum = Z_STREAM_ERROR;
return (const char*)ERR_MSG(Z_STREAM_ERROR);
}
*errnum = s->z_err;
if (*errnum == Z_OK) return (const char*)"";
 
m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
 
if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
 
TRYFREE(s->msg);
s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
strcpy(s->msg, s->path);
strcat(s->msg, ": ");
strcat(s->msg, m);
return (const char*)s->msg;
}
/shark/trunk/ports/zlib/deflate.h
0,0 → 1,318
/* deflate.h -- internal compression state
* Copyright (C) 1995-2002 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
 
/* @(#) $Id: deflate.h,v 1.1 2003-03-24 11:13:44 pj Exp $ */
 
#ifndef _DEFLATE_H
#define _DEFLATE_H
 
#include "zutil.h"
 
/* ===========================================================================
* Internal compression state.
*/
 
#define LENGTH_CODES 29
/* number of length codes, not counting the special END_BLOCK code */
 
#define LITERALS 256
/* number of literal bytes 0..255 */
 
#define L_CODES (LITERALS+1+LENGTH_CODES)
/* number of Literal or Length codes, including the END_BLOCK code */
 
#define D_CODES 30
/* number of distance codes */
 
#define BL_CODES 19
/* number of codes used to transfer the bit lengths */
 
#define HEAP_SIZE (2*L_CODES+1)
/* maximum heap size */
 
#define MAX_BITS 15
/* All codes must not exceed MAX_BITS bits */
 
#define INIT_STATE 42
#define BUSY_STATE 113
#define FINISH_STATE 666
/* Stream status */
 
 
/* Data structure describing a single value and its code string. */
typedef struct ct_data_s {
union {
ush freq; /* frequency count */
ush code; /* bit string */
} fc;
union {
ush dad; /* father node in Huffman tree */
ush len; /* length of bit string */
} dl;
} FAR ct_data;
 
#define Freq fc.freq
#define Code fc.code
#define Dad dl.dad
#define Len dl.len
 
typedef struct static_tree_desc_s static_tree_desc;
 
typedef struct tree_desc_s {
ct_data *dyn_tree; /* the dynamic tree */
int max_code; /* largest code with non zero frequency */
static_tree_desc *stat_desc; /* the corresponding static tree */
} FAR tree_desc;
 
typedef ush Pos;
typedef Pos FAR Posf;
typedef unsigned IPos;
 
/* A Pos is an index in the character window. We use short instead of int to
* save space in the various tables. IPos is used only for parameter passing.
*/
 
typedef struct internal_state {
z_streamp strm; /* pointer back to this zlib stream */
int status; /* as the name implies */
Bytef *pending_buf; /* output still pending */
ulg pending_buf_size; /* size of pending_buf */
Bytef *pending_out; /* next pending byte to output to the stream */
int pending; /* nb of bytes in the pending buffer */
int noheader; /* suppress zlib header and adler32 */
Byte data_type; /* UNKNOWN, BINARY or ASCII */
Byte method; /* STORED (for zip only) or DEFLATED */
int last_flush; /* value of flush param for previous deflate call */
 
/* used by deflate.c: */
 
uInt w_size; /* LZ77 window size (32K by default) */
uInt w_bits; /* log2(w_size) (8..16) */
uInt w_mask; /* w_size - 1 */
 
Bytef *window;
/* Sliding window. Input bytes are read into the second half of the window,
* and move to the first half later to keep a dictionary of at least wSize
* bytes. With this organization, matches are limited to a distance of
* wSize-MAX_MATCH bytes, but this ensures that IO is always
* performed with a length multiple of the block size. Also, it limits
* the window size to 64K, which is quite useful on MSDOS.
* To do: use the user input buffer as sliding window.
*/
 
ulg window_size;
/* Actual size of window: 2*wSize, except when the user input buffer
* is directly used as sliding window.
*/
 
Posf *prev;
/* Link to older string with same hash index. To limit the size of this
* array to 64K, this link is maintained only for the last 32K strings.
* An index in this array is thus a window index modulo 32K.
*/
 
Posf *head; /* Heads of the hash chains or NIL. */
 
uInt ins_h; /* hash index of string to be inserted */
uInt hash_size; /* number of elements in hash table */
uInt hash_bits; /* log2(hash_size) */
uInt hash_mask; /* hash_size-1 */
 
uInt hash_shift;
/* Number of bits by which ins_h must be shifted at each input
* step. It must be such that after MIN_MATCH steps, the oldest
* byte no longer takes part in the hash key, that is:
* hash_shift * MIN_MATCH >= hash_bits
*/
 
long block_start;
/* Window position at the beginning of the current output block. Gets
* negative when the window is moved backwards.
*/
 
uInt match_length; /* length of best match */
IPos prev_match; /* previous match */
int match_available; /* set if previous match exists */
uInt strstart; /* start of string to insert */
uInt match_start; /* start of matching string */
uInt lookahead; /* number of valid bytes ahead in window */
 
uInt prev_length;
/* Length of the best match at previous step. Matches not greater than this
* are discarded. This is used in the lazy match evaluation.
*/
 
uInt max_chain_length;
/* To speed up deflation, hash chains are never searched beyond this
* length. A higher limit improves compression ratio but degrades the
* speed.
*/
 
uInt max_lazy_match;
/* Attempt to find a better match only when the current match is strictly
* smaller than this value. This mechanism is used only for compression
* levels >= 4.
*/
# define max_insert_length max_lazy_match
/* Insert new strings in the hash table only if the match length is not
* greater than this length. This saves time but degrades compression.
* max_insert_length is used only for compression levels <= 3.
*/
 
int level; /* compression level (1..9) */
int strategy; /* favor or force Huffman coding*/
 
uInt good_match;
/* Use a faster search when the previous match is longer than this */
 
int nice_match; /* Stop searching when current match exceeds this */
 
/* used by trees.c: */
/* Didn't use ct_data typedef below to supress compiler warning */
struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
 
struct tree_desc_s l_desc; /* desc. for literal tree */
struct tree_desc_s d_desc; /* desc. for distance tree */
struct tree_desc_s bl_desc; /* desc. for bit length tree */
 
ush bl_count[MAX_BITS+1];
/* number of codes at each bit length for an optimal tree */
 
int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
int heap_len; /* number of elements in the heap */
int heap_max; /* element of largest frequency */
/* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
* The same heap array is used to build all trees.
*/
 
uch depth[2*L_CODES+1];
/* Depth of each subtree used as tie breaker for trees of equal frequency
*/
 
uchf *l_buf; /* buffer for literals or lengths */
 
uInt lit_bufsize;
/* Size of match buffer for literals/lengths. There are 4 reasons for
* limiting lit_bufsize to 64K:
* - frequencies can be kept in 16 bit counters
* - if compression is not successful for the first block, all input
* data is still in the window so we can still emit a stored block even
* when input comes from standard input. (This can also be done for
* all blocks if lit_bufsize is not greater than 32K.)
* - if compression is not successful for a file smaller than 64K, we can
* even emit a stored file instead of a stored block (saving 5 bytes).
* This is applicable only for zip (not gzip or zlib).
* - creating new Huffman trees less frequently may not provide fast
* adaptation to changes in the input data statistics. (Take for
* example a binary file with poorly compressible code followed by
* a highly compressible string table.) Smaller buffer sizes give
* fast adaptation but have of course the overhead of transmitting
* trees more frequently.
* - I can't count above 4
*/
 
uInt last_lit; /* running index in l_buf */
 
ushf *d_buf;
/* Buffer for distances. To simplify the code, d_buf and l_buf have
* the same number of elements. To use different lengths, an extra flag
* array would be necessary.
*/
 
ulg opt_len; /* bit length of current block with optimal trees */
ulg static_len; /* bit length of current block with static trees */
uInt matches; /* number of string matches in current block */
int last_eob_len; /* bit length of EOB code for last block */
 
#ifdef DEBUG
ulg compressed_len; /* total bit length of compressed file mod 2^32 */
ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
#endif
 
ush bi_buf;
/* Output buffer. bits are inserted starting at the bottom (least
* significant bits).
*/
int bi_valid;
/* Number of valid bits in bi_buf. All bits above the last valid bit
* are always zero.
*/
 
} FAR deflate_state;
 
/* Output a byte on the stream.
* IN assertion: there is enough room in pending_buf.
*/
#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
 
 
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
/* Minimum amount of lookahead, except at the end of the input file.
* See deflate.c for comments about the MIN_MATCH+1.
*/
 
#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
/* In order to simplify the code, particularly on 16 bit machines, match
* distances are limited to MAX_DIST instead of WSIZE.
*/
 
/* in trees.c */
void _tr_init OF((deflate_state *s));
int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
int eof));
void _tr_align OF((deflate_state *s));
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
int eof));
 
#define d_code(dist) \
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
/* Mapping from a distance to a distance code. dist is the distance - 1 and
* must not have side effects. _dist_code[256] and _dist_code[257] are never
* used.
*/
 
#ifndef DEBUG
/* Inline versions of _tr_tally for speed: */
 
#if defined(GEN_TREES_H) || !defined(STDC)
extern uch _length_code[];
extern uch _dist_code[];
#else
extern const uch _length_code[];
extern const uch _dist_code[];
#endif
 
# define _tr_tally_lit(s, c, flush) \
{ uch cc = (c); \
s->d_buf[s->last_lit] = 0; \
s->l_buf[s->last_lit++] = cc; \
s->dyn_ltree[cc].Freq++; \
flush = (s->last_lit == s->lit_bufsize-1); \
}
# define _tr_tally_dist(s, distance, length, flush) \
{ uch len = (length); \
ush dist = (distance); \
s->d_buf[s->last_lit] = dist; \
s->l_buf[s->last_lit++] = len; \
dist--; \
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
s->dyn_dtree[d_code(dist)].Freq++; \
flush = (s->last_lit == s->lit_bufsize-1); \
}
#else
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
# define _tr_tally_dist(s, distance, length, flush) \
flush = _tr_tally(s, distance, length)
#endif
 
#endif
/shark/trunk/ports/zlib/infutil.c
0,0 → 1,87
/* inflate_util.c -- data and routines common to blocks and codes
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
#include "zutil.h"
#include "infblock.h"
#include "inftrees.h"
#include "infcodes.h"
#include "infutil.h"
 
struct inflate_codes_state {int dummy;}; /* for buggy compilers */
 
/* And'ing with mask[n] masks the lower n bits */
uInt inflate_mask[17] = {
0x0000,
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
};
 
 
/* copy as much as possible from the sliding window to the output area */
int inflate_flush(s, z, r)
inflate_blocks_statef *s;
z_streamp z;
int r;
{
uInt n;
Bytef *p;
Bytef *q;
 
/* local copies of source and destination pointers */
p = z->next_out;
q = s->read;
 
/* compute number of bytes to copy as far as end of window */
n = (uInt)((q <= s->write ? s->write : s->end) - q);
if (n > z->avail_out) n = z->avail_out;
if (n && r == Z_BUF_ERROR) r = Z_OK;
 
/* update counters */
z->avail_out -= n;
z->total_out += n;
 
/* update check information */
if (s->checkfn != Z_NULL)
z->adler = s->check = (*s->checkfn)(s->check, q, n);
 
/* copy as far as end of window */
zmemcpy(p, q, n);
p += n;
q += n;
 
/* see if more to copy at beginning of window */
if (q == s->end)
{
/* wrap pointers */
q = s->window;
if (s->write == s->end)
s->write = s->window;
 
/* compute bytes to copy */
n = (uInt)(s->write - q);
if (n > z->avail_out) n = z->avail_out;
if (n && r == Z_BUF_ERROR) r = Z_OK;
 
/* update counters */
z->avail_out -= n;
z->total_out += n;
 
/* update check information */
if (s->checkfn != Z_NULL)
z->adler = s->check = (*s->checkfn)(s->check, q, n);
 
/* copy */
zmemcpy(p, q, n);
p += n;
q += n;
}
 
/* update pointers */
z->next_out = p;
s->read = q;
 
/* done */
return r;
}
/shark/trunk/ports/zlib/crc32.c
0,0 → 1,162
/* crc32.c -- compute the CRC-32 of a data stream
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* @(#) $Id: crc32.c,v 1.1 2003-03-24 11:13:44 pj Exp $ */
 
#include "zlib.h"
 
#define local static
 
#ifdef DYNAMIC_CRC_TABLE
 
local int crc_table_empty = 1;
local uLongf crc_table[256];
local void make_crc_table OF((void));
 
/*
Generate a table for a byte-wise 32-bit CRC calculation on the polynomial:
x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
 
Polynomials over GF(2) are represented in binary, one bit per coefficient,
with the lowest powers in the most significant bit. Then adding polynomials
is just exclusive-or, and multiplying a polynomial by x is a right shift by
one. If we call the above polynomial p, and represent a byte as the
polynomial q, also with the lowest power in the most significant bit (so the
byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
where a mod b means the remainder after dividing a by b.
 
This calculation is done using the shift-register method of multiplying and
taking the remainder. The register is initialized to zero, and for each
incoming bit, x^32 is added mod p to the register if the bit is a one (where
x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
x (which is shifting right by one and adding x^32 mod p if the bit shifted
out is a one). We start with the highest power (least significant bit) of
q and repeat for all eight bits of q.
 
The table is simply the CRC of all possible eight bit values. This is all
the information needed to generate CRC's on data a byte at a time for all
combinations of CRC register values and incoming bytes.
*/
local void make_crc_table()
{
uLong c;
int n, k;
uLong poly; /* polynomial exclusive-or pattern */
/* terms of polynomial defining this crc (except x^32): */
static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
 
/* make exclusive-or pattern from polynomial (0xedb88320L) */
poly = 0L;
for (n = 0; n < sizeof(p)/sizeof(Byte); n++)
poly |= 1L << (31 - p[n]);
for (n = 0; n < 256; n++)
{
c = (uLong)n;
for (k = 0; k < 8; k++)
c = c & 1 ? poly ^ (c >> 1) : c >> 1;
crc_table[n] = c;
}
crc_table_empty = 0;
}
#else
/* ========================================================================
* Table of CRC-32's of all single-byte values (made by make_crc_table)
*/
local const uLongf crc_table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
0x2d02ef8dL
};
#endif
 
/* =========================================================================
* This function can be used by asm versions of crc32()
*/
const uLongf * ZEXPORT get_crc_table()
{
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty) make_crc_table();
#endif
return (const uLongf *)crc_table;
}
 
/* ========================================================================= */
#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
#define DO2(buf) DO1(buf); DO1(buf);
#define DO4(buf) DO2(buf); DO2(buf);
#define DO8(buf) DO4(buf); DO4(buf);
 
/* ========================================================================= */
uLong ZEXPORT crc32(crc, buf, len)
uLong crc;
const Bytef *buf;
uInt len;
{
if (buf == Z_NULL) return 0L;
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty)
make_crc_table();
#endif
crc = crc ^ 0xffffffffL;
while (len >= 8)
{
DO8(buf);
len -= 8;
}
if (len) do {
DO1(buf);
} while (--len);
return crc ^ 0xffffffffL;
}
/shark/trunk/ports/zlib/zutil.h
0,0 → 1,220
/* zutil.h -- internal interface and configuration of the compression library
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
 
/* @(#) $Id: zutil.h,v 1.1 2003-03-24 11:13:45 pj Exp $ */
 
#ifndef _Z_UTIL_H
#define _Z_UTIL_H
 
#include "zlib.h"
 
#ifdef STDC
# include <stddef.h>
# include <string.h>
# include <stdlib.h>
#endif
#ifdef NO_ERRNO_H
extern int errno;
#else
# include <errno.h>
#endif
 
#ifndef local
# define local static
#endif
/* compile with -Dlocal if your debugger can't find static symbols */
 
typedef unsigned char uch;
typedef uch FAR uchf;
typedef unsigned short ush;
typedef ush FAR ushf;
typedef unsigned long ulg;
 
extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */
 
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
 
#define ERR_RETURN(strm,err) \
return (strm->msg = (char*)ERR_MSG(err), (err))
/* To be used only when the state is known to be valid */
 
/* common constants */
 
#ifndef DEF_WBITS
# define DEF_WBITS MAX_WBITS
#endif
/* default windowBits for decompression. MAX_WBITS is for compression only */
 
#if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8
#else
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
#endif
/* default memLevel */
 
#define STORED_BLOCK 0
#define STATIC_TREES 1
#define DYN_TREES 2
/* The three kinds of block type */
 
#define MIN_MATCH 3
#define MAX_MATCH 258
/* The minimum and maximum match lengths */
 
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
 
/* target dependencies */
 
#ifdef MSDOS
# define OS_CODE 0x00
# if defined(__TURBOC__) || defined(__BORLANDC__)
# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
/* Allow compilation with ANSI keywords only enabled */
void _Cdecl farfree( void *block );
void *_Cdecl farmalloc( unsigned long nbytes );
# else
# include <alloc.h>
# endif
# else /* MSC or DJGPP */
# include <malloc.h>
# endif
#endif
 
#ifdef OS2
# define OS_CODE 0x06
#endif
 
#ifdef WIN32 /* Window 95 & Windows NT */
# define OS_CODE 0x0b
#endif
 
#if defined(VAXC) || defined(VMS)
# define OS_CODE 0x02
# define F_OPEN(name, mode) \
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
#endif
 
#ifdef AMIGA
# define OS_CODE 0x01
#endif
 
#if defined(ATARI) || defined(atarist)
# define OS_CODE 0x05
#endif
 
#if defined(MACOS) || defined(TARGET_OS_MAC)
# define OS_CODE 0x07
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
# include <unix.h> /* for fdopen */
# else
# ifndef fdopen
# define fdopen(fd,mode) NULL /* No fdopen() */
# endif
# endif
#endif
 
#ifdef __50SERIES /* Prime/PRIMOS */
# define OS_CODE 0x0F
#endif
 
#ifdef TOPS20
# define OS_CODE 0x0a
#endif
 
#if defined(_BEOS_) || defined(RISCOS)
# define fdopen(fd,mode) NULL /* No fdopen() */
#endif
 
#if (defined(_MSC_VER) && (_MSC_VER > 600))
# define fdopen(fd,type) _fdopen(fd,type)
#endif
 
 
/* Common defaults */
 
#ifndef OS_CODE
# define OS_CODE 0x03 /* assume Unix */
#endif
 
#ifndef F_OPEN
# define F_OPEN(name, mode) fopen((name), (mode))
#endif
 
/* functions */
 
#ifdef HAVE_STRERROR
extern char *strerror OF((int));
# define zstrerror(errnum) strerror(errnum)
#else
# define zstrerror(errnum) ""
#endif
 
#if defined(pyr)
# define NO_MEMCPY
#endif
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
/* 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).
* The __SC__ check is for Symantec.
*/
# define NO_MEMCPY
#endif
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
# define HAVE_MEMCPY
#endif
#ifdef HAVE_MEMCPY
# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
# define zmemcpy _fmemcpy
# define zmemcmp _fmemcmp
# define zmemzero(dest, len) _fmemset(dest, 0, len)
# else
# define zmemcpy memcpy
# define zmemcmp memcmp
# define zmemzero(dest, len) memset(dest, 0, len)
# endif
#else
extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
extern void zmemzero OF((Bytef* dest, uInt len));
#endif
 
/* Diagnostic functions */
#ifdef DEBUG
# include <stdio.h>
extern int z_verbose;
extern void z_error OF((char *m));
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
# define Trace(stderr,x) {if (z_verbose>=0) cprintf x ;}
# define Tracev(stderr,x) {if (z_verbose>0) cprintf x ;}
# define Tracevv(stderr,x) {if (z_verbose>1) cprintf x ;}
# define Tracec(c,(stderr,x)) {if (z_verbose>0 && (c)) cprintf (x) ;}
# define Tracecv(c,(stderr,x)) {if (z_verbose>1 && (c)) cprintf (x) ;}
#else
# define Assert(cond,msg)
# define Trace(x)
# define Tracev(x)
# define Tracevv(x)
# define Tracec(c,x)
# define Tracecv(c,x)
#endif
 
 
typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
uInt len));
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
void zcfree OF((voidpf opaque, voidpf ptr));
 
#define ZALLOC(strm, items, size) \
(*((strm)->zalloc))((strm)->opaque, (items), (size))
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
 
#endif /* _Z_UTIL_H */
/shark/trunk/ports/zlib/infutil.h
0,0 → 1,98
/* infutil.h -- types and macros common to blocks and codes
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
 
#ifndef _INFUTIL_H
#define _INFUTIL_H
 
typedef enum {
TYPE, /* get type bits (3, including end bit) */
LENS, /* get lengths for stored */
STORED, /* processing stored block */
TABLE, /* get table lengths */
BTREE, /* get bit lengths tree for a dynamic block */
DTREE, /* get length, distance trees for a dynamic block */
CODES, /* processing fixed or dynamic block */
DRY, /* output remaining window bytes */
DONE, /* finished last block, done */
BAD} /* got a data error--stuck here */
inflate_block_mode;
 
/* inflate blocks semi-private state */
struct inflate_blocks_state {
 
/* mode */
inflate_block_mode mode; /* current inflate_block mode */
 
/* mode dependent information */
union {
uInt left; /* if STORED, bytes left to copy */
struct {
uInt table; /* table lengths (14 bits) */
uInt index; /* index into blens (or border) */
uIntf *blens; /* bit lengths of codes */
uInt bb; /* bit length tree depth */
inflate_huft *tb; /* bit length decoding tree */
} trees; /* if DTREE, decoding info for trees */
struct {
inflate_codes_statef
*codes;
} decode; /* if CODES, current state */
} sub; /* submode */
uInt last; /* true if this block is the last block */
 
/* mode independent information */
uInt bitk; /* bits in bit buffer */
uLong bitb; /* bit buffer */
inflate_huft *hufts; /* single malloc for tree space */
Bytef *window; /* sliding window */
Bytef *end; /* one byte after sliding window */
Bytef *read; /* window read pointer */
Bytef *write; /* window write pointer */
check_func checkfn; /* check function */
uLong check; /* check on output */
 
};
 
 
/* defines for inflate input/output */
/* update pointers and return */
#define UPDBITS {s->bitb=b;s->bitk=k;}
#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
#define UPDOUT {s->write=q;}
#define UPDATE {UPDBITS UPDIN UPDOUT}
#define LEAVE {UPDATE return inflate_flush(s,z,r);}
/* get bytes and bits */
#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}
#define NEEDBYTE {if(n)r=Z_OK;else LEAVE}
#define NEXTBYTE (n--,*p++)
#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}
#define DUMPBITS(j) {b>>=(j);k-=(j);}
/* output bytes */
#define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)
#define LOADOUT {q=s->write;m=(uInt)WAVAIL;}
#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}
#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
#define OUTBYTE(a) {*q++=(Byte)(a);m--;}
/* load local pointers */
#define LOAD {LOADIN LOADOUT}
 
/* masks for lower bits (size given to avoid silly warnings with Visual C++) */
extern uInt inflate_mask[17];
 
/* copy as much as possible from the sliding window to the output area */
extern int inflate_flush OF((
inflate_blocks_statef *,
z_streamp ,
int));
 
struct internal_state {int dummy;}; /* for buggy compilers */
 
#endif
/shark/trunk/ports/zlib/inftrees.c
0,0 → 1,454
/* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
#include "zutil.h"
#include "inftrees.h"
 
#if !defined(BUILDFIXED) && !defined(STDC)
# define BUILDFIXED /* non ANSI compilers may not accept inffixed.h */
#endif
 
const char inflate_copyright[] =
" inflate 1.1.4 Copyright 1995-2002 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
include such an acknowledgment, I would appreciate that you keep this
copyright string in the executable of your product.
*/
struct internal_state {int dummy;}; /* for buggy compilers */
 
/* simplify the use of the inflate_huft type with some defines */
#define exop word.what.Exop
#define bits word.what.Bits
 
 
local int huft_build OF((
uIntf *, /* code lengths in bits */
uInt, /* number of codes */
uInt, /* number of "simple" codes */
const uIntf *, /* list of base values for non-simple codes */
const uIntf *, /* list of extra bits for non-simple codes */
inflate_huft * FAR*,/* result: starting table */
uIntf *, /* maximum lookup bits (returns actual) */
inflate_huft *, /* space for trees */
uInt *, /* hufts used in space */
uIntf * )); /* space for values */
 
/* Tables for deflate from PKZIP's appnote.txt. */
local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
/* see note #13 above about 258 */
local const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */
local const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
8193, 12289, 16385, 24577};
local const uInt cpdext[30] = { /* Extra bits for distance codes */
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
12, 12, 13, 13};
 
/*
Huffman code decoding is performed using a multi-level table lookup.
The fastest way to decode is to simply build a lookup table whose
size is determined by the longest code. However, the time it takes
to build this table can also be a factor if the data being decoded
is not very long. The most common codes are necessarily the
shortest codes, so those codes dominate the decoding time, and hence
the speed. The idea is you can have a shorter table that decodes the
shorter, more probable codes, and then point to subsidiary tables for
the longer codes. The time it costs to decode the longer codes is
then traded against the time it takes to make longer tables.
 
This results of this trade are in the variables lbits and dbits
below. lbits is the number of bits the first level table for literal/
length codes can decode in one step, and dbits is the same thing for
the distance codes. Subsequent tables are also less than or equal to
those sizes. These values may be adjusted either when all of the
codes are shorter than that, in which case the longest code length in
bits is used, or when the shortest code is *longer* than the requested
table size, in which case the length of the shortest code in bits is
used.
 
There are two different values for the two tables, since they code a
different number of possibilities each. The literal/length table
codes 286 possible values, or in a flat code, a little over eight
bits. The distance table codes 30 possible values, or a little less
than five bits, flat. The optimum values for speed end up being
about one bit more than those, so lbits is 8+1 and dbits is 5+1.
The optimum values may differ though from machine to machine, and
possibly even between compilers. Your mileage may vary.
*/
 
 
/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
#define BMAX 15 /* maximum bit length of any code */
 
local int huft_build(b, n, s, d, e, t, m, hp, hn, v)
uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
uInt n; /* number of codes (assumed <= 288) */
uInt s; /* number of simple-valued codes (0..s-1) */
const uIntf *d; /* list of base values for non-simple codes */
const uIntf *e; /* list of extra bits for non-simple codes */
inflate_huft * FAR *t; /* result: starting table */
uIntf *m; /* maximum lookup bits, returns actual */
inflate_huft *hp; /* space for trees */
uInt *hn; /* hufts used in space */
uIntf *v; /* working area: values in order of bit length */
/* Given a list of code lengths and a maximum table size, make a set of
tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR
if the given code set is incomplete (the tables are still built in this
case), or Z_DATA_ERROR if the input is invalid. */
{
 
uInt a; /* counter for codes of length k */
uInt c[BMAX+1]; /* bit length count table */
uInt f; /* i repeats in table every f entries */
int g; /* maximum code length */
int h; /* table level */
register uInt i; /* counter, current code */
register uInt j; /* counter */
register int k; /* number of bits in current code */
int l; /* bits per table (returned in m) */
uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */
register uIntf *p; /* pointer into c[], b[], or v[] */
inflate_huft *q; /* points to current table */
struct inflate_huft_s r; /* table entry for structure assignment */
inflate_huft *u[BMAX]; /* table stack */
register int w; /* bits before this table == (l * h) */
uInt x[BMAX+1]; /* bit offsets, then code stack */
uIntf *xp; /* pointer into x */
int y; /* number of dummy codes added */
uInt z; /* number of entries in current table */
 
 
/* Generate counts for each bit length */
p = c;
#define C0 *p++ = 0;
#define C2 C0 C0 C0 C0
#define C4 C2 C2 C2 C2
C4 /* clear c[]--assume BMAX+1 is 16 */
p = b; i = n;
do {
c[*p++]++; /* assume all entries <= BMAX */
} while (--i);
if (c[0] == n) /* null input--all zero length codes */
{
*t = (inflate_huft *)Z_NULL;
*m = 0;
return Z_OK;
}
 
 
/* Find minimum and maximum length, bound *m by those */
l = *m;
for (j = 1; j <= BMAX; j++)
if (c[j])
break;
k = j; /* minimum code length */
if ((uInt)l < j)
l = j;
for (i = BMAX; i; i--)
if (c[i])
break;
g = i; /* maximum code length */
if ((uInt)l > i)
l = i;
*m = l;
 
 
/* Adjust last length count to fill out codes, if needed */
for (y = 1 << j; j < i; j++, y <<= 1)
if ((y -= c[j]) < 0)
return Z_DATA_ERROR;
if ((y -= c[i]) < 0)
return Z_DATA_ERROR;
c[i] += y;
 
 
/* Generate starting offsets into the value table for each length */
x[1] = j = 0;
p = c + 1; xp = x + 2;
while (--i) { /* note that i == g from above */
*xp++ = (j += *p++);
}
 
 
/* Make a table of values in order of bit lengths */
p = b; i = 0;
do {
if ((j = *p++) != 0)
v[x[j]++] = i;
} while (++i < n);
n = x[g]; /* set n to length of v */
 
 
/* Generate the Huffman codes and for each, make the table entries */
x[0] = i = 0; /* first Huffman code is zero */
p = v; /* grab values in bit order */
h = -1; /* no tables yet--level -1 */
w = -l; /* bits decoded == (l * h) */
u[0] = (inflate_huft *)Z_NULL; /* just to keep compilers happy */
q = (inflate_huft *)Z_NULL; /* ditto */
z = 0; /* ditto */
 
/* go through the bit lengths (k already is bits in shortest code) */
for (; k <= g; k++)
{
a = c[k];
while (a--)
{
/* here i is the Huffman code of length k bits for value *p */
/* make tables up to required level */
while (k > w + l)
{
h++;
w += l; /* previous table always l bits */
 
/* compute minimum size table less than or equal to l bits */
z = g - w;
z = z > (uInt)l ? l : z; /* table size upper limit */
if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */
{ /* too few codes for k-w bit table */
f -= a + 1; /* deduct codes from patterns left */
xp = c + k;
if (j < z)
while (++j < z) /* try smaller tables up to z bits */
{
if ((f <<= 1) <= *++xp)
break; /* enough codes to use up j bits */
f -= *xp; /* else deduct codes from patterns */
}
}
z = 1 << j; /* table entries for j-bit table */
 
/* allocate new table */
if (*hn + z > MANY) /* (note: doesn't matter for fixed) */
return Z_DATA_ERROR; /* overflow of MANY */
u[h] = q = hp + *hn;
*hn += z;
 
/* connect to last table, if there is one */
if (h)
{
x[h] = i; /* save pattern for backing up */
r.bits = (Byte)l; /* bits to dump before this table */
r.exop = (Byte)j; /* bits in this table */
j = i >> (w - l);
r.base = (uInt)(q - u[h-1] - j); /* offset to this table */
u[h-1][j] = r; /* connect to last table */
}
else
*t = q; /* first table is returned result */
}
 
/* set up table entry in r */
r.bits = (Byte)(k - w);
if (p >= v + n)
r.exop = 128 + 64; /* out of values--invalid code */
else if (*p < s)
{
r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */
r.base = *p++; /* simple code is just the value */
}
else
{
r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */
r.base = d[*p++ - s];
}
 
/* fill code-like entries with r */
f = 1 << (k - w);
for (j = i >> w; j < z; j += f)
q[j] = r;
 
/* backwards increment the k-bit code i */
for (j = 1 << (k - 1); i & j; j >>= 1)
i ^= j;
i ^= j;
 
/* backup over finished tables */
mask = (1 << w) - 1; /* needed on HP, cc -O bug */
while ((i & mask) != x[h])
{
h--; /* don't need to update q */
w -= l;
mask = (1 << w) - 1;
}
}
}
 
 
/* Return Z_BUF_ERROR if we were given an incomplete table */
return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
}
 
 
int inflate_trees_bits(c, bb, tb, hp, z)
uIntf *c; /* 19 code lengths */
uIntf *bb; /* bits tree desired/actual depth */
inflate_huft * FAR *tb; /* bits tree result */
inflate_huft *hp; /* space for trees */
z_streamp z; /* for messages */
{
int r;
uInt hn = 0; /* hufts used in space */
uIntf *v; /* work area for huft_build */
 
if ((v = (uIntf*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL)
return Z_MEM_ERROR;
r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL,
tb, bb, hp, &hn, v);
if (r == Z_DATA_ERROR)
z->msg = (char*)"oversubscribed dynamic bit lengths tree";
else if (r == Z_BUF_ERROR || *bb == 0)
{
z->msg = (char*)"incomplete dynamic bit lengths tree";
r = Z_DATA_ERROR;
}
ZFREE(z, v);
return r;
}
 
 
int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
uInt nl; /* number of literal/length codes */
uInt nd; /* number of distance codes */
uIntf *c; /* that many (total) code lengths */
uIntf *bl; /* literal desired/actual bit depth */
uIntf *bd; /* distance desired/actual bit depth */
inflate_huft * FAR *tl; /* literal/length tree result */
inflate_huft * FAR *td; /* distance tree result */
inflate_huft *hp; /* space for trees */
z_streamp z; /* for messages */
{
int r;
uInt hn = 0; /* hufts used in space */
uIntf *v; /* work area for huft_build */
 
/* allocate work area */
if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
return Z_MEM_ERROR;
 
/* build literal/length tree */
r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v);
if (r != Z_OK || *bl == 0)
{
if (r == Z_DATA_ERROR)
z->msg = (char*)"oversubscribed literal/length tree";
else if (r != Z_MEM_ERROR)
{
z->msg = (char*)"incomplete literal/length tree";
r = Z_DATA_ERROR;
}
ZFREE(z, v);
return r;
}
 
/* build distance tree */
r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v);
if (r != Z_OK || (*bd == 0 && nl > 257))
{
if (r == Z_DATA_ERROR)
z->msg = (char*)"oversubscribed distance tree";
else if (r == Z_BUF_ERROR) {
#ifdef PKZIP_BUG_WORKAROUND
r = Z_OK;
}
#else
z->msg = (char*)"incomplete distance tree";
r = Z_DATA_ERROR;
}
else if (r != Z_MEM_ERROR)
{
z->msg = (char*)"empty distance tree with lengths";
r = Z_DATA_ERROR;
}
ZFREE(z, v);
return r;
#endif
}
 
/* done */
ZFREE(z, v);
return Z_OK;
}
 
 
/* build fixed tables only once--keep them here */
#ifdef BUILDFIXED
local int fixed_built = 0;
#define FIXEDH 544 /* number of hufts used by fixed tables */
local inflate_huft fixed_mem[FIXEDH];
local uInt fixed_bl;
local uInt fixed_bd;
local inflate_huft *fixed_tl;
local inflate_huft *fixed_td;
#else
#include "inffixed.h"
#endif
 
 
int inflate_trees_fixed(bl, bd, tl, td, z)
uIntf *bl; /* literal desired/actual bit depth */
uIntf *bd; /* distance desired/actual bit depth */
inflate_huft * FAR *tl; /* literal/length tree result */
inflate_huft * FAR *td; /* distance tree result */
z_streamp z; /* for memory allocation */
{
#ifdef BUILDFIXED
/* build fixed tables if not already */
if (!fixed_built)
{
int k; /* temporary variable */
uInt f = 0; /* number of hufts used in fixed_mem */
uIntf *c; /* length list for huft_build */
uIntf *v; /* work area for huft_build */
 
/* allocate memory */
if ((c = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
return Z_MEM_ERROR;
if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
{
ZFREE(z, c);
return Z_MEM_ERROR;
}
 
/* literal table */
for (k = 0; k < 144; k++)
c[k] = 8;
for (; k < 256; k++)
c[k] = 9;
for (; k < 280; k++)
c[k] = 7;
for (; k < 288; k++)
c[k] = 8;
fixed_bl = 9;
huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl,
fixed_mem, &f, v);
 
/* distance table */
for (k = 0; k < 30; k++)
c[k] = 5;
fixed_bd = 5;
huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd,
fixed_mem, &f, v);
 
/* done */
ZFREE(z, v);
ZFREE(z, c);
fixed_built = 1;
}
#endif
*bl = fixed_bl;
*bd = fixed_bd;
*tl = fixed_tl;
*td = fixed_td;
return Z_OK;
}
/shark/trunk/ports/zlib/trees.c
0,0 → 1,1214
/* trees.c -- output deflated data using Huffman coding
* Copyright (C) 1995-2002 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/*
* ALGORITHM
*
* The "deflation" process uses several Huffman trees. The more
* common source values are represented by shorter bit sequences.
*
* Each code tree is stored in a compressed form which is itself
* a Huffman encoding of the lengths of all the code strings (in
* ascending order by source values). The actual code strings are
* reconstructed from the lengths in the inflate process, as described
* in the deflate specification.
*
* REFERENCES
*
* Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
* Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
*
* Storer, James A.
* Data Compression: Methods and Theory, pp. 49-50.
* Computer Science Press, 1988. ISBN 0-7167-8156-5.
*
* Sedgewick, R.
* Algorithms, p290.
* Addison-Wesley, 1983. ISBN 0-201-06672-6.
*/
 
/* @(#) $Id: trees.c,v 1.1 2003-03-24 11:13:44 pj Exp $ */
 
/* #define GEN_TREES_H */
 
#include "deflate.h"
 
#ifdef DEBUG
# include <ctype.h>
#endif
 
/* ===========================================================================
* Constants
*/
 
#define MAX_BL_BITS 7
/* Bit length codes must not exceed MAX_BL_BITS bits */
 
#define END_BLOCK 256
/* end of block literal code */
 
#define REP_3_6 16
/* repeat previous bit length 3-6 times (2 bits of repeat count) */
 
#define REPZ_3_10 17
/* repeat a zero length 3-10 times (3 bits of repeat count) */
 
#define REPZ_11_138 18
/* repeat a zero length 11-138 times (7 bits of repeat count) */
 
local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
= {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
 
local const int extra_dbits[D_CODES] /* extra bits for each distance code */
= {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
 
local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
 
local const uch bl_order[BL_CODES]
= {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
/* The lengths of the bit length codes are sent in order of decreasing
* probability, to avoid transmitting the lengths for unused bit length codes.
*/
 
#define Buf_size (8 * 2*sizeof(char))
/* Number of bits used within bi_buf. (bi_buf might be implemented on
* more than 16 bits on some systems.)
*/
 
/* ===========================================================================
* Local data. These are initialized only once.
*/
 
#define DIST_CODE_LEN 512 /* see definition of array dist_code below */
 
#if defined(GEN_TREES_H) || !defined(STDC)
/* non ANSI compilers may not accept trees.h */
 
local ct_data static_ltree[L_CODES+2];
/* The static literal tree. Since the bit lengths are imposed, there is no
* need for the L_CODES extra codes used during heap construction. However
* The codes 286 and 287 are needed to build a canonical tree (see _tr_init
* below).
*/
 
local ct_data static_dtree[D_CODES];
/* The static distance tree. (Actually a trivial tree since all codes use
* 5 bits.)
*/
 
uch _dist_code[DIST_CODE_LEN];
/* Distance codes. The first 256 values correspond to the distances
* 3 .. 258, the last 256 values correspond to the top 8 bits of
* the 15 bit distances.
*/
 
uch _length_code[MAX_MATCH-MIN_MATCH+1];
/* length code for each normalized match length (0 == MIN_MATCH) */
 
local int base_length[LENGTH_CODES];
/* First normalized length for each code (0 = MIN_MATCH) */
 
local int base_dist[D_CODES];
/* First normalized distance for each code (0 = distance of 1) */
 
#else
# include "trees.h"
#endif /* GEN_TREES_H */
 
struct static_tree_desc_s {
const ct_data *static_tree; /* static tree or NULL */
const intf *extra_bits; /* extra bits for each code or NULL */
int extra_base; /* base index for extra_bits */
int elems; /* max number of elements in the tree */
int max_length; /* max bit length for the codes */
};
 
local static_tree_desc static_l_desc =
{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
 
local static_tree_desc static_d_desc =
{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
 
local static_tree_desc static_bl_desc =
{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
 
/* ===========================================================================
* Local (static) routines in this file.
*/
 
local void tr_static_init OF((void));
local void init_block OF((deflate_state *s));
local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
local void build_tree OF((deflate_state *s, tree_desc *desc));
local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
local int build_bl_tree OF((deflate_state *s));
local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
int blcodes));
local void compress_block OF((deflate_state *s, ct_data *ltree,
ct_data *dtree));
local void set_data_type OF((deflate_state *s));
local unsigned bi_reverse OF((unsigned value, int length));
local void bi_windup OF((deflate_state *s));
local void bi_flush OF((deflate_state *s));
local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
int header));
 
#ifdef GEN_TREES_H
local void gen_trees_header OF((void));
#endif
 
#ifndef DEBUG
# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
/* Send a code of the given tree. c and tree must not have side effects */
 
#else /* DEBUG */
# define send_code(s, c, tree) \
{ if (z_verbose>2) cprintf("\ncd %3d ",(c)); \
send_bits(s, tree[c].Code, tree[c].Len); }
#endif
 
/* ===========================================================================
* Output a short LSB first on the stream.
* IN assertion: there is enough room in pendingBuf.
*/
#define put_short(s, w) { \
put_byte(s, (uch)((w) & 0xff)); \
put_byte(s, (uch)((ush)(w) >> 8)); \
}
 
/* ===========================================================================
* Send a value on a given number of bits.
* IN assertion: length <= 16 and value fits in length bits.
*/
#ifdef DEBUG
local void send_bits OF((deflate_state *s, int value, int length));
 
local void send_bits(s, value, length)
deflate_state *s;
int value; /* value to send */
int length; /* number of bits */
{
Tracevv((stderr," l %2d v %4x ", length, value));
Assert(length > 0 && length <= 15, "invalid length");
s->bits_sent += (ulg)length;
 
/* If not enough room in bi_buf, use (valid) bits from bi_buf and
* (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
* unused bits in value.
*/
if (s->bi_valid > (int)Buf_size - length) {
s->bi_buf |= (value << s->bi_valid);
put_short(s, s->bi_buf);
s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
s->bi_valid += length - Buf_size;
} else {
s->bi_buf |= value << s->bi_valid;
s->bi_valid += length;
}
}
#else /* !DEBUG */
 
#define send_bits(s, value, length) \
{ int len = length;\
if (s->bi_valid > (int)Buf_size - len) {\
int val = value;\
s->bi_buf |= (val << s->bi_valid);\
put_short(s, s->bi_buf);\
s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
s->bi_valid += len - Buf_size;\
} else {\
s->bi_buf |= (value) << s->bi_valid;\
s->bi_valid += len;\
}\
}
#endif /* DEBUG */
 
 
#define MAX(a,b) (a >= b ? a : b)
/* the arguments must not have side effects */
 
/* ===========================================================================
* Initialize the various 'constant' tables.
*/
local void tr_static_init()
{
#if defined(GEN_TREES_H) || !defined(STDC)
static int static_init_done = 0;
int n; /* iterates over tree elements */
int bits; /* bit counter */
int length; /* length value */
int code; /* code value */
int dist; /* distance index */
ush bl_count[MAX_BITS+1];
/* number of codes at each bit length for an optimal tree */
 
if (static_init_done) return;
 
/* For some embedded targets, global variables are not initialized: */
static_l_desc.static_tree = static_ltree;
static_l_desc.extra_bits = extra_lbits;
static_d_desc.static_tree = static_dtree;
static_d_desc.extra_bits = extra_dbits;
static_bl_desc.extra_bits = extra_blbits;
 
/* Initialize the mapping length (0..255) -> length code (0..28) */
length = 0;
for (code = 0; code < LENGTH_CODES-1; code++) {
base_length[code] = length;
for (n = 0; n < (1<<extra_lbits[code]); n++) {
_length_code[length++] = (uch)code;
}
}
Assert (length == 256, "tr_static_init: length != 256");
/* Note that the length 255 (match length 258) can be represented
* in two different ways: code 284 + 5 bits or code 285, so we
* overwrite length_code[255] to use the best encoding:
*/
_length_code[length-1] = (uch)code;
 
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
dist = 0;
for (code = 0 ; code < 16; code++) {
base_dist[code] = dist;
for (n = 0; n < (1<<extra_dbits[code]); n++) {
_dist_code[dist++] = (uch)code;
}
}
Assert (dist == 256, "tr_static_init: dist != 256");
dist >>= 7; /* from now on, all distances are divided by 128 */
for ( ; code < D_CODES; code++) {
base_dist[code] = dist << 7;
for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
_dist_code[256 + dist++] = (uch)code;
}
}
Assert (dist == 256, "tr_static_init: 256+dist != 512");
 
/* Construct the codes of the static literal tree */
for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
n = 0;
while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
/* Codes 286 and 287 do not exist, but we must include them in the
* tree construction to get a canonical Huffman tree (longest code
* all ones)
*/
gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
 
/* The static distance tree is trivial: */
for (n = 0; n < D_CODES; n++) {
static_dtree[n].Len = 5;
static_dtree[n].Code = bi_reverse((unsigned)n, 5);
}
static_init_done = 1;
 
# ifdef GEN_TREES_H
gen_trees_header();
# endif
#endif /* defined(GEN_TREES_H) || !defined(STDC) */
}
 
/* ===========================================================================
* Genererate the file trees.h describing the static trees.
*/
#ifdef GEN_TREES_H
# ifndef DEBUG
# include <stdio.h>
# endif
 
# define SEPARATOR(i, last, width) \
((i) == (last)? "\n};\n\n" : \
((i) % (width) == (width)-1 ? ",\n" : ", "))
 
void gen_trees_header()
{
FILE *header = fopen("trees.h", "w");
int i;
 
Assert (header != NULL, "Can't open trees.h");
fprintf(header,
"/* header created automatically with -DGEN_TREES_H */\n\n");
 
fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
for (i = 0; i < L_CODES+2; i++) {
fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
}
 
fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
for (i = 0; i < D_CODES; i++) {
fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
}
 
fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
for (i = 0; i < DIST_CODE_LEN; i++) {
fprintf(header, "%2u%s", _dist_code[i],
SEPARATOR(i, DIST_CODE_LEN-1, 20));
}
 
fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
fprintf(header, "%2u%s", _length_code[i],
SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
}
 
fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
for (i = 0; i < LENGTH_CODES; i++) {
fprintf(header, "%1u%s", base_length[i],
SEPARATOR(i, LENGTH_CODES-1, 20));
}
 
fprintf(header, "local const int base_dist[D_CODES] = {\n");
for (i = 0; i < D_CODES; i++) {
fprintf(header, "%5u%s", base_dist[i],
SEPARATOR(i, D_CODES-1, 10));
}
 
fclose(header);
}
#endif /* GEN_TREES_H */
 
/* ===========================================================================
* Initialize the tree data structures for a new zlib stream.
*/
void _tr_init(s)
deflate_state *s;
{
tr_static_init();
 
s->l_desc.dyn_tree = s->dyn_ltree;
s->l_desc.stat_desc = &static_l_desc;
 
s->d_desc.dyn_tree = s->dyn_dtree;
s->d_desc.stat_desc = &static_d_desc;
 
s->bl_desc.dyn_tree = s->bl_tree;
s->bl_desc.stat_desc = &static_bl_desc;
 
s->bi_buf = 0;
s->bi_valid = 0;
s->last_eob_len = 8; /* enough lookahead for inflate */
#ifdef DEBUG
s->compressed_len = 0L;
s->bits_sent = 0L;
#endif
 
/* Initialize the first block of the first file: */
init_block(s);
}
 
/* ===========================================================================
* Initialize a new block.
*/
local void init_block(s)
deflate_state *s;
{
int n; /* iterates over tree elements */
 
/* Initialize the trees. */
for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
 
s->dyn_ltree[END_BLOCK].Freq = 1;
s->opt_len = s->static_len = 0L;
s->last_lit = s->matches = 0;
}
 
#define SMALLEST 1
/* Index within the heap array of least frequent node in the Huffman tree */
 
 
/* ===========================================================================
* Remove the smallest element from the heap and recreate the heap with
* one less element. Updates heap and heap_len.
*/
#define pqremove(s, tree, top) \
{\
top = s->heap[SMALLEST]; \
s->heap[SMALLEST] = s->heap[s->heap_len--]; \
pqdownheap(s, tree, SMALLEST); \
}
 
/* ===========================================================================
* Compares to subtrees, using the tree depth as tie breaker when
* the subtrees have equal frequency. This minimizes the worst case length.
*/
#define smaller(tree, n, m, depth) \
(tree[n].Freq < tree[m].Freq || \
(tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
 
/* ===========================================================================
* Restore the heap property by moving down the tree starting at node k,
* exchanging a node with the smallest of its two sons if necessary, stopping
* when the heap property is re-established (each father smaller than its
* two sons).
*/
local void pqdownheap(s, tree, k)
deflate_state *s;
ct_data *tree; /* the tree to restore */
int k; /* node to move down */
{
int v = s->heap[k];
int j = k << 1; /* left son of k */
while (j <= s->heap_len) {
/* Set j to the smallest of the two sons: */
if (j < s->heap_len &&
smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
j++;
}
/* Exit if v is smaller than both sons */
if (smaller(tree, v, s->heap[j], s->depth)) break;
 
/* Exchange v with the smallest son */
s->heap[k] = s->heap[j]; k = j;
 
/* And continue down the tree, setting j to the left son of k */
j <<= 1;
}
s->heap[k] = v;
}
 
/* ===========================================================================
* Compute the optimal bit lengths for a tree and update the total bit length
* for the current block.
* IN assertion: the fields freq and dad are set, heap[heap_max] and
* above are the tree nodes sorted by increasing frequency.
* OUT assertions: the field len is set to the optimal bit length, the
* array bl_count contains the frequencies for each bit length.
* The length opt_len is updated; static_len is also updated if stree is
* not null.
*/
local void gen_bitlen(s, desc)
deflate_state *s;
tree_desc *desc; /* the tree descriptor */
{
ct_data *tree = desc->dyn_tree;
int max_code = desc->max_code;
const ct_data *stree = desc->stat_desc->static_tree;
const intf *extra = desc->stat_desc->extra_bits;
int base = desc->stat_desc->extra_base;
int max_length = desc->stat_desc->max_length;
int h; /* heap index */
int n, m; /* iterate over the tree elements */
int bits; /* bit length */
int xbits; /* extra bits */
ush f; /* frequency */
int overflow = 0; /* number of elements with bit length too large */
 
for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
 
/* In a first pass, compute the optimal bit lengths (which may
* overflow in the case of the bit length tree).
*/
tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
 
for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
n = s->heap[h];
bits = tree[tree[n].Dad].Len + 1;
if (bits > max_length) bits = max_length, overflow++;
tree[n].Len = (ush)bits;
/* We overwrite tree[n].Dad which is no longer needed */
 
if (n > max_code) continue; /* not a leaf node */
 
s->bl_count[bits]++;
xbits = 0;
if (n >= base) xbits = extra[n-base];
f = tree[n].Freq;
s->opt_len += (ulg)f * (bits + xbits);
if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
}
if (overflow == 0) return;
 
Trace((stderr,"\nbit length overflow\n"));
/* This happens for example on obj2 and pic of the Calgary corpus */
 
/* Find the first bit length which could increase: */
do {
bits = max_length-1;
while (s->bl_count[bits] == 0) bits--;
s->bl_count[bits]--; /* move one leaf down the tree */
s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
s->bl_count[max_length]--;
/* The brother of the overflow item also moves one step up,
* but this does not affect bl_count[max_length]
*/
overflow -= 2;
} while (overflow > 0);
 
/* Now recompute all bit lengths, scanning in increasing frequency.
* h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
* lengths instead of fixing only the wrong ones. This idea is taken
* from 'ar' written by Haruhiko Okumura.)
*/
for (bits = max_length; bits != 0; bits--) {
n = s->bl_count[bits];
while (n != 0) {
m = s->heap[--h];
if (m > max_code) continue;
if (tree[m].Len != (unsigned) bits) {
Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
s->opt_len += ((long)bits - (long)tree[m].Len)
*(long)tree[m].Freq;
tree[m].Len = (ush)bits;
}
n--;
}
}
}
 
/* ===========================================================================
* Generate the codes for a given tree and bit counts (which need not be
* optimal).
* IN assertion: the array bl_count contains the bit length statistics for
* the given tree and the field len is set for all tree elements.
* OUT assertion: the field code is set for all tree elements of non
* zero code length.
*/
local void gen_codes (tree, max_code, bl_count)
ct_data *tree; /* the tree to decorate */
int max_code; /* largest code with non zero frequency */
ushf *bl_count; /* number of codes at each bit length */
{
ush next_code[MAX_BITS+1]; /* next code value for each bit length */
ush code = 0; /* running code value */
int bits; /* bit index */
int n; /* code index */
 
/* The distribution counts are first used to generate the code values
* without bit reversal.
*/
for (bits = 1; bits <= MAX_BITS; bits++) {
next_code[bits] = code = (code + bl_count[bits-1]) << 1;
}
/* Check that the bit counts in bl_count are consistent. The last code
* must be all ones.
*/
Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
"inconsistent bit counts");
Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
 
for (n = 0; n <= max_code; n++) {
int len = tree[n].Len;
if (len == 0) continue;
/* Now reverse the bits */
tree[n].Code = bi_reverse(next_code[len]++, len);
 
Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
}
}
 
/* ===========================================================================
* Construct one Huffman tree and assigns the code bit strings and lengths.
* Update the total bit length for the current block.
* IN assertion: the field freq is set for all tree elements.
* OUT assertions: the fields len and code are set to the optimal bit length
* and corresponding code. The length opt_len is updated; static_len is
* also updated if stree is not null. The field max_code is set.
*/
local void build_tree(s, desc)
deflate_state *s;
tree_desc *desc; /* the tree descriptor */
{
ct_data *tree = desc->dyn_tree;
const ct_data *stree = desc->stat_desc->static_tree;
int elems = desc->stat_desc->elems;
int n, m; /* iterate over heap elements */
int max_code = -1; /* largest code with non zero frequency */
int node; /* new node being created */
 
/* Construct the initial heap, with least frequent element in
* heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
* heap[0] is not used.
*/
s->heap_len = 0, s->heap_max = HEAP_SIZE;
 
for (n = 0; n < elems; n++) {
if (tree[n].Freq != 0) {
s->heap[++(s->heap_len)] = max_code = n;
s->depth[n] = 0;
} else {
tree[n].Len = 0;
}
}
 
/* The pkzip format requires that at least one distance code exists,
* and that at least one bit should be sent even if there is only one
* possible code. So to avoid special checks later on we force at least
* two codes of non zero frequency.
*/
while (s->heap_len < 2) {
node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
tree[node].Freq = 1;
s->depth[node] = 0;
s->opt_len--; if (stree) s->static_len -= stree[node].Len;
/* node is 0 or 1 so it does not have extra bits */
}
desc->max_code = max_code;
 
/* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
* establish sub-heaps of increasing lengths:
*/
for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
 
/* Construct the Huffman tree by repeatedly combining the least two
* frequent nodes.
*/
node = elems; /* next internal node of the tree */
do {
pqremove(s, tree, n); /* n = node of least frequency */
m = s->heap[SMALLEST]; /* m = node of next least frequency */
 
s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
s->heap[--(s->heap_max)] = m;
 
/* Create a new node father of n and m */
tree[node].Freq = tree[n].Freq + tree[m].Freq;
s->depth[node] = (uch) (MAX(s->depth[n], s->depth[m]) + 1);
tree[n].Dad = tree[m].Dad = (ush)node;
#ifdef DUMP_BL_TREE
if (tree == s->bl_tree) {
cprintf("\nnode %d(%d), sons %d(%d) %d(%d)",
node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
}
#endif
/* and insert the new node in the heap */
s->heap[SMALLEST] = node++;
pqdownheap(s, tree, SMALLEST);
 
} while (s->heap_len >= 2);
 
s->heap[--(s->heap_max)] = s->heap[SMALLEST];
 
/* At this point, the fields freq and dad are set. We can now
* generate the bit lengths.
*/
gen_bitlen(s, (tree_desc *)desc);
 
/* The field len is now set, we can generate the bit codes */
gen_codes ((ct_data *)tree, max_code, s->bl_count);
}
 
/* ===========================================================================
* Scan a literal or distance tree to determine the frequencies of the codes
* in the bit length tree.
*/
local void scan_tree (s, tree, max_code)
deflate_state *s;
ct_data *tree; /* the tree to be scanned */
int max_code; /* and its largest code of non zero frequency */
{
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
int curlen; /* length of current code */
int nextlen = tree[0].Len; /* length of next code */
int count = 0; /* repeat count of the current code */
int max_count = 7; /* max repeat count */
int min_count = 4; /* min repeat count */
 
if (nextlen == 0) max_count = 138, min_count = 3;
tree[max_code+1].Len = (ush)0xffff; /* guard */
 
for (n = 0; n <= max_code; n++) {
curlen = nextlen; nextlen = tree[n+1].Len;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
s->bl_tree[curlen].Freq += count;
} else if (curlen != 0) {
if (curlen != prevlen) s->bl_tree[curlen].Freq++;
s->bl_tree[REP_3_6].Freq++;
} else if (count <= 10) {
s->bl_tree[REPZ_3_10].Freq++;
} else {
s->bl_tree[REPZ_11_138].Freq++;
}
count = 0; prevlen = curlen;
if (nextlen == 0) {
max_count = 138, min_count = 3;
} else if (curlen == nextlen) {
max_count = 6, min_count = 3;
} else {
max_count = 7, min_count = 4;
}
}
}
 
/* ===========================================================================
* Send a literal or distance tree in compressed form, using the codes in
* bl_tree.
*/
local void send_tree (s, tree, max_code)
deflate_state *s;
ct_data *tree; /* the tree to be scanned */
int max_code; /* and its largest code of non zero frequency */
{
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
int curlen; /* length of current code */
int nextlen = tree[0].Len; /* length of next code */
int count = 0; /* repeat count of the current code */
int max_count = 7; /* max repeat count */
int min_count = 4; /* min repeat count */
 
/* tree[max_code+1].Len = -1; */ /* guard already set */
if (nextlen == 0) max_count = 138, min_count = 3;
 
for (n = 0; n <= max_code; n++) {
curlen = nextlen; nextlen = tree[n+1].Len;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
 
} else if (curlen != 0) {
if (curlen != prevlen) {
send_code(s, curlen, s->bl_tree); count--;
}
Assert(count >= 3 && count <= 6, " 3_6?");
send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
 
} else if (count <= 10) {
send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
 
} else {
send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
}
count = 0; prevlen = curlen;
if (nextlen == 0) {
max_count = 138, min_count = 3;
} else if (curlen == nextlen) {
max_count = 6, min_count = 3;
} else {
max_count = 7, min_count = 4;
}
}
}
 
/* ===========================================================================
* Construct the Huffman tree for the bit lengths and return the index in
* bl_order of the last bit length code to send.
*/
local int build_bl_tree(s)
deflate_state *s;
{
int max_blindex; /* index of last bit length code of non zero freq */
 
/* Determine the bit length frequencies for literal and distance trees */
scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
 
/* Build the bit length tree: */
build_tree(s, (tree_desc *)(&(s->bl_desc)));
/* opt_len now includes the length of the tree representations, except
* the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
*/
 
/* Determine the number of bit length codes to send. The pkzip format
* requires that at least 4 bit length codes be sent. (appnote.txt says
* 3 but the actual value used is 4.)
*/
for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
}
/* Update opt_len to include the bit length tree and counts */
s->opt_len += 3*(max_blindex+1) + 5+5+4;
Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
s->opt_len, s->static_len));
 
return max_blindex;
}
 
/* ===========================================================================
* Send the header for a block using dynamic Huffman trees: the counts, the
* lengths of the bit length codes, the literal tree and the distance tree.
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
*/
local void send_all_trees(s, lcodes, dcodes, blcodes)
deflate_state *s;
int lcodes, dcodes, blcodes; /* number of codes for each tree */
{
int rank; /* index in bl_order */
 
Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
"too many codes");
Tracev((stderr, "\nbl counts: "));
send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
send_bits(s, dcodes-1, 5);
send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
for (rank = 0; rank < blcodes; rank++) {
Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
}
Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
 
send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
 
send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
}
 
/* ===========================================================================
* Send a stored block
*/
void _tr_stored_block(s, buf, stored_len, eof)
deflate_state *s;
charf *buf; /* input block */
ulg stored_len; /* length of input block */
int eof; /* true if this is the last block for a file */
{
send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */
#ifdef DEBUG
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
s->compressed_len += (stored_len + 4) << 3;
#endif
copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
}
 
/* ===========================================================================
* Send one empty static block to give enough lookahead for inflate.
* This takes 10 bits, of which 7 may remain in the bit buffer.
* The current inflate code requires 9 bits of lookahead. If the
* last two codes for the previous block (real code plus EOB) were coded
* on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
* the last real code. In this case we send two empty static blocks instead
* of one. (There are no problems if the previous block is stored or fixed.)
* To simplify the code, we assume the worst case of last real code encoded
* on one bit only.
*/
void _tr_align(s)
deflate_state *s;
{
send_bits(s, STATIC_TREES<<1, 3);
send_code(s, END_BLOCK, static_ltree);
#ifdef DEBUG
s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
#endif
bi_flush(s);
/* Of the 10 bits for the empty block, we have already sent
* (10 - bi_valid) bits. The lookahead for the last real code (before
* the EOB of the previous block) was thus at least one plus the length
* of the EOB plus what we have just sent of the empty static block.
*/
if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
send_bits(s, STATIC_TREES<<1, 3);
send_code(s, END_BLOCK, static_ltree);
#ifdef DEBUG
s->compressed_len += 10L;
#endif
bi_flush(s);
}
s->last_eob_len = 7;
}
 
/* ===========================================================================
* Determine the best encoding for the current block: dynamic trees, static
* trees or store, and output the encoded block to the zip file.
*/
void _tr_flush_block(s, buf, stored_len, eof)
deflate_state *s;
charf *buf; /* input block, or NULL if too old */
ulg stored_len; /* length of input block */
int eof; /* true if this is the last block for a file */
{
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
int max_blindex = 0; /* index of last bit length code of non zero freq */
 
/* Build the Huffman trees unless a stored block is forced */
if (s->level > 0) {
 
/* Check if the file is ascii or binary */
if (s->data_type == Z_UNKNOWN) set_data_type(s);
 
/* Construct the literal and distance trees */
build_tree(s, (tree_desc *)(&(s->l_desc)));
Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
s->static_len));
 
build_tree(s, (tree_desc *)(&(s->d_desc)));
Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
s->static_len));
/* At this point, opt_len and static_len are the total bit lengths of
* the compressed block data, excluding the tree representations.
*/
 
/* Build the bit length tree for the above two trees, and get the index
* in bl_order of the last bit length code to send.
*/
max_blindex = build_bl_tree(s);
 
/* Determine the best encoding. Compute first the block length in bytes*/
opt_lenb = (s->opt_len+3+7)>>3;
static_lenb = (s->static_len+3+7)>>3;
 
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
s->last_lit));
 
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
 
} else {
Assert(buf != (char*)0, "lost buf");
opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
}
 
#ifdef FORCE_STORED
if (buf != (char*)0) { /* force stored block */
#else
if (stored_len+4 <= opt_lenb && buf != (char*)0) {
/* 4: two words for the lengths */
#endif
/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
* Otherwise we can't have processed more than WSIZE input bytes since
* the last block flush, because compression would have been
* successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
* transform a block into a stored block.
*/
_tr_stored_block(s, buf, stored_len, eof);
 
#ifdef FORCE_STATIC
} else if (static_lenb >= 0) { /* force static trees */
#else
} else if (static_lenb == opt_lenb) {
#endif
send_bits(s, (STATIC_TREES<<1)+eof, 3);
compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
#ifdef DEBUG
s->compressed_len += 3 + s->static_len;
#endif
} else {
send_bits(s, (DYN_TREES<<1)+eof, 3);
send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
max_blindex+1);
compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
#ifdef DEBUG
s->compressed_len += 3 + s->opt_len;
#endif
}
Assert (s->compressed_len == s->bits_sent, "bad compressed size");
/* The above check is made mod 2^32, for files larger than 512 MB
* and uLong implemented on 32 bits.
*/
init_block(s);
 
if (eof) {
bi_windup(s);
#ifdef DEBUG
s->compressed_len += 7; /* align on byte boundary */
#endif
}
Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
s->compressed_len-7*eof));
}
 
/* ===========================================================================
* Save the match info and tally the frequency counts. Return true if
* the current block must be flushed.
*/
int _tr_tally (s, dist, lc)
deflate_state *s;
unsigned dist; /* distance of matched string */
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
{
s->d_buf[s->last_lit] = (ush)dist;
s->l_buf[s->last_lit++] = (uch)lc;
if (dist == 0) {
/* lc is the unmatched char */
s->dyn_ltree[lc].Freq++;
} else {
s->matches++;
/* Here, lc is the match length - MIN_MATCH */
dist--; /* dist = match distance - 1 */
Assert((ush)dist < (ush)MAX_DIST(s) &&
(ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
(ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
 
s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
s->dyn_dtree[d_code(dist)].Freq++;
}
 
#ifdef TRUNCATE_BLOCK
/* Try to guess if it is profitable to stop the current block here */
if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
/* Compute an upper bound for the compressed length */
ulg out_length = (ulg)s->last_lit*8L;
ulg in_length = (ulg)((long)s->strstart - s->block_start);
int dcode;
for (dcode = 0; dcode < D_CODES; dcode++) {
out_length += (ulg)s->dyn_dtree[dcode].Freq *
(5L+extra_dbits[dcode]);
}
out_length >>= 3;
Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
s->last_lit, in_length, out_length,
100L - out_length*100L/in_length));
if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
}
#endif
return (s->last_lit == s->lit_bufsize-1);
/* We avoid equality with lit_bufsize because of wraparound at 64K
* on 16 bit machines and because stored blocks are restricted to
* 64K-1 bytes.
*/
}
 
/* ===========================================================================
* Send the block data compressed using the given Huffman trees
*/
local void compress_block(s, ltree, dtree)
deflate_state *s;
ct_data *ltree; /* literal tree */
ct_data *dtree; /* distance tree */
{
unsigned dist; /* distance of matched string */
int lc; /* match length or unmatched char (if dist == 0) */
unsigned lx = 0; /* running index in l_buf */
unsigned code; /* the code to send */
int extra; /* number of extra bits to send */
 
if (s->last_lit != 0) do {
dist = s->d_buf[lx];
lc = s->l_buf[lx++];
if (dist == 0) {
send_code(s, lc, ltree); /* send a literal byte */
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
} else {
/* Here, lc is the match length - MIN_MATCH */
code = _length_code[lc];
send_code(s, code+LITERALS+1, ltree); /* send the length code */
extra = extra_lbits[code];
if (extra != 0) {
lc -= base_length[code];
send_bits(s, lc, extra); /* send the extra length bits */
}
dist--; /* dist is now the match distance - 1 */
code = d_code(dist);
Assert (code < D_CODES, "bad d_code");
 
send_code(s, code, dtree); /* send the distance code */
extra = extra_dbits[code];
if (extra != 0) {
dist -= base_dist[code];
send_bits(s, dist, extra); /* send the extra distance bits */
}
} /* literal or match pair ? */
 
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow");
 
} while (lx < s->last_lit);
 
send_code(s, END_BLOCK, ltree);
s->last_eob_len = ltree[END_BLOCK].Len;
}
 
/* ===========================================================================
* Set the data type to ASCII or BINARY, using a crude approximation:
* binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
* IN assertion: the fields freq of dyn_ltree are set and the total of all
* frequencies does not exceed 64K (to fit in an int on 16 bit machines).
*/
local void set_data_type(s)
deflate_state *s;
{
int n = 0;
unsigned ascii_freq = 0;
unsigned bin_freq = 0;
while (n < 7) bin_freq += s->dyn_ltree[n++].Freq;
while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq;
while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII);
}
 
/* ===========================================================================
* Reverse the first len bits of a code, using straightforward code (a faster
* method would use a table)
* IN assertion: 1 <= len <= 15
*/
local unsigned bi_reverse(code, len)
unsigned code; /* the value to invert */
int len; /* its bit length */
{
register unsigned res = 0;
do {
res |= code & 1;
code >>= 1, res <<= 1;
} while (--len > 0);
return res >> 1;
}
 
/* ===========================================================================
* Flush the bit buffer, keeping at most 7 bits in it.
*/
local void bi_flush(s)
deflate_state *s;
{
if (s->bi_valid == 16) {
put_short(s, s->bi_buf);
s->bi_buf = 0;
s->bi_valid = 0;
} else if (s->bi_valid >= 8) {
put_byte(s, (Byte)s->bi_buf);
s->bi_buf >>= 8;
s->bi_valid -= 8;
}
}
 
/* ===========================================================================
* Flush the bit buffer and align the output on a byte boundary
*/
local void bi_windup(s)
deflate_state *s;
{
if (s->bi_valid > 8) {
put_short(s, s->bi_buf);
} else if (s->bi_valid > 0) {
put_byte(s, (Byte)s->bi_buf);
}
s->bi_buf = 0;
s->bi_valid = 0;
#ifdef DEBUG
s->bits_sent = (s->bits_sent+7) & ~7;
#endif
}
 
/* ===========================================================================
* Copy a stored block, storing first the length and its
* one's complement if requested.
*/
local void copy_block(s, buf, len, header)
deflate_state *s;
charf *buf; /* the input data */
unsigned len; /* its length */
int header; /* true if block header must be written */
{
bi_windup(s); /* align on byte boundary */
s->last_eob_len = 8; /* enough lookahead for inflate */
 
if (header) {
put_short(s, (ush)len);
put_short(s, (ush)~len);
#ifdef DEBUG
s->bits_sent += 2*16;
#endif
}
#ifdef DEBUG
s->bits_sent += (ulg)len<<3;
#endif
while (len--) {
put_byte(s, *buf++);
}
}
/shark/trunk/ports/zlib/inflate.c
0,0 → 1,366
/* inflate.c -- zlib interface to inflate modules
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
#include "zutil.h"
#include "infblock.h"
 
struct inflate_blocks_state {int dummy;}; /* for buggy compilers */
 
typedef enum {
METHOD, /* waiting for method byte */
FLAG, /* waiting for flag byte */
DICT4, /* four dictionary check bytes to go */
DICT3, /* three dictionary check bytes to go */
DICT2, /* two dictionary check bytes to go */
DICT1, /* one dictionary check byte to go */
DICT0, /* waiting for inflateSetDictionary */
BLOCKS, /* decompressing blocks */
CHECK4, /* four check bytes to go */
CHECK3, /* three check bytes to go */
CHECK2, /* two check bytes to go */
CHECK1, /* one check byte to go */
DONE, /* finished check, done */
BAD} /* got an error--stay here */
inflate_mode;
 
/* inflate private state */
struct internal_state {
 
/* mode */
inflate_mode mode; /* current inflate mode */
 
/* mode dependent information */
union {
uInt method; /* if FLAGS, method byte */
struct {
uLong was; /* computed check value */
uLong need; /* stream check value */
} check; /* if CHECK, check values to compare */
uInt marker; /* if BAD, inflateSync's marker bytes count */
} sub; /* submode */
 
/* mode independent information */
int nowrap; /* flag for no wrapper */
uInt wbits; /* log2(window size) (8..15, defaults to 15) */
inflate_blocks_statef
*blocks; /* current inflate_blocks state */
 
};
 
 
int ZEXPORT inflateReset(z)
z_streamp z;
{
if (z == Z_NULL || z->state == Z_NULL)
return Z_STREAM_ERROR;
z->total_in = z->total_out = 0;
z->msg = Z_NULL;
z->state->mode = z->state->nowrap ? BLOCKS : METHOD;
inflate_blocks_reset(z->state->blocks, z, Z_NULL);
Tracev((stderr, "inflate: reset\n"));
return Z_OK;
}
 
 
int ZEXPORT inflateEnd(z)
z_streamp z;
{
if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
return Z_STREAM_ERROR;
if (z->state->blocks != Z_NULL)
inflate_blocks_free(z->state->blocks, z);
ZFREE(z, z->state);
z->state = Z_NULL;
Tracev((stderr, "inflate: end\n"));
return Z_OK;
}
 
 
int ZEXPORT inflateInit2_(z, w, version, stream_size)
z_streamp z;
int w;
const char *version;
int stream_size;
{
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
stream_size != sizeof(z_stream))
return Z_VERSION_ERROR;
 
/* initialize state */
if (z == Z_NULL)
return Z_STREAM_ERROR;
z->msg = Z_NULL;
if (z->zalloc == Z_NULL)
{
z->zalloc = zcalloc;
z->opaque = (voidpf)0;
}
if (z->zfree == Z_NULL) z->zfree = zcfree;
if ((z->state = (struct internal_state FAR *)
ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL)
return Z_MEM_ERROR;
z->state->blocks = Z_NULL;
 
/* handle undocumented nowrap option (no zlib header or check) */
z->state->nowrap = 0;
if (w < 0)
{
w = - w;
z->state->nowrap = 1;
}
 
/* set window size */
if (w < 8 || w > 15)
{
inflateEnd(z);
return Z_STREAM_ERROR;
}
z->state->wbits = (uInt)w;
 
/* create inflate_blocks state */
if ((z->state->blocks =
inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w))
== Z_NULL)
{
inflateEnd(z);
return Z_MEM_ERROR;
}
Tracev((stderr, "inflate: allocated\n"));
 
/* reset state */
inflateReset(z);
return Z_OK;
}
 
 
int ZEXPORT inflateInit_(z, version, stream_size)
z_streamp z;
const char *version;
int stream_size;
{
return inflateInit2_(z, DEF_WBITS, version, stream_size);
}
 
 
#define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
 
int ZEXPORT inflate(z, f)
z_streamp z;
int f;
{
int r;
uInt b;
 
if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL)
return Z_STREAM_ERROR;
f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;
r = Z_BUF_ERROR;
while (1) switch (z->state->mode)
{
case METHOD:
NEEDBYTE
if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED)
{
z->state->mode = BAD;
z->msg = (char*)"unknown compression method";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
{
z->state->mode = BAD;
z->msg = (char*)"invalid window size";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
z->state->mode = FLAG;
case FLAG:
NEEDBYTE
b = NEXTBYTE;
if (((z->state->sub.method << 8) + b) % 31)
{
z->state->mode = BAD;
z->msg = (char*)"incorrect header check";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
Tracev((stderr, "inflate: zlib header ok\n"));
if (!(b & PRESET_DICT))
{
z->state->mode = BLOCKS;
break;
}
z->state->mode = DICT4;
case DICT4:
NEEDBYTE
z->state->sub.check.need = (uLong)NEXTBYTE << 24;
z->state->mode = DICT3;
case DICT3:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 16;
z->state->mode = DICT2;
case DICT2:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 8;
z->state->mode = DICT1;
case DICT1:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE;
z->adler = z->state->sub.check.need;
z->state->mode = DICT0;
return Z_NEED_DICT;
case DICT0:
z->state->mode = BAD;
z->msg = (char*)"need dictionary";
z->state->sub.marker = 0; /* can try inflateSync */
return Z_STREAM_ERROR;
case BLOCKS:
r = inflate_blocks(z->state->blocks, z, r);
if (r == Z_DATA_ERROR)
{
z->state->mode = BAD;
z->state->sub.marker = 0; /* can try inflateSync */
break;
}
if (r == Z_OK)
r = f;
if (r != Z_STREAM_END)
return r;
r = f;
inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was);
if (z->state->nowrap)
{
z->state->mode = DONE;
break;
}
z->state->mode = CHECK4;
case CHECK4:
NEEDBYTE
z->state->sub.check.need = (uLong)NEXTBYTE << 24;
z->state->mode = CHECK3;
case CHECK3:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 16;
z->state->mode = CHECK2;
case CHECK2:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 8;
z->state->mode = CHECK1;
case CHECK1:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE;
 
if (z->state->sub.check.was != z->state->sub.check.need)
{
z->state->mode = BAD;
z->msg = (char*)"incorrect data check";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
Tracev((stderr, "inflate: zlib check ok\n"));
z->state->mode = DONE;
case DONE:
return Z_STREAM_END;
case BAD:
return Z_DATA_ERROR;
default:
return Z_STREAM_ERROR;
}
#ifdef NEED_DUMMY_RETURN
return Z_STREAM_ERROR; /* Some dumb compilers complain without this */
#endif
}
 
 
int ZEXPORT inflateSetDictionary(z, dictionary, dictLength)
z_streamp z;
const Bytef *dictionary;
uInt dictLength;
{
uInt length = dictLength;
 
if (z == Z_NULL || z->state == Z_NULL || z->state->mode != DICT0)
return Z_STREAM_ERROR;
 
if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR;
z->adler = 1L;
 
if (length >= ((uInt)1<<z->state->wbits))
{
length = (1<<z->state->wbits)-1;
dictionary += dictLength - length;
}
inflate_set_dictionary(z->state->blocks, dictionary, length);
z->state->mode = BLOCKS;
return Z_OK;
}
 
 
int ZEXPORT inflateSync(z)
z_streamp z;
{
uInt n; /* number of bytes to look at */
Bytef *p; /* pointer to bytes */
uInt m; /* number of marker bytes found in a row */
uLong r, w; /* temporaries to save total_in and total_out */
 
/* set up */
if (z == Z_NULL || z->state == Z_NULL)
return Z_STREAM_ERROR;
if (z->state->mode != BAD)
{
z->state->mode = BAD;
z->state->sub.marker = 0;
}
if ((n = z->avail_in) == 0)
return Z_BUF_ERROR;
p = z->next_in;
m = z->state->sub.marker;
 
/* search */
while (n && m < 4)
{
static const Byte mark[4] = {0, 0, 0xff, 0xff};
if (*p == mark[m])
m++;
else if (*p)
m = 0;
else
m = 4 - m;
p++, n--;
}
 
/* restore */
z->total_in += p - z->next_in;
z->next_in = p;
z->avail_in = n;
z->state->sub.marker = m;
 
/* return no joy or set up to restart on a new block */
if (m != 4)
return Z_DATA_ERROR;
r = z->total_in; w = z->total_out;
inflateReset(z);
z->total_in = r; z->total_out = w;
z->state->mode = BLOCKS;
return Z_OK;
}
 
 
/* Returns true if inflate is currently at the end of a block generated
* by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
* implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH
* but removes the length bytes of the resulting empty stored block. When
* decompressing, PPP checks that at the end of input packet, inflate is
* waiting for these length bytes.
*/
int ZEXPORT inflateSyncPoint(z)
z_streamp z;
{
if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL)
return Z_STREAM_ERROR;
return inflate_blocks_sync_point(z->state->blocks);
}
/shark/trunk/ports/zlib/uncompr.c
0,0 → 1,58
/* uncompr.c -- decompress a memory buffer
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* @(#) $Id: uncompr.c,v 1.1 2003-03-24 11:13:45 pj Exp $ */
 
#include "zlib.h"
 
/* ===========================================================================
Decompresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be large enough to hold the
entire uncompressed data. (The size of the uncompressed data must have
been saved previously by the compressor and transmitted to the decompressor
by some mechanism outside the scope of this compression library.)
Upon exit, destLen is the actual size of the compressed buffer.
This function can be used to decompress a whole file at once if the
input file is mmap'ed.
 
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer, or Z_DATA_ERROR if the input data was corrupted.
*/
int ZEXPORT uncompress (dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
{
z_stream stream;
int err;
 
stream.next_in = (Bytef*)source;
stream.avail_in = (uInt)sourceLen;
/* Check for source > 64K on 16-bit machine: */
if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
 
stream.next_out = dest;
stream.avail_out = (uInt)*destLen;
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
 
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
 
err = inflateInit(&stream);
if (err != Z_OK) return err;
 
err = inflate(&stream, Z_FINISH);
if (err != Z_STREAM_END) {
inflateEnd(&stream);
return err == Z_OK ? Z_BUF_ERROR : err;
}
*destLen = stream.total_out;
 
err = inflateEnd(&stream);
return err;
}
/shark/trunk/ports/zlib/inftrees.h
0,0 → 1,58
/* inftrees.h -- header to use inftrees.c
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
 
/* Huffman code lookup table entry--this entry is four bytes for machines
that have 16-bit pointers (e.g. PC's in the small or medium model). */
 
typedef struct inflate_huft_s FAR inflate_huft;
 
struct inflate_huft_s {
union {
struct {
Byte Exop; /* number of extra bits or operation */
Byte Bits; /* number of bits in this code or subcode */
} what;
uInt pad; /* pad structure to a power of 2 (4 bytes for */
} word; /* 16-bit, 8 bytes for 32-bit int's) */
uInt base; /* literal, length base, distance base,
or table offset */
};
 
/* Maximum size of dynamic tree. The maximum found in a long but non-
exhaustive search was 1004 huft structures (850 for length/literals
and 154 for distances, the latter actually the result of an
exhaustive search). The actual maximum is not known, but the
value below is more than safe. */
#define MANY 1440
 
extern int inflate_trees_bits OF((
uIntf *, /* 19 code lengths */
uIntf *, /* bits tree desired/actual depth */
inflate_huft * FAR *, /* bits tree result */
inflate_huft *, /* space for trees */
z_streamp)); /* for messages */
 
extern int inflate_trees_dynamic OF((
uInt, /* number of literal/length codes */
uInt, /* number of distance codes */
uIntf *, /* that many (total) code lengths */
uIntf *, /* literal desired/actual bit depth */
uIntf *, /* distance desired/actual bit depth */
inflate_huft * FAR *, /* literal/length tree result */
inflate_huft * FAR *, /* distance tree result */
inflate_huft *, /* space for trees */
z_streamp)); /* for messages */
 
extern int inflate_trees_fixed OF((
uIntf *, /* literal desired/actual bit depth */
uIntf *, /* distance desired/actual bit depth */
inflate_huft * FAR *, /* literal/length tree result */
inflate_huft * FAR *, /* distance tree result */
z_streamp)); /* for memory allocation */
/shark/trunk/ports/zlib/infblock.c
0,0 → 1,403
/* infblock.c -- interpret and process block types to last block
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
#include "zutil.h"
#include "infblock.h"
#include "inftrees.h"
#include "infcodes.h"
#include "infutil.h"
 
struct inflate_codes_state {int dummy;}; /* for buggy compilers */
 
/* simplify the use of the inflate_huft type with some defines */
#define exop word.what.Exop
#define bits word.what.Bits
 
/* Table for deflate from PKZIP's appnote.txt. */
local const uInt border[] = { /* Order of the bit length code lengths */
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
 
/*
Notes beyond the 1.93a appnote.txt:
 
1. Distance pointers never point before the beginning of the output
stream.
2. Distance pointers can point back across blocks, up to 32k away.
3. There is an implied maximum of 7 bits for the bit length table and
15 bits for the actual data.
4. If only one code exists, then it is encoded using one bit. (Zero
would be more efficient, but perhaps a little confusing.) If two
codes exist, they are coded using one bit each (0 and 1).
5. There is no way of sending zero distance codes--a dummy must be
sent if there are none. (History: a pre 2.0 version of PKZIP would
store blocks with no distance codes, but this was discovered to be
too harsh a criterion.) Valid only for 1.93a. 2.04c does allow
zero distance codes, which is sent as one code of zero bits in
length.
6. There are up to 286 literal/length codes. Code 256 represents the
end-of-block. Note however that the static length tree defines
288 codes just to fill out the Huffman codes. Codes 286 and 287
cannot be used though, since there is no length base or extra bits
defined for them. Similarily, there are up to 30 distance codes.
However, static trees define 32 codes (all 5 bits) to fill out the
Huffman codes, but the last two had better not show up in the data.
7. Unzip can check dynamic Huffman blocks for complete code sets.
The exception is that a single code would not be complete (see #4).
8. The five bits following the block type is really the number of
literal codes sent minus 257.
9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits
(1+6+6). Therefore, to output three times the length, you output
three codes (1+1+1), whereas to output four times the same length,
you only need two codes (1+3). Hmm.
10. In the tree reconstruction algorithm, Code = Code + Increment
only if BitLength(i) is not zero. (Pretty obvious.)
11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19)
12. Note: length code 284 can represent 227-258, but length code 285
really is 258. The last length deserves its own, short code
since it gets used a lot in very redundant files. The length
258 is special since 258 - 3 (the min match length) is 255.
13. The literal/length and distance code bit lengths are read as a
single stream of lengths. It is possible (and advantageous) for
a repeat code (16, 17, or 18) to go across the boundary between
the two sets of lengths.
*/
 
 
void inflate_blocks_reset(s, z, c)
inflate_blocks_statef *s;
z_streamp z;
uLongf *c;
{
if (c != Z_NULL)
*c = s->check;
if (s->mode == BTREE || s->mode == DTREE)
ZFREE(z, s->sub.trees.blens);
if (s->mode == CODES)
inflate_codes_free(s->sub.decode.codes, z);
s->mode = TYPE;
s->bitk = 0;
s->bitb = 0;
s->read = s->write = s->window;
if (s->checkfn != Z_NULL)
z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0);
Tracev((stderr, "inflate: blocks reset\n"));
}
 
 
inflate_blocks_statef *inflate_blocks_new(z, c, w)
z_streamp z;
check_func c;
uInt w;
{
inflate_blocks_statef *s;
 
if ((s = (inflate_blocks_statef *)ZALLOC
(z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)
return s;
if ((s->hufts =
(inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL)
{
ZFREE(z, s);
return Z_NULL;
}
if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)
{
ZFREE(z, s->hufts);
ZFREE(z, s);
return Z_NULL;
}
s->end = s->window + w;
s->checkfn = c;
s->mode = TYPE;
Tracev((stderr, "inflate: blocks allocated\n"));
inflate_blocks_reset(s, z, Z_NULL);
return s;
}
 
 
int inflate_blocks(s, z, r)
inflate_blocks_statef *s;
z_streamp z;
int r;
{
uInt t; /* temporary storage */
uLong b; /* bit buffer */
uInt k; /* bits in bit buffer */
Bytef *p; /* input data pointer */
uInt n; /* bytes available there */
Bytef *q; /* output window write pointer */
uInt m; /* bytes to end of window or read pointer */
 
/* copy input/output information to locals (UPDATE macro restores) */
LOAD
 
/* process input based on current state */
while (1) switch (s->mode)
{
case TYPE:
NEEDBITS(3)
t = (uInt)b & 7;
s->last = t & 1;
switch (t >> 1)
{
case 0: /* stored */
Tracev((stderr, "inflate: stored block%s\n",
s->last ? " (last)" : ""));
DUMPBITS(3)
t = k & 7; /* go to byte boundary */
DUMPBITS(t)
s->mode = LENS; /* get length of stored block */
break;
case 1: /* fixed */
Tracev((stderr, "inflate: fixed codes block%s\n",
s->last ? " (last)" : ""));
{
uInt bl, bd;
inflate_huft *tl, *td;
 
inflate_trees_fixed(&bl, &bd, &tl, &td, z);
s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z);
if (s->sub.decode.codes == Z_NULL)
{
r = Z_MEM_ERROR;
LEAVE
}
}
DUMPBITS(3)
s->mode = CODES;
break;
case 2: /* dynamic */
Tracev((stderr, "inflate: dynamic codes block%s\n",
s->last ? " (last)" : ""));
DUMPBITS(3)
s->mode = TABLE;
break;
case 3: /* illegal */
DUMPBITS(3)
s->mode = BAD;
z->msg = (char*)"invalid block type";
r = Z_DATA_ERROR;
LEAVE
}
break;
case LENS:
NEEDBITS(32)
if ((((~b) >> 16) & 0xffff) != (b & 0xffff))
{
s->mode = BAD;
z->msg = (char*)"invalid stored block lengths";
r = Z_DATA_ERROR;
LEAVE
}
s->sub.left = (uInt)b & 0xffff;
b = k = 0; /* dump bits */
Tracev((stderr, "inflate: stored length %u\n", s->sub.left));
s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE);
break;
case STORED:
if (n == 0)
LEAVE
NEEDOUT
t = s->sub.left;
if (t > n) t = n;
if (t > m) t = m;
zmemcpy(q, p, t);
p += t; n -= t;
q += t; m -= t;
if ((s->sub.left -= t) != 0)
break;
Tracev((stderr, "inflate: stored end, %lu total out\n",
z->total_out + (q >= s->read ? q - s->read :
(s->end - s->read) + (q - s->window))));
s->mode = s->last ? DRY : TYPE;
break;
case TABLE:
NEEDBITS(14)
s->sub.trees.table = t = (uInt)b & 0x3fff;
#ifndef PKZIP_BUG_WORKAROUND
if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)
{
s->mode = BAD;
z->msg = (char*)"too many length or distance symbols";
r = Z_DATA_ERROR;
LEAVE
}
#endif
t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL)
{
r = Z_MEM_ERROR;
LEAVE
}
DUMPBITS(14)
s->sub.trees.index = 0;
Tracev((stderr, "inflate: table sizes ok\n"));
s->mode = BTREE;
case BTREE:
while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
{
NEEDBITS(3)
s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7;
DUMPBITS(3)
}
while (s->sub.trees.index < 19)
s->sub.trees.blens[border[s->sub.trees.index++]] = 0;
s->sub.trees.bb = 7;
t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb,
&s->sub.trees.tb, s->hufts, z);
if (t != Z_OK)
{
r = t;
if (r == Z_DATA_ERROR)
{
ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
}
LEAVE
}
s->sub.trees.index = 0;
Tracev((stderr, "inflate: bits tree ok\n"));
s->mode = DTREE;
case DTREE:
while (t = s->sub.trees.table,
s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
{
inflate_huft *h;
uInt i, j, c;
 
t = s->sub.trees.bb;
NEEDBITS(t)
h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]);
t = h->bits;
c = h->base;
if (c < 16)
{
DUMPBITS(t)
s->sub.trees.blens[s->sub.trees.index++] = c;
}
else /* c == 16..18 */
{
i = c == 18 ? 7 : c - 14;
j = c == 18 ? 11 : 3;
NEEDBITS(t + i)
DUMPBITS(t)
j += (uInt)b & inflate_mask[i];
DUMPBITS(i)
i = s->sub.trees.index;
t = s->sub.trees.table;
if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||
(c == 16 && i < 1))
{
ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
z->msg = (char*)"invalid bit length repeat";
r = Z_DATA_ERROR;
LEAVE
}
c = c == 16 ? s->sub.trees.blens[i - 1] : 0;
do {
s->sub.trees.blens[i++] = c;
} while (--j);
s->sub.trees.index = i;
}
}
s->sub.trees.tb = Z_NULL;
{
uInt bl, bd;
inflate_huft *tl, *td;
inflate_codes_statef *c;
 
bl = 9; /* must be <= 9 for lookahead assumptions */
bd = 6; /* must be <= 9 for lookahead assumptions */
t = s->sub.trees.table;
t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
s->sub.trees.blens, &bl, &bd, &tl, &td,
s->hufts, z);
if (t != Z_OK)
{
if (t == (uInt)Z_DATA_ERROR)
{
ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
}
r = t;
LEAVE
}
Tracev((stderr, "inflate: trees ok\n"));
if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)
{
r = Z_MEM_ERROR;
LEAVE
}
s->sub.decode.codes = c;
}
ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE
if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
return inflate_flush(s, z, r);
r = Z_OK;
inflate_codes_free(s->sub.decode.codes, z);
LOAD
Tracev((stderr, "inflate: codes end, %lu total out\n",
z->total_out + (q >= s->read ? q - s->read :
(s->end - s->read) + (q - s->window))));
if (!s->last)
{
s->mode = TYPE;
break;
}
s->mode = DRY;
case DRY:
FLUSH
if (s->read != s->write)
LEAVE
s->mode = DONE;
case DONE:
r = Z_STREAM_END;
LEAVE
case BAD:
r = Z_DATA_ERROR;
LEAVE
default:
r = Z_STREAM_ERROR;
LEAVE
}
}
 
 
int inflate_blocks_free(s, z)
inflate_blocks_statef *s;
z_streamp z;
{
inflate_blocks_reset(s, z, Z_NULL);
ZFREE(z, s->window);
ZFREE(z, s->hufts);
ZFREE(z, s);
Tracev((stderr, "inflate: blocks freed\n"));
return Z_OK;
}
 
 
void inflate_set_dictionary(s, d, n)
inflate_blocks_statef *s;
const Bytef *d;
uInt n;
{
zmemcpy(s->window, d, n);
s->read = s->write = s->window + n;
}
 
 
/* Returns true if inflate is currently at the end of a block generated
* by Z_SYNC_FLUSH or Z_FULL_FLUSH.
* IN assertion: s != Z_NULL
*/
int inflate_blocks_sync_point(s)
inflate_blocks_statef *s;
{
return s->mode == LENS;
}
/shark/trunk/ports/zlib/trees.h
0,0 → 1,128
/* header created automatically with -DGEN_TREES_H */
 
local const ct_data static_ltree[L_CODES+2] = {
{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
};
 
local const ct_data static_dtree[D_CODES] = {
{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
};
 
const uch _dist_code[DIST_CODE_LEN] = {
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
};
 
const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
};
 
local const int base_length[LENGTH_CODES] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
64, 80, 96, 112, 128, 160, 192, 224, 0
};
 
local const int base_dist[D_CODES] = {
0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
};
 
/shark/trunk/ports/zlib/infcodes.c
0,0 → 1,251
/* infcodes.c -- process literals and length/distance pairs
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
#include "zutil.h"
#include "inftrees.h"
#include "infblock.h"
#include "infcodes.h"
#include "infutil.h"
#include "inffast.h"
 
/* simplify the use of the inflate_huft type with some defines */
#define exop word.what.Exop
#define bits word.what.Bits
 
typedef enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
START, /* x: set up for LEN */
LEN, /* i: get length/literal/eob next */
LENEXT, /* i: getting length extra (have base) */
DIST, /* i: get distance next */
DISTEXT, /* i: getting distance extra */
COPY, /* o: copying bytes in window, waiting for space */
LIT, /* o: got literal, waiting for output space */
WASH, /* o: got eob, possibly still output waiting */
END, /* x: got eob and all data flushed */
BADCODE} /* x: got error */
inflate_codes_mode;
 
/* inflate codes private state */
struct inflate_codes_state {
 
/* mode */
inflate_codes_mode mode; /* current inflate_codes mode */
 
/* mode dependent information */
uInt len;
union {
struct {
inflate_huft *tree; /* pointer into tree */
uInt need; /* bits needed */
} code; /* if LEN or DIST, where in tree */
uInt lit; /* if LIT, literal */
struct {
uInt get; /* bits to get for extra */
uInt dist; /* distance back to copy from */
} copy; /* if EXT or COPY, where and how much */
} sub; /* submode */
 
/* mode independent information */
Byte lbits; /* ltree bits decoded per branch */
Byte dbits; /* dtree bits decoder per branch */
inflate_huft *ltree; /* literal/length/eob tree */
inflate_huft *dtree; /* distance tree */
 
};
 
 
inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
uInt bl, bd;
inflate_huft *tl;
inflate_huft *td; /* need separate declaration for Borland C++ */
z_streamp z;
{
inflate_codes_statef *c;
 
if ((c = (inflate_codes_statef *)
ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL)
{
c->mode = START;
c->lbits = (Byte)bl;
c->dbits = (Byte)bd;
c->ltree = tl;
c->dtree = td;
Tracev((stderr, "inflate: codes new\n"));
}
return c;
}
 
 
int inflate_codes(s, z, r)
inflate_blocks_statef *s;
z_streamp z;
int r;
{
uInt j; /* temporary storage */
inflate_huft *t; /* temporary pointer */
uInt e; /* extra bits or operation */
uLong b; /* bit buffer */
uInt k; /* bits in bit buffer */
Bytef *p; /* input data pointer */
uInt n; /* bytes available there */
Bytef *q; /* output window write pointer */
uInt m; /* bytes to end of window or read pointer */
Bytef *f; /* pointer to copy strings from */
inflate_codes_statef *c = s->sub.decode.codes; /* codes state */
 
/* copy input/output information to locals (UPDATE macro restores) */
LOAD
 
/* process input and output based on current state */
while (1) switch (c->mode)
{ /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
case START: /* x: set up for LEN */
#ifndef SLOW
if (m >= 258 && n >= 10)
{
UPDATE
r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z);
LOAD
if (r != Z_OK)
{
c->mode = r == Z_STREAM_END ? WASH : BADCODE;
break;
}
}
#endif /* !SLOW */
c->sub.code.need = c->lbits;
c->sub.code.tree = c->ltree;
c->mode = LEN;
case LEN: /* i: get length/literal/eob next */
j = c->sub.code.need;
NEEDBITS(j)
t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
DUMPBITS(t->bits)
e = (uInt)(t->exop);
if (e == 0) /* literal */
{
c->sub.lit = t->base;
Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
"inflate: literal '%c'\n" :
"inflate: literal 0x%02x\n", t->base));
c->mode = LIT;
break;
}
if (e & 16) /* length */
{
c->sub.copy.get = e & 15;
c->len = t->base;
c->mode = LENEXT;
break;
}
if ((e & 64) == 0) /* next table */
{
c->sub.code.need = e;
c->sub.code.tree = t + t->base;
break;
}
if (e & 32) /* end of block */
{
Tracevv((stderr, "inflate: end of block\n"));
c->mode = WASH;
break;
}
c->mode = BADCODE; /* invalid code */
z->msg = (char*)"invalid literal/length code";
r = Z_DATA_ERROR;
LEAVE
case LENEXT: /* i: getting length extra (have base) */
j = c->sub.copy.get;
NEEDBITS(j)
c->len += (uInt)b & inflate_mask[j];
DUMPBITS(j)
c->sub.code.need = c->dbits;
c->sub.code.tree = c->dtree;
Tracevv((stderr, "inflate: length %u\n", c->len));
c->mode = DIST;
case DIST: /* i: get distance next */
j = c->sub.code.need;
NEEDBITS(j)
t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
DUMPBITS(t->bits)
e = (uInt)(t->exop);
if (e & 16) /* distance */
{
c->sub.copy.get = e & 15;
c->sub.copy.dist = t->base;
c->mode = DISTEXT;
break;
}
if ((e & 64) == 0) /* next table */
{
c->sub.code.need = e;
c->sub.code.tree = t + t->base;
break;
}
c->mode = BADCODE; /* invalid code */
z->msg = (char*)"invalid distance code";
r = Z_DATA_ERROR;
LEAVE
case DISTEXT: /* i: getting distance extra */
j = c->sub.copy.get;
NEEDBITS(j)
c->sub.copy.dist += (uInt)b & inflate_mask[j];
DUMPBITS(j)
Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY;
case COPY: /* o: copying bytes in window, waiting for space */
f = q - c->sub.copy.dist;
while (f < s->window) /* modulo window size-"while" instead */
f += s->end - s->window; /* of "if" handles invalid distances */
while (c->len)
{
NEEDOUT
OUTBYTE(*f++)
if (f == s->end)
f = s->window;
c->len--;
}
c->mode = START;
break;
case LIT: /* o: got literal, waiting for output space */
NEEDOUT
OUTBYTE(c->sub.lit)
c->mode = START;
break;
case WASH: /* o: got eob, possibly more output */
if (k > 7) /* return unused byte, if any */
{
Assert(k < 16, "inflate_codes grabbed too many bytes")
k -= 8;
n++;
p--; /* can always return one */
}
FLUSH
if (s->read != s->write)
LEAVE
c->mode = END;
case END:
r = Z_STREAM_END;
LEAVE
case BADCODE: /* x: got error */
r = Z_DATA_ERROR;
LEAVE
default:
r = Z_STREAM_ERROR;
LEAVE
}
#ifdef NEED_DUMMY_RETURN
return Z_STREAM_ERROR; /* Some dumb compilers complain without this */
#endif
}
 
 
void inflate_codes_free(c, z)
inflate_codes_statef *c;
z_streamp z;
{
ZFREE(z, c);
Tracev((stderr, "inflate: codes free\n"));
}
/shark/trunk/ports/zlib/inffast.c
0,0 → 1,183
/* inffast.c -- process literals and length/distance pairs fast
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
#include "zutil.h"
#include "inftrees.h"
#include "infblock.h"
#include "infcodes.h"
#include "infutil.h"
#include "inffast.h"
 
struct inflate_codes_state {int dummy;}; /* for buggy compilers */
 
/* simplify the use of the inflate_huft type with some defines */
#define exop word.what.Exop
#define bits word.what.Bits
 
/* macros for bit input with no checking and for returning unused bytes */
#define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}}
#define UNGRAB {c=z->avail_in-n;c=(k>>3)<c?k>>3:c;n+=c;p-=c;k-=c<<3;}
 
/* Called with number of bytes left to write in window at least 258
(the maximum string length) and number of input bytes available
at least ten. The ten bytes are six bytes for the longest length/
distance pair plus four bytes for overloading the bit buffer. */
 
int inflate_fast(bl, bd, tl, td, s, z)
uInt bl, bd;
inflate_huft *tl;
inflate_huft *td; /* need separate declaration for Borland C++ */
inflate_blocks_statef *s;
z_streamp z;
{
inflate_huft *t; /* temporary pointer */
uInt e; /* extra bits or operation */
uLong b; /* bit buffer */
uInt k; /* bits in bit buffer */
Bytef *p; /* input data pointer */
uInt n; /* bytes available there */
Bytef *q; /* output window write pointer */
uInt m; /* bytes to end of window or read pointer */
uInt ml; /* mask for literal/length tree */
uInt md; /* mask for distance tree */
uInt c; /* bytes to copy */
uInt d; /* distance back to copy from */
Bytef *r; /* copy source pointer */
 
/* load input, output, bit values */
LOAD
 
/* initialize masks */
ml = inflate_mask[bl];
md = inflate_mask[bd];
 
/* do until not enough input or output space for fast loop */
do { /* assume called with m >= 258 && n >= 10 */
/* get literal/length code */
GRABBITS(20) /* max bits for literal/length code */
if ((e = (t = tl + ((uInt)b & ml))->exop) == 0)
{
DUMPBITS(t->bits)
Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
"inflate: * literal '%c'\n" :
"inflate: * literal 0x%02x\n", t->base));
*q++ = (Byte)t->base;
m--;
continue;
}
do {
DUMPBITS(t->bits)
if (e & 16)
{
/* get extra bits for length */
e &= 15;
c = t->base + ((uInt)b & inflate_mask[e]);
DUMPBITS(e)
Tracevv((stderr, "inflate: * length %u\n", c));
 
/* decode distance base of block to copy */
GRABBITS(15); /* max bits for distance code */
e = (t = td + ((uInt)b & md))->exop;
do {
DUMPBITS(t->bits)
if (e & 16)
{
/* get extra bits to add to distance base */
e &= 15;
GRABBITS(e) /* get extra bits (up to 13) */
d = t->base + ((uInt)b & inflate_mask[e]);
DUMPBITS(e)
Tracevv((stderr, "inflate: * distance %u\n", d));
 
/* do the copy */
m -= c;
r = q - d;
if (r < s->window) /* wrap if needed */
{
do {
r += s->end - s->window; /* force pointer in window */
} while (r < s->window); /* covers invalid distances */
e = s->end - r;
if (c > e)
{
c -= e; /* wrapped copy */
do {
*q++ = *r++;
} while (--e);
r = s->window;
do {
*q++ = *r++;
} while (--c);
}
else /* normal copy */
{
*q++ = *r++; c--;
*q++ = *r++; c--;
do {
*q++ = *r++;
} while (--c);
}
}
else /* normal copy */
{
*q++ = *r++; c--;
*q++ = *r++; c--;
do {
*q++ = *r++;
} while (--c);
}
break;
}
else if ((e & 64) == 0)
{
t += t->base;
e = (t += ((uInt)b & inflate_mask[e]))->exop;
}
else
{
z->msg = (char*)"invalid distance code";
UNGRAB
UPDATE
return Z_DATA_ERROR;
}
} while (1);
break;
}
if ((e & 64) == 0)
{
t += t->base;
if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) == 0)
{
DUMPBITS(t->bits)
Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
"inflate: * literal '%c'\n" :
"inflate: * literal 0x%02x\n", t->base));
*q++ = (Byte)t->base;
m--;
break;
}
}
else if (e & 32)
{
Tracevv((stderr, "inflate: * end of block\n"));
UNGRAB
UPDATE
return Z_STREAM_END;
}
else
{
z->msg = (char*)"invalid literal/length code";
UNGRAB
UPDATE
return Z_DATA_ERROR;
}
} while (1);
} while (m >= 258 && n >= 10);
 
/* not enough input or output--restore pointers and return */
UNGRAB
UPDATE
return Z_OK;
}
/shark/trunk/ports/zlib/compress.c
0,0 → 1,68
/* compress.c -- compress a memory buffer
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* @(#) $Id: compress.c,v 1.1 2003-03-24 11:13:44 pj Exp $ */
 
#include "zlib.h"
 
/* ===========================================================================
Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte
length of the source buffer. Upon entry, destLen is the total size of the
destination buffer, which must be at least 0.1% larger than sourceLen plus
12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
 
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
int level;
{
z_stream stream;
int err;
 
stream.next_in = (Bytef*)source;
stream.avail_in = (uInt)sourceLen;
#ifdef MAXSEG_64K
/* Check for source > 64K on 16-bit machine: */
if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
#endif
stream.next_out = dest;
stream.avail_out = (uInt)*destLen;
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
 
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
stream.opaque = (voidpf)0;
 
err = deflateInit(&stream, level);
if (err != Z_OK) return err;
 
err = deflate(&stream, Z_FINISH);
if (err != Z_STREAM_END) {
deflateEnd(&stream);
return err == Z_OK ? Z_BUF_ERROR : err;
}
*destLen = stream.total_out;
 
err = deflateEnd(&stream);
return err;
}
 
/* ===========================================================================
*/
int ZEXPORT compress (dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
{
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}
/shark/trunk/ports/zlib/adler32.c
0,0 → 1,48
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* @(#) $Id: adler32.c,v 1.1 2003-03-24 11:13:44 pj Exp $ */
 
#include "zlib.h"
 
#define BASE 65521L /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
 
#define DO1(buf,i) {s1 += buf[i]; s2 += s1;}
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
#define DO16(buf) DO8(buf,0); DO8(buf,8);
 
/* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
{
unsigned long s1 = adler & 0xffff;
unsigned long s2 = (adler >> 16) & 0xffff;
int k;
 
if (buf == Z_NULL) return 1L;
 
while (len > 0) {
k = len < NMAX ? len : NMAX;
len -= k;
while (k >= 16) {
DO16(buf);
buf += 16;
k -= 16;
}
if (k != 0) do {
s1 += *buf++;
s2 += s1;
} while (--k);
s1 %= BASE;
s2 %= BASE;
}
return (s2 << 16) | s1;
}
/shark/trunk/ports/zlib/makefile
0,0 → 1,22
# The Frame Buffer Device
 
ifndef BASE
BASE=../..
endif
 
include $(BASE)/config/config.mk
 
LIBRARY = zlib
 
OBJS_PATH = $(BASE)/ports/zlib
 
ZLIB = 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.o
 
OBJS = $(ZLIB)
 
C_OPT += -I../../../drivers/linuxc24/include -I./include -I. -I..
 
include $(BASE)/config/lib.mk
 
/shark/trunk/ports/zlib/infblock.h
0,0 → 1,39
/* infblock.h -- header to use infblock.c
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
 
/* WARNING: this file should *not* be used by applications. It is
part of the implementation of the compression library and is
subject to change. Applications should only use zlib.h.
*/
 
struct inflate_blocks_state;
typedef struct inflate_blocks_state FAR inflate_blocks_statef;
 
extern inflate_blocks_statef * inflate_blocks_new OF((
z_streamp z,
check_func c, /* check function */
uInt w)); /* window size */
 
extern int inflate_blocks OF((
inflate_blocks_statef *,
z_streamp ,
int)); /* initial return code */
 
extern void inflate_blocks_reset OF((
inflate_blocks_statef *,
z_streamp ,
uLongf *)); /* check value on output */
 
extern int inflate_blocks_free OF((
inflate_blocks_statef *,
z_streamp));
 
extern void inflate_set_dictionary OF((
inflate_blocks_statef *s,
const Bytef *d, /* dictionary */
uInt n)); /* dictionary length */
 
extern int inflate_blocks_sync_point OF((
inflate_blocks_statef *s));
/shark/trunk/ports/png/zlib.h
File deleted
/shark/trunk/ports/png/adler32.c
File deleted
/shark/trunk/ports/png/infblock.c
File deleted
/shark/trunk/ports/png/pngconf.h
File deleted
/shark/trunk/ports/png/deflate.c
File deleted
/shark/trunk/ports/png/inffixed.h
File deleted
/shark/trunk/ports/png/zconf.h
File deleted
/shark/trunk/ports/png/infcodes.c
File deleted
/shark/trunk/ports/png/infblock.h
File deleted
/shark/trunk/ports/png/inftrees.c
File deleted
/shark/trunk/ports/png/deflate.h
File deleted
/shark/trunk/ports/png/infcodes.h
File deleted
/shark/trunk/ports/png/compress.c
File deleted
/shark/trunk/ports/png/inftrees.h
File deleted
/shark/trunk/ports/png/crc32.c
File deleted
/shark/trunk/ports/png/infutil.c
File deleted
/shark/trunk/ports/png/trees.c
File deleted
/shark/trunk/ports/png/png.h
File deleted
/shark/trunk/ports/png/gzio.c
File deleted
/shark/trunk/ports/png/infutil.h
File deleted
/shark/trunk/ports/png/trees.h
File deleted
/shark/trunk/ports/png/uncompr.c
File deleted
/shark/trunk/ports/png/zutil.c
File deleted
/shark/trunk/ports/png/inflate.c
File deleted
/shark/trunk/ports/png/zutil.h
File deleted
/shark/trunk/ports/png/inffast.c
File deleted
/shark/trunk/ports/png/inffast.h
File deleted
/shark/trunk/ports/png/include/pngconf.h
0,0 → 1,1348
/* pngconf.h - machine configurable file for libpng
*
* libpng 1.2.5 - October 3, 2002
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
 
/* Any machine specific code is near the front of this file, so if you
* are configuring libpng for a machine, you may want to read the section
* starting here down to where it starts to typedef png_color, png_text,
* and png_info.
*/
 
#ifndef PNGCONF_H
#define PNGCONF_H
 
/* This is the size of the compression buffer, and thus the size of
* an IDAT chunk. Make this whatever size you feel is best for your
* machine. One of these will be allocated per png_struct. When this
* is full, it writes the data to the disk, and does some other
* calculations. Making this an extremely small size will slow
* the library down, but you may want to experiment to determine
* where it becomes significant, if you are concerned with memory
* usage. Note that zlib allocates at least 32Kb also. For readers,
* this describes the size of the buffer available to read the data in.
* Unless this gets smaller than the size of a row (compressed),
* it should not make much difference how big this is.
*/
 
#ifndef PNG_ZBUF_SIZE
# define PNG_ZBUF_SIZE 8192
#endif
 
/* Enable if you want a write-only libpng */
 
#ifndef PNG_NO_READ_SUPPORTED
# define PNG_READ_SUPPORTED
#endif
 
/* Enable if you want a read-only libpng */
 
#ifndef PNG_NO_WRITE_SUPPORTED
# define PNG_WRITE_SUPPORTED
#endif
 
/* Enabled by default in 1.2.0. You can disable this if you don't need to
support PNGs that are embedded in MNG datastreams */
#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
# ifndef PNG_MNG_FEATURES_SUPPORTED
# define PNG_MNG_FEATURES_SUPPORTED
# endif
#endif
 
#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
# ifndef PNG_FLOATING_POINT_SUPPORTED
# define PNG_FLOATING_POINT_SUPPORTED
# endif
#endif
 
/* If you are running on a machine where you cannot allocate more
* than 64K of memory at once, uncomment this. While libpng will not
* normally need that much memory in a chunk (unless you load up a very
* large file), zlib needs to know how big of a chunk it can use, and
* libpng thus makes sure to check any memory allocation to verify it
* will fit into memory.
#define PNG_MAX_MALLOC_64K
*/
#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
# define PNG_MAX_MALLOC_64K
#endif
 
/* Special munging to support doing things the 'cygwin' way:
* 'Normal' png-on-win32 defines/defaults:
* PNG_BUILD_DLL -- building dll
* PNG_USE_DLL -- building an application, linking to dll
* (no define) -- building static library, or building an
* application and linking to the static lib
* 'Cygwin' defines/defaults:
* PNG_BUILD_DLL -- (ignored) building the dll
* (no define) -- (ignored) building an application, linking to the dll
* PNG_STATIC -- (ignored) building the static lib, or building an
* application that links to the static lib.
* ALL_STATIC -- (ignored) building various static libs, or building an
* application that links to the static libs.
* Thus,
* a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
* this bit of #ifdefs will define the 'correct' config variables based on
* that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
* unnecessary.
*
* Also, the precedence order is:
* ALL_STATIC (since we can't #undef something outside our namespace)
* PNG_BUILD_DLL
* PNG_STATIC
* (nothing) == PNG_USE_DLL
*
* CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
* of auto-import in binutils, we no longer need to worry about
* __declspec(dllexport) / __declspec(dllimport) and friends. Therefore,
* we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
* to __declspec() stuff. However, we DO need to worry about
* PNG_BUILD_DLL and PNG_STATIC because those change some defaults
* such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
*/
#if defined(__CYGWIN__)
# if defined(ALL_STATIC)
# if defined(PNG_BUILD_DLL)
# undef PNG_BUILD_DLL
# endif
# if defined(PNG_USE_DLL)
# undef PNG_USE_DLL
# endif
# if defined(PNG_DLL)
# undef PNG_DLL
# endif
# if !defined(PNG_STATIC)
# define PNG_STATIC
# endif
# else
# if defined (PNG_BUILD_DLL)
# if defined(PNG_STATIC)
# undef PNG_STATIC
# endif
# if defined(PNG_USE_DLL)
# undef PNG_USE_DLL
# endif
# if !defined(PNG_DLL)
# define PNG_DLL
# endif
# else
# if defined(PNG_STATIC)
# if defined(PNG_USE_DLL)
# undef PNG_USE_DLL
# endif
# if defined(PNG_DLL)
# undef PNG_DLL
# endif
# else
# if !defined(PNG_USE_DLL)
# define PNG_USE_DLL
# endif
# if !defined(PNG_DLL)
# define PNG_DLL
# endif
# endif
# endif
# endif
#endif
 
/* This protects us against compilers that run on a windowing system
* and thus don't have or would rather us not use the stdio types:
* stdin, stdout, and stderr. The only one currently used is stderr
* in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will
* prevent these from being compiled and used. #defining PNG_NO_STDIO
* will also prevent these, plus will prevent the entire set of stdio
* macros and functions (FILE *, printf, etc.) from being compiled and used,
* unless (PNG_DEBUG > 0) has been #defined.
*
* #define PNG_NO_CONSOLE_IO
* #define PNG_NO_STDIO
*/
 
#if defined(_WIN32_WCE)
# include <windows.h>
/* Console I/O functions are not supported on WindowsCE */
# define PNG_NO_CONSOLE_IO
# ifdef PNG_DEBUG
# undef PNG_DEBUG
# endif
#endif
 
#ifdef PNG_BUILD_DLL
# ifndef PNG_CONSOLE_IO_SUPPORTED
# ifndef PNG_NO_CONSOLE_IO
# define PNG_NO_CONSOLE_IO
# endif
# endif
#endif
 
# ifdef PNG_NO_STDIO
# ifndef PNG_NO_CONSOLE_IO
# define PNG_NO_CONSOLE_IO
# endif
# ifdef PNG_DEBUG
# if (PNG_DEBUG > 0)
# include <stdio.h>
# endif
# endif
# else
# if !defined(_WIN32_WCE)
/* "stdio.h" functions are not supported on WindowsCE */
# include <stdio.h>
# endif
# endif
 
/* This macro protects us against machines that don't have function
* prototypes (ie K&R style headers). If your compiler does not handle
* function prototypes, define this macro and use the included ansi2knr.
* I've always been able to use _NO_PROTO as the indicator, but you may
* need to drag the empty declaration out in front of here, or change the
* ifdef to suit your own needs.
*/
#ifndef PNGARG
 
#ifdef OF /* zlib prototype munger */
# define PNGARG(arglist) OF(arglist)
#else
 
#ifdef _NO_PROTO
# define PNGARG(arglist) ()
# ifndef PNG_TYPECAST_NULL
# define PNG_TYPECAST_NULL
# endif
#else
# define PNGARG(arglist) arglist
#endif /* _NO_PROTO */
 
#endif /* OF */
 
#endif /* PNGARG */
 
/* Try to determine if we are compiling on a Mac. Note that testing for
* just __MWERKS__ is not good enough, because the Codewarrior is now used
* on non-Mac platforms.
*/
#ifndef MACOS
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
# define MACOS
# endif
#endif
 
/* enough people need this for various reasons to include it here */
#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
# include <sys/types.h>
#endif
 
#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
//# define PNG_SETJMP_SUPPORTED
#endif
 
#ifdef PNG_SETJMP_SUPPORTED
/* This is an attempt to force a single setjmp behaviour on Linux. If
* the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
*/
 
# ifdef __linux__
# ifdef _BSD_SOURCE
# define PNG_SAVE_BSD_SOURCE
# undef _BSD_SOURCE
# endif
# ifdef _SETJMP_H
__png.h__ already includes setjmp.h;
__dont__ include it again.;
# endif
# endif /* __linux__ */
 
/* include setjmp.h for error handling */
//# include <setjmp.h>
 
# ifdef __linux__
# ifdef PNG_SAVE_BSD_SOURCE
# define _BSD_SOURCE
# undef PNG_SAVE_BSD_SOURCE
# endif
# endif /* __linux__ */
#endif /* PNG_SETJMP_SUPPORTED */
 
#ifdef BSD
# include <strings.h>
#else
# include <string.h>
#endif
 
/* Other defines for things like memory and the like can go here. */
#ifdef PNG_INTERNAL
 
#include <stdlib.h>
 
/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
* aren't usually used outside the library (as far as I know), so it is
* debatable if they should be exported at all. In the future, when it is
* possible to have run-time registry of chunk-handling functions, some of
* these will be made available again.
#define PNG_EXTERN extern
*/
#define PNG_EXTERN
 
/* Other defines specific to compilers can go here. Try to keep
* them inside an appropriate ifdef/endif pair for portability.
*/
 
#if defined(PNG_FLOATING_POINT_SUPPORTED)
# if defined(MACOS)
/* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible.
*/
# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
# include <fp.h>
# endif
# else
# include <math.h>
# endif
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881
*/
# include <m68881.h>
# endif
#endif
 
/* Codewarrior on NT has linking problems without this. */
#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
# define PNG_ALWAYS_EXTERN
#endif
 
/* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
* stdlib.h like it should (I think). Or perhaps this is a C++
* "feature"?
*/
#ifdef __TURBOC__
# include <mem.h>
# include "alloc.h"
#endif
 
#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
# include <malloc.h>
#endif
 
/* This controls how fine the dithering gets. As this allocates
* a largish chunk of memory (32K), those who are not as concerned
* with dithering quality can decrease some or all of these.
*/
#ifndef PNG_DITHER_RED_BITS
# define PNG_DITHER_RED_BITS 5
#endif
#ifndef PNG_DITHER_GREEN_BITS
# define PNG_DITHER_GREEN_BITS 5
#endif
#ifndef PNG_DITHER_BLUE_BITS
# define PNG_DITHER_BLUE_BITS 5
#endif
 
/* This controls how fine the gamma correction becomes when you
* are only interested in 8 bits anyway. Increasing this value
* results in more memory being used, and more pow() functions
* being called to fill in the gamma tables. Don't set this value
* less then 8, and even that may not work (I haven't tested it).
*/
 
#ifndef PNG_MAX_GAMMA_8
# define PNG_MAX_GAMMA_8 11
#endif
 
/* This controls how much a difference in gamma we can tolerate before
* we actually start doing gamma conversion.
*/
#ifndef PNG_GAMMA_THRESHOLD
# define PNG_GAMMA_THRESHOLD 0.05
#endif
 
#endif /* PNG_INTERNAL */
 
/* The following uses const char * instead of char * for error
* and warning message functions, so some compilers won't complain.
* If you do not want to use const, define PNG_NO_CONST here.
*/
 
#ifndef PNG_NO_CONST
# define PNG_CONST const
#else
# define PNG_CONST
#endif
 
/* The following defines give you the ability to remove code from the
* library that you will not be using. I wish I could figure out how to
* automate this, but I can't do that without making it seriously hard
* on the users. So if you are not using an ability, change the #define
* to and #undef, and that part of the library will not be compiled. If
* your linker can't find a function, you may want to make sure the
* ability is defined here. Some of these depend upon some others being
* defined. I haven't figured out all the interactions here, so you may
* have to experiment awhile to get everything to compile. If you are
* creating or using a shared library, you probably shouldn't touch this,
* as it will affect the size of the structures, and this will cause bad
* things to happen if the library and/or application ever change.
*/
 
/* Any features you will not be using can be undef'ed here */
 
/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
* to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
* on the compile line, then pick and choose which ones to define without
* having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
* if you only want to have a png-compliant reader/writer but don't need
* any of the extra transformations. This saves about 80 kbytes in a
* typical installation of the library. (PNG_NO_* form added in version
* 1.0.1c, for consistency)
*/
 
/* The size of the png_text structure changed in libpng-1.0.6 when
* iTXt is supported. It is turned off by default, to support old apps
* that malloc the png_text structure instead of calling png_set_text()
* and letting libpng malloc it. It will be turned on by default in
* libpng-1.3.0.
*/
 
#ifndef PNG_iTXt_SUPPORTED
# if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
# define PNG_NO_READ_iTXt
# endif
# if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
# define PNG_NO_WRITE_iTXt
# endif
#endif
 
/* The following support, added after version 1.0.0, can be turned off here en
* masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
* with old applications that require the length of png_struct and png_info
* to remain unchanged.
*/
 
#ifdef PNG_LEGACY_SUPPORTED
# define PNG_NO_FREE_ME
# define PNG_NO_READ_UNKNOWN_CHUNKS
# define PNG_NO_WRITE_UNKNOWN_CHUNKS
# define PNG_NO_READ_USER_CHUNKS
# define PNG_NO_READ_iCCP
# define PNG_NO_WRITE_iCCP
# define PNG_NO_READ_iTXt
# define PNG_NO_WRITE_iTXt
# define PNG_NO_READ_sCAL
# define PNG_NO_WRITE_sCAL
# define PNG_NO_READ_sPLT
# define PNG_NO_WRITE_sPLT
# define PNG_NO_INFO_IMAGE
# define PNG_NO_READ_RGB_TO_GRAY
# define PNG_NO_READ_USER_TRANSFORM
# define PNG_NO_WRITE_USER_TRANSFORM
# define PNG_NO_USER_MEM
# define PNG_NO_READ_EMPTY_PLTE
# define PNG_NO_MNG_FEATURES
# define PNG_NO_FIXED_POINT_SUPPORTED
#endif
 
/* Ignore attempt to turn off both floating and fixed point support */
#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
!defined(PNG_NO_FIXED_POINT_SUPPORTED)
# define PNG_FIXED_POINT_SUPPORTED
#endif
 
#ifndef PNG_NO_FREE_ME
# define PNG_FREE_ME_SUPPORTED
#endif
 
#if defined(PNG_READ_SUPPORTED)
 
#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_READ_TRANSFORMS)
# define PNG_READ_TRANSFORMS_SUPPORTED
#endif
 
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
# ifndef PNG_NO_READ_EXPAND
# define PNG_READ_EXPAND_SUPPORTED
# endif
# ifndef PNG_NO_READ_SHIFT
# define PNG_READ_SHIFT_SUPPORTED
# endif
# ifndef PNG_NO_READ_PACK
# define PNG_READ_PACK_SUPPORTED
# endif
# ifndef PNG_NO_READ_BGR
# define PNG_READ_BGR_SUPPORTED
# endif
# ifndef PNG_NO_READ_SWAP
# define PNG_READ_SWAP_SUPPORTED
# endif
# ifndef PNG_NO_READ_PACKSWAP
# define PNG_READ_PACKSWAP_SUPPORTED
# endif
# ifndef PNG_NO_READ_INVERT
# define PNG_READ_INVERT_SUPPORTED
# endif
# ifndef PNG_NO_READ_DITHER
# define PNG_READ_DITHER_SUPPORTED
# endif
# ifndef PNG_NO_READ_BACKGROUND
# define PNG_READ_BACKGROUND_SUPPORTED
# endif
# ifndef PNG_NO_READ_16_TO_8
# define PNG_READ_16_TO_8_SUPPORTED
# endif
# ifndef PNG_NO_READ_FILLER
# define PNG_READ_FILLER_SUPPORTED
# endif
# ifndef PNG_NO_READ_GAMMA
# define PNG_READ_GAMMA_SUPPORTED
# endif
# ifndef PNG_NO_READ_GRAY_TO_RGB
# define PNG_READ_GRAY_TO_RGB_SUPPORTED
# endif
# ifndef PNG_NO_READ_SWAP_ALPHA
# define PNG_READ_SWAP_ALPHA_SUPPORTED
# endif
# ifndef PNG_NO_READ_INVERT_ALPHA
# define PNG_READ_INVERT_ALPHA_SUPPORTED
# endif
# ifndef PNG_NO_READ_STRIP_ALPHA
# define PNG_READ_STRIP_ALPHA_SUPPORTED
# endif
# ifndef PNG_NO_READ_USER_TRANSFORM
# define PNG_READ_USER_TRANSFORM_SUPPORTED
# endif
# ifndef PNG_NO_READ_RGB_TO_GRAY
# define PNG_READ_RGB_TO_GRAY_SUPPORTED
# endif
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
 
#if !defined(PNG_NO_PROGRESSIVE_READ) && \
!defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
#endif /* about interlacing capability! You'll */
/* still have interlacing unless you change the following line: */
 
#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
 
#ifndef PNG_NO_READ_COMPOSITE_NODIV
# ifndef PNG_NO_READ_COMPOSITED_NODIV /* libpng-1.0.x misspelling */
# define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel, SGI */
# endif
#endif
 
/* Deprecated, will be removed from version 2.0.0.
Use PNG_MNG_FEATURES_SUPPORTED instead. */
#ifndef PNG_NO_READ_EMPTY_PLTE
# define PNG_READ_EMPTY_PLTE_SUPPORTED
#endif
 
#endif /* PNG_READ_SUPPORTED */
 
#if defined(PNG_WRITE_SUPPORTED)
 
# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_WRITE_TRANSFORMS)
# define PNG_WRITE_TRANSFORMS_SUPPORTED
#endif
 
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
# ifndef PNG_NO_WRITE_SHIFT
# define PNG_WRITE_SHIFT_SUPPORTED
# endif
# ifndef PNG_NO_WRITE_PACK
# define PNG_WRITE_PACK_SUPPORTED
# endif
# ifndef PNG_NO_WRITE_BGR
# define PNG_WRITE_BGR_SUPPORTED
# endif
# ifndef PNG_NO_WRITE_SWAP
# define PNG_WRITE_SWAP_SUPPORTED
# endif
# ifndef PNG_NO_WRITE_PACKSWAP
# define PNG_WRITE_PACKSWAP_SUPPORTED
# endif
# ifndef PNG_NO_WRITE_INVERT
# define PNG_WRITE_INVERT_SUPPORTED
# endif
# ifndef PNG_NO_WRITE_FILLER
# define PNG_WRITE_FILLER_SUPPORTED /* same as WRITE_STRIP_ALPHA */
# endif
# ifndef PNG_NO_WRITE_SWAP_ALPHA
# define PNG_WRITE_SWAP_ALPHA_SUPPORTED
# endif
# ifndef PNG_NO_WRITE_INVERT_ALPHA
# define PNG_WRITE_INVERT_ALPHA_SUPPORTED
# endif
# ifndef PNG_NO_WRITE_USER_TRANSFORM
# define PNG_WRITE_USER_TRANSFORM_SUPPORTED
# endif
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
 
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
# ifndef PNG_NO_USER_TRANSFORM_PTR
# define PNG_USER_TRANSFORM_PTR_SUPPORTED
# endif
#endif
 
#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
encoders, but can cause trouble
if left undefined */
 
#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
defined(PNG_FLOATING_POINT_SUPPORTED)
# define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#endif
 
#ifndef PNG_1_0_X
#ifndef PNG_NO_ERROR_NUMBERS
#define PNG_ERROR_NUMBERS_SUPPORTED
#endif
#endif /* PNG_1_0_X */
 
#ifndef PNG_NO_WRITE_FLUSH
# define PNG_WRITE_FLUSH_SUPPORTED
#endif
 
/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
#ifndef PNG_NO_WRITE_EMPTY_PLTE
# define PNG_WRITE_EMPTY_PLTE_SUPPORTED
#endif
 
#endif /* PNG_WRITE_SUPPORTED */
 
#ifndef PNG_NO_STDIO
# define PNG_TIME_RFC1123_SUPPORTED
#endif
 
/* This adds extra functions in pngget.c for accessing data from the
* info pointer (added in version 0.99)
* png_get_image_width()
* png_get_image_height()
* png_get_bit_depth()
* png_get_color_type()
* png_get_compression_type()
* png_get_filter_type()
* png_get_interlace_type()
* png_get_pixel_aspect_ratio()
* png_get_pixels_per_meter()
* png_get_x_offset_pixels()
* png_get_y_offset_pixels()
* png_get_x_offset_microns()
* png_get_y_offset_microns()
*/
#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
# define PNG_EASY_ACCESS_SUPPORTED
#endif
 
/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
# ifndef PNG_ASSEMBLER_CODE_SUPPORTED
# define PNG_ASSEMBLER_CODE_SUPPORTED
# endif
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
# define PNG_MMX_CODE_SUPPORTED
# endif
#endif
 
/* If you are sure that you don't need thread safety and you are compiling
with PNG_USE_PNGCCRD for an MMX application, you can define this for
faster execution. See pnggccrd.c.
#define PNG_THREAD_UNSAFE_OK
*/
 
#if !defined(PNG_1_0_X)
#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
# define PNG_USER_MEM_SUPPORTED
#endif
#endif /* PNG_1_0_X */
 
/* These are currently experimental features, define them if you want */
 
/* very little testing */
/*
#ifdef PNG_READ_SUPPORTED
# ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
# define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
# endif
#endif
*/
 
/* This is only for PowerPC big-endian and 680x0 systems */
/* some testing */
/*
#ifdef PNG_READ_SUPPORTED
# ifndef PNG_PNG_READ_BIG_ENDIAN_SUPPORTED
# define PNG_READ_BIG_ENDIAN_SUPPORTED
# endif
#endif
*/
 
/* Buggy compilers (e.g., gcc 2.7.2.2) need this */
/*
#define PNG_NO_POINTER_INDEXING
*/
 
/* These functions are turned off by default, as they will be phased out. */
/*
#define PNG_USELESS_TESTS_SUPPORTED
#define PNG_CORRECT_PALETTE_SUPPORTED
*/
 
/* Any chunks you are not interested in, you can undef here. The
* ones that allocate memory may be expecially important (hIST,
* tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
* a bit smaller.
*/
 
#if defined(PNG_READ_SUPPORTED) && \
!defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
!defined(PNG_NO_READ_ANCILLARY_CHUNKS)
# define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#endif
 
#if defined(PNG_WRITE_SUPPORTED) && \
!defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
!defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
# define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#endif
 
#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
 
#ifdef PNG_NO_READ_TEXT
# define PNG_NO_READ_iTXt
# define PNG_NO_READ_tEXt
# define PNG_NO_READ_zTXt
#endif
#ifndef PNG_NO_READ_bKGD
# define PNG_READ_bKGD_SUPPORTED
# define PNG_bKGD_SUPPORTED
#endif
#ifndef PNG_NO_READ_cHRM
# define PNG_READ_cHRM_SUPPORTED
# define PNG_cHRM_SUPPORTED
#endif
#ifndef PNG_NO_READ_gAMA
# define PNG_READ_gAMA_SUPPORTED
# define PNG_gAMA_SUPPORTED
#endif
#ifndef PNG_NO_READ_hIST
# define PNG_READ_hIST_SUPPORTED
# define PNG_hIST_SUPPORTED
#endif
#ifndef PNG_NO_READ_iCCP
# define PNG_READ_iCCP_SUPPORTED
# define PNG_iCCP_SUPPORTED
#endif
#ifndef PNG_NO_READ_iTXt
# ifndef PNG_READ_iTXt_SUPPORTED
# define PNG_READ_iTXt_SUPPORTED
# endif
# ifndef PNG_iTXt_SUPPORTED
# define PNG_iTXt_SUPPORTED
# endif
#endif
#ifndef PNG_NO_READ_oFFs
# define PNG_READ_oFFs_SUPPORTED
# define PNG_oFFs_SUPPORTED
#endif
#ifndef PNG_NO_READ_pCAL
# define PNG_READ_pCAL_SUPPORTED
# define PNG_pCAL_SUPPORTED
#endif
#ifndef PNG_NO_READ_sCAL
# define PNG_READ_sCAL_SUPPORTED
# define PNG_sCAL_SUPPORTED
#endif
#ifndef PNG_NO_READ_pHYs
# define PNG_READ_pHYs_SUPPORTED
# define PNG_pHYs_SUPPORTED
#endif
#ifndef PNG_NO_READ_sBIT
# define PNG_READ_sBIT_SUPPORTED
# define PNG_sBIT_SUPPORTED
#endif
#ifndef PNG_NO_READ_sPLT
# define PNG_READ_sPLT_SUPPORTED
# define PNG_sPLT_SUPPORTED
#endif
#ifndef PNG_NO_READ_sRGB
# define PNG_READ_sRGB_SUPPORTED
# define PNG_sRGB_SUPPORTED
#endif
#ifndef PNG_NO_READ_tEXt
# define PNG_READ_tEXt_SUPPORTED
# define PNG_tEXt_SUPPORTED
#endif
#ifndef PNG_NO_READ_tIME
# define PNG_READ_tIME_SUPPORTED
# define PNG_tIME_SUPPORTED
#endif
#ifndef PNG_NO_READ_tRNS
# define PNG_READ_tRNS_SUPPORTED
# define PNG_tRNS_SUPPORTED
#endif
#ifndef PNG_NO_READ_zTXt
# define PNG_READ_zTXt_SUPPORTED
# define PNG_zTXt_SUPPORTED
#endif
#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
# define PNG_UNKNOWN_CHUNKS_SUPPORTED
# endif
# ifndef PNG_NO_HANDLE_AS_UNKNOWN
# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# endif
#endif
#if !defined(PNG_NO_READ_USER_CHUNKS) && \
defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
# define PNG_READ_USER_CHUNKS_SUPPORTED
# define PNG_USER_CHUNKS_SUPPORTED
# ifdef PNG_NO_READ_UNKNOWN_CHUNKS
# undef PNG_NO_READ_UNKNOWN_CHUNKS
# endif
# ifdef PNG_NO_HANDLE_AS_UNKNOWN
# undef PNG_NO_HANDLE_AS_UNKNOWN
# endif
#endif
#ifndef PNG_NO_READ_OPT_PLTE
# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
#endif /* optional PLTE chunk in RGB and RGBA images */
#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
defined(PNG_READ_zTXt_SUPPORTED)
# define PNG_READ_TEXT_SUPPORTED
# define PNG_TEXT_SUPPORTED
#endif
 
#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
 
#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
 
#ifdef PNG_NO_WRITE_TEXT
# define PNG_NO_WRITE_iTXt
# define PNG_NO_WRITE_tEXt
# define PNG_NO_WRITE_zTXt
#endif
#ifndef PNG_NO_WRITE_bKGD
# define PNG_WRITE_bKGD_SUPPORTED
# ifndef PNG_bKGD_SUPPORTED
# define PNG_bKGD_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_cHRM
# define PNG_WRITE_cHRM_SUPPORTED
# ifndef PNG_cHRM_SUPPORTED
# define PNG_cHRM_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_gAMA
# define PNG_WRITE_gAMA_SUPPORTED
# ifndef PNG_gAMA_SUPPORTED
# define PNG_gAMA_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_hIST
# define PNG_WRITE_hIST_SUPPORTED
# ifndef PNG_hIST_SUPPORTED
# define PNG_hIST_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_iCCP
# define PNG_WRITE_iCCP_SUPPORTED
# ifndef PNG_iCCP_SUPPORTED
# define PNG_iCCP_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_iTXt
# ifndef PNG_WRITE_iTXt_SUPPORTED
# define PNG_WRITE_iTXt_SUPPORTED
# endif
# ifndef PNG_iTXt_SUPPORTED
# define PNG_iTXt_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_oFFs
# define PNG_WRITE_oFFs_SUPPORTED
# ifndef PNG_oFFs_SUPPORTED
# define PNG_oFFs_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_pCAL
# define PNG_WRITE_pCAL_SUPPORTED
# ifndef PNG_pCAL_SUPPORTED
# define PNG_pCAL_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_sCAL
# define PNG_WRITE_sCAL_SUPPORTED
# ifndef PNG_sCAL_SUPPORTED
# define PNG_sCAL_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_pHYs
# define PNG_WRITE_pHYs_SUPPORTED
# ifndef PNG_pHYs_SUPPORTED
# define PNG_pHYs_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_sBIT
# define PNG_WRITE_sBIT_SUPPORTED
# ifndef PNG_sBIT_SUPPORTED
# define PNG_sBIT_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_sPLT
# define PNG_WRITE_sPLT_SUPPORTED
# ifndef PNG_sPLT_SUPPORTED
# define PNG_sPLT_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_sRGB
# define PNG_WRITE_sRGB_SUPPORTED
# ifndef PNG_sRGB_SUPPORTED
# define PNG_sRGB_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_tEXt
# define PNG_WRITE_tEXt_SUPPORTED
# ifndef PNG_tEXt_SUPPORTED
# define PNG_tEXt_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_tIME
//# define PNG_WRITE_tIME_SUPPORTED
# ifndef PNG_tIME_SUPPORTED
//# define PNG_tIME_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_tRNS
# define PNG_WRITE_tRNS_SUPPORTED
# ifndef PNG_tRNS_SUPPORTED
# define PNG_tRNS_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_zTXt
# define PNG_WRITE_zTXt_SUPPORTED
# ifndef PNG_zTXt_SUPPORTED
# define PNG_zTXt_SUPPORTED
# endif
#endif
#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
# define PNG_UNKNOWN_CHUNKS_SUPPORTED
# endif
# ifndef PNG_NO_HANDLE_AS_UNKNOWN
# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# endif
# endif
#endif
#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
defined(PNG_WRITE_zTXt_SUPPORTED)
# define PNG_WRITE_TEXT_SUPPORTED
# ifndef PNG_TEXT_SUPPORTED
# define PNG_TEXT_SUPPORTED
# endif
#endif
 
#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
 
/* Turn this off to disable png_read_png() and
* png_write_png() and leave the row_pointers member
* out of the info structure.
*/
#ifndef PNG_NO_INFO_IMAGE
# define PNG_INFO_IMAGE_SUPPORTED
#endif
 
/* need the time information for reading tIME chunks */
#if defined(PNG_tIME_SUPPORTED)
# if !defined(_WIN32_WCE)
/* "time.h" functions are not supported on WindowsCE */
# include <time.h>
# endif
#endif
 
/* Some typedefs to get us started. These should be safe on most of the
* common platforms. The typedefs should be at least as large as the
* numbers suggest (a png_uint_32 must be at least 32 bits long), but they
* don't have to be exactly that size. Some compilers dislike passing
* unsigned shorts as function parameters, so you may be better off using
* unsigned int for png_uint_16. Likewise, for 64-bit systems, you may
* want to have unsigned int for png_uint_32 instead of unsigned long.
*/
 
typedef unsigned long png_uint_32;
typedef long png_int_32;
typedef unsigned short png_uint_16;
typedef short png_int_16;
typedef unsigned char png_byte;
 
/* This is usually size_t. It is typedef'ed just in case you need it to
change (I'm not sure if you will or not, so I thought I'd be safe) */
typedef size_t png_size_t;
 
/* The following is needed for medium model support. It cannot be in the
* PNG_INTERNAL section. Needs modification for other compilers besides
* MSC. Model independent support declares all arrays and pointers to be
* large using the far keyword. The zlib version used must also support
* model independent data. As of version zlib 1.0.4, the necessary changes
* have been made in zlib. The USE_FAR_KEYWORD define triggers other
* changes that are needed. (Tim Wegner)
*/
 
/* Separate compiler dependencies (problem here is that zlib.h always
defines FAR. (SJT) */
#ifdef __BORLANDC__
# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
# define LDATA 1
# else
# define LDATA 0
# endif
/* GRR: why is Cygwin in here? Cygwin is not Borland C... */
# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
# define PNG_MAX_MALLOC_64K
# if (LDATA != 1)
# ifndef FAR
# define FAR __far
# endif
# define USE_FAR_KEYWORD
# endif /* LDATA != 1 */
/* Possibly useful for moving data out of default segment.
* Uncomment it if you want. Could also define FARDATA as
* const if your compiler supports it. (SJT)
# define FARDATA FAR
*/
# endif /* __WIN32__, __FLAT__, __CYGWIN__ */
#endif /* __BORLANDC__ */
 
 
/* Suggest testing for specific compiler first before testing for
* FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
* making reliance oncertain keywords suspect. (SJT)
*/
 
/* MSC Medium model */
#if defined(FAR)
# if defined(M_I86MM)
# define USE_FAR_KEYWORD
# define FARDATA FAR
# include <dos.h>
# endif
#endif
 
/* SJT: default case */
#ifndef FAR
# define FAR
#endif
 
/* At this point FAR is always defined */
#ifndef FARDATA
# define FARDATA
#endif
 
/* Typedef for floating-point numbers that are converted
to fixed-point with a multiple of 100,000, e.g., int_gamma */
typedef png_int_32 png_fixed_point;
 
/* Add typedefs for pointers */
typedef void FAR * png_voidp;
typedef png_byte FAR * png_bytep;
typedef png_uint_32 FAR * png_uint_32p;
typedef png_int_32 FAR * png_int_32p;
typedef png_uint_16 FAR * png_uint_16p;
typedef png_int_16 FAR * png_int_16p;
typedef PNG_CONST char FAR * png_const_charp;
typedef char FAR * png_charp;
typedef png_fixed_point FAR * png_fixed_point_p;
 
#ifndef PNG_NO_STDIO
#if defined(_WIN32_WCE)
typedef HANDLE png_FILE_p;
#else
typedef FILE * png_FILE_p;
#endif
#endif
 
#ifdef PNG_FLOATING_POINT_SUPPORTED
typedef double FAR * png_doublep;
#endif
 
/* Pointers to pointers; i.e. arrays */
typedef png_byte FAR * FAR * png_bytepp;
typedef png_uint_32 FAR * FAR * png_uint_32pp;
typedef png_int_32 FAR * FAR * png_int_32pp;
typedef png_uint_16 FAR * FAR * png_uint_16pp;
typedef png_int_16 FAR * FAR * png_int_16pp;
typedef PNG_CONST char FAR * FAR * png_const_charpp;
typedef char FAR * FAR * png_charpp;
typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
#ifdef PNG_FLOATING_POINT_SUPPORTED
typedef double FAR * FAR * png_doublepp;
#endif
 
/* Pointers to pointers to pointers; i.e., pointer to array */
typedef char FAR * FAR * FAR * png_charppp;
 
/* libpng typedefs for types in zlib. If zlib changes
* or another compression library is used, then change these.
* Eliminates need to change all the source files.
*/
typedef charf * png_zcharp;
typedef charf * FAR * png_zcharpp;
typedef z_stream FAR * png_zstreamp;
 
/*
* Define PNG_BUILD_DLL if the module being built is a Windows
* LIBPNG DLL.
*
* Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
* It is equivalent to Microsoft predefined macro _DLL that is
* automatically defined when you compile using the share
* version of the CRT (C Run-Time library)
*
* The cygwin mods make this behavior a little different:
* Define PNG_BUILD_DLL if you are building a dll for use with cygwin
* Define PNG_STATIC if you are building a static library for use with cygwin,
* -or- if you are building an application that you want to link to the
* static library.
* PNG_USE_DLL is defined by default (no user action needed) unless one of
* the other flags is defined.
*/
 
#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
# define PNG_DLL
#endif
/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
* When building a static lib, default to no GLOBAL ARRAYS, but allow
* command-line override
*/
#if defined(__CYGWIN__)
# if !defined(PNG_STATIC)
# if defined(PNG_USE_GLOBAL_ARRAYS)
# undef PNG_USE_GLOBAL_ARRAYS
# endif
# if !defined(PNG_USE_LOCAL_ARRAYS)
# define PNG_USE_LOCAL_ARRAYS
# endif
# else
# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
# if defined(PNG_USE_GLOBAL_ARRAYS)
# undef PNG_USE_GLOBAL_ARRAYS
# endif
# endif
# endif
# if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
# define PNG_USE_LOCAL_ARRAYS
# endif
#endif
 
/* Do not use global arrays (helps with building DLL's)
* They are no longer used in libpng itself, since version 1.0.5c,
* but might be required for some pre-1.0.5c applications.
*/
#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
# if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
# define PNG_USE_LOCAL_ARRAYS
# else
# define PNG_USE_GLOBAL_ARRAYS
# endif
#endif
 
#if defined(__CYGWIN__)
# undef PNGAPI
# define PNGAPI __cdecl
# undef PNG_IMPEXP
# define PNG_IMPEXP
#endif
 
/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
* you may get warnings regarding the linkage of png_zalloc and png_zfree.
* Don't ignore those warnings; you must also reset the default calling
* convention in your compiler to match your PNGAPI, and you must build
* zlib and your applications the same way you build libpng.
*/
 
#ifndef PNGAPI
 
#if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
# ifndef PNG_NO_MODULEDEF
# define PNG_NO_MODULEDEF
# endif
#endif
 
#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
# define PNG_IMPEXP
#endif
 
#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
(( defined(_Windows) || defined(_WINDOWS) || \
defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
 
# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
# define PNGAPI __cdecl
# else
# define PNGAPI _cdecl
# endif
 
# if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
# define PNG_IMPEXP
# endif
 
# if !defined(PNG_IMPEXP)
 
# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
 
/* Borland/Microsoft */
# if defined(_MSC_VER) || defined(__BORLANDC__)
# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
# define PNG_EXPORT PNG_EXPORT_TYPE1
# else
# define PNG_EXPORT PNG_EXPORT_TYPE2
# if defined(PNG_BUILD_DLL)
# define PNG_IMPEXP __export
# else
# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
VC++ */
# endif /* Exists in Borland C++ for
C++ classes (== huge) */
# endif
# endif
 
# if !defined(PNG_IMPEXP)
# if defined(PNG_BUILD_DLL)
# define PNG_IMPEXP __declspec(dllexport)
# else
# define PNG_IMPEXP __declspec(dllimport)
# endif
# endif
# endif /* PNG_IMPEXP */
#else /* !(DLL || non-cygwin WINDOWS) */
# if (defined(__IBMC__) || defined(IBMCPP__)) && defined(__OS2__)
# define PNGAPI _System
# define PNG_IMPEXP
# else
# if 0 /* ... other platforms, with other meanings */
# else
# define PNGAPI
# define PNG_IMPEXP
# endif
# endif
#endif
#endif
 
#ifndef PNGAPI
# define PNGAPI
#endif
#ifndef PNG_IMPEXP
# define PNG_IMPEXP
#endif
 
#ifndef PNG_EXPORT
# define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
#endif
 
#ifdef PNG_USE_GLOBAL_ARRAYS
# ifndef PNG_EXPORT_VAR
# define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
# endif
#endif
 
/* User may want to use these so they are not in PNG_INTERNAL. Any library
* functions that are passed far data must be model independent.
*/
 
#ifndef PNG_ABORT
# define PNG_ABORT() abort()
#endif
 
#ifdef PNG_SETJMP_SUPPORTED
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
#else
# define png_jmpbuf(png_ptr) \
(LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
#endif
 
#if defined(USE_FAR_KEYWORD) /* memory model independent fns */
/* use this to make far-to-near assignments */
# define CHECK 1
# define NOCHECK 0
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
# define png_strcpy _fstrcpy
# define png_strlen _fstrlen
# define png_memcmp _fmemcmp /* SJT: added */
# define png_memcpy _fmemcpy
# define png_memset _fmemset
#else /* use the usual functions */
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strcpy strcpy
# define png_strlen strlen
# define png_memcmp memcmp /* SJT: added */
# define png_memcpy memcpy
# define png_memset memset
#endif
/* End of memory model independent support */
 
/* Just a little check that someone hasn't tried to define something
* contradictory.
*/
#if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
# undef PNG_ZBUF_SIZE
# define PNG_ZBUF_SIZE 65536
#endif
 
#ifdef PNG_READ_SUPPORTED
/* Prior to libpng-1.0.9, this block was in pngasmrd.h */
#if defined(PNG_INTERNAL)
 
/* These are the default thresholds before the MMX code kicks in; if either
* rowbytes or bitdepth is below the threshold, plain C code is used. These
* can be overridden at runtime via the png_set_mmx_thresholds() call in
* libpng 1.2.0 and later. The values below were chosen by Intel.
*/
 
#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */
#endif
#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */
#endif
 
/* Set this in the makefile for VC++ on Pentium, not here. */
/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c .
* MMX will be detected at run time and used if present.
*/
#ifdef PNG_USE_PNGVCRD
# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
#endif
 
/* Set this in the makefile for gcc/as on Pentium, not here. */
/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c .
* MMX will be detected at run time and used if present.
*/
#ifdef PNG_USE_PNGGCCRD
# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
#endif
/* - see pnggccrd.c for info about what is currently enabled */
 
#endif /* PNG_INTERNAL */
#endif /* PNG_READ_SUPPORTED */
 
#endif /* PNGCONF_H */
 
/shark/trunk/ports/png/include/png.h
0,0 → 1,3283
/* png.h - header file for PNG reference library
*
* libpng version 1.2.5 - October 3, 2002
* Copyright (c) 1998-2002 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.2.5 - October 3, 2002: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
*
* Due to various miscommunications, unforeseen code incompatibilities
* and occasional factors outside the authors' control, version numbering
* on the library has not always been consistent and straightforward.
* The following table summarizes matters since version 0.89c, which was
* the first widely used release:
*
* source png.h png.h shared-lib
* version string int version
* ------- ------ ----- ----------
* 0.89c "1.0 beta 3" 0.89 89 1.0.89
* 0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90]
* 0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95]
* 0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96]
* 0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97]
* 0.97c 0.97 97 2.0.97
* 0.98 0.98 98 2.0.98
* 0.99 0.99 98 2.0.99
* 0.99a-m 0.99 99 2.0.99
* 1.00 1.00 100 2.1.0 [100 should be 10000]
* 1.0.0 (from here on, the 100 2.1.0 [100 should be 10000]
* 1.0.1 png.h string is 10001 2.1.0
* 1.0.1a-e identical to the 10002 from here on, the shared library
* 1.0.2 source version) 10002 is 2.V where V is the source code
* 1.0.2a-b 10003 version, except as noted.
* 1.0.3 10003
* 1.0.3a-d 10004
* 1.0.4 10004
* 1.0.4a-f 10005
* 1.0.5 (+ 2 patches) 10005
* 1.0.5a-d 10006
* 1.0.5e-r 10100 (not source compatible)
* 1.0.5s-v 10006 (not binary compatible)
* 1.0.6 (+ 3 patches) 10006 (still binary incompatible)
* 1.0.6d-f 10007 (still binary incompatible)
* 1.0.6g 10007
* 1.0.6h 10007 10.6h (testing xy.z so-numbering)
* 1.0.6i 10007 10.6i
* 1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
* 1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible)
* 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
* 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
* 1.0.7 1 10007 (still compatible)
* 1.0.8beta1-4 1 10008 2.1.0.8beta1-4
* 1.0.8rc1 1 10008 2.1.0.8rc1
* 1.0.8 1 10008 2.1.0.8
* 1.0.9beta1-6 1 10009 2.1.0.9beta1-6
* 1.0.9rc1 1 10009 2.1.0.9rc1
* 1.0.9beta7-10 1 10009 2.1.0.9beta7-10
* 1.0.9rc2 1 10009 2.1.0.9rc2
* 1.0.9 1 10009 2.1.0.9
* 1.0.10beta1 1 10010 2.1.0.10beta1
* 1.0.10rc1 1 10010 2.1.0.10rc1
* 1.0.10 1 10010 2.1.0.10
* 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
* 1.0.11rc1 1 10011 2.1.0.11rc1
* 1.0.11 1 10011 2.1.0.11
* 1.0.12beta1-2 2 10012 2.1.0.12beta1-2
* 1.0.12rc1 2 10012 2.1.0.12rc1
* 1.0.12 2 10012 2.1.0.12
* 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned)
* 1.2.0beta1-2 2 10200 2.1.2.0beta1-2
* 1.2.0beta3-5 3 10200 3.1.2.0beta3-5
* 1.2.0rc1 3 10200 3.1.2.0rc1
* 1.2.0 3 10200 3.1.2.0
* 1.2.1beta1-4 3 10201 3.1.2.1beta1-4
* 1.2.1rc1-2 3 10201 3.1.2.1rc1-2
* 1.2.1 3 10201 3.1.2.1
* 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
* 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
* 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
* 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
* 1.0.13 10 10013 10.so.0.1.0.13
* 1.2.2 12 10202 12.so.0.1.2.2
* 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6
* 1.2.3 12 10203 12.so.0.1.2.3
* 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3
* 1.0.14rc1 13 10014 10.so.0.1.0.14rc1
* 1.2.4rc1 13 10204 12.so.0.1.2.4rc1
* 1.0.14 10 10014 10.so.0.1.0.14
* 1.2.4 13 10204 12.so.0.1.2.4
* 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2
* 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3
* 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3
* 1.0.15 10 10015 10.so.0.1.0.15
* 1.2.5 13 10205 12.so.0.1.2.5
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
* used for changes in backward compatibility, as it is intended. The
* PNG_LIBPNG_VER macro, which is not used within libpng but is available
* for applications, is an unsigned integer of the form xyyzz corresponding
* to the source version x.y.z (leading zeros in y and z). Beta versions
* were given the previous public release number plus a letter, until
* version 1.0.6j; from then on they were given the upcoming public
* release number plus "betaNN" or "rcN".
*
* Binary incompatibility exists only when applications make direct access
* to the info_ptr or png_ptr members through png.h, and the compiled
* application is loaded with a different version of the library.
*
* DLLNUM will change each time there are forward or backward changes
* in binary compatibility (e.g., when a new feature is added).
*
* See libpng.txt or libpng.3 for more information. The PNG specification
* is available as RFC 2083 <ftp://ftp.uu.net/graphics/png/documents/>
* and as a W3C Recommendation <http://www.w3.org/TR/REC.png.html>
*/
 
/*
* COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
*
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
* libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
* Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.0.6
* with the following individuals added to the list of Contributing Authors
*
* Simon-Pierre Cadieux
* Eric S. Raymond
* Gilles Vollant
*
* and with the following additions to the disclaimer:
*
* There is no warranty against interference with your enjoyment of the
* library or against infringement. There is no warranty that our
* efforts or the library will fulfill any of your particular purposes
* or needs. This library is provided with all faults, and the entire
* risk of satisfactory quality, performance, accuracy, and effort is with
* the user.
*
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson
* Distributed according to the same disclaimer and license as libpng-0.96,
* with the following individuals added to the list of Contributing Authors:
*
* Tom Lane
* Glenn Randers-Pehrson
* Willem van Schaik
*
* libpng versions 0.89, June 1996, through 0.96, May 1997, are
* Copyright (c) 1996, 1997 Andreas Dilger
* Distributed according to the same disclaimer and license as libpng-0.88,
* with the following individuals added to the list of Contributing Authors:
*
* John Bowler
* Kevin Bracey
* Sam Bushell
* Magnus Holmgren
* Greg Roelofs
* Tom Tanner
*
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
*
* For the purposes of this copyright and license, "Contributing Authors"
* is defined as the following set of individuals:
*
* Andreas Dilger
* Dave Martindale
* Guy Eric Schalnat
* Paul Schmidt
* Tim Wegner
*
* The PNG Reference Library is supplied "AS IS". The Contributing Authors
* and Group 42, Inc. disclaim all warranties, expressed or implied,
* including, without limitation, the warranties of merchantability and of
* fitness for any purpose. The Contributing Authors and Group 42, Inc.
* assume no liability for direct, indirect, incidental, special, exemplary,
* or consequential damages, which may result from the use of the PNG
* Reference Library, even if advised of the possibility of such damage.
*
* Permission is hereby granted to use, copy, modify, and distribute this
* source code, or portions hereof, for any purpose, without fee, subject
* to the following restrictions:
*
* 1. The origin of this source code must not be misrepresented.
*
* 2. Altered versions must be plainly marked as such and
* must not be misrepresented as being the original source.
*
* 3. This Copyright notice may not be removed or altered from
* any source or altered source distribution.
*
* The Contributing Authors and Group 42, Inc. specifically permit, without
* fee, and encourage the use of this source code as a component to
* supporting the PNG file format in commercial products. If you use this
* source code in a product, acknowledgment is not required but would be
* appreciated.
*/
 
/*
* A "png_get_copyright" function is available, for convenient use in "about"
* boxes and the like:
*
* printf("%s",png_get_copyright(NULL));
*
* Also, the PNG logo (in PNG format, of course) is supplied in the
* files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
*/
 
/*
* Libpng is OSI Certified Open Source Software. OSI Certified is a
* certification mark of the Open Source Initiative.
*/
 
/*
* The contributing authors would like to thank all those who helped
* with testing, bug fixes, and patience. This wouldn't have been
* possible without all of you.
*
* Thanks to Frank J. T. Wojcik for helping with the documentation.
*/
 
/*
* Y2K compliance in libpng:
* =========================
*
* October 3, 2002
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.2.5 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
* that will hold years up to 65535. The other two hold the date in text
* format, and will hold years up to 9999.
*
* The integer is
* "png_uint_16 year" in png_time_struct.
*
* The strings are
* "png_charp time_buffer" in png_struct and
* "near_time_buffer", which is a local character string in png.c.
*
* There are seven time-related functions:
* png.c: png_convert_to_rfc_1123() in png.c
* (formerly png_convert_to_rfc_1152() in error)
* png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
* png_convert_from_time_t() in pngwrite.c
* png_get_tIME() in pngget.c
* png_handle_tIME() in pngrutil.c, called in pngread.c
* png_set_tIME() in pngset.c
* png_write_tIME() in pngwutil.c, called in pngwrite.c
*
* All handle dates properly in a Y2K environment. The
* png_convert_from_time_t() function calls gmtime() to convert from system
* clock time, which returns (year - 1900), which we properly convert to
* the full 4-digit year. There is a possibility that applications using
* libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
* function, or that they are incorrectly passing only a 2-digit year
* instead of "year - 1900" into the png_convert_from_struct_tm() function,
* but this is not under our control. The libpng documentation has always
* stated that it works with 4-digit years, and the APIs have been
* documented as such.
*
* The tIME chunk itself is also Y2K compliant. It uses a 2-byte unsigned
* integer to hold the year, and can hold years as large as 65535.
*
* zlib, upon which libpng depends, is also Y2K compliant. It contains
* no date-related code.
*
* Glenn Randers-Pehrson
* libpng maintainer
* PNG Development Group
*/
 
#ifndef PNG_H
#define PNG_H
 
/* This is not the place to learn how to use libpng. The file libpng.txt
* describes how to use libpng, and the file example.c summarizes it
* with some code on which to build. This file is useful for looking
* at the actual function definitions and structure components.
*/
 
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.2.5"
 
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM %DLLNUM%
 
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 2
#define PNG_LIBPNG_VER_RELEASE 5
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
 
#define PNG_LIBPNG_VER_BUILD 0
 
#define PNG_LIBPNG_BUILD_ALPHA 1
#define PNG_LIBPNG_BUILD_BETA 2
#define PNG_LIBPNG_BUILD_RC 3
#define PNG_LIBPNG_BUILD_STABLE 4
#define PNG_LIBPNG_BUILD_TYPEMASK 7
#define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with STABLE only */
#define PNG_LIBPNG_BUILD_TYPE 4
 
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
* version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */
#define PNG_LIBPNG_VER 10205 /* 1.2.5 */
 
#ifndef PNG_VERSION_INFO_ONLY
 
/* include the compression library's header */
#include "zlib.h"
 
/* include all user configurable info, including optional assembler routines */
#include "pngconf.h"
 
/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
/* This file is arranged in several sections. The first section contains
* structure and type definitions. The second section contains the external
* library functions, while the third has the internal library functions,
* which applications aren't expected to use directly.
*/
 
#ifndef PNG_NO_TYPECAST_NULL
#define int_p_NULL (int *)NULL
#define png_bytep_NULL (png_bytep)NULL
#define png_bytepp_NULL (png_bytepp)NULL
#define png_doublep_NULL (png_doublep)NULL
#define png_error_ptr_NULL (png_error_ptr)NULL
#define png_flush_ptr_NULL (png_flush_ptr)NULL
#define png_free_ptr_NULL (png_free_ptr)NULL
#define png_infopp_NULL (png_infopp)NULL
#define png_malloc_ptr_NULL (png_malloc_ptr)NULL
#define png_read_status_ptr_NULL (png_read_status_ptr)NULL
#define png_rw_ptr_NULL (png_rw_ptr)NULL
#define png_structp_NULL (png_structp)NULL
#define png_uint_16p_NULL (png_uint_16p)NULL
#define png_voidp_NULL (png_voidp)NULL
#define png_write_status_ptr_NULL (png_write_status_ptr)NULL
#else
#define int_p_NULL NULL
#define png_bytep_NULL NULL
#define png_bytepp_NULL NULL
#define png_doublep_NULL NULL
#define png_error_ptr_NULL NULL
#define png_flush_ptr_NULL NULL
#define png_free_ptr_NULL NULL
#define png_infopp_NULL NULL
#define png_malloc_ptr_NULL NULL
#define png_read_status_ptr_NULL NULL
#define png_rw_ptr_NULL NULL
#define png_structp_NULL NULL
#define png_uint_16p_NULL NULL
#define png_voidp_NULL NULL
#define png_write_status_ptr_NULL NULL
#endif
 
/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
/* Version information for C files, stored in png.c. This had better match
* the version above.
*/
#ifdef PNG_USE_GLOBAL_ARRAYS
PNG_EXPORT_VAR (const char) png_libpng_ver[18];
/* need room for 99.99.99beta99z */
#else
#define png_libpng_ver png_get_header_ver(NULL)
#endif
 
#ifdef PNG_USE_GLOBAL_ARRAYS
/* This was removed in version 1.0.5c */
/* Structures to facilitate easy interlacing. See png.c for more details */
PNG_EXPORT_VAR (const int FARDATA) png_pass_start[7];
PNG_EXPORT_VAR (const int FARDATA) png_pass_inc[7];
PNG_EXPORT_VAR (const int FARDATA) png_pass_ystart[7];
PNG_EXPORT_VAR (const int FARDATA) png_pass_yinc[7];
PNG_EXPORT_VAR (const int FARDATA) png_pass_mask[7];
PNG_EXPORT_VAR (const int FARDATA) png_pass_dsp_mask[7];
#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
PNG_EXPORT_VAR (const int FARDATA) png_pass_width[7];
#endif
/* This isn't currently used. If you need it, see png.c for more details.
PNG_EXPORT_VAR (const int FARDATA) png_pass_height[7];
*/
#endif
 
#endif /* PNG_NO_EXTERN */
 
/* Three color definitions. The order of the red, green, and blue, (and the
* exact size) is not important, although the size of the fields need to
* be png_byte or png_uint_16 (as defined below).
*/
typedef struct png_color_struct
{
png_byte red;
png_byte green;
png_byte blue;
} png_color;
typedef png_color FAR * png_colorp;
typedef png_color FAR * FAR * png_colorpp;
 
typedef struct png_color_16_struct
{
png_byte index; /* used for palette files */
png_uint_16 red; /* for use in red green blue files */
png_uint_16 green;
png_uint_16 blue;
png_uint_16 gray; /* for use in grayscale files */
} png_color_16;
typedef png_color_16 FAR * png_color_16p;
typedef png_color_16 FAR * FAR * png_color_16pp;
 
typedef struct png_color_8_struct
{
png_byte red; /* for use in red green blue files */
png_byte green;
png_byte blue;
png_byte gray; /* for use in grayscale files */
png_byte alpha; /* for alpha channel files */
} png_color_8;
typedef png_color_8 FAR * png_color_8p;
typedef png_color_8 FAR * FAR * png_color_8pp;
 
/*
* The following two structures are used for the in-core representation
* of sPLT chunks.
*/
typedef struct png_sPLT_entry_struct
{
png_uint_16 red;
png_uint_16 green;
png_uint_16 blue;
png_uint_16 alpha;
png_uint_16 frequency;
} png_sPLT_entry;
typedef png_sPLT_entry FAR * png_sPLT_entryp;
typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp;
 
/* When the depth of the sPLT palette is 8 bits, the color and alpha samples
* occupy the LSB of their respective members, and the MSB of each member
* is zero-filled. The frequency member always occupies the full 16 bits.
*/
 
typedef struct png_sPLT_struct
{
png_charp name; /* palette name */
png_byte depth; /* depth of palette samples */
png_sPLT_entryp entries; /* palette entries */
png_int_32 nentries; /* number of palette entries */
} png_sPLT_t;
typedef png_sPLT_t FAR * png_sPLT_tp;
typedef png_sPLT_t FAR * FAR * png_sPLT_tpp;
 
#ifdef PNG_TEXT_SUPPORTED
/* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,
* and whether that contents is compressed or not. The "key" field
* points to a regular zero-terminated C string. The "text", "lang", and
* "lang_key" fields can be regular C strings, empty strings, or NULL pointers.
* However, the * structure returned by png_get_text() will always contain
* regular zero-terminated C strings (possibly empty), never NULL pointers,
* so they can be safely used in printf() and other string-handling functions.
*/
typedef struct png_text_struct
{
int compression; /* compression value:
-1: tEXt, none
0: zTXt, deflate
1: iTXt, none
2: iTXt, deflate */
png_charp key; /* keyword, 1-79 character description of "text" */
png_charp text; /* comment, may be an empty string (ie "")
or a NULL pointer */
png_size_t text_length; /* length of the text string */
#ifdef PNG_iTXt_SUPPORTED
png_size_t itxt_length; /* length of the itxt string */
png_charp lang; /* language code, 0-79 characters
or a NULL pointer */
png_charp lang_key; /* keyword translated UTF-8 string, 0 or more
chars or a NULL pointer */
#endif
} png_text;
typedef png_text FAR * png_textp;
typedef png_text FAR * FAR * png_textpp;
#endif
 
/* Supported compression types for text in PNG files (tEXt, and zTXt).
* The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */
#define PNG_TEXT_COMPRESSION_NONE_WR -3
#define PNG_TEXT_COMPRESSION_zTXt_WR -2
#define PNG_TEXT_COMPRESSION_NONE -1
#define PNG_TEXT_COMPRESSION_zTXt 0
#define PNG_ITXT_COMPRESSION_NONE 1
#define PNG_ITXT_COMPRESSION_zTXt 2
#define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */
 
/* png_time is a way to hold the time in an machine independent way.
* Two conversions are provided, both from time_t and struct tm. There
* is no portable way to convert to either of these structures, as far
* as I know. If you know of a portable way, send it to me. As a side
* note - PNG has always been Year 2000 compliant!
*/
typedef struct png_time_struct
{
png_uint_16 year; /* full year, as in, 1995 */
png_byte month; /* month of year, 1 - 12 */
png_byte day; /* day of month, 1 - 31 */
png_byte hour; /* hour of day, 0 - 23 */
png_byte minute; /* minute of hour, 0 - 59 */
png_byte second; /* second of minute, 0 - 60 (for leap seconds) */
} png_time;
typedef png_time FAR * png_timep;
typedef png_time FAR * FAR * png_timepp;
 
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
/* png_unknown_chunk is a structure to hold queued chunks for which there is
* no specific support. The idea is that we can use this to queue
* up private chunks for output even though the library doesn't actually
* know about their semantics.
*/
typedef struct png_unknown_chunk_t
{
png_byte name[5];
png_byte *data;
png_size_t size;
 
/* libpng-using applications should NOT directly modify this byte. */
png_byte location; /* mode of operation at read time */
}
png_unknown_chunk;
typedef png_unknown_chunk FAR * png_unknown_chunkp;
typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
#endif
 
/* png_info is a structure that holds the information in a PNG file so
* that the application can find out the characteristics of the image.
* If you are reading the file, this structure will tell you what is
* in the PNG file. If you are writing the file, fill in the information
* you want to put into the PNG file, then call png_write_info().
* The names chosen should be very close to the PNG specification, so
* consult that document for information about the meaning of each field.
*
* With libpng < 0.95, it was only possible to directly set and read the
* the values in the png_info_struct, which meant that the contents and
* order of the values had to remain fixed. With libpng 0.95 and later,
* however, there are now functions that abstract the contents of
* png_info_struct from the application, so this makes it easier to use
* libpng with dynamic libraries, and even makes it possible to use
* libraries that don't have all of the libpng ancillary chunk-handing
* functionality.
*
* In any case, the order of the parameters in png_info_struct should NOT
* be changed for as long as possible to keep compatibility with applications
* that use the old direct-access method with png_info_struct.
*
* The following members may have allocated storage attached that should be
* cleaned up before the structure is discarded: palette, trans, text,
* pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
* splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
* are automatically freed when the info structure is deallocated, if they were
* allocated internally by libpng. This behavior can be changed by means
* of the png_data_freer() function.
*
* More allocation details: all the chunk-reading functions that
* change these members go through the corresponding png_set_*
* functions. A function to clear these members is available: see
* png_free_data(). The png_set_* functions do not depend on being
* able to point info structure members to any of the storage they are
* passed (they make their own copies), EXCEPT that the png_set_text
* functions use the same storage passed to them in the text_ptr or
* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
* functions do not make their own copies.
*/
typedef struct png_info_struct
{
/* the following are necessary for every PNG file */
png_uint_32 width; /* width of image in pixels (from IHDR) */
png_uint_32 height; /* height of image in pixels (from IHDR) */
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
png_uint_32 rowbytes; /* bytes needed to hold an untransformed row */
png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
/* The following three should have been named *_method not *_type */
png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
 
/* The following is informational only on read, and not used on writes. */
png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
png_byte pixel_depth; /* number of bits per pixel */
png_byte spare_byte; /* to align the data, and for future use */
png_byte signature[8]; /* magic bytes read by libpng from start of file */
 
/* The rest of the data is optional. If you are reading, check the
* valid field to see if the information in these are valid. If you
* are writing, set the valid field to those chunks you want written,
* and initialize the appropriate fields below.
*/
 
#if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
/* The gAMA chunk describes the gamma characteristics of the system
* on which the image was created, normally in the range [1.0, 2.5].
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
*/
float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
#endif
 
#if defined(PNG_sRGB_SUPPORTED)
/* GR-P, 0.96a */
/* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
#endif
 
#if defined(PNG_TEXT_SUPPORTED)
/* The tEXt, and zTXt chunks contain human-readable textual data in
* uncompressed, compressed, and optionally compressed forms, respectively.
* The data in "text" is an array of pointers to uncompressed,
* null-terminated C strings. Each chunk has a keyword that describes the
* textual data contained in that chunk. Keywords are not required to be
* unique, and the text string may be empty. Any number of text chunks may
* be in an image.
*/
int num_text; /* number of comments read/to write */
int max_text; /* current size of text array */
png_textp text; /* array of comments read/to write */
#endif /* PNG_TEXT_SUPPORTED */
 
#if defined(PNG_tIME_SUPPORTED)
/* The tIME chunk holds the last time the displayed image data was
* modified. See the png_time struct for the contents of this struct.
*/
png_time mod_time;
#endif
 
#if defined(PNG_sBIT_SUPPORTED)
/* The sBIT chunk specifies the number of significant high-order bits
* in the pixel data. Values are in the range [1, bit_depth], and are
* only specified for the channels in the pixel data. The contents of
* the low-order bits is not specified. Data is valid if
* (valid & PNG_INFO_sBIT) is non-zero.
*/
png_color_8 sig_bit; /* significant bits in color channels */
#endif
 
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
defined(PNG_READ_BACKGROUND_SUPPORTED)
/* The tRNS chunk supplies transparency data for paletted images and
* other image types that don't need a full alpha channel. There are
* "num_trans" transparency values for a paletted image, stored in the
* same order as the palette colors, starting from index 0. Values
* for the data are in the range [0, 255], ranging from fully transparent
* to fully opaque, respectively. For non-paletted images, there is a
* single color specified that should be treated as fully transparent.
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
*/
png_bytep trans; /* transparent values for paletted image */
png_color_16 trans_values; /* transparent color for non-palette image */
#endif
 
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
/* The bKGD chunk gives the suggested image background color if the
* display program does not have its own background color and the image
* is needs to composited onto a background before display. The colors
* in "background" are normally in the same color space/depth as the
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
*/
png_color_16 background;
#endif
 
#if defined(PNG_oFFs_SUPPORTED)
/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
* and downwards from the top-left corner of the display, page, or other
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
*/
png_int_32 x_offset; /* x offset on page */
png_int_32 y_offset; /* y offset on page */
png_byte offset_unit_type; /* offset units type */
#endif
 
#if defined(PNG_pHYs_SUPPORTED)
/* The pHYs chunk gives the physical pixel density of the image for
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
*/
png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
png_uint_32 y_pixels_per_unit; /* vertical pixel density */
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
#endif
 
#if defined(PNG_hIST_SUPPORTED)
/* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a
* reduced-color palette, if required. Data is an array of "num_palette"
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
* is non-zero.
*/
png_uint_16p hist;
#endif
 
#ifdef PNG_cHRM_SUPPORTED
/* The cHRM chunk describes the CIE color characteristics of the monitor
* on which the PNG was created. This data allows the viewer to do gamut
* mapping of the input image to ensure that the viewer sees the same
* colors in the image as the creator. Values are in the range
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
float x_white;
float y_white;
float x_red;
float y_red;
float x_green;
float y_green;
float x_blue;
float y_blue;
#endif
#endif
 
#if defined(PNG_pCAL_SUPPORTED)
/* The pCAL chunk describes a transformation between the stored pixel
* values and original physical data values used to create the image.
* The integer range [0, 2^bit_depth - 1] maps to the floating-point
* range given by [pcal_X0, pcal_X1], and are further transformed by a
* (possibly non-linear) transformation function given by "pcal_type"
* and "pcal_params" into "pcal_units". Please see the PNG_EQUATION_
* defines below, and the PNG-Group's PNG extensions document for a
* complete description of the transformations and how they should be
* implemented, and for a description of the ASCII parameter strings.
* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
*/
png_charp pcal_purpose; /* pCAL chunk description string */
png_int_32 pcal_X0; /* minimum value */
png_int_32 pcal_X1; /* maximum value */
png_charp pcal_units; /* Latin-1 string giving physical units */
png_charpp pcal_params; /* ASCII strings containing parameter values */
png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
png_byte pcal_nparams; /* number of parameters given in pcal_params */
#endif
 
/* New members added in libpng-1.0.6 */
#ifdef PNG_FREE_ME_SUPPORTED
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#endif
 
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
/* storage for unknown chunks that the library doesn't recognize. */
png_unknown_chunkp unknown_chunks;
png_size_t unknown_chunks_num;
#endif
 
#if defined(PNG_iCCP_SUPPORTED)
/* iCCP chunk data. */
png_charp iccp_name; /* profile name */
png_charp iccp_profile; /* International Color Consortium profile data */
/* Note to maintainer: should be png_bytep */
png_uint_32 iccp_proflen; /* ICC profile data length */
png_byte iccp_compression; /* Always zero */
#endif
 
#if defined(PNG_sPLT_SUPPORTED)
/* data on sPLT chunks (there may be more than one). */
png_sPLT_tp splt_palettes;
png_uint_32 splt_palettes_num;
#endif
 
#if defined(PNG_sCAL_SUPPORTED)
/* The sCAL chunk describes the actual physical dimensions of the
* subject matter of the graphic. The chunk contains a unit specification
* a byte value, and two ASCII strings representing floating-point
* values. The values are width and height corresponsing to one pixel
* in the image. This external representation is converted to double
* here. Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.
*/
png_byte scal_unit; /* unit of physical scale */
#ifdef PNG_FLOATING_POINT_SUPPORTED
double scal_pixel_width; /* width of one pixel */
double scal_pixel_height; /* height of one pixel */
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_charp scal_s_width; /* string containing height */
png_charp scal_s_height; /* string containing width */
#endif
#endif
 
#if defined(PNG_INFO_IMAGE_SUPPORTED)
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
png_bytepp row_pointers; /* the image bits */
#endif
 
#if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
#endif
 
#if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
png_fixed_point int_x_white;
png_fixed_point int_y_white;
png_fixed_point int_x_red;
png_fixed_point int_y_red;
png_fixed_point int_x_green;
png_fixed_point int_y_green;
png_fixed_point int_x_blue;
png_fixed_point int_y_blue;
#endif
 
} png_info;
 
typedef png_info FAR * png_infop;
typedef png_info FAR * FAR * png_infopp;
 
/* Maximum positive integer used in PNG is (2^31)-1 */
#define PNG_MAX_UINT ((png_uint_32)0x7fffffffL)
 
/* These describe the color_type field in png_info. */
/* color type masks */
#define PNG_COLOR_MASK_PALETTE 1
#define PNG_COLOR_MASK_COLOR 2
#define PNG_COLOR_MASK_ALPHA 4
 
/* color types. Note that not all combinations are legal */
#define PNG_COLOR_TYPE_GRAY 0
#define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
#define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR)
#define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
/* aliases */
#define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA
#define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA
 
/* This is for compression type. PNG 1.0-1.2 only define the single type. */
#define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
#define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE
 
/* This is for filter type. PNG 1.0-1.2 only define the single type. */
#define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */
#define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */
#define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE
 
/* These are for the interlacing type. These values should NOT be changed. */
#define PNG_INTERLACE_NONE 0 /* Non-interlaced image */
#define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */
#define PNG_INTERLACE_LAST 2 /* Not a valid value */
 
/* These are for the oFFs chunk. These values should NOT be changed. */
#define PNG_OFFSET_PIXEL 0 /* Offset in pixels */
#define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */
#define PNG_OFFSET_LAST 2 /* Not a valid value */
 
/* These are for the pCAL chunk. These values should NOT be changed. */
#define PNG_EQUATION_LINEAR 0 /* Linear transformation */
#define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */
#define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */
#define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */
#define PNG_EQUATION_LAST 4 /* Not a valid value */
 
/* These are for the sCAL chunk. These values should NOT be changed. */
#define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */
#define PNG_SCALE_METER 1 /* meters per pixel */
#define PNG_SCALE_RADIAN 2 /* radians per pixel */
#define PNG_SCALE_LAST 3 /* Not a valid value */
 
/* These are for the pHYs chunk. These values should NOT be changed. */
#define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */
#define PNG_RESOLUTION_METER 1 /* pixels/meter */
#define PNG_RESOLUTION_LAST 2 /* Not a valid value */
 
/* These are for the sRGB chunk. These values should NOT be changed. */
#define PNG_sRGB_INTENT_PERCEPTUAL 0
#define PNG_sRGB_INTENT_RELATIVE 1
#define PNG_sRGB_INTENT_SATURATION 2
#define PNG_sRGB_INTENT_ABSOLUTE 3
#define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */
 
/* This is for text chunks */
#define PNG_KEYWORD_MAX_LENGTH 79
 
/* Maximum number of entries in PLTE/sPLT/tRNS arrays */
#define PNG_MAX_PALETTE_LENGTH 256
 
/* These determine if an ancillary chunk's data has been successfully read
* from the PNG header, or if the application has filled in the corresponding
* data in the info_struct to be written into the output file. The values
* of the PNG_INFO_<chunk> defines should NOT be changed.
*/
#define PNG_INFO_gAMA 0x0001
#define PNG_INFO_sBIT 0x0002
#define PNG_INFO_cHRM 0x0004
#define PNG_INFO_PLTE 0x0008
#define PNG_INFO_tRNS 0x0010
#define PNG_INFO_bKGD 0x0020
#define PNG_INFO_hIST 0x0040
#define PNG_INFO_pHYs 0x0080
#define PNG_INFO_oFFs 0x0100
#define PNG_INFO_tIME 0x0200
#define PNG_INFO_pCAL 0x0400
#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */
#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */
 
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
* the routines for other purposes.
*/
typedef struct png_row_info_struct
{
png_uint_32 width; /* width of row */
png_uint_32 rowbytes; /* number of bytes in row */
png_byte color_type; /* color type of row */
png_byte bit_depth; /* bit depth of row */
png_byte channels; /* number of channels (1, 2, 3, or 4) */
png_byte pixel_depth; /* bits per pixel (depth * channels) */
} png_row_info;
 
typedef png_row_info FAR * png_row_infop;
typedef png_row_info FAR * FAR * png_row_infopp;
 
/* These are the function types for the I/O functions and for the functions
* that allow the user to override the default I/O functions with his or her
* own. The png_error_ptr type should match that of user-supplied warning
* and error functions, while the png_rw_ptr type should match that of the
* user read/write data functions.
*/
typedef struct png_struct_def png_struct;
typedef png_struct FAR * png_structp;
 
typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp));
typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t));
typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp));
typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32,
int));
typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32,
int));
 
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop));
typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));
typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
png_uint_32, int));
#endif
 
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_LEGACY_SUPPORTED)
typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
png_row_infop, png_bytep));
#endif
 
#if defined(PNG_USER_CHUNKS_SUPPORTED)
typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
#endif
 
/* Transform masks for the high-level interface */
#define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */
#define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */
#define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */
#define PNG_TRANSFORM_PACKING 0x0004 /* read and write */
#define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */
#define PNG_TRANSFORM_EXPAND 0x0010 /* read only */
#define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */
#define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */
#define PNG_TRANSFORM_BGR 0x0080 /* read and write */
#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */
#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */
 
/* Flags for MNG supported features */
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
#define PNG_FLAG_MNG_FILTER_64 0x04
#define PNG_ALL_MNG_FEATURES 0x05
 
typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));
 
/* The structure that holds the information to read and write PNG files.
* The only people who need to care about what is inside of this are the
* people who will be modifying the library for their own special needs.
* It should NOT be accessed directly by an application, except to store
* the jmp_buf.
*/
 
struct png_struct_def
{
#ifdef PNG_SETJMP_SUPPORTED
jmp_buf jmpbuf; /* used in png_error */
#endif
png_error_ptr error_fn; /* function for printing errors and aborting */
png_error_ptr warning_fn; /* function for printing warnings */
png_voidp error_ptr; /* user supplied struct for error functions */
png_rw_ptr write_data_fn; /* function for writing output data */
png_rw_ptr read_data_fn; /* function for reading input data */
png_voidp io_ptr; /* ptr to application struct for I/O functions */
 
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
png_user_transform_ptr read_user_transform_fn; /* user read transform */
#endif
 
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
png_user_transform_ptr write_user_transform_fn; /* user write transform */
#endif
 
/* These were added in libpng-1.0.2 */
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
png_voidp user_transform_ptr; /* user supplied struct for user transform */
png_byte user_transform_depth; /* bit depth of user transformed pixels */
png_byte user_transform_channels; /* channels in user transformed pixels */
#endif
#endif
 
png_uint_32 mode; /* tells us where we are in the PNG file */
png_uint_32 flags; /* flags indicating various things to libpng */
png_uint_32 transformations; /* which transformations to perform */
 
z_stream zstream; /* pointer to decompression structure (below) */
png_bytep zbuf; /* buffer for zlib */
png_size_t zbuf_size; /* size of zbuf */
int zlib_level; /* holds zlib compression level */
int zlib_method; /* holds zlib compression method */
int zlib_window_bits; /* holds zlib compression window bits */
int zlib_mem_level; /* holds zlib compression memory level */
int zlib_strategy; /* holds zlib compression strategy */
 
png_uint_32 width; /* width of image in pixels */
png_uint_32 height; /* height of image in pixels */
png_uint_32 num_rows; /* number of rows in current pass */
png_uint_32 usr_width; /* width of row at start of write */
png_uint_32 rowbytes; /* size of row in bytes */
png_uint_32 irowbytes; /* size of current interlaced row in bytes */
png_uint_32 iwidth; /* width of current interlaced row in pixels */
png_uint_32 row_number; /* current row in interlace pass */
png_bytep prev_row; /* buffer to save previous (unfiltered) row */
png_bytep row_buf; /* buffer to save current (unfiltered) row */
png_bytep sub_row; /* buffer to save "sub" row when filtering */
png_bytep up_row; /* buffer to save "up" row when filtering */
png_bytep avg_row; /* buffer to save "avg" row when filtering */
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
png_row_info row_info; /* used for transformation routines */
 
png_uint_32 idat_size; /* current IDAT size for read */
png_uint_32 crc; /* current chunk CRC value */
png_colorp palette; /* palette from the input file */
png_uint_16 num_palette; /* number of color entries in palette */
png_uint_16 num_trans; /* number of transparency values */
png_byte chunk_name[5]; /* null-terminated name of current chunk */
png_byte compression; /* file compression type (always 0) */
png_byte filter; /* file filter type (always 0) */
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
png_byte pass; /* current interlace pass (0 - 6) */
png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
png_byte color_type; /* color type of file */
png_byte bit_depth; /* bit depth of file */
png_byte usr_bit_depth; /* bit depth of users row */
png_byte pixel_depth; /* number of bits per pixel */
png_byte channels; /* number of channels in file */
png_byte usr_channels; /* channels at start of write */
png_byte sig_bytes; /* magic bytes read/written from start of file */
 
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
#ifdef PNG_LEGACY_SUPPORTED
png_byte filler; /* filler byte for pixel expansion */
#else
png_uint_16 filler; /* filler bytes for pixel expansion */
#endif
#endif
 
#if defined(PNG_bKGD_SUPPORTED)
png_byte background_gamma_type;
# ifdef PNG_FLOATING_POINT_SUPPORTED
float background_gamma;
# endif
png_color_16 background; /* background color in screen gamma space */
#if defined(PNG_READ_GAMMA_SUPPORTED)
png_color_16 background_1; /* background normalized to gamma 1.0 */
#endif
#endif /* PNG_bKGD_SUPPORTED */
 
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
png_flush_ptr output_flush_fn;/* Function for flushing output */
png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
png_uint_32 flush_rows; /* number of rows written since last flush */
#endif
 
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
int gamma_shift; /* number of "insignificant" bits 16-bit gamma */
#ifdef PNG_FLOATING_POINT_SUPPORTED
float gamma; /* file gamma value */
float screen_gamma; /* screen gamma value (display_exponent) */
#endif
#endif
 
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep gamma_table; /* gamma table for 8-bit depth files */
png_bytep gamma_from_1; /* converts from 1.0 to screen */
png_bytep gamma_to_1; /* converts from file to 1.0 */
png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
#endif
 
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
png_color_8 sig_bit; /* significant bits in each available channel */
#endif
 
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
png_color_8 shift; /* shift for significant bit tranformation */
#endif
 
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep trans; /* transparency values for paletted files */
png_color_16 trans_values; /* transparency values for non-paletted files */
#endif
 
png_read_status_ptr read_row_fn; /* called after each row is decoded */
png_write_status_ptr write_row_fn; /* called after each row is encoded */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
png_progressive_info_ptr info_fn; /* called after header data fully read */
png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */
png_progressive_end_ptr end_fn; /* called after image is complete */
png_bytep save_buffer_ptr; /* current location in save_buffer */
png_bytep save_buffer; /* buffer for previously read data */
png_bytep current_buffer_ptr; /* current location in current_buffer */
png_bytep current_buffer; /* buffer for recently used data */
png_uint_32 push_length; /* size of current input chunk */
png_uint_32 skip_length; /* bytes to skip in input data */
png_size_t save_buffer_size; /* amount of data now in save_buffer */
png_size_t save_buffer_max; /* total size of save_buffer */
png_size_t buffer_size; /* total amount of available input data */
png_size_t current_buffer_size; /* amount of data now in current_buffer */
int process_mode; /* what push library is currently doing */
int cur_palette; /* current push library palette index */
 
# if defined(PNG_TEXT_SUPPORTED)
png_size_t current_text_size; /* current size of text input data */
png_size_t current_text_left; /* how much text left to read in input */
png_charp current_text; /* current text chunk buffer */
png_charp current_text_ptr; /* current location in current_text */
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
 
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* for the Borland special 64K segment handler */
png_bytepp offset_table_ptr;
png_bytep offset_table;
png_uint_16 offset_table_number;
png_uint_16 offset_table_count;
png_uint_16 offset_table_count_free;
#endif
 
#if defined(PNG_READ_DITHER_SUPPORTED)
png_bytep palette_lookup; /* lookup table for dithering */
png_bytep dither_index; /* index translation for palette files */
#endif
 
#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
png_uint_16p hist; /* histogram */
#endif
 
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
png_byte heuristic_method; /* heuristic for row filter selection */
png_byte num_prev_filters; /* number of weights for previous rows */
png_bytep prev_filters; /* filter type(s) of previous row(s) */
png_uint_16p filter_weights; /* weight(s) for previous line(s) */
png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
png_uint_16p filter_costs; /* relative filter calculation cost */
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
#endif
 
#if defined(PNG_TIME_RFC1123_SUPPORTED)
png_charp time_buffer; /* String to hold RFC 1123 time text */
#endif
 
/* New members added in libpng-1.0.6 */
 
#ifdef PNG_FREE_ME_SUPPORTED
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#endif
 
#if defined(PNG_USER_CHUNKS_SUPPORTED)
png_voidp user_chunk_ptr;
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
#endif
 
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
int num_chunk_list;
png_bytep chunk_list;
#endif
 
/* New members added in libpng-1.0.3 */
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
png_byte rgb_to_gray_status;
/* These were changed from png_byte in libpng-1.0.6 */
png_uint_16 rgb_to_gray_red_coeff;
png_uint_16 rgb_to_gray_green_coeff;
png_uint_16 rgb_to_gray_blue_coeff;
#endif
 
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
/* changed from png_byte to png_uint_32 at version 1.2.0 */
#ifdef PNG_1_0_X
png_byte mng_features_permitted;
#else
png_uint_32 mng_features_permitted;
#endif /* PNG_1_0_X */
#endif
 
/* New member added in libpng-1.0.7 */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_fixed_point int_gamma;
#endif
 
/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
#if defined(PNG_MNG_FEATURES_SUPPORTED)
png_byte filter_type;
#endif
 
#if defined(PNG_1_0_X) || (defined(PNG_DEBUG) && defined(PNG_USE_PNGGCCRD))
/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */
png_uint_32 row_buf_size;
#endif
 
/* New members added in libpng-1.2.0 */
#if !defined(PNG_1_0_X) && defined(PNG_ASSEMBLER_CODE_SUPPORTED)
png_byte mmx_bitdepth_threshold;
png_uint_32 mmx_rowbytes_threshold;
png_uint_32 asm_flags;
#endif
 
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
#ifdef PNG_USER_MEM_SUPPORTED
png_voidp mem_ptr; /* user supplied struct for mem functions */
png_malloc_ptr malloc_fn; /* function for allocating memory */
png_free_ptr free_fn; /* function for freeing memory */
#endif
 
/* New member added in libpng-1.0.13 and 1.2.0 */
png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
 
#if defined(PNG_READ_DITHER_SUPPORTED)
/* The following three members were added at version 1.0.14 and 1.2.4 */
png_bytep dither_sort; /* working sort array */
png_bytep index_to_palette; /* where the original index currently is */
/* in the palette */
png_bytep palette_to_index; /* which original index points to this */
/* palette color */
#endif
 
};
 
 
/* This prevents a compiler error in png.c if png.c and png.h are both at
version 1.2.5
*/
typedef png_structp version_1_2_5;
 
typedef png_struct FAR * FAR * png_structpp;
 
/* Here are the function definitions most commonly used. This is not
* the place to find out how to use libpng. See libpng.txt for the
* full explanation, see example.c for the summary. This just provides
* a simple one line description of the use of each function.
*/
 
/* Returns the version number of the library */
extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void));
 
/* Tell lib we have already handled the first <num_bytes> magic bytes.
* Handling more than 8 bytes from the beginning of the file is an error.
*/
extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr,
int num_bytes));
 
/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
* PNG file. Returns zero if the supplied bytes match the 8-byte PNG
* signature, and non-zero otherwise. Having num_to_check == 0 or
* start > 7 will always fail (ie return non-zero).
*/
extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,
png_size_t num_to_check));
 
/* Simple signature checking function. This is the same as calling
* png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
*/
extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num));
 
/* Allocate and initialize png_ptr struct for reading, and any other memory. */
extern PNG_EXPORT(png_structp,png_create_read_struct)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn));
 
/* Allocate and initialize png_ptr struct for writing, and any other memory */
extern PNG_EXPORT(png_structp,png_create_write_struct)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn));
 
extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size)
PNGARG((png_structp png_ptr));
 
extern PNG_EXPORT(void,png_set_compression_buffer_size)
PNGARG((png_structp png_ptr, png_uint_32 size));
 
/* Reset the compression stream */
extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
 
/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
#ifdef PNG_USER_MEM_SUPPORTED
extern PNG_EXPORT(png_structp,png_create_read_struct_2)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn));
extern PNG_EXPORT(png_structp,png_create_write_struct_2)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn));
#endif
 
/* Write a PNG chunk - size, type, (optional) data, CRC. */
extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr,
png_bytep chunk_name, png_bytep data, png_size_t length));
 
/* Write the start of a PNG chunk - length and chunk name. */
extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr,
png_bytep chunk_name, png_uint_32 length));
 
/* Write the data of a PNG chunk started with png_write_chunk_start(). */
extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr,
png_bytep data, png_size_t length));
 
/* Finish a chunk started with png_write_chunk_start() (includes CRC). */
extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));
 
/* Allocate and initialize the info structure */
extern PNG_EXPORT(png_infop,png_create_info_struct)
PNGARG((png_structp png_ptr));
 
/* Initialize the info structure (old interface - DEPRECATED) */
extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));
#undef png_info_init
#define png_info_init(info_ptr) png_info_init_3(&info_ptr, sizeof(png_info));
extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,
png_size_t png_info_struct_size));
 
/* Writes all the PNG information before the image. */
extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,
png_infop info_ptr));
extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
 
/* read the information before the actual image data. */
extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
 
#if defined(PNG_TIME_RFC1123_SUPPORTED)
extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)
PNGARG((png_structp png_ptr, png_timep ptime));
#endif
 
#if !defined(_WIN32_WCE)
/* "time.h" functions are not supported on WindowsCE */
#if defined(PNG_WRITE_tIME_SUPPORTED)
/* convert from a struct tm to png_time */
extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
struct tm FAR * ttime));
 
/* convert from time_t to png_time. Uses gmtime() */
extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,
time_t ttime));
#endif /* PNG_WRITE_tIME_SUPPORTED */
#endif /* _WIN32_WCE */
 
#if defined(PNG_READ_EXPAND_SUPPORTED)
/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* Use blue, green, red order for pixels. */
extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
/* Expand the grayscale to 24-bit RGB if necessary. */
extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
/* Reduce RGB to grayscale. */
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,
int error_action, double red, double green ));
#endif
extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr,
int error_action, png_fixed_point red, png_fixed_point green ));
extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp
png_ptr));
#endif
 
extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,
png_colorp palette));
 
#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
/* Add a filler byte to 24-bit RGB images. */
extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,
png_uint_32 filler, int flags));
/* The values of the PNG_FILLER_ defines should NOT be changed */
#define PNG_FILLER_BEFORE 0
#define PNG_FILLER_AFTER 1
#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */
 
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* Swap bytes in 16-bit depth files. */
extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */
extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
/* Swap packing order of pixels in bytes. */
extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
/* Converts files to legal bit depths. */
extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr,
png_color_8p true_bits));
#endif
 
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
defined(PNG_WRITE_INTERLACING_SUPPORTED)
/* Have the code handle the interlacing. Returns the number of passes. */
extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
/* Invert monochrome files */
extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
/* Handle alpha and tRNS by replacing with a background color. */
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
png_color_16p background_color, int background_gamma_code,
int need_expand, double background_gamma));
#endif
#define PNG_BACKGROUND_GAMMA_UNKNOWN 0
#define PNG_BACKGROUND_GAMMA_SCREEN 1
#define PNG_BACKGROUND_GAMMA_FILE 2
#define PNG_BACKGROUND_GAMMA_UNIQUE 3
#endif
 
#if defined(PNG_READ_16_TO_8_SUPPORTED)
/* strip the second byte of information from a 16-bit depth file. */
extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_DITHER_SUPPORTED)
/* Turn on dithering, and reduce the palette to the number of colors available. */
extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,
png_colorp palette, int num_palette, int maximum_colors,
png_uint_16p histogram, int full_dither));
#endif
 
#if defined(PNG_READ_GAMMA_SUPPORTED)
/* Handle gamma correction. Screen_gamma=(display_exponent) */
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,
double screen_gamma, double default_file_gamma));
#endif
#endif
 
#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
/* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */
/* Deprecated and will be removed. Use png_permit_mng_features() instead. */
extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr,
int empty_plte_permitted));
#endif
 
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
/* Set how many lines between output flushes - 0 for no flushing */
extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));
/* Flush the current PNG output buffer */
extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));
#endif
 
/* optional update palette with requested transformations */
extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr));
 
/* optional call to update the users info structure */
extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
 
/* read one or more rows of image data. */
extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,
png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));
 
/* read a row of data. */
extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,
png_bytep row,
png_bytep display_row));
 
/* read the whole image into memory at once. */
extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,
png_bytepp image));
 
/* write a row of image data */
extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,
png_bytep row));
 
/* write a few rows of image data */
extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr,
png_bytepp row, png_uint_32 num_rows));
 
/* write the image data */
extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,
png_bytepp image));
 
/* writes the end of the PNG file. */
extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,
png_infop info_ptr));
 
/* read the end of the PNG file. */
extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,
png_infop info_ptr));
 
/* free any memory associated with the png_info_struct */
extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,
png_infopp info_ptr_ptr));
 
/* free any memory associated with the png_struct and the png_info_structs */
extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp
png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
 
/* free all memory used by the read (old method - NOT DLL EXPORTED) */
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
png_infop end_info_ptr));
 
/* free any memory associated with the png_struct and the png_info_structs */
extern PNG_EXPORT(void,png_destroy_write_struct)
PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
 
/* free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
extern void png_write_destroy PNGARG((png_structp png_ptr));
 
/* set the libpng method of handling chunk CRC errors */
extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,
int crit_action, int ancil_action));
 
/* Values for png_set_crc_action() to say how to handle CRC errors in
* ancillary and critical chunks, and whether to use the data contained
* therein. Note that it is impossible to "discard" data in a critical
* chunk. For versions prior to 0.90, the action was always error/quit,
* whereas in version 0.90 and later, the action for CRC errors in ancillary
* chunks is warn/discard. These values should NOT be changed.
*
* value action:critical action:ancillary
*/
#define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */
#define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */
#define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */
#define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */
#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */
#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */
 
/* These functions give the user control over the scan-line filtering in
* libpng and the compression methods used by zlib. These functions are
* mainly useful for testing, as the defaults should work with most users.
* Those users who are tight on memory or want faster performance at the
* expense of compression can modify them. See the compression library
* header file (zlib.h) for an explination of the compression functions.
*/
 
/* set the filtering method(s) used by libpng. Currently, the only valid
* value for "method" is 0.
*/
extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,
int filters));
 
/* Flags for png_set_filter() to say which filters to use. The flags
* are chosen so that they don't conflict with real filter types
* below, in case they are supplied instead of the #defined constants.
* These values should NOT be changed.
*/
#define PNG_NO_FILTERS 0x00
#define PNG_FILTER_NONE 0x08
#define PNG_FILTER_SUB 0x10
#define PNG_FILTER_UP 0x20
#define PNG_FILTER_AVG 0x40
#define PNG_FILTER_PAETH 0x80
#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
PNG_FILTER_AVG | PNG_FILTER_PAETH)
 
/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
* These defines should NOT be changed.
*/
#define PNG_FILTER_VALUE_NONE 0
#define PNG_FILTER_VALUE_SUB 1
#define PNG_FILTER_VALUE_UP 2
#define PNG_FILTER_VALUE_AVG 3
#define PNG_FILTER_VALUE_PAETH 4
#define PNG_FILTER_VALUE_LAST 5
 
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */
/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
* defines, either the default (minimum-sum-of-absolute-differences), or
* the experimental method (weighted-minimum-sum-of-absolute-differences).
*
* Weights are factors >= 1.0, indicating how important it is to keep the
* filter type consistent between rows. Larger numbers mean the current
* filter is that many times as likely to be the same as the "num_weights"
* previous filters. This is cumulative for each previous row with a weight.
* There needs to be "num_weights" values in "filter_weights", or it can be
* NULL if the weights aren't being specified. Weights have no influence on
* the selection of the first row filter. Well chosen weights can (in theory)
* improve the compression for a given image.
*
* Costs are factors >= 1.0 indicating the relative decoding costs of a
* filter type. Higher costs indicate more decoding expense, and are
* therefore less likely to be selected over a filter with lower computational
* costs. There needs to be a value in "filter_costs" for each valid filter
* type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
* setting the costs. Costs try to improve the speed of decompression without
* unduly increasing the compressed image size.
*
* A negative weight or cost indicates the default value is to be used, and
* values in the range [0.0, 1.0) indicate the value is to remain unchanged.
* The default values for both weights and costs are currently 1.0, but may
* change if good general weighting/cost heuristics can be found. If both
* the weights and costs are set to 1.0, this degenerates the WEIGHTED method
* to the UNWEIGHTED method, but with added encoding time/computation.
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
int heuristic_method, int num_weights, png_doublep filter_weights,
png_doublep filter_costs));
#endif
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
 
/* Heuristic used for row filter selection. These defines should NOT be
* changed.
*/
#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */
#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */
#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */
 
/* Set the library compression level. Currently, valid values range from
* 0 - 9, corresponding directly to the zlib compression levels 0 - 9
* (0 - no compression, 9 - "maximal" compression). Note that tests have
* shown that zlib compression levels 3-6 usually perform as well as level 9
* for PNG images, and do considerably fewer caclulations. In the future,
* these values may not correspond directly to the zlib compression levels.
*/
extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr,
int level));
 
extern PNG_EXPORT(void,png_set_compression_mem_level)
PNGARG((png_structp png_ptr, int mem_level));
 
extern PNG_EXPORT(void,png_set_compression_strategy)
PNGARG((png_structp png_ptr, int strategy));
 
extern PNG_EXPORT(void,png_set_compression_window_bits)
PNGARG((png_structp png_ptr, int window_bits));
 
extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,
int method));
 
/* These next functions are called for input/output, memory, and error
* handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
* and call standard C I/O routines such as fread(), fwrite(), and
* fprintf(). These functions can be made to use other I/O routines
* at run time for those applications that need to handle I/O in a
* different manner by calling png_set_???_fn(). See libpng.txt for
* more information.
*/
 
#if !defined(PNG_NO_STDIO)
/* Initialize the input/output for the PNG file to the default functions. */
extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp));
#endif
 
/* Replace the (error and abort), and warning functions with user
* supplied functions. If no messages are to be printed you must still
* write and use replacement functions. The replacement error_fn should
* still do a longjmp to the last setjmp location if you are using this
* method of error handling. If error_fn or warning_fn is NULL, the
* default function will be used.
*/
 
extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr,
png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
 
/* Return the user pointer associated with the error functions */
extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr));
 
/* Replace the default data output functions with a user supplied one(s).
* If buffered output is not used, then output_flush_fn can be set to NULL.
* If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
* output_flush_fn will be ignored (and thus can be NULL).
*/
extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr,
png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
 
/* Replace the default data input function with a user supplied one. */
extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr,
png_voidp io_ptr, png_rw_ptr read_data_fn));
 
/* Return the user pointer associated with the I/O functions */
extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr));
 
extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr,
png_read_status_ptr read_row_fn));
 
extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr,
png_write_status_ptr write_row_fn));
 
#ifdef PNG_USER_MEM_SUPPORTED
/* Replace the default memory allocation functions with user supplied one(s). */
extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr,
png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));
/* Return the user pointer associated with the memory functions */
extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr));
#endif
 
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_LEGACY_SUPPORTED)
extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp
png_ptr, png_user_transform_ptr read_user_transform_fn));
#endif
 
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_LEGACY_SUPPORTED)
extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp
png_ptr, png_user_transform_ptr write_user_transform_fn));
#endif
 
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_LEGACY_SUPPORTED)
extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp
png_ptr, png_voidp user_transform_ptr, int user_transform_depth,
int user_transform_channels));
/* Return the user pointer associated with the user transform functions */
extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr)
PNGARG((png_structp png_ptr));
#endif
 
#ifdef PNG_USER_CHUNKS_SUPPORTED
extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr,
png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp
png_ptr));
#endif
 
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
/* Sets the function callbacks for the push reader, and a pointer to a
* user-defined structure available to the callback functions.
*/
extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr,
png_voidp progressive_ptr,
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
png_progressive_end_ptr end_fn));
 
/* returns the user pointer associated with the push read functions */
extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)
PNGARG((png_structp png_ptr));
 
/* function to be called when data becomes available */
extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));
 
/* function that combines rows. Not very much different than the
* png_combine_row() call. Is this even used?????
*/
extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
png_bytep old_row, png_bytep new_row));
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 
extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
png_uint_32 size));
 
#if defined(PNG_1_0_X)
# define png_malloc_warn png_malloc
#else
/* Added at libpng version 1.2.4 */
extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,
png_uint_32 size));
#endif
 
/* frees a pointer allocated by png_malloc() */
extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
 
#if defined(PNG_1_0_X)
/* Function to allocate memory for zlib. */
extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,
uInt size));
 
/* Function to free memory for zlib */
extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr));
#endif
 
/* Free data that was allocated internally */
extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 free_me, int num));
#ifdef PNG_FREE_ME_SUPPORTED
/* Reassign responsibility for freeing existing data, whether allocated
* by libpng or by the application */
extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
png_infop info_ptr, int freer, png_uint_32 mask));
#endif
/* assignments for png_data_freer */
#define PNG_DESTROY_WILL_FREE_DATA 1
#define PNG_SET_WILL_FREE_DATA 1
#define PNG_USER_WILL_FREE_DATA 2
/* Flags for png_ptr->free_me and info_ptr->free_me */
#define PNG_FREE_HIST 0x0008
#define PNG_FREE_ICCP 0x0010
#define PNG_FREE_SPLT 0x0020
#define PNG_FREE_ROWS 0x0040
#define PNG_FREE_PCAL 0x0080
#define PNG_FREE_SCAL 0x0100
#define PNG_FREE_UNKN 0x0200
#define PNG_FREE_LIST 0x0400
#define PNG_FREE_PLTE 0x1000
#define PNG_FREE_TRNS 0x2000
#define PNG_FREE_TEXT 0x4000
#define PNG_FREE_ALL 0x7fff
#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
 
#ifdef PNG_USER_MEM_SUPPORTED
extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,
png_uint_32 size));
extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr,
png_voidp ptr));
#endif
 
extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr,
png_voidp s1, png_voidp s2, png_uint_32 size));
 
extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr,
png_voidp s1, int value, png_uint_32 size));
 
#if defined(USE_FAR_KEYWORD) /* memory model conversion function */
extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
int check));
#endif /* USE_FAR_KEYWORD */
 
/* Fatal error in PNG image of libpng - can't continue */
extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
png_const_charp error_message));
 
/* The same, but the chunk name is prepended to the error string. */
extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
png_const_charp error_message));
 
/* Non-fatal error in libpng. Can continue, but may have a problem. */
extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,
png_const_charp warning_message));
 
/* Non-fatal error in libpng, chunk name is prepended to message. */
extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,
png_const_charp warning_message));
 
/* The png_set_<chunk> functions are for storing values in the png_info_struct.
* Similarly, the png_get_<chunk> calls are used to read values from the
* png_info_struct, either storing the parameters in the passed variables, or
* setting pointers into the png_info_struct where the data is stored. The
* png_get_<chunk> functions return a non-zero value if the data was available
* in info_ptr, or return zero and do not change any of the parameters if the
* data was not available.
*
* These functions should be used instead of directly accessing png_info
* to avoid problems with future changes in the size and internal layout of
* png_info_struct.
*/
/* Returns "flag" if chunk data is valid in info_ptr. */
extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 flag));
 
/* Returns number of bytes needed to hold a transformed row. */
extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr,
png_infop info_ptr));
 
#if defined(PNG_INFO_IMAGE_SUPPORTED)
/* Returns row_pointers, which is an array of pointers to scanlines that was
returned from png_read_png(). */
extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr,
png_infop info_ptr));
/* Set row_pointers, which is an array of pointers to scanlines for use
by png_write_png(). */
extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytepp row_pointers));
#endif
 
/* Returns number of color channels in image. */
extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr,
png_infop info_ptr));
 
#ifdef PNG_EASY_ACCESS_SUPPORTED
/* Returns image width in pixels. */
extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp
png_ptr, png_infop info_ptr));
 
/* Returns image height in pixels. */
extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp
png_ptr, png_infop info_ptr));
 
/* Returns image bit_depth. */
extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp
png_ptr, png_infop info_ptr));
 
/* Returns image color_type. */
extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp
png_ptr, png_infop info_ptr));
 
/* Returns image filter_type. */
extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp
png_ptr, png_infop info_ptr));
 
/* Returns image interlace_type. */
extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp
png_ptr, png_infop info_ptr));
 
/* Returns image compression_type. */
extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp
png_ptr, png_infop info_ptr));
 
/* Returns image resolution in pixels per meter, from pHYs chunk data. */
extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp
png_ptr, png_infop info_ptr));
extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp
png_ptr, png_infop info_ptr));
extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp
png_ptr, png_infop info_ptr));
 
/* Returns pixel aspect ratio, computed from pHYs chunk data. */
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp
png_ptr, png_infop info_ptr));
#endif
 
/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp
png_ptr, png_infop info_ptr));
extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp
png_ptr, png_infop info_ptr));
extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp
png_ptr, png_infop info_ptr));
extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp
png_ptr, png_infop info_ptr));
 
#endif /* PNG_EASY_ACCESS_SUPPORTED */
 
/* Returns pointer to signature string read from PNG header */
extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
png_infop info_ptr));
 
#if defined(PNG_bKGD_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_16p *background));
#endif
 
#if defined(PNG_bKGD_SUPPORTED)
extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_16p background));
#endif
 
#if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,
png_infop info_ptr, double *white_x, double *white_y, double *red_x,
double *red_y, double *green_x, double *green_y, double *blue_x,
double *blue_y));
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point
*int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y,
png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point
*int_blue_x, png_fixed_point *int_blue_y));
#endif
#endif
 
#if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr,
png_infop info_ptr, double white_x, double white_y, double red_x,
double red_y, double green_x, double green_y, double blue_x, double blue_y));
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
png_fixed_point int_blue_y));
#endif
#endif
 
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
png_infop info_ptr, double *file_gamma));
#endif
extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_fixed_point *int_file_gamma));
#endif
 
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr,
png_infop info_ptr, double file_gamma));
#endif
extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_fixed_point int_file_gamma));
#endif
 
#if defined(PNG_hIST_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_16p *hist));
#endif
 
#if defined(PNG_hIST_SUPPORTED)
extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_16p hist));
#endif
 
extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 *width, png_uint_32 *height,
int *bit_depth, int *color_type, int *interlace_method,
int *compression_method, int *filter_method));
 
extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,
int color_type, int interlace_method, int compression_method,
int filter_method));
 
#if defined(PNG_oFFs_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
int *unit_type));
#endif
 
#if defined(PNG_oFFs_SUPPORTED)
extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y,
int unit_type));
#endif
 
#if defined(PNG_pCAL_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
int *type, int *nparams, png_charp *units, png_charpp *params));
#endif
 
#if defined(PNG_pCAL_SUPPORTED)
extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1,
int type, int nparams, png_charp units, png_charpp params));
#endif
 
#if defined(PNG_pHYs_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
#endif
 
#if defined(PNG_pHYs_SUPPORTED)
extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));
#endif
 
extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_colorp *palette, int *num_palette));
 
extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_colorp palette, int num_palette));
 
#if defined(PNG_sBIT_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_8p *sig_bit));
#endif
 
#if defined(PNG_sBIT_SUPPORTED)
extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_8p sig_bit));
#endif
 
#if defined(PNG_sRGB_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,
png_infop info_ptr, int *intent));
#endif
 
#if defined(PNG_sRGB_SUPPORTED)
extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr,
png_infop info_ptr, int intent));
extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,
png_infop info_ptr, int intent));
#endif
 
#if defined(PNG_iCCP_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen));
/* Note to maintainer: profile should be png_bytepp */
#endif
 
#if defined(PNG_iCCP_SUPPORTED)
extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charp name, int compression_type,
png_charp profile, png_uint_32 proflen));
/* Note to maintainer: profile should be png_bytep */
#endif
 
#if defined(PNG_sPLT_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_sPLT_tpp entries));
#endif
 
#if defined(PNG_sPLT_SUPPORTED)
extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries));
#endif
 
#if defined(PNG_TEXT_SUPPORTED)
/* png_get_text also returns the number of text chunks in *num_text */
extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp *text_ptr, int *num_text));
#endif
 
/*
* Note while png_set_text() will accept a structure whose text,
* language, and translated keywords are NULL pointers, the structure
* returned by png_get_text will always contain regular
* zero-terminated C strings. They might be empty strings but
* they will never be NULL pointers.
*/
 
#if defined(PNG_TEXT_SUPPORTED)
extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text));
#endif
 
#if defined(PNG_tIME_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_timep *mod_time));
#endif
 
#if defined(PNG_tIME_SUPPORTED)
extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_timep mod_time));
#endif
 
#if defined(PNG_tRNS_SUPPORTED)
extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep *trans, int *num_trans,
png_color_16p *trans_values));
#endif
 
#if defined(PNG_tRNS_SUPPORTED)
extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep trans, int num_trans,
png_color_16p trans_values));
#endif
 
#if defined(PNG_tRNS_SUPPORTED)
#endif
 
#if defined(PNG_sCAL_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, int *unit, double *width, double *height));
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr,
png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight));
#endif
#endif
#endif /* PNG_sCAL_SUPPORTED */
 
#if defined(PNG_sCAL_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, int unit, double width, double height));
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,
png_infop info_ptr, int unit, png_charp swidth, png_charp sheight));
#endif
#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
 
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
/* provide a list of chunks and how they are to be handled, if the built-in
handling or default unknown chunk handling is not desired. Any chunks not
listed will be handled in the default manner. The IHDR and IEND chunks
must not be listed.
keep = 0: follow default behavour
= 1: do not keep
= 2: keep only if safe-to-copy
= 3: keep even if unsafe-to-copy
*/
extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp
png_ptr, int keep, png_bytep chunk_list, int num_chunks));
extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));
extern PNG_EXPORT(void, png_set_unknown_chunk_location)
PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location));
extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));
#endif
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep
chunk_name));
#endif
 
/* Png_free_data() will turn off the "valid" flag for anything it frees.
If you need to turn it off for a chunk that your application has freed,
you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */
extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr,
png_infop info_ptr, int mask));
 
#if defined(PNG_INFO_IMAGE_SUPPORTED)
/* The "params" pointer is currently not used and is for future expansion. */
extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,
png_infop info_ptr,
int transforms,
png_voidp params));
extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
png_infop info_ptr,
int transforms,
png_voidp params));
#endif
 
/* Define PNG_DEBUG at compile time for debugging information. Higher
* numbers for PNG_DEBUG mean more debugging information. This has
* only been added since version 0.95 so it is not implemented throughout
* libpng yet, but more support will be added as needed.
*/
#ifdef PNG_DEBUG
#if (PNG_DEBUG > 0)
#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
#include <crtdbg.h>
#if (PNG_DEBUG > 1)
#define png_debug(l,m) _RPT0(_CRT_WARN,m)
#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1)
#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2)
#endif
#else /* PNG_DEBUG_FILE || !_MSC_VER */
#ifndef PNG_DEBUG_FILE
#define PNG_DEBUG_FILE stderr
#endif /* PNG_DEBUG_FILE */
#if (PNG_DEBUG > 1)
#define png_debug(l,m) \
{ \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
}
#define png_debug1(l,m,p1) \
{ \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
}
#define png_debug2(l,m,p1,p2) \
{ \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
}
#endif /* (PNG_DEBUG > 1) */
#endif /* _MSC_VER */
#endif /* (PNG_DEBUG > 0) */
#endif /* PNG_DEBUG */
#ifndef png_debug
#define png_debug(l, m)
#endif
#ifndef png_debug1
#define png_debug1(l, m, p1)
#endif
#ifndef png_debug2
#define png_debug2(l, m, p1, p2)
#endif
 
extern PNG_EXPORT(png_bytep,png_sig_bytes) PNGARG((void));
 
extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
 
#ifdef PNG_MNG_FEATURES_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
png_ptr, png_uint_32 mng_features_permitted));
#endif
 
/* Added to version 1.2.0 */
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */
#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */
#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04
#define PNG_ASM_FLAG_MMX_READ_INTERLACE 0x08
#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB 0x10
#define PNG_ASM_FLAG_MMX_READ_FILTER_UP 0x20
#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG 0x40
#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80
#define PNG_ASM_FLAGS_INITIALIZED 0x80000000 /* not user-settable */
 
#define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH )
#define PNG_MMX_WRITE_FLAGS ( 0 )
 
#define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \
| PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU \
| PNG_MMX_READ_FLAGS \
| PNG_MMX_WRITE_FLAGS )
 
#define PNG_SELECT_READ 1
#define PNG_SELECT_WRITE 2
 
 
#if !defined(PNG_1_0_X)
/* pngget.c */
extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask)
PNGARG((int flag_select, int *compilerID));
 
/* pngget.c */
extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask)
PNGARG((int flag_select));
 
/* pngget.c */
extern PNG_EXPORT(png_uint_32,png_get_asm_flags)
PNGARG((png_structp png_ptr));
 
/* pngget.c */
extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold)
PNGARG((png_structp png_ptr));
 
/* pngget.c */
extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold)
PNGARG((png_structp png_ptr));
 
/* pngset.c */
extern PNG_EXPORT(void,png_set_asm_flags)
PNGARG((png_structp png_ptr, png_uint_32 asm_flags));
 
/* pngset.c */
extern PNG_EXPORT(void,png_set_mmx_thresholds)
PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold,
png_uint_32 mmx_rowbytes_threshold));
 
#endif /* PNG_1_0_X */
#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
 
#if !defined(PNG_1_0_X)
/* png.c, pnggccrd.c, or pngvcrd.c */
extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
 
/* Strip the prepended error numbers ("#nnn ") from error and warning
* messages before passing them to the error or warning handler. */
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
png_ptr, png_uint_32 strip_mode));
#endif
#endif /* PNG_1_0_X */
 
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
 
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.2.5 - October 3, 2002 (header)\n"
 
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
/* With these routines we avoid an integer divide, which will be slower on
* most machines. However, it does take more operations than the corresponding
* divide method, so it may be slower on a few RISC systems. There are two
* shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
*
* Note that the rounding factors are NOT supposed to be the same! 128 and
* 32768 are correct for the NODIV code; 127 and 32767 are correct for the
* standard method.
*
* [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
*/
 
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
 
# define png_composite(composite, fg, alpha, bg) \
{ png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \
+ (png_uint_16)(bg)*(png_uint_16)(255 - \
(png_uint_16)(alpha)) + (png_uint_16)128); \
(composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
 
# define png_composite_16(composite, fg, alpha, bg) \
{ png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \
+ (png_uint_32)(bg)*(png_uint_32)(65535L - \
(png_uint_32)(alpha)) + (png_uint_32)32768L); \
(composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
 
#else /* standard method using integer division */
 
# define png_composite(composite, fg, alpha, bg) \
(composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
(png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
(png_uint_16)127) / 255)
 
# define png_composite_16(composite, fg, alpha, bg) \
(composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
(png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) + \
(png_uint_32)32767) / (png_uint_32)65535L)
 
#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
 
/* These next functions are used internally in the code. They generally
* shouldn't be used unless you are writing code to add or replace some
* functionality in libpng. More information about most functions can
* be found in the files where the functions are located.
*/
 
#if defined(PNG_INTERNAL)
 
/* Various modes of operation. Note that after an init, mode is set to
* zero automatically when the structure is created.
*/
#define PNG_HAVE_IHDR 0x01
#define PNG_HAVE_PLTE 0x02
#define PNG_HAVE_IDAT 0x04
#define PNG_AFTER_IDAT 0x08
#define PNG_HAVE_IEND 0x10
#define PNG_HAVE_gAMA 0x20
#define PNG_HAVE_cHRM 0x40
#define PNG_HAVE_sRGB 0x80
#define PNG_HAVE_CHUNK_HEADER 0x100
#define PNG_WROTE_tIME 0x200
#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
#define PNG_BACKGROUND_IS_GRAY 0x800
#define PNG_HAVE_PNG_SIGNATURE 0x1000
 
/* flags for the transformations the PNG library does on the image data */
#define PNG_BGR 0x0001
#define PNG_INTERLACE 0x0002
#define PNG_PACK 0x0004
#define PNG_SHIFT 0x0008
#define PNG_SWAP_BYTES 0x0010
#define PNG_INVERT_MONO 0x0020
#define PNG_DITHER 0x0040
#define PNG_BACKGROUND 0x0080
#define PNG_BACKGROUND_EXPAND 0x0100
/* 0x0200 unused */
#define PNG_16_TO_8 0x0400
#define PNG_RGBA 0x0800
#define PNG_EXPAND 0x1000
#define PNG_GAMMA 0x2000
#define PNG_GRAY_TO_RGB 0x4000
#define PNG_FILLER 0x8000L
#define PNG_PACKSWAP 0x10000L
#define PNG_SWAP_ALPHA 0x20000L
#define PNG_STRIP_ALPHA 0x40000L
#define PNG_INVERT_ALPHA 0x80000L
#define PNG_USER_TRANSFORM 0x100000L
#define PNG_RGB_TO_GRAY_ERR 0x200000L
#define PNG_RGB_TO_GRAY_WARN 0x400000L
#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
 
/* flags for png_create_struct */
#define PNG_STRUCT_PNG 0x0001
#define PNG_STRUCT_INFO 0x0002
 
/* Scaling factor for filter heuristic weighting calculations */
#define PNG_WEIGHT_SHIFT 8
#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
#define PNG_COST_SHIFT 3
#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
 
/* flags for the png_ptr->flags rather than declaring a byte for each one */
#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
#define PNG_FLAG_ZLIB_CUSTOM_LEVEL 0x0002
#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL 0x0004
#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS 0x0008
#define PNG_FLAG_ZLIB_CUSTOM_METHOD 0x0010
#define PNG_FLAG_ZLIB_FINISHED 0x0020
#define PNG_FLAG_ROW_INIT 0x0040
#define PNG_FLAG_FILLER_AFTER 0x0080
#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100
#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
#define PNG_FLAG_CRC_CRITICAL_USE 0x0400
#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
#define PNG_FLAG_FREE_PLTE 0x1000
#define PNG_FLAG_FREE_TRNS 0x2000
#define PNG_FLAG_FREE_HIST 0x4000
#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000L
#define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000L
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000L
#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000L
#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000L
#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000L
 
/* For use in png_set_keep_unknown, png_handle_as_unknown */
#define HANDLE_CHUNK_AS_DEFAULT 0
#define HANDLE_CHUNK_NEVER 1
#define HANDLE_CHUNK_IF_SAFE 2
#define HANDLE_CHUNK_ALWAYS 3
 
#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
PNG_FLAG_CRC_ANCILLARY_NOWARN)
 
#define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \
PNG_FLAG_CRC_CRITICAL_IGNORE)
 
#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
PNG_FLAG_CRC_CRITICAL_MASK)
 
/* save typing and make code easier to understand */
#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
abs((int)((c1).green) - (int)((c2).green)) + \
abs((int)((c1).blue) - (int)((c2).blue)))
 
/* variables declared in png.c - only it needs to define PNG_NO_EXTERN */
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
/* place to hold the signature string for a PNG file. */
#ifdef PNG_USE_GLOBAL_ARRAYS
PNG_EXPORT_VAR (const png_byte FARDATA) png_sig[8];
#else
#define png_sig png_sig_bytes(NULL)
#endif
#endif /* PNG_NO_EXTERN */
 
/* Constant strings for known chunk types. If you need to add a chunk,
* define the name here, and add an invocation of the macro in png.c and
* wherever it's needed.
*/
#define PNG_IHDR const png_byte png_IHDR[5] = { 73, 72, 68, 82, '\0'}
#define PNG_IDAT const png_byte png_IDAT[5] = { 73, 68, 65, 84, '\0'}
#define PNG_IEND const png_byte png_IEND[5] = { 73, 69, 78, 68, '\0'}
#define PNG_PLTE const png_byte png_PLTE[5] = { 80, 76, 84, 69, '\0'}
#define PNG_bKGD const png_byte png_bKGD[5] = { 98, 75, 71, 68, '\0'}
#define PNG_cHRM const png_byte png_cHRM[5] = { 99, 72, 82, 77, '\0'}
#define PNG_gAMA const png_byte png_gAMA[5] = {103, 65, 77, 65, '\0'}
#define PNG_hIST const png_byte png_hIST[5] = {104, 73, 83, 84, '\0'}
#define PNG_iCCP const png_byte png_iCCP[5] = {105, 67, 67, 80, '\0'}
#define PNG_iTXt const png_byte png_iTXt[5] = {105, 84, 88, 116, '\0'}
#define PNG_oFFs const png_byte png_oFFs[5] = {111, 70, 70, 115, '\0'}
#define PNG_pCAL const png_byte png_pCAL[5] = {112, 67, 65, 76, '\0'}
#define PNG_sCAL const png_byte png_sCAL[5] = {115, 67, 65, 76, '\0'}
#define PNG_pHYs const png_byte png_pHYs[5] = {112, 72, 89, 115, '\0'}
#define PNG_sBIT const png_byte png_sBIT[5] = {115, 66, 73, 84, '\0'}
#define PNG_sPLT const png_byte png_sPLT[5] = {115, 80, 76, 84, '\0'}
#define PNG_sRGB const png_byte png_sRGB[5] = {115, 82, 71, 66, '\0'}
#define PNG_tEXt const png_byte png_tEXt[5] = {116, 69, 88, 116, '\0'}
#define PNG_tIME const png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
#define PNG_tRNS const png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
#define PNG_zTXt const png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
 
#ifdef PNG_USE_GLOBAL_ARRAYS
PNG_EXPORT_VAR (const png_byte FARDATA) png_IHDR[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_IDAT[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_IEND[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_PLTE[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_bKGD[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_cHRM[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_gAMA[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_hIST[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_iCCP[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_iTXt[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_oFFs[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_pCAL[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_sCAL[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_pHYs[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_sBIT[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_sPLT[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_sRGB[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_tEXt[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_tIME[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_tRNS[5];
PNG_EXPORT_VAR (const png_byte FARDATA) png_zTXt[5];
#endif /* PNG_USE_GLOBAL_ARRAYS */
 
 
/* Inline macros to do direct reads of bytes from the input buffer. These
* require that you are using an architecture that uses PNG byte ordering
* (MSB first) and supports unaligned data storage. I think that PowerPC
* in big-endian mode and 680x0 are the only ones that will support this.
* The x86 line of processors definitely do not. The png_get_int_32()
* routine also assumes we are using two's complement format for negative
* values, which is almost certainly true.
*/
#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED)
# define png_get_int_32(buf) ( *((png_int_32p) (buf)))
# endif
# define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
# define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
#else
# if defined(PNG_pCAL_SUPPORTED) || defined(PNG_oFFs_SUPPORTED)
PNG_EXTERN png_int_32 png_get_int_32 PNGARG((png_bytep buf));
# endif
PNG_EXTERN png_uint_32 png_get_uint_32 PNGARG((png_bytep buf));
PNG_EXTERN png_uint_16 png_get_uint_16 PNGARG((png_bytep buf));
#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
 
/* Initialize png_ptr struct for reading, and allocate any other memory.
* (old interface - DEPRECATED - use png_create_read_struct instead).
*/
extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
#undef png_read_init
#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
PNG_LIBPNG_VER_STRING, sizeof(png_struct));
extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
png_const_charp user_png_ver, png_size_t png_struct_size));
extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
png_info_size));
 
/* Initialize png_ptr struct for writing, and allocate any other memory.
* (old interface - DEPRECATED - use png_create_write_struct instead).
*/
extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
#undef png_write_init
#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
PNG_LIBPNG_VER_STRING, sizeof(png_struct));
extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
png_const_charp user_png_ver, png_size_t png_struct_size));
extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
png_info_size));
 
/* Allocate memory for an internal libpng struct */
PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
 
/* Free memory from internal libpng struct */
PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
 
PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
malloc_fn, png_voidp mem_ptr));
PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
png_free_ptr free_fn, png_voidp mem_ptr));
 
/* Free any memory that info_ptr points to and reset struct. */
PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
png_infop info_ptr));
 
#ifndef PNG_1_0_X
/* Function to allocate memory for zlib. */
PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
 
/* Function to free memory for zlib */
PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
 
/* Next four functions are used internally as callbacks. PNGAPI is required
* but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */
 
PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
png_bytep data, png_size_t length));
 
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t length));
#endif
 
PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
png_bytep data, png_size_t length));
 
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
#if !defined(PNG_NO_STDIO)
PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
#endif
#endif
#else /* PNG_1_0_X */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t length));
#endif
#endif /* PNG_1_0_X */
 
/* Reset the CRC variable */
PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
 
/* Write the "data" buffer to whatever output you are using. */
PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
png_size_t length));
 
/* Read data from whatever input you are using into the "data" buffer */
PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
png_size_t length));
 
/* Read bytes into buf, and update png_ptr->crc */
PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
png_size_t length));
 
/* Decompress data in a chunk that uses compression */
#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr,
int comp_type, png_charp chunkdata, png_size_t chunklength,
png_size_t prefix_length, png_size_t *data_length));
#endif
 
/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
 
/* Read the CRC from the file and compare it to the libpng calculated CRC */
PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
 
/* Calculate the CRC over a section of data. Note that we are only
* passing a maximum of 64K on systems that have this as a memory limit,
* since this is the maximum buffer size we can specify.
*/
PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
png_size_t length));
 
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
#endif
 
 
/* Place a 32-bit number into a buffer in PNG byte order (big-endian).
* The only currently known PNG chunks that use signed numbers are
* the ancillary extension chunks, oFFs and pCAL.
*/
PNG_EXTERN void png_save_uint_32 PNGARG((png_bytep buf, png_uint_32 i));
 
#if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
PNG_EXTERN void png_save_int_32 PNGARG((png_bytep buf, png_int_32 i));
#endif
 
/* Place a 16-bit number into a buffer in PNG byte order.
* The parameter is declared unsigned int, not png_uint_16,
* just to avoid potential problems on pre-ANSI C compilers.
*/
PNG_EXTERN void png_save_uint_16 PNGARG((png_bytep buf, unsigned int i));
 
/* simple function to write the signature */
PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
 
/* write various chunks */
 
/* Write the IHDR chunk, and update the png_struct with the necessary
* information.
*/
PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
png_uint_32 height,
int bit_depth, int color_type, int compression_method, int filter_method,
int interlace_method));
 
PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
png_uint_32 num_pal));
 
PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
png_size_t length));
 
PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
 
#if defined(PNG_WRITE_gAMA_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point
file_gamma));
#endif
#endif
 
#if defined(PNG_WRITE_sBIT_SUPPORTED)
PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
int color_type));
#endif
 
#if defined(PNG_WRITE_cHRM_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
double white_x, double white_y,
double red_x, double red_y, double green_x, double green_y,
double blue_x, double blue_y));
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
png_fixed_point int_blue_y));
#endif
#endif
 
#if defined(PNG_WRITE_sRGB_SUPPORTED)
PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
int intent));
#endif
 
#if defined(PNG_WRITE_iCCP_SUPPORTED)
PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
png_charp name, int compression_type,
png_charp profile, int proflen));
/* Note to maintainer: profile should be png_bytep */
#endif
 
#if defined(PNG_WRITE_sPLT_SUPPORTED)
PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
png_sPLT_tp palette));
#endif
 
#if defined(PNG_WRITE_tRNS_SUPPORTED)
PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
png_color_16p values, int number, int color_type));
#endif
 
#if defined(PNG_WRITE_bKGD_SUPPORTED)
PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
png_color_16p values, int color_type));
#endif
 
#if defined(PNG_WRITE_hIST_SUPPORTED)
PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
int num_hist));
#endif
 
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
png_charp key, png_charpp new_key));
#endif
 
#if defined(PNG_WRITE_tEXt_SUPPORTED)
PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
png_charp text, png_size_t text_len));
#endif
 
#if defined(PNG_WRITE_zTXt_SUPPORTED)
PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
png_charp text, png_size_t text_len, int compression));
#endif
 
#if defined(PNG_WRITE_iTXt_SUPPORTED)
PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
int compression, png_charp key, png_charp lang, png_charp lang_key,
png_charp text));
#endif
 
#if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */
PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text));
#endif
 
#if defined(PNG_WRITE_oFFs_SUPPORTED)
PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
png_int_32 x_offset, png_int_32 y_offset, int unit_type));
#endif
 
#if defined(PNG_WRITE_pCAL_SUPPORTED)
PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
png_int_32 X0, png_int_32 X1, int type, int nparams,
png_charp units, png_charpp params));
#endif
 
#if defined(PNG_WRITE_pHYs_SUPPORTED)
PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
int unit_type));
#endif
 
#if defined(PNG_WRITE_tIME_SUPPORTED)
PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
png_timep mod_time));
#endif
 
#if defined(PNG_WRITE_sCAL_SUPPORTED)
#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
int unit, double width, double height));
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
int unit, png_charp width, png_charp height));
#endif
#endif
#endif
 
/* Called when finished processing a row of data */
PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
 
/* Internal use only. Called before first row of data */
PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
 
#if defined(PNG_READ_GAMMA_SUPPORTED)
PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));
#endif
 
/* combine a row of data, dealing with alpha, etc. if requested */
PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
int mask));
 
#if defined(PNG_READ_INTERLACING_SUPPORTED)
/* expand an interlaced row */
/* OLD pre-1.0.9 interface:
PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
png_bytep row, int pass, png_uint_32 transformations));
*/
PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
#endif
 
/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
 
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
/* grab pixels out of a row for an interlaced pass */
PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
png_bytep row, int pass));
#endif
 
/* unfilter a row */
PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
 
/* Choose the best filter to use and filter the row data */
PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
png_row_infop row_info));
 
/* Write out the filtered row. */
PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
png_bytep filtered_row));
/* finish a row while reading, dealing with interlacing passes, etc. */
PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
 
/* initialize the row buffers, etc. */
PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
/* optional call to update the users info structure */
PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
png_infop info_ptr));
 
/* these are the functions that do the transformations */
#if defined(PNG_READ_FILLER_SUPPORTED)
PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
png_bytep row, png_uint_32 filler, png_uint_32 flags));
#endif
 
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
png_bytep row));
#endif
 
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
png_bytep row));
#endif
 
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
png_bytep row));
#endif
 
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
png_bytep row));
#endif
 
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
png_bytep row, png_uint_32 flags));
#endif
 
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
#endif
 
#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
#endif
 
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
row_info, png_bytep row));
#endif
 
#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
png_bytep row));
#endif
 
#if defined(PNG_READ_PACK_SUPPORTED)
PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
#endif
 
#if defined(PNG_READ_SHIFT_SUPPORTED)
PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
png_color_8p sig_bits));
#endif
 
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
#endif
 
#if defined(PNG_READ_16_TO_8_SUPPORTED)
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
#endif
 
#if defined(PNG_READ_DITHER_SUPPORTED)
PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
 
# if defined(PNG_CORRECT_PALETTE_SUPPORTED)
PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
png_colorp palette, int num_palette));
# endif
#endif
 
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
#endif
 
#if defined(PNG_WRITE_PACK_SUPPORTED)
PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
png_bytep row, png_uint_32 bit_depth));
#endif
 
#if defined(PNG_WRITE_SHIFT_SUPPORTED)
PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
png_color_8p bit_depth));
#endif
 
#if defined(PNG_READ_BACKGROUND_SUPPORTED)
#if defined(PNG_READ_GAMMA_SUPPORTED)
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
png_color_16p trans_values, png_color_16p background,
png_color_16p background_1,
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
png_uint_16pp gamma_16_to_1, int gamma_shift));
#else
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
png_color_16p trans_values, png_color_16p background));
#endif
#endif
 
#if defined(PNG_READ_GAMMA_SUPPORTED)
PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
png_bytep gamma_table, png_uint_16pp gamma_16_table,
int gamma_shift));
#endif
 
#if defined(PNG_READ_EXPAND_SUPPORTED)
PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
png_bytep row, png_color_16p trans_value));
#endif
 
/* The following decodes the appropriate chunks, and does error correction,
* then calls the appropriate callback for the chunk if it is valid.
*/
 
/* decode the IHDR chunk */
PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
 
#if defined(PNG_READ_bKGD_SUPPORTED)
PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_cHRM_SUPPORTED)
PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_gAMA_SUPPORTED)
PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_hIST_SUPPORTED)
PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_iCCP_SUPPORTED)
extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif /* PNG_READ_iCCP_SUPPORTED */
 
#if defined(PNG_READ_iTXt_SUPPORTED)
PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_oFFs_SUPPORTED)
PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_pCAL_SUPPORTED)
PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_pHYs_SUPPORTED)
PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_sBIT_SUPPORTED)
PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_sCAL_SUPPORTED)
PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_sPLT_SUPPORTED)
extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif /* PNG_READ_sPLT_SUPPORTED */
 
#if defined(PNG_READ_sRGB_SUPPORTED)
PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_tEXt_SUPPORTED)
PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_tIME_SUPPORTED)
PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_tRNS_SUPPORTED)
PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
#if defined(PNG_READ_zTXt_SUPPORTED)
PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif
 
PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
 
PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
png_bytep chunk_name));
 
/* handle the transformations for reading and writing */
PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
 
PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
 
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
png_uint_32 length));
PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t buffer_length));
PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t buffer_length));
PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
#if defined(PNG_READ_tEXt_SUPPORTED)
PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
#if defined(PNG_READ_zTXt_SUPPORTED)
PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
#if defined(PNG_READ_iTXt_SUPPORTED)
PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
 
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
 
#ifdef PNG_MNG_FEATURES_SUPPORTED
PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
png_bytep row));
PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
png_bytep row));
#endif
 
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
/* png.c */ /* PRIVATE */
PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
#endif
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
 
#endif /* PNG_INTERNAL */
 
#ifdef __cplusplus
}
#endif
 
#endif /* PNG_VERSION_INFO_ONLY */
/* do not put anything past this line */
#endif /* PNG_H */
/shark/trunk/ports/png/makefile
10,17 → 10,14
 
OBJS_PATH = $(BASE)/ports/png
 
PNG = adler32.o compress.o crc32.o deflate.o gzio.o\
infblock.o infcodes.o inffast.o inflate.o inftrees.o\
infutil.o png.o pngerror.o pnggccrd.o pngget.o pngmem.o\
PNG = png.o pngerror.o pnggccrd.o pngget.o pngmem.o\
pngread.o pngpread.o pngrio.o pngrtran.o pngrutil.o\
pngset.o pngtest.o pngtrans.o pngvcrd.o pngwio.o\
pngwrite.o pngwtran.o pngwutil.o trees.o uncompr.o\
zutil.o
pngwrite.o pngwtran.o pngwutil.o
 
OBJS = $(PNG)
 
C_OPT += -I../../../drivers/linuxc24/include -I../include -I. -I..
C_OPT += -I../../../drivers/linuxc24/include -I./include -I. -I../zlib/include
 
include $(BASE)/config/lib.mk
 
/shark/trunk/ports/fftw/include/conffftw.h
0,0 → 1,142
/* -*- C -*- */
/*
* Copyright (c) 1997-1999 Massachusetts Institute of Technology
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
/* fftw.h -- system-wide definitions */
/* $Id: conffftw.h,v 1.1 2003-03-24 11:14:54 pj Exp $ */
 
/* configuration options (guessed by configure) */
 
/* Define to empty if the keyword does not work. */
/* #undef const */
 
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
 
/* Define if you have the BSDgettimeofday function. */
#undef HAVE_BSDGETTIMEOFDAY
 
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
 
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
 
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
 
/* Define if you have the <malloc.h> header file */
#undef HAVE_MALLOC_H
 
/* Define if you have gethrtime() a la Solaris 2 */
#undef HAVE_GETHRTIME
 
/* Define if you have getopt() */
#undef HAVE_GETOPT
 
/* Define if you have getopt_long() */
#undef HAVE_GETOPT_LONG
 
/* Define if you have isnan() */
#undef HAVE_ISNAN
 
/* Define for enabling the high resolution Pentium timer */
#undef FFTW_ENABLE_PENTIUM_TIMER
#define _HARTIK
 
/*
* When using FFTW_ENABLE_PENTIUM_TIMER, set FFTW_CYCLES_PER_SEC
* to your real CPU clock speed!
*/
/* This is for 200 MHz */
#define FFTW_CYCLES_PER_SEC 133000000L
 
/*
* Define to enable a gcc/x86 specific hack that aligns
* the stack to an 8-byte boundary
*/
/* #undef FFTW_ENABLE_I386_HACKS */
 
/* Define to enable extra runtime checks for debugging. */
/* #undef FFTW_DEBUG */
 
/*
* Define to enable extra runtime checks for the alignment of variables
* in the codelets (causes coredump for misaligned double on x86).
*/
/* #undef FFTW_DEBUG_ALIGNMENT */
 
#define FFTW_VERSION "2.1.2"
 
/* Use Win32 high-resolution timer */
#if defined(__WIN32__) || defined(WIN32) || defined(_WINDOWS)
#define HAVE_WIN32_TIMER
#define HAVE_WIN32
#endif
 
/* Use MacOS Time Manager timer */
#if defined(MAC) || defined(macintosh)
#define HAVE_MAC_TIMER
#define HAVE_MACOS
 
/* Define to use nanosecond timer on PCI PowerMacs: */
/* #undef HAVE_MAC_PCI_TIMER */
#endif
 
/* define if you have alloca.h: */
/* #undef HAVE_ALLOCA_H */
 
/* define if you have the alloca function: */
/* #undef HAVE_ALLOCA */
 
/************************** threads configuration ************************/
 
/* The following preprocessor symbols select which threads library
to use when compiling the FFTW threads parallel libraries: */
 
/* #undef FFTW_USING_SOLARIS_THREADS */
/* #undef FFTW_USING_POSIX_THREADS */
/* #undef FFTW_USING_BEOS_THREADS */
/* #undef FFTW_USING_MACH_THREADS */
 
/* #undef HAVE_MACH_CTHREADS_H */
/* #undef HAVE_CTHREADS_H */
/* #undef HAVE_CTHREAD_H */
 
#ifdef HAVE_WIN32
#define FFTW_USING_WIN32_THREADS
#endif
 
#ifdef HAVE_MACOS
#define FFTW_USING_MACOS_THREADS
#endif
 
/*********************** fortran wrapper configuration *********************/
 
/* These symbols select how to mangle function names so that they will
be recognized by the linker. If none of them are defined, then
Fortran wrappers will not be compiled. */
 
/* #undef FFTW_FORTRANIZE_LOWERCASE */
/* #undef FFTW_FORTRANIZE_LOWERCASE_UNDERSCORE */
/* #undef FFTW_FORTRANIZE_UPPERCASE */
/* #undef FFTW_FORTRANIZE_UPPERCASE_UNDERSCORE */
 
/* define the following if names with an underscore get an extra one: */
/* #undef FFTW_FORTRANIZE_EXTRA_UNDERSCORE */
/shark/trunk/ports/fftw/include/fftw-int.h
0,0 → 1,489
/*
* Copyright (c) 1997-1999 Massachusetts Institute of Technology
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
/* fftw.h -- system-wide definitions */
/* $Id: fftw-int.h,v 1.1 2003-03-24 11:14:54 pj Exp $ */
 
#ifndef FFTW_INT_H
#define FFTW_INT_H
#include <conffftw.h>
#include <fftw.h>
 
#ifdef __cplusplus
extern "C" {
#else
#endif /* __cplusplus */
 
/****************************************************************************/
/* Private Functions */
/****************************************************************************/
 
extern fftw_twiddle *fftw_create_twiddle(int n, const fftw_codelet_desc *d);
extern void fftw_destroy_twiddle(fftw_twiddle *tw);
 
extern void fftw_strided_copy(int, fftw_complex *, int, fftw_complex *);
extern void fftw_executor_simple(int, const fftw_complex *, fftw_complex *,
fftw_plan_node *, int, int);
 
extern fftwnd_plan fftwnd_create_plan_aux(int rank, const int *n,
fftw_direction dir, int flags);
extern fftw_plan *fftwnd_new_plan_array(int rank);
extern fftw_plan *fftwnd_create_plans_generic(fftw_plan *plans,
int rank, const int *n,
fftw_direction dir, int flags);
extern fftw_plan *fftwnd_create_plans_specific(fftw_plan *plans,
int rank, const int *n,
const int *n_after,
fftw_direction dir, int flags,
fftw_complex *in, int istride,
fftw_complex *out, int ostride);
extern int fftwnd_work_size(int rank, const int *n, int flags, int ncopies);
 
extern void fftwnd_aux(fftwnd_plan p, int cur_dim,
fftw_complex *in, int istride,
fftw_complex *out, int ostride,
fftw_complex *work);
extern void fftwnd_aux_howmany(fftwnd_plan p, int cur_dim,
int howmany,
fftw_complex *in, int istride, int idist,
fftw_complex *out, int ostride, int odist,
fftw_complex *work);
 
/* wisdom prototypes */
enum fftw_wisdom_category {
FFTW_WISDOM, RFFTW_WISDOM
};
 
extern int fftw_wisdom_lookup(int n, int flags, fftw_direction dir,
enum fftw_wisdom_category category,
int istride, int ostride,
enum fftw_node_type *type,
int *signature, int replace_p);
extern void fftw_wisdom_add(int n, int flags, fftw_direction dir,
enum fftw_wisdom_category cat,
int istride, int ostride,
enum fftw_node_type type,
int signature);
 
/* Private planner functions: */
extern double fftw_estimate_node(fftw_plan_node *p);
extern fftw_plan_node *fftw_make_node_notw(int size,
const fftw_codelet_desc *config);
extern fftw_plan_node *fftw_make_node_real2hc(int size,
const fftw_codelet_desc *config);
extern fftw_plan_node *fftw_make_node_hc2real(int size,
const fftw_codelet_desc *config);
extern fftw_plan_node *fftw_make_node_twiddle(int n,
const fftw_codelet_desc *config,
fftw_plan_node *recurse,
int flags);
extern fftw_plan_node *fftw_make_node_hc2hc(int n,
fftw_direction dir,
const fftw_codelet_desc *config,
fftw_plan_node *recurse,
int flags);
extern fftw_plan_node *fftw_make_node_generic(int n, int size,
fftw_generic_codelet *codelet,
fftw_plan_node *recurse,
int flags);
extern fftw_plan_node *fftw_make_node_rgeneric(int n, int size,
fftw_direction dir,
fftw_rgeneric_codelet * codelet,
fftw_plan_node *recurse,
int flags);
extern int fftw_factor(int n);
extern fftw_plan_node *fftw_make_node(void);
extern fftw_plan fftw_make_plan(int n, fftw_direction dir,
fftw_plan_node *root, int flags,
enum fftw_node_type wisdom_type,
int wisdom_signature);
extern void fftw_use_plan(fftw_plan p);
extern void fftw_use_node(fftw_plan_node *p);
extern void fftw_destroy_plan_internal(fftw_plan p);
extern fftw_plan fftw_pick_better(fftw_plan p1, fftw_plan p2);
extern fftw_plan fftw_lookup(fftw_plan *table, int n, int flags);
extern void fftw_insert(fftw_plan *table, fftw_plan this_plan, int n);
extern void fftw_make_empty_table(fftw_plan *table);
extern void fftw_destroy_table(fftw_plan *table);
extern void fftw_complete_twiddle(fftw_plan_node *p, int n);
 
extern fftw_plan_node *fftw_make_node_rader(int n, int size,
fftw_direction dir,
fftw_plan_node *recurse,
int flags);
extern fftw_rader_data *fftw_rader_top;
 
/****************************************************************************/
/* Floating Point Types */
/****************************************************************************/
 
/*
* We use these definitions to make it easier for people to change
* FFTW to use long double and similar types. You shouldn't have to
* change this just to use float or double.
*/
 
/*
* Change this if your floating-point constants need to be expressed
* in a special way. For example, if fftw_real is long double, you
* will need to append L to your fp constants to make them of the
* same precision. Do this by changing "x" below to "x##L".
*/
#define FFTW_KONST(x) ((fftw_real) x)
 
#define FFTW_TRIG_SIN sin
#define FFTW_TRIG_COS cos
typedef double FFTW_TRIG_REAL; /* the argument type for sin and cos */
 
#define FFTW_K2PI FFTW_KONST(6.2831853071795864769252867665590057683943388)
 
/****************************************************************************/
/* gcc/x86 hacks */
/****************************************************************************/
 
/*
* gcc 2.[78].x and x86 specific hacks. These macros align the stack
* pointer so that the double precision temporary variables in the
* codelets will be aligned to a multiple of 8 bytes (*way* faster on
* pentium and pentiumpro)
*/
#ifdef __GNUC__
#ifdef __i386__
#ifdef FFTW_ENABLE_I386_HACKS
#ifndef FFTW_ENABLE_FLOAT
#define FFTW_USING_I386_HACKS
#define HACK_ALIGN_STACK_EVEN() { \
if ((((long) (__builtin_alloca(0))) & 0x7)) __builtin_alloca(4); \
}
 
#define HACK_ALIGN_STACK_ODD() { \
if (!(((long) (__builtin_alloca(0))) & 0x7)) __builtin_alloca(4); \
}
 
#ifdef FFTW_DEBUG_ALIGNMENT
#define ASSERT_ALIGNED_DOUBLE() { \
double __foo; \
if ((((long) &__foo) & 0x7)) abort(); \
}
#endif
 
#endif
#endif
#endif
#endif
 
#ifndef HACK_ALIGN_STACK_EVEN
#define HACK_ALIGN_STACK_EVEN()
#endif
#ifndef HACK_ALIGN_STACK_ODD
#define HACK_ALIGN_STACK_ODD()
#endif
#ifndef ASSERT_ALIGNED_DOUBLE
#define ASSERT_ALIGNED_DOUBLE()
#endif
 
/****************************************************************************/
/* Timers */
/****************************************************************************/
 
/*
* Here, you can use all the nice timers available in your machine.
*/
 
/*
*
Things you should define to include your own clock:
 
fftw_time -- the data type used to store a time
 
extern fftw_time fftw_get_time(void);
-- a function returning the current time. (We have
implemented this as a macro in most cases.)
 
extern fftw_time fftw_time_diff(fftw_time t1, fftw_time t2);
-- returns the time difference (t1 - t2).
If t1 < t2, it may simply return zero (although this
is not required). (We have implemented this as a macro
in most cases.)
 
extern double fftw_time_to_sec(fftw_time t);
-- returns the time t expressed in seconds, as a double.
(Implemented as a macro in most cases.)
 
FFTW_TIME_MIN -- a double-precision macro holding the minimum
time interval (in seconds) for accurate time measurements.
This should probably be at least 100 times the precision of
your clock (we use even longer intervals, to be conservative).
This will determine how long the planner takes to measure
the speeds of different possible plans.
 
Bracket all of your definitions with an appropriate #ifdef so that
they will be enabled on your machine. If you do add your own
high-precision timer code, let us know (at fftw@theory.lcs.mit.edu).
 
Only declarations should go in this file. Any function definitions
that you need should go into timer.c.
*/
 
/*
* define a symbol so that we know that we have the fftw_time_diff
* function/macro (it did not exist prior to FFTW 1.2)
*/
#define FFTW_HAS_TIME_DIFF
 
/**********************************************
* SOLARIS
**********************************************/
#if defined(HAVE_GETHRTIME)
 
/* we use the nanosecond virtual timer */
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
 
typedef hrtime_t fftw_time;
 
#define fftw_get_time() gethrtime()
#define fftw_time_diff(t1,t2) ((t1) - (t2))
#define fftw_time_to_sec(t) ((double) t / 1.0e9)
 
/*
* a measurement is valid if it runs for at least
* FFTW_TIME_MIN seconds.
*/
#define FFTW_TIME_MIN (1.0e-4) /* for Solaris nanosecond timer */
#define FFTW_TIME_REPEAT 8
 
/**********************************************
* Pentium time stamp counter
**********************************************/
#elif defined(__GNUC__) && defined(__i386__) && defined(FFTW_ENABLE_PENTIUM_TIMER)
 
/*
* Use internal Pentium register (time stamp counter). Resolution
* is 1/FFTW_CYCLES_PER_SEC seconds (e.g. 5 ns for Pentium 200 MHz).
* (This code was contributed by Wolfgang Reimer)
*/
 
#ifndef FFTW_CYCLES_PER_SEC
#error "Must define FFTW_CYCLES_PER_SEC in fftw/config.h to use the Pentium cycle counter"
#endif
 
typedef unsigned long long fftw_time;
 
static __inline__ fftw_time read_tsc()
{
struct {
long unsigned lo, hi;
} counter;
long unsigned sav_eax, sav_edx;
__asm__("movl %%eax,%0":"=m"(sav_eax));
__asm__("movl %%edx,%0":"=m"(sav_edx));
__asm__("rdtsc");
__asm__("movl %%eax,%0":"=m"(counter.lo));
__asm__("movl %%edx,%0":"=m"(counter.hi));
__asm__("movl %0,%%eax": : "m"(sav_eax):"eax");
__asm__("movl %0,%%edx": : "m"(sav_edx):"edx");
return *(fftw_time *) & counter;
}
 
#define fftw_get_time() read_tsc()
#define fftw_time_diff(t1,t2) ((t1) - (t2))
#define fftw_time_to_sec(t) (((double) (t)) / FFTW_CYCLES_PER_SEC)
#define FFTW_TIME_MIN (1.0e-4) /* for Pentium TSC register */
 
/************* generic systems having gettimeofday ************/
#elif defined(HAVE_GETTIMEOFDAY) || defined(HAVE_BSDGETTIMEOFDAY)
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#define FFTW_USE_GETTIMEOFDAY
 
typedef struct timeval fftw_time;
 
extern fftw_time fftw_gettimeofday_get_time(void);
extern fftw_time fftw_gettimeofday_time_diff(fftw_time t1, fftw_time t2);
#define fftw_get_time() fftw_gettimeofday_get_time()
#define fftw_time_diff(t1, t2) fftw_gettimeofday_time_diff(t1, t2)
#define fftw_time_to_sec(t) ((double)(t).tv_sec + (double)(t).tv_usec * 1.0E-6)
 
#ifndef FFTW_TIME_MIN
/* this should be fine on any system claiming a microsecond timer */
#define FFTW_TIME_MIN (1.0e-2)
#endif
 
/**********************************************
* MACINTOSH
**********************************************/
#elif defined(HAVE_MAC_TIMER)
 
/*
* By default, use the microsecond-timer in the Mac Time Manager.
* Alternatively, by changing the following #if 1 to #if 0, you
* can use the nanosecond timer available *only* on PCI PowerMacs.
*/
#ifndef HAVE_MAC_PCI_TIMER /* use time manager */
 
/*
* Use Macintosh Time Manager routines (maximum resolution is about 20
* microseconds).
*/
typedef struct fftw_time_struct {
unsigned long hi, lo;
} fftw_time;
 
extern fftw_time get_Mac_microseconds(void);
 
#define fftw_get_time() get_Mac_microseconds()
 
/* define as a function instead of a macro: */
extern fftw_time fftw_time_diff(fftw_time t1, fftw_time t2);
 
#define fftw_time_to_sec(t) ((t).lo * 1.0e-6 + 4294967295.0e-6 * (t).hi)
 
/* very conservative, since timer should be accurate to 20e-6: */
/* (although this seems not to be the case in practice) */
#define FFTW_TIME_MIN (5.0e-2) /* for MacOS Time Manager timer */
 
#else /* use nanosecond timer */
 
/* Use the nanosecond timer available on PCI PowerMacs. */
 
#include <DriverServices.h>
 
typedef AbsoluteTime fftw_time;
#define fftw_get_time() UpTime()
#define fftw_time_diff(t1,t2) SubAbsoluteFromAbsolute(t1,t2)
#define fftw_time_to_sec(t) (AbsoluteToNanoseconds(t).lo * 1.0e-9)
 
/* Extremely conservative minimum time: */
/* for MacOS PCI PowerMac nanosecond timer */
#define FFTW_TIME_MIN (5.0e-3)
 
#endif /* use nanosecond timer */
 
/**********************************************
* WINDOWS
**********************************************/
#elif defined(HAVE_WIN32_TIMER)
 
#include <time.h>
 
typedef unsigned long fftw_time;
extern unsigned long GetPerfTime(void);
extern double GetPerfSec(double ticks);
 
#define fftw_get_time() GetPerfTime()
#define fftw_time_diff(t1,t2) ((t1) - (t2))
#define fftw_time_to_sec(t) GetPerfSec(t)
 
#define FFTW_TIME_MIN (5.0e-2) /* for Win32 timer */
 
/**********************************************
* CRAY
**********************************************/
#elif defined(_CRAYMPP) /* Cray MPP system */
 
double SECONDR(void); /*
* I think you have to link with -lsci to
* get this
*/
 
typedef double fftw_time;
#define fftw_get_time() SECONDR()
#define fftw_time_diff(t1,t2) ((t1) - (t2))
#define fftw_time_to_sec(t) (t)
 
#define FFTW_TIME_MIN (1.0e-1) /* for Cray MPP SECONDR timer */
 
 
 
/**********************************************
* HARTIK
**********************************************/
#elif defined(_HARTIK) /* Hartik RT system */
 
#include <kernel/kern.h>
 
typedef TIME fftw_time;
 
#define fftw_get_time() sys_gettime(NULL)
#define fftw_time_diff(t1,t2) ((t1) - (t2))
#define fftw_time_to_sec(t) ((double) t / 1.0e6)
 
/*
* a measurement is valid if it runs for at least
* FFTW_TIME_MIN seconds.
*/
#define FFTW_TIME_MIN (1.0e-6)
#define FFTW_TIME_REPEAT 8
 
/**********************************************
* VANILLA UNIX/ISO C SYSTEMS
**********************************************/
/* last resort: use good old Unix clock() */
#else
 
#include <time.h>
 
typedef clock_t fftw_time;
 
#ifndef CLOCKS_PER_SEC
#ifdef sun
/* stupid sunos4 prototypes */
#define CLOCKS_PER_SEC 1000000
extern long clock(void);
#else /* not sun, we don't know CLOCKS_PER_SEC */
#error Please define CLOCKS_PER_SEC
#endif
#endif
 
#define fftw_get_time() clock()
#define fftw_time_diff(t1,t2) ((t1) - (t2))
#define fftw_time_to_sec(t) (((double) (t)) / CLOCKS_PER_SEC)
 
/*
* ***VERY*** conservative constant: this says that a
* measurement must run for 200ms in order to be valid.
* You had better check the manual of your machine
* to discover if it can do better than this
*/
#define FFTW_TIME_MIN (2.0e-1) /* for default clock() timer */
 
#endif /* UNIX clock() */
 
/* take FFTW_TIME_REPEAT measurements... */
#ifndef FFTW_TIME_REPEAT
#define FFTW_TIME_REPEAT 4
#endif
 
/* but do not run for more than TIME_LIMIT seconds while measuring one FFT */
#ifndef FFTW_TIME_LIMIT
#define FFTW_TIME_LIMIT 2.0
#endif
 
#ifdef __cplusplus
} /* extern "C" */
 
#endif /* __cplusplus */
 
#endif /* FFTW_INT_H */
/shark/trunk/ports/fftw/include/f77_func.h
0,0 → 1,61
/*
* Copyright (c) 1997-1999 Massachusetts Institute of Technology
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
#ifndef F77_FUNC_H
#define F77_FUNC_H
 
#include <ports/fftw-int.h>
 
/* Define a macro to mangle function names so that they can be
recognized by the Fortran linker. Specifically, F77_FUNC_
is designed to mangle identifiers containing an underscore. */
 
#ifdef FFTW_FORTRANIZE_LOWERCASE
# ifdef FFTW_FORTRANIZE_EXTRA_UNDERSCORE
# define F77_FUNC_(x,X) x ## _
# else
# define F77_FUNC_(x,X) x
# endif
#endif
 
#ifdef FFTW_FORTRANIZE_LOWERCASE_UNDERSCORE
# ifdef FFTW_FORTRANIZE_EXTRA_UNDERSCORE
# define F77_FUNC_(x,X) x ## __
# else
# define F77_FUNC_(x,X) x ## _
# endif
#endif
 
#ifdef FFTW_FORTRANIZE_UPPERCASE
# ifdef FFTW_FORTRANIZE_EXTRA_UNDERSCORE
# define F77_FUNC_(x,X) X ## _
# else
# define F77_FUNC_(x,X) X
# endif
#endif
 
#ifdef FFTW_FORTRANIZE_UPPERCASE_UNDERSCORE
# ifdef FFTW_FORTRANIZE_EXTRA_UNDERSCORE
# define F77_FUNC_(x,X) X ## __
# else
# define F77_FUNC_(x,X) X ## _
# endif
#endif
 
#endif /* F77_FUNC_H */
/shark/trunk/ports/fftw/include/fftw.h
0,0 → 1,413
/* -*- C -*- */
/*
* Copyright (c) 1997-1999 Massachusetts Institute of Technology
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
/* fftw.h -- system-wide definitions */
/* $Id: fftw.h,v 1.1 2003-03-24 11:14:55 pj Exp $ */
 
#ifndef FFTW_H
#define FFTW_H
 
#include <stdlib.h>
//#include <stdio.h>
//#include "halsa.h"
 
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
/* Define for using single precision */
/*
* If you can, use configure --enable-float instead of changing this
* flag directly
*/
/* #undef FFTW_ENABLE_FLOAT */
 
/* our real numbers */
#ifdef FFTW_ENABLE_FLOAT
typedef float fftw_real;
#else
typedef double fftw_real;
#endif
 
/*********************************************
* Complex numbers and operations
*********************************************/
typedef struct {
fftw_real re, im;
} fftw_complex;
 
#define c_re(c) ((c).re)
#define c_im(c) ((c).im)
 
typedef enum {
FFTW_FORWARD = -1, FFTW_BACKWARD = 1
} fftw_direction;
 
/* backward compatibility with FFTW-1.3 */
typedef fftw_complex FFTW_COMPLEX;
typedef fftw_real FFTW_REAL;
 
#ifndef FFTW_1_0_COMPATIBILITY
#define FFTW_1_0_COMPATIBILITY 0
#endif
 
#if FFTW_1_0_COMPATIBILITY
/* backward compatibility with FFTW-1.0 */
#define REAL fftw_real
#define COMPLEX fftw_complex
#endif
 
/*********************************************
* Success or failure status
*********************************************/
 
typedef enum {
FFTW_SUCCESS = 0, FFTW_FAILURE = -1
} fftw_status;
 
/*********************************************
* Codelets
*********************************************/
typedef void (fftw_notw_codelet)
(const fftw_complex *, fftw_complex *, int, int);
typedef void (fftw_twiddle_codelet)
(fftw_complex *, const fftw_complex *, int,
int, int);
typedef void (fftw_generic_codelet)
(fftw_complex *, const fftw_complex *, int,
int, int, int);
typedef void (fftw_real2hc_codelet)
(const fftw_real *, fftw_real *, fftw_real *,
int, int, int);
typedef void (fftw_hc2real_codelet)
(const fftw_real *, const fftw_real *,
fftw_real *, int, int, int);
typedef void (fftw_hc2hc_codelet)
(fftw_real *, const fftw_complex *,
int, int, int);
typedef void (fftw_rgeneric_codelet)
(fftw_real *, const fftw_complex *, int,
int, int, int);
 
/*********************************************
* Configurations
*********************************************/
/*
* A configuration is a database of all known codelets
*/
 
enum fftw_node_type {
FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER,
FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC
};
 
/* description of a codelet */
typedef struct {
const char *name; /* name of the codelet */
void (*codelet) (); /* pointer to the codelet itself */
int size; /* size of the codelet */
fftw_direction dir; /* direction */
enum fftw_node_type type; /* TWIDDLE or NO_TWIDDLE */
int signature; /* unique id */
int ntwiddle; /* number of twiddle factors */
const int *twiddle_order; /*
* array that determines the order
* in which the codelet expects
* the twiddle factors
*/
} fftw_codelet_desc;
 
/* On Win32, you need to do funny things to access global variables
in shared libraries. Thanks to Andrew Sterian for this hack. */
#if defined(__WIN32__) || defined(WIN32) || defined(_WINDOWS)
# if defined(BUILD_FFTW_DLL)
# define DL_IMPORT(type) __declspec(dllexport) type
# elif defined(USE_FFTW_DLL)
# define DL_IMPORT(type) __declspec(dllimport) type
# else
# define DL_IMPORT(type) type
# endif
#else
# define DL_IMPORT(type) type
#endif
 
extern DL_IMPORT(const char *) fftw_version;
 
/*****************************
* Plans
*****************************/
/*
* A plan is a sequence of reductions to compute a FFT of
* a given size. At each step, the FFT algorithm can:
*
* 1) apply a notw codelet, or
* 2) recurse and apply a twiddle codelet, or
* 3) apply the generic codelet.
*/
 
/* structure that contains twiddle factors */
typedef struct fftw_twiddle_struct {
int n;
const fftw_codelet_desc *cdesc;
fftw_complex *twarray;
struct fftw_twiddle_struct *next;
int refcnt;
} fftw_twiddle;
 
typedef struct fftw_rader_data_struct {
struct fftw_plan_struct *plan;
fftw_complex *omega;
int g, ginv;
int p, flags, refcount;
struct fftw_rader_data_struct *next;
fftw_codelet_desc *cdesc;
} fftw_rader_data;
 
typedef void (fftw_rader_codelet)
(fftw_complex *, const fftw_complex *, int,
int, int, fftw_rader_data *);
 
/* structure that holds all the data needed for a given step */
typedef struct fftw_plan_node_struct {
enum fftw_node_type type;
 
union {
/* nodes of type FFTW_NOTW */
struct {
int size;
fftw_notw_codelet *codelet;
const fftw_codelet_desc *codelet_desc;
} notw;
 
/* nodes of type FFTW_TWIDDLE */
struct {
int size;
fftw_twiddle_codelet *codelet;
fftw_twiddle *tw;
struct fftw_plan_node_struct *recurse;
const fftw_codelet_desc *codelet_desc;
} twiddle;
 
/* nodes of type FFTW_GENERIC */
struct {
int size;
fftw_generic_codelet *codelet;
fftw_twiddle *tw;
struct fftw_plan_node_struct *recurse;
} generic;
 
/* nodes of type FFTW_RADER */
struct {
int size;
fftw_rader_codelet *codelet;
fftw_rader_data *rader_data;
fftw_twiddle *tw;
struct fftw_plan_node_struct *recurse;
} rader;
 
/* nodes of type FFTW_REAL2HC */
struct {
int size;
fftw_real2hc_codelet *codelet;
const fftw_codelet_desc *codelet_desc;
} real2hc;
 
/* nodes of type FFTW_HC2REAL */
struct {
int size;
fftw_hc2real_codelet *codelet;
const fftw_codelet_desc *codelet_desc;
} hc2real;
 
/* nodes of type FFTW_HC2HC */
struct {
int size;
fftw_direction dir;
fftw_hc2hc_codelet *codelet;
fftw_twiddle *tw;
struct fftw_plan_node_struct *recurse;
const fftw_codelet_desc *codelet_desc;
} hc2hc;
 
/* nodes of type FFTW_RGENERIC */
struct {
int size;
fftw_direction dir;
fftw_rgeneric_codelet *codelet;
fftw_twiddle *tw;
struct fftw_plan_node_struct *recurse;
} rgeneric;
} nodeu;
 
int refcnt;
} fftw_plan_node;
 
struct fftw_plan_struct {
int n;
int refcnt;
fftw_direction dir;
int flags;
int wisdom_signature;
enum fftw_node_type wisdom_type;
struct fftw_plan_struct *next;
fftw_plan_node *root;
double cost;
};
 
/* a plan is just an array of instructions */
typedef struct fftw_plan_struct *fftw_plan;
 
/* flags for the planner */
#define FFTW_ESTIMATE (0)
#define FFTW_MEASURE (1)
 
#define FFTW_OUT_OF_PLACE (0)
#define FFTW_IN_PLACE (8)
#define FFTW_USE_WISDOM (16)
 
#define FFTW_THREADSAFE (128) /* guarantee plan is read-only so that the
same plan can be used in parallel by
multiple threads */
 
#define FFTWND_FORCE_BUFFERED (256) /* internal, undocumented flag */
 
extern fftw_plan fftw_create_plan_specific(int n, fftw_direction dir,
int flags,
fftw_complex *in, int istride,
fftw_complex *out, int ostride);
#define FFTW_HAS_PLAN_SPECIFIC
extern fftw_plan fftw_create_plan(int n, fftw_direction dir, int flags);
extern void fftw_print_plan(fftw_plan plan);
extern void fftw_destroy_plan(fftw_plan plan);
extern void fftw(fftw_plan plan, int howmany, fftw_complex *in, int istride,
int idist, fftw_complex *out, int ostride, int odist);
extern void fftw_one(fftw_plan plan, fftw_complex *in, fftw_complex *out);
extern void fftw_die(const char *s);
extern void *fftw_malloc(size_t n);
extern void fftw_free(void *p);
extern void fftw_check_memory_leaks(void);
extern void fftw_print_max_memory_usage(void);
 
typedef void *(*fftw_malloc_type_function) (size_t n);
typedef void (*fftw_free_type_function) (void *p);
typedef void (*fftw_die_type_function) (const char *errString);
extern DL_IMPORT(fftw_malloc_type_function) fftw_malloc_hook;
extern DL_IMPORT(fftw_free_type_function) fftw_free_hook;
extern DL_IMPORT(fftw_die_type_function) fftw_die_hook;
 
extern size_t fftw_sizeof_fftw_real(void);
 
/* Wisdom: */
/*
* define this symbol so that users know we are using a version of FFTW
* with wisdom
*/
//#define FFTW_HAS_WISDOM
extern void fftw_forget_wisdom(void);
extern void fftw_export_wisdom(void (*emitter) (char c, void *), void *data);
extern fftw_status fftw_import_wisdom(int (*g) (void *), void *data);
//extern void fftw_export_wisdom_to_file(FILE *output_file);
//extern fftw_status fftw_import_wisdom_from_file(FILE *input_file);
extern char *fftw_export_wisdom_to_string(void);
extern fftw_status fftw_import_wisdom_from_string(const char *input_string);
 
/*
* define symbol so we know this function is available (it is not in
* older FFTWs)
*/
//#define FFTW_HAS_FPRINT_PLAN
//extern void fftw_fprint_plan(FILE *f, fftw_plan plan);
 
/*****************************
* N-dimensional code
*****************************/
typedef struct {
int is_in_place; /* 1 if for in-place FFTs, 0 otherwise */
 
int rank; /*
* the rank (number of dimensions) of the
* array to be FFTed
*/
int *n; /*
* the dimensions of the array to the
* FFTed
*/
fftw_direction dir;
 
int *n_before; /*
* n_before[i] = product of n[j] for j < i
*/
int *n_after; /* n_after[i] = product of n[j] for j > i */
 
fftw_plan *plans; /* 1d fftw plans for each dimension */
 
int nbuffers, nwork;
fftw_complex *work; /*
* work array big enough to hold
* nbuffers+1 of the largest dimension
* (has nwork elements)
*/
} fftwnd_data;
 
typedef fftwnd_data *fftwnd_plan;
 
/* Initializing the FFTWND plan: */
extern fftwnd_plan fftw2d_create_plan(int nx, int ny, fftw_direction dir,
int flags);
extern fftwnd_plan fftw3d_create_plan(int nx, int ny, int nz,
fftw_direction dir, int flags);
extern fftwnd_plan fftwnd_create_plan(int rank, const int *n,
fftw_direction dir,
int flags);
 
extern fftwnd_plan fftw2d_create_plan_specific(int nx, int ny,
fftw_direction dir,
int flags,
fftw_complex *in, int istride,
fftw_complex *out, int ostride);
extern fftwnd_plan fftw3d_create_plan_specific(int nx, int ny, int nz,
fftw_direction dir, int flags,
fftw_complex *in, int istride,
fftw_complex *out, int ostride);
extern fftwnd_plan fftwnd_create_plan_specific(int rank, const int *n,
fftw_direction dir,
int flags,
fftw_complex *in, int istride,
fftw_complex *out, int ostride);
 
/* Freeing the FFTWND plan: */
extern void fftwnd_destroy_plan(fftwnd_plan plan);
 
/* Printing the plan: */
//extern void fftwnd_fprint_plan(FILE *f, fftwnd_plan p);
extern void fftwnd_print_plan(fftwnd_plan p);
#define FFTWND_HAS_PRINT_PLAN
 
/* Computing the N-Dimensional FFT */
extern void fftwnd(fftwnd_plan plan, int howmany,
fftw_complex *in, int istride, int idist,
fftw_complex *out, int ostride, int odist);
extern void fftwnd_one(fftwnd_plan p, fftw_complex *in, fftw_complex *out);
 
#ifdef __cplusplus
} /* extern "C" */
 
#endif /* __cplusplus */
#endif /* FFTW_H */
/shark/trunk/ports/fftw/include/rfftw.h
0,0 → 1,98
/*
* Copyright (c) 1997-1999 Massachusetts Institute of Technology
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
 
/* rfftw.h -- system-wide definitions for rfftw */
#ifndef RFFTW_H
#define RFFTW_H
 
#include <fftw.h>
 
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
/****************************************************************************/
 
#define RFFTW_V2
 
typedef fftw_plan rfftw_plan;
typedef fftwnd_plan rfftwnd_plan;
 
#define FFTW_REAL_TO_COMPLEX FFTW_FORWARD
#define FFTW_COMPLEX_TO_REAL FFTW_BACKWARD
 
extern void rfftw(rfftw_plan plan, int howmany, fftw_real *in, int istride,
int idist, fftw_real *out, int ostride, int odist);
extern void rfftw_one(rfftw_plan plan, fftw_real *in, fftw_real *out);
 
extern rfftw_plan rfftw_create_plan_specific(int n, fftw_direction dir,
int flags,
fftw_real *in, int istride,
fftw_real *out, int ostride);
 
extern rfftw_plan rfftw_create_plan(int n, fftw_direction dir, int flags);
extern void rfftw_destroy_plan(rfftw_plan plan);
 
//extern void rfftw_fprint_plan(FILE *f, rfftw_plan p);
//extern void rfftw_print_plan(rfftw_plan p);
 
extern void rfftw_executor_simple(int n, fftw_real *in,
fftw_real *out,
fftw_plan_node *p,
int istride,
int ostride);
 
extern rfftwnd_plan rfftwnd_create_plan_specific(int rank, const int *n,
fftw_direction dir, int flags,
fftw_real *in, int istride,
fftw_real *out, int ostride);
extern rfftwnd_plan rfftw2d_create_plan_specific(int nx, int ny,
fftw_direction dir, int flags,
fftw_real *in, int istride,
fftw_real *out, int ostride);
extern rfftwnd_plan rfftw3d_create_plan_specific(int nx, int ny, int nz,
fftw_direction dir, int flags,
fftw_real *in, int istride,
fftw_real *out, int ostride);
extern rfftwnd_plan rfftwnd_create_plan(int rank, const int *n,
fftw_direction dir, int flags);
extern rfftwnd_plan rfftw2d_create_plan(int nx, int ny,
fftw_direction dir, int flags);
extern rfftwnd_plan rfftw3d_create_plan(int nx, int ny, int nz,
fftw_direction dir, int flags);
extern void rfftwnd_destroy_plan(rfftwnd_plan plan);
//extern void rfftwnd_fprint_plan(FILE *f, rfftwnd_plan plan);
extern void rfftwnd_print_plan(rfftwnd_plan plan);
extern void rfftwnd_real_to_complex(rfftwnd_plan p, int howmany,
fftw_real *in, int istride, int idist,
fftw_complex *out, int ostride, int odist);
extern void rfftwnd_complex_to_real(rfftwnd_plan p, int howmany,
fftw_complex *in, int istride, int idist,
fftw_real *out, int ostride, int odist);
extern void rfftwnd_one_real_to_complex(rfftwnd_plan p,
fftw_real *in, fftw_complex *out);
extern void rfftwnd_one_complex_to_real(rfftwnd_plan p,
fftw_complex *in, fftw_real *out);
 
/****************************************************************************/
 
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* RFFTW_H */
/shark/trunk/ports/fftw/rfftw/rgeneric.c
22,8 → 22,8
* rgeneric.c -- "generic" rfftw codelets. They work for all n (and
* they are slow)
*/
#include <ports/fftw-int.h>
#include <ports/rfftw.h>
#include <fftw-int.h>
#include <rfftw.h>
 
/* this code assumes that r and m are both odd */
void fftw_hc2hc_forward_generic(fftw_real *A, const fftw_complex *W,
/shark/trunk/ports/fftw/rfftw/frc_6.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:33 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 6 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: frc_6.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_6.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_6.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_6.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_6.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_6.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_6(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/frc_8.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:34 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 8 */
 
34,9 → 34,9
 
/*
* Generator Id's :
* $Id: frc_8.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_8.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_8.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_8.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_8.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_8.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_8(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/frc_11.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:36 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 11 */
 
43,9 → 43,9
 
/*
* Generator Id's :
* $Id: frc_11.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_11.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_11.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_11.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_11.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_11.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_real2hc_11(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/frc_13.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:36 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 13 */
 
53,9 → 53,9
 
/*
* Generator Id's :
* $Id: frc_13.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_13.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_13.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_13.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_13.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_13.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_real2hc_13(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/frc_32.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:39 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 32 */
 
40,9 → 40,9
 
/*
* Generator Id's :
* $Id: frc_32.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_32.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_32.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_32.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_32.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_32.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_32(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/frc_15.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:39 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 15 */
 
43,9 → 43,9
 
/*
* Generator Id's :
* $Id: frc_15.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_15.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_15.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_15.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_15.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_15.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_15(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/fcr_2.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:04 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 2 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: fcr_2.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_2.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_2.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_2.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_2.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_2.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_2(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_4.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:05 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 4 */
 
34,9 → 34,9
 
/*
* Generator Id's :
* $Id: fcr_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_4.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_4.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_4.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_4(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_6.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:05 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 6 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fcr_6.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_6.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_6.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_6.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_6.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_6.c,v 1.2 2003-03-24 11:14:56 pj Exp $
*/
 
void fftw_hc2real_6(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fhb_10.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:56:06 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-backward 10 */
 
42,9 → 42,9
 
/*
* Generator Id's :
* $Id: fhb_10.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_10.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_10.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_10.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fhb_10.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fhb_10.c,v 1.2 2003-03-24 11:14:56 pj Exp $
*/
 
void fftw_hc2hc_backward_10(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fcr_8.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:06 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 8 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fcr_8.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_8.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_8.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_8.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_8.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_8.c,v 1.2 2003-03-24 11:14:56 pj Exp $
*/
 
void fftw_hc2real_8(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fhf_10.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:36 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-forward 10 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: fhf_10.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_10.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_10.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_10.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhf_10.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhf_10.c,v 1.2 2003-03-24 11:14:57 pj Exp $
*/
 
void fftw_hc2hc_forward_10(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/frc_128.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:41 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 128 */
 
64,9 → 64,9
 
/*
* Generator Id's :
* $Id: frc_128.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_128.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_128.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_128.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_128.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_128.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_real2hc_128(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/fhb_16.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:56:08 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-backward 16 */
 
44,9 → 44,9
 
/*
* Generator Id's :
* $Id: fhb_16.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_16.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_16.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_16.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fhb_16.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fhb_16.c,v 1.2 2003-03-24 11:14:56 pj Exp $
*/
 
void fftw_hc2hc_backward_16(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/rexec.c
21,12 → 21,12
* rexec.c -- execute the fft
*/
 
/* $Id: rexec.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $ */
/* $Id: rexec.c,v 1.2 2003-03-24 11:14:59 pj Exp $ */
//#include <ports/stdio.h>
#include <stdlib.h>
 
#include <ports/fftw-int.h>
#include <ports/rfftw.h>
#include <fftw-int.h>
#include <rfftw.h>
 
void rfftw_strided_copy(int n, fftw_real *in, int ostride,
fftw_real *out)
/shark/trunk/ports/fftw/rfftw/fhf_16.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:39 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-forward 16 */
 
42,9 → 42,9
 
/*
* Generator Id's :
* $Id: fhf_16.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_16.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_16.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_16.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhf_16.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhf_16.c,v 1.2 2003-03-24 11:14:57 pj Exp $
*/
 
void fftw_hc2hc_forward_16(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fcr_11.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:07 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 11 */
 
44,9 → 44,9
 
/*
* Generator Id's :
* $Id: fcr_11.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_11.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_11.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_11.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_11.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_11.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_11(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_13.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:08 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 13 */
 
52,9 → 52,9
 
/*
* Generator Id's :
* $Id: fcr_13.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_13.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_13.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_13.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_13.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_13.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_13(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_32.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:12 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 32 */
 
41,9 → 41,9
 
/*
* Generator Id's :
* $Id: fcr_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_32.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_32.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_32.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_32(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_15.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:11 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 15 */
 
40,9 → 40,9
 
/*
* Generator Id's :
* $Id: fcr_15.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_15.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_15.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_15.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_15.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_15.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_15(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fhb_2.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:57 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-backward 2 */
 
34,9 → 34,9
 
/*
* Generator Id's :
* $Id: fhb_2.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_2.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_2.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_2.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fhb_2.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fhb_2.c,v 1.2 2003-03-24 11:14:56 pj Exp $
*/
 
void fftw_hc2hc_backward_2(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fhb_4.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:58 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-backward 4 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fhb_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_4.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_4.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_4.c,v 1.2 2003-03-24 11:14:57 pj Exp $
*/
 
void fftw_hc2hc_backward_4(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/frc_64.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:40 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 64 */
 
48,9 → 48,9
 
/*
* Generator Id's :
* $Id: frc_64.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_64.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_64.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_64.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_64.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_64.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_64(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/fhf_2.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:28 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-forward 2 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: fhf_2.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_2.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_2.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_2.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhf_2.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhf_2.c,v 1.2 2003-03-24 11:14:57 pj Exp $
*/
 
void fftw_hc2hc_forward_2(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fhb_6.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:56:00 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-backward 6 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: fhb_6.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_6.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_6.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_6.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_6.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_6.c,v 1.2 2003-03-24 11:14:57 pj Exp $
*/
 
void fftw_hc2hc_backward_6(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fhf_4.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:29 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-forward 4 */
 
34,9 → 34,9
 
/*
* Generator Id's :
* $Id: fhf_4.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_4.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_4.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_4.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_4.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_4.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_hc2hc_forward_4(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fhb_8.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:56:04 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-backward 8 */
 
38,9 → 38,9
 
/*
* Generator Id's :
* $Id: fhb_8.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_8.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_8.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_8.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_8.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_8.c,v 1.2 2003-03-24 11:14:57 pj Exp $
*/
 
void fftw_hc2hc_backward_8(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/rexec2.c
17,7 → 17,7
*
*/
 
/* $Id: rexec2.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $ */
/* $Id: rexec2.c,v 1.2 2003-03-24 11:14:59 pj Exp $ */
/*
* rexec2.c -- alternate rfftw executor, specifically designed for the
* multidimensional transforms. Given an extra work array,
25,8 → 25,8
* not destroy the input in hc2real transforms.
*/
 
#include <ports/fftw-int.h>
#include <ports/rfftw.h>
#include <fftw-int.h>
#include <rfftw.h>
 
/* copies halfcomplex array in (contiguous) to fftw_complex array out. */
void rfftw_hc2c(int n, fftw_real *in, fftw_complex *out, int ostride)
/shark/trunk/ports/fftw/rfftw/fhf_6.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:31 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-forward 6 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fhf_6.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_6.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_6.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_6.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_6.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_6.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_hc2hc_forward_6(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/frc_1.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:33 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 1 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: frc_1.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_1.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_1.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_1.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_1.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_1.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_real2hc_1(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/fhf_8.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:34 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-forward 8 */
 
36,9 → 36,9
 
/*
* Generator Id's :
* $Id: fhf_8.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_8.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_8.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_8.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_8.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_8.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_hc2hc_forward_8(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/makefile
10,6 → 10,8
 
OBJS_PATH = $(BASE)/ports/fftw/rfftw
 
OTHERINCL += -I$(BASE)/ports/fftw/include
 
OBJS = frc_1.o frc_2.o frc_3.o frc_4.o frc_5.o frc_6.o frc_7.o frc_8.o \
frc_9.o frc_10.o frc_11.o frc_12.o frc_13.o frc_14.o frc_15.o \
frc_16.o frc_32.o frc_64.o frc_128.o fhf_2.o fhf_3.o fhf_4.o \
/shark/trunk/ports/fftw/rfftw/frc_3.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:33 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 3 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: frc_3.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_3.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_3.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_3.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_3.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_3.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_3(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/frc_5.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:33 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 5 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: frc_5.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_5.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_5.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_5.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_5.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_5.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_5(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/frc_7.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:34 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 7 */
 
39,9 → 39,9
 
/*
* Generator Id's :
* $Id: frc_7.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_7.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_7.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_7.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_7.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_7.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_7(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/frc_9.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:35 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 9 */
 
47,9 → 47,9
 
/*
* Generator Id's :
* $Id: frc_9.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_9.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_9.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_9.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_9.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_9.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_9(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/fcr_128.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:15 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 128 */
 
65,9 → 65,9
 
/*
* Generator Id's :
* $Id: fcr_128.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_128.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_128.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_128.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_128.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_128.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_128(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/frc_10.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:35 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 10 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: frc_10.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_10.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_10.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_10.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_10.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_10.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_real2hc_10(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/rfftwnd.c
17,10 → 17,10
*
*/
 
/* $Id: rfftwnd.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $ */
/* $Id: rfftwnd.c,v 1.2 2003-03-24 11:14:59 pj Exp $ */
 
#include <ports/fftw-int.h>
#include <ports/rfftw.h>
#include <fftw-int.h>
#include <rfftw.h>
 
/********************** prototypes for rexec2 routines **********************/
 
/shark/trunk/ports/fftw/rfftw/frc_12.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:36 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 12 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: frc_12.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_12.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_12.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_12.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_12.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_12.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_real2hc_12(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/frc_14.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:38 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 14 */
 
39,9 → 39,9
 
/*
* Generator Id's :
* $Id: frc_14.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_14.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_14.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: frc_14.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_14.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: frc_14.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_real2hc_14(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/frc_16.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:39 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 16 */
 
36,9 → 36,9
 
/*
* Generator Id's :
* $Id: frc_16.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_16.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_16.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_16.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_16.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_16.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_16(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/rplanner.c
21,7 → 21,7
* planner.c -- find the optimal plan
*/
 
/* $Id: rplanner.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $ */
/* $Id: rplanner.c,v 1.2 2003-03-24 11:14:59 pj Exp $ */
#ifdef FFTW_USING_CILK
#include <cilk.h>
#include <cilk-compat.h>
30,8 → 30,8
#include <stdlib.h>
//#include <stdio.h>
 
#include <ports/fftw-int.h>
#include <ports/rfftw.h>
#include <fftw-int.h>
#include <rfftw.h>
 
extern fftw_codelet_desc *rfftw_config[]; /* global from rconfig.c */
extern fftw_rgeneric_codelet fftw_hc2hc_forward_generic;
/shark/trunk/ports/fftw/rfftw/fcr_64.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:13 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 64 */
 
49,9 → 49,9
 
/*
* Generator Id's :
* $Id: fcr_64.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_64.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_64.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_64.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_64.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_64.c,v 1.2 2003-03-24 11:14:56 pj Exp $
*/
 
void fftw_hc2real_64(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_1.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:04 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 1 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: fcr_1.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_1.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_1.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_1.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_1.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_1.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_1(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_3.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:04 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 3 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fcr_3.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_3.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_3.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_3.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_3.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_3.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_3(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_5.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:05 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 5 */
 
38,9 → 38,9
 
/*
* Generator Id's :
* $Id: fcr_5.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_5.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_5.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_5.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_5.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_5.c,v 1.2 2003-03-24 11:14:56 pj Exp $
*/
 
void fftw_hc2real_5(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_7.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:06 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 7 */
 
40,9 → 40,9
 
/*
* Generator Id's :
* $Id: fcr_7.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_7.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_7.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_7.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_7.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_7.c,v 1.2 2003-03-24 11:14:56 pj Exp $
*/
 
void fftw_hc2real_7(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_9.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:06 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 9 */
 
45,9 → 45,9
 
/*
* Generator Id's :
* $Id: fcr_9.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_9.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_9.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_9.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_9.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fcr_9.c,v 1.2 2003-03-24 11:14:56 pj Exp $
*/
 
void fftw_hc2real_9(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fhb_32.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:56:10 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-backward 32 */
 
56,9 → 56,9
 
/*
* Generator Id's :
* $Id: fhb_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_32.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fhb_32.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fhb_32.c,v 1.2 2003-03-24 11:14:56 pj Exp $
*/
 
void fftw_hc2hc_backward_32(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fhf_32.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:39 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-forward 32 */
 
56,9 → 56,9
 
/*
* Generator Id's :
* $Id: fhf_32.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_32.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_32.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_32.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhf_32.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhf_32.c,v 1.2 2003-03-24 11:14:57 pj Exp $
*/
 
void fftw_hc2hc_forward_32(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fcr_10.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:06 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 10 */
 
38,9 → 38,9
 
/*
* Generator Id's :
* $Id: fcr_10.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_10.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_10.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_10.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_10.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_10.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_10(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_12.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:07 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 12 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fcr_12.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_12.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_12.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_12.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_12.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_12.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_12(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_14.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:10 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 14 */
 
40,9 → 40,9
 
/*
* Generator Id's :
* $Id: fcr_14.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_14.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_14.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_14.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_14.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_14.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_14(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fcr_16.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:11 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2real 16 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: fcr_16.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_16.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_16.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fcr_16.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_16.c,v 1.2 2003-03-24 11:14:55 pj Exp $
* $Id: fcr_16.c,v 1.2 2003-03-24 11:14:55 pj Exp $
*/
 
void fftw_hc2real_16(const fftw_real *real_input, const fftw_real *imag_input, fftw_real *output, int real_istride, int imag_istride, int ostride)
/shark/trunk/ports/fftw/rfftw/fhb_3.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:58 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-backward 3 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: fhb_3.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_3.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_3.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: fhb_3.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fhb_3.c,v 1.2 2003-03-24 11:14:56 pj Exp $
* $Id: fhb_3.c,v 1.2 2003-03-24 11:14:56 pj Exp $
*/
 
void fftw_hc2hc_backward_3(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fhb_5.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:59 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-backward 5 */
 
42,9 → 42,9
 
/*
* Generator Id's :
* $Id: fhb_5.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_5.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_5.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_5.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_5.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_5.c,v 1.2 2003-03-24 11:14:57 pj Exp $
*/
 
void fftw_hc2hc_backward_5(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fhf_3.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:29 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-forward 3 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fhf_3.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_3.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_3.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_3.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhf_3.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhf_3.c,v 1.2 2003-03-24 11:14:57 pj Exp $
*/
 
void fftw_hc2hc_forward_3(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fhb_7.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:56:02 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-backward 7 */
 
46,9 → 46,9
 
/*
* Generator Id's :
* $Id: fhb_7.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_7.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_7.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_7.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_7.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_7.c,v 1.2 2003-03-24 11:14:57 pj Exp $
*/
 
void fftw_hc2hc_backward_7(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/rconfig.c
39,8 → 39,8
/* rconfig.c -- this file contains all the real-complex codelets
* the system knows about */
 
#include <ports/fftw-int.h>
#include <ports/rfftw.h>
#include <fftw-int.h>
#include <rfftw.h>
 
#define NOTW_CODELET(x) \
&fftw_real2hc_##x##_desc
/shark/trunk/ports/fftw/rfftw/fhf_5.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:30 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-forward 5 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: fhf_5.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_5.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_5.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_5.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_5.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_5.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_hc2hc_forward_5(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fhb_9.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:56:05 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-backward 9 */
 
53,9 → 53,9
 
/*
* Generator Id's :
* $Id: fhb_9.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_9.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_9.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhb_9.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_9.c,v 1.2 2003-03-24 11:14:57 pj Exp $
* $Id: fhb_9.c,v 1.2 2003-03-24 11:14:57 pj Exp $
*/
 
void fftw_hc2hc_backward_9(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/fhf_7.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:32 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-forward 7 */
 
39,9 → 39,9
 
/*
* Generator Id's :
* $Id: fhf_7.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_7.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_7.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_7.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_7.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_7.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_hc2hc_forward_7(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/frc_2.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:33 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 2 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: frc_2.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_2.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_2.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_2.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_2.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_2.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_2(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/rfftw/fhf_9.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:35 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -hc2hc-forward 9 */
 
47,9 → 47,9
 
/*
* Generator Id's :
* $Id: fhf_9.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_9.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_9.c,v 1.1.1.1 2002-03-29 14:12:58 pj Exp $
* $Id: fhf_9.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_9.c,v 1.2 2003-03-24 11:14:58 pj Exp $
* $Id: fhf_9.c,v 1.2 2003-03-24 11:14:58 pj Exp $
*/
 
void fftw_hc2hc_forward_9(fftw_real *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/rfftw/frc_4.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:33 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -real2hc 4 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: frc_4.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_4.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_4.c,v 1.1.1.1 2002-03-29 14:12:59 pj Exp $
* $Id: frc_4.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_4.c,v 1.2 2003-03-24 11:14:59 pj Exp $
* $Id: frc_4.c,v 1.2 2003-03-24 11:14:59 pj Exp $
*/
 
void fftw_real2hc_4(const fftw_real *input, fftw_real *real_output, fftw_real *imag_output, int istride, int real_ostride, int imag_ostride)
/shark/trunk/ports/fftw/fftw/fni_4.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:43 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 4 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: fni_4.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_4.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_4.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_4.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_4.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_4.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftwi_no_twiddle_4(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fni_6.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:44 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 6 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fni_6.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_6.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_6.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_6.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_6.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_6.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftwi_no_twiddle_6(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/wisdom.c
21,7 → 21,7
* wisdom.c -- manage the wisdom
*/
 
#include <ports/fftw-int.h>
#include <fftw-int.h>
//#include <ports/stdio.h>
#include <stdlib.h>
//#include <ports/ctype.h>
/shark/trunk/ports/fftw/fftw/fni_8.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:46 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 8 */
 
34,9 → 34,9
 
/*
* Generator Id's :
* $Id: fni_8.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_8.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_8.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_8.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_8.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_8.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftwi_no_twiddle_8(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fn_10.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:27 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 10 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: fn_10.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_10.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_10.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_10.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_10.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_10.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_10(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fn_12.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:28 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 12 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fn_12.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_12.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_12.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_12.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_12.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_12.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_12(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/config.c
19,9 → 19,9
 
/* config.c -- this file contains all the codelets the system knows about */
 
/* $Id: config.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $ */
/* $Id: config.c,v 1.2 2003-03-24 11:14:49 pj Exp $ */
 
#include <ports/fftw-int.h>
#include <fftw-int.h>
 
/* the signature is the same as the size, for now */
#define NOTW_CODELET(x) \
/shark/trunk/ports/fftw/fftw/fn_14.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:28 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 14 */
 
39,9 → 39,9
 
/*
* Generator Id's :
* $Id: fn_14.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_14.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_14.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_14.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_14.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_14.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_14(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftwi_10.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:52 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 10 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: ftwi_10.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_10.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_10.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_10.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_10.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_10.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftwi_twiddle_10(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fn_16.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:31 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 16 */
 
36,9 → 36,9
 
/*
* Generator Id's :
* $Id: fn_16.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_16.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_16.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_16.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_16.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_16.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_16(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fni_10.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:48 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 10 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: fni_10.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_10.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_10.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_10.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_10.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_10.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftwi_no_twiddle_10(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fni_12.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:50 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 12 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fni_12.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_12.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_12.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_12.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_12.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_12.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftwi_no_twiddle_12(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftwi_16.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:52 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 16 */
 
36,9 → 36,9
 
/*
* Generator Id's :
* $Id: ftwi_16.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_16.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_16.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_16.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_16.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_16.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftwi_twiddle_16(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fni_14.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:52 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 14 */
 
39,9 → 39,9
 
/*
* Generator Id's :
* $Id: fni_14.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_14.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_14.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_14.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_14.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_14.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftwi_no_twiddle_14(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftw_3.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:18 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 3 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: ftw_3.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_3.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_3.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_3.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_3.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_3.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftw_twiddle_3(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fni_16.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:55 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 16 */
 
36,9 → 36,9
 
/*
* Generator Id's :
* $Id: fni_16.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_16.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_16.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_16.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_16.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_16.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftwi_no_twiddle_16(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftw_5.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:19 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 5 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: ftw_5.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_5.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_5.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_5.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_5.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_5.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftw_twiddle_5(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fn_2.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:26 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 2 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: fn_2.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_2.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_2.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_2.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_2.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_2.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_2(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftw_7.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:20 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 7 */
 
39,9 → 39,9
 
/*
* Generator Id's :
* $Id: ftw_7.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_7.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_7.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_7.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftw_7.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftw_7.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftw_twiddle_7(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fn_4.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:27 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 4 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: fn_4.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_4.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_4.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_4.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_4.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_4.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_4(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftw_9.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:22 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 9 */
 
41,9 → 41,9
 
/*
* Generator Id's :
* $Id: ftw_9.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_9.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_9.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_9.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftw_9.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftw_9.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftw_twiddle_9(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fn_6.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:27 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 6 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fn_6.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_6.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_6.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_6.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_6.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_6.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_6(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fn_8.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:27 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 8 */
 
34,9 → 34,9
 
/*
* Generator Id's :
* $Id: fn_8.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_8.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_8.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_8.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fn_8.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fn_8.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftw_no_twiddle_8(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftwi_3.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:46 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 3 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: ftwi_3.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_3.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_3.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_3.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_3.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_3.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftwi_twiddle_3(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/ftwi_5.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:47 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 5 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: ftwi_5.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_5.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_5.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_5.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_5.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_5.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftwi_twiddle_5(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/ftwi_7.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:48 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 7 */
 
39,9 → 39,9
 
/*
* Generator Id's :
* $Id: ftwi_7.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_7.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_7.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_7.c,v 1.2 2003-03-24 11:14:54 pj Exp $
* $Id: ftwi_7.c,v 1.2 2003-03-24 11:14:54 pj Exp $
* $Id: ftwi_7.c,v 1.2 2003-03-24 11:14:54 pj Exp $
*/
 
void fftwi_twiddle_7(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/planner.c
21,13 → 21,13
* planner.c -- find the optimal plan
*/
 
/* $Id: planner.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $ */
/* $Id: planner.c,v 1.2 2003-03-24 11:14:54 pj Exp $ */
#ifdef FFTW_USING_CILK
#include <ports/cilk.h>
#include <ports/cilk-compat.h>
#include <cilk.h>
#include <cilk-compat.h>
#endif
 
#include <ports/fftw-int.h>
#include <fftw-int.h>
#include <stdlib.h>
//#include <ports/stdio.h>
 
/shark/trunk/ports/fftw/fftw/ftwi_9.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:50 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 9 */
 
41,9 → 41,9
 
/*
* Generator Id's :
* $Id: ftwi_9.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_9.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_9.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_9.c,v 1.2 2003-03-24 11:14:54 pj Exp $
* $Id: ftwi_9.c,v 1.2 2003-03-24 11:14:54 pj Exp $
* $Id: ftwi_9.c,v 1.2 2003-03-24 11:14:54 pj Exp $
*/
 
void fftwi_twiddle_9(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/ftw_32.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:24 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 32 */
 
40,9 → 40,9
 
/*
* Generator Id's :
* $Id: ftw_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_32.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_32.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_32.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftw_twiddle_32(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/wisdomio.c
20,7 → 20,7
//#include <ports/stdio.h>
#include <stdlib.h>
 
#include <ports/fftw-int.h>
#include <fftw-int.h>
 
/**************** import/export using file ***************/
/*
/shark/trunk/ports/fftw/fftw/fni_1.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:42 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 1 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: fni_1.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_1.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_1.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_1.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_1.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_1.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftwi_no_twiddle_1(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/makefile
10,6 → 10,8
 
OBJS_PATH = $(BASE)/ports/fftw/fftw
 
OTHERINCL += -I$(BASE)/ports/fftw/include
 
OBJS = fn_1.o fn_2.o fn_3.o fn_4.o fn_5.o fn_6.o fn_7.o fn_8.o fn_9.o \
fn_10.o fn_11.o fn_12.o fn_13.o fn_14.o fn_15.o fn_16.o fn_32.o \
fn_64.o ftw_2.o ftw_3.o ftw_4.o ftw_5.o ftw_6.o ftw_7.o ftw_8.o \
/shark/trunk/ports/fftw/fftw/executor.c
21,12 → 21,12
* executor.c -- execute the fft
*/
 
/* $Id: executor.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $ */
#include <ports/fftw-int.h>
/* $Id: executor.c,v 1.2 2003-03-24 11:14:50 pj Exp $ */
#include <fftw-int.h>
//#include <ports/stdio.h>
#include <stdlib.h>
 
const char *fftw_version = "FFTW V" FFTW_VERSION " ($Id: executor.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $)";
const char *fftw_version = "FFTW V" FFTW_VERSION " ($Id: executor.c,v 1.2 2003-03-24 11:14:50 pj Exp $)";
 
/*
* This function is called in other files, so we cannot declare
/shark/trunk/ports/fftw/fftw/fni_3.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:43 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 3 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fni_3.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_3.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_3.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_3.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_3.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_3.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftwi_no_twiddle_3(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fni_5.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:44 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 5 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: fni_5.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_5.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_5.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_5.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_5.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_5.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftwi_no_twiddle_5(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fni_7.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:45 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 7 */
 
39,9 → 39,9
 
/*
* Generator Id's :
* $Id: fni_7.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_7.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_7.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_7.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_7.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_7.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftwi_no_twiddle_7(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fni_9.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:47 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 9 */
 
41,9 → 41,9
 
/*
* Generator Id's :
* $Id: fni_9.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_9.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_9.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_9.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_9.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_9.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftwi_no_twiddle_9(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fn_11.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:28 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 11 */
 
43,9 → 43,9
 
/*
* Generator Id's :
* $Id: fn_11.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_11.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_11.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_11.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_11.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_11.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_11(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fn_13.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:28 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 13 */
 
53,9 → 53,9
 
/*
* Generator Id's :
* $Id: fn_13.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_13.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_13.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_13.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_13.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_13.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_13(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fn_32.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:31 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 32 */
 
40,9 → 40,9
 
/*
* Generator Id's :
* $Id: fn_32.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_32.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_32.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_32.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_32.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_32.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_32(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/malloc.c
21,13 → 21,13
* malloc.c -- memory allocation related functions
*/
 
/* $Id: malloc.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $ */
/* $Id: malloc.c,v 1.2 2003-03-24 11:14:54 pj Exp $ */
#ifdef FFTW_USING_CILK
#include <ports/cilk.h>
#include <ports/cilk-compat.h>
#include <cilk.h>
#include <cilk-compat.h>
#endif
 
#include <ports/fftw-int.h>
#include <fftw-int.h>
//#include <stdio.h>
#include <stdlib.h>
 
91,7 → 91,7
// fflush(stdout);
// fprintf(stderr, "fftw: %s", s);
 
kern_printf(s);
printk(KERN_ERR "fftw: %s", s);
sys_abort(EXIT_FAILURE);
}
 
/shark/trunk/ports/fftw/fftw/fn_15.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:30 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 15 */
 
39,9 → 39,9
 
/*
* Generator Id's :
* $Id: fn_15.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_15.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_15.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_15.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_15.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_15.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_15(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftw_64.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:27 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 64 */
 
48,9 → 48,9
 
/*
* Generator Id's :
* $Id: ftw_64.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_64.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_64.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_64.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftw_64.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftw_64.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftw_twiddle_64(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/generic.c
22,7 → 22,7
* generic.c -- "generic" codelets. They work for all n (and they are
* slow)
*/
#include <ports/fftw-int.h>
#include <fftw-int.h>
#include <stdlib.h>
 
void fftw_twiddle_generic(fftw_complex *A, const fftw_complex *W,
/shark/trunk/ports/fftw/fftw/ftwi_32.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:53 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 32 */
 
40,9 → 40,9
 
/*
* Generator Id's :
* $Id: ftwi_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_32.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_32.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_32.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_32.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftwi_twiddle_32(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fni_11.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:49 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 11 */
 
43,9 → 43,9
 
/*
* Generator Id's :
* $Id: fni_11.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_11.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_11.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_11.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_11.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_11.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftwi_no_twiddle_11(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fni_13.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:51 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 13 */
 
53,9 → 53,9
 
/*
* Generator Id's :
* $Id: fni_13.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_13.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_13.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_13.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_13.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_13.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftwi_no_twiddle_13(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fni_32.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:57 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 32 */
 
40,9 → 40,9
 
/*
* Generator Id's :
* $Id: fni_32.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_32.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_32.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_32.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_32.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_32.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftwi_no_twiddle_32(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftw_2.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:18 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 2 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: ftw_2.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_2.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_2.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_2.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_2.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_2.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftw_twiddle_2(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fni_15.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:55 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 15 */
 
39,9 → 39,9
 
/*
* Generator Id's :
* $Id: fni_15.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_15.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_15.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_15.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_15.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_15.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftwi_no_twiddle_15(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftw_4.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:18 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 4 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: ftw_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_4.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_4.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_4.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftw_twiddle_4(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fn_1.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:26 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 1 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: fn_1.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_1.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_1.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_1.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_1.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_1.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_1(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftw_6.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:19 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 6 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: ftw_6.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_6.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_6.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_6.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_6.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_6.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftw_twiddle_6(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fn_3.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:26 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 3 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: fn_3.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_3.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_3.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_3.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_3.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_3.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_3(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftw_8.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:21 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 8 */
 
34,9 → 34,9
 
/*
* Generator Id's :
* $Id: ftw_8.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_8.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_8.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftw_8.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftw_8.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftw_8.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftw_twiddle_8(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fn_5.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:27 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 5 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: fn_5.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_5.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_5.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_5.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_5.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_5.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_5(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fftwnd.c
17,9 → 17,9
*
*/
 
/* $Id: fftwnd.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $ */
/* $Id: fftwnd.c,v 1.2 2003-03-24 11:14:50 pj Exp $ */
 
#include <ports/fftw-int.h>
#include <fftw-int.h>
 
/* the number of buffers to use for buffered transforms: */
#define FFTWND_NBUFFERS 8
/shark/trunk/ports/fftw/fftw/fn_7.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:27 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 7 */
 
39,9 → 39,9
 
/*
* Generator Id's :
* $Id: fn_7.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_7.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_7.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_7.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fn_7.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fn_7.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftw_no_twiddle_7(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftwi_2.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:45 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 2 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: ftwi_2.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_2.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_2.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_2.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_2.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_2.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftwi_twiddle_2(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fn_9.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:27 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 9 */
 
41,9 → 41,9
 
/*
* Generator Id's :
* $Id: fn_9.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_9.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_9.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_9.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fn_9.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fn_9.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftw_no_twiddle_9(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/ftwi_4.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:46 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 4 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: ftwi_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_4.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_4.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_4.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_4.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftwi_twiddle_4(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/twiddle.c
23,13 → 23,13
* the inverse
*/
 
/* $Id: twiddle.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $ */
/* $Id: twiddle.c,v 1.2 2003-03-24 11:14:54 pj Exp $ */
#ifdef FFTW_USING_CILK
#include <ports/cilk.h>
#include <ports/cilk-compat.h>
#include <cilk.h>
#include <cilk-compat.h>
#endif
 
#include <ports/fftw-int.h>
#include <fftw-int.h>
#include <math.h>
#include <stdlib.h>
 
/shark/trunk/ports/fftw/fftw/rader.c
26,7 → 26,7
#include <stdlib.h>
#include <math.h>
 
#include <ports/fftw-int.h>
#include <fftw-int.h>
 
#ifdef FFTW_USING_CILK
#include <ports/cilk.h>
/shark/trunk/ports/fftw/fftw/ftwi_6.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:47 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 6 */
 
35,9 → 35,9
 
/*
* Generator Id's :
* $Id: ftwi_6.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_6.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_6.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_6.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_6.c,v 1.2 2003-03-24 11:14:53 pj Exp $
* $Id: ftwi_6.c,v 1.2 2003-03-24 11:14:53 pj Exp $
*/
 
void fftwi_twiddle_6(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/ftwi_8.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:49 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 8 */
 
34,9 → 34,9
 
/*
* Generator Id's :
* $Id: ftwi_8.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_8.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_8.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_8.c,v 1.2 2003-03-24 11:14:54 pj Exp $
* $Id: ftwi_8.c,v 1.2 2003-03-24 11:14:54 pj Exp $
* $Id: ftwi_8.c,v 1.2 2003-03-24 11:14:54 pj Exp $
*/
 
void fftwi_twiddle_8(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/ftw_10.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:22 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 10 */
 
37,9 → 37,9
 
/*
* Generator Id's :
* $Id: ftw_10.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_10.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_10.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_10.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_10.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_10.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftw_twiddle_10(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/ftw_16.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:24 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddle 16 */
 
36,9 → 36,9
 
/*
* Generator Id's :
* $Id: ftw_16.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_16.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_16.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: ftw_16.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_16.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: ftw_16.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftw_twiddle_16(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fn_64.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:32 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddle 64 */
 
48,9 → 48,9
 
/*
* Generator Id's :
* $Id: fn_64.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_64.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_64.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fn_64.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_64.c,v 1.2 2003-03-24 11:14:50 pj Exp $
* $Id: fn_64.c,v 1.2 2003-03-24 11:14:50 pj Exp $
*/
 
void fftw_no_twiddle_64(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/putils.c
22,13 → 22,13
* putils.c -- plan utilities shared by planner.c and rplanner.c
*/
 
/* $Id: putils.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $ */
/* $Id: putils.c,v 1.2 2003-03-24 11:14:54 pj Exp $ */
#ifdef FFTW_USING_CILK
#include <ports/cilk.h>
#include <ports/cilk-compat.h>
#include <cilk.h>
#include <cilk-compat.h>
#endif
 
#include <ports/fftw-int.h>
#include <fftw-int.h>
#include <stdlib.h>
//#include <ports/stdio.h>
 
/shark/trunk/ports/fftw/fftw/ftwi_64.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:55:56 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -twiddleinv 64 */
 
48,9 → 48,9
 
/*
* Generator Id's :
* $Id: ftwi_64.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_64.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_64.c,v 1.1.1.1 2002-03-29 14:12:57 pj Exp $
* $Id: ftwi_64.c,v 1.2 2003-03-24 11:14:54 pj Exp $
* $Id: ftwi_64.c,v 1.2 2003-03-24 11:14:54 pj Exp $
* $Id: ftwi_64.c,v 1.2 2003-03-24 11:14:54 pj Exp $
*/
 
void fftwi_twiddle_64(fftw_complex *A, const fftw_complex *W, int iostride, int m, int dist)
/shark/trunk/ports/fftw/fftw/fni_64.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:58 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 64 */
 
48,9 → 48,9
 
/*
* Generator Id's :
* $Id: fni_64.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_64.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_64.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_64.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_64.c,v 1.2 2003-03-24 11:14:52 pj Exp $
* $Id: fni_64.c,v 1.2 2003-03-24 11:14:52 pj Exp $
*/
 
void fftwi_no_twiddle_64(const fftw_complex *input, fftw_complex *output, int istride, int ostride)
/shark/trunk/ports/fftw/fftw/fni_2.c
20,8 → 20,8
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Tue May 18 13:54:42 EDT 1999 */
 
#include <ports/fftw-int.h>
#include <ports/fftw.h>
#include <fftw-int.h>
#include <fftw.h>
 
/* Generated by: ./genfft -magic-alignment-check -magic-twiddle-load-all -magic-variables 4 -magic-loopi -notwiddleinv 2 */
 
33,9 → 33,9
 
/*
* Generator Id's :
* $Id: fni_2.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_2.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_2.c,v 1.1.1.1 2002-03-29 14:12:56 pj Exp $
* $Id: fni_2.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_2.c,v 1.2 2003-03-24 11:14:51 pj Exp $
* $Id: fni_2.c,v 1.2 2003-03-24 11:14:51 pj Exp $
*/
 
void fftwi_no_twiddle_2(const fftw_complex *input, fftw_complex *output, int istride, int ostride)