示例#1
0
文件: api_tactic.cpp 项目: EinNarr/z3
    static Z3_apply_result _tactic_apply(Z3_context c, Z3_tactic t, Z3_goal g, params_ref p) {
        goal_ref new_goal;
        new_goal = alloc(goal, *to_goal_ref(g));
        Z3_apply_result_ref * ref = alloc(Z3_apply_result_ref, mk_c(c)->m());
        mk_c(c)->save_object(ref); 

        unsigned timeout     = p.get_uint("timeout", UINT_MAX);
        bool     use_ctrl_c  = p.get_bool("ctrl_c", false);
        cancel_eh<reslimit> eh(mk_c(c)->m().limit());
        
        to_tactic_ref(t)->updt_params(p);

        api::context::set_interruptable si(*(mk_c(c)), eh);
        {
            scoped_ctrl_c ctrlc(eh, false, use_ctrl_c);
            scoped_timer timer(timeout, &eh);
            try {
                exec(*to_tactic_ref(t), new_goal, ref->m_subgoals, ref->m_mc, ref->m_pc, ref->m_core);
                return of_apply_result(ref);
            }
            catch (z3_exception & ex) {
                mk_c(c)->handle_exception(ex);
                return 0;
            }
        }
    }
示例#2
0
文件: api_tactic.cpp 项目: EinNarr/z3
 Z3_tactic Z3_API Z3_tactic_cond(Z3_context c, Z3_probe p, Z3_tactic t1, Z3_tactic t2) {
     Z3_TRY;
     LOG_Z3_tactic_cond(c, p, t1, t2);
     RESET_ERROR_CODE();
     tactic * new_t = cond(to_probe_ref(p), to_tactic_ref(t1), to_tactic_ref(t2));
     RETURN_TACTIC(new_t);
     Z3_CATCH_RETURN(0);
 }
示例#3
0
文件: api_tactic.cpp 项目: EinNarr/z3
 Z3_tactic Z3_API Z3_tactic_par_and_then(Z3_context c, Z3_tactic t1, Z3_tactic t2) {
     Z3_TRY;
     LOG_Z3_tactic_par_and_then(c, t1, t2);
     RESET_ERROR_CODE();
     tactic * new_t = par_and_then(to_tactic_ref(t1), to_tactic_ref(t2));
     RETURN_TACTIC(new_t);
     Z3_CATCH_RETURN(0);
 }
示例#4
0
文件: api_tactic.cpp 项目: EinNarr/z3
 Z3_tactic Z3_API Z3_tactic_using_params(Z3_context c, Z3_tactic t, Z3_params p) {
     Z3_TRY;
     LOG_Z3_tactic_using_params(c, t, p);
     RESET_ERROR_CODE();
     param_descrs r;
     to_tactic_ref(t)->collect_param_descrs(r);
     to_param_ref(p).validate(r);
     tactic * new_t = using_params(to_tactic_ref(t), to_param_ref(p));
     RETURN_TACTIC(new_t);
     Z3_CATCH_RETURN(0);
 }
示例#5
0
文件: api_tactic.cpp 项目: EinNarr/z3
 Z3_tactic Z3_API Z3_tactic_repeat(Z3_context c, Z3_tactic t, unsigned max) {
     Z3_TRY;
     LOG_Z3_tactic_repeat(c, t, max);
     RESET_ERROR_CODE();
     tactic * new_t = repeat(to_tactic_ref(t), max);
     RETURN_TACTIC(new_t);
     Z3_CATCH_RETURN(0);
 }
示例#6
0
文件: api_tactic.cpp 项目: EinNarr/z3
 Z3_tactic Z3_API Z3_tactic_when(Z3_context c, Z3_probe p, Z3_tactic t) {
     Z3_TRY;
     LOG_Z3_tactic_when(c, p, t);
     RESET_ERROR_CODE();
     tactic * new_t = when(to_probe_ref(p), to_tactic_ref(t));
     RETURN_TACTIC(new_t);
     Z3_CATCH_RETURN(0);
 }
