Skip to content
Browse files

Specify constant array lengths as integers.

  • Loading branch information...
1 parent 46a4839 commit 44756655362254679ae8b6ecad66104175b5e773 @jrfonseca jrfonseca committed Oct 15, 2011
Showing with 380 additions and 367 deletions.
  1. +2 −2 specs/cglapi.py
  2. +6 −6 specs/d3d10.py
  3. +4 −4 specs/d3d8types.py
  4. +4 −4 specs/d3d9types.py
  5. +2 −2 specs/d3dtypes.py
  6. +3 −3 specs/ddraw.py
  7. +2 −2 specs/dxgi.py
  8. +2 −2 specs/dxgitype.py
  9. +338 −338 specs/glapi.py
  10. +5 −1 specs/scripts/cdecl.py
  11. +8 −2 specs/scripts/glspec.py
  12. +3 −0 specs/scripts/gltxt.py
  13. +1 −1 specs/winapi.py
View
4 specs/cglapi.py
@@ -222,8 +222,8 @@
Function(CGLError, "CGLEnable", [(CGLContextObj, "ctx"), (CGLContextEnable, "pname")]),
Function(CGLError, "CGLDisable", [(CGLContextObj, "ctx"), (CGLContextEnable, "pname")]),
Function(CGLError, "CGLIsEnabled", [(CGLContextObj, "ctx"), (CGLContextEnable, "pname"), Out(Pointer(GLint), "enable")]),
- Function(CGLError, "CGLSetParameter", [(CGLContextObj, "ctx"), (CGLContextParameter, "pname"), (Array(Const(GLint), "1"), "params")]),
- Function(CGLError, "CGLGetParameter", [(CGLContextObj, "ctx"), (CGLContextParameter, "pname"), Out(Array(GLint, "1"), "params")]),
+ Function(CGLError, "CGLSetParameter", [(CGLContextObj, "ctx"), (CGLContextParameter, "pname"), (Array(Const(GLint), 1), "params")]),
+ Function(CGLError, "CGLGetParameter", [(CGLContextObj, "ctx"), (CGLContextParameter, "pname"), Out(Array(GLint, 1), "params")]),
Function(CGLError, "CGLSetVirtualScreen", [(CGLContextObj, "ctx"), (GLint, "screen")]),
Function(CGLError, "CGLGetVirtualScreen", [(CGLContextObj, "ctx"), Out(Pointer(GLint), "screen")]),
Function(CGLError, "CGLSetGlobalOption", [(CGLGlobalOption, "pname"), (OpaquePointer(Const(GLint)), "params")]),
View
12 specs/d3d10.py
@@ -55,14 +55,14 @@
D3D10_BLEND_DESC = Struct("D3D10_BLEND_DESC", [
(BOOL, "AlphaToCoverageEnable"),
- (Array(BOOL, "8"), "BlendEnable"),
+ (Array(BOOL, 8), "BlendEnable"),
(D3D10_BLEND, "SrcBlend"),
(D3D10_BLEND, "DestBlend"),
(D3D10_BLEND_OP, "BlendOp"),
(D3D10_BLEND, "SrcBlendAlpha"),
(D3D10_BLEND, "DestBlendAlpha"),
(D3D10_BLEND_OP, "BlendOpAlpha"),
- (Array(UINT8, "8"), "RenderTargetWriteMask"),
+ (Array(UINT8, 8), "RenderTargetWriteMask"),
])
D3D10_DEPTH_WRITE_MASK = Enum("D3D10_DEPTH_WRITE_MASK", [
@@ -172,7 +172,7 @@
(FLOAT, "MipLODBias"),
(UINT, "MaxAnisotropy"),
(D3D10_COMPARISON_FUNC, "ComparisonFunc"),
- (Array(FLOAT, "4"), "BorderColor"),
+ (Array(FLOAT, 4), "BorderColor"),
(FLOAT, "MinLOD"),
(FLOAT, "MaxLOD"),
])
@@ -819,7 +819,7 @@
Method(Void, "GSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(OpaquePointer(ID3D10ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
Method(Void, "GSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(OpaquePointer(ID3D10SamplerState)), "NumSamplers"), "ppSamplers")]),
Method(Void, "OMSetRenderTargets", [(UINT, "NumViews"), (Array(Const(OpaquePointer(ID3D10RenderTargetView)), "NumViews"), "ppRenderTargetViews"), (Pointer(ID3D10DepthStencilView), "pDepthStencilView")]),
- Method(Void, "OMSetBlendState", [(Pointer(ID3D10BlendState), "pBlendState"), (Array(Const(FLOAT), "4"), "BlendFactor"), (UINT, "SampleMask")]),
+ Method(Void, "OMSetBlendState", [(Pointer(ID3D10BlendState), "pBlendState"), (Array(Const(FLOAT), 4), "BlendFactor"), (UINT, "SampleMask")]),
Method(Void, "OMSetDepthStencilState", [(Pointer(ID3D10DepthStencilState), "pDepthStencilState"), (UINT, "StencilRef")]),
Method(Void, "SOSetTargets", [(UINT, "NumBuffers"), (Array(Const(OpaquePointer(ID3D10Buffer)), "NumBuffers"), "ppSOTargets"), (Array(Const(UINT), "NumBuffers"), "pOffsets")]),
Method(Void, "DrawAuto", []),
@@ -829,7 +829,7 @@
Method(Void, "CopySubresourceRegion", [(Pointer(ID3D10Resource), "pDstResource"), (UINT, "DstSubresource"), (UINT, "DstX"), (UINT, "DstY"), (UINT, "DstZ"), (Pointer(ID3D10Resource), "pSrcResource"), (UINT, "SrcSubresource"), (Pointer(Const(D3D10_BOX)), "pSrcBox")]),
Method(Void, "CopyResource", [(Pointer(ID3D10Resource), "pDstResource"), (Pointer(ID3D10Resource), "pSrcResource")]),
Method(Void, "UpdateSubresource", [(Pointer(ID3D10Resource), "pDstResource"), (UINT, "DstSubresource"), (Pointer(Const(D3D10_BOX)), "pDstBox"), (OpaquePointer(Const(Void)), "pSrcData"), (UINT, "SrcRowPitch"), (UINT, "SrcDepthPitch")]),
- Method(Void, "ClearRenderTargetView", [(OpaquePointer(ID3D10RenderTargetView), "pRenderTargetView"), (Array(Const(FLOAT), "4"), "ColorRGBA")]),
+ Method(Void, "ClearRenderTargetView", [(OpaquePointer(ID3D10RenderTargetView), "pRenderTargetView"), (Array(Const(FLOAT), 4), "ColorRGBA")]),
Method(Void, "ClearDepthStencilView", [(Pointer(ID3D10DepthStencilView), "pDepthStencilView"), (UINT, "ClearFlags"), (FLOAT, "Depth"), (UINT8, "Stencil")]),
Method(Void, "GenerateMips", [(OpaquePointer(ID3D10ShaderResourceView), "pShaderResourceView")]),
Method(Void, "ResolveSubresource", [(Pointer(ID3D10Resource), "pDstResource"), (UINT, "DstSubresource"), (Pointer(ID3D10Resource), "pSrcResource"), (UINT, "SrcSubresource"), (DXGI_FORMAT, "Format")]),
@@ -851,7 +851,7 @@
Method(Void, "GSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), Out(Array(OpaquePointer(ID3D10ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
Method(Void, "GSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), Out(Array(OpaquePointer(ID3D10SamplerState), "NumSamplers"), "ppSamplers")]),
Method(Void, "OMGetRenderTargets", [(UINT, "NumViews"), Out(Array(OpaquePointer(ID3D10RenderTargetView), "NumViews"), "ppRenderTargetViews"), Out(Pointer(Pointer(ID3D10DepthStencilView)), "ppDepthStencilView")]),
- Method(Void, "OMGetBlendState", [Out(Pointer(Pointer(ID3D10BlendState)), "ppBlendState"), Out(Array(FLOAT, "4"), "BlendFactor"), Out(Pointer(UINT), "pSampleMask")]),
+ Method(Void, "OMGetBlendState", [Out(Pointer(Pointer(ID3D10BlendState)), "ppBlendState"), Out(Array(FLOAT, 4), "BlendFactor"), Out(Pointer(UINT), "pSampleMask")]),
Method(Void, "OMGetDepthStencilState", [Out(Pointer(Pointer(ID3D10DepthStencilState)), "ppDepthStencilState"), Out(Pointer(UINT), "pStencilRef")]),
Method(Void, "SOGetTargets", [(UINT, "NumBuffers"), Out(Array(OpaquePointer(ID3D10Buffer), "NumBuffers"), "ppSOTargets"), Out(Array(UINT, "NumBuffers"), "pOffsets")]),
Method(Void, "RSGetState", [Out(Pointer(Pointer(ID3D10RasterizerState)), "ppRasterizerState")]),
View
8 specs/d3d8types.py
@@ -50,7 +50,7 @@
])
D3DMATRIX = Struct("D3DMATRIX", [
- (Array(Array(Float, "4"), "4"), "m"),
+ (Array(Array(Float, 4), "4"), "m"),
])
D3DVIEWPORT8 = Struct("D3DVIEWPORT8", [
@@ -828,9 +828,9 @@
])
D3DGAMMARAMP = Struct("D3DGAMMARAMP", [
- (Array(WORD, "256"), "red"),
- (Array(WORD, "256"), "green"),
- (Array(WORD, "256"), "blue"),
+ (Array(WORD, 256), "red"),
+ (Array(WORD, 256), "green"),
+ (Array(WORD, 256), "blue"),
])
D3DBACKBUFFER_TYPE = Enum("D3DBACKBUFFER_TYPE", [
View
8 specs/d3d9types.py
@@ -50,7 +50,7 @@
])
D3DMATRIX = Struct("D3DMATRIX", [
- (Array(Array(Float, "4"), "4"), "m"),
+ (Array(Array(Float, 4), "4"), "m"),
])
D3DVIEWPORT9 = Struct("D3DVIEWPORT9", [
@@ -1015,9 +1015,9 @@
])
D3DGAMMARAMP = Struct("D3DGAMMARAMP", [
- (Array(WORD, "256"), "red"),
- (Array(WORD, "256"), "green"),
- (Array(WORD, "256"), "blue"),
+ (Array(WORD, 256), "red"),
+ (Array(WORD, 256), "green"),
+ (Array(WORD, 256), "blue"),
])
D3DBACKBUFFER_TYPE = Enum("D3DBACKBUFFER_TYPE", [
View
4 specs/d3dtypes.py
@@ -664,8 +664,8 @@
(D3DTRANSFORMSTATETYPE, "dtstTransformStateType"),
(D3DLIGHTSTATETYPE, "dlstLightStateType"),
(D3DRENDERSTATETYPE, "drstRenderStateType"),
- (Array(DWORD, "1"), "dwArg"),
- (Array(D3DVALUE, "1"), "dvArg"),
+ (Array(DWORD, 1), "dwArg"),
+ (Array(D3DVALUE, 1), "dvArg"),
])
D3DMATRIXLOAD = Struct("D3DMATRIXLOAD", [
View
6 specs/ddraw.py
@@ -496,9 +496,9 @@
LPDDBLTBATCH = Pointer(DDBLTBATCH)
DDGAMMARAMP = Struct("DDGAMMARAMP", [
- (Array(WORD, "256"), "red"),
- (Array(WORD, "256"), "green"),
- (Array(WORD, "256"), "blue"),
+ (Array(WORD, 256), "red"),
+ (Array(WORD, 256), "green"),
+ (Array(WORD, 256), "blue"),
])
LPDDGAMMARAMP = Pointer(DDGAMMARAMP)
View
4 specs/dxgi.py
@@ -56,7 +56,7 @@
])
DXGI_OUTPUT_DESC = Struct("DXGI_OUTPUT_DESC", [
- (Array(WCHAR, "32"), "DeviceName"),
+ (Array(WCHAR, 32), "DeviceName"),
(RECT, "DesktopCoordinates"),
(BOOL, "AttachedToDesktop"),
(DXGI_MODE_ROTATION, "Rotation"),
@@ -72,7 +72,7 @@
])
DXGI_ADAPTER_DESC = Struct("DXGI_ADAPTER_DESC", [
- (Array(WCHAR, "128"), "Description"),
+ (Array(WCHAR, 128), "Description"),
(UINT, "VendorId"),
(UINT, "DeviceId"),
(UINT, "SubSysId"),
View
4 specs/dxgitype.py
@@ -34,15 +34,15 @@
DXGI_GAMMA_CONTROL = Struct("DXGI_GAMMA_CONTROL", [
(DXGI_RGB, "Scale"),
(DXGI_RGB, "Offset"),
- (Array(DXGI_RGB, "1025"), "GammaCurve"),
+ (Array(DXGI_RGB, 1025), "GammaCurve"),
])
DXGI_GAMMA_CONTROL_CAPABILITIES = Struct("DXGI_GAMMA_CONTROL_CAPABILITIES", [
(BOOL, "ScaleAndOffsetSupported"),
(Float, "MaxConvertedValue"),
(Float, "MinConvertedValue"),
(UINT, "NumGammaControlPoints"),
- (Array(Float, "1025"), "ControlPointPositions"),
+ (Array(Float, 1025), "ControlPointPositions"),
])
DXGI_RATIONAL = Struct("DXGI_RATIONAL", [
View
676 specs/glapi.py
338 additions, 338 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
6 specs/scripts/cdecl.py
@@ -275,7 +275,11 @@ def parse_named_type(self):
self.consume()
length = self.consume()
self.consume(']')
- type = 'Array(%s, "%s")' % (type, length)
+ try:
+ int(length)
+ except ValueError:
+ length = "%s" % length
+ type = 'Array(%s, %s)' % (type, length)
return type, name
int_tokens = ('unsigned', 'signed', 'int', 'long', 'short', 'char')
View
10 specs/scripts/glspec.py
@@ -24,6 +24,8 @@
#
##########################################################################/
+"""Parser for OpenGL .spec files in http://www.opengl.org/registry/."""
+
import sys
import re
@@ -230,11 +232,15 @@ def parse_arg(self, function_name, arg_name, arg_type):
elif length == '1':
arg_type = 'Pointer(%s)' % base_type
elif length.find("COMPSIZE") == -1:
- arg_type = '%s(%s, "%s")' % (constructor, base_type, length)
+ try:
+ int(length)
+ except ValueError:
+ length = "%s" % length
+ arg_type = '%s(%s, %s)' % (constructor, base_type, length)
else:
length = length.replace("COMPSIZE", "__%s_size" % function_name)
length = length.replace("/", ", ")
- arg_type = 'Opaque%s(%s, "%s")' % (constructor, base_type, length)
+ arg_type = 'Opaque%s(%s, %s)' % (constructor, base_type, length)
else:
assert False
View
3 specs/scripts/gltxt.py
@@ -25,6 +25,9 @@
##########################################################################/
+"""Parser for OpenGL .txt extensions specification."""
+
+
import sys
import re
import optparse
View
2 specs/winapi.py
@@ -83,7 +83,7 @@
(DWORD, "Data1"),
(WORD, "Data2"),
(WORD, "Data3"),
- (Array(BYTE, "8"), "Data4"),
+ (Array(BYTE, 8), "Data4"),
])
LPGUID = Pointer(GUID)

0 comments on commit 4475665

Please sign in to comment.
Something went wrong with that request. Please try again.