Ejemplo n.º 1
0
    def parseSystemSignal(self, xmlRoot, parent=None):
        """
        parses <SYSTEM-SIGNAL>
        """
        assert (xmlRoot.tag == 'SYSTEM-SIGNAL')
        name, dataTypeRef, initValueRef, length, desc = None, None, None, None, None
        for elem in xmlRoot.findall('./*'):
            if elem.tag == 'SHORT-NAME':
                name = parseTextNode(elem)
            elif elem.tag == 'DATA-TYPE-REF':
                dataTypeRef = parseTextNode(elem)
            elif elem.tag == 'INIT-VALUE-REF':
                initValueRef = parseTextNode(elem)
            elif elem.tag == 'LENGTH':
                length = parseIntNode(elem)
            elif elem.tag == 'SIGNAL-LENGTH':
                length = parseIntNode(elem)
            elif elem.tag == 'DESC':
                descXml = xmlRoot.find('DESC')
                if descXml is not None:
                    L2Xml = descXml.find('L-2')
                    if L2Xml is not None:
                        desc = parseTextNode(L2Xml)
            else:
                raise NotImplementedError(elem.tag)
#      if (name is not None) and (dataTypeRef is not None) and (initValueRef is not None) and length is not None:
        if (
                name is not None
        ) and length is not None:  #All signals doesn't have IV constant Ref or DatatypeRef
            return SystemSignal(name, dataTypeRef, initValueRef, length, desc,
                                parent)
        else:
            raise RuntimeError('failed to parse %s' % xmlRoot.tag)
Ejemplo n.º 2
0
 def parseSystemSignal(self, xmlRoot, dummy, parent=None):
     """
   parses <SYSTEM-SIGNAL>
   """
     assert (xmlRoot.tag == 'SYSTEM-SIGNAL')
     name, dataTypeRef, initValueRef, length, desc = None, None, None, None, None
     for elem in xmlRoot.findall('./*'):
         if elem.tag == 'SHORT-NAME':
             name = parseTextNode(elem)
         elif elem.tag == 'DATA-TYPE-REF':
             dataTypeRef = parseTextNode(elem)
         elif elem.tag == 'INIT-VALUE-REF':
             initValueRef = parseTextNode(elem)
         elif elem.tag == 'LENGTH':
             length = parseIntNode(elem)
         elif elem.tag == 'DESC':
             desc = parseTextNode(elem).strip()
             if len(desc) == 0: desc = None
         else:
             raise NotImplementedError(elem.tag)
     if (name is not None) and (dataTypeRef is not None) and (
             initValueRef is not None) and length is not None:
         return SystemSignal(name, dataTypeRef, initValueRef, length, desc,
                             parent)
     else:
         raise RunTimeError('failed to parse %s' % xmlRoot.tag)
Ejemplo n.º 3
0
   def parseSystemSignal(self,xmlRoot,parent=None):
      """
      parses <SYSTEM-SIGNAL>
      """
      assert(xmlRoot.tag=='SYSTEM-SIGNAL')
      name,dataTypeRef,initValueRef,length,desc=None,None,None,None,None
      for elem in xmlRoot.findall('./*'):
         if elem.tag=='SHORT-NAME':
            name=parseTextNode(elem)
         elif elem.tag=='DATA-TYPE-REF':
            dataTypeRef=parseTextNode(elem)
         elif elem.tag=='INIT-VALUE-REF':
            initValueRef=parseTextNode(elem)
         elif elem.tag=='LENGTH':
            length=parseIntNode(elem)
         elif elem.tag=='DESC':
            descXml = xmlRoot.find('DESC')
            if descXml is not None:
               L2Xml = descXml.find('L-2')
               if L2Xml is not None:
                  desc = parseTextNode(L2Xml)
         else:
            raise NotImplementedError(elem.tag)
#      if (name is not None) and (dataTypeRef is not None) and (initValueRef is not None) and length is not None:
      if (name is not None) and length is not None:  #All signals doesn't have IV constant Ref or DatatypeRef
         return SystemSignal(name, dataTypeRef, initValueRef, length, desc, parent)
      else:
         raise RunTimeError('failed to parse %s'%xmlRoot.tag)
