2 Generic object-oriented reading/writing.
4 Part of the swftools package.
6 Copyright (c) 2001 Matthias Kramm <kramm@quiss.org>
8 This file is distributed under the GPL, see file COPYING for details */
11 #ifndef __rfxswf_bitio_h__
12 #define __rfxswf_bitio_h__
14 #define READER_TYPE_FILE 0
15 #define READER_TYPE_MEM 1
16 #define READER_TYPE_ZLIB 2
17 #define WRITER_TYPE_FILE 0
18 #define WRITER_TYPE_MEM 1
19 #define WRITER_TYPE_ZLIB 2
23 int (*read)(struct reader_t*, void*data, int len);
34 int (*write)(struct writer_t*, void*data, int len);
35 void (*finish)(struct writer_t*);
44 void reader_resetbits(struct reader_t*r);
45 unsigned int reader_readbit(struct reader_t*r);
46 unsigned int reader_readbits(struct reader_t*r, int num);
48 void writer_resetbits(struct writer_t*w);
49 void writer_writebit(struct writer_t*w, int bit);
50 void writer_writebits(struct writer_t*w, unsigned int data, int bits);
52 /* standard readers / writers */
54 void reader_init_filereader(struct reader_t*r, int handle);
55 void reader_init_zlibinflate(struct reader_t*r, struct reader_t*input);
56 void reader_init_memreader(struct reader_t*r, void*data, int length);
58 void writer_init_filewriter(struct writer_t*w, int handle);
59 void writer_init_zlibdeflate(struct writer_t*w, struct writer_t*output);
60 void writer_init_memwriter(struct writer_t*r, void*data, int length);
62 #endif //__rfxswf_bitio_h__