2 Generic object-oriented reading/writing.
4 Part of the swftools package.
6 Copyright (c) 2001 Matthias Kramm <kramm@quiss.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
24 #ifndef __rfxswf_bitio_h__
25 #define __rfxswf_bitio_h__
27 #define READER_TYPE_FILE 0
28 #define READER_TYPE_MEM 1
29 #define READER_TYPE_ZLIB_U 2
30 #define READER_TYPE_ZLIB_C 3
31 #define READER_TYPE_ZLIB READER_TYPE_ZLIB_U
33 #define WRITER_TYPE_FILE 0
34 #define WRITER_TYPE_MEM 1
35 #define WRITER_TYPE_ZLIB_C 2
36 #define WRITER_TYPE_ZLIB_U 3
37 #define WRITER_TYPE_NULL 4
38 #define WRITER_TYPE_ZLIB WRITER_TYPE_ZLIB_C
42 int (*read
)(struct reader_t
*, void*data
, int len
);
53 int (*write
)(struct writer_t
*, void*data
, int len
);
54 void (*finish
)(struct writer_t
*);
63 void reader_resetbits(struct reader_t
*r
);
64 unsigned int reader_readbit(struct reader_t
*r
);
65 unsigned int reader_readbits(struct reader_t
*r
, int num
);
67 void writer_resetbits(struct writer_t
*w
);
68 void writer_writebit(struct writer_t
*w
, int bit
);
69 void writer_writebits(struct writer_t
*w
, unsigned int data
, int bits
);
71 /* standard readers / writers */
73 void reader_init_filereader(struct reader_t
*r
, int handle
);
74 void reader_init_zlibinflate(struct reader_t
*r
, struct reader_t
*input
);
75 void reader_init_memreader(struct reader_t
*r
, void*data
, int length
);
77 void writer_init_filewriter(struct writer_t
*w
, int handle
);
78 void writer_init_filewriter2(struct writer_t
*w
, char*filename
);
79 void writer_init_zlibdeflate(struct writer_t
*w
, struct writer_t
*output
);
80 void writer_init_memwriter(struct writer_t
*r
, void*data
, int length
);
81 void writer_init_nullwriter(struct writer_t
*w
);
83 #endif //__rfxswf_bitio_h__