Ejemplo n.º 4
0
 def parseSwcNvBlockNeeds(self,xmlRoot,rootProject=None):
    name=parseTextNode(xmlRoot.find('SHORT-NAME'))
    numberOfDataSets=parseIntNode(xmlRoot.find('N-DATA-SETS'))
    readonly=parseBooleanNode(xmlRoot.find('READONLY'))
    reliability=parseTextNode(xmlRoot.find('RELIABILITY'))
    resistantToChangedSW=parseBooleanNode(xmlRoot.find('RESISTANT-TO-CHANGED-SW'))
    restoreAtStart=parseBooleanNode(xmlRoot.find('RESTORE-AT-START'))
    writeOnlyOnce=parseBooleanNode(xmlRoot.find('WRITE-ONLY-ONCE'))
    writingFrequency=parseIntNode(xmlRoot.find('WRITING-FREQUENCY'))
    defaultBlockRef=parseTextNode(xmlRoot.find('DEFAULT-BLOCK-REF'))
    mirrorBlockref=parseTextNode(xmlRoot.find('MIRROR-BLOCK-REF'))      
    serviceCallPorts=self.parseServiceCallPorts(xmlRoot.find('SERVICE-CALL-PORTS'),rootProject)
    assert(len(serviceCallPorts)>0)
    swcNvBlockNeeds=SwcNvBlockNeeds(name,numberOfDataSets,readonly,reliability,resistantToChangedSW,restoreAtStart,
                                    writeOnlyOnce,writingFrequency,defaultBlockRef,mirrorBlockref)
    swcNvBlockNeeds.serviceCallPorts=serviceCallPorts
    return swcNvBlockNeeds
Ejemplo n.º 5
0
 def parseSwcNvBlockNeeds(self,xmlRoot):
     name=parseTextNode(xmlRoot.find('SHORT-NAME'))
     numberOfDataSets=parseIntNode(xmlRoot.find('N-DATA-SETS'))
     readOnly=parseBooleanNode(xmlRoot.find('READONLY'))
     reliability=parseTextNode(xmlRoot.find('RELIABILITY'))
     resistantToChangedSW=parseBooleanNode(xmlRoot.find('RESISTANT-TO-CHANGED-SW'))
     restoreAtStart=parseBooleanNode(xmlRoot.find('RESTORE-AT-START'))
     writeOnlyOnce=parseBooleanNode(xmlRoot.find('WRITE-ONLY-ONCE'))
     writingFrequency=parseIntNode(xmlRoot.find('WRITING-FREQUENCY'))
     writingPriority=parseTextNode(xmlRoot.find('WRITING-PRIORITY'))
     defaultBlockRef=parseTextNode(xmlRoot.find('DEFAULT-BLOCK-REF'))
     mirrorBlockRef=parseTextNode(xmlRoot.find('MIRROR-BLOCK-REF'))
     serviceCallPorts=self.parseServiceCallPorts(xmlRoot.find('SERVICE-CALL-PORTS'))
     assert(len(serviceCallPorts)>0)
     swcNvBlockNeeds=SwcNvBlockNeeds(name,numberOfDataSets,readOnly,reliability,resistantToChangedSW,restoreAtStart,
                                     writeOnlyOnce,writingFrequency,writingPriority,defaultBlockRef,mirrorBlockRef)
     swcNvBlockNeeds.serviceCallPorts=serviceCallPorts
     return swcNvBlockNeeds
