Ejemplo n.º 1
0
	def string_type(self, ast, pt, wstring = False):
		typenode = Node(ast, 'type', source = pt)
		if wstring:
			target = Node(typenode, 'customised', [infogripper.getTypenode('wstring', ast)])
		else:
			target = Node(typenode, 'customised', [infogripper.getTypenode('string', ast)])
		typenode.add_child(target)
		pos_const_node = pt.the('positive_int_const')
		if pos_const_node != None:
			expr = self.getExpression(ast, pos_const_node.the('const_exp'))
			typenode.add_attribute('max_length', expr.leaf)
		# This is a new, anonymous type.
		return typenode
Ejemplo n.º 2
0
    def _rename_params(self, ast):
        if self.get_is_pagefault(ast):
            new_ast = ast.copy()

            new_ast.children = []

            for child in ast.children:
                if child.name != 'parameter':
                    new_ast.children.append(child.copy())
                elif child.the('target').the('type').leaf != 'fpage':
                    new_ast.children.append(child.copy())
                else:
                    # Create a new magical node with the correct name...
                    fp_param = Node(new_ast, 'parameter', leaf=child.leaf)
                    fp_param.add_attribute(
                        'direction', child.get_single_attribute('direction'))
                    target = Node(fp_param, 'target')
                    target.add_child(
                        infogripper.getTypenode('idl4_mapitem', ast))
                    fp_param.add_child(target)

                    new_ast.children.append(fp_param)

            return new_ast
        else:
            return ast
Ejemplo n.º 3
0
def _make_struct(ast, name, *args):
	struct = TypeNode(ast, leaf = name, source_file = '<builtin>')
	struct.add_attribute('meta_type', 'struct')

	members = Node(struct, 'members')
	struct.add_child(members)

	for arg_type, arg_name in args:
		inst_node = Node(None, 'type_instance', leaf = arg_name)

		target = Node(inst_node, 'target')
		type_node = getTypenode(arg_type, ast)
		target.add_child(type_node)

		inst_node.add_child(target)
		members.add_child(inst_node)
	
	return struct
Ejemplo n.º 4
0
def _make_struct(ast, name, *args):
    struct = TypeNode(ast, leaf=name, source_file='<builtin>')
    struct.add_attribute('meta_type', 'struct')

    members = Node(struct, 'members')
    struct.add_child(members)

    for arg_type, arg_name in args:
        inst_node = Node(None, 'type_instance', leaf=arg_name)

        target = Node(inst_node, 'target')
        type_node = getTypenode(arg_type, ast)
        target.add_child(type_node)

        inst_node.add_child(target)
        members.add_child(inst_node)

    return struct
Ejemplo n.º 5
0
	def _rename_params(self, ast):
		if self.get_is_pagefault(ast):
			new_ast = ast.copy()

			new_ast.children = []

			for child in ast.children:
				if child.name != 'parameter':
					new_ast.children.append(child.copy())
				elif child.the('target').the('type').leaf != 'fpage':
					new_ast.children.append(child.copy())
				else:
					# Create a new magical node with the correct name...
					fp_param = Node(new_ast, 'parameter', leaf = child.leaf)
					fp_param.add_attribute('direction', child.get_single_attribute('direction'))
					target = Node(fp_param, 'target')
					target.add_child(infogripper.getTypenode('idl4_mapitem', ast))
					fp_param.add_child(target)

					new_ast.children.append(fp_param)

			return new_ast
		else:
			return ast
Ejemplo n.º 6
0
	def scoped_name_type(self, ast, pt):
		scoped_name = self.scoped_name(pt)
		target_type = infogripper.getTypenode(scoped_name, ast)
		if not target_type:
			raise UnknownTypeError(failed_name = scoped_name, node = pt)
		return target_type