include/SDL_stdinc.h
author Edward Rudd <urkle@outoforder.cc>
Wed, 03 Dec 2014 12:47:39 -0500
changeset 9262 b3df9db209b0
parent 9261 ac20d283fe41
child 9306 817656bd36ec
permissions -rw-r--r--
ugh.. stray character
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
     2
  Simple DirectMedia Layer
8149
681eb46b8ac4 Fixed bug 2374 - Update copyright for 2014...
Sam Lantinga <slouken@libsdl.org>
parents: 8089
diff changeset
     3
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
     7
  arising from the use of this software.
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
    11
  freely, subject to the following restrictions:
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5512
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    20
*/
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    21
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    22
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    23
 *  \file SDL_stdinc.h
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
    24
 *
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    25
 *  This is a general header that includes C language support.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    26
 */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    27
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    28
#ifndef _SDL_stdinc_h
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    29
#define _SDL_stdinc_h
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    30
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    31
#include "SDL_config.h"
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    32
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    33
#ifdef HAVE_SYS_TYPES_H
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    34
#include <sys/types.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    35
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    36
#ifdef HAVE_STDIO_H
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    37
#include <stdio.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    38
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    39
#if defined(STDC_HEADERS)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    40
# include <stdlib.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    41
# include <stddef.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    42
# include <stdarg.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    43
#else
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    44
# if defined(HAVE_STDLIB_H)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    45
#  include <stdlib.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    46
# elif defined(HAVE_MALLOC_H)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    47
#  include <malloc.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    48
# endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    49
# if defined(HAVE_STDDEF_H)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    50
#  include <stddef.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    51
# endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    52
# if defined(HAVE_STDARG_H)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    53
#  include <stdarg.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    54
# endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    55
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    56
#ifdef HAVE_STRING_H
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    57
# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    58
#  include <memory.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    59
# endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    60
# include <string.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    61
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    62
#ifdef HAVE_STRINGS_H
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    63
# include <strings.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    64
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    65
#if defined(HAVE_INTTYPES_H)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    66
# include <inttypes.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    67
#elif defined(HAVE_STDINT_H)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    68
# include <stdint.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    69
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    70
#ifdef HAVE_CTYPE_H
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    71
# include <ctype.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    72
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    73
#ifdef HAVE_MATH_H
8316
88f011703f39 Got a bare-bones version of SDL compiling for Windows RT. Dummy drivers are used in some places. Very little Windows-specific code (from the Win32 version of SDL) is used.
David Ludwig <dludwig@pobox.com>
parents: 6138
diff changeset
    74
# if defined(__WINRT__)
88f011703f39 Got a bare-bones version of SDL compiling for Windows RT. Dummy drivers are used in some places. Very little Windows-specific code (from the Win32 version of SDL) is used.
David Ludwig <dludwig@pobox.com>
parents: 6138
diff changeset
    75
/* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
8500
f25ef28d61e8 WinRT: more "Windows RT" to "WinRT" renaming
David Ludwig <dludwig@pobox.com>
parents: 8478
diff changeset
    76
   WinRT.  See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
8316
88f011703f39 Got a bare-bones version of SDL compiling for Windows RT. Dummy drivers are used in some places. Very little Windows-specific code (from the Win32 version of SDL) is used.
David Ludwig <dludwig@pobox.com>
parents: 6138
diff changeset
    77
   for more information.
88f011703f39 Got a bare-bones version of SDL compiling for Windows RT. Dummy drivers are used in some places. Very little Windows-specific code (from the Win32 version of SDL) is used.
David Ludwig <dludwig@pobox.com>
parents: 6138
diff changeset
    78
*/
88f011703f39 Got a bare-bones version of SDL compiling for Windows RT. Dummy drivers are used in some places. Very little Windows-specific code (from the Win32 version of SDL) is used.
David Ludwig <dludwig@pobox.com>
parents: 6138
diff changeset
    79
#  define _USE_MATH_DEFINES
88f011703f39 Got a bare-bones version of SDL compiling for Windows RT. Dummy drivers are used in some places. Very little Windows-specific code (from the Win32 version of SDL) is used.
David Ludwig <dludwig@pobox.com>
parents: 6138
diff changeset
    80
# endif
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    81
# include <math.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    82
#endif
8478
337b5dc0797b WinRT: build fixes and additional WinRT-related integrations with SDL 2.0.0
David Ludwig <dludwig@pobox.com>
parents: 8477
diff changeset
    83
