[Python-checkins] python/dist/src/Tools/bgen/bgen bgenHeapBuffer.py, 1.8, 1.9

jackjansen@users.sourceforge.net jackjansen at users.sourceforge.net
Tue Sep 20 23:11:23 CEST 2005


Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26912

Modified Files:
	bgenHeapBuffer.py 
Log Message:
Added a class MallocHeapOutputBufferType for types that are passed
as &buffer, &size and allocated by the called function.


Index: bgenHeapBuffer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenHeapBuffer.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- bgenHeapBuffer.py	10 Jul 2005 20:37:50 -0000	1.8
+++ bgenHeapBuffer.py	20 Sep 2005 21:11:19 -0000	1.9
@@ -111,3 +111,32 @@
 
     def passOutput(self, name):
         return "%s__out__, %s__len__, &%s__len__" % (name, name, name)
+        
+class MallocHeapOutputBufferType(HeapOutputBufferType):
+    """Output buffer allocated by the called function -- passed as (&buffer, &size).
+    
+    Instantiate without parameters.
+    Call from Python without parameters.
+    """
+
+    def getargsCheck(self, name):
+        Output("%s__out__ = NULL;", name)
+
+    def getAuxDeclarations(self, name):
+        return []
+        
+    def passOutput(self, name):
+        return "&%s__out__, &%s__len__" % (name, name)
+
+    def getargsFormat(self):
+        return ""
+
+    def getargsArgs(self, name):
+        return None
+        
+    def mkvalueFormat(self):
+        return "z#"
+        
+    def cleanup(self, name):
+        Output("if( %s__out__ ) free(%s__out__);", name, name)
+



More information about the Python-checkins mailing list