[Python-checkins] python/dist/src/Tools/bgen/bgen bgenGenerator.py, 1.20, 1.21 bgenType.py, 1.17, 1.18 bgenVariable.py, 1.8, 1.9

jackjansen@users.sourceforge.net jackjansen at users.sourceforge.net
Fri Jul 1 22:23:31 CEST 2005


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

Modified Files:
	bgenGenerator.py bgenType.py bgenVariable.py 
Log Message:
Added methods mkvaluePreCheck and getargsPreCheck, which are called (for
each variable) before calling Py_BuildValue and PyArg_Parse.


Index: bgenGenerator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenGenerator.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- bgenGenerator.py	30 Jun 2005 15:00:13 -0000	1.20
+++ bgenGenerator.py	1 Jul 2005 20:23:27 -0000	1.21
@@ -194,6 +194,7 @@
             if arg.flags == SelfMode:
                 continue
             if arg.mode in (InMode, InOutMode):
+                arg.getargsPreCheck()
                 fmt = fmt + arg.getargsFormat()
                 args = arg.getargsArgs()
                 if args:
@@ -242,6 +243,7 @@
             if not arg: continue
             if arg.flags == ErrorMode: continue
             if arg.mode in (OutMode, InOutMode):
+                arg.mkvaluePreCheck()
                 fmt = fmt + arg.mkvalueFormat()
                 lst = lst + sep + arg.mkvalueArgs()
         if fmt == "":

Index: bgenType.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenType.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- bgenType.py	28 Jun 2005 15:14:35 -0000	1.17
+++ bgenType.py	1 Jul 2005 20:23:27 -0000	1.18
@@ -61,11 +61,18 @@
         """
         return "&" + name
 
+    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.
 
         This is type-dependent; the default does not check for errors.
-        An example would be a check for a maximum string length."""
+        An example would be a check for a maximum string length, or it
+        could do post-getargs() copying or conversion."""
 
     def passInput(self, name):
         """Return an argument for passing a variable into a call.
@@ -119,6 +126,12 @@
         """
         return name
 
+    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.
 

Index: bgenVariable.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenVariable.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- bgenVariable.py	28 Jun 2005 15:14:35 -0000	1.8
+++ bgenVariable.py	1 Jul 2005 20:23:27 -0000	1.9
@@ -63,6 +63,9 @@
     def getargsCheck(self):
         return self.type.getargsCheck(self.name)
 
+    def getargsPreCheck(self):
+        return self.type.getargsPreCheck(self.name)
+
     def passArgument(self):
         """Return the string required to pass the variable as argument.
 
@@ -95,6 +98,9 @@
         """Call the type's mkvalueArgs method."""
         return self.type.mkvalueArgs(self.name)
 
+    def mkvaluePreCheck(self):
+        return self.type.mkvaluePreCheck(self.name)
+
     def cleanup(self):
         """Call the type's cleanup method."""
         return self.type.cleanup(self.name)



More information about the Python-checkins mailing list