]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Tools/bgen/bgen/bgenHeapBuffer.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Tools / bgen / bgen / bgenHeapBuffer.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Tools/bgen/bgen/bgenHeapBuffer.py b/AppPkg/Applications/Python/Python-2.7.2/Tools/bgen/bgen/bgenHeapBuffer.py
deleted file mode 100644 (file)
index 5abfca2..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-# Buffers allocated on the heap\r
-\r
-from bgenOutput import *\r
-from bgenType import OutputOnlyMixIn\r
-from bgenBuffer import FixedInputOutputBufferType\r
-\r
-\r
-class HeapInputOutputBufferType(FixedInputOutputBufferType):\r
-\r
-    """Input-output buffer allocated on the heap -- passed as (inbuffer, outbuffer, size).\r
-\r
-    Instantiate without parameters.\r
-    Call from Python with input buffer.\r
-    """\r
-\r
-    def __init__(self, datatype = 'char', sizetype = 'int', sizeformat = None):\r
-        FixedInputOutputBufferType.__init__(self, "0", datatype, sizetype, sizeformat)\r
-\r
-    def getOutputBufferDeclarations(self, name, constmode=False, outmode=False):\r
-        if constmode:\r
-            raise RuntimeError, "Cannot use const output buffer"\r
-        if outmode:\r
-            out = "*"\r
-        else:\r
-            out = ""\r
-        return ["%s%s *%s__out__" % (self.datatype, out, name)]\r
-\r
-    def getargsCheck(self, name):\r
-        Output("if ((%s__out__ = malloc(%s__in_len__)) == NULL)", name, name)\r
-        OutLbrace()\r
-        Output('PyErr_NoMemory();')\r
-        Output("goto %s__error__;", name)\r
-        self.label_needed = 1\r
-        OutRbrace()\r
-        Output("%s__len__ = %s__in_len__;", name, name)\r
-\r
-    def passOutput(self, name):\r
-        return "%s__in__, %s__out__, (%s)%s__len__" % \\r
-            (name, name, self.sizetype, name)\r
-\r
-    def mkvalueArgs(self, name):\r
-        return "%s__out__, (int)%s__len__" % (name, name)\r
-\r
-    def cleanup(self, name):\r
-        Output("free(%s__out__);", name)\r
-        FixedInputOutputBufferType.cleanup(self, name)\r
-\r
-\r
-class VarHeapInputOutputBufferType(HeapInputOutputBufferType):\r
-\r
-    """same as base class, but passed as (inbuffer, outbuffer, &size)"""\r
-\r
-    def passOutput(self, name):\r
-        return "%s__in__, %s__out__, &%s__len__" % (name, name, name)\r
-\r
-\r
-class HeapCombinedInputOutputBufferType(HeapInputOutputBufferType):\r
-\r
-    """same as base class, but passed as (inoutbuffer, size)"""\r
-\r
-    def passOutput(self, name):\r
-        return "(%s *)memcpy(%s__out__, %s__in__, %s__len__)" % \\r
-            (self.datatype, name,   name,     name)\r
-\r
-\r
-class VarHeapCombinedInputOutputBufferType(HeapInputOutputBufferType):\r
-\r
-    """same as base class, but passed as (inoutbuffer, &size)"""\r
-\r
-    def passOutput(self, name):\r
-        return "(%s *)memcpy(%s__out__, %s__in__, &%s__len__)" % \\r
-            (self.datatype, name,   name,      name)\r
-\r
-\r
-class HeapOutputBufferType(OutputOnlyMixIn, HeapInputOutputBufferType):\r
-\r
-    """Output buffer allocated on the heap -- passed as (buffer, size).\r
-\r
-    Instantiate without parameters.\r
-    Call from Python with buffer size.\r
-    """\r
-\r
-    def getInputBufferDeclarations(self, name, constmode=False):\r
-        return []\r
-\r
-    def getargsFormat(self):\r
-        return "i"\r
-\r
-    def getargsArgs(self, name):\r
-        return "&%s__in_len__" % name\r
-\r
-    def passOutput(self, name):\r
-        return "%s__out__, %s__len__" % (name, name)\r
-\r
-\r
-class VarHeapOutputBufferType(HeapOutputBufferType):\r
-\r
-    """Output buffer allocated on the heap -- passed as (buffer, &size).\r
-\r
-    Instantiate without parameters.\r
-    Call from Python with buffer size.\r
-    """\r
-\r
-    def passOutput(self, name):\r
-        return "%s__out__, &%s__len__" % (name, name)\r
-\r
-\r
-class VarVarHeapOutputBufferType(VarHeapOutputBufferType):\r
-\r
-    """Output buffer allocated on the heap -- passed as (buffer, size, &size).\r
-\r
-    Instantiate without parameters.\r
-    Call from Python with buffer size.\r
-    """\r
-\r
-    def passOutput(self, name):\r
-        return "%s__out__, %s__len__, &%s__len__" % (name, name, name)\r
-\r
-class MallocHeapOutputBufferType(HeapOutputBufferType):\r
-    """Output buffer allocated by the called function -- passed as (&buffer, &size).\r
-\r
-    Instantiate without parameters.\r
-    Call from Python without parameters.\r
-    """\r
-\r
-    def getargsCheck(self, name):\r
-        Output("%s__out__ = NULL;", name)\r
-\r
-    def getAuxDeclarations(self, name):\r
-        return []\r
-\r
-    def passOutput(self, name):\r
-        return "&%s__out__, &%s__len__" % (name, name)\r
-\r
-    def getargsFormat(self):\r
-        return ""\r
-\r
-    def getargsArgs(self, name):\r
-        return None\r
-\r
-    def mkvalueFormat(self):\r
-        return "z#"\r
-\r
-    def cleanup(self, name):\r
-        Output("if( %s__out__ ) free(%s__out__);", name, name)\r