summaryrefslogtreecommitdiff
path: root/hscript/script.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 13:54:18 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 13:54:18 -0500
commita3504832b357f6bd97f51560dbbf8a933583dc70 (patch)
tree26533fd27d36ca4b10e9c472a3d82d3f6d63fe8b /hscript/script.cc
parent36199bc708785688306bf6c027ea3eb0f7a4d88b (diff)
downloadhorizon-a3504832b357f6bd97f51560dbbf8a933583dc70.tar.gz
horizon-a3504832b357f6bd97f51560dbbf8a933583dc70.tar.bz2
horizon-a3504832b357f6bd97f51560dbbf8a933583dc70.tar.xz
horizon-a3504832b357f6bd97f51560dbbf8a933583dc70.zip
hscript: Add Keymap code
Diffstat (limited to 'hscript/script.cc')
-rw-r--r--hscript/script.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/hscript/script.cc b/hscript/script.cc
index f1fa5d6..dae014c 100644
--- a/hscript/script.cc
+++ b/hscript/script.cc
@@ -91,7 +91,8 @@ struct Script::ScriptPrivate {
std::unique_ptr<RootPassphrase> rootpw;
/*! The system language. */
std::unique_ptr<Language> lang;
- /* keymap */
+ /*! The system keymap. */
+ std::unique_ptr<Keymap> keymap;
/*! The system timezone. */
std::unique_ptr<Timezone> tzone;
@@ -151,6 +152,8 @@ struct Script::ScriptPrivate {
return store_rootpw(obj, lineno, errors, warnings, opts);
} else if(key_name == "language") {
return store_lang(obj, lineno, errors, warnings, opts);
+ } else if(key_name == "keymap") {
+ return store_keymap(obj, lineno, errors, warnings, opts);
} else if(key_name == "firmware") {
return store_firmware(obj, lineno, errors, warnings, opts);
} else if(key_name == "timezone") {
@@ -293,6 +296,18 @@ struct Script::ScriptPrivate {
return true;
}
+ bool store_keymap(Keys::Key *obj, int lineno, int *errors, int *,
+ ScriptOptions) {
+ if(this->keymap) {
+ DUPLICATE_ERROR(this->keymap, std::string("keymap"),
+ this->keymap->value())
+ return false;
+ }
+ std::unique_ptr<Keymap> k(dynamic_cast<Keymap *>(obj));
+ this->keymap = std::move(k);
+ return true;
+ }
+
bool store_timezone(Keys::Key *obj, int lineno, int *errors, int *,
ScriptOptions) {
if(this->tzone) {
@@ -722,7 +737,8 @@ bool Script::validate() const {
/* REQ: Runner.Validate.language */
if(internal->lang && !internal->lang->validate(this->opts)) failures++;
- /* keymap */
+ /* REQ: Runner.Validate.keymap */
+ if(internal->keymap && !internal->keymap->validate(this->opts)) failures++;
#ifdef NON_LIBRE_FIRMWARE
/* REQ: Runner.Validate.firmware */