Renesas / Mbed OS GR-PEACH_Audio_Playback_7InchLCD_Sample

Dependencies:   GR-PEACH_video R_BSP TLV320_RBSP USBHost_custom

Fork of GR-PEACH_Audio_Playback_Sample by Renesas

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers compat.h Source File

compat.h

00001 /* libFLAC - Free Lossless Audio Codec library
00002  * Copyright (C) 2012-2014  Xiph.org Foundation
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  *
00008  * - Redistributions of source code must retain the above copyright
00009  * notice, this list of conditions and the following disclaimer.
00010  *
00011  * - Redistributions in binary form must reproduce the above copyright
00012  * notice, this list of conditions and the following disclaimer in the
00013  * documentation and/or other materials provided with the distribution.
00014  *
00015  * - Neither the name of the Xiph.org Foundation nor the names of its
00016  * contributors may be used to endorse or promote products derived from
00017  * this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00020  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00022  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
00023  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00024  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00025  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00026  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00027  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00028  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00029  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 
00032 /* This is the prefered location of all CPP hackery to make $random_compiler
00033  * work like something approaching a C99 (or maybe more accurately GNU99)
00034  * compiler.
00035  *
00036  * It is assumed that this header will be included after "config.h".
00037  */
00038 
00039 #ifndef FLAC__SHARE__COMPAT_H
00040 #define FLAC__SHARE__COMPAT_H
00041 
00042 #if defined _WIN32 && !defined __CYGWIN__
00043 /* where MSVC puts unlink() */
00044 # include <io.h>
00045 #else
00046 #if(1) /* mbed */
00047 #include <stdint.h> /* for SIZE_MAX */
00048 #include <stddef.h> /* for size_t */
00049 #define HAVE_LROUND /* Compiler has lround function */
00050 #else  /* not mbed */
00051 # include <unistd.h>
00052 #endif /* end mbed */
00053 #endif
00054 
00055 #if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
00056 #include <sys/types.h> /* for off_t */
00057 #define FLAC__off_t __int64 /* use this instead of off_t to fix the 2 GB limit */
00058 #if !defined __MINGW32__
00059 #define fseeko _fseeki64
00060 #define ftello _ftelli64
00061 #else /* MinGW */
00062 #if !defined(HAVE_FSEEKO)
00063 #define fseeko fseeko64
00064 #define ftello ftello64
00065 #endif
00066 #endif
00067 #else
00068 #define FLAC__off_t off_t
00069 #endif
00070 
00071 #if HAVE_INTTYPES_H
00072 #define __STDC_FORMAT_MACROS
00073 #include <inttypes.h>
00074 #endif
00075 
00076 #if defined(_MSC_VER)
00077 #define strtoll _strtoi64
00078 #define strtoull _strtoui64
00079 #endif
00080 
00081 #if defined(_MSC_VER)
00082 #define inline __inline
00083 #endif
00084 
00085 #if defined __INTEL_COMPILER || (defined _MSC_VER && defined _WIN64)
00086 /* MSVS generates VERY slow 32-bit code with __restrict */
00087 #define flac_restrict __restrict
00088 #elif defined __GNUC__
00089 #define flac_restrict __restrict__
00090 #else
00091 #define flac_restrict
00092 #endif
00093 
00094 #define FLAC__U64L(x) x##ULL
00095 
00096 #if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
00097 #define FLAC__STRCASECMP stricmp
00098 #define FLAC__STRNCASECMP strnicmp
00099 #else
00100 #define FLAC__STRCASECMP strcasecmp
00101 #define FLAC__STRNCASECMP strncasecmp
00102 #endif
00103 
00104 #if defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ || defined __EMX__
00105 #include <io.h> /* for _setmode(), chmod() */
00106 #include <fcntl.h> /* for _O_BINARY */
00107 #else
00108 #if(1) /* mbed */
00109 #else  /* not mbed */
00110 #include <unistd.h> /* for chown(), unlink() */
00111 #endif /* end mbed */
00112 #endif
00113 
00114 #if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
00115 #if defined __BORLANDC__
00116 #include <utime.h> /* for utime() */
00117 #else
00118 #include <sys/utime.h> /* for utime() */
00119 #endif
00120 #else
00121 #if(1) /* mbed */
00122 #else  /* not mbed */
00123 #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
00124 #include <utime.h> /* for utime() */
00125 #endif /* end mbed */
00126 #endif
00127 
00128 #if defined _MSC_VER
00129 #  if _MSC_VER >= 1600
00130 /* Visual Studio 2010 has decent C99 support */
00131 #    include <stdint.h>
00132 #    define PRIu64 "llu"
00133 #    define PRId64 "lld"
00134 #    define PRIx64 "llx"
00135 #  else
00136 #    include <limits.h>
00137 #    ifndef UINT32_MAX
00138 #      define UINT32_MAX _UI32_MAX
00139 #    endif
00140      typedef unsigned __int64 uint64_t;
00141      typedef unsigned __int32 uint32_t;
00142      typedef unsigned __int16 uint16_t;
00143      typedef unsigned __int8 uint8_t;
00144      typedef __int64 int64_t;
00145      typedef __int32 int32_t;
00146      typedef __int16 int16_t;
00147      typedef __int8  int8_t;
00148 #    define PRIu64 "I64u"
00149 #    define PRId64 "I64d"
00150 #    define PRIx64 "I64x"
00151 #  endif
00152 #endif /* defined _MSC_VER */
00153 
00154 #ifdef _WIN32
00155 /* All char* strings are in UTF-8 format. Added to support Unicode files on Windows */
00156 #include "share/win_utf8_io.h"
00157 
00158 #define flac_printf printf_utf8
00159 #define flac_fprintf fprintf_utf8
00160 #define flac_vfprintf vfprintf_utf8
00161 #define flac_fopen fopen_utf8
00162 #define flac_chmod chmod_utf8
00163 #define flac_utime utime_utf8
00164 #define flac_unlink unlink_utf8
00165 #define flac_rename rename_utf8
00166 #define flac_stat _stat64_utf8
00167 
00168 #else
00169 
00170 #define flac_printf printf
00171 #define flac_fprintf fprintf
00172 #define flac_vfprintf vfprintf
00173 #define flac_fopen fopen
00174 #define flac_chmod chmod
00175 #define flac_utime utime
00176 #define flac_unlink unlink
00177 #define flac_rename rename
00178 #define flac_stat stat
00179 
00180 #endif
00181 
00182 #ifdef _WIN32
00183 #define flac_stat_s __stat64 /* stat struct */
00184 #define flac_fstat _fstat64
00185 #else
00186 #define flac_stat_s stat /* stat struct */
00187 #define flac_fstat fstat
00188 #endif
00189 
00190 #ifndef M_LN2
00191 #define M_LN2 0.69314718055994530942
00192 #endif
00193 #ifndef M_PI
00194 #define M_PI 3.14159265358979323846
00195 #endif
00196 
00197 /* FLAC needs to compile and work correctly on systems with a normal ISO C99
00198  * snprintf as well as Microsoft Visual Studio which has an non-standards
00199  * conformant snprint_s function.
00200  *
00201  * This function wraps the MS version to behave more like the the ISO version.
00202  */
00203 #include <stdarg.h>
00204 #ifdef __cplusplus
00205 extern "C" {
00206 #endif
00207 int flac_snprintf(char *str, size_t size, const char *fmt, ...);
00208 int flac_vsnprintf(char *str, size_t size, const char *fmt, va_list va);
00209 #ifdef __cplusplus
00210 };
00211 #endif
00212 
00213 #endif /* FLAC__SHARE__COMPAT_H */