Subversion Repositories Kolibri OS

Rev

Rev 9561 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.     SDL - Simple DirectMedia Layer
  3.     Copyright (C) 1997-2012 Sam Lantinga
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Lesser General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2.1 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Lesser General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Lesser General Public
  16.     License along with this library; if not, write to the Free Software
  17.     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  18.  
  19.     Sam Lantinga
  20.     slouken@libsdl.org
  21. */
  22.  
  23. /** @file SDL_stdinc.h
  24.  *  This is a general header that includes C language support
  25.  */
  26.  
  27. #ifndef _SDL_stdinc_h
  28. #define _SDL_stdinc_h
  29.  
  30. #include <stdio.h>
  31. #include <stdlib.h>
  32. #include <stddef.h>
  33. #include <stdarg.h>
  34. #include <stdint.h>
  35. #include <ctype.h>
  36.  
  37. /** The number of elements in an array */
  38. #define SDL_arraysize(array)    (sizeof(array)/sizeof(array[0]))
  39.  
  40. /* Use proper C++ casts when compiled as C++ to be compatible with the option
  41.  -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above. */
  42. #ifdef __cplusplus
  43. #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
  44. #define SDL_static_cast(type, expression) static_cast<type>(expression)
  45. #else
  46. #define SDL_reinterpret_cast(type, expression) ((type)(expression))
  47. #define SDL_static_cast(type, expression) ((type)(expression))
  48. #endif
  49.  
  50. typedef enum {
  51.         DUMMY_ENUM_VALUE
  52. } SDL_DUMMY_ENUM;
  53.  
  54. #include "begin_code.h"
  55. /* Set up for C function definitions, even when using C++ */
  56. #ifdef __cplusplus
  57. extern "C" {
  58. #endif
  59.  
  60. #define SDL_malloc  malloc
  61. #define SDL_calloc      calloc
  62. #define SDL_realloc     realloc
  63. #define SDL_free        free
  64. #define SDL_stack_alloc(type, count)    (type*)SDL_malloc(sizeof(type)*(count))
  65. #define SDL_stack_free(data)    SDL_free(data)
  66. #define SDL_qsort       qsort
  67. #define SDL_abs         abs
  68. #define SDL_min(x, y)   (((x) < (y)) ? (x) : (y))
  69. #define SDL_max(x, y)   (((x) > (y)) ? (x) : (y))
  70. #define SDL_isdigit(X)  isdigit(X)
  71. #define SDL_isspace(X)  isspace(X)
  72. #define SDL_toupper(X)  toupper(X)
  73. #define SDL_tolower(X)  tolower(X)
  74. #define SDL_memset      memset
  75. #define SDL_memmove     memmove
  76. #define SDL_memcmp      memcmp
  77. #define SDL_strlen      strlen
  78. #define SDL_strlcpy     strlcpy
  79. #define SDL_strlcat    strlcat
  80. #define SDL_strdup     strdup
  81. #define SDL_strrev      _strrev
  82. #define SDL_strupr      _strupr
  83. #define SDL_strlwr      _strlwr
  84. #define SDL_strchr      strchr
  85. #define SDL_strrchr     strrchr
  86. #define SDL_strstr      strstr
  87. #define SDL_itoa        itoa
  88. #define SDL_ltoa        _ltoa
  89. #define SDL_uitoa       _uitoa
  90. #define SDL_ultoa       _ultoa
  91. #define SDL_strtol      strtol
  92. #define SDL_strtoul      strtoul
  93. #define SDL_strtod      strtod
  94. #define SDL_atoi        atoi
  95. #define SDL_atof        atof
  96. #define SDL_strcmp      strcmp
  97. #define SDL_strncmp     strncmp
  98. #define SDL_sscanf      sscanf
  99. #define SDL_snprintf    snprintf
  100. #define SDL_vsnprintf   vsnprintf
  101.  
  102. /* Ends C function definitions when using C++ */
  103. #ifdef __cplusplus
  104. }
  105. #endif
  106. #include "close_code.h"
  107.  
  108. #endif /* _SDL_stdinc_h */
  109.