/**********************************************************/
/* apimagic: cparser-based API normalization utility */
/* Copyright (C) 2015--2016 Z. Gilboa */
/* Released under GPLv2 and GPLv3; see COPYING.APIMAGIC. */
/**********************************************************/
#include <cparser/driver/c_driver.h>
#include <apimagic/apimagic.h>
struct amgc_paradigm_meta {
const char * const string;
int val;
};
static const struct amgc_paradigm_meta cparser_lang_std_meta[] = {
{"c++", STANDARD_CXX98 },
{"c++98", STANDARD_CXX98 },
{"c11", STANDARD_C11 },
{"c1x", STANDARD_C11 },
{"c89", STANDARD_C89 },
{"c90", STANDARD_C89 },
{"c99", STANDARD_C99 },
{"c9x", STANDARD_C99 },
{"gnu++98", STANDARD_GNUXX98},
{"gnu11", STANDARD_GNU11 },
{"gnu1x", STANDARD_GNU11 },
{"gnu89", STANDARD_GNU89 },
{"gnu99", STANDARD_GNU99 },
{"gnu9x", STANDARD_GNU99 },
{"iso9899:1990", STANDARD_C89 },
{"iso9899:199409", STANDARD_C89AMD1},
{"iso9899:1999", STANDARD_C99 },
{"iso9899:199x", STANDARD_C99 },
{"iso9899:2011", STANDARD_C11},
{0,0}
};
static int amgc_paradigm_member(
const struct amgc_paradigm_meta meta[],
const char * string)
{
const struct amgc_paradigm_meta * rec;
for (rec = meta; rec->string; rec++)
if (!(strcmp(rec->string,string)))
return rec->val;
return -1;
}
int amgc_lang_std_from_string(const char * std)
{
return amgc_paradigm_member(cparser_lang_std_meta,std);
}