3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

Use nullptr.

This commit is contained in:
Bruce Mitchener 2018-02-12 14:05:55 +07:00
parent f01328c65f
commit 76eb7b9ede
625 changed files with 4639 additions and 4639 deletions

View file

@ -162,57 +162,57 @@ extern "C" {
Z3_TRY;
LOG_Z3_algebraic_add(c, a, b);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(b, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
CHECK_IS_ALGEBRAIC_X(b, nullptr);
BIN_OP(+,add);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_algebraic_sub(Z3_context c, Z3_ast a, Z3_ast b) {
Z3_TRY;
LOG_Z3_algebraic_sub(c, a, b);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(b, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
CHECK_IS_ALGEBRAIC_X(b, nullptr);
BIN_OP(-,sub);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_algebraic_mul(Z3_context c, Z3_ast a, Z3_ast b) {
Z3_TRY;
LOG_Z3_algebraic_mul(c, a, b);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(b, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
CHECK_IS_ALGEBRAIC_X(b, nullptr);
BIN_OP(*,mul);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_algebraic_div(Z3_context c, Z3_ast a, Z3_ast b) {
Z3_TRY;
LOG_Z3_algebraic_div(c, a, b);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(b, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
CHECK_IS_ALGEBRAIC_X(b, nullptr);
if ((is_rational(c, b) && get_rational(c, b).is_zero()) ||
(!is_rational(c, b) && am(c).is_zero(get_irrational(c, b)))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
BIN_OP(/,div);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_algebraic_root(Z3_context c, Z3_ast a, unsigned k) {
Z3_TRY;
LOG_Z3_algebraic_root(c, a, k);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
if (k % 2 == 0) {
if ((is_rational(c, a) && get_rational(c, a).is_neg()) ||
(!is_rational(c, a) && am(c).is_neg(get_irrational(c, a)))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
algebraic_numbers::manager & _am = am(c);
@ -229,14 +229,14 @@ extern "C" {
expr * r = au(c).mk_numeral(_r, false);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_algebraic_power(Z3_context c, Z3_ast a, unsigned k) {
Z3_TRY;
LOG_Z3_algebraic_power(c, a, k);
RESET_ERROR_CODE();
CHECK_IS_ALGEBRAIC_X(a, 0);
CHECK_IS_ALGEBRAIC_X(a, nullptr);
algebraic_numbers::manager & _am = am(c);
scoped_anum _r(_am);
if (is_rational(c, a)) {
@ -251,7 +251,7 @@ extern "C" {
expr * r = au(c).mk_numeral(_r, false);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
#define BIN_PRED(RAT_PRED, IRAT_PRED) \
@ -357,17 +357,17 @@ extern "C" {
polynomial::manager & pm = mk_c(c)->pm();
polynomial_ref _p(pm);
polynomial::scoped_numeral d(pm.m());
expr2polynomial converter(mk_c(c)->m(), pm, 0, true);
expr2polynomial converter(mk_c(c)->m(), pm, nullptr, true);
if (!converter.to_polynomial(to_expr(p), _p, d) ||
static_cast<unsigned>(max_var(_p)) >= n + 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
algebraic_numbers::manager & _am = am(c);
scoped_anum_vector as(_am);
if (!to_anum_vector(c, n, a, as)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
scoped_anum_vector roots(_am);
{
@ -383,7 +383,7 @@ extern "C" {
result->m_ast_vector.push_back(au(c).mk_numeral(roots.get(i), false));
}
RETURN_Z3(of_ast_vector(result));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
int Z3_API Z3_algebraic_eval(Z3_context c, Z3_ast p, unsigned n, Z3_ast a[]) {
@ -393,7 +393,7 @@ extern "C" {
polynomial::manager & pm = mk_c(c)->pm();
polynomial_ref _p(pm);
polynomial::scoped_numeral d(pm.m());
expr2polynomial converter(mk_c(c)->m(), pm, 0, true);
expr2polynomial converter(mk_c(c)->m(), pm, nullptr, true);
if (!converter.to_polynomial(to_expr(p), _p, d) ||
static_cast<unsigned>(max_var(_p)) >= n) {
SET_ERROR_CODE(Z3_INVALID_ARG);

View file

@ -34,7 +34,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_sort r = of_sort(mk_c(c)->m().mk_sort(mk_c(c)->get_arith_fid(), INT_SORT));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_real_sort(Z3_context c) {
@ -43,7 +43,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_sort r = of_sort(mk_c(c)->m().mk_sort(mk_c(c)->get_arith_fid(), REAL_SORT));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_real(Z3_context c, int num, int den) {
@ -52,12 +52,12 @@ extern "C" {
RESET_ERROR_CODE();
if (den == 0) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
sort* s = mk_c(c)->m().mk_sort(mk_c(c)->get_arith_fid(), REAL_SORT);
ast* a = mk_c(c)->mk_numeral_core(rational(num, den), s);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
MK_ARITH_OP(Z3_mk_add, OP_ADD);
@ -77,11 +77,11 @@ extern "C" {
k = OP_DIV;
}
expr * args[2] = { to_expr(n1), to_expr(n2) };
ast* a = mk_c(c)->m().mk_app(mk_c(c)->get_arith_fid(), k, 0, 0, 2, args);
ast* a = mk_c(c)->m().mk_app(mk_c(c)->get_arith_fid(), k, 0, nullptr, 2, args);
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
MK_ARITH_PRED(Z3_mk_lt, OP_LT);
@ -98,17 +98,17 @@ extern "C" {
RESET_ERROR_CODE();
if (num_args == 0) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr* r = to_expr(args[0]);
for (unsigned i = 1; i < num_args; ++i) {
expr* args1[2] = { r, to_expr(args[i]) };
r = mk_c(c)->m().mk_app(mk_c(c)->get_arith_fid(), OP_SUB, 0, 0, 2, args1);
r = mk_c(c)->m().mk_app(mk_c(c)->get_arith_fid(), OP_SUB, 0, nullptr, 2, args1);
check_sorts(c, r);
}
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_unary_minus(Z3_context c, Z3_ast n) {
@ -116,7 +116,7 @@ extern "C" {
LOG_Z3_mk_unary_minus(c, n);
RESET_ERROR_CODE();
MK_UNARY_BODY(Z3_mk_unary_minus, mk_c(c)->get_arith_fid(), OP_UMINUS, SKIP);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_algebraic_number(Z3_context c, Z3_ast a) {
@ -134,7 +134,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!Z3_is_algebraic_number(c, a)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * e = to_expr(a);
algebraic_numbers::anum const & val = mk_c(c)->autil().to_irrational_algebraic_numeral(e);
@ -143,7 +143,7 @@ extern "C" {
expr * r = mk_c(c)->autil().mk_numeral(l, false);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_get_algebraic_number_upper(Z3_context c, Z3_ast a, unsigned precision) {
@ -152,7 +152,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!Z3_is_algebraic_number(c, a)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * e = to_expr(a);
algebraic_numbers::anum const & val = mk_c(c)->autil().to_irrational_algebraic_numeral(e);
@ -161,7 +161,7 @@ extern "C" {
expr * r = mk_c(c)->autil().mk_numeral(l, false);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_get_numerator(Z3_context c, Z3_ast a) {
@ -172,12 +172,12 @@ extern "C" {
ast * _a = to_ast(a);
if (!is_expr(_a) || !mk_c(c)->autil().is_numeral(to_expr(_a), val)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * r = mk_c(c)->autil().mk_numeral(numerator(val), true);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_get_denominator(Z3_context c, Z3_ast a) {
@ -188,12 +188,12 @@ extern "C" {
ast * _a = to_ast(a);
if (!is_expr(_a) || !mk_c(c)->autil().is_numeral(to_expr(_a), val)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * r = mk_c(c)->autil().mk_numeral(denominator(val), true);
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -31,7 +31,7 @@ extern "C" {
sort * ty = mk_c(c)->m().mk_sort(mk_c(c)->get_array_fid(), ARRAY_SORT, 2, params);
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_array_sort_n(Z3_context c, unsigned n, Z3_sort const* domain, Z3_sort range) {
@ -44,7 +44,7 @@ extern "C" {
sort * ty = mk_c(c)->m().mk_sort(mk_c(c)->get_array_fid(), ARRAY_SORT, params.size(), params.c_ptr());
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_select(Z3_context c, Z3_ast a, Z3_ast i) {
@ -58,7 +58,7 @@ extern "C" {
sort * i_ty = m.get_sort(_i);
if (a_ty->get_family_id() != mk_c(c)->get_array_fid()) {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
sort * domain[2] = {a_ty, i_ty};
func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_SELECT, 2, a_ty->get_parameters(), 2, domain);
@ -67,7 +67,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_select_n(Z3_context c, Z3_ast a, unsigned n, Z3_ast const* idxs) {
@ -81,7 +81,7 @@ extern "C" {
// sort * i_ty = m.get_sort(_i);
if (a_ty->get_family_id() != mk_c(c)->get_array_fid()) {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<sort> domain;
ptr_vector<expr> args;
@ -96,7 +96,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_store(Z3_context c, Z3_ast a, Z3_ast i, Z3_ast v) {
@ -112,7 +112,7 @@ extern "C" {
sort * v_ty = m.get_sort(_v);
if (a_ty->get_family_id() != mk_c(c)->get_array_fid()) {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
sort * domain[3] = {a_ty, i_ty, v_ty};
func_decl * d = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_STORE, 2, a_ty->get_parameters(), 3, domain);
@ -121,7 +121,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_store_n(Z3_context c, Z3_ast a, unsigned n, Z3_ast const* idxs, Z3_ast v) {
@ -135,7 +135,7 @@ extern "C" {
sort * v_ty = m.get_sort(_v);
if (a_ty->get_family_id() != mk_c(c)->get_array_fid()) {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<sort> domain;
ptr_vector<expr> args;
@ -152,7 +152,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_map(Z3_context c, Z3_func_decl f, unsigned n, Z3_ast const* args) {
@ -161,7 +161,7 @@ extern "C" {
RESET_ERROR_CODE();
if (n == 0) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ast_manager & m = mk_c(c)->m();
func_decl* _f = to_func_decl(f);
@ -177,7 +177,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_const_array(Z3_context c, Z3_sort domain, Z3_ast v) {
@ -196,7 +196,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_array_default(Z3_context c, Z3_ast array) {
@ -206,12 +206,12 @@ extern "C" {
ast_manager & m = mk_c(c)->m();
expr * _a = to_expr(array);
func_decl * f = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_ARRAY_DEFAULT, 0, 0, 1, &_a);
func_decl * f = m.mk_func_decl(mk_c(c)->get_array_fid(), OP_ARRAY_DEFAULT, 0, nullptr, 1, &_a);
app * r = m.mk_app(f, 1, &_a);
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast mk_app_array_core(Z3_context c, Z3_sort domain, Z3_ast v) {
@ -233,7 +233,7 @@ extern "C" {
Z3_sort Z3_API Z3_mk_set_sort(Z3_context c, Z3_sort ty) {
Z3_TRY;
return Z3_mk_array_sort(c, ty, Z3_mk_bool_sort(c));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_empty_set(Z3_context c, Z3_sort domain) {
@ -242,7 +242,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = mk_app_array_core(c, domain, Z3_mk_false(c));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_full_set(Z3_context c, Z3_sort domain) {
@ -251,7 +251,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = mk_app_array_core(c, domain, Z3_mk_true(c));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
MK_NARY(Z3_mk_set_union, mk_c(c)->get_array_fid(), OP_SET_UNION, SKIP);
@ -270,7 +270,7 @@ extern "C" {
app * r = a.mk_as_array(to_func_decl(f));
mk_c(c)->save_ast_trail(r);
return of_ast(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_mk_set_member(Z3_context c, Z3_ast elem, Z3_ast set) {
@ -289,22 +289,22 @@ extern "C" {
Z3_TRY;
LOG_Z3_get_array_sort_domain(c, t);
RESET_ERROR_CODE();
CHECK_VALID_AST(t, 0);
CHECK_VALID_AST(t, nullptr);
if (to_sort(t)->get_family_id() == mk_c(c)->get_array_fid() &&
to_sort(t)->get_decl_kind() == ARRAY_SORT) {
Z3_sort r = reinterpret_cast<Z3_sort>(to_sort(t)->get_parameter(0).get_ast());
RETURN_Z3(r);
}
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
Z3_CATCH_RETURN(0);
RETURN_Z3(nullptr);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_get_array_sort_range(Z3_context c, Z3_sort t) {
Z3_TRY;
LOG_Z3_get_array_sort_range(c, t);
RESET_ERROR_CODE();
CHECK_VALID_AST(t, 0);
CHECK_VALID_AST(t, nullptr);
if (to_sort(t)->get_family_id() == mk_c(c)->get_array_fid() &&
to_sort(t)->get_decl_kind() == ARRAY_SORT) {
unsigned n = to_sort(t)->get_num_parameters();
@ -312,8 +312,8 @@ extern "C" {
RETURN_Z3(r);
}
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
Z3_CATCH_RETURN(0);
RETURN_Z3(nullptr);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -49,11 +49,11 @@ extern "C" {
RESET_ERROR_CODE();
if (i < 0 || (size_t)i >= (SIZE_MAX >> PTR_ALIGNMENT)) {
SET_ERROR_CODE(Z3_IOB);
return 0;
return nullptr;
}
Z3_symbol result = of_symbol(symbol(i));
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_symbol Z3_API Z3_mk_string_symbol(Z3_context c, char const * str) {
@ -61,13 +61,13 @@ extern "C" {
LOG_Z3_mk_string_symbol(c, str);
RESET_ERROR_CODE();
symbol s;
if (str == 0 || *str == 0)
if (str == nullptr || *str == 0)
s = symbol::null;
else
s = symbol(str);
Z3_symbol result = of_symbol(s);
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_eq_sort(Z3_context c, Z3_sort s1, Z3_sort s2) {
@ -82,7 +82,7 @@ extern "C" {
sort* ty = mk_c(c)->m().mk_uninterpreted_sort(to_symbol(name));
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_eq_ast(Z3_context c, Z3_ast s1, Z3_ast s2) {
@ -107,7 +107,7 @@ extern "C" {
mk_c(c)->save_ast_trail(d);
RETURN_Z3(of_func_decl(d));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_app(Z3_context c, Z3_func_decl d, unsigned num_args, Z3_ast const * args) {
@ -123,7 +123,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_const(Z3_context c, Z3_symbol s, Z3_sort ty) {
@ -133,7 +133,7 @@ extern "C" {
app* a = mk_c(c)->m().mk_const(mk_c(c)->m().mk_const_decl(to_symbol(s), to_sort(ty)));
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -142,7 +142,7 @@ extern "C" {
Z3_TRY;
LOG_Z3_mk_fresh_func_decl(c, prefix, domain_size, domain, range);
RESET_ERROR_CODE();
if (prefix == 0) {
if (prefix == nullptr) {
prefix = "";
}
@ -153,20 +153,20 @@ extern "C" {
mk_c(c)->save_ast_trail(d);
RETURN_Z3(of_func_decl(d));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fresh_const(Z3_context c, const char * prefix, Z3_sort ty) {
Z3_TRY;
LOG_Z3_mk_fresh_const(c, prefix, ty);
RESET_ERROR_CODE();
if (prefix == 0) {
if (prefix == nullptr) {
prefix = "";
}
app* a = mk_c(c)->m().mk_fresh_const(prefix, to_sort(ty));
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_true(Z3_context c) {
@ -175,7 +175,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = of_ast(mk_c(c)->m().mk_true());
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_false(Z3_context c) {
@ -184,7 +184,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = of_ast(mk_c(c)->m().mk_false());
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
MK_UNARY(Z3_mk_not, mk_c(c)->get_basic_fid(), OP_NOT, SKIP);
@ -210,7 +210,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = mk_ite_core(c, t1, t2, t3);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_bool_sort(Z3_context c) {
@ -219,7 +219,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_sort r = of_sort(mk_c(c)->m().mk_sort(mk_c(c)->m().get_basic_family_id(), BOOL_SORT));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_app_to_ast(Z3_context c, Z3_app a) {
@ -335,7 +335,7 @@ extern "C" {
Z3_bool Z3_API Z3_is_app(Z3_context c, Z3_ast a) {
LOG_Z3_is_app(c, a);
RESET_ERROR_CODE();
return a != 0 && is_app(reinterpret_cast<ast*>(a));
return a != nullptr && is_app(reinterpret_cast<ast*>(a));
}
Z3_app Z3_API Z3_to_app(Z3_context c, Z3_ast a) {
@ -357,7 +357,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_app(reinterpret_cast<ast*>(a))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(of_func_decl(to_app(a)->get_decl()));
}
@ -373,11 +373,11 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_app(reinterpret_cast<ast*>(a))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
if (i >= to_app(a)->get_num_args()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(of_ast(to_app(a)->get_arg(i)));
}
@ -466,15 +466,15 @@ extern "C" {
RESET_ERROR_CODE();
if (idx >= to_func_decl(d)->get_num_parameters()) {
SET_ERROR_CODE(Z3_IOB);
return 0;
return nullptr;
}
parameter const& p = to_func_decl(d)->get_parameters()[idx];
if (!p.is_symbol()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
return of_symbol(p.get_symbol());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_get_decl_sort_parameter(Z3_context c, Z3_func_decl d, unsigned idx) {
@ -483,15 +483,15 @@ extern "C" {
RESET_ERROR_CODE();
if (idx >= to_func_decl(d)->get_num_parameters()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
parameter const& p = to_func_decl(d)->get_parameters()[idx];
if (!p.is_ast() || !is_sort(p.get_ast())) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(of_sort(to_sort(p.get_ast())));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_get_decl_ast_parameter(Z3_context c, Z3_func_decl d, unsigned idx) {
@ -500,15 +500,15 @@ extern "C" {
RESET_ERROR_CODE();
if (idx >= to_func_decl(d)->get_num_parameters()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
parameter const& p = to_func_decl(d)->get_parameters()[idx];
if (!p.is_ast()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(of_ast(p.get_ast()));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_func_decl Z3_API Z3_get_decl_func_decl_parameter(Z3_context c, Z3_func_decl d, unsigned idx) {
@ -517,15 +517,15 @@ extern "C" {
RESET_ERROR_CODE();
if (idx >= to_func_decl(d)->get_num_parameters()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
parameter const& p = to_func_decl(d)->get_parameters()[idx];
if (!p.is_ast() || !is_func_decl(p.get_ast())) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(of_func_decl(to_func_decl(p.get_ast())));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_get_decl_rational_parameter(Z3_context c, Z3_func_decl d, unsigned idx) {
@ -551,17 +551,17 @@ extern "C" {
LOG_Z3_get_sort_name(c, t);
RESET_ERROR_CODE();
return of_symbol(to_sort(t)->get_name());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a) {
Z3_TRY;
LOG_Z3_get_sort(c, a);
RESET_ERROR_CODE();
CHECK_IS_EXPR(a, 0);
CHECK_IS_EXPR(a, nullptr);
Z3_sort r = of_sort(mk_c(c)->m().get_sort(to_expr(a)));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_get_arity(Z3_context c, Z3_func_decl d) {
@ -586,21 +586,21 @@ extern "C" {
RESET_ERROR_CODE();
if (i >= to_func_decl(d)->get_arity()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_sort r = of_sort(to_func_decl(d)->get_domain(i));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_get_range(Z3_context c, Z3_func_decl d) {
Z3_TRY;
LOG_Z3_get_range(c, d);
RESET_ERROR_CODE();
CHECK_VALID_AST(d, 0);
CHECK_VALID_AST(d, nullptr);
Z3_sort r = of_sort(to_func_decl(d)->get_range());
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort_kind Z3_get_sort_kind(Z3_context c, Z3_sort t) {
@ -688,17 +688,17 @@ extern "C" {
}
catch (z3_exception & ex) {
mk_c(c)->handle_exception(ex);
return 0;
return nullptr;
}
}
mk_c(c)->save_ast_trail(result);
return of_ast(result.get());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_simplify(Z3_context c, Z3_ast _a) {
LOG_Z3_simplify(c, _a);
RETURN_Z3(simplify(c, _a, 0));
RETURN_Z3(simplify(c, _a, nullptr));
}
Z3_ast Z3_API Z3_simplify_ex(Z3_context c, Z3_ast _a, Z3_params p) {
@ -727,7 +727,7 @@ extern "C" {
th_rewriter::get_param_descrs(d->m_descrs);
Z3_param_descrs r = of_param_descrs(d);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_update_term(Z3_context c, Z3_ast _a, unsigned num_args, Z3_ast const _args[]) {
@ -762,7 +762,7 @@ extern "C" {
}
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_substitute(Z3_context c,
@ -777,11 +777,11 @@ extern "C" {
expr * a = to_expr(_a);
expr * const * from = to_exprs(_from);
expr * const * to = to_exprs(_to);
expr * r = 0;
expr * r = nullptr;
for (unsigned i = 0; i < num_exprs; i++) {
if (m.get_sort(from[i]) != m.get_sort(to[i])) {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(of_expr(0));
RETURN_Z3(of_expr(nullptr));
}
SASSERT(from[i]->get_ref_count() > 0);
SASSERT(to[i]->get_ref_count() > 0);
@ -795,7 +795,7 @@ extern "C" {
mk_c(c)->save_ast_trail(new_a);
r = new_a.get();
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_substitute_vars(Z3_context c,
@ -813,7 +813,7 @@ extern "C" {
subst(a, num_exprs, to, new_a);
mk_c(c)->save_ast_trail(new_a);
RETURN_Z3(of_expr(new_a.get()));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_API char const * Z3_ast_to_string(Z3_context c, Z3_ast a) {
@ -839,7 +839,7 @@ extern "C" {
UNREACHABLE();
}
return mk_c(c)->mk_external_string(buffer.str());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_API char const * Z3_sort_to_string(Z3_context c, Z3_sort s) {
@ -1233,17 +1233,17 @@ extern "C" {
Z3_TRY;
LOG_Z3_translate(c, a, target);
RESET_ERROR_CODE();
CHECK_VALID_AST(a, 0);
CHECK_VALID_AST(a, nullptr);
if (c == target) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
SASSERT(mk_c(c)->m().contains(to_ast(a)));
ast_translation translator(mk_c(c)->m(), mk_c(target)->m());
ast * _result = translator(to_ast(a));
mk_c(target)->save_ast_trail(_result);
RETURN_Z3(of_ast(_result));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -38,7 +38,7 @@ extern "C" {
mk_c(c)->save_object(m);
Z3_ast_map r = of_ast_map(m);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_ast_map_inc_ref(Z3_context c, Z3_ast_map m) {
@ -70,15 +70,15 @@ extern "C" {
LOG_Z3_ast_map_find(c, m, k);
RESET_ERROR_CODE();
obj_map<ast, ast*>::obj_map_entry * entry = to_ast_map_ref(m).find_core(to_ast(k));
if (entry == 0) {
if (entry == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
else {
ast * r = entry->get_data().m_value;
RETURN_Z3(of_ast(r));
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_ast_map_insert(Z3_context c, Z3_ast_map m, Z3_ast k, Z3_ast v) {
@ -115,7 +115,7 @@ extern "C" {
Z3_TRY;
LOG_Z3_ast_map_erase(c, m, k);
RESET_ERROR_CODE();
ast * v = 0;
ast * v = nullptr;
if (to_ast_map_ref(m).find(to_ast(k), v)) {
to_ast_map_ref(m).erase(to_ast(k));
ast_manager & mng = to_ast_map(m)->m;
@ -146,7 +146,7 @@ extern "C" {
}
Z3_ast_vector r = of_ast_vector(v);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_ast_map_to_string(Z3_context c, Z3_ast_map m) {
@ -163,7 +163,7 @@ extern "C" {
}
buffer << ")";
return mk_c(c)->mk_external_string(buffer.str());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -33,7 +33,7 @@ extern "C" {
mk_c(c)->save_object(v);
Z3_ast_vector r = of_ast_vector(v);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_ast_vector_inc_ref(Z3_context c, Z3_ast_vector v) {
@ -66,12 +66,12 @@ extern "C" {
RESET_ERROR_CODE();
if (i >= to_ast_vector_ref(v).size()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
// Remark: Don't need to invoke save_object.
ast * r = to_ast_vector_ref(v).get(i);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_ast_vector_set(Z3_context c, Z3_ast_vector v, unsigned i, Z3_ast a) {
@ -108,7 +108,7 @@ extern "C" {
RESET_ERROR_CODE();
if (c == t) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ast_translation translator(mk_c(c)->m(), mk_c(t)->m());
Z3_ast_vector_ref * new_v = alloc(Z3_ast_vector_ref, *mk_c(t), mk_c(t)->m());
@ -119,7 +119,7 @@ extern "C" {
new_v->m_ast_vector.push_back(new_ast);
}
RETURN_Z3(of_ast_vector(new_v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_ast_vector_to_string(Z3_context c, Z3_ast_vector v) {
@ -134,7 +134,7 @@ extern "C" {
}
buffer << ")";
return mk_c(c)->mk_external_string(buffer.str());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -33,7 +33,7 @@ extern "C" {
parameter p(sz);
Z3_sort r = of_sort(mk_c(c)->m().mk_sort(mk_c(c)->get_bv_fid(), BV_SORT, 1, &p));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
#define MK_BV_UNARY(NAME, OP) MK_UNARY(NAME, mk_c(c)->get_bv_fid(), OP, SKIP)
@ -85,7 +85,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_ast r = mk_extract_core(c, high, low, n);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
#define MK_BV_PUNARY(NAME, OP) \
@ -146,7 +146,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
check_sorts(c, a);
RETURN_Z3(of_ast(a));
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
/**
@ -164,7 +164,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
unsigned sz = Z3_get_bv_sort_size(c, s);
if (sz == 0) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
Z3_ast x = Z3_mk_int64(c, 1, s);
Z3_inc_ref(c, x);
@ -174,7 +174,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_dec_ref(c, x);
Z3_dec_ref(c, y);
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_mk_bvsmin(Z3_context c, Z3_sort s) {
@ -229,7 +229,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_dec_ref(c, r);
return result;
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// only for signed machine integers
@ -257,7 +257,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_dec_ref(c, args_neg);
Z3_dec_ref(c, zero);
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// only for signed machine integers
@ -286,7 +286,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_dec_ref(c, z);
Z3_dec_ref(c, zero);
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_bvsub_no_underflow(Z3_context c, Z3_ast t1, Z3_ast t2, Z3_bool is_signed) {
@ -311,7 +311,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
else {
return Z3_mk_bvule(c, t2, t1);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_bvmul_no_overflow(Z3_context c, Z3_ast n1, Z3_ast n2, Z3_bool is_signed) {
@ -336,11 +336,11 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_TRY;
RESET_ERROR_CODE();
Z3_ast min = Z3_mk_bvsmin(c, Z3_get_sort(c, t));
if (Z3_get_error_code(c) != Z3_OK) return 0;
if (Z3_get_error_code(c) != Z3_OK) return nullptr;
Z3_ast eq = Z3_mk_eq(c, t, min);
if (Z3_get_error_code(c) != Z3_OK) return 0;
if (Z3_get_error_code(c) != Z3_OK) return nullptr;
return Z3_mk_not(c, eq);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// only for signed machine integers
@ -366,7 +366,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
Z3_dec_ref(c, z);
Z3_dec_ref(c, u);
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_bvsub(Z3_context c, Z3_ast n1, Z3_ast n2) {
@ -374,7 +374,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
LOG_Z3_mk_bvsub(c, n1, n2);
RESET_ERROR_CODE();
MK_BINARY_BODY(Z3_mk_bvsub, mk_c(c)->get_bv_fid(), OP_BSUB, SKIP);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_bvneg(Z3_context c, Z3_ast n) {
@ -382,7 +382,7 @@ Z3_ast Z3_API NAME(Z3_context c, unsigned i, Z3_ast n) { \
LOG_Z3_mk_bvneg(c, n);
RESET_ERROR_CODE();
MK_UNARY_BODY(Z3_mk_bvneg, mk_c(c)->get_bv_fid(), OP_BNEG, SKIP);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_get_bv_sort_size(Z3_context c, Z3_sort t) {

View file

@ -53,7 +53,7 @@ extern "C" {
Z3_bool_opt Z3_API Z3_global_param_get(Z3_string param_id, Z3_string_ptr param_value) {
memory::initialize(UINT_MAX);
LOG_Z3_global_param_get(param_id, param_value);
*param_value = 0;
*param_value = nullptr;
try {
g_Z3_global_param_get_buffer = gparams::get_value(param_id);
*param_value = g_Z3_global_param_get_buffer.c_str();

View file

@ -70,7 +70,7 @@ namespace api {
// ------------------------
context::context(context_params * p, bool user_ref_count):
m_params(p != 0 ? *p : context_params()),
m_params(p != nullptr ? *p : context_params()),
m_user_ref_count(user_ref_count),
m_manager(m_params.mk_ast_manager()),
m_plugins(m()),
@ -89,7 +89,7 @@ namespace api {
m_searching = false;
m_interruptable = 0;
m_interruptable = nullptr;
m_error_handler = &default_error_handler;
m_basic_fid = m().get_basic_family_id();
@ -108,7 +108,7 @@ namespace api {
context::~context() {
m_last_obj = 0;
m_last_obj = nullptr;
u_map<api::object*>::iterator it = m_allocated_objects.begin();
while (it != m_allocated_objects.end()) {
api::object* val = it->m_value;
@ -131,7 +131,7 @@ namespace api {
context::set_interruptable::~set_interruptable() {
#pragma omp critical (set_interruptable)
{
m_ctx.m_interruptable = 0;
m_ctx.m_interruptable = nullptr;
}
}
@ -175,7 +175,7 @@ namespace api {
}
expr * context::mk_numeral_core(rational const & n, sort * s) {
expr* e = 0;
expr* e = nullptr;
family_id fid = s->get_family_id();
if (fid == m_arith_fid) {
e = m_arith_util.mk_numeral(n, s);
@ -239,7 +239,7 @@ namespace api {
void context::reset_last_result() {
if (m_user_ref_count)
m_last_result.reset();
m_last_obj = 0;
m_last_obj = nullptr;
}
void context::save_object(object * r) {
@ -313,7 +313,7 @@ namespace api {
//
// -----------------------
realclosure::manager & context::rcfm() {
if (m_rcf_manager.get() == 0) {
if (m_rcf_manager.get() == nullptr) {
m_rcf_manager = alloc(realclosure::manager, m_limit, m_rcf_qm);
}
return *(m_rcf_manager.get());
@ -336,7 +336,7 @@ extern "C" {
memory::initialize(UINT_MAX);
Z3_context r = reinterpret_cast<Z3_context>(alloc(api::context, reinterpret_cast<context_params*>(c), false));
RETURN_Z3(r);
Z3_CATCH_RETURN_NO_HANDLE(0);
Z3_CATCH_RETURN_NO_HANDLE(nullptr);
}
Z3_context Z3_API Z3_mk_context_rc(Z3_config c) {
@ -345,7 +345,7 @@ extern "C" {
memory::initialize(UINT_MAX);
Z3_context r = reinterpret_cast<Z3_context>(alloc(api::context, reinterpret_cast<context_params*>(c), true));
RETURN_Z3(r);
Z3_CATCH_RETURN_NO_HANDLE(0);
Z3_CATCH_RETURN_NO_HANDLE(nullptr);
}
void Z3_API Z3_del_context(Z3_context c) {
@ -459,7 +459,7 @@ extern "C" {
case Z3_INTERNAL_FATAL: return "internal error";
case Z3_INVALID_USAGE: return "invalid usage";
case Z3_DEC_REF_ERROR: return "invalid dec_ref command";
case Z3_EXCEPTION: return c == 0 ? "Z3 exception" : mk_c(c)->get_exception_msg();
case Z3_EXCEPTION: return c == nullptr ? "Z3 exception" : mk_c(c)->get_exception_msg();
default: return "unknown";
}
}

View file

@ -45,9 +45,9 @@ namespace api {
ast_ref_vector m_trail;
public:
fixedpoint_context(ast_manager& m, smt_params& p):
m_state(0),
m_reduce_app(0),
m_reduce_assign(0),
m_state(nullptr),
m_reduce_app(nullptr),
m_reduce_assign(nullptr),
m_context(m, m_register_engine, p),
m_trail(m) {}
@ -74,7 +74,7 @@ namespace api {
m_reduce_assign = f;
}
void reduce(func_decl* f, unsigned num_args, expr * const* args, expr_ref& result) override {
expr* r = 0;
expr* r = nullptr;
if (m_reduce_app) {
m_reduce_app(m_state, f, num_args, args, &r);
result = r;
@ -85,7 +85,7 @@ namespace api {
m_trail.push_back(r);
}
// allow fallthrough.
if (r == 0) {
if (r == nullptr) {
ast_manager& m = m_context.get_manager();
result = m.mk_app(f, num_args, args);
}
@ -171,22 +171,22 @@ extern "C" {
sort * r = to_sort(s);
if (Z3_get_sort_kind(c, s) != Z3_RELATION_SORT) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
if (col >= r->get_num_parameters()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
parameter const& p = r->get_parameter(col);
if (!p.is_ast() || !is_sort(p.get_ast())) {
UNREACHABLE();
warning_msg("Sort parameter expected at %d", col);
SET_ERROR_CODE(Z3_INTERNAL_FATAL);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_sort res = of_sort(to_sort(p.get_ast()));
RETURN_Z3(res);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_finite_domain_sort(Z3_context c, Z3_symbol name, __uint64 size) {
@ -196,7 +196,7 @@ extern "C" {
sort* s = mk_c(c)->datalog_util().mk_sort(to_symbol(name), size);
mk_c(c)->save_ast_trail(s);
RETURN_Z3(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_get_finite_domain_sort_size(Z3_context c, Z3_sort s, __uint64 * out) {
@ -228,7 +228,7 @@ extern "C" {
mk_c(c)->save_object(d);
Z3_fixedpoint r = of_datalog(d);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_inc_ref(Z3_context c, Z3_fixedpoint s) {
@ -331,7 +331,7 @@ extern "C" {
expr* e = to_fixedpoint_ref(d)->ctx().get_answer_as_formula();
mk_c(c)->save_ast_trail(e);
RETURN_Z3(of_expr(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_fixedpoint_get_reason_unknown(Z3_context c,Z3_fixedpoint d) {
@ -366,7 +366,7 @@ extern "C" {
ctx.set_ignore_check(true);
if (!parse_smt2_commands(ctx, s)) {
SET_ERROR_CODE(Z3_PARSER_ERROR);
return 0;
return nullptr;
}
Z3_ast_vector_ref* v = alloc(Z3_ast_vector_ref, *mk_c(c), m);
@ -398,7 +398,7 @@ extern "C" {
std::string str(s);
std::istringstream is(str);
RETURN_Z3(Z3_fixedpoint_from_stream(c, d, is));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_fixedpoint_from_file(
@ -410,10 +410,10 @@ extern "C" {
std::ifstream is(s);
if (!is) {
SET_ERROR_CODE(Z3_PARSER_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
RETURN_Z3(Z3_fixedpoint_from_stream(c, d, is));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -426,7 +426,7 @@ extern "C" {
mk_c(c)->save_object(st);
Z3_stats r = of_stats(st);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_register_relation(Z3_context c,Z3_fixedpoint d, Z3_func_decl f) {
@ -473,7 +473,7 @@ extern "C" {
v->m_ast_vector.push_back(m.mk_not(queries[i].get()));
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_fixedpoint_get_assertions(
@ -490,7 +490,7 @@ extern "C" {
v->m_ast_vector.push_back(to_fixedpoint_ref(d)->ctx().get_assertion(i));
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_set_reduce_assign_callback(
@ -541,7 +541,7 @@ extern "C" {
expr_ref r = to_fixedpoint_ref(d)->get_cover_delta(level, to_func_decl(pred));
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r.get()));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_add_cover(Z3_context c, Z3_fixedpoint d, int level, Z3_func_decl pred, Z3_ast property) {
@ -573,7 +573,7 @@ extern "C" {
to_fixedpoint_ref(f)->collect_param_descrs(d->m_descrs);
Z3_param_descrs r = of_param_descrs(d);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_set_params(Z3_context c, Z3_fixedpoint d, Z3_params p) {

View file

@ -37,7 +37,7 @@ namespace api {
struct Z3_fixedpoint_ref : public api::object {
api::fixedpoint_context * m_datalog;
params_ref m_params;
Z3_fixedpoint_ref(api::context& c): api::object(c), m_datalog(0) {}
Z3_fixedpoint_ref(api::context& c): api::object(c), m_datalog(nullptr) {}
~Z3_fixedpoint_ref() override { dealloc(m_datalog); }
};

View file

@ -49,7 +49,7 @@ Notes:
expr* e = to_fixedpoint_ref(d)->ctx().get_ground_sat_answer();
mk_c(c)->save_ast_trail(e);
RETURN_Z3(of_expr(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_fixedpoint_get_rules_along_trace(
@ -69,7 +69,7 @@ Notes:
v->m_ast_vector.push_back(rules[i].get());
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_symbol Z3_API Z3_fixedpoint_get_rule_names_along_trace(
@ -90,7 +90,7 @@ Notes:
ss << ";" << names[i].str();
}
RETURN_Z3(of_symbol(symbol(ss.str().substr(1).c_str())));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_fixedpoint_add_invariant(Z3_context c, Z3_fixedpoint d, Z3_func_decl pred, Z3_ast property) {
@ -108,6 +108,6 @@ Notes:
expr_ref r = to_fixedpoint_ref(d)->ctx().get_reachable(to_func_decl(pred));
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r.get()));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}

View file

@ -52,12 +52,12 @@ extern "C" {
{
datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, 1, constrs);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, 0, tuples);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, nullptr, tuples);
del_datatype_decl(dt);
if (!is_ok) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
@ -82,7 +82,7 @@ extern "C" {
proj_decls[i] = of_func_decl(_accs[i]);
}
RETURN_Z3_mk_tuple_sort(of_sort(tuple));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_enumeration_sort(Z3_context c,
@ -108,18 +108,18 @@ extern "C" {
recognizer_s += e_name.str();
symbol recognizer(recognizer_s.c_str());
constrs.push_back(mk_constructor_decl(e_name, recognizer, 0, 0));
constrs.push_back(mk_constructor_decl(e_name, recognizer, 0, nullptr));
}
{
datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, 0, n, constrs.c_ptr());
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, 0, sorts);
datatype_decl * dt = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, n, constrs.c_ptr());
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &dt, 0, nullptr, sorts);
del_datatype_decl(dt);
if (!is_ok) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
@ -143,7 +143,7 @@ extern "C" {
}
RETURN_Z3_mk_enumeration_sort(of_sort(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_list_sort(Z3_context c,
@ -168,7 +168,7 @@ extern "C" {
mk_accessor_decl(m, symbol("tail"), type_ref(0))
};
constructor_decl* constrs[2] = {
mk_constructor_decl(symbol("nil"), symbol("is_nil"), 0, 0),
mk_constructor_decl(symbol("nil"), symbol("is_nil"), 0, nullptr),
// Leo: SMT 2.0 document uses 'insert' instead of cons
mk_constructor_decl(symbol("cons"), symbol("is_cons"), 2, head_tail)
};
@ -176,12 +176,12 @@ extern "C" {
sort_ref_vector sorts(m);
{
datatype_decl * decl = mk_datatype_decl(dt_util, to_symbol(name), 0, nullptr, 2, constrs);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &decl, 0, 0, sorts);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &decl, 0, nullptr, sorts);
del_datatype_decl(decl);
if (!is_ok) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
sort * s = sorts.get(0);
@ -225,7 +225,7 @@ extern "C" {
*tail_decl = of_func_decl(f);
}
RETURN_Z3_mk_list_sort(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
struct constructor {
@ -259,7 +259,7 @@ extern "C" {
cnstr->m_sort_refs.push_back(sort_refs[i]);
}
RETURN_Z3(reinterpret_cast<Z3_constructor>(cnstr));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -349,12 +349,12 @@ extern "C" {
sort_ref_vector sorts(m);
{
datatype_decl * data = mk_datatype_decl(c, name, num_constructors, constructors);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &data, 0, 0, sorts);
bool is_ok = mk_c(c)->get_dt_plugin()->mk_datatypes(1, &data, 0, nullptr, sorts);
del_datatype_decl(data);
if (!is_ok) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
sort * s = sorts.get(0);
@ -367,7 +367,7 @@ extern "C" {
cn->m_constructor = cnstrs[i];
}
RETURN_Z3_mk_datatype(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
typedef ptr_vector<constructor> constructor_list;
@ -383,7 +383,7 @@ extern "C" {
result->push_back(reinterpret_cast<constructor*>(constructors[i]));
}
RETURN_Z3(reinterpret_cast<Z3_constructor_list>(result));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_del_constructor_list(Z3_context c, Z3_constructor_list clist) {
@ -412,7 +412,7 @@ extern "C" {
datas.push_back(mk_datatype_decl(c, sort_names[i], cl->size(), reinterpret_cast<Z3_constructor*>(cl->c_ptr())));
}
sort_ref_vector _sorts(m);
bool ok = mk_c(c)->get_dt_plugin()->mk_datatypes(datas.size(), datas.c_ptr(), 0, 0, _sorts);
bool ok = mk_c(c)->get_dt_plugin()->mk_datatypes(datas.size(), datas.c_ptr(), 0, nullptr, _sorts);
del_datatype_decls(datas.size(), datas.c_ptr());
if (!ok) {
@ -454,17 +454,17 @@ extern "C" {
Z3_func_decl get_datatype_sort_constructor_core(Z3_context c, Z3_sort t, unsigned idx) {
RESET_ERROR_CODE();
CHECK_VALID_AST(t, 0);
CHECK_VALID_AST(t, nullptr);
sort * _t = to_sort(t);
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(_t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(_t);
if (idx >= decls.size()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
func_decl* decl = (decls)[idx];
mk_c(c)->save_ast_trail(decl);
@ -477,7 +477,7 @@ extern "C" {
RESET_ERROR_CODE();
Z3_func_decl r = get_datatype_sort_constructor_core(c, t, idx);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_func_decl Z3_API Z3_get_datatype_sort_recognizer(Z3_context c, Z3_sort t, unsigned idx) {
@ -489,18 +489,18 @@ extern "C" {
if (!dt_util.is_datatype(_t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(_t);
if (idx >= decls.size()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
func_decl* decl = (decls)[idx];
decl = dt_util.get_constructor_recognizer(decl);
mk_c(c)->save_ast_trail(decl);
RETURN_Z3(of_func_decl(decl));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_func_decl Z3_API Z3_get_datatype_sort_constructor_accessor(Z3_context c, Z3_sort t, unsigned idx_c, unsigned idx_a) {
@ -512,28 +512,28 @@ extern "C" {
if (!dt_util.is_datatype(_t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(_t);
if (idx_c >= decls.size()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
func_decl* decl = (decls)[idx_c];
if (decl->get_arity() <= idx_a) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<func_decl> const & accs = *dt_util.get_constructor_accessors(decl);
SASSERT(accs.size() == decl->get_arity());
if (accs.size() <= idx_a) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
decl = (accs)[idx_a];
mk_c(c)->save_ast_trail(decl);
RETURN_Z3(of_func_decl(decl));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_func_decl Z3_API Z3_get_tuple_sort_mk_decl(Z3_context c, Z3_sort t) {
@ -544,11 +544,11 @@ extern "C" {
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(tuple) || dt_util.is_recursive(tuple) || dt_util.get_datatype_num_constructors(tuple) != 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_func_decl r = get_datatype_sort_constructor_core(c, t, 0);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_get_tuple_sort_num_fields(Z3_context c, Z3_sort t) {
@ -579,22 +579,22 @@ extern "C" {
datatype_util& dt_util = mk_c(c)->dtutil();
if (!dt_util.is_datatype(tuple) || dt_util.is_recursive(tuple) || dt_util.get_datatype_num_constructors(tuple) != 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<func_decl> const & decls = *dt_util.get_datatype_constructors(tuple);
if (decls.size() != 1) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<func_decl> const & accs = *dt_util.get_constructor_accessors((decls)[0]);
if (accs.size() <= i) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
func_decl* acc = (accs)[i];
mk_c(c)->save_ast_trail(acc);
RETURN_Z3(of_func_decl(acc));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_datatype_update_field(
@ -614,7 +614,7 @@ extern "C" {
mk_c(c)->save_ast_trail(r);
check_sorts(c, r);
RETURN_Z3(of_ast(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}

View file

@ -56,7 +56,7 @@ extern "C" {
sort * s = ctx->fpautil().mk_rm_sort();
mk_c(c)->save_ast_trail(s);
RETURN_Z3(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_nearest_ties_to_even(Z3_context c) {
@ -67,7 +67,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_nearest_ties_to_even();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rne(Z3_context c) {
@ -78,7 +78,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_nearest_ties_to_even();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_nearest_ties_to_away(Z3_context c) {
@ -89,7 +89,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_nearest_ties_to_away();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rna(Z3_context c) {
@ -100,7 +100,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_nearest_ties_to_away();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_toward_positive(Z3_context c) {
@ -111,7 +111,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_positive();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rtp(Z3_context c) {
@ -122,7 +122,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_positive();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_toward_negative(Z3_context c) {
@ -133,7 +133,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_negative();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rtn(Z3_context c) {
@ -144,7 +144,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_negative();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_toward_zero(Z3_context c) {
@ -155,7 +155,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_zero();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rtz(Z3_context c) {
@ -166,7 +166,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_round_toward_zero();
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -181,7 +181,7 @@ extern "C" {
sort * s = ctx->fpautil().mk_float_sort(ebits, sbits);
ctx->save_ast_trail(s);
RETURN_Z3(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_fpa_sort_half(Z3_context c) {
@ -220,50 +220,50 @@ extern "C" {
Z3_TRY;
LOG_Z3_mk_fpa_nan(c, s);
RESET_ERROR_CODE();
CHECK_VALID_AST(s, 0);
CHECK_VALID_AST(s, nullptr);
if (!is_fp_sort(c, s)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_nan(to_sort(s));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_inf(Z3_context c, Z3_sort s, Z3_bool negative) {
Z3_TRY;
LOG_Z3_mk_fpa_inf(c, s, negative);
RESET_ERROR_CODE();
CHECK_VALID_AST(s, 0);
CHECK_VALID_AST(s, nullptr);
if (!is_fp_sort(c, s)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = negative != 0 ? ctx->fpautil().mk_ninf(to_sort(s)) :
ctx->fpautil().mk_pinf(to_sort(s));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_zero(Z3_context c, Z3_sort s, Z3_bool negative) {
Z3_TRY;
LOG_Z3_mk_fpa_inf(c, s, negative);
RESET_ERROR_CODE();
CHECK_VALID_AST(s, 0);
CHECK_VALID_AST(s, nullptr);
if (!is_fp_sort(c, s)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = negative != 0 ? ctx->fpautil().mk_nzero(to_sort(s)) :
ctx->fpautil().mk_pzero(to_sort(s));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_fp(Z3_context c, Z3_ast sgn, Z3_ast exp, Z3_ast sig) {
@ -272,13 +272,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_bv(c, sgn) || !is_bv(c, exp) || !is_bv(c, sig)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_fp(to_expr(sgn), to_expr(exp), to_expr(sig));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_float(Z3_context c, float v, Z3_sort ty) {
@ -287,7 +287,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp_sort(c, ty)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
@ -298,7 +298,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_double(Z3_context c, double v, Z3_sort ty) {
@ -307,7 +307,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp_sort(c, ty)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
@ -315,7 +315,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_int(Z3_context c, signed v, Z3_sort ty) {
@ -324,7 +324,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp_sort(c, ty)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
@ -335,7 +335,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_int_uint(Z3_context c, Z3_bool sgn, signed exp, unsigned sig, Z3_sort ty) {
@ -344,7 +344,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp_sort(c, ty)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
@ -355,7 +355,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_numeral_int64_uint64(Z3_context c, Z3_bool sgn, __int64 exp, __uint64 sig, Z3_sort ty) {
@ -364,7 +364,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp_sort(c, ty)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
scoped_mpf tmp(ctx->fpautil().fm());
@ -375,7 +375,7 @@ extern "C" {
expr * a = ctx->fpautil().mk_value(tmp);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_abs(Z3_context c, Z3_ast t) {
@ -384,13 +384,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_abs(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_neg(Z3_context c, Z3_ast t) {
@ -399,13 +399,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_neg(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_add(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
@ -414,13 +414,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_add(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_sub(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
@ -429,13 +429,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_sub(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_mul(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
@ -444,13 +444,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_mul(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_div(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2) {
@ -459,13 +459,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_div(to_expr(rm), to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_fma(Z3_context c, Z3_ast rm, Z3_ast t1, Z3_ast t2, Z3_ast t3) {
@ -474,13 +474,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t1) || !is_fp(c, t2) || !is_fp(c, t3)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_fma(to_expr(rm), to_expr(t1), to_expr(t2), to_expr(t3));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_sqrt(Z3_context c, Z3_ast rm, Z3_ast t) {
@ -489,13 +489,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_sqrt(to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_rem(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -504,13 +504,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_rem(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_round_to_integral(Z3_context c, Z3_ast rm, Z3_ast t) {
@ -519,13 +519,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_round_to_integral(to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_min(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -534,13 +534,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_min(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_max(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -549,13 +549,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_max(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_leq(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -564,13 +564,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_le(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_lt(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -579,13 +579,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_lt(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_geq(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -594,13 +594,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_ge(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_gt(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -609,13 +609,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_gt(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_eq(Z3_context c, Z3_ast t1, Z3_ast t2) {
@ -624,13 +624,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t1) || !is_fp(c, t2)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_float_eq(to_expr(t1), to_expr(t2));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_normal(Z3_context c, Z3_ast t) {
@ -639,13 +639,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_normal(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_subnormal(Z3_context c, Z3_ast t) {
@ -654,13 +654,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_subnormal(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_zero(Z3_context c, Z3_ast t) {
@ -669,13 +669,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_zero(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_infinite(Z3_context c, Z3_ast t) {
@ -684,13 +684,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_inf(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_nan(Z3_context c, Z3_ast t) {
@ -699,13 +699,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_nan(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_negative(Z3_context c, Z3_ast t) {
@ -714,13 +714,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_negative(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_is_positive(Z3_context c, Z3_ast t) {
@ -729,13 +729,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_is_positive(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -745,19 +745,19 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_bv(c, bv) || !is_fp_sort(c, s)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
fpa_util & fu = ctx->fpautil();
if (!ctx->bvutil().is_bv(to_expr(bv)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(bv));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_float(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
@ -770,12 +770,12 @@ extern "C" {
!fu.is_float(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_real(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
@ -788,12 +788,12 @@ extern "C" {
!ctx->autil().is_real(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_signed(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
@ -806,12 +806,12 @@ extern "C" {
!ctx->bvutil().is_bv(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_unsigned(Z3_context c, Z3_ast rm, Z3_ast t, Z3_sort s) {
@ -824,12 +824,12 @@ extern "C" {
!ctx->bvutil().is_bv(to_expr(t)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp_unsigned(to_sort(s), to_expr(rm), to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_ubv(Z3_context c, Z3_ast rm, Z3_ast t, unsigned sz) {
@ -838,13 +838,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_to_ubv(to_expr(rm), to_expr(t), sz);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_sbv(Z3_context c, Z3_ast rm, Z3_ast t, unsigned sz) {
@ -853,13 +853,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_rm(c, rm) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_to_sbv(to_expr(rm), to_expr(t), sz);
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_real(Z3_context c, Z3_ast t) {
@ -868,13 +868,13 @@ extern "C" {
RESET_ERROR_CODE();
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
expr * a = ctx->fpautil().mk_to_real(to_expr(t));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_fpa_get_ebits(Z3_context c, Z3_sort s) {
@ -911,7 +911,7 @@ extern "C" {
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
if (sgn == 0) {
if (sgn == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
@ -939,8 +939,8 @@ extern "C" {
Z3_TRY;
LOG_Z3_fpa_get_numeral_sign_bv(c, t);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
family_id fid = mk_c(c)->get_fpa_fid();
@ -949,13 +949,13 @@ extern "C" {
expr * e = to_expr(t);
if (!is_app(e) || is_app_of(e, fid, OP_FPA_NAN) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
scoped_mpf val(mpfm);
bool r = plugin->is_numeral(to_expr(t), val);
if (!r || mpfm.is_nan(val)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
app * a;
if (mpfm.is_pos(val))
@ -964,15 +964,15 @@ extern "C" {
a = ctx->bvutil().mk_numeral(1, 1);
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_fpa_get_numeral_significand_bv(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_fpa_get_numeral_significand_bv(c, t);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
unsynch_mpq_manager & mpqm = mpfm.mpq_manager();
@ -982,13 +982,13 @@ extern "C" {
expr * e = to_expr(t);
if (!is_app(e) || is_app_of(e, fid, OP_FPA_NAN) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
scoped_mpf val(mpfm);
bool r = plugin->is_numeral(e, val);
if (!r || !(mpfm.is_normal(val) || mpfm.is_denormal(val) || mpfm.is_zero(val) || mpfm.is_inf(val))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
unsigned sbits = val.get().get_sbits();
scoped_mpq q(mpqm);
@ -997,15 +997,15 @@ extern "C" {
app * a = mk_c(c)->bvutil().mk_numeral(q.get(), sbits-1);
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_fpa_get_numeral_significand_string(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_fpa_get_numeral_significand_string(c, t);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
unsynch_mpq_manager & mpqm = mpfm.mpq_manager();
@ -1041,7 +1041,7 @@ extern "C" {
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
if (n == 0) {
if (n == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
@ -1076,8 +1076,8 @@ extern "C" {
Z3_TRY;
LOG_Z3_fpa_get_numeral_exponent_string(c, t, biased);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
family_id fid = mk_c(c)->get_fpa_fid();
@ -1119,7 +1119,7 @@ extern "C" {
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
if (n == 0) {
if (n == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
}
@ -1161,8 +1161,8 @@ extern "C" {
Z3_TRY;
LOG_Z3_fpa_get_numeral_exponent_bv(c, t, biased);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
ast_manager & m = mk_c(c)->m();
mpf_manager & mpfm = mk_c(c)->fpautil().fm();
family_id fid = mk_c(c)->get_fpa_fid();
@ -1170,13 +1170,13 @@ extern "C" {
expr * e = to_expr(t);
if (!is_app(e) || is_app_of(e, fid, OP_FPA_NAN) || !is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
scoped_mpf val(mpfm);
bool r = plugin->is_numeral(e, val);
if (!r || !(mpfm.is_normal(val) || mpfm.is_denormal(val) || mpfm.is_zero(val) || mpfm.is_inf(val))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
unsigned ebits = val.get().get_ebits();
mpf_exp_t exp;
@ -1194,23 +1194,23 @@ extern "C" {
app * a = mk_c(c)->bvutil().mk_numeral(exp, ebits);
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_ieee_bv(Z3_context c, Z3_ast t) {
Z3_TRY;
LOG_Z3_mk_fpa_to_ieee_bv(c, t);
RESET_ERROR_CODE();
CHECK_NON_NULL(t, 0);
CHECK_VALID_AST(t, 0);
CHECK_NON_NULL(t, nullptr);
CHECK_VALID_AST(t, nullptr);
if (!is_fp(c, t)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
api::context * ctx = mk_c(c);
Z3_ast r = of_ast(ctx->fpautil().mk_to_ieee_bv(to_expr(t)));
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_fpa_to_fp_int_real(Z3_context c, Z3_ast rm, Z3_ast exp, Z3_ast sig, Z3_sort s) {
@ -1224,12 +1224,12 @@ extern "C" {
!ctx->autil().is_real(to_expr(sig)) ||
!fu.is_float(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
expr * a = fu.mk_to_fp(to_sort(s), to_expr(rm), to_expr(exp), to_expr(sig));
ctx->save_ast_trail(a);
RETURN_Z3(of_expr(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_fpa_is_numeral_nan(Z3_context c, Z3_ast t) {

View file

@ -30,14 +30,14 @@ extern "C" {
RESET_ERROR_CODE();
if (proofs != 0 && !mk_c(c)->m().proofs_enabled()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_goal_ref * g = alloc(Z3_goal_ref, *mk_c(c));
g->m_goal = alloc(goal, mk_c(c)->m(), proofs != 0, models != 0, unsat_cores != 0);
mk_c(c)->save_object(g);
Z3_goal r = of_goal(g);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_goal_inc_ref(Z3_context c, Z3_goal g) {
@ -119,12 +119,12 @@ extern "C" {
RESET_ERROR_CODE();
if (idx >= to_goal_ref(g)->size()) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * result = to_goal_ref(g)->form(idx);
mk_c(c)->save_ast_trail(result);
RETURN_Z3(of_ast(result));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_goal_num_exprs(Z3_context c, Z3_goal g) {
@ -161,7 +161,7 @@ extern "C" {
mk_c(target)->save_object(_r);
Z3_goal r = of_goal(_r);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_goal_to_string(Z3_context c, Z3_goal g) {

View file

@ -29,6 +29,6 @@ struct Z3_goal_ref : public api::object {
inline Z3_goal_ref * to_goal(Z3_goal g) { return reinterpret_cast<Z3_goal_ref *>(g); }
inline Z3_goal of_goal(Z3_goal_ref * g) { return reinterpret_cast<Z3_goal>(g); }
inline goal_ref to_goal_ref(Z3_goal g) { return g == 0 ? goal_ref() : to_goal(g)->m_goal; }
inline goal_ref to_goal_ref(Z3_goal g) { return g == nullptr ? goal_ref() : to_goal(g)->m_goal; }
#endif

View file

@ -110,7 +110,7 @@ extern "C" {
pre_parents_vec,
interpolants,
theory_vec,
0); // ignore params for now FIXME
nullptr); // ignore params for now FIXME
// copy result back
for (unsigned i = 0; i < interpolants.size(); i++){
@ -174,7 +174,7 @@ extern "C" {
itp_vec,
theory_vec);
*error = res ? 0 : itp_err.str().c_str();
*error = res ? nullptr : itp_err.str().c_str();
return res;
}
@ -227,7 +227,7 @@ extern "C" {
cnsts,
_pat,
interp,
(interpolation_options_struct *)0 // ignore params for now
(interpolation_options_struct *)nullptr // ignore params for now
);
// copy result back
@ -236,7 +236,7 @@ extern "C" {
_m.dec_ref(interp[i]);
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_lbool Z3_API Z3_compute_interpolant(Z3_context c, Z3_ast pat, Z3_params p, Z3_ast_vector *out_interp, Z3_model *model){
@ -283,7 +283,7 @@ extern "C" {
cnsts,
interp,
m,
0 // ignore params for now
nullptr // ignore params for now
);
}
catch (z3_exception & ex) {
@ -297,8 +297,8 @@ extern "C" {
Z3_lbool status = of_lbool(_status);
Z3_ast_vector_ref *v = 0;
*model = 0;
Z3_ast_vector_ref *v = nullptr;
*model = nullptr;
if (_status == l_false){
// copy result back
@ -510,7 +510,7 @@ extern "C" {
read_error.clear();
try {
std::string foo(filename);
Z3_ast assrts = Z3_parse_smtlib2_file(ctx, filename, 0, 0, 0, 0, 0, 0);
Z3_ast assrts = Z3_parse_smtlib2_file(ctx, filename, 0, nullptr, nullptr, 0, nullptr, nullptr);
Z3_app app = Z3_to_app(ctx, assrts);
int nconjs = Z3_get_app_num_args(ctx, app);
assertions.resize(nconjs);
@ -523,7 +523,7 @@ extern "C" {
*error = read_msg.c_str();
return false;
}
Z3_set_error_handler(ctx, 0);
Z3_set_error_handler(ctx, nullptr);
return true;
}
@ -571,7 +571,7 @@ extern "C" {
hash_map<Z3_ast, int> pred_map;
for (unsigned j = 0; j < num; j++){
Z3_ast lhs = 0, rhs = read_cnsts[j];
Z3_ast lhs = nullptr, rhs = read_cnsts[j];
if (Z3_get_decl_kind(ctx, Z3_get_app_decl(ctx, Z3_to_app(ctx, rhs))) == Z3_OP_IMPLIES){
Z3_app app1 = Z3_to_app(ctx, rhs);

View file

@ -21,15 +21,15 @@ Revision History:
#include "util/util.h"
#include "util/version.h"
std::ostream * g_z3_log = 0;
std::ostream * g_z3_log = nullptr;
bool g_z3_log_enabled = false;
extern "C" {
void Z3_close_log_unsafe(void) {
if (g_z3_log != 0) {
if (g_z3_log != nullptr) {
dealloc(g_z3_log);
g_z3_log_enabled = false;
g_z3_log = 0;
g_z3_log = nullptr;
}
}
@ -40,12 +40,12 @@ extern "C" {
#pragma omp critical (z3_log)
{
#endif
if (g_z3_log != 0)
if (g_z3_log != nullptr)
Z3_close_log_unsafe();
g_z3_log = alloc(std::ofstream, filename);
if (g_z3_log->bad() || g_z3_log->fail()) {
dealloc(g_z3_log);
g_z3_log = 0;
g_z3_log = nullptr;
res = Z3_FALSE;
}
else {
@ -61,13 +61,13 @@ extern "C" {
}
void Z3_API Z3_append_log(Z3_string str) {
if (g_z3_log == 0)
if (g_z3_log == nullptr)
return;
#ifdef Z3_LOG_SYNC
#pragma omp critical (z3_log)
{
#endif
if (g_z3_log != 0)
if (g_z3_log != nullptr)
_Z3_append_log(static_cast<char const *>(str));
#ifdef Z3_LOG_SYNC
}
@ -75,7 +75,7 @@ extern "C" {
}
void Z3_API Z3_close_log(void) {
if (g_z3_log != 0) {
if (g_z3_log != nullptr) {
#ifdef Z3_LOG_SYNC
#pragma omp critical (z3_log)
{

View file

@ -38,7 +38,7 @@ extern "C" {
m_ref->m_model = alloc(model, mk_c(c)->m());
mk_c(c)->save_object(m_ref);
RETURN_Z3(of_model(m_ref));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_model_inc_ref(Z3_context c, Z3_model m) {
@ -65,14 +65,14 @@ extern "C" {
Z3_TRY;
LOG_Z3_model_get_const_interp(c, m, a);
RESET_ERROR_CODE();
CHECK_NON_NULL(m, 0);
CHECK_NON_NULL(m, nullptr);
expr * r = to_model_ref(m)->get_const_interp(to_func_decl(a));
if (!r) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
mk_c(c)->save_ast_trail(r);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_model_has_interp(Z3_context c, Z3_model m, Z3_func_decl a) {
@ -91,17 +91,17 @@ extern "C" {
Z3_TRY;
LOG_Z3_model_get_func_interp(c, m, f);
RESET_ERROR_CODE();
CHECK_NON_NULL(m, 0);
CHECK_NON_NULL(m, nullptr);
func_interp * _fi = to_model_ref(m)->get_func_interp(to_func_decl(f));
if (!_fi) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_func_interp_ref * fi = alloc(Z3_func_interp_ref, *mk_c(c), to_model_ref(m));
fi->m_func_interp = _fi;
mk_c(c)->save_object(fi);
RETURN_Z3(of_func_interp(fi));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_model_get_num_consts(Z3_context c, Z3_model m) {
@ -117,16 +117,16 @@ extern "C" {
Z3_TRY;
LOG_Z3_model_get_const_decl(c, m, i);
RESET_ERROR_CODE();
CHECK_NON_NULL(m, 0);
CHECK_NON_NULL(m, nullptr);
model * _m = to_model_ref(m);
if (i < _m->get_num_constants()) {
RETURN_Z3(of_func_decl(_m->get_constant(i)));
}
else {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_model_get_num_funcs(Z3_context c, Z3_model m) {
@ -139,11 +139,11 @@ extern "C" {
}
Z3_func_decl get_model_func_decl_core(Z3_context c, Z3_model m, unsigned i) {
CHECK_NON_NULL(m, 0);
CHECK_NON_NULL(m, nullptr);
model * _m = to_model_ref(m);
if (i >= _m->get_num_functions()) {
SET_ERROR_CODE(Z3_IOB);
return 0;
return nullptr;
}
return of_func_decl(_m->get_function(i));
}
@ -154,13 +154,13 @@ extern "C" {
RESET_ERROR_CODE();
Z3_func_decl r = get_model_func_decl_core(c, m, i);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_model_eval(Z3_context c, Z3_model m, Z3_ast t, Z3_bool model_completion, Z3_ast * v) {
Z3_TRY;
LOG_Z3_model_eval(c, m, t, model_completion, v);
if (v) *v = 0;
if (v) *v = nullptr;
RESET_ERROR_CODE();
CHECK_NON_NULL(m, Z3_FALSE);
CHECK_IS_EXPR(t, Z3_FALSE);
@ -187,11 +187,11 @@ extern "C" {
RESET_ERROR_CODE();
if (i >= to_model_ref(m)->get_num_uninterpreted_sorts()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
sort * s = to_model_ref(m)->get_uninterpreted_sort(i);
RETURN_Z3(of_sort(s));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_model_get_sort_universe(Z3_context c, Z3_model m, Z3_sort s) {
@ -200,7 +200,7 @@ extern "C" {
RESET_ERROR_CODE();
if (!to_model_ref(m)->has_uninterpreted_sort(to_sort(s))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ptr_vector<expr> const & universe = to_model_ref(m)->get_universe(to_sort(s));
Z3_ast_vector_ref * v = alloc(Z3_ast_vector_ref, *mk_c(c), mk_c(c)->m());
@ -210,7 +210,7 @@ extern "C" {
v->m_ast_vector.push_back(universe[i]);
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_model Z3_API Z3_model_translate(Z3_context c, Z3_model m, Z3_context target) {
@ -222,7 +222,7 @@ extern "C" {
dst->m_model = to_model_ref(m)->translate(tr);
mk_c(target)->save_object(dst);
RETURN_Z3(of_model(dst));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_as_array(Z3_context c, Z3_ast a) {
@ -242,9 +242,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_func_interp Z3_API Z3_add_func_interp(Z3_context c, Z3_model m, Z3_func_decl f, Z3_ast else_val) {
@ -259,7 +259,7 @@ extern "C" {
mdl->register_decl(d, f_ref->m_func_interp);
f_ref->m_func_interp->set_else(to_expr(else_val));
RETURN_Z3(of_func_interp(f_ref));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_add_const_interp(Z3_context c, Z3_model m, Z3_func_decl f, Z3_ast a) {
@ -310,30 +310,30 @@ extern "C" {
Z3_TRY;
LOG_Z3_func_interp_get_entry(c, f, i);
RESET_ERROR_CODE();
CHECK_NON_NULL(f, 0);
CHECK_NON_NULL(f, nullptr);
if (i >= to_func_interp_ref(f)->num_entries()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
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(0);
Z3_CATCH_RETURN(nullptr);
}
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);
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(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_func_interp_set_else(Z3_context c, Z3_func_interp f, Z3_ast else_value) {
@ -399,7 +399,7 @@ extern "C" {
expr * v = to_func_entry_ref(e)->get_result();
mk_c(c)->save_ast_trail(v);
RETURN_Z3(of_expr(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_func_entry_get_num_args(Z3_context c, Z3_func_entry e) {
@ -416,11 +416,11 @@ extern "C" {
RESET_ERROR_CODE();
if (i >= to_func_entry(e)->m_func_interp->get_arity()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr * r = to_func_entry(e)->m_func_entry->get_arg(i);
RETURN_Z3(of_expr(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// ----------------------------
@ -491,7 +491,7 @@ extern "C" {
Z3_TRY;
LOG_Z3_model_to_string(c, m);
RESET_ERROR_CODE();
CHECK_NON_NULL(m, 0);
CHECK_NON_NULL(m, nullptr);
std::ostringstream buffer;
std::string result;
if (mk_c(c)->get_print_mode() == Z3_PRINT_SMTLIB2_COMPLIANT) {
@ -507,7 +507,7 @@ extern "C" {
result = buffer.str();
}
return mk_c(c)->mk_external_string(result);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -34,7 +34,7 @@ inline model * to_model_ref(Z3_model s) { return to_model(s)->m_model.get(); }
struct Z3_func_interp_ref : public api::object {
model_ref m_model; // must have it to prevent reference to m_func_interp to be killed.
func_interp * m_func_interp;
Z3_func_interp_ref(api::context& c, model * m): api::object(c), m_model(m), m_func_interp(0) {}
Z3_func_interp_ref(api::context& c, model * m): api::object(c), m_model(m), m_func_interp(nullptr) {}
~Z3_func_interp_ref() override {}
};
@ -46,7 +46,7 @@ struct Z3_func_entry_ref : public api::object {
model_ref m_model; // must have it to prevent reference to m_func_entry to be killed.
func_interp * m_func_interp;
func_entry const * m_func_entry;
Z3_func_entry_ref(api::context& c, model * m):api::object(c), m_model(m), m_func_interp(0), m_func_entry(0) {}
Z3_func_entry_ref(api::context& c, model * m):api::object(c), m_model(m), m_func_interp(nullptr), m_func_entry(nullptr) {}
~Z3_func_entry_ref() override {}
};

View file

@ -52,11 +52,11 @@ extern "C" {
LOG_Z3_mk_numeral(c, n, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
if (!n) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
sort * _ty = to_sort(ty);
bool is_float = mk_c(c)->fpautil().is_float(_ty);
@ -73,11 +73,11 @@ extern "C" {
('P' == *m) ||
('+' == *m))))) {
SET_ERROR_CODE(Z3_PARSER_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
++m;
}
ast * a = 0;
ast * a = nullptr;
if (_ty->get_family_id() == mk_c(c)->get_fpa_fid()) {
// avoid expanding floats into huge rationals.
fpa_util & fu = mk_c(c)->fpautil();
@ -89,7 +89,7 @@ extern "C" {
else
a = mk_c(c)->mk_numeral_core(rational(n), _ty);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_int(Z3_context c, int value, Z3_sort ty) {
@ -97,11 +97,11 @@ extern "C" {
LOG_Z3_mk_int(c, value, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ast * a = mk_c(c)->mk_numeral_core(rational(value), to_sort(ty));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_unsigned_int(Z3_context c, unsigned value, Z3_sort ty) {
@ -109,11 +109,11 @@ extern "C" {
LOG_Z3_mk_unsigned_int(c, value, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
ast * a = mk_c(c)->mk_numeral_core(rational(value), to_sort(ty));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_int64(Z3_context c, long long value, Z3_sort ty) {
@ -121,12 +121,12 @@ extern "C" {
LOG_Z3_mk_int64(c, value, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
rational n(value, rational::i64());
ast* a = mk_c(c)->mk_numeral_core(n, to_sort(ty));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_unsigned_int64(Z3_context c, unsigned long long value, Z3_sort ty) {
@ -134,12 +134,12 @@ extern "C" {
LOG_Z3_mk_unsigned_int64(c, value, ty);
RESET_ERROR_CODE();
if (!check_numeral_sort(c, ty)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
rational n(value, rational::ui64());
ast * a = mk_c(c)->mk_numeral_core(n, to_sort(ty));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_numeral_ast(Z3_context c, Z3_ast a) {
@ -397,7 +397,7 @@ extern "C" {
}
ast * a = mk_c(c)->mk_numeral_core(r, mk_c(c)->bvutil().mk_sort(sz));
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -35,7 +35,7 @@ extern "C" {
struct Z3_optimize_ref : public api::object {
opt::context* m_opt;
Z3_optimize_ref(api::context& c): api::object(c), m_opt(0) {}
Z3_optimize_ref(api::context& c): api::object(c), m_opt(nullptr) {}
~Z3_optimize_ref() override { dealloc(m_opt); }
};
inline Z3_optimize_ref * to_optimize(Z3_optimize o) { return reinterpret_cast<Z3_optimize_ref *>(o); }
@ -50,7 +50,7 @@ extern "C" {
o->m_opt = alloc(opt::context,mk_c(c)->m());
mk_c(c)->save_object(o);
RETURN_Z3(of_optimize(o));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_optimize_inc_ref(Z3_context c, Z3_optimize o) {
@ -171,7 +171,7 @@ extern "C" {
}
mk_c(c)->save_object(m_ref);
RETURN_Z3(of_model(m_ref));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_optimize_set_params(Z3_context c, Z3_optimize o, Z3_params p) {
@ -195,7 +195,7 @@ extern "C" {
to_optimize_ptr(o)->collect_param_descrs(d->m_descrs);
Z3_param_descrs r = of_param_descrs(d);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// get lower value or current approximation
@ -206,7 +206,7 @@ extern "C" {
expr_ref e = to_optimize_ptr(o)->get_lower(idx);
mk_c(c)->save_ast_trail(e);
RETURN_Z3(of_expr(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// get upper or current approximation
@ -217,7 +217,7 @@ extern "C" {
expr_ref e = to_optimize_ptr(o)->get_upper(idx);
mk_c(c)->save_ast_trail(e);
RETURN_Z3(of_expr(e));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// get lower value or current approximation
@ -231,7 +231,7 @@ extern "C" {
mk_c(c)->save_object(v);
v->m_ast_vector.append(es.size(), (ast*const*)es.c_ptr());
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
// get upper or current approximation
@ -245,7 +245,7 @@ extern "C" {
mk_c(c)->save_object(v);
v->m_ast_vector.append(es.size(), (ast*const*)es.c_ptr());
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_optimize_to_string(Z3_context c, Z3_optimize o) {
@ -277,7 +277,7 @@ extern "C" {
mk_c(c)->save_object(st);
Z3_stats r = of_stats(st);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
static void Z3_optimize_from_stream(
@ -367,7 +367,7 @@ extern "C" {
v->m_ast_vector.push_back(h);
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_optimize_get_objectives(Z3_context c, Z3_optimize o) {
@ -381,7 +381,7 @@ extern "C" {
v->m_ast_vector.push_back(to_optimize_ptr(o)->get_objective(i));
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}

View file

@ -34,7 +34,7 @@ extern "C" {
mk_c(c)->save_object(p);
Z3_params r = of_params(p);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
/**
@ -172,11 +172,11 @@ extern "C" {
RESET_ERROR_CODE();
if (i >= to_param_descrs_ptr(p)->size()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_symbol result = of_symbol(to_param_descrs_ptr(p)->get_param_name(i));
return result;
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_param_descrs_get_documentation(Z3_context c, Z3_param_descrs p, Z3_symbol s) {
@ -184,12 +184,12 @@ extern "C" {
LOG_Z3_param_descrs_get_documentation(c, p, s);
RESET_ERROR_CODE();
char const* result = to_param_descrs_ptr(p)->get_descr(to_symbol(s));
if (result == 0) {
if (result == nullptr) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
return mk_c(c)->mk_external_string(result);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_param_descrs_to_string(Z3_context c, Z3_param_descrs p) {

View file

@ -80,7 +80,7 @@ extern "C" {
ptr_vector<expr>::const_iterator end = ctx->end_assertions();
unsigned size = static_cast<unsigned>(end - it);
return of_ast(mk_c(c)->mk_and(size, it));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_parse_smtlib2_string(Z3_context c, Z3_string str,
@ -96,7 +96,7 @@ extern "C" {
std::istringstream is(s);
Z3_ast r = parse_smtlib2_stream(false, c, is, num_sorts, sort_names, sorts, num_decls, decl_names, decls);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_parse_smtlib2_file(Z3_context c, Z3_string file_name,
@ -111,10 +111,10 @@ extern "C" {
std::ifstream is(file_name);
if (!is) {
SET_ERROR_CODE(Z3_PARSER_ERROR);
return 0;
return nullptr;
}
Z3_ast r = parse_smtlib2_stream(false, c, is, num_sorts, sort_names, sorts, num_decls, decl_names, decls);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -34,7 +34,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_atleast(Z3_context c, unsigned num_args,
@ -48,7 +48,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_pble(Z3_context c, unsigned num_args,
@ -66,7 +66,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_pbge(Z3_context c, unsigned num_args,
@ -84,7 +84,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_pbeq(Z3_context c, unsigned num_args,
@ -102,7 +102,7 @@ extern "C" {
mk_c(c)->save_ast_trail(a);
check_sorts(c, a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}

View file

@ -50,7 +50,7 @@ extern "C" {
if (!converter.to_polynomial(to_expr(p), _p, d) ||
!converter.to_polynomial(to_expr(q), _q, d)) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return 0;
return nullptr;
}
Z3_ast_vector_ref* result = alloc(Z3_ast_vector_ref, *mk_c(c), mk_c(c)->m());
mk_c(c)->save_object(result);
@ -74,7 +74,7 @@ extern "C" {
}
}
RETURN_Z3(of_ast_vector(result));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -56,7 +56,7 @@ extern "C"
app_ref_vector vars(mk_c(c)->m ());
if (!to_apps(num_bounds, bound, vars)) {
SET_ERROR_CODE (Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr_ref result (mk_c(c)->m ());
@ -66,7 +66,7 @@ extern "C"
mk_c(c)->save_ast_trail (result.get ());
return of_expr (result.get ());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_qe_model_project_skolem (Z3_context c,
@ -83,7 +83,7 @@ extern "C"
ast_manager& man = mk_c(c)->m ();
app_ref_vector vars(man);
if (!to_apps(num_bounds, bound, vars)) {
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
expr_ref result (mk_c(c)->m ());
@ -103,7 +103,7 @@ extern "C"
}
return of_expr (result.get ());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_model_extrapolate (Z3_context c,
@ -130,7 +130,7 @@ extern "C"
mk_c(c)->save_ast_trail (result.get ());
return of_expr (result.get ());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_qe_lite (Z3_context c, Z3_ast_vector vars, Z3_ast body)
@ -145,7 +145,7 @@ extern "C"
app *a = to_app (vVars.get (i));
if (a->get_kind () != AST_APP) {
SET_ERROR_CODE (Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
vApps.push_back (a);
}
@ -167,7 +167,7 @@ extern "C"
mk_c(c)->save_ast_trail (result.get ());
return of_expr (result);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
}

View file

@ -37,10 +37,10 @@ extern "C" {
c,
is_forall,
weight,
0,
0,
nullptr,
nullptr,
num_patterns, patterns,
0, 0,
0, nullptr,
num_decls, sorts,
decl_names,
body
@ -104,7 +104,7 @@ extern "C" {
}
mk_c(c)->save_ast_trail(result.get());
return of_ast(result.get());
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_quantifier_ex(
@ -166,17 +166,17 @@ extern "C" {
ptr_vector<expr> bound_asts;
if (num_patterns > 0 && num_no_patterns > 0) {
SET_ERROR_CODE(Z3_INVALID_USAGE);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
if (num_bound == 0) {
SET_ERROR_CODE(Z3_INVALID_USAGE);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
for (unsigned i = 0; i < num_bound; ++i) {
app* a = to_app(bound[i]);
if (a->get_kind() != AST_APP) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
symbol s(to_app(a)->get_decl()->get_name());
names.push_back(of_symbol(s));
@ -184,7 +184,7 @@ extern "C" {
bound_asts.push_back(a);
if (a->get_family_id() != null_family_id || a->get_num_args() != 0) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
// Abstract patterns
@ -205,7 +205,7 @@ extern "C" {
expr_ref result(mk_c(c)->m());
if (!is_app(to_expr(no_patterns[i]))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
app* pat = to_app(to_expr(no_patterns[i]));
expr_abstract(mk_c(c)->m(), 0, num_bound, bound_asts.c_ptr(), pat, result);
@ -224,7 +224,7 @@ extern "C" {
names.size(), types.c_ptr(), names.c_ptr(),
of_ast(abs_body.get()));
RETURN_Z3(result);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_quantifier_const(Z3_context c,
@ -235,10 +235,10 @@ extern "C" {
unsigned num_patterns,
Z3_pattern const patterns[],
Z3_ast body) {
return Z3_mk_quantifier_const_ex(c, is_forall, weight, 0, 0,
return Z3_mk_quantifier_const_ex(c, is_forall, weight, nullptr, nullptr,
num_bound, bound,
num_patterns, patterns,
0, 0,
0, nullptr,
body);
}
@ -269,13 +269,13 @@ extern "C" {
for (unsigned i = 0; i < num_patterns; ++i) {
if (!is_app(to_expr(terms[i]))) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
}
app* a = mk_c(c)->m().mk_pattern(num_patterns, reinterpret_cast<app*const*>(to_exprs(terms)));
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_pattern(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_bound(Z3_context c, unsigned index, Z3_sort ty) {
@ -285,7 +285,7 @@ extern "C" {
ast* a = mk_c(c)->m().mk_var(index, to_sort(ty));
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_quantifier_forall(Z3_context c, Z3_ast a) {
@ -344,9 +344,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
@ -376,9 +376,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_symbol Z3_API Z3_get_quantifier_bound_name(Z3_context c, Z3_ast a, unsigned i) {
@ -391,9 +391,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
return 0;
return nullptr;
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_get_quantifier_bound_sort(Z3_context c, Z3_ast a, unsigned i) {
@ -407,9 +407,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_get_quantifier_body(Z3_context c, Z3_ast a) {
@ -423,9 +423,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_get_quantifier_num_bound(Z3_context c, Z3_ast a) {
@ -470,9 +470,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_pattern_to_ast(Z3_context c, Z3_pattern p) {

View file

@ -62,7 +62,7 @@ extern "C" {
rcnumeral r;
rcfm(c).set(r, q);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_mk_small_int(Z3_context c, int val) {
@ -73,7 +73,7 @@ extern "C" {
rcnumeral r;
rcfm(c).set(r, val);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_mk_pi(Z3_context c) {
@ -84,7 +84,7 @@ extern "C" {
rcnumeral r;
rcfm(c).mk_pi(r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_mk_e(Z3_context c) {
@ -95,7 +95,7 @@ extern "C" {
rcnumeral r;
rcfm(c).mk_e(r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_mk_infinitesimal(Z3_context c) {
@ -106,7 +106,7 @@ extern "C" {
rcnumeral r;
rcfm(c).mk_infinitesimal(r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_rcf_mk_roots(Z3_context c, unsigned n, Z3_rcf_num const a[], Z3_rcf_num roots[]) {
@ -145,7 +145,7 @@ extern "C" {
rcnumeral r;
rcfm(c).add(to_rcnumeral(a), to_rcnumeral(b), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_sub(Z3_context c, Z3_rcf_num a, Z3_rcf_num b) {
@ -156,7 +156,7 @@ extern "C" {
rcnumeral r;
rcfm(c).sub(to_rcnumeral(a), to_rcnumeral(b), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_mul(Z3_context c, Z3_rcf_num a, Z3_rcf_num b) {
@ -167,7 +167,7 @@ extern "C" {
rcnumeral r;
rcfm(c).mul(to_rcnumeral(a), to_rcnumeral(b), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_div(Z3_context c, Z3_rcf_num a, Z3_rcf_num b) {
@ -178,7 +178,7 @@ extern "C" {
rcnumeral r;
rcfm(c).div(to_rcnumeral(a), to_rcnumeral(b), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_neg(Z3_context c, Z3_rcf_num a) {
@ -189,7 +189,7 @@ extern "C" {
rcnumeral r;
rcfm(c).neg(to_rcnumeral(a), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_inv(Z3_context c, Z3_rcf_num a) {
@ -200,7 +200,7 @@ extern "C" {
rcnumeral r;
rcfm(c).inv(to_rcnumeral(a), r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_rcf_num Z3_API Z3_rcf_power(Z3_context c, Z3_rcf_num a, unsigned k) {
@ -211,7 +211,7 @@ extern "C" {
rcnumeral r;
rcfm(c).power(to_rcnumeral(a), k, r);
RETURN_Z3(from_rcnumeral(r));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_rcf_lt(Z3_context c, Z3_rcf_num a, Z3_rcf_num b) {

View file

@ -31,7 +31,7 @@ extern "C" {
sort * ty = mk_c(c)->sutil().str.mk_seq(to_sort(domain));
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_re_sort(Z3_context c, Z3_sort domain) {
@ -41,7 +41,7 @@ extern "C" {
sort * ty = mk_c(c)->sutil().re.mk_re(to_sort(domain));
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_mk_string(Z3_context c, Z3_string str) {
@ -52,7 +52,7 @@ extern "C" {
app* a = mk_c(c)->sutil().str.mk_string(s);
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_sort Z3_API Z3_mk_string_sort(Z3_context c) {
@ -62,7 +62,7 @@ extern "C" {
sort* ty = mk_c(c)->sutil().str.mk_string_sort();
mk_c(c)->save_ast_trail(ty);
RETURN_Z3(of_sort(ty));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_bool Z3_API Z3_is_seq_sort(Z3_context c, Z3_sort s) {
@ -152,7 +152,7 @@ extern "C" {
app* a = hi == 0 ? mk_c(c)->sutil().re.mk_loop(to_expr(r), lo) : mk_c(c)->sutil().re.mk_loop(to_expr(r), lo, hi);
mk_c(c)->save_ast_trail(a);
RETURN_Z3(of_ast(a));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
MK_UNARY(Z3_mk_re_plus, mk_c(c)->get_seq_fid(), OP_RE_PLUS, SKIP);

View file

@ -57,7 +57,7 @@ extern "C" {
}
static void init_solver(Z3_context c, Z3_solver s) {
if (to_solver(s)->m_solver.get() == 0)
if (to_solver(s)->m_solver.get() == nullptr)
init_solver_core(c, s);
}
@ -69,7 +69,7 @@ extern "C" {
mk_c(c)->save_object(s);
Z3_solver r = of_solver(s);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_solver Z3_API Z3_mk_solver(Z3_context c) {
@ -80,7 +80,7 @@ extern "C" {
mk_c(c)->save_object(s);
Z3_solver r = of_solver(s);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_solver Z3_API Z3_mk_solver_for_logic(Z3_context c, Z3_symbol logic) {
@ -91,7 +91,7 @@ extern "C" {
std::ostringstream strm;
strm << "logic '" << to_symbol(logic) << "' is not recognized";
throw default_exception(strm.str());
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
else {
Z3_solver_ref * s = alloc(Z3_solver_ref, *mk_c(c), mk_smt_strategic_solver_factory(to_symbol(logic)));
@ -99,7 +99,7 @@ extern "C" {
Z3_solver r = of_solver(s);
RETURN_Z3(r);
}
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_solver Z3_API Z3_mk_solver_from_tactic(Z3_context c, Z3_tactic t) {
@ -110,7 +110,7 @@ extern "C" {
mk_c(c)->save_object(s);
Z3_solver r = of_solver(s);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_solver Z3_API Z3_solver_translate(Z3_context c, Z3_solver s, Z3_context target) {
@ -118,13 +118,13 @@ extern "C" {
LOG_Z3_solver_translate(c, s, target);
RESET_ERROR_CODE();
params_ref const& p = to_solver(s)->m_params;
Z3_solver_ref * sr = alloc(Z3_solver_ref, *mk_c(target), 0);
Z3_solver_ref * sr = alloc(Z3_solver_ref, *mk_c(target), nullptr);
init_solver(c, s);
sr->m_solver = to_solver(s)->m_solver->translate(mk_c(target)->m(), p);
mk_c(target)->save_object(sr);
Z3_solver r = of_solver(sr);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void solver_from_stream(Z3_context c, Z3_solver s, std::istream& is) {
@ -137,7 +137,7 @@ extern "C" {
return;
}
bool initialized = to_solver(s)->m_solver.get() != 0;
bool initialized = to_solver(s)->m_solver.get() != nullptr;
if (!initialized)
init_solver(c, s);
ptr_vector<expr>::const_iterator it = ctx->begin_assertions();
@ -190,13 +190,13 @@ extern "C" {
RESET_ERROR_CODE();
std::ostringstream buffer;
param_descrs descrs;
bool initialized = to_solver(s)->m_solver.get() != 0;
bool initialized = to_solver(s)->m_solver.get() != nullptr;
if (!initialized)
init_solver(c, s);
to_solver_ref(s)->collect_param_descrs(descrs);
context_params::collect_solver_param_descrs(descrs);
if (!initialized)
to_solver(s)->m_solver = 0;
to_solver(s)->m_solver = nullptr;
descrs.display(buffer);
return mk_c(c)->mk_external_string(buffer.str());
Z3_CATCH_RETURN("");
@ -208,16 +208,16 @@ extern "C" {
RESET_ERROR_CODE();
Z3_param_descrs_ref * d = alloc(Z3_param_descrs_ref, *mk_c(c));
mk_c(c)->save_object(d);
bool initialized = to_solver(s)->m_solver.get() != 0;
bool initialized = to_solver(s)->m_solver.get() != nullptr;
if (!initialized)
init_solver(c, s);
to_solver_ref(s)->collect_param_descrs(d->m_descrs);
context_params::collect_solver_param_descrs(d->m_descrs);
if (!initialized)
to_solver(s)->m_solver = 0;
to_solver(s)->m_solver = nullptr;
Z3_param_descrs r = of_param_descrs(d);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_solver_set_params(Z3_context c, Z3_solver s, Z3_params p) {
@ -288,7 +288,7 @@ extern "C" {
Z3_TRY;
LOG_Z3_solver_reset(c, s);
RESET_ERROR_CODE();
to_solver(s)->m_solver = 0;
to_solver(s)->m_solver = nullptr;
Z3_CATCH;
}
@ -334,7 +334,7 @@ extern "C" {
v->m_ast_vector.push_back(to_solver_ref(s)->get_assertion(i));
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
static Z3_lbool _solver_check(Z3_context c, Z3_solver s, unsigned num_assumptions, Z3_ast const assumptions[]) {
@ -375,7 +375,7 @@ extern "C" {
LOG_Z3_solver_check(c, s);
RESET_ERROR_CODE();
init_solver(c, s);
return _solver_check(c, s, 0, 0);
return _solver_check(c, s, 0, nullptr);
Z3_CATCH_RETURN(Z3_L_UNDEF);
}
@ -397,13 +397,13 @@ extern "C" {
to_solver_ref(s)->get_model(_m);
if (!_m) {
SET_ERROR_CODE(Z3_INVALID_USAGE);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_model_ref * m_ref = alloc(Z3_model_ref, *mk_c(c));
m_ref->m_model = _m;
mk_c(c)->save_object(m_ref);
RETURN_Z3(of_model(m_ref));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast Z3_API Z3_solver_get_proof(Z3_context c, Z3_solver s) {
@ -414,11 +414,11 @@ extern "C" {
proof * p = to_solver_ref(s)->get_proof();
if (!p) {
SET_ERROR_CODE(Z3_INVALID_USAGE);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
mk_c(c)->save_ast_trail(p);
RETURN_Z3(of_ast(p));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_ast_vector Z3_API Z3_solver_get_unsat_core(Z3_context c, Z3_solver s) {
@ -434,7 +434,7 @@ extern "C" {
v->m_ast_vector.push_back(core[i]);
}
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_solver_get_reason_unknown(Z3_context c, Z3_solver s) {
@ -458,7 +458,7 @@ extern "C" {
mk_c(c)->save_object(st);
Z3_stats r = of_stats(st);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_solver_to_string(Z3_context c, Z3_solver s) {

View file

@ -26,7 +26,7 @@ struct Z3_solver_ref : public api::object {
ref<solver> m_solver;
params_ref m_params;
symbol m_logic;
Z3_solver_ref(api::context& c, solver_factory * f): api::object(c), m_solver_factory(f), m_solver(0), m_logic(symbol::null) {}
Z3_solver_ref(api::context& c, solver_factory * f): api::object(c), m_solver_factory(f), m_solver(nullptr), m_logic(symbol::null) {}
~Z3_solver_ref() override {}
};

View file

@ -51,13 +51,13 @@ extern "C" {
LOG_Z3_mk_tactic(c, name);
RESET_ERROR_CODE();
tactic_cmd * t = mk_c(c)->find_tactic_cmd(symbol(name));
if (t == 0) {
if (t == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
tactic * new_t = t->mk(mk_c(c)->m());
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_tactic_inc_ref(Z3_context c, Z3_tactic t) {
@ -81,13 +81,13 @@ extern "C" {
LOG_Z3_mk_probe(c, name);
RESET_ERROR_CODE();
probe_info * p = mk_c(c)->find_probe(symbol(name));
if (p == 0) {
if (p == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
probe * new_p = p->get();
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_probe_inc_ref(Z3_context c, Z3_probe p) {
@ -112,7 +112,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = and_then(to_tactic_ref(t1), to_tactic_ref(t2));
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_or_else(Z3_context c, Z3_tactic t1, Z3_tactic t2) {
@ -121,7 +121,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = or_else(to_tactic_ref(t1), to_tactic_ref(t2));
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_par_or(Z3_context c, unsigned num, Z3_tactic const ts[]) {
@ -134,7 +134,7 @@ extern "C" {
}
tactic * new_t = par(num, _ts.c_ptr());
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_par_and_then(Z3_context c, Z3_tactic t1, Z3_tactic t2) {
@ -143,7 +143,7 @@ extern "C" {
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);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_try_for(Z3_context c, Z3_tactic t, unsigned ms) {
@ -152,7 +152,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = try_for(to_tactic_ref(t), ms);
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_when(Z3_context c, Z3_probe p, Z3_tactic t) {
@ -161,7 +161,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = when(to_probe_ref(p), to_tactic_ref(t));
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_cond(Z3_context c, Z3_probe p, Z3_tactic t1, Z3_tactic t2) {
@ -170,7 +170,7 @@ extern "C" {
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);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_repeat(Z3_context c, Z3_tactic t, unsigned max) {
@ -179,7 +179,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = repeat(to_tactic_ref(t), max);
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_skip(Z3_context c) {
@ -188,7 +188,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = mk_skip_tactic();
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_fail(Z3_context c) {
@ -197,7 +197,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = mk_fail_tactic();
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_fail_if(Z3_context c, Z3_probe p) {
@ -206,7 +206,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = fail_if(to_probe_ref(p));
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_fail_if_not_decided(Z3_context c) {
@ -215,7 +215,7 @@ extern "C" {
RESET_ERROR_CODE();
tactic * new_t = mk_fail_if_undecided_tactic();
RETURN_TACTIC(new_t);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_tactic Z3_API Z3_tactic_using_params(Z3_context c, Z3_tactic t, Z3_params p) {
@ -227,7 +227,7 @@ extern "C" {
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);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_const(Z3_context c, double val) {
@ -236,7 +236,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_const_probe(val);
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_lt(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -245,7 +245,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_lt(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_gt(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -254,7 +254,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_gt(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_le(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -263,7 +263,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_le(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_ge(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -272,7 +272,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_ge(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_eq(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -281,7 +281,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_eq(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_and(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -290,7 +290,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_and(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_or(Z3_context c, Z3_probe p1, Z3_probe p2) {
@ -299,7 +299,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_or(to_probe_ref(p1), to_probe_ref(p2));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_probe Z3_API Z3_probe_not(Z3_context c, Z3_probe p) {
@ -308,7 +308,7 @@ extern "C" {
RESET_ERROR_CODE();
probe * new_p = mk_not(to_probe_ref(p));
RETURN_PROBE(new_p);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
unsigned Z3_API Z3_get_num_tactics(Z3_context c) {
@ -372,7 +372,7 @@ extern "C" {
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);
Z3_CATCH_RETURN(nullptr);
}
Z3_string Z3_API Z3_tactic_get_descr(Z3_context c, Z3_string name) {
@ -380,7 +380,7 @@ extern "C" {
LOG_Z3_tactic_get_descr(c, name);
RESET_ERROR_CODE();
tactic_cmd * t = mk_c(c)->find_tactic_cmd(symbol(name));
if (t == 0) {
if (t == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return "";
}
@ -393,7 +393,7 @@ extern "C" {
LOG_Z3_probe_get_descr(c, name);
RESET_ERROR_CODE();
probe_info * p = mk_c(c)->find_probe(symbol(name));
if (p == 0) {
if (p == nullptr) {
SET_ERROR_CODE(Z3_INVALID_ARG);
return "";
}
@ -423,7 +423,7 @@ extern "C" {
}
catch (z3_exception & ex) {
mk_c(c)->handle_exception(ex);
return 0;
return nullptr;
}
}
}
@ -443,7 +443,7 @@ extern "C" {
params_ref p;
Z3_apply_result r = _tactic_apply(c, t, g, p);
RETURN_Z3(r);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_apply_result Z3_API Z3_tactic_apply_ex(Z3_context c, Z3_tactic t, Z3_goal g, Z3_params p) {
@ -455,7 +455,7 @@ extern "C" {
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);
Z3_CATCH_RETURN(nullptr);
}
void Z3_API Z3_apply_result_inc_ref(Z3_context c, Z3_apply_result r) {
@ -503,14 +503,14 @@ extern "C" {
RESET_ERROR_CODE();
if (i > to_apply_result(r)->m_subgoals.size()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
Z3_goal_ref * g = alloc(Z3_goal_ref, *mk_c(c));
g->m_goal = to_apply_result(r)->m_subgoals[i];
mk_c(c)->save_object(g);
Z3_goal result = of_goal(g);
RETURN_Z3(result);
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
Z3_model Z3_API Z3_apply_result_convert_model(Z3_context c, Z3_apply_result r, unsigned i, Z3_model m) {
@ -519,7 +519,7 @@ extern "C" {
RESET_ERROR_CODE();
if (i > to_apply_result(r)->m_subgoals.size()) {
SET_ERROR_CODE(Z3_IOB);
RETURN_Z3(0);
RETURN_Z3(nullptr);
}
model_ref new_m = to_model_ref(m)->copy();
if (to_apply_result(r)->m_mc)
@ -528,7 +528,7 @@ extern "C" {
m_ref->m_model = new_m;
mk_c(c)->save_object(m_ref);
RETURN_Z3(of_model(m_ref));
Z3_CATCH_RETURN(0);
Z3_CATCH_RETURN(nullptr);
}
};

View file

@ -40,11 +40,11 @@ struct Z3_probe_ref : public api::object {
inline Z3_tactic_ref * to_tactic(Z3_tactic g) { return reinterpret_cast<Z3_tactic_ref *>(g); }
inline Z3_tactic of_tactic(Z3_tactic_ref * g) { return reinterpret_cast<Z3_tactic>(g); }
inline tactic * to_tactic_ref(Z3_tactic g) { return g == 0 ? 0 : to_tactic(g)->m_tactic.get(); }
inline tactic * to_tactic_ref(Z3_tactic g) { return g == nullptr ? nullptr : to_tactic(g)->m_tactic.get(); }
inline Z3_probe_ref * to_probe(Z3_probe g) { return reinterpret_cast<Z3_probe_ref *>(g); }
inline Z3_probe of_probe(Z3_probe_ref * g) { return reinterpret_cast<Z3_probe>(g); }
inline probe * to_probe_ref(Z3_probe g) { return g == 0 ? 0 : to_probe(g)->m_probe.get(); }
inline probe * to_probe_ref(Z3_probe g) { return g == nullptr ? nullptr : to_probe(g)->m_probe.get(); }
struct Z3_apply_result_ref : public api::object {
goal_ref_buffer m_subgoals;

View file

@ -93,7 +93,7 @@ struct Z3_params_ref : public api::object {
inline Z3_params_ref * to_params(Z3_params p) { return reinterpret_cast<Z3_params_ref *>(p); }
inline Z3_params of_params(Z3_params_ref * p) { return reinterpret_cast<Z3_params>(p); }
inline params_ref to_param_ref(Z3_params p) { return p == 0 ? params_ref() : to_params(p)->m_params; }
inline params_ref to_param_ref(Z3_params p) { return p == nullptr ? params_ref() : to_params(p)->m_params; }
struct Z3_param_descrs_ref : public api::object {
param_descrs m_descrs;
@ -103,7 +103,7 @@ struct Z3_param_descrs_ref : public api::object {
inline Z3_param_descrs_ref * to_param_descrs(Z3_param_descrs p) { return reinterpret_cast<Z3_param_descrs_ref *>(p); }
inline Z3_param_descrs of_param_descrs(Z3_param_descrs_ref * p) { return reinterpret_cast<Z3_param_descrs>(p); }
inline param_descrs * to_param_descrs_ptr(Z3_param_descrs p) { return p == 0 ? 0 : &(to_param_descrs(p)->m_descrs); }
inline param_descrs * to_param_descrs_ptr(Z3_param_descrs p) { return p == nullptr ? nullptr : &(to_param_descrs(p)->m_descrs); }
#define SKIP ((void) 0)

View file

@ -430,10 +430,10 @@ struct z3_replayer::imp {
next(); skip_blank(); read_ptr();
TRACE("z3_replayer", tout << "[" << m_line << "] " << "P " << m_ptr << "\n";);
if (m_ptr == 0) {
m_args.push_back(0);
m_args.push_back(nullptr);
}
else {
void * obj = 0;
void * obj = nullptr;
if (!m_heap.find(m_ptr, obj))
throw z3_replayer_exception("invalid pointer");
m_args.push_back(value(obj));
@ -453,7 +453,7 @@ struct z3_replayer::imp {
// push null symbol
next();
TRACE("z3_replayer", tout << "[" << m_line << "] " << "N\n";);
m_args.push_back(value(SYMBOL, static_cast<char const *>(0)));
m_args.push_back(value(SYMBOL, static_cast<char const *>(nullptr)));
break;
case '$': {
// push symbol
@ -689,7 +689,7 @@ struct z3_replayer::imp {
}
void reset() {
m_result = 0;
m_result = nullptr;
m_args.reset();
m_obj_arrays.reset();
m_sym_arrays.reset();