include/begin_code.h
changeset 8582 c3e9a2b93517
parent 8535 e8ee0708ef5c
child 8583 fb2933ca805f
     1.1 --- a/include/begin_code.h	Tue Mar 04 19:49:11 2014 -0500
     1.2 +++ b/include/begin_code.h	Sun Mar 09 11:06:11 2014 -0700
     1.3 @@ -1,140 +1,140 @@
     1.4 -/*
     1.5 -  Simple DirectMedia Layer
     1.6 -  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
     1.7 -
     1.8 -  This software is provided 'as-is', without any express or implied
     1.9 -  warranty.  In no event will the authors be held liable for any damages
    1.10 -  arising from the use of this software.
    1.11 -
    1.12 -  Permission is granted to anyone to use this software for any purpose,
    1.13 -  including commercial applications, and to alter it and redistribute it
    1.14 -  freely, subject to the following restrictions:
    1.15 -
    1.16 -  1. The origin of this software must not be misrepresented; you must not
    1.17 -     claim that you wrote the original software. If you use this software
    1.18 -     in a product, an acknowledgment in the product documentation would be
    1.19 -     appreciated but is not required.
    1.20 -  2. Altered source versions must be plainly marked as such, and must not be
    1.21 -     misrepresented as being the original software.
    1.22 -  3. This notice may not be removed or altered from any source distribution.
    1.23 -*/
    1.24 -
    1.25 -/**
    1.26 - *  \file begin_code.h
    1.27 - *
    1.28 - *  This file sets things up for C dynamic library function definitions,
    1.29 - *  static inlined functions, and structures aligned at 4-byte alignment.
    1.30 - *  If you don't like ugly C preprocessor code, don't look at this file. :)
    1.31 - */
    1.32 -
    1.33 -/* This shouldn't be nested -- included it around code only. */
    1.34 -#ifdef _begin_code_h
    1.35 -#error Nested inclusion of begin_code.h
    1.36 -#endif
    1.37 -#define _begin_code_h
    1.38 -
    1.39 -#ifndef SDL_DEPRECATED
    1.40 -#  if (__GNUC__ >= 4)  /* technically, this arrived in gcc 3.1, but oh well. */
    1.41 -#    define SDL_DEPRECATED __attribute__((deprecated))
    1.42 -#  else
    1.43 -#    define SDL_DEPRECATED
    1.44 -#  endif
    1.45 -#endif
    1.46 -
    1.47 -/* Some compilers use a special export keyword */
    1.48 -#ifndef DECLSPEC
    1.49 -# if defined(__WIN32__) || defined(__WINRT__)
    1.50 -#  ifdef __BORLANDC__
    1.51 -#   ifdef BUILD_SDL
    1.52 -#    define DECLSPEC
    1.53 -#   else
    1.54 -#    define DECLSPEC    __declspec(dllimport)
    1.55 -#   endif
    1.56 -#  else
    1.57 -#   define DECLSPEC __declspec(dllexport)
    1.58 -#  endif
    1.59 -# else
    1.60 -#  if defined(__GNUC__) && __GNUC__ >= 4
    1.61 -#   define DECLSPEC __attribute__ ((visibility("default")))
    1.62 -#  elif defined(__GNUC__) && __GNUC__ >= 2
    1.63 -#   define DECLSPEC __declspec(dllexport)
    1.64 -#  else
    1.65 -#   define DECLSPEC
    1.66 -#  endif
    1.67 -# endif
    1.68 -#endif
    1.69 -
    1.70 -/* By default SDL uses the C calling convention */
    1.71 -#ifndef SDLCALL
    1.72 -#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
    1.73 -#define SDLCALL __cdecl
    1.74 -#else
    1.75 -#define SDLCALL
    1.76 -#endif
    1.77 -#endif /* SDLCALL */
    1.78 -
    1.79 -/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
    1.80 -#ifdef __SYMBIAN32__
    1.81 -#undef DECLSPEC
    1.82 -#define DECLSPEC
    1.83 -#endif /* __SYMBIAN32__ */
    1.84 -
    1.85 -/* Force structure packing at 4 byte alignment.
    1.86 -   This is necessary if the header is included in code which has structure
    1.87 -   packing set to an alternate value, say for loading structures from disk.
    1.88 -   The packing is reset to the previous value in close_code.h
    1.89 - */
    1.90 -#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
    1.91 -#ifdef _MSC_VER
    1.92 -#pragma warning(disable: 4103)
    1.93 -#endif
    1.94 -#ifdef __BORLANDC__
    1.95 -#pragma nopackwarning
    1.96 -#endif
    1.97 -#ifdef _M_X64
    1.98 -/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
    1.99 -#pragma pack(push,8)
   1.100 -#else
   1.101 -#pragma pack(push,4)
   1.102 -#endif
   1.103 -#endif /* Compiler needs structure packing set */
   1.104 -
   1.105 -#ifndef SDL_INLINE
   1.106 -#if defined(__GNUC__)
   1.107 -#define SDL_INLINE __inline__
   1.108 -#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
   1.109 -      defined(__DMC__) || defined(__SC__) || \
   1.110 -      defined(__WATCOMC__) || defined(__LCC__) || \
   1.111 -      defined(__DECC)
   1.112 -#define SDL_INLINE __inline
   1.113 -#ifndef __inline__
   1.114 -#define __inline__ __inline
   1.115 -#endif
   1.116 -#else
   1.117 -#define SDL_INLINE inline
   1.118 -#ifndef __inline__
   1.119 -#define __inline__ inline
   1.120 -#endif
   1.121 -#endif
   1.122 -#endif /* SDL_INLINE not defined */
   1.123 -
   1.124 -#ifndef SDL_FORCE_INLINE
   1.125 -#if defined(_MSC_VER)
   1.126 -#define SDL_FORCE_INLINE __forceinline
   1.127 -#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
   1.128 -#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
   1.129 -#else
   1.130 -#define SDL_FORCE_INLINE static SDL_INLINE
   1.131 -#endif
   1.132 -#endif /* SDL_FORCE_INLINE not defined */
   1.133 -
   1.134 -/* Apparently this is needed by several Windows compilers */
   1.135 -#if !defined(__MACH__)
   1.136 -#ifndef NULL
   1.137 -#ifdef __cplusplus
   1.138 -#define NULL 0
   1.139 -#else
   1.140 -#define NULL ((void *)0)
   1.141 -#endif
   1.142 -#endif /* NULL */
   1.143 -#endif /* ! Mac OS X - breaks precompiled headers */
   1.144 +/*
   1.145 +  Simple DirectMedia Layer
   1.146 +  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
   1.147 +
   1.148 +  This software is provided 'as-is', without any express or implied
   1.149 +  warranty.  In no event will the authors be held liable for any damages
   1.150 +  arising from the use of this software.
   1.151 +
   1.152 +  Permission is granted to anyone to use this software for any purpose,
   1.153 +  including commercial applications, and to alter it and redistribute it
   1.154 +  freely, subject to the following restrictions:
   1.155 +
   1.156 +  1. The origin of this software must not be misrepresented; you must not
   1.157 +     claim that you wrote the original software. If you use this software
   1.158 +     in a product, an acknowledgment in the product documentation would be
   1.159 +     appreciated but is not required.
   1.160 +  2. Altered source versions must be plainly marked as such, and must not be
   1.161 +     misrepresented as being the original software.
   1.162 +  3. This notice may not be removed or altered from any source distribution.
   1.163 +*/
   1.164 +
   1.165 +/**
   1.166 + *  \file begin_code.h
   1.167 + *
   1.168 + *  This file sets things up for C dynamic library function definitions,
   1.169 + *  static inlined functions, and structures aligned at 4-byte alignment.
   1.170 + *  If you don't like ugly C preprocessor code, don't look at this file. :)
   1.171 + */
   1.172 +
   1.173 +/* This shouldn't be nested -- included it around code only. */
   1.174 +#ifdef _begin_code_h
   1.175 +#error Nested inclusion of begin_code.h
   1.176 +#endif
   1.177 +#define _begin_code_h
   1.178 +
   1.179 +#ifndef SDL_DEPRECATED
   1.180 +#  if (__GNUC__ >= 4)  /* technically, this arrived in gcc 3.1, but oh well. */
   1.181 +#    define SDL_DEPRECATED __attribute__((deprecated))
   1.182 +#  else
   1.183 +#    define SDL_DEPRECATED
   1.184 +#  endif
   1.185 +#endif
   1.186 +
   1.187 +/* Some compilers use a special export keyword */
   1.188 +#ifndef DECLSPEC
   1.189 +# if defined(__WIN32__) || defined(__WINRT__)
   1.190 +#  ifdef __BORLANDC__
   1.191 +#   ifdef BUILD_SDL
   1.192 +#    define DECLSPEC
   1.193 +#   else
   1.194 +#    define DECLSPEC    __declspec(dllimport)
   1.195 +#   endif
   1.196 +#  else
   1.197 +#   define DECLSPEC __declspec(dllexport)
   1.198 +#  endif
   1.199 +# else
   1.200 +#  if defined(__GNUC__) && __GNUC__ >= 4
   1.201 +#   define DECLSPEC __attribute__ ((visibility("default")))
   1.202 +#  elif defined(__GNUC__) && __GNUC__ >= 2
   1.203 +#   define DECLSPEC __declspec(dllexport)
   1.204 +#  else
   1.205 +#   define DECLSPEC
   1.206 +#  endif
   1.207 +# endif
   1.208 +#endif
   1.209 +
   1.210 +/* By default SDL uses the C calling convention */
   1.211 +#ifndef SDLCALL
   1.212 +#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
   1.213 +#define SDLCALL __cdecl
   1.214 +#else
   1.215 +#define SDLCALL
   1.216 +#endif
   1.217 +#endif /* SDLCALL */
   1.218 +
   1.219 +/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
   1.220 +#ifdef __SYMBIAN32__
   1.221 +#undef DECLSPEC
   1.222 +#define DECLSPEC
   1.223 +#endif /* __SYMBIAN32__ */
   1.224 +
   1.225 +/* Force structure packing at 4 byte alignment.
   1.226 +   This is necessary if the header is included in code which has structure
   1.227 +   packing set to an alternate value, say for loading structures from disk.
   1.228 +   The packing is reset to the previous value in close_code.h
   1.229 + */
   1.230 +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
   1.231 +#ifdef _MSC_VER
   1.232 +#pragma warning(disable: 4103)
   1.233 +#endif
   1.234 +#ifdef __BORLANDC__
   1.235 +#pragma nopackwarning
   1.236 +#endif
   1.237 +#ifdef _M_X64
   1.238 +/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
   1.239 +#pragma pack(push,8)
   1.240 +#else
   1.241 +#pragma pack(push,4)
   1.242 +#endif
   1.243 +#endif /* Compiler needs structure packing set */
   1.244 +
   1.245 +#ifndef SDL_INLINE
   1.246 +#if defined(__GNUC__)
   1.247 +#define SDL_INLINE __inline__
   1.248 +#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
   1.249 +      defined(__DMC__) || defined(__SC__) || \
   1.250 +      defined(__WATCOMC__) || defined(__LCC__) || \
   1.251 +      defined(__DECC)
   1.252 +#define SDL_INLINE __inline
   1.253 +#ifndef __inline__
   1.254 +#define __inline__ __inline
   1.255 +#endif
   1.256 +#else
   1.257 +#define SDL_INLINE inline
   1.258 +#ifndef __inline__
   1.259 +#define __inline__ inline
   1.260 +#endif
   1.261 +#endif
   1.262 +#endif /* SDL_INLINE not defined */
   1.263 +
   1.264 +#ifndef SDL_FORCE_INLINE
   1.265 +#if defined(_MSC_VER)
   1.266 +#define SDL_FORCE_INLINE __forceinline
   1.267 +#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
   1.268 +#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
   1.269 +#else
   1.270 +#define SDL_FORCE_INLINE static SDL_INLINE
   1.271 +#endif
   1.272 +#endif /* SDL_FORCE_INLINE not defined */
   1.273 +
   1.274 +/* Apparently this is needed by several Windows compilers */
   1.275 +#if !defined(__MACH__)
   1.276 +#ifndef NULL
   1.277 +#ifdef __cplusplus
   1.278 +#define NULL 0
   1.279 +#else
   1.280 +#define NULL ((void *)0)
   1.281 +#endif
   1.282 +#endif /* NULL */
   1.283 +#endif /* ! Mac OS X - breaks precompiled headers */