certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] certi/scripts GenMsgCXX.py GenMsgAST.py


From: certi-cvs
Subject: [certi-cvs] certi/scripts GenMsgCXX.py GenMsgAST.py
Date: Fri, 11 Jun 2010 07:47:34 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Eric NOULARD <erk>      10/06/11 07:47:33

Modified files:
        scripts        : GenMsgCXX.py GenMsgAST.py 

Log message:
        Merge from Lucas ALBA work
         - fix enum generation
        
        Fix getMessageRootType

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/scripts/GenMsgCXX.py?cvsroot=certi&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/certi/scripts/GenMsgAST.py?cvsroot=certi&r1=1.11&r2=1.12

Patches:
Index: GenMsgCXX.py
===================================================================
RCS file: /sources/certi/certi/scripts/GenMsgCXX.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- GenMsgCXX.py        10 Jun 2010 08:31:52 -0000      1.17
+++ GenMsgCXX.py        11 Jun 2010 07:47:33 -0000      1.18
@@ -18,7 +18,7 @@
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 ## USA
 ##
-## $Id: GenMsgCXX.py,v 1.17 2010/06/10 08:31:52 erk Exp $
+## $Id: GenMsgCXX.py,v 1.18 2010/06/11 07:47:33 erk Exp $
 ## ----------------------------------------------------------------------------
 
 """

Index: GenMsgAST.py
===================================================================
RCS file: /sources/certi/certi/scripts/GenMsgAST.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- GenMsgAST.py        10 Jun 2010 08:31:52 -0000      1.11
+++ GenMsgAST.py        11 Jun 2010 07:47:33 -0000      1.12
@@ -18,7 +18,7 @@
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 ## USA
 ##
-## $Id: GenMsgAST.py,v 1.11 2010/06/10 08:31:52 erk Exp $
+## $Id: GenMsgAST.py,v 1.12 2010/06/11 07:47:33 erk Exp $
 ## ----------------------------------------------------------------------------
 
 """
@@ -169,19 +169,36 @@
     # pythonic getter/setter using properties   
     enums = property(fget=__getEnumTypes,fset=None,fdel=None,doc=None)
     
-    def getRootMergeType(self,msg):
-       """ return the root merge type
+    def getRootMergeType(self,msg,verbose=0):
+       """ 
+       Return the root merge type of a message.
+       
+       The idea is to find the root of the merge chain of
+       the provided message. 
+       @param msg: the message for which we want to know the root merge type
+       @type any: more precisely either C{NativeType} or C{MessageType} however
+                  only C{MessageType} may lead to a real search of the root.
+       @return: the C{MessageType} root merge type or msg if msg wasn't an 
instance of C{MessageType}
        """
        retval = None
+       # msg may be a simple string not a type         
+       if (isinstance(msg,type(""))):
+               current = self.getType(msg)
+       else:
        current = msg
+               
        while retval==None:                         
+               if (verbose):
+                       print "current = %s, retval = %s" % (current,retval)
+                       print "type(current)=", type(current)                   
            
                if isinstance(current,MessageType):
                        if current.hasMerge():
-                         current=AST.getType(current.merge)
+                         current=self.getType(current.merge)
                        else: 
                          retval = current
                else:
                        retval = current                
+        return retval
         
     def add(self,any):
         """ 
@@ -569,8 +586,10 @@
                parent.nbHeir += 1         
                if (None!=lastMerge):
                           # recurse to find root merge                         
                   
-                   if (lastMerge!=AST.getRootMergeType(msg.merge)):
-                                         self.logger.error("Error: there is 
more than one merged type (%s != %s). You should use one merged type only" % 
(lastMerge, msg.merge))
+                          rootMerge = AST.getRootMergeType(msg.merge)          
                                   
+                   if (lastMerge!=rootMerge):
+                                         blah = 
AST.getRootMergeType(msg.merge,1)
+                                         self.logger.error("Error: there is 
more than one merged type (%s != %s (root of %s)). You should use one merged 
type only" % (lastMerge,rootMerge,msg.merge))
                                          self.logger.fatal(" --> Check lines 
(%d,%d)" % (msg.linespan) + " of <%s>" % AST.name )
                                          return           
                else:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]