diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-01 18:11:11 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-11-01 18:11:11 -0500 |
commit | 8bd47a3f42ff1cd9ae2252c7ef17639f57fe6250 (patch) | |
tree | 7f3ea8568a0653a713f402baae181ef5a91dcf77 /hscript | |
parent | 011f7069677c77ee3039d94aef7bc25030ab3309 (diff) | |
download | horizon-8bd47a3f42ff1cd9ae2252c7ef17639f57fe6250.tar.gz horizon-8bd47a3f42ff1cd9ae2252c7ef17639f57fe6250.tar.bz2 horizon-8bd47a3f42ff1cd9ae2252c7ef17639f57fe6250.tar.xz horizon-8bd47a3f42ff1cd9ae2252c7ef17639f57fe6250.zip |
hscript: Implement Runner.Validate.keymap.Valid
Diffstat (limited to 'hscript')
-rw-r--r-- | hscript/meta.cc | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/hscript/meta.cc b/hscript/meta.cc index 640743c..fbd6f31 100644 --- a/hscript/meta.cc +++ b/hscript/meta.cc @@ -301,13 +301,30 @@ bool Language::execute(ScriptOptions opts) const { } -Key *Keymap::parseFromData(const std::string &data, int lineno, int *, int *) { +const std::set<std::string> valid_keymaps = { + "us", "ad", "af", "ara", "al", "am", "at", "az", "by", "be", "bd", "in", + "ba", "br", "bg", "ma", "mm", "ca", "cd", "cn", "hr", "cz", "dk", "nl", + "bt", "ee", "ir", "iq", "fo", "fi", "fr", "gh", "gn", "ge", "de", "gr", + "hu", "is", "il", "it", "jp", "kg", "kh", "kz", "la", "latam", "lt", "lv", + "mao", "me", "mk", "mt", "mn", "no", "pl", "pt", "ro", "ru", "rs", "si", + "sk", "es", "se", "ch", "sy", "tj", "lk", "th", "tr", "ua", "gb", "uz", + "vn", "kr", "ie", "pk", "mv", "za", "epo", "np", "ng", "et", "sn", "brai", + "tm", "ml", "tz", "ke", "bw", "ph" +}; + +Key *Keymap::parseFromData(const std::string &data, int lineno, int *errors, + int *) { + if(valid_keymaps.find(data) == valid_keymaps.end()) { + if(errors) *errors += 1; + output_error("installfile:" + std::to_string(lineno), + "keymap: invalid keymap specified"); + return nullptr; + } + return new Keymap(lineno, data); } bool Keymap::validate(ScriptOptions) const { - /* TODO XXX */ - /* Will require console-setup to be installed on the validating machine. */ return true; } |