Ejemplo n.º 6
0
 def parseComponentPorts(self,componentType,xmlRoot):
    xmlPorts=xmlRoot.find('PORTS')
    assert(xmlPorts is not None)      
    for xmlPort in xmlPorts.findall('*'):
       if(xmlPort.tag == "R-PORT-PROTOTYPE"):
          portName = xmlPort.find('SHORT-NAME').text
          portInterfaceRef = parseTextNode(xmlPort.find('REQUIRED-INTERFACE-TREF'))
          port = RequirePort(portName,portInterfaceRef,parent=componentType)                        
          if xmlPort.findall('./REQUIRED-COM-SPECS') is not None:        
             for xmlItem in xmlPort.findall('./REQUIRED-COM-SPECS/*'):
                if xmlItem.tag == 'CLIENT-COM-SPEC':
                   operationName=_getOperationNameFromComSpec(xmlItem,portInterfaceRef)
                   comspec=OperationComSpec(operationName)
                   port.comspec.append(comspec)
                elif xmlItem.tag == 'UNQUEUED-RECEIVER-COM-SPEC':
                   dataElemName = _getDataElemNameFromComSpec(xmlItem,portInterfaceRef)
                   comspec = DataElementComSpec(dataElemName)
                   if xmlItem.find('./ALIVE-TIMEOUT') != None:
                      comspec.aliveTimeout = parseTextNode(xmlItem.find('./ALIVE-TIMEOUT'))
                   if xmlItem.find('./INIT-VALUE-REF') != None:
                      comspec.initValueRef = parseTextNode(xmlItem.find('./INIT-VALUE-REF'))
                   port.comspec.append(comspec)
                elif xmlItem.tag == 'QUEUED-RECEIVER-COM-SPEC':
                   dataElemName = _getDataElemNameFromComSpec(xmlItem,portInterfaceRef)
                   comspec = DataElementComSpec(dataElemName)
                   if xmlItem.find('./QUEUE-LENGTH') != None:
                      comspec.queueLength = parseTextNode(xmlItem.find('./QUEUE-LENGTH'))
                   port.comspec.append(comspec)
                else:
                   raise NotImplementedError(item.tag)
          componentType.requirePorts.append(port)
       elif(xmlPort.tag == 'P-PORT-PROTOTYPE'):
          portName = xmlPort.find('SHORT-NAME').text
          portInterfaceRef = parseTextNode(xmlPort.find('PROVIDED-INTERFACE-TREF'))
          port = ProvidePort(portName,portInterfaceRef,parent=componentType)                                       
          if xmlPort.findall('./PROVIDED-COM-SPECS') is not None:
             for xmlItem in xmlPort.findall('./PROVIDED-COM-SPECS/*'):
                if xmlItem.tag == 'SERVER-COM-SPEC':
                   operationName=_getOperationNameFromComSpec(xmlItem,portInterfaceRef)
                   comspec=OperationComSpec(operationName)
                   comspec.queueLength=parseIntNode(xmlItem.find('QUEUE-LENGTH'))
                   port.comspec.append(comspec)
                elif xmlItem.tag == 'UNQUEUED-SENDER-COM-SPEC':
                   dataElemName = _getDataElemNameFromComSpec(xmlItem,portInterfaceRef)
                   comspec = DataElementComSpec(dataElemName)
                   if xmlItem.find('./INIT-VALUE-REF') != None:
                      comspec.initValueRef = parseTextNode(xmlItem.find('./INIT-VALUE-REF'))
                   if xmlItem.find('./CAN-INVALIDATE') != None:
                      comspec.canInvalidate = True if parseTextNode(xmlItem.find('./CAN-INVALIDATE'))=='true' else False
                   port.comspec.append(comspec)
                elif xmlItem.tag == 'QUEUED-SENDER-COM-SPEC':
                   dataElemName = _getDataElemNameFromComSpec(xmlItem,portInterfaceRef)
                   comspec = DataElementComSpec(dataElemName)
                   port.comspec.append(comspec)
                else:
                   raise NotImplementedError(xmlItem.tag)
          componentType.providePorts.append(port)      
Ejemplo n.º 7
0
 def parseSystemSignal(self,xmlRoot,dummy,parent=None):
    """
    parses <SYSTEM-SIGNAL>
    """
    assert(xmlRoot.tag=='SYSTEM-SIGNAL')
    name,dataTypeRef,initValueRef,length,desc=None,None,None,None,None
    for elem in xmlRoot.findall('./*'):         
       if elem.tag=='SHORT-NAME':
          name=parseTextNode(elem)
       elif elem.tag=='DATA-TYPE-REF':
          dataTypeRef=parseTextNode(elem)
       elif elem.tag=='INIT-VALUE-REF':
          initValueRef=parseTextNode(elem)
       elif elem.tag=='LENGTH':
          length=parseIntNode(elem)
       elif elem.tag=='DESC':
          desc=parseTextNode(elem).strip()
          if len(desc)==0: desc=None
       else:
          raise NotImplementedError(elem.tag)
    if (name is not None) and (dataTypeRef is not None) and (initValueRef is not None) and length is not None:         
       return SystemSignal(name,dataTypeRef,initValueRef,length,desc,parent)
    else:
       raise ValueError("failed to parse <SYSTEM-SIGNAL>")