solaris fixes.
[swftools.git] / src / bitio.h
1 /* bitio.h 
2    Header file for bitio.c.
3
4    Part of the swftools package.
5    
6    Copyright (c) 2001 Matthias Kramm <kramm@quiss.org> 
7
8    This file is distributed under the GPL, see file COPYING for details */
9
10 #ifndef __bitio_h__
11 #define __bitio_h__
12
13 #include "types.h"
14 #include "../lib/rfxswf.h"
15
16 struct reader_t {
17     u8* data;
18     int datalength;
19     int datapos;
20     u8 bitpos,mybyte;
21     u8 bitmem;
22 };
23
24 struct writer_t {
25     u8* data;
26     int maxlength;
27     int pos;
28     int bitpos;
29     u8 mybyte;
30 };
31
32 void reader_resetbits(struct reader_t*);
33 void reader_init(struct reader_t*,uchar*newdata, int newlength);
34 void reader_skip(struct reader_t*,int length);
35 void reader_input1(struct reader_t*, void*target);
36 void reader_input2(struct reader_t*, void*target);
37 void reader_input4(struct reader_t*, void*target);
38 uchar*reader_getinputpos(struct reader_t*);
39 int reader_getinputlength(struct reader_t*);
40 void reader_setinputpos(struct reader_t*,uchar*pos);
41 u32 reader_readbit(struct reader_t*);
42 void reader_readbits(struct reader_t*,u32*val,int num);
43 void reader_readsbits(struct reader_t*,s32*val,int num);
44 u32 reader_getbits(struct reader_t*,int num);
45 s32 reader_getsbits(struct reader_t*,int num);
46 u8 reader_readu8(struct reader_t*);
47 u16 reader_readu16(struct reader_t*);
48 u32 reader_readu32(struct reader_t*);
49
50 void writer_init(struct writer_t*w, u8*data, int maxlength);
51 void writer_write(struct writer_t*w, void*data, int length);
52 void* writer_getpos(struct writer_t*w);
53 void writer_writebit(struct writer_t*w, int bit);
54 void writer_writebits(struct writer_t*w, u32 data, int bits);
55 void writer_writeu8(struct writer_t*w, u8 value);
56 void writer_writeu16(struct writer_t*w, u16 value);
57 void writer_writeu32(struct writer_t*w, u32 value);
58 void writer_resetbits(struct writer_t*w);
59
60 #endif //__bitio_h__