]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Tools/bgen/bgen/bgenStackBuffer.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Tools / bgen / bgen / bgenStackBuffer.py
CommitLineData
4710c53d 1"""Buffers allocated on the stack."""\r
2\r
3\r
4from bgenBuffer import FixedInputBufferType, FixedOutputBufferType\r
5\r
6\r
7class StackOutputBufferType(FixedOutputBufferType):\r
8\r
9 """Fixed output buffer allocated on the stack -- passed as (buffer, size).\r
10\r
11 Instantiate with the buffer size as parameter.\r
12 """\r
13\r
14 def passOutput(self, name):\r
15 return "%s__out__, %s" % (name, self.size)\r
16\r
17\r
18class VarStackOutputBufferType(StackOutputBufferType):\r
19\r
20 """Output buffer allocated on the stack -- passed as (buffer, &size).\r
21\r
22 Instantiate with the buffer size as parameter.\r
23 """\r
24\r
25 def getSizeDeclarations(self, name):\r
26 return []\r
27\r
28 def getAuxDeclarations(self, name):\r
29 return ["int %s__len__ = %s" % (name, self.size)]\r
30\r
31 def passOutput(self, name):\r
32 return "%s__out__, &%s__len__" % (name, name)\r
33\r
34 def mkvalueArgs(self, name):\r
35 return "%s__out__, (int)%s__len__" % (name, name)\r
36\r
37\r
38class VarVarStackOutputBufferType(VarStackOutputBufferType):\r
39\r
40 """Output buffer allocated on the stack -- passed as (buffer, size, &size).\r
41\r
42 Instantiate with the buffer size as parameter.\r
43 """\r
44\r
45 def passOutput(self, name):\r
46 return "%s__out__, %s__len__, &%s__len__" % (name, name, name)\r
47\r
48\r
49class ReturnVarStackOutputBufferType(VarStackOutputBufferType):\r
50\r
51 """Output buffer allocated on the stack -- passed as (buffer, size) -> size.\r
52\r
53 Instantiate with the buffer size as parameter.\r
54 The function's return value is the size.\r
55 (XXX Should have a way to suppress returning it separately, too.)\r
56 """\r
57\r
58 def passOutput(self, name):\r
59 return "%s__out__, %s__len__" % (name, name)\r
60\r
61 def mkvalueArgs(self, name):\r
62 return "%s__out__, (int)_rv" % name\r