Subversion Repositories Kolibri OS

Rev

Go to most recent revision | 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.  
  31. #include <sys/types.h>
  32. #include <stdio.h>
  33. #include <stdlib.h>
  34. #include <stddef.h>
  35. #include <stdarg.h>
  36. #include <strings.h>
  37. #include <inttypes.h>
  38. #include <stdint.h>
  39. #include <ctype.h>
  40.  
  41. /** The number of elements in an array */
  42. #define SDL_arraysize(array)    (sizeof(array)/sizeof(array[0]))
  43.  
  44. /* Use proper C++ casts when compiled as C++ to be compatible with the option
  45.  -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above. */
  46. #ifdef __cplusplus
  47. #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
  48. #define SDL_static_cast(type, expression) static_cast<type>(expression)
  49. #else
  50. #define SDL_reinterpret_cast(type, expression) ((type)(expression))
  51. #define SDL_static_cast(type, expression) ((type)(expression))
  52. #endif
  53.  
  54. typedef enum {
  55.         DUMMY_ENUM_VALUE
  56. } SDL_DUMMY_ENUM;
  57.  
  58. #include "begin_code.h"
  59. /* Set up for C function definitions, even when using C++ */
  60. #ifdef __cplusplus
  61. extern "C" {
  62. #endif
  63.  
  64. #define SDL_malloc  malloc
  65. #define SDL_calloc      calloc
  66. #define SDL_realloc     realloc
  67. #define SDL_free        free
  68. #define SDL_stack_alloc(type, count)    (type*)SDL_malloc(sizeof(type)*(count))
  69. #define SDL_stack_free(data)    SDL_free(data)
  70. #define SDL_qsort       qsort
  71. #define SDL_abs         abs
  72. #define SDL_min(x, y)   (((x) < (y)) ? (x) : (y))
  73. #define SDL_max(x, y)   (((x) > (y)) ? (x) : (y))
  74. #define SDL_isdigit(X)  isdigit(X)
  75. #define SDL_isspace(X)  isspace(X)
  76. #define SDL_toupper(X)  toupper(X)
  77. #define SDL_tolower(X)  tolower(X)
  78. #define SDL_memset      memset
  79. #define SDL_memmove     memmove
  80. #define SDL_memcmp      memcmp
  81. #define SDL_strlen      strlen
  82. #define SDL_strlcpy     strlcpy
  83. #define SDL_strlcat    strlcat
  84. #define SDL_strdup     strdup
  85. #define SDL_strrev      _strrev
  86. #define SDL_strupr      _strupr
  87. #define SDL_strlwr      _strlwr
  88. #define SDL_strchr      strchr
  89. #define SDL_strrchr     strrchr
  90. #define SDL_strstr      strstr
  91. #define SDL_itoa        itoa
  92. #define SDL_ltoa        _ltoa
  93. #define SDL_uitoa       _uitoa
  94. #define SDL_ultoa       _ultoa
  95. #define SDL_strtol      strtol
  96. #define SDL_strtoul      strtoul
  97. #define SDL_strtod      strtod
  98. #define SDL_atoi        atoi
  99. #define SDL_atof        atof
  100. #define SDL_strcmp      strcmp
  101. #define SDL_strncmp     strncmp
  102. #define SDL_sscanf      sscanf
  103. #define SDL_snprintf    snprintf
  104. #define SDL_vsnprintf   vsnprintf
  105.  
  106. /* Ends C function definitions when using C++ */
  107. #ifdef __cplusplus
  108. }
  109. #endif
  110. #include "close_code.h"
  111.  
  112. #endif /* _SDL_stdinc_h */
  113.