diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-10-11 01:26:41 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-10-20 01:03:47 +0200 |
| commit | cab0135f57ca1c7e448e11f866b0adb8a1328d48 (patch) | |
| tree | fcc24dc0b2d350524c33f07dc8b71f491431e832 /src/prc1/triplet.c | |
| parent | 4ce39e4fc1de9536de7dedfe91b6dee38dec76ae (diff) | |
| download | prc-cab0135f57ca1c7e448e11f866b0adb8a1328d48.tar.gz | |
Diffstat (limited to 'src/prc1/triplet.c')
| -rw-r--r-- | src/prc1/triplet.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/prc1/triplet.c b/src/prc1/triplet.c new file mode 100644 index 0000000..37d6e10 --- /dev/null +++ b/src/prc1/triplet.c @@ -0,0 +1,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; +} |
