From 9dd8f7079ebc7f203e86ecf7c7da58aec082c4ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 7 Apr 2012 10:42:50 +0100 Subject: [PATCH] Allow InOut arguments. --- specs/d3d9.py | 2 +- specs/stdapi.py | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/specs/d3d9.py b/specs/d3d9.py index 85a7f8b..9b2b179 100644 --- a/specs/d3d9.py +++ b/specs/d3d9.py @@ -167,7 +167,7 @@ IDirect3D9.methods += [ Method(HRESULT, "CheckDeviceFormatConversion", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (D3DFORMAT, "SourceFormat"), (D3DFORMAT, "TargetFormat")], sideeffects=False), Method(HRESULT, "GetDeviceCaps", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), Out(Pointer(D3DCAPS9), "pCaps")], sideeffects=False), Method(HMONITOR, "GetAdapterMonitor", [(UINT, "Adapter")], sideeffects=False), - Method(HRESULT, "CreateDevice", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (HWND, "hFocusWindow"), (D3DCREATE, "BehaviorFlags"), Out(Pointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), Out(Pointer(PDIRECT3DDEVICE9), "ppReturnedDeviceInterface")]), + Method(HRESULT, "CreateDevice", [(UINT, "Adapter"), (D3DDEVTYPE, "DeviceType"), (HWND, "hFocusWindow"), (D3DCREATE, "BehaviorFlags"), InOut(Pointer(D3DPRESENT_PARAMETERS), "pPresentationParameters"), Out(Pointer(PDIRECT3DDEVICE9), "ppReturnedDeviceInterface")]), ] IDirect3DDevice9.methods += [ diff --git a/specs/stdapi.py b/specs/stdapi.py index 51ee674..c74d311 100644 --- a/specs/stdapi.py +++ b/specs/stdapi.py @@ -272,17 +272,12 @@ class Alias(Type): def visit(self, visitor, *args, **kwargs): return visitor.visitAlias(self, *args, **kwargs) - -def Out(type, name): - arg = Arg(type, name, output=True) - return arg - - class Arg: - def __init__(self, type, name, output=False): + def __init__(self, type, name, input=True, output=False): self.type = type self.name = name + self.input = input self.output = output self.index = None @@ -290,6 +285,16 @@ class Arg: return '%s %s' % (self.type, self.name) +def In(type, name): + return Arg(type, name, input=True, output=False) + +def Out(type, name): + return Arg(type, name, input=False, output=True) + +def InOut(type, name): + return Arg(type, name, input=True, output=True) + + class Function: # 0-3 are reserved to memcpy, malloc, free, and realloc -- 2.7.4