Merge pull request #26 from G-e-n-e-v-e-n-s-i-S/get-mse-version

Add get_mse_version script function
This commit is contained in:
GenevensiS
2024-10-04 23:23:26 +02:00
committed by GitHub
4 changed files with 15 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
Function: get_mse_version
--Usage--
> get_mse_version()
Returns the current MSE app version in a string of the form:
"major.minor.patch"
+1
View File
@@ -111,6 +111,7 @@ These functions are built into the program, other [[type:function]]s can be defi
| [[fun:write_set_file]] Write a MSE set file to the output directory. | [[fun:write_set_file]] Write a MSE set file to the output directory.
! Other functions <<< ! Other functions <<<
| [[fun:get_mse_version]] Get the MSE app version.
| [[fun:trace]] Output a message for debugging purposes. | [[fun:trace]] Output a message for debugging purposes.
| [[fun:assert]] Check a condition for debugging purposes. | [[fun:assert]] Check a condition for debugging purposes.
| [[fun:warning]] Output a warning message. | [[fun:warning]] Output a warning message.
+6
View File
@@ -8,6 +8,7 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp> #include <util/prec.hpp>
#include <util/version.hpp>
#include <script/functions/functions.hpp> #include <script/functions/functions.hpp>
#include <script/functions/util.hpp> #include <script/functions/util.hpp>
#include <util/tagged_string.hpp> #include <util/tagged_string.hpp>
@@ -21,6 +22,10 @@
// ----------------------------------------------------------------------------- : Debugging // ----------------------------------------------------------------------------- : Debugging
SCRIPT_FUNCTION(get_mse_version) {
SCRIPT_RETURN(app_version.toString());
}
SCRIPT_FUNCTION(trace) { SCRIPT_FUNCTION(trace) {
SCRIPT_PARAM_C(String, input); SCRIPT_PARAM_C(String, input);
#if defined(_DEBUG) && 0 #if defined(_DEBUG) && 0
@@ -764,6 +769,7 @@ SCRIPT_FUNCTION(rule) {
void init_script_basic_functions(Context& ctx) { void init_script_basic_functions(Context& ctx) {
// debugging // debugging
ctx.setVariable(_("get_mse_version"), script_get_mse_version);
ctx.setVariable(_("trace"), script_trace); ctx.setVariable(_("trace"), script_trace);
ctx.setVariable(_("warning"), script_warning); ctx.setVariable(_("warning"), script_warning);
ctx.setVariable(_("error"), script_error); ctx.setVariable(_("error"), script_error);
@@ -102,6 +102,7 @@ $built_in_functions = array(
'write_image_file' =>'', 'write_image_file' =>'',
'write_set_file' =>'', 'write_set_file' =>'',
// other // other
'get_mse_version' =>'',
'trace' =>'', 'trace' =>'',
'assert' =>'', 'assert' =>'',
'exists_in_package' =>'', 'exists_in_package' =>'',