Esempio n. 1
0
    def __init__(self, node, tree):
        """ Constructor
		
		Keyword arguments:
		node	--	XML node defining this event
		tree	--	currently evaluted communication structure tree
		
		Resets the 'abstract' flag for every component beeing contained here.
		"""
        self.name = node.get('name')
        utils.check_name(self.name)

        bootloader = node.find('bootloader')
        if bootloader != None:
            bootloader = bootloader.attrib
        self.bootloader = bootloader

        self.description = xml_utils.get_description(node)

        self.components = utils.SingleAssignDictionary("component")
        self.events = EventContainer()
        self.subscriptions = {}
        self.indexReady = False

        for node in node.findall('component'):
            component_name = node.get('name')
            try:
                component = tree.components[component_name]
                component.abstract = False

                self.components[component_name] = component
            except KeyError:
                raise ParserException(
                    "Unknown component '%s' in container '%s'." %
                    (component_name, self.name))
Esempio n. 2
0
File: type.py Progetto: davidwe/xpcc
	def evaluate(self, tree):
		self.description = xml_utils.get_description(self.node)
		self.unit = self.node.get('unit')
		try:
			self.subtype = SubType(self.node.get('type'), tree.types)
		except ParserException as e:
			raise ParserException("Error in definition of typedef '%s': %s" % (self.name, e))
Esempio n. 3
0
	def __init__(self, node, tree):
		""" Constructor
		
		Keyword arguments:
		node	--	XML node defining this event
		tree	--	currently evaluted communication structure tree
		
		Resets the 'abstract' flag for every component beeing contained here.
		"""
		self.name = node.get('name')
		utils.check_name(self.name)
		
		bootloader = node.find('bootloader')
		if bootloader != None:
			bootloader = bootloader.attrib
		self.bootloader = bootloader
		
		self.description = xml_utils.get_description(node)
		
		self.components = utils.SingleAssignDictionary("component")
		self.events = EventContainer()
		self.subscriptions = {}
		self.indexReady = False
		
		for node in node.findall('component'):
			component_name = node.get('name')
			try:
				component = tree.components[component_name]
				component.abstract = False
				
				self.components[component_name] = component
			except KeyError:
				raise ParserException("Unknown component '%s' in container '%s'." % (component_name, self.name))
Esempio n. 4
0
File: type.py Progetto: davidwe/xpcc
	def evaluate(self, tree):
		if self.node is None:
			return
		
		self.description = xml_utils.get_description(self.node)
		for node in self.node.findall('element'):
			try:
				self.elements.append(self.Element(node, tree))
			except ParserException as e:
				raise ParserException("Error in definition of struct '%s': %s!" % (self.name, e))
		
		basetype = self.node.get('extends')
		if basetype is not None:
			try:
				self.extends = tree.types[basetype]
				if not self.extends.isStruct:
					raise ParserException("Struct '%s' is derived from non struct '%s'!" % (self.name, self.extends.name))
				if self.extends.extends:
					raise ParserException("Struct '%s' extends struct '%s'. Structs are only allowed to extend from those Structs, which do not extend anything!" % (self.name, self.extends.name))
				self.__typeIdentifierName = self.node.get('typeIdentifier')
				if self.__typeIdentifierName is None:
					raise ParserException("Struct '%s' does extend '%s', but does not provide the attribute 'typeIdentifier'!" % (self.name, self.extends.name))

			except KeyError:
				raise ParserException("Unknown super type '%s' in struct '%s'!" % (basetype, self.name))
		self.node = None
Esempio n. 5
0
File: type.py Progetto: davidwe/xpcc
	def evaluate(self, tree):
		if self.node is None:
			return
		
		self.description = xml_utils.get_description(self.node)
		self.size = int(self.node.get('size'))
		
		self.node = None
Esempio n. 6
0
    def evaluate(self, tree):
        if self.node is None:
            return

        self.description = xml_utils.get_description(self.node)
        self.string = xml_utils.get_string(self.node)
        self.size = int(self.node.get('size'))

        self.node = None
Esempio n. 7
0
	def __init__(self, node, tree):
		self.name = node.get('name')
		utils.check_name(self.name)
		
		self.description = xml_utils.get_description(node)
		self.id = xml_utils.get_identifier(node)
		
		self.parameterType = self.__get_type(node, "parameterType", tree)
		self.returnType = self.__get_type(node, "returnType", tree)
Esempio n. 8
0
File: type.py Progetto: davidwe/xpcc
		def __init__(self, node, tree):
			self.name = node.get('name')
			
			self.description = xml_utils.get_description(node)
			self.subtype = SubType(node.get('type'), tree.types)
			self.unit = node.get('unit')
			
			self.level = None
			self.size = None
Esempio n. 9
0
File: type.py Progetto: davidwe/xpcc
	def evaluate(self, tree):
		if self.node is None:
			return
		
		self.description = xml_utils.get_description(self.node)
		for node in self.node.findall('element'):
			self.__add(self.Element(node))
		
		self.node = None
Esempio n. 10
0
    def __init__(self, node, tree):
        self.name = node.get('name')
        utils.check_name(self.name)

        self.description = xml_utils.get_description(node)
        self.id = xml_utils.get_identifier(node)

        self.parameterType = self.__get_type(node, "parameterType", tree)
        self.returnType = self.__get_type(node, "returnType", tree)
Esempio n. 11
0
 def evaluate(self, tree):
     self.description = xml_utils.get_description(self.node)
     self.string = xml_utils.get_string(self.node)
     self.unit = self.node.get('unit')
     try:
         self.subtype = SubType(self.node.get('type'), tree.types)
     except ParserException as e:
         raise ParserException("Error in definition of typedef '%s': %s" %
                               (self.name, e))
