1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/**********************************************************/
/* apimagic: cparser-based API normalization utility */
/* Copyright (C) 2015--2021 SysDeer Technologies, LLC */
/* 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);
}
|