#ifdef HAVE_FLOAT_H
337b5dc0797b WinRT: build fixes and additional WinRT-related integrations with SDL 2.0.0
David Ludwig <dludwig@pobox.com>
parents: 8477
diff changeset
    84
# include <float.h>
337b5dc0797b WinRT: build fixes and additional WinRT-related integrations with SDL 2.0.0
David Ludwig <dludwig@pobox.com>
parents: 8477
diff changeset
    85
#endif
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    86
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    87
# include <iconv.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    88
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    89
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    90
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    91
 *  The number of elements in an array.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    92
 */
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
    93
#define SDL_arraysize(array)    (sizeof(array)/sizeof(array[0]))
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
    94
#define SDL_TABLESIZE(table)    SDL_arraysize(table)
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    95
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    96
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    97
 *  \name Cast operators
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
    98
 *
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
    99
 *  Use proper C++ casts when compiled as C++ to be compatible with the option
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   100
 *  -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   101
 */
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7677
diff changeset
   102
/* @{ */
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   103
#ifdef __cplusplus
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   104
#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   105
#define SDL_static_cast(type, expression) static_cast<type>(expression)
7076
1666f7a7494e Cleaned up the const_cast mess a little.
Ryan C. Gordon <icculus@icculus.org>
parents: 7059
diff changeset
   106
#define SDL_const_cast(type, expression) const_cast<type>(expression)
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   107
#else
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   108
#define SDL_reinterpret_cast(type, expression) ((type)(expression))
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   109
#define SDL_static_cast(type, expression) ((type)(expression))
7076
1666f7a7494e Cleaned up the const_cast mess a little.
Ryan C. Gordon <icculus@icculus.org>
parents: 7059
diff changeset
   110
#define SDL_const_cast(type, expression) ((type)(expression))
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   111
#endif
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7677
diff changeset
   112
/* @} *//* Cast operators */
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   113
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   114
/* Define a four character code as a Uint32 */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   115
#define SDL_FOURCC(A, B, C, D) \
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   116
    ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   117
     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   118
     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   119
     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   120
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   121
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   122
 *  \name Basic data types
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   123
 */
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7677
diff changeset
   124
/* @{ */
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   125
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   126
typedef enum
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   127
{
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   128
    SDL_FALSE = 0,
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   129
    SDL_TRUE = 1
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   130
} SDL_bool;
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   131
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   132
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   133
 * \brief A signed 8-bit integer type.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   134
 */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   135
typedef int8_t Sint8;
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   136
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   137
 * \brief An unsigned 8-bit integer type.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   138
 */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   139
typedef uint8_t Uint8;
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   140
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   141
 * \brief A signed 16-bit integer type.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   142
 */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   143
typedef int16_t Sint16;
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   144
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   145
 * \brief An unsigned 16-bit integer type.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   146
 */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   147
typedef uint16_t Uint16;
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   148
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   149
 * \brief A signed 32-bit integer type.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   150
 */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   151
typedef int32_t Sint32;
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   152
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   153
 * \brief An unsigned 32-bit integer type.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   154
 */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   155
typedef uint32_t Uint32;
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   156
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   157
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   158
 * \brief A signed 64-bit integer type.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   159
 */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   160
typedef int64_t Sint64;
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   161
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   162
 * \brief An unsigned 64-bit integer type.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   163
 */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   164
typedef uint64_t Uint64;
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   165
7678
286c42d7c5ed OCD fixes: Adds a space after /* (glory to regular expressions!)
Gabriel Jacobo <gabomdq@gmail.com>
parents: 7677
diff changeset
   166
/* @} *//* Basic data types */
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   167
8883
0700ef83072a commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5
Sam Lantinga <slouken@libsdl.org>
parents: 8844
diff changeset
   168
/* Make sure we have macros for printing 64 bit values.
0700ef83072a commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5
Sam Lantinga <slouken@libsdl.org>
parents: 8844
diff changeset
   169
 * <stdint.h> should define these but this is not true all platforms.
0700ef83072a commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5
Sam Lantinga <slouken@libsdl.org>
parents: 8844
diff changeset
   170
 * (for example win32) */
8917
23182cf59f1c Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga <slouken@libsdl.org>
parents: 8883
diff changeset
   171
#ifndef SDL_PRIs64
23182cf59f1c Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga <slouken@libsdl.org>
parents: 8883
diff changeset
   172
