Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mc_api::compare_automaton_exp_lable() defined. It's called in evaluate_label()
authorEhsan Azimi <eazimi@ehsan.irisa.fr>
Fri, 4 Dec 2020 18:16:47 +0000 (19:16 +0100)
committerEhsan Azimi <eazimi@ehsan.irisa.fr>
Fri, 4 Dec 2020 18:16:47 +0000 (19:16 +0100)
src/mc/checker/LivenessChecker.cpp
src/mc/mc_api.cpp
src/mc/mc_api.hpp

index bdebbc2..97d14fb 100644 (file)
@@ -54,12 +54,9 @@ static bool evaluate_label(const xbt_automaton_exp_label* l, std::vector<int> co
   case xbt_automaton_exp_label::AUT_NOT:
     return not evaluate_label(l->u.exp_not, values);
   case xbt_automaton_exp_label::AUT_PREDICAT:{
-      unsigned int cursor = 0;
-      xbt_automaton_propositional_symbol_t p = nullptr;
-      xbt_dynar_foreach(simgrid::mc::property_automaton->propositional_symbols, cursor, p) {
-        if (std::strcmp(xbt_automaton_propositional_symbol_get_name(p), l->u.predicat) == 0)
-          return values[cursor] != 0;
-      }
+      auto cursor = mcapi::get().compare_automaton_exp_lable(l, values);
+      if(cursor >= 0)
+        return values[cursor] != 0;
       xbt_die("Missing predicate");
       break;
     }
index 34df9cc..c94007f 100644 (file)
@@ -533,5 +533,16 @@ std::vector<xbt_automaton_state_t> mc_api::get_automaton_state() const
   return automaton_stack;
 }
 
+int mc_api::compare_automaton_exp_lable(const xbt_automaton_exp_label* l, std::vector<int> const& values) const
+{
+  unsigned int cursor = 0;
+  xbt_automaton_propositional_symbol_t p = nullptr;
+  xbt_dynar_foreach (simgrid::mc::property_automaton->propositional_symbols, cursor, p) {
+    if (std::strcmp(xbt_automaton_propositional_symbol_get_name(p), l->u.predicat) == 0)
+      return cursor;
+  }
+  return -1;
+}
+
 } // namespace mc
 } // namespace simgrid
index f6a4526..48f475d 100644 (file)
@@ -113,6 +113,8 @@ public:
   #endif
   std::vector<int> automaton_propositional_symbol_evaluate() const;
   std::vector<xbt_automaton_state_t> get_automaton_state() const;
+  int compare_automaton_exp_lable(const xbt_automaton_exp_label* l, std::vector<int> const& values) const;
+
 };
 
 } // namespace mc