Subversion Repositories freemyipod

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
160 theseven 1
/* uclconf.h -- configuration for the UCL real-time data compression library
2
 
3
   This file is part of the UCL data compression library.
4
 
5
   Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
6
   Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
7
   Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
8
   Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
9
   Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
10
   Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
11
   Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
12
   All Rights Reserved.
13
 
14
   The UCL library is free software; you can redistribute it and/or
15
   modify it under the terms of the GNU General Public License as
16
   published by the Free Software Foundation; either version 2 of
17
   the License, or (at your option) any later version.
18
 
19
   The UCL library is distributed in the hope that it will be useful,
20
   but WITHOUT ANY WARRANTY; without even the implied warranty of
21
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
   GNU General Public License for more details.
23
 
24
   You should have received a copy of the GNU General Public License
25
   along with the UCL library; see the file COPYING.
26
   If not, write to the Free Software Foundation, Inc.,
27
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28
 
29
   Markus F.X.J. Oberhumer
30
   <markus@oberhumer.com>
31
   http://www.oberhumer.com/opensource/ucl/
32
 */
33
 
34
 
35
#ifndef __UCLCONF_H
36
#define __UCLCONF_H
37
 
38
#include "embiosapp.h"
39
 
40
#define UCL_VERSION             0x010100L
41
#define UCL_VERSION_STRING      "1.01"
42
#define UCL_VERSION_DATE        "Jan 02 2002"
43
 
44
/* internal Autoconf configuration file - only used when building UCL */
45
#if defined(UCL_HAVE_CONFIG_H)
46
#  include <config.h>
47
#endif
48
#include <limits.h>
49
 
