Implemented the Dynamic API magic.

This commit is contained in:
Ryan C. Gordon
2013-12-09 16:03:18 -05:00
parent 7e1289af32
commit 090327e76e
21 changed files with 1808 additions and 1 deletions
+1
View File
@@ -240,6 +240,7 @@ file(GLOB SOURCE_FILES
${SDL2_SOURCE_DIR}/src/atomic/*.c
${SDL2_SOURCE_DIR}/src/audio/*.c
${SDL2_SOURCE_DIR}/src/cpuinfo/*.c
${SDL2_SOURCE_DIR}/src/dynapi/*.c
${SDL2_SOURCE_DIR}/src/events/*.c
${SDL2_SOURCE_DIR}/src/file/*.c
${SDL2_SOURCE_DIR}/src/libm/*.c
+16
View File
@@ -1224,6 +1224,22 @@
RelativePath="..\..\src\core\windows\SDL_windows.h"
>
</File>
<File
RelativePath="..\..\src\dynapi\SDL_dynapi.h"
>
</File>
<File
RelativePath="..\..\src\dynapi\SDL_dynapi_overrides.h"
>
</File>
<File
RelativePath="..\..\src\dynapi\SDL_dynapi_procs.h"
>
</File>
<File
RelativePath="..\..\src\dynapi\SDL_dynapi.c"
>
</File>
<File
RelativePath="..\..\src\video\windows\SDL_windowsclipboard.c"
>
+4
View File
@@ -479,6 +479,9 @@
<ClInclude Include="..\..\include\SDL_version.h" />
<ClInclude Include="..\..\include\SDL_video.h" />
<ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
<ClInclude Include="..\..\src\dynapi\SDL_dynapi.h" />
<ClInclude Include="..\..\src\dynapi\SDL_dynapi_overrides.h" />
<ClInclude Include="..\..\src\dynapi\SDL_dynapi_procs.h" />
<ClInclude Include="..\..\src\events\blank_cursor.h" />
<ClInclude Include="..\..\src\events\default_cursor.h" />
<ClInclude Include="..\..\src\audio\directsound\directx.h" />
@@ -559,6 +562,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
<ClCompile Include="..\..\src\dynapi\SDL_dynapi.c" />
<ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
<ClCompile Include="..\..\src\events\SDL_gesture.c" />
<ClCompile Include="..\..\src\events\SDL_touch.c" />
+4
View File
@@ -270,6 +270,9 @@
<ClInclude Include="..\..\include\SDL_video.h" />
<ClInclude Include="..\..\include\SDL_gamecontroller.h" />
<ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
<ClInclude Include="..\..\src\dynapi\SDL_dynapi.h" />
<ClInclude Include="..\..\src\dynapi\SDL_dynapi_overrides.h" />
<ClInclude Include="..\..\src\dynapi\SDL_dynapi_procs.h" />
<ClInclude Include="..\..\src\events\blank_cursor.h" />
<ClInclude Include="..\..\src\events\default_cursor.h" />
<ClInclude Include="..\..\src\audio\directsound\directx.h" />
@@ -350,6 +353,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
<ClCompile Include="..\..\src\dynapi\SDL_dynapi.c" />
<ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
<ClCompile Include="..\..\src\events\SDL_gesture.c" />
<ClCompile Include="..\..\src\events\SDL_touch.c" />
+4
View File
@@ -273,6 +273,9 @@
<ClInclude Include="..\..\include\SDL_video.h" />
<ClInclude Include="..\..\include\SDL_gamecontroller.h" />
<ClInclude Include="..\..\src\core\windows\SDL_windows.h" />
<ClInclude Include="..\..\src\dynapi\SDL_dynapi.h" />
<ClInclude Include="..\..\src\dynapi\SDL_dynapi_overrides.h" />
<ClInclude Include="..\..\src\dynapi\SDL_dynapi_procs.h" />
<ClInclude Include="..\..\src\events\blank_cursor.h" />
<ClInclude Include="..\..\src\events\default_cursor.h" />
<ClInclude Include="..\..\src\audio\directsound\directx.h" />
@@ -352,6 +355,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\core\windows\SDL_windows.c" />
<ClCompile Include="..\..\src\dynapi\SDL_dynapi.c" />
<ClCompile Include="..\..\src\events\SDL_clipboardevents.c" />
<ClCompile Include="..\..\src\events\SDL_gesture.c" />
<ClCompile Include="..\..\src\events\SDL_touch.c" />
@@ -67,6 +67,11 @@
04F7808512FB753F00FC43C0 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7808312FB753F00FC43C0 /* SDL_nullframebuffer.c */; };
04FFAB8B12E23B8D00BA343D /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8912E23B8D00BA343D /* SDL_atomic.c */; };
04FFAB8C12E23B8D00BA343D /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */; };
56A6702E18565E450007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6702D18565E450007D20F /* SDL_internal.h */; };
56A6703518565E760007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703118565E760007D20F /* SDL_dynapi_overrides.h */; };
56A6703618565E760007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703218565E760007D20F /* SDL_dynapi_procs.h */; };
56A6703718565E760007D20F /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6703318565E760007D20F /* SDL_dynapi.c */; };
56A6703818565E760007D20F /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6703418565E760007D20F /* SDL_dynapi.h */; };
56C181DF17C44D5E00406AE3 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 56C181DE17C44D5E00406AE3 /* SDL_filesystem.h */; };
56C181E217C44D7A00406AE3 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */; };
56EA86FB13E9EC2B002E47EB /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.c */; };
@@ -260,6 +265,11 @@
04F7808312FB753F00FC43C0 /* SDL_nullframebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullframebuffer.c; sourceTree = "<group>"; };
04FFAB8912E23B8D00BA343D /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_atomic.c; sourceTree = "<group>"; };
04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_spinlock.c; sourceTree = "<group>"; };
56A6702D18565E450007D20F /* SDL_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_internal.h; path = ../../src/SDL_internal.h; sourceTree = "<group>"; };
56A6703118565E760007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = ../../src/dynapi/SDL_dynapi_overrides.h; sourceTree = "<group>"; };
56A6703218565E760007D20F /* SDL_dynapi_procs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_procs.h; path = ../../src/dynapi/SDL_dynapi_procs.h; sourceTree = "<group>"; };
56A6703318565E760007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = ../../src/dynapi/SDL_dynapi.c; sourceTree = "<group>"; };
56A6703418565E760007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = ../../src/dynapi/SDL_dynapi.h; sourceTree = "<group>"; };
56C181DE17C44D5E00406AE3 /* SDL_filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_filesystem.h; sourceTree = "<group>"; };
56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_sysfilesystem.m; path = ../../src/filesystem/cocoa/SDL_sysfilesystem.m; sourceTree = "<group>"; };
56EA86F913E9EC2B002E47EB /* SDL_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_coreaudio.c; path = coreaudio/SDL_coreaudio.c; sourceTree = "<group>"; };
@@ -552,6 +562,17 @@
name = CustomTemplate;
sourceTree = "<group>";
};
56A6702F18565E4F0007D20F /* dynapi */ = {
isa = PBXGroup;
children = (
56A6703118565E760007D20F /* SDL_dynapi_overrides.h */,
56A6703218565E760007D20F /* SDL_dynapi_procs.h */,
56A6703318565E760007D20F /* SDL_dynapi.c */,
56A6703418565E760007D20F /* SDL_dynapi.h */,
);
name = dynapi;
sourceTree = "<group>";
};
56C181E017C44D6900406AE3 /* filesystem */ = {
isa = PBXGroup;
children = (
@@ -737,6 +758,7 @@
04B2ECEF1025CEB900F9BC5F /* atomic */,
FD99B8FB0DD52EDC00FB1D6B /* audio */,
FD99B98A0DD52EDC00FB1D6B /* cpuinfo */,
56A6702F18565E4F0007D20F /* dynapi */,
FD99B98C0DD52EDC00FB1D6B /* events */,
FD99B99D0DD52EDC00FB1D6B /* file */,
56C181E017C44D6900406AE3 /* filesystem */,
@@ -749,6 +771,7 @@
FD99B9E00DD52EDC00FB1D6B /* thread */,
FD99BA1E0DD52EDC00FB1D6B /* timer */,
FDA682420DF2374D00F98A1A /* video */,
56A6702D18565E450007D20F /* SDL_internal.h */,
04F2AF551104ABD200D6DDF7 /* SDL_assert.c */,
04BAC09A1300C1290055DE28 /* SDL_assert_c.h */,
FD99B9D40DD52EDC00FB1D6B /* SDL_error_c.h */,
@@ -941,6 +964,7 @@
FDA684530DF2374E00F98A1A /* SDL_blit_auto.h in Headers */,
FDA684550DF2374E00F98A1A /* SDL_blit_copy.h in Headers */,
FDA6845D0DF2374E00F98A1A /* SDL_pixels_c.h in Headers */,
56A6703618565E760007D20F /* SDL_dynapi_procs.h in Headers */,
FDA684630DF2374E00F98A1A /* SDL_RLEaccel_c.h in Headers */,
FDA684670DF2374E00F98A1A /* SDL_sysvideo.h in Headers */,
FDA685FC0DF244C800F98A1A /* SDL_nullevents_c.h in Headers */,
@@ -953,7 +977,9 @@
FD689F200E26E5D900F90B21 /* SDL_uikitvideo.h in Headers */,
FD689F240E26E5D900F90B21 /* SDL_uikitwindow.h in Headers */,
FD689F260E26E5D900F90B21 /* SDL_uikitopenglview.h in Headers */,
56A6703818565E760007D20F /* SDL_dynapi.h in Headers */,
FD689FCF0E26E9D400F90B21 /* SDL_uikitappdelegate.h in Headers */,
56A6703518565E760007D20F /* SDL_dynapi_overrides.h in Headers */,
047677BD0EA76A31008ABAF1 /* SDL_syshaptic.h in Headers */,
046387420F0B5B7D0041FD65 /* SDL_blit_slow.h in Headers */,
006E9888119552DD001DE610 /* SDL_rwopsbundlesupport.h in Headers */,
@@ -989,6 +1015,7 @@
AA7558A21595D55500BBD41B /* SDL_cpuinfo.h in Headers */,
AA7558A31595D55500BBD41B /* SDL_endian.h in Headers */,
AA7558A41595D55500BBD41B /* SDL_error.h in Headers */,
56A6702E18565E450007D20F /* SDL_internal.h in Headers */,
AA7558A51595D55500BBD41B /* SDL_events.h in Headers */,
AA7558A61595D55500BBD41B /* SDL_gesture.h in Headers */,
AA7558A71595D55500BBD41B /* SDL_haptic.h in Headers */,
@@ -1117,6 +1144,7 @@
FD6526700DE8FCDD002AD96B /* SDL_cpuinfo.c in Sources */,
FD6526710DE8FCDD002AD96B /* SDL_events.c in Sources */,
FD6526720DE8FCDD002AD96B /* SDL_keyboard.c in Sources */,
56A6703718565E760007D20F /* SDL_dynapi.c in Sources */,
FD6526730DE8FCDD002AD96B /* SDL_mouse.c in Sources */,
FD6526740DE8FCDD002AD96B /* SDL_quit.c in Sources */,
FD6526750DE8FCDD002AD96B /* SDL_windowevents.c in Sources */,
+48
View File
@@ -393,6 +393,21 @@
566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */; };
567E2F1C17C44BB2005F1892 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */; };
567E2F2117C44C35005F1892 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 567E2F2017C44C35005F1892 /* SDL_filesystem.h */; settings = {ATTRIBUTES = (Public, ); }; };
56A670091856545C0007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A670081856545C0007D20F /* SDL_internal.h */; };
56A6700A1856545C0007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A670081856545C0007D20F /* SDL_internal.h */; };
56A6700B1856545C0007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A670081856545C0007D20F /* SDL_internal.h */; };
56A67021185654B40007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */; };
56A67022185654B40007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */; };
56A67023185654B40007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */; };
56A67024185654B40007D20F /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6701E185654B40007D20F /* SDL_dynapi.c */; };
56A67025185654B40007D20F /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6701E185654B40007D20F /* SDL_dynapi.c */; };
56A67026185654B40007D20F /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6701E185654B40007D20F /* SDL_dynapi.c */; };
56A67027185654B40007D20F /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701F185654B40007D20F /* SDL_dynapi.h */; };
56A67028185654B40007D20F /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701F185654B40007D20F /* SDL_dynapi.h */; };
56A67029185654B40007D20F /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701F185654B40007D20F /* SDL_dynapi.h */; };
56A6702A185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; };
56A6702B185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; };
56A6702C185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; };
A77E6EB4167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; };
A77E6EB5167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; };
AA0AD09D16648D1700CE5896 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; };
@@ -994,6 +1009,11 @@
566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dropevents.c; sourceTree = "<group>"; };
567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_sysfilesystem.m; path = ../../src/filesystem/cocoa/SDL_sysfilesystem.m; sourceTree = "<group>"; };
567E2F2017C44C35005F1892 /* SDL_filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_filesystem.h; sourceTree = "<group>"; };
56A670081856545C0007D20F /* SDL_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_internal.h; path = ../../src/SDL_internal.h; sourceTree = "<group>"; };
56A6701D185654B40007D20F /* SDL_dynapi_procs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_procs.h; path = ../../src/dynapi/SDL_dynapi_procs.h; sourceTree = "<group>"; };
56A6701E185654B40007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = ../../src/dynapi/SDL_dynapi.c; sourceTree = "<group>"; };
56A6701F185654B40007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = ../../src/dynapi/SDL_dynapi.h; sourceTree = "<group>"; };
56A67020185654B40007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = ../../src/dynapi/SDL_dynapi_overrides.h; sourceTree = "<group>"; };
A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = "<group>"; };
AA0F8490178D5ECC00823F9D /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systls.c; sourceTree = "<group>"; };
AA628AC8159367B7005138DD /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rotate.c; sourceTree = "<group>"; };
@@ -1651,6 +1671,7 @@
04BDFD7312E6671700899322 /* atomic */,
04BDFD7612E6671700899322 /* audio */,
04BDFDD312E6671700899322 /* cpuinfo */,
56A6701C1856549B0007D20F /* dynapi */,
04BDFDD512E6671700899322 /* events */,
567E2F1F17C44BBB005F1892 /* filesystem */,
04BDFDEC12E6671700899322 /* file */,
@@ -1663,6 +1684,7 @@
04BDFE6412E6671800899322 /* thread */,
04BDFE9512E6671800899322 /* timer */,
04BDFEA712E6671800899322 /* video */,
56A670081856545C0007D20F /* SDL_internal.h */,
04BDFE5512E6671700899322 /* SDL_assert_c.h */,
04BDFE5612E6671700899322 /* SDL_assert.c */,
04BDFE5812E6671700899322 /* SDL_error_c.h */,
@@ -1682,6 +1704,17 @@
name = filesystem;
sourceTree = "<group>";
};
56A6701C1856549B0007D20F /* dynapi */ = {
isa = PBXGroup;
children = (
56A6701D185654B40007D20F /* SDL_dynapi_procs.h */,
56A6701E185654B40007D20F /* SDL_dynapi.c */,
56A6701F185654B40007D20F /* SDL_dynapi.h */,
56A67020185654B40007D20F /* SDL_dynapi_overrides.h */,
);
name = dynapi;
sourceTree = "<group>";
};
BEC562FE0761C0E800A33029 /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
@@ -1747,6 +1780,7 @@
AA7558061595D4D800BBD41B /* SDL_clipboard.h in Headers */,
AA7558081595D4D800BBD41B /* SDL_config_macosx.h in Headers */,
AA75580A1595D4D800BBD41B /* SDL_config.h in Headers */,
56A670091856545C0007D20F /* SDL_internal.h in Headers */,
AA75580C1595D4D800BBD41B /* SDL_copying.h in Headers */,
AA75580E1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */,
AA7558101595D4D800BBD41B /* SDL_endian.h in Headers */,
@@ -1805,6 +1839,7 @@
04BD004512E6671800899322 /* scancodes_linux.h in Headers */,
04BD004712E6671800899322 /* scancodes_xfree86.h in Headers */,
04BD004912E6671800899322 /* SDL_clipboardevents_c.h in Headers */,
56A6702A185654B40007D20F /* SDL_dynapi_overrides.h in Headers */,
04BD004B12E6671800899322 /* SDL_events_c.h in Headers */,
04BD004D12E6671800899322 /* SDL_gesture_c.h in Headers */,
04BD004F12E6671800899322 /* SDL_keyboard_c.h in Headers */,
@@ -1855,6 +1890,7 @@
04BD01EE12E6671800899322 /* SDL_x11opengles.h in Headers */,
04BD01F212E6671800899322 /* SDL_x11shape.h in Headers */,
04BD01F312E6671800899322 /* SDL_x11sym.h in Headers */,
56A67021185654B40007D20F /* SDL_dynapi_procs.h in Headers */,
04BD01F512E6671800899322 /* SDL_x11touch.h in Headers */,
04BD01F712E6671800899322 /* SDL_x11video.h in Headers */,
04BD01F912E6671800899322 /* SDL_x11window.h in Headers */,
@@ -1865,6 +1901,7 @@
04F7804A12FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */,
04F7804C12FB74A200FC43C0 /* SDL_blendline.h in Headers */,
04F7804E12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */,
56A67027185654B40007D20F /* SDL_dynapi.h in Headers */,
04F7804F12FB74A200FC43C0 /* SDL_draw.h in Headers */,
04F7805112FB74A200FC43C0 /* SDL_drawline.h in Headers */,
04F7805312FB74A200FC43C0 /* SDL_drawpoint.h in Headers */,
@@ -1917,6 +1954,7 @@
AA75582F1595D4D800BBD41B /* SDL_name.h in Headers */,
AA7558311595D4D800BBD41B /* SDL_opengl.h in Headers */,
AA7558331595D4D800BBD41B /* SDL_opengles.h in Headers */,
56A67028185654B40007D20F /* SDL_dynapi.h in Headers */,
AA7558351595D4D800BBD41B /* SDL_opengles2.h in Headers */,
AA7558371595D4D800BBD41B /* SDL_pixels.h in Headers */,
AA7558391595D4D800BBD41B /* SDL_platform.h in Headers */,
@@ -1928,6 +1966,7 @@
AA7558451595D4D800BBD41B /* SDL_rwops.h in Headers */,
AA7558471595D4D800BBD41B /* SDL_scancode.h in Headers */,
AA7558491595D4D800BBD41B /* SDL_shape.h in Headers */,
56A6702B185654B40007D20F /* SDL_dynapi_overrides.h in Headers */,
AA75584B1595D4D800BBD41B /* SDL_stdinc.h in Headers */,
AA75584D1595D4D800BBD41B /* SDL_surface.h in Headers */,
AA75584F1595D4D800BBD41B /* SDL_system.h in Headers */,
@@ -1939,6 +1978,7 @@
AA75585B1595D4D800BBD41B /* SDL_version.h in Headers */,
AA75585D1595D4D800BBD41B /* SDL_video.h in Headers */,
04BD022512E6671800899322 /* SDL_diskaudio.h in Headers */,
56A6700A1856545C0007D20F /* SDL_internal.h in Headers */,
04BD022D12E6671800899322 /* SDL_dummyaudio.h in Headers */,
04BD023512E6671800899322 /* SDL_coreaudio.h in Headers */,
04BD024312E6671800899322 /* SDL_audio_c.h in Headers */,
@@ -1953,6 +1993,7 @@
04BD026212E6671800899322 /* scancodes_xfree86.h in Headers */,
04BD026412E6671800899322 /* SDL_clipboardevents_c.h in Headers */,
04BD026612E6671800899322 /* SDL_events_c.h in Headers */,
56A67022185654B40007D20F /* SDL_dynapi_procs.h in Headers */,
04BD026812E6671800899322 /* SDL_gesture_c.h in Headers */,
04BD026A12E6671800899322 /* SDL_keyboard_c.h in Headers */,
04BD026C12E6671800899322 /* SDL_mouse_c.h in Headers */,
@@ -2063,6 +2104,7 @@
DB313FE117554B71006C0E22 /* SDL_name.h in Headers */,
DB313FE217554B71006C0E22 /* SDL_opengl.h in Headers */,
DB313FE317554B71006C0E22 /* SDL_opengles.h in Headers */,
56A67029185654B40007D20F /* SDL_dynapi.h in Headers */,
DB313FE417554B71006C0E22 /* SDL_opengles2.h in Headers */,
DB313FE517554B71006C0E22 /* SDL_pixels.h in Headers */,
DB313FE617554B71006C0E22 /* SDL_platform.h in Headers */,
@@ -2074,6 +2116,7 @@
DB313FEC17554B71006C0E22 /* SDL_rwops.h in Headers */,
DB313FED17554B71006C0E22 /* SDL_scancode.h in Headers */,
DB313FEE17554B71006C0E22 /* SDL_shape.h in Headers */,
56A6702C185654B40007D20F /* SDL_dynapi_overrides.h in Headers */,
DB313FEF17554B71006C0E22 /* SDL_stdinc.h in Headers */,
DB313FF017554B71006C0E22 /* SDL_surface.h in Headers */,
DB313FF117554B71006C0E22 /* SDL_system.h in Headers */,
@@ -2085,6 +2128,7 @@
DB313FF717554B71006C0E22 /* SDL_version.h in Headers */,
DB313FF817554B71006C0E22 /* SDL_video.h in Headers */,
DB313F7417554B71006C0E22 /* SDL_diskaudio.h in Headers */,
56A6700B1856545C0007D20F /* SDL_internal.h in Headers */,
DB313F7517554B71006C0E22 /* SDL_dummyaudio.h in Headers */,
DB313F7617554B71006C0E22 /* SDL_coreaudio.h in Headers */,
DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */,
@@ -2099,6 +2143,7 @@
DB313F8017554B71006C0E22 /* scancodes_xfree86.h in Headers */,
DB313F8117554B71006C0E22 /* SDL_clipboardevents_c.h in Headers */,
DB313F8217554B71006C0E22 /* SDL_events_c.h in Headers */,
56A67023185654B40007D20F /* SDL_dynapi_procs.h in Headers */,
DB313F8317554B71006C0E22 /* SDL_gesture_c.h in Headers */,
DB313F8417554B71006C0E22 /* SDL_keyboard_c.h in Headers */,
DB313F8517554B71006C0E22 /* SDL_mouse_c.h in Headers */,
@@ -2442,6 +2487,7 @@
0442EC1D12FE1BCB004C9285 /* SDL_render_sw.c in Sources */,
0442EC5A12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */,
0442EC5F12FE1C75004C9285 /* SDL_hints.c in Sources */,
56A67024185654B40007D20F /* SDL_dynapi.c in Sources */,
04BAC0C81300C2160055DE28 /* SDL_log.c in Sources */,
0435673E1303160F00BA5428 /* SDL_shaders_gl.c in Sources */,
566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */,
@@ -2560,6 +2606,7 @@
04F7805E12FB74A200FC43C0 /* SDL_drawpoint.c in Sources */,
0442EC1912FE1BBA004C9285 /* SDL_render_gl.c in Sources */,
0442EC1F12FE1BCB004C9285 /* SDL_render_sw.c in Sources */,
56A67025185654B40007D20F /* SDL_dynapi.c in Sources */,
0442EC5C12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */,
0442EC6012FE1C75004C9285 /* SDL_hints.c in Sources */,
04BAC0C91300C2160055DE28 /* SDL_log.c in Sources */,
@@ -2678,6 +2725,7 @@
DB31406017554B71006C0E22 /* SDL_drawpoint.c in Sources */,
DB31406117554B71006C0E22 /* SDL_render_gl.c in Sources */,
DB31406217554B71006C0E22 /* SDL_render_sw.c in Sources */,
56A67026185654B40007D20F /* SDL_dynapi.c in Sources */,
DB31406317554B71006C0E22 /* SDL_x11framebuffer.c in Sources */,
DB31406417554B71006C0E22 /* SDL_hints.c in Sources */,
DB31406517554B71006C0E22 /* SDL_log.c in Sources */,
+1
View File
@@ -326,6 +326,7 @@ SOURCES="$SOURCES $srcdir/src/*.c"
SOURCES="$SOURCES $srcdir/src/atomic/*.c"
SOURCES="$SOURCES $srcdir/src/audio/*.c"
SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
SOURCES="$SOURCES $srcdir/src/dynapi/*.c"
SOURCES="$SOURCES $srcdir/src/events/*.c"
SOURCES="$SOURCES $srcdir/src/file/*.c"
SOURCES="$SOURCES $srcdir/src/haptic/*.c"
+5
View File
@@ -111,7 +111,12 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
/**
* Create a thread.
*/
#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
#undef SDL_CreateThread
#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
#else
#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
#endif
#else
+1
View File
@@ -69,6 +69,7 @@ SDL_project "SDL2"
"/audio/disk/",
"/audio/dummy/",
"/cpuinfo/",
"/dynapi/",
"/events/",
"/file/",
"/haptic/",
+10
View File
@@ -21,6 +21,16 @@
#ifndef _SDL_internal_h
#define _SDL_internal_h
#include "dynapi/SDL_dynapi.h"
#if SDL_DYNAMIC_API
#include "dynapi/SDL_dynapi_overrides.h"
/* force DECLSPEC and SDLCALL off...it's all internal symbols now.
These will have actual #defines during SDL_dynapi.c only */
#define DECLSPEC
#define SDLCALL
#endif
#include "SDL_config.h"
#endif
+4
View File
@@ -1036,7 +1036,11 @@ open_audio_device(const char *devname, int iscapture,
/* !!! FIXME: this is nasty. */
#if defined(__WIN32__) && !defined(HAVE_LIBC)
#undef SDL_CreateThread
#if SDL_DYNAMIC_API
device->thread = SDL_CreateThread_REAL(SDL_RunAudio, name, device, NULL, NULL);
#else
device->thread = SDL_CreateThread(SDL_RunAudio, name, device, NULL, NULL);
#endif
#else
device->thread = SDL_CreateThread(SDL_RunAudio, name, device);
#endif
+302
View File
@@ -0,0 +1,302 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"
#include "SDL_dynapi.h"
#if SDL_DYNAMIC_API
#include "SDL.h"
/* !!! FIXME: Shouldn't these be included in SDL.h? */
#include "SDL_shape.h"
#include "SDL_syswm.h"
/* This is the version of the dynamic API. This doesn't match the SDL version
and should not change until there's been a major revamp in API/ABI.
So 2.0.5 adds functions over 2.0.4? This number doesn't change;
the sizeof (jump_table) changes instead. But 2.1.0 changes how a function
works in an incompatible way or removes a function? This number changes,
since sizeof (jump_table) isn't sufficient anymore. It's likely
we'll forget to bump every time we add a function, so this is the
failsafe switch for major API change decisions. Respect it and use it
sparingly. */
#define SDL_DYNAPI_VERSION 1
static void SDL_InitDynamicAPI(void);
/* BE CAREFUL CALLING ANY SDL CODE IN HERE, IT WILL BLOW UP.
Even self-contained stuff might call SDL_Error and break everything. */
/* behold, the macro salsa! */
/* !!! FIXME: ...disabled...until we write it. :) */
#define DISABLE_JUMP_MAGIC 1
#if DISABLE_JUMP_MAGIC
/* Can't use the macro for varargs nonsense. This is atrocious. */
#define SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, logname, prio) \
_static void SDL_Log##logname##name(int category, const char *fmt, ...) { \
va_list ap; initcall; va_start(ap, fmt); \
jump_table.SDL_LogMessageV(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \
va_end(ap); \
}
#define SDL_DYNAPI_VARARGS(_static, name, initcall) \
_static int SDL_SetError##name(const char *fmt, ...) { \
char buf[512]; /* !!! FIXME: dynamic allocation */ \
va_list ap; initcall; va_start(ap, fmt); \
jump_table.SDL_vsnprintf(buf, sizeof (buf), fmt, ap); \
va_end(ap); \
return jump_table.SDL_SetError("%s", buf); \
} \
_static int SDL_sscanf##name(const char *buf, const char *fmt, ...) { \
int retval; va_list ap; initcall; va_start(ap, fmt); \
retval = jump_table.SDL_vsscanf(buf, fmt, ap); \
va_end(ap); \
return retval; \
} \
_static int SDL_snprintf##name(char *buf, size_t buflen, const char *fmt, ...) { \
int retval; va_list ap; initcall; va_start(ap, fmt); \
retval = jump_table.SDL_vsnprintf(buf, buflen, fmt, ap); \
va_end(ap); \
return retval; \
} \
_static void SDL_Log##name(const char *fmt, ...) { \
va_list ap; initcall; va_start(ap, fmt); \
jump_table.SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); \
va_end(ap); \
} \
_static void SDL_LogMessage##name(int category, SDL_LogPriority priority, const char *fmt, ...) { \
va_list ap; initcall; va_start(ap, fmt); \
jump_table.SDL_LogMessageV(category, priority, fmt, ap); \
va_end(ap); \
} \
SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Verbose, VERBOSE) \
SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Debug, DEBUG) \
SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Info, INFO) \
SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Warn, WARN) \
SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Error, ERROR) \
SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Critical, CRITICAL)
#endif
/* Typedefs for function pointers for jump table, and predeclare funcs */
/* The DEFAULT funcs will init jump table and then call real function. */
/* The REAL funcs are the actual functions, name-mangled to not clash. */
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
typedef rc (*SDL_DYNAPIFN_##fn) params; \
static rc fn##_DEFAULT params; \
extern rc fn##_REAL params;
#include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC
/* The jump table! */
typedef struct {
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) SDL_DYNAPIFN_##fn fn;
#include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC
} SDL_DYNAPI_jump_table;
/* Predeclare the default functions for initializing the jump table. */
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) static rc fn##_DEFAULT params;
#include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC
/* The actual jump table. */
static SDL_DYNAPI_jump_table jump_table = {
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) fn##_DEFAULT,
#include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC
};
/* Default functions init the function table then call right thing. */
#if DISABLE_JUMP_MAGIC
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
static rc fn##_DEFAULT params { \
SDL_InitDynamicAPI(); \
ret jump_table.fn args; \
}
#define SDL_DYNAPI_PROC_NO_VARARGS 1
#include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC
#undef SDL_DYNAPI_PROC_NO_VARARGS
SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI())
#else
/* !!! FIXME: need the jump magic. */
#error Write me.
#endif
/* Public API functions to jump into the jump table. */
#if DISABLE_JUMP_MAGIC
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
rc fn params { ret jump_table.fn args; }
#define SDL_DYNAPI_PROC_NO_VARARGS 1
#include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC
#undef SDL_DYNAPI_PROC_NO_VARARGS
SDL_DYNAPI_VARARGS(,,)
#else
/* !!! FIXME: need the jump magic. */
#error Write me.
#endif
/* Here's the exported entry point that fills in the jump table. */
/* Use specific types when an "int" might suffice to keep this sane. */
typedef Sint32 (SDLCALL *SDL_DYNAPI_ENTRYFN)(Uint32 apiver, void *table, Uint32 tablesize);
extern DECLSPEC Sint32 SDLCALL SDL_DYNAPI_entry(Uint32, void *, Uint32);
Sint32
SDL_DYNAPI_entry(Uint32 apiver, void *table, Uint32 tablesize)
{
SDL_DYNAPI_jump_table *output_jump_table = (SDL_DYNAPI_jump_table *) table;
if (apiver != SDL_DYNAPI_VERSION) {
/* !!! FIXME: can maybe handle older versions? */
return -1; /* not compatible. */
} else if (tablesize > sizeof (jump_table)) {
return -1; /* newer version of SDL with functions we can't provide. */
}
/* Init our jump table first. */
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) jump_table.fn = fn##_REAL;
#include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC
/* Then the external table... */
if (output_jump_table != &jump_table) {
jump_table.SDL_memcpy(output_jump_table, &jump_table, tablesize);
}
/* Safe to call SDL functions now; jump table is initialized! */
return 0; /* success! */
}
/* Obviously we can't use SDL_LoadObject() to load SDL. :) */
/* Also obviously, we never close the loaded library. */
#if defined(_WINDOWS)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <windows.h>
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
{
HANDLE lib = LoadLibraryA(fname);
return lib ? GetProcAddress(lib, sym) : NULL;
}
#elif defined(__HAIKU__)
#include <os/kernel/image.h>
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
{
image_id lib = load_add_on(fname);
void *retval = NULL;
if ((lib < 0) || (get_image_symbol(lib, sym, B_SYMBOL_TYPE_TEXT, &retval) != B_NO_ERROR)) {
retval = NULL;
}
return retval;
}
#elif defined(unix) || defined(__APPLE__)
#include <dlfcn.h>
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
{
void *lib = dlopen(fname, RTLD_NOW | RTLD_LOCAL);
return lib ? dlsym(lib, sym) : NULL;
}
#else
#error Please define your platform.
#endif
static void
SDL_InitDynamicAPILocked(void)
{
const char *libname = SDL_getenv_REAL("SDL_DYNAMIC_API");
SDL_DYNAPI_ENTRYFN entry = SDL_DYNAPI_entry; /* funcs from here by default. */
if (libname) {
entry = (SDL_DYNAPI_ENTRYFN) get_sdlapi_entry(libname, "SDL_DYNAPI_entry");
if (!entry) {
/* !!! FIXME: fail to startup here instead? */
/* !!! FIXME: definitely warn user. */
/* Just fill in the function pointers from this library. */
entry = SDL_DYNAPI_entry;
}
}
if (entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table)) < 0) {
/* !!! FIXME: fail to startup here instead? */
/* !!! FIXME: definitely warn user. */
/* Just fill in the function pointers from this library. */
if (entry != SDL_DYNAPI_entry) {
if (!SDL_DYNAPI_entry(SDL_DYNAPI_VERSION, &jump_table, sizeof (jump_table))) {
/* !!! FIXME: now we're screwed. Should definitely abort now. */
}
}
}
/* we intentionally never close the newly-loaded lib, of course. */
}
static void
SDL_InitDynamicAPI(void)
{
/* So the theory is that every function in the jump table defaults to
* calling this function, and then replaces itself with a version that
* doesn't call this function anymore. But it's possible that, in an
* extreme corner case, you can have a second thread hit this function
* while the jump table is being initialized by the first.
* In this case, a spinlock is really painful compared to what spinlocks
* _should_ be used for, but this would only happen once, and should be
* insanely rare, as you would have to spin a thread outside of SDL (as
* SDL_CreateThread() would also call this function before building the
* new thread).
*/
static volatile SDL_bool already_initialized = SDL_FALSE;
/* SDL_AtomicLock calls SDL mutex functions to emulate if
SDL_ATOMIC_DISABLED, which we can't do here, so in such a
configuration, you're on your own. */
#if !SDL_ATOMIC_DISABLED
static SDL_SpinLock lock = 0;
SDL_AtomicLock_REAL(&lock);
#endif
if (!already_initialized) {
SDL_InitDynamicAPILocked();
already_initialized = SDL_TRUE;
}
#if !SDL_ATOMIC_DISABLED
SDL_AtomicUnlock_REAL(&lock);
#endif
}
#endif /* SDL_DYNAMIC_API */
/* vi: set ts=4 sw=4 expandtab: */
+50
View File
@@ -0,0 +1,50 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _SDL_dynapi_h
#define _SDL_dynapi_h
/* IMPORTANT:
This is the master switch to disabling the dynamic API. We made it so you
have to hand-edit an internal source file in SDL to turn it off; you
can do it if you want it badly enough, but hopefully you won't want to.
You should understand the ramifications of turning this off: it makes it
hard to update your SDL in the field, and impossible if you've statically
linked SDL into your app. Understand that platforms change, and if we can't
drop in an updated SDL, your application can definitely break some time
in the future, even if it's fine today.
To be sure, as new system-level video and audio APIs are introduced, an
updated SDL can transparently take advantage of them, but your program will
not without this feature. Think hard before turning it off.
*/
#ifdef SDL_DYNAMIC_API /* Tried to force it on the command line? */
#error Nope, you have to edit this file to force this off.
#endif
#if defined(__APPLE__) && TARGET_OS_IPHONE /* probably not useful on iOS. */
#define SDL_DYNAMIC_API 0
#else /* everyone else. */
#define SDL_DYNAMIC_API 1
#endif
#endif
/* vi: set ts=4 sw=4 expandtab: */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+141
View File
@@ -0,0 +1,141 @@
#!/usr/bin/perl -w
# Simple DirectMedia Layer
# Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
# WHAT IS THIS?
# When you add a public API to SDL, please run this script, make sure the
# output looks sane (hg diff, it adds to existing files), and commit it.
# It keeps the dynamic API jump table operating correctly.
# If you wanted this to be readable, you shouldn't have used perl.
use warnings;
use strict;
use File::Basename;
chdir(dirname(__FILE__) . '/../..');
my $sdl_dynapi_procs_h = "src/dynapi/SDL_dynapi_procs.h";
my $sdl_dynapi_overrides_h = "src/dynapi/SDL_dynapi_overrides.h";
my %existing = ();
if (-f $sdl_dynapi_procs_h) {
open(SDL_DYNAPI_PROCS_H, '<', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n");
while (<SDL_DYNAPI_PROCS_H>) {
if (/\ASDL_DYNAPI_PROC\(.*?,(.*?),/) {
$existing{$1} = 1;
}
}
close(SDL_DYNAPI_PROCS_H)
}
open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n");
open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n");
opendir(HEADERS, 'include') or die("Can't open include dir: $!\n");
while (readdir(HEADERS)) {
next if not /\.h\Z/;
my $header = "include/$_";
open(HEADER, '<', $header) or die("Can't open $header: $!\n");
while (<HEADER>) {
chomp;
next if not /\A\s*extern\s+DECLSPEC/;
my $decl = "$_ ";
if (not $decl =~ /\)\s*;/) {
while (<HEADER>) {
chomp;
s/\A\s+//;
s/\s+\Z//;
$decl .= "$_ ";
last if /\)\s*;/;
}
}
$decl =~ s/\s+\Z//;
#print("DECL: [$decl]\n");
if ($decl =~ /\A\s*extern\s+DECLSPEC\s+(const\s+|)(unsigned\s+|)(.*?)\s*(\*?)\s*SDLCALL\s+(.*?)\s*\((.*?)\);/) {
my $rc = "$1$2$3$4";
my $fn = $5;
next if $existing{$fn}; # already slotted into the jump table.
my @params = split(',', $6);
#print("rc == '$rc', fn == '$fn', params == '$params'\n");
my $retstr = ($rc eq 'void') ? '' : 'return';
my $paramstr = '(';
my $argstr = '(';
my $i = 0;
foreach (@params) {
my $str = $_;
$str =~ s/\A\s+//;
$str =~ s/\s+\Z//;
#print("1PARAM: $str\n");
if ($str eq 'void') {
$paramstr .= 'void';
} elsif ($str eq '...') {
if ($i > 0) {
$paramstr .= ', ';
}
$paramstr .= $str;
} elsif ($str =~ /\A\s*((const\s+|)(unsigned\s+|)([a-zA-Z0-9_]*)\s*([\*\s]*))\s*(.*?)\Z/) {
#print("PARSED: [$1], [$2], [$3], [$4], [$5]\n");
my $type = $1;
my $var = $6;
$type =~ s/\A\s+//;
$type =~ s/\s+\Z//;
$var =~ s/\A\s+//;
$var =~ s/\s+\Z//;
$type =~ s/\s*\*\Z/*/g;
$type =~ s/\s*(\*+)\Z/ $1/;
#print("SPLIT: ($type, $var)\n");
my $name = chr(ord('a') + $i);
if ($i > 0) {
$paramstr .= ', ';
$argstr .= ',';
}
my $spc = ($type =~ /\*\Z/) ? '' : ' ';
$paramstr .= "$type$spc$name";
$argstr .= "$name";
}
$i++;
}
$paramstr = '(void' if ($i == 0); # Just to make this consistent.
$paramstr .= ')';
$argstr .= ')';
print("NEW: $decl\n");
print SDL_DYNAPI_PROCS_H "SDL_DYNAPI_PROC($rc,$fn,$paramstr,$argstr,$retstr)\n";
print SDL_DYNAPI_OVERRIDES_H "#define $fn ${fn}_REAL\n";
} else {
print("Failed to parse decl [$decl]!\n");
}
}
close(HEADER);
}
closedir(HEADERS);
close(SDL_DYNAPI_PROCS_H);
close(SDL_DYNAPI_OVERRIDES_H);
# vi: set ts=4 sw=4 expandtab:
+4
View File
@@ -428,7 +428,11 @@ SDL_SYS_HapticOpenFromXInput(SDL_Haptic * haptic, Uint8 userid)
#if defined(__WIN32__) && !defined(HAVE_LIBC) /* !!! FIXME: this is nasty. */
#undef SDL_CreateThread
#if SDL_DYNAMIC_API
haptic->hwdata->thread = SDL_CreateThread_REAL(SDL_RunXInputHaptic, threadName, haptic->hwdata, NULL, NULL);
#else
haptic->hwdata->thread = SDL_CreateThread(SDL_RunXInputHaptic, threadName, haptic->hwdata, NULL, NULL);
#endif
#else
haptic->hwdata->thread = SDL_CreateThread(SDL_RunXInputHaptic, threadName, haptic->hwdata);
#endif
+4
View File
@@ -630,7 +630,11 @@ SDL_SYS_JoystickInit(void)
/* spin up the thread to detect hotplug of devices */
#if defined(__WIN32__) && !defined(HAVE_LIBC)
#undef SDL_CreateThread
#if SDL_DYNAMIC_API
s_threadJoystick= SDL_CreateThread_REAL( SDL_JoystickThread, "SDL_joystick", NULL, NULL, NULL );
#else
s_threadJoystick= SDL_CreateThread( SDL_JoystickThread, "SDL_joystick", NULL, NULL, NULL );
#endif
#else
s_threadJoystick = SDL_CreateThread( SDL_JoystickThread, "SDL_joystick", NULL );
#endif
+7 -1
View File
@@ -296,8 +296,14 @@ SDL_RunThread(void *data)
}
}
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
#ifdef SDL_CreateThread
#undef SDL_CreateThread
#endif
#if SDL_DYNAMIC_API
#define SDL_CreateThread SDL_CreateThread_REAL
#endif
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
DECLSPEC SDL_Thread *SDLCALL
SDL_CreateThread(int (SDLCALL * fn) (void *),
const char *name, void *data,
+4
View File
@@ -224,7 +224,11 @@ SDL_TimerInit(void)
/* !!! FIXME: this is nasty. */
#if defined(__WIN32__) && !defined(HAVE_LIBC)
#undef SDL_CreateThread
#if SDL_DYNAMIC_API
data->thread = SDL_CreateThread_REAL(SDL_TimerThread, name, data, NULL, NULL);
#else
data->thread = SDL_CreateThread(SDL_TimerThread, name, data, NULL, NULL);
#endif
#else
data->thread = SDL_CreateThread(SDL_TimerThread, name, data);
#endif