#ifdef PRIs64
23182cf59f1c Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga <slouken@libsdl.org>
parents: 8883
diff changeset
   173
#define SDL_PRIs64 PRIs64
23182cf59f1c Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga <slouken@libsdl.org>
parents: 8883
diff changeset
   174
#elif defined(__WIN32__)
9261
ac20d283fe41 fix SDL_PRIs64 on windows compilers.. (should end in d)
Edward Rudd <urkle@outoforder.cc>
parents: 9260
diff changeset
   175
#define SDL_PRIs64 "I64d"
8883
0700ef83072a commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5
Sam Lantinga <slouken@libsdl.org>
parents: 8844
diff changeset
   176
#else
8917
23182cf59f1c Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga <slouken@libsdl.org>
parents: 8883
diff changeset
   177
#define SDL_PRIs64 "lld"
8883
0700ef83072a commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5
Sam Lantinga <slouken@libsdl.org>
parents: 8844
diff changeset
   178
#endif
0700ef83072a commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5
Sam Lantinga <slouken@libsdl.org>
parents: 8844
diff changeset
   179
#endif
8917
23182cf59f1c Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga <slouken@libsdl.org>
parents: 8883
diff changeset
   180
#ifndef SDL_PRIu64
23182cf59f1c Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga <slouken@libsdl.org>
parents: 8883
diff changeset
   181
#ifdef PRIu64
23182cf59f1c Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga <slouken@libsdl.org>
parents: 8883
diff changeset
   182
#define SDL_PRIu64 PRIu64
23182cf59f1c Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga <slouken@libsdl.org>
parents: 8883
diff changeset
   183
#elif defined(__WIN32__)
23182cf59f1c Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga <slouken@libsdl.org>
parents: 8883
diff changeset
   184
#define SDL_PRIu64 "I64u"
8883
0700ef83072a commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5
Sam Lantinga <slouken@libsdl.org>
parents: 8844
diff changeset
   185
#else
8917
23182cf59f1c Don't redefine standard macros, use SDL specific macros instead to avoid compiler warnings
Sam Lantinga <slouken@libsdl.org>
parents: 8883
diff changeset
   186
#define SDL_PRIu64 "llu"
8883
0700ef83072a commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5
Sam Lantinga <slouken@libsdl.org>
parents: 8844
diff changeset
   187
#endif
0700ef83072a commit 9e211e646f9d51dc1372c9f3c8f47a78caf4f2a5
Sam Lantinga <slouken@libsdl.org>
parents: 8844
diff changeset
   188
#endif
9260
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   189
#ifndef SDL_PRIx64
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   190
#ifdef PRIx64
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   191
#define SDL_PRIx64 PRIx64
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   192
#elif defined(__WIN32__)
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   193
#define SDL_PRIx64 "I64x"
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   194
#else
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   195
#define SDL_PRIx64 "llx"
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   196
#endif
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   197
#endif
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   198
#ifndef SDL_PRIX64
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   199
#ifdef PRIX64
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   200
#define SDL_PRIX64 PRIX64
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   201
#elif defined(__WIN32__)
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   202
#define SDL_PRIX64 "I64X"
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   203
#else
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   204
#define SDL_PRIX64 "llX"
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   205
#endif
039714172dc3 switch to use SDL_PRI* macros for long long formatting everywhere.
Edward Rudd <urkle@outoforder.cc>
parents: 9080
diff changeset
   206