50
#ifdef __cplusplus
51
extern "C" {
52
#endif
53
 
54
 
55
/***********************************************************************
56
// UCL requires a conforming <limits.h>
57
************************************************************************/
58
 
59
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
60
#  error "invalid CHAR_BIT"
61
#endif
62
#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
63
#  error "check your compiler installation"
64
#endif
65
#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
66
#  error "your limits.h macros are broken"
67
#endif
68
 
69
/* workaround a compiler bug under hpux 10.20 */
70
#define UCL_0xffffffffL         4294967295ul
71
 
72
#if !defined(UCL_UINT32_C)
73
#  if (UINT_MAX < UCL_0xffffffffL)
74
#    define UCL_UINT32_C(c)     c ## UL
75
#  else
76
#    define UCL_UINT32_C(c)     c ## U
77
#  endif
78
#endif
79
 
80
 
81
/***********************************************************************
82
// architecture defines
83
************************************************************************/
84
 
85
#if !defined(__UCL_WIN) && !defined(__UCL_DOS) && !defined(__UCL_OS2)
86
#  if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
87
#    define __UCL_WIN
88
#  elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
89
#    define __UCL_WIN
90
#  elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__)
91
#    define __UCL_WIN
92
#  elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS)
93
#    define __UCL_DOS
94
#  elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2)
95
#    define __UCL_OS2
96
#  elif defined(__palmos__)
97
#    define __UCL_PALMOS
98
#  elif defined(__TOS__) || defined(__atarist__)
99
#    define __UCL_TOS
100
#  endif
101
#endif
102
 
103
#if (UINT_MAX < UCL_0xffffffffL)
104
#  if defined(__UCL_WIN)
105
#    define __UCL_WIN16
106
#  elif defined(__UCL_DOS)
107
#    define __UCL_DOS16
108
#  elif defined(__UCL_PALMOS)
109
#    define __UCL_PALMOS16
110
#  elif defined(__UCL_TOS)
111
#    define __UCL_TOS16
112
#  elif defined(__C166__)
113
#  else
114
#    error "16-bit target not supported - contact me for porting hints"
115
#  endif
116
#endif
117
 
118
#if !defined(__UCL_i386)
119
#  if defined(__UCL_DOS) || defined(__UCL_WIN16)
120
#    define __UCL_i386
121
#  elif defined(__i386__) || defined(__386__) || defined(_M_IX86)
122
#    define __UCL_i386
123
#  endif
124
#endif
125
 
126
#if defined(__UCL_STRICT_16BIT)
127
#  if (UINT_MAX < UCL_0xffffffffL)
128
#    include <ucl/ucl16bit.h>
129
#  endif
130
#endif
131
 
132
/* memory checkers */
133
#if !defined(__UCL_CHECKER)
134
#  if defined(__BOUNDS_CHECKING_ON)
135
#    define __UCL_CHECKER
136
#  elif defined(__CHECKER__)
137
#    define __UCL_CHECKER
138
#  elif defined(__INSURE__)
139
#    define __UCL_CHECKER
140
#  elif defined(__PURIFY__)
141
#    define __UCL_CHECKER
142
#  endif
143
#endif
144
 
145
 
146
/***********************************************************************
147
// integral and pointer types
148
************************************************************************/
149
 
150
/* Integral types with 32 bits or more */
151
#if !defined(UCL_UINT32_MAX)
152
#  if (UINT_MAX >= UCL_0xffffffffL)
153
     typedef unsigned int       ucl_uint32;
154
     typedef int                ucl_int32;
155
#    define UCL_UINT32_MAX      UINT_MAX
156
#    define UCL_INT32_MAX       INT_MAX
157
#    define UCL_INT32_MIN       INT_MIN
158
#  elif (ULONG_MAX >= UCL_0xffffffffL)
159
     typedef unsigned long      ucl_uint32;
160
     typedef long               ucl_int32;
161
#    define UCL_UINT32_MAX      ULONG_MAX
162
#    define UCL_INT32_MAX       LONG_MAX
163
#    define UCL_INT32_MIN       LONG_MIN
164
#  else
165
#    error "ucl_uint32"
166
#  endif
167
#endif
168
 
169
/* ucl_uint is used like size_t */
170
#if !defined(UCL_UINT_MAX)
171
#  if (UINT_MAX >= UCL_0xffffffffL)
172
     typedef unsigned int       ucl_uint;
173
     typedef int                ucl_int;
174
#    define UCL_UINT_MAX        UINT_MAX
175
#    define UCL_INT_MAX         INT_MAX
176
#    define UCL_INT_MIN         INT_MIN
177
#  elif (ULONG_MAX >= UCL_0xffffffffL)
178
     typedef unsigned long      ucl_uint;
179
     typedef long               ucl_int;
180
#    define UCL_UINT_MAX        ULONG_MAX
181
#    define UCL_INT_MAX         LONG_MAX
182
#    define UCL_INT_MIN         LONG_MIN
183
#  else
184
#    error "ucl_uint"
185
#  endif
186
#endif
187
 
188
/* Memory model that allows to access memory at offsets of ucl_uint. */
189
#if !defined(__UCL_MMODEL)
190
#  if (UCL_UINT_MAX <= UINT_MAX)
191
#    define __UCL_MMODEL
192
#  elif defined(__UCL_DOS16) || defined(__UCL_WIN16)
193
#    define __UCL_MMODEL        __huge
194
#    define UCL_999_UNSUPPORTED
195
#  elif defined(__UCL_PALMOS16) || defined(__UCL_TOS16)
196
#    define __UCL_MMODEL
197
#  else
198
#    error "__UCL_MMODEL"
199
#  endif
200
#endif
201
 
202
/* no typedef here because of const-pointer issues */
203
#define ucl_byte                unsigned char __UCL_MMODEL
204
#define ucl_bytep               unsigned char __UCL_MMODEL *
205
#define ucl_charp               char __UCL_MMODEL *
206
#define ucl_voidp               void __UCL_MMODEL *
207
#define ucl_shortp              short __UCL_MMODEL *
208
#define ucl_ushortp             unsigned short __UCL_MMODEL *
209
#define ucl_uint32p             ucl_uint32 __UCL_MMODEL *
210
#define ucl_int32p              ucl_int32 __UCL_MMODEL *
211
#define ucl_uintp               ucl_uint __UCL_MMODEL *
212
#define ucl_intp                ucl_int __UCL_MMODEL *
213
#define ucl_voidpp              ucl_voidp __UCL_MMODEL *
214
#define ucl_bytepp              ucl_bytep __UCL_MMODEL *
215
 
216
typedef int ucl_bool;
217
 
218
 
219
/***********************************************************************
220
// function types
221
************************************************************************/
222
 
223
/* linkage */
224
#if !defined(__UCL_EXTERN_C)
225
#  ifdef __cplusplus
226
#    define __UCL_EXTERN_C      extern "C"
227
#  else
228
#    define __UCL_EXTERN_C      extern
229
#  endif
230
#endif
231
 
232
/* calling conventions */
233
#if !defined(__UCL_CDECL)
234
#  if defined(__UCL_DOS16) || defined(__UCL_WIN16)
235
#    define __UCL_CDECL         __far __cdecl
236
#  elif defined(__UCL_i386) && defined(_MSC_VER)
237
#    define __UCL_CDECL         __cdecl
238
#  elif defined(__UCL_i386) && defined(__WATCOMC__)
239
#    define __UCL_CDECL         __near __cdecl
240
#  else
241
#    define __UCL_CDECL
242
#  endif
243
#endif
244
#if !defined(__UCL_ENTRY)
245
#  define __UCL_ENTRY           __UCL_CDECL
246
#endif
247
 
248
/* DLL export information */
249
#if !defined(__UCL_EXPORT1)
250
#  define __UCL_EXPORT1
251
#endif
252
#if !defined(__UCL_EXPORT2)
253
#  define __UCL_EXPORT2
254
#endif
255
 
256
/* calling convention for C functions */
257
#if !defined(UCL_PUBLIC)
258
#  define UCL_PUBLIC(_rettype)  __UCL_EXPORT1 _rettype __UCL_EXPORT2 __UCL_ENTRY
259
#endif
260
#if !defined(UCL_EXTERN)
261
#  define UCL_EXTERN(_rettype)  __UCL_EXTERN_C UCL_PUBLIC(_rettype)
262
#endif
263
#if !defined(UCL_PRIVATE)
264
#  define UCL_PRIVATE(_rettype) static _rettype __UCL_ENTRY
265
#endif
266
 
267
/* cdecl calling convention for assembler functions */
268
#if !defined(UCL_PUBLIC_CDECL)
269
#  define UCL_PUBLIC_CDECL(_rettype) \
270
                __UCL_EXPORT1 _rettype __UCL_EXPORT2 __UCL_CDECL
271
#endif
272
#if !defined(UCL_EXTERN_CDECL)
273
#  define UCL_EXTERN_CDECL(_rettype)  __UCL_EXTERN_C UCL_PUBLIC_CDECL(_rettype)
274
#endif
275
 
276
/* C++ exception specification for extern "C" function types */
277
#if !defined(__cplusplus)
278
#  undef UCL_NOTHROW
279
#  define UCL_NOTHROW
280
#elif !defined(UCL_NOTHROW)
281
#  define UCL_NOTHROW
282
#endif
283
 
284
 
285
typedef int
286
(__UCL_ENTRY *ucl_compress_t)   ( const ucl_bytep src, ucl_uint  src_len,
287
                                        ucl_bytep dst, ucl_uintp dst_len,
288
                                        ucl_voidp wrkmem );
289
 
290
typedef int
291
(__UCL_ENTRY *ucl_decompress_t) ( const ucl_bytep src, ucl_uint  src_len,
292
                                        ucl_bytep dst, ucl_uintp dst_len,
293
                                        ucl_voidp wrkmem );
294
 
295
typedef int
296
(__UCL_ENTRY *ucl_optimize_t)   (       ucl_bytep src, ucl_uint  src_len,
297
                                        ucl_bytep dst, ucl_uintp dst_len,
298
                                        ucl_voidp wrkmem );
299
 
300
typedef int
301
(__UCL_ENTRY *ucl_compress_dict_t)(const ucl_bytep src, ucl_uint  src_len,
302
                                        ucl_bytep dst, ucl_uintp dst_len,
303
                                        ucl_voidp wrkmem,
304
                                  const ucl_bytep dict, ucl_uint dict_len );
305
 
306
typedef int
307
(__UCL_ENTRY *ucl_decompress_dict_t)(const ucl_bytep src, ucl_uint  src_len,
308
                                        ucl_bytep dst, ucl_uintp dst_len,
309
                                        ucl_voidp wrkmem,
310
                                  const ucl_bytep dict, ucl_uint dict_len );
311
 
312
 
313
/* a progress indicator callback function */
314
typedef struct
315
{
316
    void (__UCL_ENTRY *callback) (ucl_uint, ucl_uint, int, ucl_voidp user);
317
    ucl_voidp user;
318
}
319
ucl_progress_callback_t;
320
#define ucl_progress_callback_p ucl_progress_callback_t __UCL_MMODEL *
321
 
322
 
323
/***********************************************************************
324
// error codes and prototypes
325
************************************************************************/
326
 
327
/* Error codes for the compression/decompression functions. Negative
328
 * values are errors, positive values will be used for special but
329
 * normal events.
330
 */
331
#define UCL_E_OK                    0
332
#define UCL_E_ERROR                 (-1)
333
#define UCL_E_INVALID_ARGUMENT      (-2)
334
#define UCL_E_OUT_OF_MEMORY         (-3)
335
/* compression errors */
336
#define UCL_E_NOT_COMPRESSIBLE      (-101)
337
/* decompression errors */
338
#define UCL_E_INPUT_OVERRUN         (-201)
339
#define UCL_E_OUTPUT_OVERRUN        (-202)
340
#define UCL_E_LOOKBEHIND_OVERRUN    (-203)
341
#define UCL_E_EOF_NOT_FOUND         (-204)
342
#define UCL_E_INPUT_NOT_CONSUMED    (-205)
343
#define UCL_E_OVERLAP_OVERRUN       (-206)
344
 
345
 
346
/* ucl_init() should be the first function you call.
347
 * Check the return code !
348
 *
349
 * ucl_init() is a macro to allow checking that the library and the
350
 * compiler's view of various types are consistent.
351
 */
352
#define ucl_init() __ucl_init2(UCL_VERSION,(int)sizeof(short),(int)sizeof(int),\
353
    (int)sizeof(long),(int)sizeof(ucl_uint32),(int)sizeof(ucl_uint),\
354
    (int)-1,(int)sizeof(char *),(int)sizeof(ucl_voidp),\
355
    (int)sizeof(ucl_compress_t))
