blob: 37d6e10876c762e58c52a525d83e6414a545359e (
plain) (
blame)
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
|
#include "prv.h"
#include "arg.h"
#include "parse.h"
#include "triplet/prv.h"
#include <stddef.h>
#include <string.h>
const char *triplet(const struct prv *p)
{
const struct args *args = p->ast->args;
return args->triplet;
}
static const struct type *find(const char *s, const struct type (*v)[12])
{
for (size_t i = 0; i < sizeof *v / sizeof **v; i++)
if (!strcmp(s, (*v)[i].u.b.name))
return &(*v)[i];
return NULL;
}
const struct type *triplet_type(const char *tr, const char *s)
{
static const struct
{
const char *s;
const struct type (*v)[12];
} m[] =
{
{"x86_64-linux-gnu", &x86_64_linux_gnu}
};
for (size_t i = 0; i < sizeof m / sizeof *m; i++)
if (!strcmp(tr, m[i].s))
return find(s, m[i].v);
return NULL;
}
|