#endif
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   207
8820
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   208
/* Annotations to help code analysis tools */
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   209
#ifdef SDL_DISABLE_ANALYZE_MACROS
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   210
#define SDL_IN_BYTECAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   211
#define SDL_INOUT_Z_CAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   212
#define SDL_OUT_Z_CAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   213
#define SDL_OUT_CAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   214
#define SDL_OUT_BYTECAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   215
#define SDL_OUT_Z_BYTECAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   216
#define SDL_PRINTF_FORMAT_STRING
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   217
#define SDL_SCANF_FORMAT_STRING
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   218
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   219
#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   220
#else
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   221
#if _MSC_VER >= 1600 /* VS 2010 and above */
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   222
#include <sal.h>
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   223
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   224
#define SDL_IN_BYTECAP(x) _In_bytecount_(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   225
#define SDL_INOUT_Z_CAP(x) _Inout_z_cap_(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   226
#define SDL_OUT_Z_CAP(x) _Out_z_cap_(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   227
#define SDL_OUT_CAP(x) _Out_cap_(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   228
#define SDL_OUT_BYTECAP(x) _Out_bytecap_(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   229
#define SDL_OUT_Z_BYTECAP(x) _Out_z_bytecap_(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   230
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   231
#define SDL_PRINTF_FORMAT_STRING _Printf_format_string_
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   232
#define SDL_SCANF_FORMAT_STRING _Scanf_format_string_impl_
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   233
#else
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   234
#define SDL_IN_BYTECAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   235
#define SDL_INOUT_Z_CAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   236
#define SDL_OUT_Z_CAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   237
#define SDL_OUT_CAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   238
#define SDL_OUT_BYTECAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   239
#define SDL_OUT_Z_BYTECAP(x)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   240
#define SDL_PRINTF_FORMAT_STRING
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   241
#define SDL_SCANF_FORMAT_STRING
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   242
#endif
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   243
#if defined(__GNUC__)
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   244
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 )))
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   245
#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 )))
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   246
#else
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   247
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   248
#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   249
#endif
8844
d35c1b1798c8 Fixed typo in source comment.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 8840
diff changeset
   250
#endif /* SDL_DISABLE_ANALYZE_MACROS */
8820
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   251
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   252
#define SDL_COMPILE_TIME_ASSERT(name, x)               \
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   253
       typedef int SDL_dummy_ ## name[(x) * 2 - 1]
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   254
/** \cond */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   255
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   256
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   257
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   258
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   259
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   260
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   261
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   262
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   263
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   264
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   265
/** \endcond */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   266
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   267
/* Check to make sure enums are the size of ints, for structure packing.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   268
   For both Watcom C/C++ and Borland C/C++ the compiler option that makes
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   269
   enums having the size of an int must be enabled.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   270
   This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   271
*/
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   272
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   273
/** \cond */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   274
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
   275
#if !defined(__ANDROID__)
4697
a5c4ded0c979 Fix compile errors under Android toolchain. Seems to have the same issue as the NDS.
Paul Hunkin <paul@bieh.net>
parents: 3697
diff changeset
   276
   /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   277
