Z3_func_entry Z3_API Z3_func_interp_get_entry(Z3_context c, Z3_func_interp f, unsigned i) { Z3_TRY; LOG_Z3_func_interp_get_entry(c, f, i); RESET_ERROR_CODE(); CHECK_NON_NULL(f, nullptr); if (i >= to_func_interp_ref(f)->num_entries()) { SET_ERROR_CODE(Z3_IOB, nullptr); RETURN_Z3(nullptr); } Z3_func_entry_ref * e = alloc(Z3_func_entry_ref, *mk_c(c), to_func_interp(f)->m_model.get()); e->m_func_interp = to_func_interp_ref(f); e->m_func_entry = to_func_interp_ref(f)->get_entry(i); mk_c(c)->save_object(e); RETURN_Z3(of_func_entry(e)); Z3_CATCH_RETURN(nullptr); }
unsigned Z3_API Z3_func_interp_get_arity(Z3_context c, Z3_func_interp f) { Z3_TRY; LOG_Z3_func_interp_get_arity(c, f); RESET_ERROR_CODE(); CHECK_NON_NULL(f, 0); return to_func_interp_ref(f)->get_arity(); Z3_CATCH_RETURN(0); }
void Z3_API Z3_func_interp_set_else(Z3_context c, Z3_func_interp f, Z3_ast else_value) { Z3_TRY; LOG_Z3_func_interp_set_else(c, f, else_value); RESET_ERROR_CODE(); // CHECK_NON_NULL(f, 0); to_func_interp_ref(f)->set_else(to_expr(else_value)); Z3_CATCH; }
Z3_ast Z3_API Z3_func_interp_get_else(Z3_context c, Z3_func_interp f) { Z3_TRY; LOG_Z3_func_interp_get_else(c, f); RESET_ERROR_CODE(); CHECK_NON_NULL(f, 0); expr * e = to_func_interp_ref(f)->get_else(); RETURN_Z3(of_expr(e)); Z3_CATCH_RETURN(0); }
Z3_ast Z3_API Z3_func_interp_get_else(Z3_context c, Z3_func_interp f) { Z3_TRY; LOG_Z3_func_interp_get_else(c, f); RESET_ERROR_CODE(); CHECK_NON_NULL(f, nullptr); expr * e = to_func_interp_ref(f)->get_else(); if (e) { mk_c(c)->save_ast_trail(e); } RETURN_Z3(of_expr(e)); Z3_CATCH_RETURN(nullptr); }
void Z3_API Z3_func_interp_add_entry(Z3_context c, Z3_func_interp fi, Z3_ast_vector args, Z3_ast value) { Z3_TRY; LOG_Z3_func_interp_add_entry(c, fi, args, value); //CHECK_NON_NULL(fi, void); //CHECK_NON_NULL(args, void); //CHECK_NON_NULL(value, void); func_interp* _fi = to_func_interp_ref(fi); expr* _value = to_expr(value); if (to_ast_vector_ref(args).size() != _fi->get_arity()) { SET_ERROR_CODE(Z3_IOB, nullptr); return; } // check sorts of value expr* const* _args = (expr* const*) to_ast_vector_ref(args).c_ptr(); _fi->insert_entry(_args, _value); Z3_CATCH; }