1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien alien.c-types alien.libraries alien.syntax
4 classes.struct combinators system ;
5 IN: compression.zlib.ffi
7 LIBRARY-UNIX: zlib cdecl "libz.so"
8 LIBRARY-MACOSX: zlib cdecl "libz.dylib"
9 LIBRARY-WINDOWS: zlib cdecl "zlib1.dll"
38 TYPEDEF: z_stream* z_streamp
55 TYPEDEF: gz_header* gz_headerp
56 CONSTANT: Z_NO_FLUSH 0
57 CONSTANT: Z_PARTIAL_FLUSH 1
58 CONSTANT: Z_SYNC_FLUSH 2
59 CONSTANT: Z_FULL_FLUSH 3
65 CONSTANT: Z_STREAM_END 1
66 CONSTANT: Z_NEED_DICT 2
68 CONSTANT: Z_STREAM_ERROR -2
69 CONSTANT: Z_DATA_ERROR -3
70 CONSTANT: Z_MEM_ERROR -4
71 CONSTANT: Z_BUF_ERROR -5
72 CONSTANT: Z_VERSION_ERROR -6
74 CONSTANT: Z_NO_COMPRESSION 0
75 CONSTANT: Z_BEST_SPEED 1
76 CONSTANT: Z_BEST_COMPRESSION 9
77 CONSTANT: Z_DEFAULT_COMPRESSION -1
79 CONSTANT: Z_FILTERED 1
80 CONSTANT: Z_HUFFMAN_ONLY 2
83 CONSTANT: Z_DEFAULT_STRATEGY 0
89 CONSTANT: Z_DEFLATED 8
91 CONSTANT: ZLIB_VERSION "1.2.5"
93 FUNCTION: c-string zlibVersion ( )
95 FUNCTION: int deflate ( z_streamp strm, int flush )
96 FUNCTION: int deflateEnd ( z_streamp strm )
98 FUNCTION: int inflate ( z_streamp strm, int flush )
99 FUNCTION: int inflateEnd ( z_streamp strm )
101 FUNCTION: int deflateSetDictionary ( z_streamp strm, Bytef* dictionary, uInt dictLength )
102 FUNCTION: int deflateCopy ( z_streamp dest, z_streamp source )
103 FUNCTION: int deflateReset ( z_streamp strm )
104 FUNCTION: int deflateParams ( z_streamp strm, int level, int strategy )
105 FUNCTION: int deflateTune ( z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain )
106 FUNCTION: uLong deflateBound ( z_streamp strm, uLong sourceLen )
107 FUNCTION: int deflatePrime ( z_streamp strm, int bits, int value )
108 FUNCTION: int deflateSetHeader ( z_streamp strm, gz_headerp head )
110 FUNCTION: int inflateSetDictionary ( z_streamp strm, Bytef* dictionary, uInt dictLength )
111 FUNCTION: int inflateSync ( z_streamp strm )
112 FUNCTION: int inflateCopy ( z_streamp dest, z_streamp source )
113 FUNCTION: int inflateReset ( z_streamp strm )
114 FUNCTION: int inflateReset2 ( z_streamp strm, int windowBits )
115 FUNCTION: int inflatePrime ( z_streamp strm, int bits, int value )
116 FUNCTION: long inflateMark ( z_streamp strm )
117 FUNCTION: int inflateGetHeader ( z_streamp strm, gz_headerp head )
119 FUNCTION: uLong zlibCompileFlags ( )
121 FUNCTION: int compress ( Bytef* dest, uLongf* destLen, Bytef* source, uLong sourceLen )
122 FUNCTION: int compress2 ( Bytef* dest, uLongf* destLen, Bytef* source, uLong sourceLen, int level )
123 FUNCTION: uLong compressBound ( uLong sourceLen )
125 FUNCTION: int uncompress ( Bytef* dest, uLongf* destLen, Bytef* source, uLong sourceLen )
127 TYPEDEF: void* gzFile
129 FUNCTION: gzFile gzdopen ( int fd, c-string mode )
130 FUNCTION: int gzbuffer ( gzFile file, uint size )
131 FUNCTION: int gzsetparams ( gzFile file, int level, int strategy )
132 FUNCTION: int gzread ( gzFile file, void* buf, uint len )
133 FUNCTION: int gzwrite ( gzFile file, void* buf, uint len )
134 FUNCTION: int gzputs ( gzFile file, char* s )
135 FUNCTION: c-string gzgets ( gzFile file, char* buf, int len )
136 FUNCTION: int gzputc ( gzFile file, int c )
137 FUNCTION: int gzgetc ( gzFile file )
138 FUNCTION: int gzungetc ( int c, gzFile file )
139 FUNCTION: int gzflush ( gzFile file, int flush )
140 FUNCTION: int gzrewind ( gzFile file )
141 FUNCTION: int gzeof ( gzFile file )
142 FUNCTION: int gzdirect ( gzFile file )
143 FUNCTION: int gzclose ( gzFile file )
144 FUNCTION: int gzclose_r ( gzFile file )
145 FUNCTION: int gzclose_w ( gzFile file )
146 FUNCTION: c-string gzerror ( gzFile file, int* errnum )
147 FUNCTION: void gzclearerr ( gzFile file )
149 FUNCTION: uLong adler32 ( uLong adler, Bytef* buf, uInt len )
150 FUNCTION: uLong crc32 ( uLong crc Bytef* buf, uInt len )
152 FUNCTION: int deflateInit_ ( z_streamp strm, int level, c-string version, int stream_size )
153 FUNCTION: int inflateInit_ ( z_streamp strm, c-string version, int stream_size )
155 FUNCTION: int deflateInit2_ ( z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, c-string version, int stream_size )
156 FUNCTION: int inflateInit2_ ( z_streamp strm, int windowBits, c-string version, int stream_size )