1 | /* ************************************************************************** */
|
---|
2 | /* * For conditions of distribution and use, * */
|
---|
3 | /* * see copyright notice in libmng.h * */
|
---|
4 | /* ************************************************************************** */
|
---|
5 | /* * * */
|
---|
6 | /* * project : libmng * */
|
---|
7 | /* * file : libmng_chunk_prc.h copyright (c) 2000-2007 G.Juyn * */
|
---|
8 | /* * version : 1.0.10 * */
|
---|
9 | /* * * */
|
---|
10 | /* * purpose : Chunk initialization & cleanup (definition) * */
|
---|
11 | /* * * */
|
---|
12 | /* * author : G.Juyn * */
|
---|
13 | /* * * */
|
---|
14 | /* * comment : definition of the chunk initialization & cleanup routines * */
|
---|
15 | /* * * */
|
---|
16 | /* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */
|
---|
17 | /* * - changed strict-ANSI stuff * */
|
---|
18 | /* * * */
|
---|
19 | /* * 0.9.2 - 08/05/2000 - G.Juyn * */
|
---|
20 | /* * - changed file-prefixes * */
|
---|
21 | /* * * */
|
---|
22 | /* * 0.9.3 - 08/26/2000 - G.Juyn * */
|
---|
23 | /* * - added MAGN chunk * */
|
---|
24 | /* * 0.9.3 - 10/16/2000 - G.Juyn * */
|
---|
25 | /* * - added support for JDAA * */
|
---|
26 | /* * * */
|
---|
27 | /* * 1.0.5 - 08/19/2002 - G.Juyn * */
|
---|
28 | /* * - B597134 - libmng pollutes the linker namespace * */
|
---|
29 | /* * 1.0.5 - 09/14/2002 - G.Juyn * */
|
---|
30 | /* * - added event handling for dynamic MNG * */
|
---|
31 | /* * * */
|
---|
32 | /* * 1.0.6 - 07/07/2003 - G.R-P * */
|
---|
33 | /* * - added NO_DELTA_PNG support * */
|
---|
34 | /* * 1.0.6 - 07/29/2003 - G.R-P * */
|
---|
35 | /* * - added conditionals around PAST chunk support * */
|
---|
36 | /* * * */
|
---|
37 | /* * 1.0.9 - 12/05/2004 - G.Juyn * */
|
---|
38 | /* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */
|
---|
39 | /* * 1.0.9 - 12/06/2004 - G.Juyn * */
|
---|
40 | /* * - added conditional MNG_OPTIMIZE_CHUNKASSIGN * */
|
---|
41 | /* * * */
|
---|
42 | /* * 1.0.10 - 04/08/2007 - G.Juyn * */
|
---|
43 | /* * - added support for mPNG proposal * */
|
---|
44 | /* * 1.0.10 - 04/12/2007 - G.Juyn * */
|
---|
45 | /* * - added support for ANG proposal * */
|
---|
46 | /* * * */
|
---|
47 | /* ************************************************************************** */
|
---|
48 |
|
---|
49 | #if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI)
|
---|
50 | #pragma option -A /* force ANSI-C */
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | #ifndef _libmng_chunk_prc_h_
|
---|
54 | #define _libmng_chunk_prc_h_
|
---|
55 |
|
---|
56 | /* ************************************************************************** */
|
---|
57 |
|
---|
58 | void mng_add_chunk (mng_datap pData,
|
---|
59 | mng_chunkp pChunk);
|
---|
60 |
|
---|
61 | /* ************************************************************************** */
|
---|
62 |
|
---|
63 | #define INIT_CHUNK_HDR(n) mng_retcode n (mng_datap pData, \
|
---|
64 | mng_chunkp pHeader, \
|
---|
65 | mng_chunkp* ppChunk)
|
---|
66 |
|
---|
67 | #ifdef MNG_OPTIMIZE_CHUNKINITFREE
|
---|
68 | INIT_CHUNK_HDR (mng_init_general) ;
|
---|
69 | #else
|
---|
70 | INIT_CHUNK_HDR (mng_init_ihdr) ;
|
---|
71 | INIT_CHUNK_HDR (mng_init_plte) ;
|
---|
72 | INIT_CHUNK_HDR (mng_init_idat) ;
|
---|
73 | INIT_CHUNK_HDR (mng_init_iend) ;
|
---|
74 | INIT_CHUNK_HDR (mng_init_trns) ;
|
---|
75 | INIT_CHUNK_HDR (mng_init_gama) ;
|
---|
76 | INIT_CHUNK_HDR (mng_init_chrm) ;
|
---|
77 | INIT_CHUNK_HDR (mng_init_srgb) ;
|
---|
78 | INIT_CHUNK_HDR (mng_init_iccp) ;
|
---|
79 | INIT_CHUNK_HDR (mng_init_text) ;
|
---|
80 | INIT_CHUNK_HDR (mng_init_ztxt) ;
|
---|
81 | INIT_CHUNK_HDR (mng_init_itxt) ;
|
---|
82 | INIT_CHUNK_HDR (mng_init_bkgd) ;
|
---|
83 | INIT_CHUNK_HDR (mng_init_phys) ;
|
---|
84 | INIT_CHUNK_HDR (mng_init_sbit) ;
|
---|
85 | INIT_CHUNK_HDR (mng_init_splt) ;
|
---|
86 | INIT_CHUNK_HDR (mng_init_hist) ;
|
---|
87 | INIT_CHUNK_HDR (mng_init_time) ;
|
---|
88 | INIT_CHUNK_HDR (mng_init_mhdr) ;
|
---|
89 | INIT_CHUNK_HDR (mng_init_mend) ;
|
---|
90 | INIT_CHUNK_HDR (mng_init_loop) ;
|
---|
91 | INIT_CHUNK_HDR (mng_init_endl) ;
|
---|
92 | INIT_CHUNK_HDR (mng_init_defi) ;
|
---|
93 | INIT_CHUNK_HDR (mng_init_basi) ;
|
---|
94 | INIT_CHUNK_HDR (mng_init_clon) ;
|
---|
95 | #ifndef MNG_SKIPCHUNK_PAST
|
---|
96 | INIT_CHUNK_HDR (mng_init_past) ;
|
---|
97 | #endif
|
---|
98 | INIT_CHUNK_HDR (mng_init_disc) ;
|
---|
99 | INIT_CHUNK_HDR (mng_init_back) ;
|
---|
100 | INIT_CHUNK_HDR (mng_init_fram) ;
|
---|
101 | INIT_CHUNK_HDR (mng_init_move) ;
|
---|
102 | INIT_CHUNK_HDR (mng_init_clip) ;
|
---|
103 | INIT_CHUNK_HDR (mng_init_show) ;
|
---|
104 | INIT_CHUNK_HDR (mng_init_term) ;
|
---|
105 | INIT_CHUNK_HDR (mng_init_save) ;
|
---|
106 | INIT_CHUNK_HDR (mng_init_seek) ;
|
---|
107 | INIT_CHUNK_HDR (mng_init_expi) ;
|
---|
108 | INIT_CHUNK_HDR (mng_init_fpri) ;
|
---|
109 | INIT_CHUNK_HDR (mng_init_need) ;
|
---|
110 | INIT_CHUNK_HDR (mng_init_phyg) ;
|
---|
111 | #ifdef MNG_INCLUDE_JNG
|
---|
112 | INIT_CHUNK_HDR (mng_init_jhdr) ;
|
---|
113 | INIT_CHUNK_HDR (mng_init_jdaa) ;
|
---|
114 | INIT_CHUNK_HDR (mng_init_jdat) ;
|
---|
115 | INIT_CHUNK_HDR (mng_init_jsep) ;
|
---|
116 | #endif
|
---|
117 | #ifndef MNG_NO_DELTA_PNG
|
---|
118 | INIT_CHUNK_HDR (mng_init_dhdr) ;
|
---|
119 | INIT_CHUNK_HDR (mng_init_prom) ;
|
---|
120 | INIT_CHUNK_HDR (mng_init_ipng) ;
|
---|
121 | INIT_CHUNK_HDR (mng_init_pplt) ;
|
---|
122 | #ifdef MNG_INCLUDE_JNG
|
---|
123 | INIT_CHUNK_HDR (mng_init_ijng) ;
|
---|
124 | #endif
|
---|
125 | INIT_CHUNK_HDR (mng_init_drop) ;
|
---|
126 | INIT_CHUNK_HDR (mng_init_dbyk) ;
|
---|
127 | INIT_CHUNK_HDR (mng_init_ordr) ;
|
---|
128 | #endif
|
---|
129 | INIT_CHUNK_HDR (mng_init_magn) ;
|
---|
130 | INIT_CHUNK_HDR (mng_init_evnt) ;
|
---|
131 | INIT_CHUNK_HDR (mng_init_unknown) ;
|
---|
132 | #endif /* MNG_OPTIMIZE_CHUNKINITFREE */
|
---|
133 |
|
---|
134 | /* ************************************************************************** */
|
---|
135 |
|
---|
136 | #define FREE_CHUNK_HDR(n) mng_retcode n (mng_datap pData, \
|
---|
137 | mng_chunkp pHeader)
|
---|
138 |
|
---|
139 | #ifdef MNG_OPTIMIZE_CHUNKINITFREE
|
---|
140 | FREE_CHUNK_HDR (mng_free_general) ;
|
---|
141 | #else /* MNG_OPTIMIZE_CHUNKINITFREE */
|
---|
142 | FREE_CHUNK_HDR (mng_free_ihdr) ;
|
---|
143 | FREE_CHUNK_HDR (mng_free_plte) ;
|
---|
144 | FREE_CHUNK_HDR (mng_free_iend) ;
|
---|
145 | FREE_CHUNK_HDR (mng_free_trns) ;
|
---|
146 | FREE_CHUNK_HDR (mng_free_gama) ;
|
---|
147 | FREE_CHUNK_HDR (mng_free_chrm) ;
|
---|
148 | FREE_CHUNK_HDR (mng_free_srgb) ;
|
---|
149 | FREE_CHUNK_HDR (mng_free_bkgd) ;
|
---|
150 | FREE_CHUNK_HDR (mng_free_phys) ;
|
---|
151 | FREE_CHUNK_HDR (mng_free_sbit) ;
|
---|
152 | FREE_CHUNK_HDR (mng_free_hist) ;
|
---|
153 | FREE_CHUNK_HDR (mng_free_time) ;
|
---|
154 | FREE_CHUNK_HDR (mng_free_mhdr) ;
|
---|
155 | FREE_CHUNK_HDR (mng_free_mend) ;
|
---|
156 | FREE_CHUNK_HDR (mng_free_endl) ;
|
---|
157 | FREE_CHUNK_HDR (mng_free_defi) ;
|
---|
158 | FREE_CHUNK_HDR (mng_free_basi) ;
|
---|
159 | FREE_CHUNK_HDR (mng_free_clon) ;
|
---|
160 | FREE_CHUNK_HDR (mng_free_back) ;
|
---|
161 | FREE_CHUNK_HDR (mng_free_move) ;
|
---|
162 | FREE_CHUNK_HDR (mng_free_clip) ;
|
---|
163 | FREE_CHUNK_HDR (mng_free_show) ;
|
---|
164 | FREE_CHUNK_HDR (mng_free_term) ;
|
---|
165 | FREE_CHUNK_HDR (mng_free_fpri) ;
|
---|
166 | FREE_CHUNK_HDR (mng_free_phyg) ;
|
---|
167 | #ifdef MNG_INCLUDE_JNG
|
---|
168 | FREE_CHUNK_HDR (mng_free_jhdr) ;
|
---|
169 | FREE_CHUNK_HDR (mng_free_jsep) ;
|
---|
170 | #endif
|
---|
171 | #ifndef MNG_NO_DELTA_PNG
|
---|
172 | FREE_CHUNK_HDR (mng_free_dhdr) ;
|
---|
173 | FREE_CHUNK_HDR (mng_free_prom) ;
|
---|
174 | FREE_CHUNK_HDR (mng_free_ipng) ;
|
---|
175 | FREE_CHUNK_HDR (mng_free_pplt) ;
|
---|
176 | #ifdef MNG_INCLUDE_JNG
|
---|
177 | FREE_CHUNK_HDR (mng_free_ijng) ;
|
---|
178 | #endif
|
---|
179 | #endif
|
---|
180 | FREE_CHUNK_HDR (mng_free_magn) ;
|
---|
181 | #endif /* MNG_OPTIMIZE_CHUNKINITFREE */
|
---|
182 |
|
---|
183 | FREE_CHUNK_HDR (mng_free_idat) ;
|
---|
184 | FREE_CHUNK_HDR (mng_free_iccp) ;
|
---|
185 | FREE_CHUNK_HDR (mng_free_text) ;
|
---|
186 | FREE_CHUNK_HDR (mng_free_ztxt) ;
|
---|
187 | FREE_CHUNK_HDR (mng_free_itxt) ;
|
---|
188 | FREE_CHUNK_HDR (mng_free_splt) ;
|
---|
189 | FREE_CHUNK_HDR (mng_free_loop) ;
|
---|
190 | #ifndef MNG_SKIPCHUNK_PAST
|
---|
191 | FREE_CHUNK_HDR (mng_free_past) ;
|
---|
192 | #endif
|
---|
193 | FREE_CHUNK_HDR (mng_free_disc) ;
|
---|
194 | FREE_CHUNK_HDR (mng_free_fram) ;
|
---|
195 | FREE_CHUNK_HDR (mng_free_save) ;
|
---|
196 | FREE_CHUNK_HDR (mng_free_seek) ;
|
---|
197 | FREE_CHUNK_HDR (mng_free_expi) ;
|
---|
198 | FREE_CHUNK_HDR (mng_free_need) ;
|
---|
199 | #ifdef MNG_INCLUDE_JNG
|
---|
200 | FREE_CHUNK_HDR (mng_free_jdaa) ;
|
---|
201 | FREE_CHUNK_HDR (mng_free_jdat) ;
|
---|
202 | #endif
|
---|
203 | #ifndef MNG_NO_DELTA_PNG
|
---|
204 | FREE_CHUNK_HDR (mng_free_drop) ;
|
---|
205 | FREE_CHUNK_HDR (mng_free_dbyk) ;
|
---|
206 | FREE_CHUNK_HDR (mng_free_ordr) ;
|
---|
207 | #endif
|
---|
208 | #ifdef MNG_INCLUDE_MPNG_PROPOSAL
|
---|
209 | FREE_CHUNK_HDR (mng_free_mpng) ;
|
---|
210 | #endif
|
---|
211 | #ifdef MNG_INCLUDE_ANG_PROPOSAL
|
---|
212 | FREE_CHUNK_HDR (mng_free_adat) ;
|
---|
213 | #endif
|
---|
214 | FREE_CHUNK_HDR (mng_free_evnt) ;
|
---|
215 | FREE_CHUNK_HDR (mng_free_unknown) ;
|
---|
216 |
|
---|
217 | /* ************************************************************************** */
|
---|
218 |
|
---|
219 | #ifdef MNG_INCLUDE_WRITE_PROCS
|
---|
220 |
|
---|
221 | #define ASSIGN_CHUNK_HDR(n) mng_retcode n (mng_datap pData, \
|
---|
222 | mng_chunkp pChunkto, \
|
---|
223 | mng_chunkp pChunkfrom)
|
---|
224 |
|
---|
225 | #ifdef MNG_OPTIMIZE_CHUNKASSIGN
|
---|
226 | ASSIGN_CHUNK_HDR (mng_assign_general) ;
|
---|
227 | #else /* MNG_OPTIMIZE_CHUNKASSIGN */
|
---|
228 | ASSIGN_CHUNK_HDR (mng_assign_ihdr) ;
|
---|
229 | ASSIGN_CHUNK_HDR (mng_assign_plte) ;
|
---|
230 | ASSIGN_CHUNK_HDR (mng_assign_iend) ;
|
---|
231 | ASSIGN_CHUNK_HDR (mng_assign_trns) ;
|
---|
232 | ASSIGN_CHUNK_HDR (mng_assign_gama) ;
|
---|
233 | ASSIGN_CHUNK_HDR (mng_assign_chrm) ;
|
---|
234 | ASSIGN_CHUNK_HDR (mng_assign_srgb) ;
|
---|
235 | ASSIGN_CHUNK_HDR (mng_assign_bkgd) ;
|
---|
236 | ASSIGN_CHUNK_HDR (mng_assign_phys) ;
|
---|
237 | ASSIGN_CHUNK_HDR (mng_assign_sbit) ;
|
---|
238 | ASSIGN_CHUNK_HDR (mng_assign_hist) ;
|
---|
239 | ASSIGN_CHUNK_HDR (mng_assign_time) ;
|
---|
240 | ASSIGN_CHUNK_HDR (mng_assign_mhdr) ;
|
---|
241 | ASSIGN_CHUNK_HDR (mng_assign_mend) ;
|
---|
242 | ASSIGN_CHUNK_HDR (mng_assign_endl) ;
|
---|
243 | ASSIGN_CHUNK_HDR (mng_assign_defi) ;
|
---|
244 | ASSIGN_CHUNK_HDR (mng_assign_basi) ;
|
---|
245 | ASSIGN_CHUNK_HDR (mng_assign_clon) ;
|
---|
246 | ASSIGN_CHUNK_HDR (mng_assign_back) ;
|
---|
247 | ASSIGN_CHUNK_HDR (mng_assign_move) ;
|
---|
248 | ASSIGN_CHUNK_HDR (mng_assign_clip) ;
|
---|
249 | ASSIGN_CHUNK_HDR (mng_assign_show) ;
|
---|
250 | ASSIGN_CHUNK_HDR (mng_assign_term) ;
|
---|
251 | ASSIGN_CHUNK_HDR (mng_assign_fpri) ;
|
---|
252 | ASSIGN_CHUNK_HDR (mng_assign_phyg) ;
|
---|
253 | #ifdef MNG_INCLUDE_JNG
|
---|
254 | ASSIGN_CHUNK_HDR (mng_assign_jhdr) ;
|
---|
255 | ASSIGN_CHUNK_HDR (mng_assign_jsep) ;
|
---|
256 | #endif
|
---|
257 | #ifndef MNG_NO_DELTA_PNG
|
---|
258 | ASSIGN_CHUNK_HDR (mng_assign_dhdr) ;
|
---|
259 | ASSIGN_CHUNK_HDR (mng_assign_prom) ;
|
---|
260 | ASSIGN_CHUNK_HDR (mng_assign_ipng) ;
|
---|
261 | ASSIGN_CHUNK_HDR (mng_assign_pplt) ;
|
---|
262 | #ifdef MNG_INCLUDE_JNG
|
---|
263 | ASSIGN_CHUNK_HDR (mng_assign_ijng) ;
|
---|
264 | #endif
|
---|
265 | #endif
|
---|
266 | ASSIGN_CHUNK_HDR (mng_assign_magn) ;
|
---|
267 | #endif /* MNG_OPTIMIZE_CHUNKASSIGN */
|
---|
268 |
|
---|
269 | ASSIGN_CHUNK_HDR (mng_assign_idat) ;
|
---|
270 | ASSIGN_CHUNK_HDR (mng_assign_iccp) ;
|
---|
271 | ASSIGN_CHUNK_HDR (mng_assign_text) ;
|
---|
272 | ASSIGN_CHUNK_HDR (mng_assign_ztxt) ;
|
---|
|
---|