virtual void execute(cmd_context & ctx) { ctx.regular_stream() << "\""; if (m_cmds.empty()) { vector<named_cmd> cmds; cmd_context::cmd_iterator it = ctx.begin_cmds(); cmd_context::cmd_iterator end = ctx.end_cmds(); for (; it != end; ++it) { cmds.push_back(named_cmd((*it).m_key, (*it).m_value)); } // named_cmd_lt is not a total order for commands, but this is irrelevant for Linux x Windows behavior std::sort(cmds.begin(), cmds.end(), named_cmd_lt()); vector<named_cmd>::const_iterator it2 = cmds.begin(); vector<named_cmd>::const_iterator end2 = cmds.end(); for (; it2 != end2; ++it2) { display_cmd(ctx, it2->first, it2->second); } } else { svector<symbol>::const_iterator it = m_cmds.begin(); svector<symbol>::const_iterator end = m_cmds.end(); for (; it != end; ++it) { cmd * c = ctx.find_cmd(*it); SASSERT(c); display_cmd(ctx, *it, c); } } ctx.regular_stream() << "\"\n"; }
virtual void execute(cmd_context & ctx) { if(m_arg_idx<2) { throw cmd_exception("at least 2 arguments expected"); } ensure_domain(ctx); ast_manager& m = ctx.m(); func_decl_ref pred( m.mk_func_decl(m_rel_name, m_domain->size(), m_domain->c_ptr(), m.mk_bool_sort()), m); ctx.insert(pred); datalog::context& dctx = m_dl_ctx->get_dl_context(); dctx.register_predicate(pred, false); if(!m_kinds.empty()) { dctx.set_predicate_representation(pred, m_kinds.size(), m_kinds.c_ptr()); } m_domain = 0; }
// concat array of string into one string std::string implode(const char delimiter, const svector<std::string>& elements) { if (elements.empty()) { return ""; } std::string res; svector<string>::const_iterator it = elements.begin(); res = *it; it++; for(; it != elements.end(); it++) { res += delimiter; res += *it; } return res; }
// return true if n contains a variable in the range [begin, end] bool operator()(expr * n, unsigned begin = 0, unsigned end = UINT_MAX) { m_contains = false; m_window = end - begin; m_todo.reset(); m_cache.reset(); m_todo.push_back(expr_delta_pair(n, begin)); while (!m_todo.empty()) { expr_delta_pair e = m_todo.back(); if (visit_children(e.m_node, e.m_delta)) { m_cache.insert(e); m_todo.pop_back(); } if (m_contains) { return true; } } SASSERT(!m_contains); return false; }
void execute(cmd_context & ctx) override { ctx.regular_stream() << "\""; if (m_cmds.empty()) { vector<named_cmd> cmds; cmd_context::cmd_iterator it = ctx.begin_cmds(); cmd_context::cmd_iterator end = ctx.end_cmds(); for (; it != end; ++it) { cmds.push_back(named_cmd((*it).m_key, (*it).m_value)); } // named_cmd_lt is not a total order for commands, but this is irrelevant for Linux x Windows behavior std::sort(cmds.begin(), cmds.end(), named_cmd_lt()); for (named_cmd const& nc : cmds) { display_cmd(ctx, nc.first, nc.second); } } else { for (symbol const& s : m_cmds) { cmd * c = ctx.find_cmd(s); SASSERT(c); display_cmd(ctx, s, c); } } ctx.regular_stream() << "\"\n"; }
bool empty() const { return m_entries.empty(); }