rubygl 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. checksums.yaml +8 -8
  2. data/Gemfile.lock +2 -0
  3. data/README.md +1 -1
  4. data/Rakefile +17 -9
  5. data/bin/ffi_code_gen.rb +11 -3
  6. data/ext/macosx/RubyGL.so +0 -0
  7. data/ext/macosx/SDL2.framework/Headers/SDL.h +163 -0
  8. data/ext/macosx/SDL2.framework/Headers/SDL_assert.h +284 -0
  9. data/ext/macosx/SDL2.framework/Headers/SDL_atomic.h +260 -0
  10. data/ext/macosx/SDL2.framework/Headers/SDL_audio.h +506 -0
  11. data/ext/macosx/SDL2.framework/Headers/SDL_bits.h +97 -0
  12. data/ext/macosx/SDL2.framework/Headers/SDL_blendmode.h +63 -0
  13. data/ext/macosx/SDL2.framework/Headers/SDL_clipboard.h +71 -0
  14. data/ext/macosx/SDL2.framework/Headers/SDL_config.h +55 -0
  15. data/ext/macosx/SDL2.framework/Headers/SDL_config_macosx.h +184 -0
  16. data/ext/macosx/SDL2.framework/Headers/SDL_copying.h +20 -0
  17. data/ext/macosx/SDL2.framework/Headers/SDL_cpuinfo.h +156 -0
  18. data/ext/macosx/SDL2.framework/Headers/SDL_endian.h +239 -0
  19. data/ext/macosx/SDL2.framework/Headers/SDL_error.h +76 -0
  20. data/ext/macosx/SDL2.framework/Headers/SDL_events.h +723 -0
  21. data/ext/macosx/SDL2.framework/Headers/SDL_filesystem.h +136 -0
  22. data/ext/macosx/SDL2.framework/Headers/SDL_gamecontroller.h +316 -0
  23. data/ext/macosx/SDL2.framework/Headers/SDL_gesture.h +87 -0
  24. data/ext/macosx/SDL2.framework/Headers/SDL_haptic.h +1225 -0
  25. data/ext/macosx/SDL2.framework/Headers/SDL_hints.h +517 -0
  26. data/ext/macosx/SDL2.framework/Headers/SDL_joystick.h +253 -0
  27. data/ext/macosx/SDL2.framework/Headers/SDL_keyboard.h +217 -0
  28. data/ext/macosx/SDL2.framework/Headers/SDL_keycode.h +341 -0
  29. data/ext/macosx/SDL2.framework/Headers/SDL_loadso.h +81 -0
  30. data/ext/macosx/SDL2.framework/Headers/SDL_log.h +211 -0
  31. data/ext/macosx/SDL2.framework/Headers/SDL_main.h +155 -0
  32. data/ext/macosx/SDL2.framework/Headers/SDL_messagebox.h +144 -0
  33. data/ext/macosx/SDL2.framework/Headers/SDL_mouse.h +224 -0
  34. data/ext/macosx/SDL2.framework/Headers/SDL_mutex.h +251 -0
  35. data/ext/macosx/SDL2.framework/Headers/SDL_name.h +33 -0
  36. data/ext/macosx/SDL2.framework/Headers/SDL_opengl.h +11126 -0
  37. data/ext/macosx/SDL2.framework/Headers/SDL_opengles.h +38 -0
  38. data/ext/macosx/SDL2.framework/Headers/SDL_opengles2.h +2790 -0
  39. data/ext/macosx/SDL2.framework/Headers/SDL_pixels.h +429 -0
  40. data/ext/macosx/SDL2.framework/Headers/SDL_platform.h +164 -0
  41. data/ext/macosx/SDL2.framework/Headers/SDL_power.h +75 -0
  42. data/ext/macosx/SDL2.framework/Headers/SDL_quit.h +58 -0
  43. data/ext/macosx/SDL2.framework/Headers/SDL_rect.h +138 -0
  44. data/ext/macosx/SDL2.framework/Headers/SDL_render.h +870 -0
  45. data/ext/macosx/SDL2.framework/Headers/SDL_revision.h +2 -0
  46. data/ext/macosx/SDL2.framework/Headers/SDL_rwops.h +232 -0
  47. data/ext/macosx/SDL2.framework/Headers/SDL_scancode.h +401 -0
  48. data/ext/macosx/SDL2.framework/Headers/SDL_shape.h +143 -0
  49. data/ext/macosx/SDL2.framework/Headers/SDL_stdinc.h +405 -0
  50. data/ext/macosx/SDL2.framework/Headers/SDL_surface.h +503 -0
  51. data/ext/macosx/SDL2.framework/Headers/SDL_system.h +191 -0
  52. data/ext/macosx/SDL2.framework/Headers/SDL_syswm.h +272 -0
  53. data/ext/macosx/SDL2.framework/Headers/SDL_thread.h +287 -0
  54. data/ext/macosx/SDL2.framework/Headers/SDL_timer.h +115 -0
  55. data/ext/macosx/SDL2.framework/Headers/SDL_touch.h +86 -0
  56. data/ext/macosx/SDL2.framework/Headers/SDL_types.h +29 -0
  57. data/ext/macosx/SDL2.framework/Headers/SDL_version.h +162 -0
  58. data/ext/macosx/SDL2.framework/Headers/SDL_video.h +979 -0
  59. data/ext/macosx/SDL2.framework/Headers/begin_code.h +140 -0
  60. data/ext/macosx/SDL2.framework/Headers/close_code.h +37 -0
  61. data/ext/macosx/SDL2.framework/Resources/Info.plist +42 -0
  62. data/ext/macosx/SDL2.framework/SDL2 +0 -0
  63. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL.h +163 -0
  64. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_assert.h +284 -0
  65. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_atomic.h +260 -0
  66. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_audio.h +506 -0
  67. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_bits.h +97 -0
  68. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_blendmode.h +63 -0
  69. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_clipboard.h +71 -0
  70. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_config.h +55 -0
  71. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_config_macosx.h +184 -0
  72. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_copying.h +20 -0
  73. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_cpuinfo.h +156 -0
  74. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_endian.h +239 -0
  75. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_error.h +76 -0
  76. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_events.h +723 -0
  77. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_filesystem.h +136 -0
  78. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_gamecontroller.h +316 -0
  79. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_gesture.h +87 -0
  80. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_haptic.h +1225 -0
  81. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_hints.h +517 -0
  82. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_joystick.h +253 -0
  83. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_keyboard.h +217 -0
  84. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_keycode.h +341 -0
  85. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_loadso.h +81 -0
  86. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_log.h +211 -0
  87. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_main.h +155 -0
  88. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_messagebox.h +144 -0
  89. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_mouse.h +224 -0
  90. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_mutex.h +251 -0
  91. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_name.h +33 -0
  92. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_opengl.h +11126 -0
  93. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_opengles.h +38 -0
  94. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_opengles2.h +2790 -0
  95. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_pixels.h +429 -0
  96. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_platform.h +164 -0
  97. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_power.h +75 -0
  98. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_quit.h +58 -0
  99. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_rect.h +138 -0
  100. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_render.h +870 -0
  101. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_revision.h +2 -0
  102. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_rwops.h +232 -0
  103. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_scancode.h +401 -0
  104. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_shape.h +143 -0
  105. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_stdinc.h +405 -0
  106. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_surface.h +503 -0
  107. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_system.h +191 -0
  108. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_syswm.h +272 -0
  109. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_thread.h +287 -0
  110. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_timer.h +115 -0
  111. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_touch.h +86 -0
  112. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_types.h +29 -0
  113. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_version.h +162 -0
  114. data/ext/macosx/SDL2.framework/Versions/A/Headers/SDL_video.h +979 -0
  115. data/ext/macosx/SDL2.framework/Versions/A/Headers/begin_code.h +140 -0
  116. data/ext/macosx/SDL2.framework/Versions/A/Headers/close_code.h +37 -0
  117. data/ext/macosx/SDL2.framework/Versions/A/Resources/Info.plist +42 -0
  118. data/ext/macosx/SDL2.framework/Versions/A/SDL2 +0 -0
  119. data/ext/macosx/SDL2.framework/Versions/A/_CodeSignature/CodeResources +331 -0
  120. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL.h +163 -0
  121. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_assert.h +284 -0
  122. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_atomic.h +260 -0
  123. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_audio.h +506 -0
  124. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_bits.h +97 -0
  125. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_blendmode.h +63 -0
  126. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_clipboard.h +71 -0
  127. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_config.h +55 -0
  128. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_config_macosx.h +184 -0
  129. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_copying.h +20 -0
  130. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_cpuinfo.h +156 -0
  131. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_endian.h +239 -0
  132. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_error.h +76 -0
  133. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_events.h +723 -0
  134. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_filesystem.h +136 -0
  135. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_gamecontroller.h +316 -0
  136. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_gesture.h +87 -0
  137. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_haptic.h +1225 -0
  138. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_hints.h +517 -0
  139. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_joystick.h +253 -0
  140. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_keyboard.h +217 -0
  141. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_keycode.h +341 -0
  142. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_loadso.h +81 -0
  143. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_log.h +211 -0
  144. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_main.h +155 -0
  145. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_messagebox.h +144 -0
  146. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_mouse.h +224 -0
  147. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_mutex.h +251 -0
  148. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_name.h +33 -0
  149. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_opengl.h +11126 -0
  150. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_opengles.h +38 -0
  151. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_opengles2.h +2790 -0
  152. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_pixels.h +429 -0
  153. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_platform.h +164 -0
  154. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_power.h +75 -0
  155. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_quit.h +58 -0
  156. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_rect.h +138 -0
  157. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_render.h +870 -0
  158. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_revision.h +2 -0
  159. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_rwops.h +232 -0
  160. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_scancode.h +401 -0
  161. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_shape.h +143 -0
  162. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_stdinc.h +405 -0
  163. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_surface.h +503 -0
  164. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_system.h +191 -0
  165. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_syswm.h +272 -0
  166. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_thread.h +287 -0
  167. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_timer.h +115 -0
  168. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_touch.h +86 -0
  169. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_types.h +29 -0
  170. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_version.h +162 -0
  171. data/ext/macosx/SDL2.framework/Versions/Current/Headers/SDL_video.h +979 -0
  172. data/ext/macosx/SDL2.framework/Versions/Current/Headers/begin_code.h +140 -0
  173. data/ext/macosx/SDL2.framework/Versions/Current/Headers/close_code.h +37 -0
  174. data/ext/macosx/SDL2.framework/Versions/Current/Resources/Info.plist +42 -0
  175. data/ext/macosx/SDL2.framework/Versions/Current/SDL2 +0 -0
  176. data/ext/macosx/SDL2.framework/Versions/Current/_CodeSignature/CodeResources +331 -0
  177. data/ext/windows/RubyGL.so +0 -0
  178. data/lib/rubygl/native/opengl.rb +1052 -1044
  179. data/lib/rubygl/setup.rb +7 -4
  180. data/lib/rubygl.rb +12 -4
  181. data/rubygl.gemspec +3 -2
  182. metadata +174 -3
