'Transform a C signature into RST nodes.'

def handle_signature(self, sig, signode):

    m = c_funcptr_sig_re.match(sig)
    if (m is None):
        m = c_sig_re.match(sig)
    if (m is None):
        raise ValueError('no    match')
    (rettype, name, arglist, const) = m.groups()
    signode += addnodes.desc_type('', '')
    self._parse_type(signode[(-1)], rettype)
    try:
        (classname, funcname) = name.split('::', 1)
        classname += '::'
        signode += addnodes.desc_addname(classname, classname)
        signode += addnodes.desc_name(funcname, funcname)
    except ValueError:
        signode += addnodes.desc_name(name, name)
    m = c_funcptr_name_re.match(name)
    if m:
        name = m.group(1)
    typename = self.env.ref_context.get('c:type')
    if ((self.name == 'c:member') and typename):
        fullname = ((typename + '.') + name)
    else:
        fullname = name
    if (not arglist):
        if (self.objtype == 'function'):
            signode += addnodes.desc_parameterlist()
        if const:
            signode += addnodes.desc_addname(const, const)
        return fullname
    paramlist = addnodes.desc_parameterlist()
    arglist = arglist.replace('`', '').replace('\\    ', '')
    for arg in self._parse_arglist(arglist):
        arg = arg.strip()
        param = addnodes.desc_parameter('', '', noemph=True)
        try:
            m = c_funcptr_arg_sig_re.match(arg)
            if m:
                self._parse_type(param, (m.group(1) + '('))
                param += nodes.emphasis(m.group(2), m.group(2))
                self._parse_type(param, ((')(' + m.group(3)) + ')'))
                if m.group(4):
                    param += addnodes.desc_addname(m.group(4), m.group(4))
            else:
                (ctype, argname) = arg.rsplit('    ', 1)
                self._parse_type(param, ctype)
                param += nodes.emphasis(('    ' + argname), (u'\xa0' + argname))
        except ValueError:
            self._parse_type(param, arg)
        paramlist += param
    signode += paramlist
    if const:
        signode += addnodes.desc_addname(const, const)
    return fullname
