Example #1
0
 Statement toMicroSt::operator()(WhenSt v) const { 
   if (is<Call>(v.cond())) {
     Call c = get<Call>(v.cond());
     if ("sample"==c.name()) {
         Expression d=newDiscrete(c.args().front());
         v.cond_ref() = BinOp(Reference("time"),Greater,Call("pre",ExpList(1,d)));
         v.elements_ref().insert(v.elements_ref().begin(), Assign(d,OptExp(BinOp(Reference("time"),Add, c.args().at(1)))));
     }
   }
   foreach_(Statement &s, v.elements_ref()) 
     s=apply(s);
   return v;
 }
Example #2
0
bool contains::operator()(Call v) const {
    if (exp==Expression(v)) return true;
    foreach_ (Expression e, v.args())
    if (apply(e)) return true;
    return false;
}