@@ -0,0 +1,239 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+
22
+ /**
23
+ * \file SDL_endian.h
24
+ *
25
+ * Functions for reading and writing endian-specific values
26
+ */
27
+
28
+ #ifndef _SDL_endian_h
29
+ #define _SDL_endian_h
30
+
31
+ #include "SDL_stdinc.h"
32
+
33
+ /**
34
+ * \name The two types of endianness
35
+ */
36
+ /* @{ */
37
+ #define SDL_LIL_ENDIAN 1234
38
+ #define SDL_BIG_ENDIAN 4321
39
+ /* @} */
40
+
41
+ #ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
42
+ #ifdef __linux__
43
+ #include <endian.h>
44
+ #define SDL_BYTEORDER __BYTE_ORDER
45
+ #else /* __linux __ */
46
+ #if defined(__hppa__) || \
47
+ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
48
+ (defined(__MIPS__) && defined(__MISPEB__)) || \
49
+ defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
50
+ defined(__sparc__)
51
+ #define SDL_BYTEORDER SDL_BIG_ENDIAN
52
+ #else
53
+ #define SDL_BYTEORDER SDL_LIL_ENDIAN
54
+ #endif
55
+ #endif /* __linux __ */
56
+ #endif /* !SDL_BYTEORDER */
57
+
58
+
59
+ #include "begin_code.h"
60
+ /* Set up for C function definitions, even when using C++ */
61
+ #ifdef __cplusplus
62
+ extern "C" {
63
+ #endif
64
+
65
+ /**
66
+ * \file SDL_endian.h
67
+ */
68
+ #if defined(__GNUC__) && defined(__i386__) && \
69
+ !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
70
+ SDL_FORCE_INLINE Uint16
71
+ SDL_Swap16(Uint16 x)
72
+ {
73
+ __asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
74
+ return x;
75
+ }
76
+ #elif defined(__GNUC__) && defined(__x86_64__)
77
+ SDL_FORCE_INLINE Uint16
78
+ SDL_Swap16(Uint16 x)
79
+ {
80
+ __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
81
+ return x;
82
+ }
83
+ #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
84
+ SDL_FORCE_INLINE Uint16
85
+ SDL_Swap16(Uint16 x)
86
+ {
87
+ int result;
88
+
89
+ __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
90
+ return (Uint16)result;
91
+ }
92
+ #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
93
+ SDL_FORCE_INLINE Uint16
94
+ SDL_Swap16(Uint16 x)
95
+ {
96
+ __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
97
+ return x;
98
+ }
99
+ #else
100
+ SDL_FORCE_INLINE Uint16
101
+ SDL_Swap16(Uint16 x)
102
+ {
103
+ return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
104
+ }
105
+ #endif
106
+
107
+ #if defined(__GNUC__) && defined(__i386__)
108
+ SDL_FORCE_INLINE Uint32
109
+ SDL_Swap32(Uint32 x)
110
+ {
111
+ __asm__("bswap %0": "=r"(x):"0"(x));
112
+ return x;
113
+ }
114
+ #elif defined(__GNUC__) && defined(__x86_64__)
115
+ SDL_FORCE_INLINE Uint32
116
+ SDL_Swap32(Uint32 x)
117
+ {
118
+ __asm__("bswapl %0": "=r"(x):"0"(x));
119
+ return x;
120
+ }
121
+ #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
122
+ SDL_FORCE_INLINE Uint32
123
+ SDL_Swap32(Uint32 x)
124
+ {
125
+ Uint32 result;
126
+
127
+ __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x));
128
+ __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x));
129
+ __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x));
130
+ return result;
131
+ }
132
+ #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
133
+ SDL_FORCE_INLINE Uint32
134
+ SDL_Swap32(Uint32 x)
135
+ {
136
+ __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
137
+ return x;
138
+ }
139
+ #else
140
+ SDL_FORCE_INLINE Uint32
141
+ SDL_Swap32(Uint32 x)
142
+ {
143
+ return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
144
+ ((x >> 8) & 0x0000FF00) | (x >> 24)));
145
+ }
146
+ #endif
147
+
148
+ #if defined(__GNUC__) && defined(__i386__)
149
+ SDL_FORCE_INLINE Uint64
150
+ SDL_Swap64(Uint64 x)
151
+ {
152
+ union
153
+ {
154
+ struct
155
+ {
156
+ Uint32 a, b;
157
+ } s;
158
+ Uint64 u;
159
+ } v;
160
+ v.u = x;
161
+ __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
162
+ "1"(v.s.
163
+ b));
164
+ return v.u;
165
+ }
166
+ #elif defined(__GNUC__) && defined(__x86_64__)
167
+ SDL_FORCE_INLINE Uint64
168
+ SDL_Swap64(Uint64 x)
169
+ {
170
+ __asm__("bswapq %0": "=r"(x):"0"(x));
171
+ return x;
172
+ }
173
+ #else
174
+ SDL_FORCE_INLINE Uint64
175
+ SDL_Swap64(Uint64 x)
176
+ {
177
+ Uint32 hi, lo;
178
+
179
+ /* Separate into high and low 32-bit values and swap them */
180
+ lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
181
+ x >>= 32;
182
+ hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
183
+ x = SDL_Swap32(lo);
184
+ x <<= 32;
185
+ x |= SDL_Swap32(hi);
186
+ return (x);
187
+ }
188
+ #endif
189
+
190
+
191
+ SDL_FORCE_INLINE float
192
+ SDL_SwapFloat(float x)
193
+ {
194
+ union
195
+ {
196
+ float f;
197
+ Uint32 ui32;
198
+ } swapper;
199
+ swapper.f = x;
200
+ swapper.ui32 = SDL_Swap32(swapper.ui32);
201
+ return swapper.f;
202
+ }
203
+
204
+
205
+ /**
206
+ * \name Swap to native
207
+ * Byteswap item from the specified endianness to the native endianness.
208
+ */
209
+ /* @{ */
210
+ #if SDL_BYTEORDER == SDL_LIL_ENDIAN
211
+ #define SDL_SwapLE16(X) (X)
212
+ #define SDL_SwapLE32(X) (X)
213
+ #define SDL_SwapLE64(X) (X)
214
+ #define SDL_SwapFloatLE(X) (X)
215
+ #define SDL_SwapBE16(X) SDL_Swap16(X)
216
+ #define SDL_SwapBE32(X) SDL_Swap32(X)
217
+ #define SDL_SwapBE64(X) SDL_Swap64(X)
218
+ #define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
219
+ #else
220
+ #define SDL_SwapLE16(X) SDL_Swap16(X)
221
+ #define SDL_SwapLE32(X) SDL_Swap32(X)
222
+ #define SDL_SwapLE64(X) SDL_Swap64(X)
223
+ #define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
224
+ #define SDL_SwapBE16(X) (X)
225
+ #define SDL_SwapBE32(X) (X)
226
+ #define SDL_SwapBE64(X) (X)
227
+ #define SDL_SwapFloatBE(X) (X)
228
+ #endif
229
+ /* @} *//* Swap to native */
230
+
231
+ /* Ends C function definitions when using C++ */
232
+ #ifdef __cplusplus
233
+ }
234
+ #endif
235
+ #include "close_code.h"
236
+
237
+ #endif /* _SDL_endian_h */
238
+
239
+ /* vi: set ts=4 sw=4 expandtab: */
@@ -0,0 +1,76 @@
1
+ /*
2
+ Simple DirectMedia Layer
3
+ Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
4
+
5
+ This software is provided 'as-is', without any express or implied
6
+ warranty. In no event will the authors be held liable for any damages
7
+ arising from the use of this software.
8
+
9
+ Permission is granted to anyone to use this software for any purpose,
10
+ including commercial applications, and to alter it and redistribute it
11
+ freely, subject to the following restrictions:
12
+
13
+ 1. The origin of this software must not be misrepresented; you must not
14
+ claim that you wrote the original software. If you use this software
15
+ in a product, an acknowledgment in the product documentation would be
16
+ appreciated but is not required.
17
+ 2. Altered source versions must be plainly marked as such, and must not be
18
+ misrepresented as being the original software.
19
+ 3. This notice may not be removed or altered from any source distribution.
20
+ */
21
+
22
+ /**
23
+ * \file SDL_error.h
24
+ *
25
+ * Simple error message routines for SDL.
26
+ */
27
+
28
+ #ifndef _SDL_error_h
29
+ #define _SDL_error_h
30
+
31
+ #include "SDL_stdinc.h"
32
+
33
+ #include "begin_code.h"
34
+ /* Set up for C function definitions, even when using C++ */
35
+ #ifdef __cplusplus
36
+ extern "C" {
37
+ #endif
38
+
39
+ /* Public functions */
40
+ /* SDL_SetError() unconditionally returns -1. */
41
+ extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...);
42
+ extern DECLSPEC const char *SDLCALL SDL_GetError(void);
43
+ extern DECLSPEC void SDLCALL SDL_ClearError(void);
44
+
45
+ /**
46
+ * \name Internal error functions
47
+ *
48
+ * \internal
49
+ * Private error reporting function - used internally.
50
+ */
51
+ /* @{ */
52
+ #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
53
+ #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
54
+ #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
55
+ typedef enum
56
+ {
57
+ SDL_ENOMEM,
58
+ SDL_EFREAD,
59
+ SDL_EFWRITE,
60
+ SDL_EFSEEK,
61
+ SDL_UNSUPPORTED,
62
+ SDL_LASTERROR
63
+ } SDL_errorcode;
64
+ /* SDL_Error() unconditionally returns -1. */
65
+ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
66
+ /* @} *//* Internal error functions */
67
+
68
+ /* Ends C function definitions when using C++ */
69
+ #ifdef __cplusplus
70
+ }
71
+ #endif
72
+ #include "close_code.h"
73
+
74
+ #endif /* _SDL_error_h */
75
+
76
+ /* vi: set ts=4 sw=4 expandtab: */