Esempio n. 12
0
    def evaluate(self, tree):
        if self.node is None:
            return

        self.description = xml_utils.get_description(self.node)
        self.string = xml_utils.get_string(self.node)
        for node in self.node.findall('element'):
            self.__add(self.Element(node))

        self.node = None
Esempio n. 13
0
        def __init__(self, node, tree):
            self.name = node.get('name')

            self.description = xml_utils.get_description(node)
            self.string = xml_utils.get_string(node)
            self.subtype = SubType(node.get('type'), tree.types)
            self.unit = node.get('unit')
            self.value = node.get('value')

            self.level = None
            self.size = None
Esempio n. 14
0
File: type.py Progetto: davidwe/xpcc
		def __init__(self, node):
			""" Constructor
			
			The name of the element has to be all upper case with underscores.
			"""
			self.name = node.get('name')
			if not re.match("^[0-9A-Z_]*$", self.name):
				raise ParserException("Attribute name of element in enum has to be UPPER_UNDERSCORE_STYLE (found: '%s')" % (self.name))
			
			self.description = xml_utils.get_description(node)
			
			value = node.get('value')
			self.value = None if (value is None) else int(value, 0)
Esempio n. 15
0
        def __init__(self, node):
            """ Constructor
			
			The name of the element has to be all upper case with underscores.
			"""
            self.name = node.get('name')
            if not re.match("^[0-9A-Z_]*$", self.name):
                raise ParserException(
                    "Attribute name of element in enum has to be UPPER_UNDERSCORE_STYLE (found: '%s')"
                    % (self.name))

            self.string = node.get('string')
            if self.string is None:
                self.string = self.name

            self.description = xml_utils.get_description(node)
            self.string = xml_utils.get_string(node)

            value = node.get('value')
            self.value = None if (value is None) else int(value, 0)
Esempio n. 16
0
	def __init__(self, node, tree):
		""" Constructor
		
		Keyword arguments:
		node	--	XML node defining this event
		tree	--	currently evaluted communication structure tree
		"""
		self.name = node.get('name')
		utils.check_name(self.name)
		
		self.id = xml_utils.get_identifier(node)
		self.description = xml_utils.get_description(node)
		self.rate = node.get('rate')
		
		type = node.get('type')
		if type is None:
			self.type = None
		else:
			try:
				self.type = tree.types[type]
			except KeyError as e:
				raise ParserException("Type '%s' is not defined. Used by Event '%s')" % (type, self.name))
Esempio n. 17
0
	def evaluate(self, tree):
		""" Load values form the XML node. """
		if self.node is None:
			return
		
		self.description = xml_utils.get_description(self.node)
		self.id = xml_utils.get_identifier(self.node)
		
		extends = self.node.get('extends')
		if extends is None:
			self.extends = None
		else:
			try:
				self.extends = tree.components[extends]
			except KeyError:
				raise ParserException("Found unknown super component '%s' in component '%s'!" % (extends, self.name))
		
		# parse functions and events
		self.__parse_actions(tree)
		self.__parse_events(tree)
		
		self.node = None
Esempio n. 18
0
    def evaluate(self, tree):
        """ Load values form the XML node. """
        if self.node is None:
            return

        self.description = xml_utils.get_description(self.node)
        self.id = xml_utils.get_identifier(self.node)

        extends = self.node.get('extends')
        if extends is None:
            self.extends = None
        else:
            try:
                self.extends = tree.components[extends]
            except KeyError:
                raise ParserException(
                    "Found unknown super component '%s' in component '%s'!" %
                    (extends, self.name))

        # parse functions and events
        self.__parse_actions(tree)
        self.__parse_events(tree)

        self.node = None
Esempio n. 19
0
    def __init__(self, node, tree):
        """ Constructor
		
		Keyword arguments:
		node	--	XML node defining this event
		tree	--	currently evaluted communication structure tree
		"""
        self.name = node.get('name')
        utils.check_name(self.name)

        self.id = xml_utils.get_identifier(node)
        self.description = xml_utils.get_description(node)
        self.rate = node.get('rate')

        type = node.get('type')
        if type is None:
            self.type = None
        else:
            try:
                self.type = tree.types[type]
            except KeyError as e:
                raise ParserException(
                    "Type '%s' is not defined. Used by Event '%s')" %
                    (type, self.name))
Esempio n. 20
0
    def evaluate(self, tree):
        if self.node is None:
            return

        self.description = xml_utils.get_description(self.node)
        self.string = xml_utils.get_string(self.node)
        for node in self.node.findall('element'):
            try:
                self.elements.append(self.Element(node, tree))
            except ParserException as e:
                raise ParserException(
                    "Error in definition of struct '%s': %s!" % (self.name, e))

        basetype = self.node.get('extends')
        if basetype is not None:
            try:
                self.extends = tree.types[basetype]
                if not self.extends.isStruct:
                    raise ParserException(
                        "Struct '%s' is derived from non struct '%s'!" %
                        (self.name, self.extends.name))
                if self.extends.extends:
                    raise ParserException(
                        "Struct '%s' extends struct '%s'. Structs are only allowed to extend from those Structs, which do not extend anything!"
                        % (self.name, self.extends.name))
                self.__typeIdentifierName = self.node.get('typeIdentifier')
                if self.__typeIdentifierName is None:
                    raise ParserException(
                        "Struct '%s' does extend '%s', but does not provide the attribute 'typeIdentifier'!"
                        % (self.name, self.extends.name))

            except KeyError:
                raise ParserException(
                    "Unknown super type '%s' in struct '%s'!" %
                    (basetype, self.name))
        self.node = None