]> git.cworth.org Git - apitrace/commitdiff
More cleanups.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 23 Nov 2010 21:35:55 +0000 (21:35 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 23 Nov 2010 21:35:55 +0000 (21:35 +0000)
CMakeLists.txt
d3d10_1.py
d3d10misc.py
d3d8.py
d3d9.py
d3dcaps.py
ddraw.py
dl.py [deleted file]

index b7f98f50094785dcf642d8d3a6accf9052f978ea..a7ac9f5769ab91e2e7312b14ffcb6973d7889331 100644 (file)
@@ -21,26 +21,8 @@ find_path (GLEW_INCLUDE_DIR GL/glew.h
 )
 
 if (WIN32)
-       # Nobody likes to include windows.h:
-       # - Microsoft's GL/gl.h header depends on windows.h but doesn't include it;
-       # - GLEW temporarily defines the necessary defines but undefines them later
-       # - certain GLUT distributions don't include it;
-       # - most of our programs are meant to be portable so don't include it.
-       #
-       # We could try to replicate the windows.h definitions required by
-       # GL/gl.h, but the build time savings don't compensate the constant
-       # headaches that brings, so instead we force windows.h to be included
-       # on every file.
-       if (MSVC)
-               add_definitions (-FIwindows.h)
-       else (MSVC)
-               add_definitions (--include windows.h)
-       endif (MSVC)
-
        # MSVC & MinGW only define & use APIENTRY
        add_definitions (-DGLAPIENTRY=__stdcall)
-
-       link_libraries (winmm)
 endif (WIN32)
 
 if (MSVC)
@@ -155,7 +137,7 @@ else ()
        add_custom_command (
                OUTPUT glxtrace.cpp
                COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glxtrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glxtrace.cpp
-               DEPENDS glxtrace.py trace.py glapi.py dl.py base.py
+               DEPENDS glxtrace.py trace.py glapi.py base.py
        )
 
        add_library (glxtrace SHARED glxtrace.cpp log.cpp os_posix.cpp)
@@ -170,7 +152,7 @@ if (GLEW_INCLUDE_DIR)
        add_custom_command (
                OUTPUT glretrace.cpp
                COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/glretrace.py > ${CMAKE_CURRENT_BINARY_DIR}/glretrace.cpp
-               DEPENDS glretrace.py glapi.py dl.py base.py
+               DEPENDS glretrace.py glapi.py base.py
        )
 
        include_directories (
index 932e6cdd2672cfc945566d9810b6ead212f9c59c..b9fa9f95857f5a0738be410fe057aa715578395c 100644 (file)
@@ -59,9 +59,9 @@ DXGI_SWAP_CHAIN_DESC = Alias("DXGI_SWAP_CHAIN_DESC", Void)
 
 d3d10_1 = Dll("d3d10")
 d3d10_1.functions += [
-    DllFunction(HRESULT, "D3D10CreateDevice1", [(Pointer(IDXGIAdapter), "pAdapter"), (D3D10_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (UINT, "Flags"), (D3D10_FEATURE_LEVEL1, "HardwareLevel"), (UINT, "SDKVersion"), (OutPointer(Pointer(ID3D10Device1)), "ppDevice")]),
-    DllFunction(HRESULT, "D3D10CreateDeviceAndSwapChain1", [(Pointer(IDXGIAdapter), "pAdapter"), (D3D10_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (UINT, "Flags"), (D3D10_FEATURE_LEVEL1, "HardwareLevel"), (UINT, "SDKVersion"), (Pointer(DXGI_SWAP_CHAIN_DESC), "pSwapChainDesc"), (OutPointer(Pointer(IDXGISwapChain)), "ppSwapChain"), (OutPointer(Pointer(ID3D10Device1)), "ppDevice")]),
-    DllFunction(HRESULT, "D3D10CreateBlob", [(SIZE_T, "NumBytes"), (OutPointer(LPD3D10BLOB), "ppBuffer")]),
+    StdFunction(HRESULT, "D3D10CreateDevice1", [(Pointer(IDXGIAdapter), "pAdapter"), (D3D10_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (UINT, "Flags"), (D3D10_FEATURE_LEVEL1, "HardwareLevel"), (UINT, "SDKVersion"), (OutPointer(Pointer(ID3D10Device1)), "ppDevice")]),
+    StdFunction(HRESULT, "D3D10CreateDeviceAndSwapChain1", [(Pointer(IDXGIAdapter), "pAdapter"), (D3D10_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (UINT, "Flags"), (D3D10_FEATURE_LEVEL1, "HardwareLevel"), (UINT, "SDKVersion"), (Pointer(DXGI_SWAP_CHAIN_DESC), "pSwapChainDesc"), (OutPointer(Pointer(IDXGISwapChain)), "ppSwapChain"), (OutPointer(Pointer(ID3D10Device1)), "ppDevice")]),
+    StdFunction(HRESULT, "D3D10CreateBlob", [(SIZE_T, "NumBytes"), (OutPointer(LPD3D10BLOB), "ppBuffer")]),
 ]
 
 if __name__ == '__main__':
index a75efb0d9e729694f210d4f1b6eacd016e223565..9e81b513bd45977c221e1b6e553e00fa857d85b6 100644 (file)
@@ -51,9 +51,9 @@ DXGI_SWAP_CHAIN_DESC = Alias("DXGI_SWAP_CHAIN_DESC", Void)
 
 d3d10 = Dll("d3d10")
 d3d10.functions += [
-    DllFunction(HRESULT, "D3D10CreateDevice", [(Pointer(IDXGIAdapter), "pAdapter"), (D3D10_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (UINT, "Flags"), (UINT, "SDKVersion"), Out(Pointer(Pointer(ID3D10Device)), "ppDevice")]),
-    DllFunction(HRESULT, "D3D10CreateDeviceAndSwapChain", [(Pointer(IDXGIAdapter), "pAdapter"), (D3D10_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (UINT, "Flags"), (UINT, "SDKVersion"), (Pointer(DXGI_SWAP_CHAIN_DESC), "pSwapChainDesc"), Out(Pointer(Pointer(IDXGISwapChain)), "ppSwapChain"), Out(Pointer(Pointer(ID3D10Device)), "ppDevice")]),
-    DllFunction(HRESULT, "D3D10CreateBlob", [(SIZE_T, "NumBytes"), Out(Pointer(LPD3D10BLOB), "ppBuffer")]),
+    StdFunction(HRESULT, "D3D10CreateDevice", [(Pointer(IDXGIAdapter), "pAdapter"), (D3D10_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (UINT, "Flags"), (UINT, "SDKVersion"), Out(Pointer(Pointer(ID3D10Device)), "ppDevice")]),
+    StdFunction(HRESULT, "D3D10CreateDeviceAndSwapChain", [(Pointer(IDXGIAdapter), "pAdapter"), (D3D10_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (UINT, "Flags"), (UINT, "SDKVersion"), (Pointer(DXGI_SWAP_CHAIN_DESC), "pSwapChainDesc"), Out(Pointer(Pointer(IDXGISwapChain)), "ppSwapChain"), Out(Pointer(Pointer(ID3D10Device)), "ppDevice")]),
+    StdFunction(HRESULT, "D3D10CreateBlob", [(SIZE_T, "NumBytes"), Out(Pointer(LPD3D10BLOB), "ppBuffer")]),
 ]
 
 if __name__ == '__main__':
diff --git a/d3d8.py b/d3d8.py
index aaa028525941ce680fa643170e64f92a02ed8b1e..a4f1f348bfb7366b0ca62aecebdd271d822c3fc4 100644 (file)
--- a/d3d8.py
+++ b/d3d8.py
@@ -275,7 +275,7 @@ IDirect3DVolume8.methods += [
 
 d3d8 = Dll("d3d8")
 d3d8.functions += [
-    DllFunction(PDIRECT3D8, "Direct3DCreate8", [(UINT, "SDKVersion")]),
+    StdFunction(PDIRECT3D8, "Direct3DCreate8", [(UINT, "SDKVersion")]),
 ]
 
 if __name__ == '__main__':
diff --git a/d3d9.py b/d3d9.py
index 7049d1d498a54bb6a3dad37597798ea24787a0c5..55f3dcd86d67fa9cdc683284a9c6315f69fd7480 100644 (file)
--- a/d3d9.py
+++ b/d3d9.py
@@ -392,15 +392,15 @@ IDirect3DSwapChain9Ex.methods += [
 
 d3d9 = Dll("d3d9")
 d3d9.functions += [
-    DllFunction(PDIRECT3D9, "Direct3DCreate9", [(UINT, "SDKVersion")], fail='NULL'),
-    DllFunction(HRESULT, "Direct3DCreate9Ex", [(UINT, "SDKVersion"), Out(Pointer(PDIRECT3D9EX), "ppD3D")], fail='D3DERR_NOTAVAILABLE'),
-    DllFunction(Int, "D3DPERF_BeginEvent", [(D3DCOLOR, "col"), (LPCWSTR, "wszName")], fail='-1'),
-    DllFunction(Int, "D3DPERF_EndEvent", [], fail='-1'),
-    DllFunction(Void, "D3DPERF_SetMarker", [(D3DCOLOR, "col"), (LPCWSTR, "wszName")], fail=''),
-    DllFunction(Void, "D3DPERF_SetRegion", [(D3DCOLOR, "col"), (LPCWSTR, "wszName")], fail=''),
-    DllFunction(BOOL, "D3DPERF_QueryRepeatFrame", [], fail='FALSE'),
-    DllFunction(Void, "D3DPERF_SetOptions", [(DWORD, "dwOptions")], fail=''),
-    DllFunction(DWORD, "D3DPERF_GetStatus", [], fail='0'),
+    StdFunction(PDIRECT3D9, "Direct3DCreate9", [(UINT, "SDKVersion")], fail='NULL'),
+    StdFunction(HRESULT, "Direct3DCreate9Ex", [(UINT, "SDKVersion"), Out(Pointer(PDIRECT3D9EX), "ppD3D")], fail='D3DERR_NOTAVAILABLE'),
+    StdFunction(Int, "D3DPERF_BeginEvent", [(D3DCOLOR, "col"), (LPCWSTR, "wszName")], fail='-1'),
+    StdFunction(Int, "D3DPERF_EndEvent", [], fail='-1'),
+    StdFunction(Void, "D3DPERF_SetMarker", [(D3DCOLOR, "col"), (LPCWSTR, "wszName")], fail=''),
+    StdFunction(Void, "D3DPERF_SetRegion", [(D3DCOLOR, "col"), (LPCWSTR, "wszName")], fail=''),
+    StdFunction(BOOL, "D3DPERF_QueryRepeatFrame", [], fail='FALSE'),
+    StdFunction(Void, "D3DPERF_SetOptions", [(DWORD, "dwOptions")], fail=''),
+    StdFunction(DWORD, "D3DPERF_GetStatus", [], fail='0'),
 ]
 
 if __name__ == '__main__':
index 515c3c4e74e6362e1f70af1c99238d467c6b9ed1..50ca351904a2268ba55480c510264bceb3deb8e9 100644 (file)
@@ -461,6 +461,6 @@ D3DFINDDEVICERESULT = Struct("D3DFINDDEVICERESULT", [
 ])
 LPD3DFINDDEVICERESULT = Pointer(D3DFINDDEVICERESULT)
 
-LPD3DENUMDEVICESCALLBACK = DllFunction(HRESULT, "LPD3DENUMDEVICESCALLBACK", [(Pointer(GUID), "lpGuid"), (LPSTR, "lpDeviceDescription"), (LPSTR, "lpDeviceName"), LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID])
-LPD3DENUMDEVICESCALLBACK7 = DllFunction(HRESULT, "LPD3DENUMDEVICESCALLBACK7", [(LPSTR, "lpDeviceDescription"), (LPSTR, "lpDeviceName"), LPD3DDEVICEDESC7, LPVOID])
+LPD3DENUMDEVICESCALLBACK = StdFunction(HRESULT, "LPD3DENUMDEVICESCALLBACK", [(Pointer(GUID), "lpGuid"), (LPSTR, "lpDeviceDescription"), (LPSTR, "lpDeviceName"), LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID])
+LPD3DENUMDEVICESCALLBACK7 = StdFunction(HRESULT, "LPD3DENUMDEVICESCALLBACK7", [(LPSTR, "lpDeviceDescription"), (LPSTR, "lpDeviceName"), LPD3DDEVICEDESC7, LPVOID])
 
index 8f3f2415f0c645bb712c6d743ba4e48d17b9898e..bc2065b5fce7c9c14a9268eaa9c094e696e3738a 100644 (file)
--- a/ddraw.py
+++ b/ddraw.py
@@ -1605,13 +1605,13 @@ DDCREATE = Flags(DWORD, [
 
 ddraw = Dll("ddraw")
 ddraw.functions += [
-    DllFunction(HRESULT, "DirectDrawEnumerateW", [(LPDDENUMCALLBACKW, "lpCallback"), (LPVOID, "lpContext")]),
-    DllFunction(HRESULT, "DirectDrawEnumerateA", [(LPDDENUMCALLBACKA, "lpCallback"), (LPVOID, "lpContext")]),
-    DllFunction(HRESULT, "DirectDrawEnumerateExW", [(LPDDENUMCALLBACKEXW, "lpCallback"), (LPVOID, "lpContext"), (DDENUM, "dwFlags")]),
-    DllFunction(HRESULT, "DirectDrawEnumerateExA", [(LPDDENUMCALLBACKEXA, "lpCallback"), (LPVOID, "lpContext"), (DDENUM, "dwFlags")]),
-    DllFunction(HRESULT, "DirectDrawCreate", [(Pointer(GUID), "lpGUID"), Out(Pointer(LPDIRECTDRAW), "lplpDD"), (Pointer(IUnknown), "pUnkOuter")]),
-    DllFunction(HRESULT, "DirectDrawCreateEx", [(Pointer(GUID), "lpGuid"), Out(Pointer(LPVOID), "lplpDD"), (REFIID, "iid"), (Pointer(IUnknown), "pUnkOuter")]),
-    DllFunction(HRESULT, "DirectDrawCreateClipper", [(DWORD, "dwFlags"), Out(Pointer(LPDIRECTDRAWCLIPPER), "lplpDDClipper"), (Pointer(IUnknown), "pUnkOuter")]),
+    StdFunction(HRESULT, "DirectDrawEnumerateW", [(LPDDENUMCALLBACKW, "lpCallback"), (LPVOID, "lpContext")]),
+    StdFunction(HRESULT, "DirectDrawEnumerateA", [(LPDDENUMCALLBACKA, "lpCallback"), (LPVOID, "lpContext")]),
+    StdFunction(HRESULT, "DirectDrawEnumerateExW", [(LPDDENUMCALLBACKEXW, "lpCallback"), (LPVOID, "lpContext"), (DDENUM, "dwFlags")]),
+    StdFunction(HRESULT, "DirectDrawEnumerateExA", [(LPDDENUMCALLBACKEXA, "lpCallback"), (LPVOID, "lpContext"), (DDENUM, "dwFlags")]),
+    StdFunction(HRESULT, "DirectDrawCreate", [(Pointer(GUID), "lpGUID"), Out(Pointer(LPDIRECTDRAW), "lplpDD"), (Pointer(IUnknown), "pUnkOuter")]),
+    StdFunction(HRESULT, "DirectDrawCreateEx", [(Pointer(GUID), "lpGuid"), Out(Pointer(LPVOID), "lplpDD"), (REFIID, "iid"), (Pointer(IUnknown), "pUnkOuter")]),
+    StdFunction(HRESULT, "DirectDrawCreateClipper", [(DWORD, "dwFlags"), Out(Pointer(LPDIRECTDRAWCLIPPER), "lplpDDClipper"), (Pointer(IUnknown), "pUnkOuter")]),
 ]
 
 if __name__ == '__main__':
diff --git a/dl.py b/dl.py
deleted file mode 100644 (file)
index 1edcec7..0000000
--- a/dl.py
+++ /dev/null
@@ -1,81 +0,0 @@
-##########################################################################
-#
-# Copyright 2008-2010 VMware, Inc.
-# All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-##########################################################################/
-
-"""dl"""
-
-
-from base import *
-
-
-class DllFunction(Function):
-
-    def __init__(self, type, name, args, call = '', **kwargs):
-        Function.__init__(self, type, name, args, call=call, **kwargs)
-        
-    def get_true_pointer(self):
-        ptype = self.pointer_type()
-        pvalue = self.pointer_value()
-        print '    if(!%s) {' % (pvalue,)
-        print '        %s = (%s)dlsym(RTLD_NEXT, "%s");' % (pvalue, ptype, self.name)
-        print '        if(!%s)' % (pvalue,)
-        self.fail_impl()
-        print '    }'
-
-
-class Dll:
-
-    def __init__(self, name):
-        self.name = name
-        self.functions = []
-        if self not in towrap:
-            towrap.append(self)
-
-    def wrap_name(self):
-        return "Wrap" + self.name
-
-    def wrap_pre_decl(self):
-        pass
-
-    def wrap_decl(self):
-        for function in self.functions:
-            function.wrap_decl()
-        print
-
-    def wrap_impl(self):
-        for function in self.functions:
-            function.wrap_impl()
-        print
-        print '''
-static void _init(void) __attribute__((constructor));
-static void _init(void) {'''
-        print r'        Log::Open("%s");' % self.name
-        print '''}
-
-static void _uninit(void) __attribute__((destructor));
-static void _uninit(void) {
-    Log::Close();
-}
-'''
-