]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Tools/bgen/bgen/bgenStackBuffer.py
1 """Buffers allocated on the stack."""
4 from bgenBuffer
import FixedInputBufferType
, FixedOutputBufferType
7 class StackOutputBufferType(FixedOutputBufferType
):
9 """Fixed output buffer allocated on the stack -- passed as (buffer, size).
11 Instantiate with the buffer size as parameter.
14 def passOutput(self
, name
):
15 return "%s__out__, %s" % (name
, self
.size
)
18 class VarStackOutputBufferType(StackOutputBufferType
):
20 """Output buffer allocated on the stack -- passed as (buffer, &size).
22 Instantiate with the buffer size as parameter.
25 def getSizeDeclarations(self
, name
):
28 def getAuxDeclarations(self
, name
):
29 return ["int %s__len__ = %s" % (name
, self
.size
)]
31 def passOutput(self
, name
):
32 return "%s__out__, &%s__len__" % (name
, name
)
34 def mkvalueArgs(self
, name
):
35 return "%s__out__, (int)%s__len__" % (name
, name
)
38 class VarVarStackOutputBufferType(VarStackOutputBufferType
):
40 """Output buffer allocated on the stack -- passed as (buffer, size, &size).
42 Instantiate with the buffer size as parameter.
45 def passOutput(self
, name
):
46 return "%s__out__, %s__len__, &%s__len__" % (name
, name
, name
)
49 class ReturnVarStackOutputBufferType(VarStackOutputBufferType
):
51 """Output buffer allocated on the stack -- passed as (buffer, size) -> size.
53 Instantiate with the buffer size as parameter.
54 The function's return value is the size.
55 (XXX Should have a way to suppress returning it separately, too.)
58 def passOutput(self
, name
):
59 return "%s__out__, %s__len__" % (name
, name
)
61 def mkvalueArgs(self
, name
):
62 return "%s__out__, (int)_rv" % name