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

prepare symbols to be more abstract, update mbi, delay initialize some modules

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-01-10 12:02:08 -08:00
parent 74d3493d74
commit 78a1736bd2
25 changed files with 286 additions and 357 deletions

View file

@ -53,11 +53,11 @@ extern "C" {
RESET_ERROR_CODE();
if (i < 0 || (size_t)i >= (SIZE_MAX >> PTR_ALIGNMENT)) {
SET_ERROR_CODE(Z3_IOB, nullptr);
return nullptr;
return of_symbol(symbol::null);
}
Z3_symbol result = of_symbol(symbol(i));
Z3_symbol result = of_symbol(symbol((unsigned)i));
return result;
Z3_CATCH_RETURN(nullptr);
Z3_CATCH_RETURN(of_symbol(symbol::null));
}
Z3_symbol Z3_API Z3_mk_string_symbol(Z3_context c, char const * str) {
@ -71,7 +71,7 @@ extern "C" {
s = symbol(str);
Z3_symbol result = of_symbol(s);
return result;
Z3_CATCH_RETURN(nullptr);
Z3_CATCH_RETURN(of_symbol(symbol::null));
}
bool Z3_API Z3_is_eq_sort(Z3_context c, Z3_sort s1, Z3_sort s2) {
@ -437,7 +437,7 @@ extern "C" {
Z3_symbol Z3_API Z3_get_decl_name(Z3_context c, Z3_func_decl d) {
LOG_Z3_get_decl_name(c, d);
RESET_ERROR_CODE();
CHECK_VALID_AST(d, nullptr);
CHECK_VALID_AST(d, of_symbol(symbol::null));
return of_symbol(to_func_decl(d)->get_name());
}
@ -521,18 +521,18 @@ extern "C" {
Z3_TRY;
LOG_Z3_get_decl_symbol_parameter(c, d, idx);
RESET_ERROR_CODE();
CHECK_VALID_AST(d, nullptr);
CHECK_VALID_AST(d, of_symbol(symbol::null));
if (idx >= to_func_decl(d)->get_num_parameters()) {
SET_ERROR_CODE(Z3_IOB, nullptr);
return nullptr;
return of_symbol(symbol::null);
}
parameter const& p = to_func_decl(d)->get_parameters()[idx];
if (!p.is_symbol()) {
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
return nullptr;
return of_symbol(symbol::null);
}
return of_symbol(p.get_symbol());
Z3_CATCH_RETURN(nullptr);
Z3_CATCH_RETURN(of_symbol(symbol::null));
}
Z3_sort Z3_API Z3_get_decl_sort_parameter(Z3_context c, Z3_func_decl d, unsigned idx) {
@ -612,9 +612,9 @@ extern "C" {
Z3_TRY;
LOG_Z3_get_sort_name(c, t);
RESET_ERROR_CODE();
CHECK_VALID_AST(t, nullptr);
CHECK_VALID_AST(t, of_symbol(symbol::null));
return of_symbol(to_sort(t)->get_name());
Z3_CATCH_RETURN(nullptr);
Z3_CATCH_RETURN(of_symbol(symbol::null));
}
Z3_sort Z3_API Z3_get_sort(Z3_context c, Z3_ast a) {

View file

@ -679,8 +679,8 @@ extern "C" {
for (unsigned i = 0; i < names.size(); ++i) {
ss << ";" << names[i].str();
}
RETURN_Z3(of_symbol(symbol(ss.str().substr(1).c_str())));
Z3_CATCH_RETURN(nullptr);
return of_symbol(symbol(ss.str().substr(1).c_str()));
Z3_CATCH_RETURN(of_symbol(symbol::null));
}
void Z3_API Z3_fixedpoint_add_invariant(Z3_context c, Z3_fixedpoint d, Z3_func_decl pred, Z3_ast property) {

View file

@ -172,11 +172,11 @@ extern "C" {
RESET_ERROR_CODE();
if (i >= to_param_descrs_ptr(p)->size()) {
SET_ERROR_CODE(Z3_IOB, nullptr);
RETURN_Z3(nullptr);
return of_symbol(symbol::null);
}
Z3_symbol result = of_symbol(to_param_descrs_ptr(p)->get_param_name(i));
return result;
Z3_CATCH_RETURN(nullptr);
Z3_CATCH_RETURN(of_symbol(symbol::null));
}
Z3_string Z3_API Z3_param_descrs_get_documentation(Z3_context c, Z3_param_descrs p, Z3_symbol s) {

View file

@ -37,8 +37,8 @@ extern "C" {
c,
is_forall,
weight,
nullptr,
nullptr,
of_symbol(symbol::null),
of_symbol(symbol::null),
num_patterns, patterns,
0, nullptr,
num_decls, sorts,
@ -290,7 +290,7 @@ extern "C" {
unsigned num_patterns,
Z3_pattern const patterns[],
Z3_ast body) {
return Z3_mk_quantifier_const_ex(c, is_forall, weight, nullptr, nullptr,
return Z3_mk_quantifier_const_ex(c, is_forall, weight, of_symbol(symbol::null), of_symbol(symbol::null),
num_bound, bound,
num_patterns, patterns,
0, nullptr,
@ -456,9 +456,9 @@ extern "C" {
}
else {
SET_ERROR_CODE(Z3_SORT_ERROR, nullptr);
return nullptr;
return of_symbol(symbol::null);
}
Z3_CATCH_RETURN(nullptr);
Z3_CATCH_RETURN(of_symbol(symbol::null));
}
Z3_sort Z3_API Z3_get_quantifier_bound_sort(Z3_context c, Z3_ast a, unsigned i) {

View file

@ -427,7 +427,7 @@ namespace z3 {
if (s.kind() == Z3_INT_SYMBOL)
out << "k!" << s.to_int();
else
out << s.str().c_str();
out << s.str();
return out;
}