@@ -38,15 +38,15 @@ def __init__(self, size, datatype = 'char', sizetype = 'int', sizeformat = None)
3838 self .sizeformat = sizeformat or type2format [sizetype ]
3939 self .label_needed = 0
4040
41- def getArgDeclarations (self , name , reference = False , constmode = False ):
41+ def getArgDeclarations (self , name , reference = False , constmode = False , outmode = False ):
4242 if reference :
4343 raise RuntimeError , "Cannot pass buffer types by reference"
4444 return (self .getBufferDeclarations (name , constmode ) +
45- self .getSizeDeclarations (name ))
45+ self .getSizeDeclarations (name , outmode ))
4646
47- def getBufferDeclarations (self , name , constmode = False ):
47+ def getBufferDeclarations (self , name , constmode = False , outmode = False ):
4848 return self .getInputBufferDeclarations (name , constmode ) + \
49- self .getOutputBufferDeclarations (name , constmode )
49+ self .getOutputBufferDeclarations (name , constmode , outmode )
5050
5151 def getInputBufferDeclarations (self , name , constmode = False ):
5252 if constmode :
@@ -55,13 +55,21 @@ def getInputBufferDeclarations(self, name, constmode=False):
5555 const = ""
5656 return ["%s%s *%s__in__" % (const , self .datatype , name )]
5757
58- def getOutputBufferDeclarations (self , name , constmode = False ):
58+ def getOutputBufferDeclarations (self , name , constmode = False , outmode = False ):
5959 if constmode :
6060 raise RuntimeError , "Cannot use const output buffer"
61- return ["%s %s__out__[%s]" % (self .datatype , name , self .size )]
61+ if outmode :
62+ out = "*"
63+ else :
64+ out = ""
65+ return ["%s%s %s__out__[%s]" % (self .datatype , out , name , self .size )]
6266
63- def getSizeDeclarations (self , name ):
64- return ["%s %s__len__" % (self .sizetype , name )]
67+ def getSizeDeclarations (self , name , outmode = False ):
68+ if outmode :
69+ out = "*"
70+ else :
71+ out = ""
72+ return ["%s%s %s__len__" % (self .sizetype , out , name )]
6573
6674 def getAuxDeclarations (self , name ):
6775 return ["int %s__in_len__" % (name )]
@@ -112,7 +120,7 @@ def passOutput(self, name):
112120
113121class InputOnlyBufferMixIn (InputOnlyMixIn ):
114122
115- def getOutputBufferDeclarations (self , name , constmode = False ):
123+ def getOutputBufferDeclarations (self , name , constmode = False , outmode = False ):
116124 return []
117125
118126
@@ -200,16 +208,20 @@ def getInputBufferDeclarations(self, name, constmode=False):
200208 const = ""
201209 return ["%s%s *%s__in__" % (const , self .type , name )]
202210
203- def getSizeDeclarations (self , name ):
211+ def getSizeDeclarations (self , name , outmode = False ):
204212 return []
205213
206214 def getAuxDeclarations (self , name ):
207215 return ["int %s__in_len__" % (name )]
208216
209- def getOutputBufferDeclarations (self , name , constmode = False ):
217+ def getOutputBufferDeclarations (self , name , constmode = False , outmode = False ):
210218 if constmode :
211219 raise RuntimeError , "Cannot use const output buffer"
212- return ["%s %s__out__" % (self .type , name )]
220+ if outmode :
221+ out = "*"
222+ else :
223+ out = ""
224+ return ["%s%s %s__out__" % (self .type , out , name )]
213225
214226 def getargsArgs (self , name ):
215227 return "(char **)&%s__in__, &%s__in_len__" % (name , name )
@@ -262,7 +274,7 @@ class StructOutputBufferType(OutputOnlyBufferMixIn, StructInputOutputBufferType)
262274 Instantiate with the struct type as parameter.
263275 """
264276
265- def getSizeDeclarations (self , name ):
277+ def getSizeDeclarations (self , name , outmode = False ):
266278 return []
267279
268280 def getAuxDeclarations (self , name ):
@@ -279,7 +291,7 @@ class ArrayOutputBufferType(OutputOnlyBufferMixIn, StructInputOutputBufferType):
279291 Instantiate with the struct type as parameter.
280292 """
281293
282- def getSizeDeclarations (self , name ):
294+ def getSizeDeclarations (self , name , outmode = False ):
283295 return []
284296
285297 def getAuxDeclarations (self , name ):
0 commit comments