[Python-checkins] python/dist/src/Tools/bgen/bgen bgenType.py, 1.13, 1.14 bgenVariable.py, 1.3, 1.4

jackjansen@users.sourceforge.net jackjansen at users.sourceforge.net
Thu Jun 16 23:26:33 CEST 2005


Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20173
Modified Files:
	bgenType.py bgenVariable.py 
Log Message:
More factorization.
Index: bgenType.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenType.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- bgenType.py	14 Jun 2005 21:32:51 -0000	1.13
+++ bgenType.py	16 Jun 2005 21:26:23 -0000	1.14
@@ -24,11 +24,16 @@
 
 Example: int.declare('spam') prints "int spam;"
 """
+ Output("%s;", self.getDeclaration(name, reference))
+
+ def getDeclaration(self, name, reference=False):
+ """Return a string declaring a variable or argument, without
+ any syntactic adornment"""
 if reference:
- Output("%s& %s;", self.typeName, name)
+ return "%s& %s" % (self.typeName, name)
 else:
- Output("%s %s;", self.typeName, name)
-
+ return "%s %s" % (self.typeName, name)
+ 
 def getargs(self):
 return self.getargsFormat(), self.getargsArgs()
 
@@ -72,6 +77,7 @@
 Default is to call passInput().
 """
 return self.passInput(name)
+ 
 def errorCheck(self, name):
 """Check for an error returned in the variable.
 
Index: bgenVariable.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenVariable.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- bgenVariable.py	14 Jun 2005 21:32:51 -0000	1.3
+++ bgenVariable.py	16 Jun 2005 21:26:24 -0000	1.4
@@ -43,6 +43,11 @@
 self.type.declare(self.name, reference=True)
 elif self.flags != SelfMode:
 self.type.declare(self.name)
+ 
+ def getDeclaration(self):
+ """Return the unadorned declaration of the variable,
+ suitable for use in a formal parameter list."""
+ return self.type.getDeclaration(self.name)
 
 def getargsFormat(self):
 """Call the type's getargsFormatmethod."""


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /