Exemplo n.º 1
0
    def parse_blocks(self, blocks):

        if blocks[0] == 'oneway':
            self._oneway = True
            blocks.pop(0)
        else:
            self._oneway = False

        self._returns = idl_type.IDLType(blocks[0], self)
        self._name = blocks[1]
        self._arguments = []

        if not blocks[2] == '(':
            print ' -- Invalid Interface Token (%s)' % interface_name
            print blocks

        index = 3
        argument_blocks = []
        while True:
            if index == len(blocks):
                break
            token = blocks[index]
            if token == ',' or token == ')':
                if len(argument_blocks) == 0:
                    break

                a = IDLArgument(self)
                self._arguments.append(a)
                a.parse_blocks(argument_blocks)

                argument_blocks = []
            else:
                argument_blocks.append(token)
            index = index + 1
Exemplo n.º 2
0
    def parse_blocks(self, blocks):
        type_name_ = ''
        rindex = 1
        name = blocks[-rindex]
        while True:
            if name.find('[') < 0:
                break

            if name.find('[') > 0:
                type_name_ = name[name.find('['):]
                name = name[:name.find('[')]
                #rindex = rindex + 1
                break

            type_name_ = name + type_name_
            rindex = rindex + 1
            name = blocks[-rindex]

        type_name = ''
        for t in blocks[:-rindex]:
            type_name = type_name + ' ' + t
        type_name = type_name + ' ' + type_name_
        type_name = type_name.strip()

        self._type = idl_type.IDLType(type_name, self)
        self._name = name

        self._post_process()
Exemplo n.º 3
0
 def parse_blocks(self, blocks):
     directions = ['in', 'out', 'inout']
     self._dir = 'in'
     if blocks[0] in directions:
         self._dir = blocks[0]
         blocks.pop(0)
         pass
     argument_name, argument_type = self._name_and_type(blocks)
     self._name = argument_name
     self._type = idl_type.IDLType(argument_type, self)
Exemplo n.º 4
0
 def parse_blocks(self, blocks):
     name, typ = self._name_and_type(blocks)
     if typ.find('[') >= 0:
         print self.name, ':',typ
     if name.find('[') > 0:
         name_ = name[:name.find('[')]
         print typ
         typ = typ.strip() + ' ' + name[name.find('['):]
         name = name_
     self._name = name
     self._type = idl_type.IDLType(typ, self)
Exemplo n.º 5
0
    def find_types(self, full_typename):
        if type.is_primitive(full_typename):
            return [type.IDLType(full_typename, self)]
        typenode = []

        def parse_node(s, name=str(full_typename)):
            if s.name == name.strip() or s.full_path == name.strip():
                typenode.append(s)

        def parse_module(m):
            m.forEachModule(parse_module)
            m.forEachStruct(parse_node)
            m.forEachTypedef(parse_node)
            m.forEachEnum(parse_node)
            m.forEachInterface(parse_node)

        parse_module(self)

        return typenode