3 * Copyright (C) 2008 Maciej Piechotka
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.
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.
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
20 * Maciej Piechotka <uzytkownik2@gmail.com>
23 [CCode (cheader_filename = "bzlib.h")]
25 [CCode (cname = "int", cprefix = "BZ_", has_type_id = false)]
32 [CCode (cname = "int", cprefix = "BZ_", has_type_id = false)]
49 [CCode (cname = "bz_stream", has_type_id = false)]
50 public struct Stream {
51 public string next_in;
53 public uint totoal_in_lo32;
54 public uint total_in_hi32;
55 public string next_out;
56 public uint avail_out;
57 public uint totoal_out_lo32;
58 public uint total_out_hi32;
60 public AllocFunc? bzalloc;
61 public FreeFunc? bzfree;
63 [CCode (cname = "BZ2_bzCompressInit")]
64 public Status compress_init (int block_size_100k, int verbosity, int work_factor);
65 [CCode (cname = "BZ2_bzCompress")]
66 public Status compress (Action action);
67 [CCode (cname = "BZ2_bzCompressEnd")]
68 public Status compress_end ();
69 [CCode (cname = "BZ2_bzDecompressInit")]
70 public Status decompress_init (int verbosity, int small);
71 [CCode (cname = "BZ2_bzDecompress")]
72 public Status decompress ();
73 [CCode (cname = "BZ2_bzDecompressEnd")]
74 public Status decompress_end ();
77 [CCode (cname = "BZFILE", cprefix = "BZ2_bz", free_function = "BZ2_bzclose")]
79 public class BZFileStream {
80 public static BZFileStream open (string path, string mode = "rb");
81 public static BZFileStream dopen (int fd, string mode);
82 public int read (uint8[] buf);
83 public int write (uint8[] buf);
84 public unowned string error (out Status status);
87 [CCode (has_target = false, has_typedef = false)]
88 public delegate void* AllocFunc (void* target, int m, int n);
90 [CCode (has_target = false, has_typedef = false)]
91 public delegate void FreeFunc (void* target, void* p);