示例#7
0
文件: api_tactic.cpp 项目: EinNarr/z3
 Z3_tactic Z3_API Z3_tactic_try_for(Z3_context c, Z3_tactic t, unsigned ms) {
     Z3_TRY;
     LOG_Z3_tactic_try_for(c, t, ms);
     RESET_ERROR_CODE();
     tactic * new_t = try_for(to_tactic_ref(t), ms);
     RETURN_TACTIC(new_t);
     Z3_CATCH_RETURN(0);
 }
示例#8
0
 Z3_tactic Z3_API Z3_tactic_using_params(Z3_context c, Z3_tactic t, Z3_params p) {
     Z3_TRY;
     LOG_Z3_tactic_using_params(c, t, p);
     RESET_ERROR_CODE();
     tactic * new_t = using_params(to_tactic_ref(t), to_param_ref(p));
     RETURN_TACTIC(new_t);
     Z3_CATCH_RETURN(0);
 }
示例#9
0
文件: api_solver.cpp 项目: levnach/z3
 Z3_solver Z3_API Z3_mk_solver_from_tactic(Z3_context c, Z3_tactic t) {
     Z3_TRY;
     LOG_Z3_mk_solver_from_tactic(c, t);
     RESET_ERROR_CODE();
     Z3_solver_ref * s = alloc(Z3_solver_ref, *mk_c(c), mk_tactic2solver_factory(to_tactic_ref(t)));
     mk_c(c)->save_object(s);
     Z3_solver r = of_solver(s);
     RETURN_Z3(r);
     Z3_CATCH_RETURN(nullptr);
 }
示例#10
0
文件: api_tactic.cpp 项目: EinNarr/z3
 Z3_apply_result Z3_API Z3_tactic_apply_ex(Z3_context c, Z3_tactic t, Z3_goal g, Z3_params p) {
     Z3_TRY;
     LOG_Z3_tactic_apply_ex(c, t, g, p);
     RESET_ERROR_CODE();
     param_descrs pd;
     to_tactic_ref(t)->collect_param_descrs(pd);
     to_param_ref(p).validate(pd);
     Z3_apply_result r = _tactic_apply(c, t, g, to_param_ref(p));
     RETURN_Z3(r);
     Z3_CATCH_RETURN(0);
 }
示例#11
0
文件: api_tactic.cpp 项目: EinNarr/z3
 Z3_param_descrs Z3_API Z3_tactic_get_param_descrs(Z3_context c, Z3_tactic t) {
     Z3_TRY;
     LOG_Z3_tactic_get_param_descrs(c, t);
     RESET_ERROR_CODE();
     Z3_param_descrs_ref * d = alloc(Z3_param_descrs_ref);
     mk_c(c)->save_object(d);
     to_tactic_ref(t)->collect_param_descrs(d->m_descrs);
     Z3_param_descrs r = of_param_descrs(d);
     RETURN_Z3(r);
     Z3_CATCH_RETURN(0);
 }
示例#12
0
文件: api_tactic.cpp 项目: EinNarr/z3
 Z3_string Z3_API Z3_tactic_get_help(Z3_context c, Z3_tactic t) {
     Z3_TRY;
     LOG_Z3_tactic_get_help(c, t);
     RESET_ERROR_CODE();
     std::ostringstream buffer;
     param_descrs descrs;
     to_tactic_ref(t)->collect_param_descrs(descrs);
     descrs.display(buffer);
     return mk_c(c)->mk_external_string(buffer.str());
     Z3_CATCH_RETURN("");
 }
示例#13
0
文件: api_tactic.cpp 项目: EinNarr/z3
 Z3_tactic Z3_API Z3_tactic_par_or(Z3_context c, unsigned num, Z3_tactic const ts[]) {
     Z3_TRY;
     LOG_Z3_tactic_par_or(c, num, ts);
     RESET_ERROR_CODE();
     ptr_buffer<tactic> _ts;
     for (unsigned i = 0; i < num; i++) {
         _ts.push_back(to_tactic_ref(ts[i]));
     }
     tactic * new_t = par(num, _ts.c_ptr());
     RETURN_TACTIC(new_t);
     Z3_CATCH_RETURN(0);
 }