From 0a48e51af94c5bcbf35bd8433a609dfcd36d365a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Tue, 21 Jun 2011 00:00:49 +0000 Subject: [PATCH] Fixes, more tests. --- Data/s/std.verm | 5 +---- Data/s/testy.erm | 14 ++++++++++++++ Scripting/ERM/ERMInterpreter.cpp | 17 +++++++++-------- 3 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 Data/s/testy.erm diff --git a/Data/s/std.verm b/Data/s/std.verm index af1adc2d2..865997ce7 100644 --- a/Data/s/std.verm +++ b/Data/s/std.verm @@ -37,7 +37,4 @@ VERM [* n [factorial [- n 1]]] ] ] -![print [factorial 8]] - -; example 7 --- ERM integration -![if [> 3 2] !!IF:M^Hello world^] \ No newline at end of file +![print [factorial 8]] \ No newline at end of file diff --git a/Data/s/testy.erm b/Data/s/testy.erm new file mode 100644 index 000000000..082c1891e --- /dev/null +++ b/Data/s/testy.erm @@ -0,0 +1,14 @@ +ZVSE +!?PI; + !!VRv2777:S4; + !!DO1/0/5/1&v2777<>1:P0; + +!?FU1; + !!VRv2778:Sx16%2; + !!IF&x16>3:M^Hello world number %X16! To duza liczba^; + !!IF&v2778==0&x16<=3:M^Hello world number %X16! To mala parzysta liczba^; + !!IF&v2778==1&x16<=3:M^Hello world number %X16! To mala nieparzysta liczba^; + +!?PI; + !!VRz10:S^Composed hello ^; + !!IF:M^%Z10%%world%%, v2777=%V2777, v2778=%V2778!^; \ No newline at end of file diff --git a/Scripting/ERM/ERMInterpreter.cpp b/Scripting/ERM/ERMInterpreter.cpp index 34bbcd48c..5d67d60c3 100644 --- a/Scripting/ERM/ERMInterpreter.cpp +++ b/Scripting/ERM/ERMInterpreter.cpp @@ -872,6 +872,7 @@ struct StringFormatter charsToReplace++; replaceWithWhat << erm->ermGlobalEnv->getQuickVar(msg[percentPos+2]); } + break; case 'X': replaceWithWhat << erm->getVar("x", getNum()).getInt(); break; @@ -1295,16 +1296,16 @@ struct ERMExpDispatch : boost::static_visitor<> } void operator()(Treceiver const& trig) const { - HLP helper; + HLP helper; + //check condition + if(trig.condition.is_initialized()) + { + if( !erm->checkCondition(trig.condition.get()) ) + return; + } + if(trig.name == "VR") { - //check condition - if(trig.condition.is_initialized()) - { - if( !erm->checkCondition(trig.condition.get()) ) - return; - } - //perform operations if(trig.identifier.is_initialized()) {