def methodReturnType(m, macro):
    """macro should be NS_IMETHOD or NS_IMETHODIMP"""
    if m.nostdcall and m.notxpcom:
        return '%s%s' % (macro == 'NS_IMETHOD' and 'virtual ' or '', m.
            realtype.nativeType('in').strip())
    elif m.nostdcall:
        return '%snsresult' % (macro == 'NS_IMETHOD' and 'virtual ' or '')
    elif m.notxpcom:
        return '%s_(%s)' % (macro, m.realtype.nativeType('in').strip())
    else:
        return macro
