mirror of https://github.com/python/cpython
Whitespace normalization.
This commit is contained in:
parent
9a3240e8e6
commit
7d66b00f29
|
@ -41,23 +41,23 @@ class FixedInputOutputBufferType(InputOnlyType):
|
|||
def getArgDeclarations(self, name, reference=False, constmode=False):
|
||||
if reference:
|
||||
raise RuntimeError, "Cannot pass buffer types by reference"
|
||||
return (self.getBufferDeclarations(name, constmode) +
|
||||
return (self.getBufferDeclarations(name, constmode) +
|
||||
self.getSizeDeclarations(name))
|
||||
|
||||
def getBufferDeclarations(self, name, constmode=False):
|
||||
return self.getInputBufferDeclarations(name, constmode) + \
|
||||
self.getOutputBufferDeclarations(name, constmode)
|
||||
self.getOutputBufferDeclarations(name, constmode)
|
||||
|
||||
def getInputBufferDeclarations(self, name, constmode=False):
|
||||
if constmode:
|
||||
const = "const "
|
||||
else:
|
||||
const = ""
|
||||
if constmode:
|
||||
const = "const "
|
||||
else:
|
||||
const = ""
|
||||
return ["%s%s *%s__in__" % (const, self.datatype, name)]
|
||||
|
||||
def getOutputBufferDeclarations(self, name, constmode=False):
|
||||
if constmode:
|
||||
raise RuntimeError, "Cannot use const output buffer"
|
||||
if constmode:
|
||||
raise RuntimeError, "Cannot use const output buffer"
|
||||
return ["%s %s__out__[%s]" % (self.datatype, name, self.size)]
|
||||
|
||||
def getSizeDeclarations(self, name):
|
||||
|
@ -194,21 +194,21 @@ class StructInputOutputBufferType(FixedInputOutputBufferType):
|
|||
self.typeName = self.type = type
|
||||
|
||||
def getInputBufferDeclarations(self, name, constmode=False):
|
||||
if constmode:
|
||||
const = "const "
|
||||
else:
|
||||
const = ""
|
||||
if constmode:
|
||||
const = "const "
|
||||
else:
|
||||
const = ""
|
||||
return ["%s%s *%s__in__" % (const, self.type, name)]
|
||||
|
||||
def getSizeDeclarations(self, name):
|
||||
return []
|
||||
|
||||
|
||||
def getAuxDeclarations(self, name):
|
||||
return ["int %s__in_len__" % (name)]
|
||||
|
||||
def getOutputBufferDeclarations(self, name, constmode=False):
|
||||
if constmode:
|
||||
raise RuntimeError, "Cannot use const output buffer"
|
||||
if constmode:
|
||||
raise RuntimeError, "Cannot use const output buffer"
|
||||
return ["%s %s__out__" % (self.type, name)]
|
||||
|
||||
def getargsArgs(self, name):
|
||||
|
|
|
@ -32,7 +32,7 @@ class BaseFunctionGenerator:
|
|||
|
||||
def checkgenerate(self):
|
||||
return True
|
||||
|
||||
|
||||
def generate(self):
|
||||
if not self.checkgenerate():
|
||||
return
|
||||
|
@ -234,7 +234,7 @@ class FunctionGenerator(BaseFunctionGenerator):
|
|||
return "%s = " % self.rv.name
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def checkit(self):
|
||||
for arg in self.argumentList:
|
||||
arg.errorCheck()
|
||||
|
|
|
@ -17,8 +17,8 @@ class HeapInputOutputBufferType(FixedInputOutputBufferType):
|
|||
FixedInputOutputBufferType.__init__(self, "0", datatype, sizetype, sizeformat)
|
||||
|
||||
def getOutputBufferDeclarations(self, name, constmode=False):
|
||||
if constmode:
|
||||
raise RuntimeError, "Cannot use const output buffer"
|
||||
if constmode:
|
||||
raise RuntimeError, "Cannot use const output buffer"
|
||||
return ["%s *%s__out__" % (self.datatype, name)]
|
||||
|
||||
def getargsCheck(self, name):
|
||||
|
|
|
@ -220,7 +220,7 @@ class ObjectDefinition(GeneratorGroup):
|
|||
Output("""Py_INCREF(&%s);""", self.typename)
|
||||
Output("PyModule_AddObject(m, \"%s\", (PyObject *)&%s);", self.name, self.typename);
|
||||
self.outputTypeObjectInitializerCompat()
|
||||
|
||||
|
||||
def outputTypeObjectInitializerCompat(self):
|
||||
Output("/* Backward-compatible name */")
|
||||
Output("""Py_INCREF(&%s);""", self.typename);
|
||||
|
|
|
@ -47,7 +47,7 @@ class Type:
|
|||
type, such as helper variables used to hold sizes, etc. These declarations
|
||||
are not part of the C/C++ function call interface."""
|
||||
return []
|
||||
|
||||
|
||||
def getargs(self):
|
||||
return self.getargsFormat(), self.getargsArgs()
|
||||
|
||||
|
@ -68,10 +68,10 @@ class Type:
|
|||
|
||||
def getargsPreCheck(self, name):
|
||||
"""Perform any actions needed before calling getargs().
|
||||
|
||||
|
||||
This could include declaring temporary variables and such.
|
||||
"""
|
||||
|
||||
|
||||
def getargsCheck(self, name):
|
||||
"""Perform any needed post-[new]getargs() checks.
|
||||
|
||||
|
@ -133,10 +133,10 @@ class Type:
|
|||
|
||||
def mkvaluePreCheck(self, name):
|
||||
"""Perform any actions needed before calling mkvalue().
|
||||
|
||||
|
||||
This could include declaring temporary variables and such.
|
||||
"""
|
||||
|
||||
|
||||
def cleanup(self, name):
|
||||
"""Clean up if necessary.
|
||||
|
||||
|
|
|
@ -48,10 +48,10 @@ class Variable:
|
|||
def getArgDeclarations(self, constmode=False):
|
||||
refmode = (self.flags & RefMode)
|
||||
if constmode:
|
||||
constmode = (self.flags & ConstMode)
|
||||
constmode = (self.flags & ConstMode)
|
||||
return self.type.getArgDeclarations(self.name,
|
||||
reference=refmode, constmode=constmode)
|
||||
|
||||
reference=refmode, constmode=constmode)
|
||||
|
||||
def getAuxDeclarations(self):
|
||||
return self.type.getAuxDeclarations(self.name)
|
||||
|
||||
|
|
|
@ -626,7 +626,7 @@ if missing: raise "Missing Types"
|
|||
|
||||
def destination(self, type, name, arglist):
|
||||
return "FunctionGenerator", "functions"
|
||||
|
||||
|
||||
def generatemodifiers(self, classname, name, modifiers):
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue