void process_for_equations(Modelica::MMO_Class &mmo_class) { EquationList &equations = mmo_class.equations_ref().equations_ref(); EquationList new_equations; foreach_ (Equation &e, equations) { if (is<ForEq>(e)) { ForEq feq = boost::get<ForEq>(e); IndexList il = feq.range().indexes(); ERROR_UNLESS(il.size() == 1, "process_for_equations:\n" "forIndexList with more than 1 forIndex are not supported yet\n"); Index in = il.front(); Name variable = in.name(); OptExp ind = in.exp(); ERROR_UNLESS(ind, "for-equation's index with implicit range not supported yet\n"); Expression exp = ind.get(); ForIndexIterator *forIndexIter = NULL; if (is<Range>(exp)) { forIndexIter = new RangeIterator(get<Range>(exp),mmo_class.syms_ref()); } else if (is<Brace>(exp)) { forIndexIter = new BraceIterator(get<Brace>(exp),mmo_class.syms_ref()); } else { ERROR("For Iterator not supported"); } while (forIndexIter->hasNext()) { Real index_val = forIndexIter->next(); foreach_ (Equation eq, feq.elements()) new_equations.push_back(instantiate_equation(eq, variable, index_val, mmo_class.syms_ref())); } delete forIndexIter; } else { // Not a for eq new_equations.push_back(e); } } mmo_class.equations_ref().equations_ref()=new_equations; }