typedef enum
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   278
{
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   279
    DUMMY_ENUM_VALUE
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   280
} SDL_DUMMY_ENUM;
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   281
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   282
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   283
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   284
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   285
/** \endcond */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   286
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   287
#include "begin_code.h"
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   288
/* Set up for C function definitions, even when using C++ */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   289
#ifdef __cplusplus
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   290
extern "C" {
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   291
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   292
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   293
#if defined(HAVE_ALLOCA) && !defined(alloca)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   294
# if defined(HAVE_ALLOCA_H)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   295
#  include <alloca.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   296
# elif defined(__GNUC__)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   297
#  define alloca __builtin_alloca
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   298
# elif defined(_MSC_VER)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   299
#  include <malloc.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   300
#  define alloca _alloca
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   301
# elif defined(__WATCOMC__)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   302
#  include <malloc.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   303
# elif defined(__BORLANDC__)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   304
#  include <malloc.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   305
# elif defined(__DMC__)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   306
#  include <stdlib.h>
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   307
# elif defined(__AIX__)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   308
#pragma alloca
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   309
# elif defined(__MRC__)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   310
void *alloca(unsigned);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   311
# else
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   312
char *alloca();
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   313
# endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   314
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   315
#ifdef HAVE_ALLOCA
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   316
#define SDL_stack_alloc(type, count)    (type*)alloca(sizeof(type)*(count))
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   317
#define SDL_stack_free(data)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   318
#else
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   319
#define SDL_stack_alloc(type, count)    (type*)SDL_malloc(sizeof(type)*(count))
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   320
#define SDL_stack_free(data)            SDL_free(data)
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   321
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   322
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   323
extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   324
extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   325
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   326
extern DECLSPEC void SDLCALL SDL_free(void *mem);
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   327
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   328
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   329
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   330
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   331
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   332
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   333
extern DECLSPEC int SDLCALL SDL_abs(int x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   334
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   335
/* !!! FIXME: these have side effects. You probably shouldn't use them. */
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   336
/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   337
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   338
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   339
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   340
extern DECLSPEC int SDLCALL SDL_isdigit(int x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   341
extern DECLSPEC int SDLCALL SDL_isspace(int x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   342
extern DECLSPEC int SDLCALL SDL_toupper(int x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   343
extern DECLSPEC int SDLCALL SDL_tolower(int x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   344
8820
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   345
extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   346
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   347
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   348
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   349
7386
ff3af8304053 Made the SDL_memset4() comment even clearer so we don't accidentally replace it with memset() in the future.
Sam Lantinga <slouken@libsdl.org>
parents: 7385
diff changeset
   350
/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
7901
ae8600f0916a Clarified that SDL_memset4 is a 32-bit assignment and fixed a compiler warning
Sam Lantinga <slouken@libsdl.org>
parents: 7678
diff changeset
   351
SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   352
{
7385
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   353
#if defined(__GNUC__) && defined(i386)
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   354
    int u0, u1, u2;
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   355
    __asm__ __volatile__ (
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   356
        "cld \n\t"
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   357
        "rep ; stosl \n\t"
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   358
        : "=&D" (u0), "=&a" (u1), "=&c" (u2)
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   359
        : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   360
        : "memory"
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   361
    );
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   362
#else
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   363
    size_t _n = (dwords + 3) / 4;
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   364
    Uint32 *_p = SDL_static_cast(Uint32 *, dst);
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   365
    Uint32 _val = (val);
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   366
    if (dwords == 0)
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   367
        return;
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   368
    switch (dwords % 4)
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   369
    {
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   370
        case 0: do {    *_p++ = _val;
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   371
        case 3:         *_p++ = _val;
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   372
        case 2:         *_p++ = _val;
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   373
        case 1:         *_p++ = _val;
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   374
        } while ( --_n );
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   375
    }
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   376
#endif
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   377
}
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   378
7385
6e90315f859a Backed out commit 898992405fa7 because memset() does a byte fill and SDL_memset4() does a uint32 fill and this change breaks SDL_FillRect()
Sam Lantinga <slouken@libsdl.org>
parents: 7382
diff changeset
   379
8820
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   380
extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   381
8820
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   382
SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_BYTECAP(dwords*4) const void *src, size_t dwords)
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   383
{
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   384
    return SDL_memcpy(dst, src, dwords * 4);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   385
}
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   386
8820
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   387
extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   388
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   389
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   390
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
8820
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   391
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   392
extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   393
7351
668a3dc28361 Removed the inline functions from SDL_stdinc.h
Sam Lantinga <slouken@libsdl.org>
parents: 7308
diff changeset
   394
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
8820
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   395
extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   396
extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes);
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   397
extern DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   398
extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   399
extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   400
extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   401
extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   402
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   403
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   404
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   405
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   406
extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
7351
668a3dc28361 Removed the inline functions from SDL_stdinc.h
Sam Lantinga <slouken@libsdl.org>
parents: 7308
diff changeset
   407
extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
668a3dc28361 Removed the inline functions from SDL_stdinc.h
Sam Lantinga <slouken@libsdl.org>
parents: 7308
diff changeset
   408
extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   409
extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   410
extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   411
extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix);
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   412
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   413
extern DECLSPEC int SDLCALL SDL_atoi(const char *str);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   414
extern DECLSPEC double SDLCALL SDL_atof(const char *str);
7351
668a3dc28361 Removed the inline functions from SDL_stdinc.h
Sam Lantinga <slouken@libsdl.org>
parents: 7308
diff changeset
   415
extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
668a3dc28361 Removed the inline functions from SDL_stdinc.h
Sam Lantinga <slouken@libsdl.org>
parents: 7308
diff changeset
   416
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
668a3dc28361 Removed the inline functions from SDL_stdinc.h
Sam Lantinga <slouken@libsdl.org>
parents: 7308
diff changeset
   417
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
668a3dc28361 Removed the inline functions from SDL_stdinc.h
Sam Lantinga <slouken@libsdl.org>
parents: 7308
diff changeset
   418
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
668a3dc28361 Removed the inline functions from SDL_stdinc.h
Sam Lantinga <slouken@libsdl.org>
parents: 7308
diff changeset
   419
extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   420
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   421
extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   422
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   423
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   424
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   425
8820
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   426
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2);
8089
de8b6fdf6544 Added SDL_vsscanf().
Ryan C. Gordon <icculus@icculus.org>
parents: 8004
diff changeset
   427
extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap);
8820
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   428
extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3);
0e935d5b193a Added annotations to help code analysis tools
Sam Lantinga <slouken@libsdl.org>
parents: 8583
diff changeset
   429
extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   430
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   431
#ifndef HAVE_M_PI
6627
23b7cef164ae We might actually have PI
Sam Lantinga <slouken@libsdl.org>
parents: 6610
diff changeset
   432
#ifndef M_PI
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   433
#define M_PI    3.14159265358979323846264338327950288   /* pi */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   434
#endif
6627
23b7cef164ae We might actually have PI
Sam Lantinga <slouken@libsdl.org>
parents: 6610
diff changeset
   435
#endif
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   436
8004
13da154af020 Fixed bug 2245 - add SDL_acos and SDL_asin
Sam Lantinga <slouken@libsdl.org>
parents: 7901
diff changeset
   437
extern DECLSPEC double SDLCALL SDL_acos(double x);
13da154af020 Fixed bug 2245 - add SDL_acos and SDL_asin
Sam Lantinga <slouken@libsdl.org>
parents: 7901
diff changeset
   438
extern DECLSPEC double SDLCALL SDL_asin(double x);
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   439
extern DECLSPEC double SDLCALL SDL_atan(double x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   440
extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   441
extern DECLSPEC double SDLCALL SDL_ceil(double x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   442
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   443
extern DECLSPEC double SDLCALL SDL_cos(double x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   444
extern DECLSPEC float SDLCALL SDL_cosf(float x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   445
extern DECLSPEC double SDLCALL SDL_fabs(double x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   446
extern DECLSPEC double SDLCALL SDL_floor(double x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   447
extern DECLSPEC double SDLCALL SDL_log(double x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   448
extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   449
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   450
extern DECLSPEC double SDLCALL SDL_sin(double x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   451
extern DECLSPEC float SDLCALL SDL_sinf(float x);
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   452
extern DECLSPEC double SDLCALL SDL_sqrt(double x);
8840
9b6ddcbdea65 Added SDL_sqrtf(), SDL_tan(), SDL_tanf()
Sam Lantinga <slouken@libsdl.org>
parents: 8820
diff changeset
   453
extern DECLSPEC float SDLCALL SDL_sqrtf(float x);
9b6ddcbdea65 Added SDL_sqrtf(), SDL_tan(), SDL_tanf()
Sam Lantinga <slouken@libsdl.org>
parents: 8820
diff changeset
   454
extern DECLSPEC double SDLCALL SDL_tan(double x);
9b6ddcbdea65 Added SDL_sqrtf(), SDL_tan(), SDL_tanf()
Sam Lantinga <slouken@libsdl.org>
parents: 8820
diff changeset
   455
extern DECLSPEC float SDLCALL SDL_tanf(float x);
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   456
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   457
/* The SDL implementation of iconv() returns these error codes */
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
   458
#define SDL_ICONV_ERROR     (size_t)-1
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
   459
#define SDL_ICONV_E2BIG     (size_t)-2
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
   460
#define SDL_ICONV_EILSEQ    (size_t)-3
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
   461
#define SDL_ICONV_EINVAL    (size_t)-4
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   462
7003
eeaf77005c30 Improvements to stdlib.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
   463
/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   464
typedef struct _SDL_iconv_t *SDL_iconv_t;
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   465
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   466
                                                   const char *fromcode);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   467
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   468
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   469
                                         size_t * inbytesleft, char **outbuf,
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   470
                                         size_t * outbytesleft);
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   471
/**
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   472
 *  This function converts a string between encodings in one pass, returning a
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   473
 *  string that must be freed with SDL_free() or NULL on error.
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   474
 */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   475
extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   476
                                               const char *fromcode,
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   477
                                               const char *inbuf,
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   478
                                               size_t inbytesleft);
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
   479
#define SDL_iconv_utf8_locale(S)    SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
   480
#define SDL_iconv_utf8_ucs2(S)      (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7076
diff changeset
   481
#define SDL_iconv_utf8_ucs4(S)      (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
4761
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   482
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   483
/* Ends C function definitions when using C++ */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   484
#ifdef __cplusplus
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   485
}
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   486
#endif
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   487
#include "close_code.h"
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   488
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   489
#endif /* _SDL_stdinc_h */
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   490
bb2e32f5a556 Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents: 4758
diff changeset
   491
/* vi: set ts=4 sw=4 expandtab: */