1 /*
2     Ming, an SWF output library
3     Copyright (C) 2001  Opaque Industries - http://www.opaque.net/
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19 
20 /* output.h
21  *
22  * $Id$
23  *
24  * Notice: This header file contains declarations of functions and types that
25  * are just used internally. All library functions and types that are supposed
26  * to be publicly accessable are defined in ./src/ming.h.
27  */
28 
29 #ifndef SWF_OUTPUT_H_INCLUDED
30 #define SWF_OUTPUT_H_INCLUDED
31 
32 #include "ming.h"
33 
34 typedef struct SWFOutput_s *SWFOutput;
35 
36 #define OUTPUT_BUFFER_INCREMENT 1024
37 
38 
39 /* create/destroy output object */
40 SWFOutput newSWFOutput();
41 
42 SWFOutput newSizedSWFOutput(int size);
43 
44 void destroySWFOutput(SWFOutput out);
45 
46 /* write output's buffer to stream */
47 void SWFOutput_writeToMethod(SWFOutput out,
48 			     SWFByteOutputMethod method, void *data);
49 
50 /* utilities for writing */
51 void SWFOutput_grow(SWFOutput out);
52 
53 void SWFOutput_checkSize(SWFOutput out, int bytes);
54 
55 /* truncate a SizedSWFOutput after the final length is known */
56 void SWFOutput_truncate(SWFOutput out, int size);
57 
58 void SWFOutput_byteAlign(SWFOutput out);
59 
60 int SWFOutput_getLength(SWFOutput out);
61 
62 void SWFOutput_setNext(SWFOutput out, SWFOutput next);
SelectEventSelectEvent63 
64 SWFOutput SWFOutput_getNext(SWFOutput out);
65 
66 byte* SWFOutput_getBuffer(SWFOutput out);
67 
68 byte* SWFOutput_getCurPos(SWFOutput out);
69 
70 /* write data to output */
71 void SWFOutput_writeBits(SWFOutput out, int data, int bits);
72 
73 void SWFOutput_writeSBits(SWFOutput out, int data, int bits);
74 
75 void SWFOutput_writeUInt8(SWFOutput out, int data);
76 
77 void SWFOutput_writeSInt8(SWFOutput out, int data);
78 
79 void SWFOutput_writeUInt16(SWFOutput out, int data);
80 
81 void SWFOutput_writeSInt16(SWFOutput out, int data);
82 
83 void SWFOutput_writeUInt32(SWFOutput out, long data);
84 
85 void SWFOutput_writeSInt32(SWFOutput out, long data);
86 
87 void SWFOutput_writeBuffer(SWFOutput out, char *buffer, int bytes);
88 
89 
90 /* number of bits required to store num */
91 int SWFOutput_numBits(int num);
92 
93 int SWFOutput_numSBits(int num);
94 
95 
96 void SWFOutput_writeString(SWFOutput out, const byte *string);
97 
98 #endif /* SWF_OUTPUT_H_INCLUDED */
99