2 * Copyright (c) 2005, Herve Drolon, FreeImage Team
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
26 #ifndef OPJ_INCLUDES_H
27 #define OPJ_INCLUDES_H
30 * This must be included before any system headers,
31 * since they can react to macro defined there
33 #include "opj_config.h"
36 ==========================================================
37 Standard includes used by the library
38 ==========================================================
52 Use fseeko() and ftello() if they are available since they use
53 'off_t' rather than 'long'. It is wrong to use fseeko() and
54 ftello() only on systems with special LFS support since some systems
55 (e.g. FreeBSD) support a 64-bit off_t by default.
57 #if defined(HAVE_FSEEKO)
63 #if defined(WIN32) && !defined(Windows95) && !defined(__BORLANDC__) && \
64 !(defined(_MSC_VER) && _MSC_VER < 1400) && \
65 !(defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x800)
67 Windows '95 and Borland C do not support _lseeki64
68 Visual Studio does not support _fseeki64 and _ftelli64 until the 2005 release.
69 Without these interfaces, files over 2GB in size are not supported for Windows.
71 # define OPJ_FSEEK(stream,offset,whence) _fseeki64(stream,/* __int64 */ offset,whence)
72 # define OPJ_FSTAT(fildes,stat_buff) _fstati64(fildes,/* struct _stati64 */ stat_buff)
73 # define OPJ_FTELL(stream) /* __int64 */ _ftelli64(stream)
74 # define OPJ_STAT_STRUCT_T struct _stati64
75 # define OPJ_STAT(path,stat_buff) _stati64(path,/* struct _stati64 */ stat_buff)
77 # define OPJ_FSEEK(stream,offset,whence) fseek(stream,offset,whence)
78 # define OPJ_FSTAT(fildes,stat_buff) fstat(fildes,stat_buff)
79 # define OPJ_FTELL(stream) ftell(stream)
80 # define OPJ_STAT_STRUCT_T struct stat
81 # define OPJ_STAT(path,stat_buff) stat(path,stat_buff)
86 ==========================================================
88 ==========================================================
93 ==========================================================
95 ==========================================================
98 /* Ignore GCC attributes if this is not GCC */
100 #define __attribute__(x) /* __attribute__(x) */
104 The inline keyword is supported by C99 but not by C90.
105 Most compilers implement their own version of this keyword ...
108 #if defined(_MSC_VER)
109 #define INLINE __forceinline
110 #elif defined(__GNUC__)
111 #define INLINE __inline__
112 #elif defined(__MWERKS__)
113 #define INLINE inline
115 /* add other compilers here ... */
117 #endif /* defined(<Compiler>) */
120 /* Are restricted pointers available? (C99) */
121 #if (__STDC_VERSION__ != 199901L)
122 /* Not a C99 compiler */
124 #define restrict __restrict__
126 #define restrict /* restrict */
130 /* MSVC and Borland C do not have lrintf */
131 #if defined(_MSC_VER) || defined(__BORLANDC__)
132 static INLINE long lrintf(float f){
134 return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
148 #include "opj_inttypes.h"
150 #include "opj_malloc.h"
170 #include "opj_intmath.h"
173 #include "cidx_manager.h"
174 #include "indexbox_manager.h"
179 #include "openjpwl/jpwl.h"
180 #endif /* USE_JPWL */
184 #include "function_list.h"
186 #endif /* OPJ_INCLUDES_H */