Plugin registrar: chain up to GLib.Object using new (vala 0.7.8) syntax
[cinaest] / vapi / zlib.vapi
1 /* zlib.vala
2  *
3  * Copyright (C) 2006-2009  Raffaele Sandrini, Jürg Billeter, Evan Nemerson
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
18  *
19  * Author:
20  *      Raffaele Sandrini <raffaele@sandrini.ch>
21  *      Jürg Billeter <j@bitron.ch>
22  *      Evan Nemerson <evan@polussystems.com>
23  */
24
25 using GLib;
26
27 [CCode (lower_case_cprefix = "", cheader_filename = "zlib.h")]
28 namespace ZLib {
29         [CCode (cprefix = "ZLIB_VER_")]
30         namespace VERSION {
31                 [CCode (cname = "ZLIB_VERSION")]
32                 public const string STRING;
33                 [CCode (cname = "ZLIB_VERNUM")]
34                 public const int NUMBER;
35                 public const int MAJOR;
36                 public const int MINOR;
37                 public const int REVISION;
38         }
39
40         [CCode (cprefix = "Z_")]
41         namespace Flush {
42                 [CCode (cname = "Z_NO_FLUSH")]
43                 public const int NONE;
44                 [CCode (cname = "Z_SYNC_FLUSH")]
45                 public const int SYNC;
46                 [CCode (cname = "Z_FULL_FLUSH")]
47                 public const int FULL;
48                 public const int FINISH;
49                 public const int BLOCK;
50         }
51
52         namespace Status {
53                 [CCode (cname = "Z_OK")]
54                 public const int OK;
55                 [CCode (cname = "Z_STREAM_END")]
56                 public const int STREAM_END;
57                 [CCode (cname = "Z_NEED_DICT")]
58                 public const int NEED_DICT;
59                 [CCode (cname = "Z_ERRNO")]
60                 public const int ERRNO;
61                 [CCode (cname = "Z_STREAM_ERROR")]
62                 public const int STREAM_ERROR;
63                 [CCode (cname = "Z_DATA_ERROR")]
64                 public const int DATA_ERROR;
65                 [CCode (cname = "Z_MEM_ERROR")]
66                 public const int MEM_ERROR;
67                 [CCode (cname = "Z_BUF_ERROR")]
68                 public const int BUF_ERROR;
69                 [CCode (cname = "Z_VERSION_ERROR")]
70                 public const int VERSION_ERROR;
71         }
72
73         namespace Compression {
74                 [CCode (cname = "Z_NO_COMPRESSION")]
75                 public const int NONE;
76                 [CCode (cname = "Z_BEST_SPEED")]
77                 public const int BEST_SPEED;
78                 [CCode (cname = "Z_BEST_COMPRESSION")]
79                 public const int BEST_COMPRESSION;
80                 [CCode (cname = "Z_DEFAULT_COMPRESSION")]
81                 public const int DEFAULT;
82         }
83
84         [CCode (cprefix = "Z_")]
85         namespace Strategy {
86                 public const int FILTERED;
87                 public const int HUFFMAN_ONLY;
88                 public const int RLE;
89                 public const int FIXED;
90                 [CCode (cname = "Z_DEFAULT_STRATEGY")]
91                 public const int DEFAULT;
92         }
93
94         [CCode (cprefix = "Z_")]
95         namespace Data {
96                 public const int BINARY;
97                 public const int TEXT;
98                 public const int ASCII;
99                 public const int UNKNOWN;
100         }
101
102         [CCode (cprefix = "Z_")]
103         namespace Algorithm {
104                 public const int DEFLATED;
105         }
106
107         [CCode (cname = "z_stream", destroy_function = "deflateEnd")]
108         public struct Stream {
109                 public uchar* next_in;
110                 public uint avail_in;
111                 public ulong total_in;
112
113                 public uchar* next_out;
114                 public uint avail_out;
115                 public ulong total_out;
116
117                 public string? msg;
118
119                 public int data_type;
120                 public ulong adler;
121         }
122
123         [CCode (cname = "z_stream", destroy_function = "deflateEnd")]
124         public struct DeflateStream : Stream {
125                 [CCode (cname = "deflateInit")]
126                 public DeflateStream (int level = Compression.DEFAULT);
127                 [CCode (cname = "deflateInit2")]
128                 public DeflateStream.full (int level, int method, int windowBits, int memLevel, int strategy);
129
130                 [CCode (cname = "deflate")]
131                 public int deflate (int flush);
132                 [CCode (cname = "deflateSetDictionary")]
133                 public int set_dictionary ([CCode (array_length_type = "guint")] uchar[] dictionary);
134                 [CCode (cname = "deflateCopy", instance_pos = 0)]
135                 public int copy (DeflateStream dest);
136                 [CCode (cname = "deflateReset")]
137                 public int reset ();
138                 [CCode (cname = "deflateParams")]
139                 public int params (int level, int strategy);
140                 [CCode (cname = "deflateTune")]
141                 public int tune (int good_length, int max_lazy, int nice_length, int max_chain);
142                 [CCode (cname = "deflateBound")]
143                 public ulong bound (ulong sourceLen);
144                 [CCode (cname = "deflatePrime")]
145                 public int prime (int bits, int value);
146                 [CCode (cname = "deflateSetHeader")]
147                 public int set_header (GZHeader head);
148         }
149
150         [CCode (cname = "z_stream", destroy_function = "inflateEnd")]
151         public struct InflateStream : Stream {
152                 [CCode (cname = "inflateInit")]
153                 public InflateStream ();
154                 [CCode (cname = "inflateInit2")]
155                 public InflateStream.full (int windowBits);
156
157                 [CCode (cname = "inflate")]
158                 public int inflate (int flush);
159                 [CCode (cname = "inflateSetDictionary")]
160                 public int set_dictionary ([CCode (array_length_type = "guint")] uchar[] dictionary);
161                 [CCode (cnmae = "inflateSync")]
162                 public int sync ();
163                 public int reset ();
164                 public int prime (int bits, int value);
165                 public int get_header (out GZHeader head);
166         }
167
168         namespace Utility {
169                 [CCode (cname = "compress2")]
170                 public static int compress ([CCode (array_length_type = "gulong")] uchar[] dest, [CCode (array_length_type = "gulong")] uchar[] source, int level = Compression.DEFAULT);
171                 [CCode (cname = "compressBound")]
172                 public static int compress_bound (ulong sourceLen);
173
174                 public static int uncompress ([CCode (array_length_type = "gulong")] uchar[] dest, [CCode (array_length_type = "gulong")] uchar[] source);
175         }
176
177         [CCode (cname = "gz_header")]
178         public struct GZHeader {
179                 public int text;
180                 public ulong time;
181                 public int xflags;
182                 public int os;
183                 [CCode (array_length_name = "extra_len", array_length_type = "guint")]
184                 public uchar[] extra;
185                 public uint extra_max;
186                 public string? name;
187                 public uint name_max;
188                 public string comment;
189                 [CCode (cname = "comm_max")]
190                 public uint comment_max;
191                 public int hcrc;
192                 public int done;
193         }
194
195         [CCode (cname = "gzFile", cprefix = "gz", free_function = "gzclose")]
196         public class GZFileStream {
197                 public static GZFileStream open (string path, string mode);
198                 public static GZFileStream dopen (int fd, string mode);
199                 public int setparams (int level, int strategy);
200                 public int read (char[] buf);
201                 public int write (char[] buf);
202                 [PrintfFormat]
203                 public int printf (string format, ...);
204                 public int puts (string s);
205                 public weak string gets (char[] buf);
206                 public int flush (int flush);
207                 public int rewind ();
208                 public bool eof ();
209                 public bool direct ();
210         }
211 }