Esempio n. 1
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
Esempio n. 2
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. 3
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. 4
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. 5
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. 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)
        for node in self.node.findall('element'):
            self.__add(self.Element(node))

        self.node = None
Esempio n. 7
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. 8
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. 9
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. 10
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. 11
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. 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'):
            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