SDL Library

Dependents:   H261_decoder

Committer:
miruga27
Date:
Thu Sep 22 00:03:09 2016 +0000
Revision:
0:7fb6877b5d7c
SDL

Who changed what in which revision?

UserRevisionLine numberNew contents of line
miruga27 0:7fb6877b5d7c 1 /*
miruga27 0:7fb6877b5d7c 2 Simple DirectMedia Layer
miruga27 0:7fb6877b5d7c 3 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
miruga27 0:7fb6877b5d7c 4
miruga27 0:7fb6877b5d7c 5 This software is provided 'as-is', without any express or implied
miruga27 0:7fb6877b5d7c 6 warranty. In no event will the authors be held liable for any damages
miruga27 0:7fb6877b5d7c 7 arising from the use of this software.
miruga27 0:7fb6877b5d7c 8
miruga27 0:7fb6877b5d7c 9 Permission is granted to anyone to use this software for any purpose,
miruga27 0:7fb6877b5d7c 10 including commercial applications, and to alter it and redistribute it
miruga27 0:7fb6877b5d7c 11 freely, subject to the following restrictions:
miruga27 0:7fb6877b5d7c 12
miruga27 0:7fb6877b5d7c 13 1. The origin of this software must not be misrepresented; you must not
miruga27 0:7fb6877b5d7c 14 claim that you wrote the original software. If you use this software
miruga27 0:7fb6877b5d7c 15 in a product, an acknowledgment in the product documentation would be
miruga27 0:7fb6877b5d7c 16 appreciated but is not required.
miruga27 0:7fb6877b5d7c 17 2. Altered source versions must be plainly marked as such, and must not be
miruga27 0:7fb6877b5d7c 18 misrepresented as being the original software.
miruga27 0:7fb6877b5d7c 19 3. This notice may not be removed or altered from any source distribution.
miruga27 0:7fb6877b5d7c 20 */
miruga27 0:7fb6877b5d7c 21
miruga27 0:7fb6877b5d7c 22 /**
miruga27 0:7fb6877b5d7c 23 * \file begin_code.h
miruga27 0:7fb6877b5d7c 24 *
miruga27 0:7fb6877b5d7c 25 * This file sets things up for C dynamic library function definitions,
miruga27 0:7fb6877b5d7c 26 * static inlined functions, and structures aligned at 4-byte alignment.
miruga27 0:7fb6877b5d7c 27 * If you don't like ugly C preprocessor code, don't look at this file. :)
miruga27 0:7fb6877b5d7c 28 */
miruga27 0:7fb6877b5d7c 29
miruga27 0:7fb6877b5d7c 30 /* This shouldn't be nested -- included it around code only. */
miruga27 0:7fb6877b5d7c 31 #ifdef _begin_code_h
miruga27 0:7fb6877b5d7c 32 #error Nested inclusion of begin_code.h
miruga27 0:7fb6877b5d7c 33 #endif
miruga27 0:7fb6877b5d7c 34 #define _begin_code_h
miruga27 0:7fb6877b5d7c 35
miruga27 0:7fb6877b5d7c 36 #ifndef SDL_DEPRECATED
miruga27 0:7fb6877b5d7c 37 # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */
miruga27 0:7fb6877b5d7c 38 # define SDL_DEPRECATED __attribute__((deprecated))
miruga27 0:7fb6877b5d7c 39 # else
miruga27 0:7fb6877b5d7c 40 # define SDL_DEPRECATED
miruga27 0:7fb6877b5d7c 41 # endif
miruga27 0:7fb6877b5d7c 42 #endif
miruga27 0:7fb6877b5d7c 43
miruga27 0:7fb6877b5d7c 44 /* Some compilers use a special export keyword */
miruga27 0:7fb6877b5d7c 45 #ifndef DECLSPEC
miruga27 0:7fb6877b5d7c 46 # if defined(__WIN32__)
miruga27 0:7fb6877b5d7c 47 # ifdef __BORLANDC__
miruga27 0:7fb6877b5d7c 48 # ifdef BUILD_SDL
miruga27 0:7fb6877b5d7c 49 # define DECLSPEC
miruga27 0:7fb6877b5d7c 50 # else
miruga27 0:7fb6877b5d7c 51 # define DECLSPEC __declspec(dllimport)
miruga27 0:7fb6877b5d7c 52 # endif
miruga27 0:7fb6877b5d7c 53 # else
miruga27 0:7fb6877b5d7c 54 # define DECLSPEC __declspec(dllexport)
miruga27 0:7fb6877b5d7c 55 # endif
miruga27 0:7fb6877b5d7c 56 # else
miruga27 0:7fb6877b5d7c 57 # if defined(__GNUC__) && __GNUC__ >= 4
miruga27 0:7fb6877b5d7c 58 # define DECLSPEC __attribute__ ((visibility("default")))
miruga27 0:7fb6877b5d7c 59 # elif defined(__GNUC__) && __GNUC__ >= 2
miruga27 0:7fb6877b5d7c 60 # define DECLSPEC __declspec(dllexport)
miruga27 0:7fb6877b5d7c 61 # else
miruga27 0:7fb6877b5d7c 62 # define DECLSPEC
miruga27 0:7fb6877b5d7c 63 # endif
miruga27 0:7fb6877b5d7c 64 # endif
miruga27 0:7fb6877b5d7c 65 #endif
miruga27 0:7fb6877b5d7c 66
miruga27 0:7fb6877b5d7c 67 /* By default SDL uses the C calling convention */
miruga27 0:7fb6877b5d7c 68 #ifndef SDLCALL
miruga27 0:7fb6877b5d7c 69 #if defined(__WIN32__) && !defined(__GNUC__)
miruga27 0:7fb6877b5d7c 70 #define SDLCALL __cdecl
miruga27 0:7fb6877b5d7c 71 #else
miruga27 0:7fb6877b5d7c 72 #define SDLCALL
miruga27 0:7fb6877b5d7c 73 #endif
miruga27 0:7fb6877b5d7c 74 #endif /* SDLCALL */
miruga27 0:7fb6877b5d7c 75
miruga27 0:7fb6877b5d7c 76 /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
miruga27 0:7fb6877b5d7c 77 #ifdef __SYMBIAN32__
miruga27 0:7fb6877b5d7c 78 #undef DECLSPEC
miruga27 0:7fb6877b5d7c 79 #define DECLSPEC
miruga27 0:7fb6877b5d7c 80 #endif /* __SYMBIAN32__ */
miruga27 0:7fb6877b5d7c 81
miruga27 0:7fb6877b5d7c 82 /* Force structure packing at 4 byte alignment.
miruga27 0:7fb6877b5d7c 83 This is necessary if the header is included in code which has structure
miruga27 0:7fb6877b5d7c 84 packing set to an alternate value, say for loading structures from disk.
miruga27 0:7fb6877b5d7c 85 The packing is reset to the previous value in close_code.h
miruga27 0:7fb6877b5d7c 86 */
miruga27 0:7fb6877b5d7c 87 #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
miruga27 0:7fb6877b5d7c 88 #ifdef _MSC_VER
miruga27 0:7fb6877b5d7c 89 #pragma warning(disable: 4103)
miruga27 0:7fb6877b5d7c 90 #endif
miruga27 0:7fb6877b5d7c 91 #ifdef __BORLANDC__
miruga27 0:7fb6877b5d7c 92 #pragma nopackwarning
miruga27 0:7fb6877b5d7c 93 #endif
miruga27 0:7fb6877b5d7c 94 #ifdef _M_X64
miruga27 0:7fb6877b5d7c 95 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
miruga27 0:7fb6877b5d7c 96 #pragma pack(push,8)
miruga27 0:7fb6877b5d7c 97 #else
miruga27 0:7fb6877b5d7c 98 #pragma pack(push,4)
miruga27 0:7fb6877b5d7c 99 #endif
miruga27 0:7fb6877b5d7c 100 #endif /* Compiler needs structure packing set */
miruga27 0:7fb6877b5d7c 101
miruga27 0:7fb6877b5d7c 102 #ifndef SDL_INLINE
miruga27 0:7fb6877b5d7c 103 #if defined(__GNUC__)
miruga27 0:7fb6877b5d7c 104 #define SDL_INLINE __inline__
miruga27 0:7fb6877b5d7c 105 #elif defined(_MSC_VER) || defined(__BORLANDC__) || \
miruga27 0:7fb6877b5d7c 106 defined(__DMC__) || defined(__SC__) || \
miruga27 0:7fb6877b5d7c 107 defined(__WATCOMC__) || defined(__LCC__) || \
miruga27 0:7fb6877b5d7c 108 defined(__DECC)
miruga27 0:7fb6877b5d7c 109 #define SDL_INLINE __inline
miruga27 0:7fb6877b5d7c 110 #ifndef __inline__
miruga27 0:7fb6877b5d7c 111 #define __inline__ __inline
miruga27 0:7fb6877b5d7c 112 #endif
miruga27 0:7fb6877b5d7c 113 #else
miruga27 0:7fb6877b5d7c 114 #define SDL_INLINE inline
miruga27 0:7fb6877b5d7c 115 #ifndef __inline__
miruga27 0:7fb6877b5d7c 116 #define __inline__ inline
miruga27 0:7fb6877b5d7c 117 #endif
miruga27 0:7fb6877b5d7c 118 #endif
miruga27 0:7fb6877b5d7c 119 #endif /* SDL_INLINE not defined */
miruga27 0:7fb6877b5d7c 120
miruga27 0:7fb6877b5d7c 121 #ifndef SDL_FORCE_INLINE
miruga27 0:7fb6877b5d7c 122 #if defined(_MSC_VER)
miruga27 0:7fb6877b5d7c 123 #define SDL_FORCE_INLINE __forceinline
miruga27 0:7fb6877b5d7c 124 #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
miruga27 0:7fb6877b5d7c 125 #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
miruga27 0:7fb6877b5d7c 126 #else
miruga27 0:7fb6877b5d7c 127 #define SDL_FORCE_INLINE static SDL_INLINE
miruga27 0:7fb6877b5d7c 128 #endif
miruga27 0:7fb6877b5d7c 129 #endif /* SDL_FORCE_INLINE not defined */
miruga27 0:7fb6877b5d7c 130
miruga27 0:7fb6877b5d7c 131 /* Apparently this is needed by several Windows compilers */
miruga27 0:7fb6877b5d7c 132 #if !defined(__MACH__)
miruga27 0:7fb6877b5d7c 133 #ifndef NULL
miruga27 0:7fb6877b5d7c 134 #ifdef __cplusplus
miruga27 0:7fb6877b5d7c 135 #define NULL 0
miruga27 0:7fb6877b5d7c 136 #else
miruga27 0:7fb6877b5d7c 137 #define NULL ((void *)0)
miruga27 0:7fb6877b5d7c 138 #endif
miruga27 0:7fb6877b5d7c 139 #endif /* NULL */
miruga27 0:7fb6877b5d7c 140 #endif /* ! Mac OS X - breaks precompiled headers */