From 6a2bbf81ae81a409565f55a825d330cd63772087 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 12 Oct 2019 09:28:39 -0500 Subject: hscript: Add Script::execute() and Simulate option --- hscript/script.cc | 17 +++++++++++++++++ hscript/script.hh | 5 +++++ 2 files changed, 22 insertions(+) (limited to 'hscript') diff --git a/hscript/script.cc b/hscript/script.cc index 9edf0cc..a31fbc3 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -378,4 +378,21 @@ bool Script::validate() const { return (failures == 0); } +bool Script::execute() const { + bool success; + + /* Runner.Execute.Verify */ + output_step_start("validate"); + success = this->validate(); + output_step_end("validate"); + if(!success) { + /* Runner.Execute.Verify.Failure */ + output_error("validator", "The HorizonScript failed validation.", + "Check the output from the validator."); + return false; + } + + return false; +} + } diff --git a/hscript/script.hh b/hscript/script.hh index daacf96..2d3d5c8 100644 --- a/hscript/script.hh +++ b/hscript/script.hh @@ -33,6 +33,8 @@ enum ScriptOptionFlags { InstallEnvironment, /*! "Pretty" output - used in interactive tooling only. */ Pretty, + /*! Just print commands that would be run, for testing/debug */ + Simulate, /*! Count of flags */ NumFlags }; @@ -67,6 +69,9 @@ public: /*! Determines if the HorizonScript is valid. */ bool validate() const; + /*! Executes the HorizonScript. */ + bool execute() const; + private: struct ScriptPrivate; /*! Internal data. */ -- cgit v1.2.3-70-g09d2