SDL_internal.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #ifndef SDL_internal_h_
  19. #define SDL_internal_h_
  20. /* Many of SDL's features require _GNU_SOURCE on various platforms */
  21. #ifndef _GNU_SOURCE
  22. #define _GNU_SOURCE
  23. #endif
  24. /* This is for a variable-length array at the end of a struct:
  25. struct x { int y; char z[SDL_VARIABLE_LENGTH_ARRAY]; };
  26. Use this because GCC 2 needs different magic than other compilers. */
  27. #if (defined(__GNUC__) && (__GNUC__ <= 2)) || defined(__CC_ARM) || defined(__cplusplus)
  28. #define SDL_VARIABLE_LENGTH_ARRAY 1
  29. #else
  30. #define SDL_VARIABLE_LENGTH_ARRAY
  31. #endif
  32. #define SDL_MAX_SMALL_ALLOC_STACKSIZE 128
  33. #define SDL_small_alloc(type, count, pisstack) ( (*(pisstack) = ((sizeof(type)*(count)) < SDL_MAX_SMALL_ALLOC_STACKSIZE)), (*(pisstack) ? SDL_stack_alloc(type, count) : (type*)SDL_malloc(sizeof(type)*(count))) )
  34. #define SDL_small_free(ptr, isstack) if ((isstack)) { SDL_stack_free(ptr); } else { SDL_free(ptr); }
  35. #include "dynapi/SDL_dynapi.h"
  36. #if SDL_DYNAMIC_API
  37. #include "dynapi/SDL_dynapi_overrides.h"
  38. /* force DECLSPEC off...it's all internal symbols now.
  39. These will have actual #defines during SDL_dynapi.c only */
  40. #define DECLSPEC
  41. #endif
  42. #include "build_config/SDL_build_config.h"
  43. #ifdef __APPLE__
  44. #ifndef _DARWIN_C_SOURCE
  45. #define _DARWIN_C_SOURCE 1 /* for memset_pattern4() */
  46. #endif
  47. #endif
  48. #ifdef HAVE_SYS_TYPES_H
  49. #include <sys/types.h>
  50. #endif
  51. #ifdef HAVE_STDIO_H
  52. #include <stdio.h>
  53. #endif
  54. #if defined(HAVE_STDLIB_H)
  55. # include <stdlib.h>
  56. #elif defined(HAVE_MALLOC_H)
  57. # include <malloc.h>
  58. #endif
  59. #if defined(HAVE_STDDEF_H)
  60. # include <stddef.h>
  61. #endif
  62. #if defined(HAVE_STDARG_H)
  63. # include <stdarg.h>
  64. #endif
  65. #ifdef HAVE_STRING_H
  66. # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
  67. # include <memory.h>
  68. # endif
  69. # include <string.h>
  70. #endif
  71. #ifdef HAVE_STRINGS_H
  72. # include <strings.h>
  73. #endif
  74. #ifdef HAVE_WCHAR_H
  75. # include <wchar.h>
  76. #endif
  77. #if defined(HAVE_INTTYPES_H)
  78. # include <inttypes.h>
  79. #elif defined(HAVE_STDINT_H)
  80. # include <stdint.h>
  81. #endif
  82. #ifdef HAVE_CTYPE_H
  83. # include <ctype.h>
  84. #endif
  85. #ifdef HAVE_MATH_H
  86. # include <math.h>
  87. #endif
  88. #ifdef HAVE_FLOAT_H
  89. # include <float.h>
  90. #endif
  91. #include "SDL_stdinc.h"
  92. /* If you run into a warning that O_CLOEXEC is redefined, update the SDL configuration header for your platform to add HAVE_O_CLOEXEC */
  93. #ifndef HAVE_O_CLOEXEC
  94. #define O_CLOEXEC 0
  95. #endif
  96. /* A few #defines to reduce SDL footprint.
  97. Only effective when library is statically linked.
  98. You have to manually edit this file. */
  99. #ifndef SDL_LEAN_AND_MEAN
  100. #define SDL_LEAN_AND_MEAN 0
  101. #endif
  102. /* Optimized functions from 'SDL_blit_0.c'
  103. - blit with source BitsPerPixel < 8, palette */
  104. #ifndef SDL_HAVE_BLIT_0
  105. #define SDL_HAVE_BLIT_0 !SDL_LEAN_AND_MEAN
  106. #endif
  107. /* Optimized functions from 'SDL_blit_1.c'
  108. - blit with source BytesPerPixel == 1, palette */
  109. #ifndef SDL_HAVE_BLIT_1
  110. #define SDL_HAVE_BLIT_1 !SDL_LEAN_AND_MEAN
  111. #endif
  112. /* Optimized functions from 'SDL_blit_A.c'
  113. - blit with 'SDL_BLENDMODE_BLEND' blending mode */
  114. #ifndef SDL_HAVE_BLIT_A
  115. #define SDL_HAVE_BLIT_A !SDL_LEAN_AND_MEAN
  116. #endif
  117. /* Optimized functions from 'SDL_blit_N.c'
  118. - blit with COLORKEY mode, or nothing */
  119. #ifndef SDL_HAVE_BLIT_N
  120. #define SDL_HAVE_BLIT_N !SDL_LEAN_AND_MEAN
  121. #endif
  122. /* Optimized functions from 'SDL_blit_N.c'
  123. - RGB565 conversion with Lookup tables */
  124. #ifndef SDL_HAVE_BLIT_N_RGB565
  125. #define SDL_HAVE_BLIT_N_RGB565 !SDL_LEAN_AND_MEAN
  126. #endif
  127. /* Optimized functions from 'SDL_blit_AUTO.c'
  128. - blit with modulate color, modulate alpha, any blending mode
  129. - scaling or not */
  130. #ifndef SDL_HAVE_BLIT_AUTO
  131. #define SDL_HAVE_BLIT_AUTO !SDL_LEAN_AND_MEAN
  132. #endif
  133. /* Run-Length-Encoding
  134. - SDL_SetColorKey() called with SDL_RLEACCEL flag */
  135. #ifndef SDL_HAVE_RLE
  136. #define SDL_HAVE_RLE !SDL_LEAN_AND_MEAN
  137. #endif
  138. /* Software SDL_Renderer
  139. - creation of software renderer
  140. - *not* general blitting functions
  141. - {blend,draw}{fillrect,line,point} internal functions */
  142. #ifndef SDL_VIDEO_RENDER_SW
  143. #define SDL_VIDEO_RENDER_SW !SDL_LEAN_AND_MEAN
  144. #endif
  145. /* YUV formats
  146. - handling of YUV surfaces
  147. - blitting and conversion functions */
  148. #ifndef SDL_HAVE_YUV
  149. #define SDL_HAVE_YUV !SDL_LEAN_AND_MEAN
  150. #endif
  151. #include "SDL_assert.h"
  152. #include "SDL_log.h"
  153. #endif /* SDL_internal_h_ */
  154. /* vi: set ts=4 sw=4 expandtab: */