[Python-checkins] python/dist/src/Tools/bgen/bgen bgenGenerator.py, 1.19, 1.20

jackjansen@users.sourceforge.net jackjansen at users.sourceforge.net
Thu Jun 30 17:00:18 CEST 2005


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

Modified Files:
	bgenGenerator.py 
Log Message:
More factorization: added a method getrvforcallit(). This allows a C++
bridge to combine declaration and assignment to the return value
temporary, allowing us to handle functions returning const values.


Index: bgenGenerator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenGenerator.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- bgenGenerator.py	29 Jun 2005 14:17:04 -0000	1.19
+++ bgenGenerator.py	30 Jun 2005 15:00:13 -0000	1.20
@@ -213,10 +213,7 @@
 
     def callit(self):
         args = ""
-        if self.rv:
-            s = "%s = %s(" % (self.rv.name, self.callname)
-        else:
-            s = "%s(" % self.name
+        s = "%s%s(" % (self.getrvforcallit(), self.callname)
         sep = ",\n" + ' '*len(s)
         for arg in self.argumentList:
             if arg is self.rv:
@@ -224,12 +221,15 @@
             s = arg.passArgument()
             if args: s = sep + s
             args = args + s
+        Output("%s%s(%s);",
+               self.getrvforcallit(), self.callname, args)
+
+    def getrvforcallit(self):
         if self.rv:
-            Output("%s = %s(%s);",
-                   self.rv.name, self.callname, args)
+            return "%s = " % self.rv.name
         else:
-            Output("%s(%s);", self.callname, args)
-
+            return ""
+            
     def checkit(self):
         for arg in self.argumentList:
             arg.errorCheck()



More information about the Python-checkins mailing list