356
UCL_EXTERN(int) __ucl_init2(ucl_uint32,int,int,int,int,int,int,int,int,int);
357
 
358
/* version functions (useful for shared libraries) */
359
UCL_EXTERN(ucl_uint32) ucl_version(void);
360
UCL_EXTERN(const char *) ucl_version_string(void);
361
UCL_EXTERN(const char *) ucl_version_date(void);
362
UCL_EXTERN(const ucl_charp) _ucl_version_string(void);
363
UCL_EXTERN(const ucl_charp) _ucl_version_date(void);
364
 
365
/* string functions */
366
UCL_EXTERN(int)
367
ucl_memcmp(const ucl_voidp _s1, const ucl_voidp _s2, ucl_uint _len);
368
UCL_EXTERN(ucl_voidp)
369
ucl_memcpy(ucl_voidp _dest, const ucl_voidp _src, ucl_uint _len);
370
UCL_EXTERN(ucl_voidp)
371
ucl_memmove(ucl_voidp _dest, const ucl_voidp _src, ucl_uint _len);
372
UCL_EXTERN(ucl_voidp)
373
ucl_memset(ucl_voidp _s, int _c, ucl_uint _len);
374
 
375
/* checksum functions */
376
UCL_EXTERN(ucl_uint32)
377
ucl_adler32(ucl_uint32 _adler, const ucl_bytep _buf, ucl_uint _len);
378
UCL_EXTERN(ucl_uint32)
379
ucl_crc32(ucl_uint32 _c, const ucl_bytep _buf, ucl_uint _len);
380
 
381
/* memory allocation functions */
382
UCL_EXTERN(ucl_voidp) ucl_alloc(ucl_uint _nelems, ucl_uint _size);
383
UCL_EXTERN(ucl_voidp) ucl_malloc(ucl_uint _size);
384
UCL_EXTERN(void) ucl_free(ucl_voidp _ptr);
385
 
386
typedef ucl_voidp (__UCL_ENTRY *ucl_alloc_hook_t) (ucl_uint, ucl_uint);
387
typedef void (__UCL_ENTRY *ucl_free_hook_t) (ucl_voidp);
388
 
389
extern ucl_alloc_hook_t ucl_alloc_hook;
390
extern ucl_free_hook_t ucl_free_hook;
391
 
392
/* misc. */
393
UCL_EXTERN(ucl_bool) ucl_assert(int _expr);
394
UCL_EXTERN(int) _ucl_config_check(void);
395
typedef union { ucl_bytep p; ucl_uint u; } __ucl_pu_u;
396
typedef union { ucl_bytep p; ucl_uint32 u32; } __ucl_pu32_u;
397
 
398
/* align a char pointer on a boundary that is a multiple of `size' */
399
UCL_EXTERN(unsigned) __ucl_align_gap(const ucl_voidp _ptr, ucl_uint _size);
400
#define UCL_PTR_ALIGN_UP(_ptr,_size) \
401
    ((_ptr) + (ucl_uint) __ucl_align_gap((const ucl_voidp)(_ptr),(ucl_uint)(_size)))
402
 
403
 
404
#ifdef __cplusplus
405
} /* extern "C" */
406
#endif
407
 
408
#endif /* already included */
409