diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2019-05-31 18:42:01 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2019-05-31 18:42:01 +0200 |
commit | bcef77a7fb3b73d2a2fbcea51012014b62755bb5 (patch) | |
tree | 3a5935014a6a2569e592f40086f7858d1207c66c /src/keywords.c | |
parent | 44cb17317c40fa9d39b3402f0826006f20387be5 (diff) | |
download | neco-bcef77a7fb3b73d2a2fbcea51012014b62755bb5.tar neco-bcef77a7fb3b73d2a2fbcea51012014b62755bb5.zip |
Switch to a JSON-based config format
We can get rid of a lot of code by ditching out INI format parser. We also
remove the support for "subtype" and "generator" templates for now; rather
than implementing this in NeCo itself, templates could be implemented as
a Lua DSL later.
Diffstat (limited to 'src/keywords.c')
-rw-r--r-- | src/keywords.c | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/src/keywords.c b/src/keywords.c deleted file mode 100644 index 12393bd..0000000 --- a/src/keywords.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "keywords.h" - -#include <libubox/utils.h> - -#include <stdlib.h> -#include <string.h> - -static const char *const keywords[] = { - -#define KW(kw) #kw, -#include "keywords.def" -#undef KW - -}; - -static int compare_keywords(const void *a, const void *b) { - const char *const *ea = a, *const *eb = b; - return strcmp(*ea, *eb); -} - -keyword_t lookup_keyword(const char *keyword) { - const char *const *entry = bsearch( - &keyword, keywords, ARRAY_SIZE(keywords), sizeof(const char *), - compare_keywords - ); - - if (!entry) - return UNKNOWN_KEYWORD; - - return (keyword_t) (entry - keywords + 1); -} |