import logging


def _decodeCStd( version, strictAnsi ):
    """
        Decodes the C standard given the values of the macros
        __STDC_VERSION__ and __STRICT_ANSI__
    """
    retVal = None

    if version == '__STDC_VERSION__' and strictAnsi == '1':
        retVal = 'c90'

    elif version == '199409L' and strictAnsi == '1':
        retVal = 'iso9899:199409'

    elif version == '199901L' and strictAnsi == '1':
        retVal = 'c99'

    elif version == '201112L' and strictAnsi == '1':
        retVal = 'c11'

    elif version == '__STDC_VERSION__' and strictAnsi == '__STRICT_ANSI__':
        retVal = 'gnu90'

    elif version == '199901L' and strictAnsi == '__STRICT_ANSI__':
        retVal = 'gnu99'

    elif version == '201112L' and strictAnsi == '__STRICT_ANSI__':
        retVal = 'gnu11'

    elif version == '201710L' and strictAnsi == '__STRICT_ANSI__':
        retVal = 'gnu17'

    else:
        logging.warning( 'Cannot decode default language standard for C. (__STDC_VERSION__ = %s __STRICT_ANSI__ = %s)',
                         version, strictAnsi )

    return retVal