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
8 { [ os windows? ] [ "zlib1.dll" ] }
9 { [ os macosx? ] [ "libz.dylib" ] }
10 { [ os unix? ] [ "libz.so" ] }
11 } cond cdecl add-library >>
40 TYPEDEF: z_stream* z_streamp
57 TYPEDEF: gz_header* gz_headerp
58 CONSTANT: Z_NO_FLUSH 0
59 CONSTANT: Z_PARTIAL_FLUSH 1
60 CONSTANT: Z_SYNC_FLUSH 2
61 CONSTANT: Z_FULL_FLUSH 3
67 CONSTANT: Z_STREAM_END 1
68 CONSTANT: Z_NEED_DICT 2
70 CONSTANT: Z_STREAM_ERROR -2
71 CONSTANT: Z_DATA_ERROR -3
72 CONSTANT: Z_MEM_ERROR -4
73 CONSTANT: Z_BUF_ERROR -5
74 CONSTANT: Z_VERSION_ERROR -6
76 CONSTANT: Z_NO_COMPRESSION 0
77 CONSTANT: Z_BEST_SPEED 1
78 CONSTANT: Z_BEST_COMPRESSION 9
79 CONSTANT: Z_DEFAULT_COMPRESSION -1
81 CONSTANT: Z_FILTERED 1
82 CONSTANT: Z_HUFFMAN_ONLY 2
85 CONSTANT: Z_DEFAULT_STRATEGY 0
91 CONSTANT: Z_DEFLATED 8
93 CONSTANT: ZLIB_VERSION "1.2.5"
95 FUNCTION: c-string zlibVersion ( )
97 FUNCTION: int deflate ( z_streamp strm, int flush )
98 FUNCTION: int deflateEnd ( z_streamp strm )
100 FUNCTION: int inflate ( z_streamp strm, int flush )
101 FUNCTION: int inflateEnd ( z_streamp strm )
103 FUNCTION: int deflateSetDictionary ( z_streamp strm, Bytef* dictionary, uInt dictLength )
104 FUNCTION: int deflateCopy ( z_streamp dest, z_streamp source )
105 FUNCTION: int deflateReset ( z_streamp strm )
106 FUNCTION: int deflateParams ( z_streamp strm, int level, int strategy )
107 FUNCTION: int deflateTune ( z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain )
108 FUNCTION: uLong deflateBound ( z_streamp strm, uLong sourceLen )
109 FUNCTION: int deflatePrime ( z_streamp strm, int bits, int value )
110 FUNCTION: int deflateSetHeader ( z_streamp strm, gz_headerp head )
112 FUNCTION: int inflateSetDictionary ( z_streamp strm, Bytef* dictionary, uInt dictLength )
113 FUNCTION: int inflateSync ( z_streamp strm )
114 FUNCTION: int inflateCopy ( z_streamp dest, z_streamp source )
115 FUNCTION: int inflateReset ( z_streamp strm )
116 FUNCTION: int inflateReset2 ( z_streamp strm, int windowBits )
117 FUNCTION: int inflatePrime ( z_streamp strm, int bits, int value )
118 FUNCTION: long inflateMark ( z_streamp strm )
119 FUNCTION: int inflateGetHeader ( z_streamp strm, gz_headerp head )
121 FUNCTION: uLong zlibCompileFlags ( )
123 FUNCTION: int compress ( Bytef* dest, uLongf* destLen, Bytef* source, uLong sourceLen )
124 FUNCTION: int compress2 ( Bytef* dest, uLongf* destLen, Bytef* source, uLong sourceLen, int level )
125 FUNCTION: uLong compressBound ( uLong sourceLen )
127 FUNCTION: int uncompress ( Bytef* dest, uLongf* destLen, Bytef* source, uLong sourceLen )
129 TYPEDEF: void* gzFile
131 FUNCTION: gzFile gzdopen ( int fd, c-string mode )
132 FUNCTION: int gzbuffer ( gzFile file, uint size )
133 FUNCTION: int gzsetparams ( gzFile file, int level, int strategy )
134 FUNCTION: int gzread ( gzFile file, void* buf, uint len )
135 FUNCTION: int gzwrite ( gzFile file, void* buf, uint len )
136 FUNCTION: int gzputs ( gzFile file, char* s )
137 FUNCTION: c-string gzgets ( gzFile file, char* buf, int len )
138 FUNCTION: int gzputc ( gzFile file, int c )
139 FUNCTION: int gzgetc ( gzFile file )
140 FUNCTION: int gzungetc ( int c, gzFile file )
141 FUNCTION: int gzflush ( gzFile file, int flush )
142 FUNCTION: int gzrewind ( gzFile file )
143 FUNCTION: int gzeof ( gzFile file )
144 FUNCTION: int gzdirect ( gzFile file )
145 FUNCTION: int gzclose ( gzFile file )
146 FUNCTION: int gzclose_r ( gzFile file )
147 FUNCTION: int gzclose_w ( gzFile file )
148 FUNCTION: c-string gzerror ( gzFile file, int* errnum )
149 FUNCTION: void gzclearerr ( gzFile file )
151 FUNCTION: uLong adler32 ( uLong adler, Bytef* buf, uInt len )
152 FUNCTION: uLong crc32 ( uLong crc Bytef* buf, uInt len )
154 FUNCTION: int deflateInit_ ( z_streamp strm, int level, c-string version, int stream_size )
155 FUNCTION: int inflateInit_ ( z_streamp strm, c-string version, int stream_size )
157 FUNCTION: int deflateInit2_ ( z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, c-string version, int stream_size )
158 FUNCTION: int inflateInit2_ ( z_streamp strm, int windowBits, c-string version, int stream_size )