diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-08 22:57:44 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-10-08 22:57:44 -0500 |
commit | ee19bcceefbd1c4c604d1afe832e0b6f669d5eae (patch) | |
tree | 896cfe715aea1e9786896e74d02b5bffab21ba69 /hscript/script.cc | |
parent | 831f22fb241e6bbf6e03a61f76932a22a63e4564 (diff) | |
download | horizon-ee19bcceefbd1c4c604d1afe832e0b6f669d5eae.tar.gz horizon-ee19bcceefbd1c4c604d1afe832e0b6f669d5eae.tar.bz2 horizon-ee19bcceefbd1c4c604d1afe832e0b6f669d5eae.tar.xz horizon-ee19bcceefbd1c4c604d1afe832e0b6f669d5eae.zip |
Make +pretty+ a global var instead of passed everywhere
Diffstat (limited to 'hscript/script.cc')
-rw-r--r-- | hscript/script.cc | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/hscript/script.cc b/hscript/script.cc index 4d5a730..d8510b6 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -93,8 +93,7 @@ struct Script::ScriptPrivate { err_str += " at installfile:" + std::to_string(OBJ->lineno());\ if(errors) *errors += 1;\ output_error("installfile:" + std::to_string(lineno),\ - "duplicate value for key '" + KEY + "'", err_str,\ - opts.test(Pretty)); + "duplicate value for key '" + KEY + "'", err_str); if(key_name == "network") { if(this->network) { @@ -125,7 +124,7 @@ struct Script::ScriptPrivate { if(warnings) *warnings += 1; output_warning("installfile:" + std::to_string(lineno), "package '" + pkg + "' has already been specified", - "", opts.test(Pretty)); + ""); continue; } packages.insert(pkg); @@ -161,8 +160,7 @@ Script::Script() { const Script *Script::load(const std::string path, const ScriptOptions opts) { std::ifstream file(path); if(!file) { - output_error(path, "Cannot open installfile", "", - (opts.test(Pretty))); + output_error(path, "Cannot open installfile", ""); return nullptr; } @@ -172,7 +170,7 @@ const Script *Script::load(const std::string path, const ScriptOptions opts) { #define PARSER_ERROR(err_str) \ errors++;\ output_error("installfile:" + std::to_string(lineno),\ - err_str, "", (opts.test(Pretty)));\ + err_str, "");\ if(!opts.test(ScriptOptionFlags::KeepGoing)) {\ break;\ } @@ -180,7 +178,7 @@ const Script *Script::load(const std::string path, const ScriptOptions opts) { #define PARSER_WARNING(warn_str) \ warnings++;\ output_warning("installfile:" + std::to_string(lineno),\ - warn_str, "", (opts.test(Pretty))); + warn_str, ""); const Script *Script::load(std::istream &sstream, const ScriptOptions opts) { using namespace Horizon::Keys; @@ -246,15 +244,13 @@ const Script *Script::load(std::istream &sstream, const ScriptOptions opts) { if(sstream.fail() && !sstream.eof()) { output_error("installfile:" + std::to_string(lineno + 1), "line exceeds maximum length", - "Maximum line length is " + std::to_string(LINE_MAX), - (opts.test(Pretty))); + "Maximum line length is " + std::to_string(LINE_MAX)); errors++; } if(sstream.bad() && !sstream.eof()) { output_error("installfile:" + std::to_string(lineno), - "I/O error while reading installfile", "", - (opts.test(Pretty))); + "I/O error while reading installfile", ""); errors++; } @@ -262,7 +258,7 @@ const Script *Script::load(std::istream &sstream, const ScriptOptions opts) { #define MISSING_ERROR(key) \ output_error("installfile:" + std::to_string(lineno),\ "expected value for key '" + std::string(key) + "'",\ - "this key is required", (opts.test(Pretty)));\ + "this key is required");\ errors++; if(!the_script->internal->network) { @@ -284,8 +280,7 @@ const Script *Script::load(std::istream &sstream, const ScriptOptions opts) { output_message("parser", "0", "installfile", std::to_string(errors) + " error(s), " + - std::to_string(warnings) + " warning(s).", - "", opts.test(Pretty)); + std::to_string(warnings) + " warning(s).", ""); if(errors > 0) { delete the_script; |