Skip to content

Commit da23ce1

Browse files
Fix btor2parser linking and update Yices2 API compatibility (#80)
- Replace hardcoded -lbtor2parser with ${BTOR2TOOLS_LIBRARIES} in CMakeLists.txt to properly link against the btor2parser library found by cmake - Update Yices2 API calls from STATUS_* to YICES_STATUS_* constants for compatibility with Yices2 API changes from SRI-CSL/yices2#587
1 parent bfb2379 commit da23ce1

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ if (DREAL_FOUND)
4848
target_link_libraries(sally ${DREAL_LIBRARIES})
4949
endif()
5050
if (BTOR2TOOLS_FOUND)
51-
target_link_libraries(sally -lbtor2parser)
51+
target_link_libraries(sally ${BTOR2TOOLS_LIBRARIES})
5252
endif()
5353

5454
target_link_libraries(sally ${Boost_LIBRARIES} ${GMP_LIBRARY})

src/smt/yices2/yices2_internal.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ yices2_internal::yices2_internal(expr::term_manager& tm, const options& opts)
6565
, d_dpllt_incomplete(false)
6666
, d_mcsat_incomplete(false)
6767
, d_conversion_cache(0)
68-
, d_last_check_status_dpllt(STATUS_UNKNOWN)
69-
, d_last_check_status_mcsat(STATUS_UNKNOWN)
68+
, d_last_check_status_dpllt(YICES_STATUS_UNKNOWN)
69+
, d_last_check_status_mcsat(YICES_STATUS_UNKNOWN)
7070
, d_config_dpllt(NULL)
7171
, d_config_mcsat(NULL)
7272
, d_instance(s_instances)
@@ -1178,22 +1178,22 @@ solver::result yices2_internal::check(expr::model::ref m, const std::vector<expr
11781178
// Call DPLL(T) first, then MCSAT if unsupported
11791179
if (d_ctx_dpllt) {
11801180
if (!m.is_null()) {
1181-
d_last_check_status_dpllt = STATUS_UNKNOWN;
1182-
d_last_check_status_mcsat = STATUS_UNKNOWN;
1181+
d_last_check_status_dpllt = YICES_STATUS_UNKNOWN;
1182+
d_last_check_status_mcsat = YICES_STATUS_UNKNOWN;
11831183
} else {
11841184
result = d_last_check_status_dpllt = yices_check_context(d_ctx_dpllt, 0);
1185-
d_last_check_status_mcsat = STATUS_UNKNOWN;
1185+
d_last_check_status_mcsat = YICES_STATUS_UNKNOWN;
11861186
switch (result) {
1187-
case STATUS_SAT:
1187+
case YICES_STATUS_SAT:
11881188
if (!d_dpllt_incomplete) {
11891189
return solver::SAT;
11901190
} else {
1191-
d_last_check_status_dpllt = STATUS_UNKNOWN;
1191+
d_last_check_status_dpllt = YICES_STATUS_UNKNOWN;
11921192
break; // Do MCSAT
11931193
}
1194-
case STATUS_UNSAT:
1194+
case YICES_STATUS_UNSAT:
11951195
return solver::UNSAT;
1196-
case STATUS_UNKNOWN:
1196+
case YICES_STATUS_UNKNOWN:
11971197
break; // Do MCSAT
11981198
default: {
11991199
std::stringstream ss;
@@ -1222,16 +1222,16 @@ solver::result yices2_internal::check(expr::model::ref m, const std::vector<expr
12221222
yices_free_model(yices_model);
12231223
}
12241224
switch (result) {
1225-
case STATUS_SAT:
1225+
case YICES_STATUS_SAT:
12261226
if (!d_mcsat_incomplete) {
12271227
return solver::SAT;
12281228
} else {
1229-
d_last_check_status_mcsat = STATUS_UNKNOWN;
1229+
d_last_check_status_mcsat = YICES_STATUS_UNKNOWN;
12301230
break; // Nobody knows
12311231
}
1232-
case STATUS_UNSAT:
1232+
case YICES_STATUS_UNSAT:
12331233
return solver::UNSAT;
1234-
case STATUS_UNKNOWN:
1234+
case YICES_STATUS_UNKNOWN:
12351235
return solver::UNKNOWN;
12361236
default: {
12371237
std::stringstream ss;
@@ -1247,13 +1247,13 @@ solver::result yices2_internal::check(expr::model::ref m, const std::vector<expr
12471247
bool yices2_internal::is_consistent() {
12481248
if (d_ctx_dpllt) {
12491249
smt_status_t status = yices_context_status(d_ctx_dpllt);
1250-
if (status == STATUS_UNSAT) {
1250+
if (status == YICES_STATUS_UNSAT) {
12511251
return false;
12521252
}
12531253
}
12541254
if (d_ctx_mcsat) {
12551255
smt_status_t status = yices_context_status(d_ctx_mcsat);
1256-
if (status == STATUS_UNSAT) {
1256+
if (status == YICES_STATUS_UNSAT) {
12571257
return false;
12581258
}
12591259
}
@@ -1346,7 +1346,7 @@ model_t* yices2_internal::get_yices_model(expr::model::ref m) {
13461346
}
13471347

13481348
expr::model::ref yices2_internal::get_model() {
1349-
assert(d_last_check_status_dpllt == STATUS_SAT || d_last_check_status_mcsat == STATUS_SAT);
1349+
assert(d_last_check_status_dpllt == YICES_STATUS_SAT || d_last_check_status_mcsat == YICES_STATUS_SAT);
13501350
assert(d_A_variables.size() > 0 || d_B_variables.size() > 0);
13511351

13521352
int32_t ret = 0;
@@ -1355,7 +1355,7 @@ expr::model::ref yices2_internal::get_model() {
13551355
expr::model::ref m = new expr::model(d_tm, false);
13561356

13571357
// Get the model from yices
1358-
model_t* yices_model = (d_last_check_status_dpllt == STATUS_SAT) ?
1358+
model_t* yices_model = (d_last_check_status_dpllt == YICES_STATUS_SAT) ?
13591359
yices_get_model(d_ctx_dpllt, true) :
13601360
yices_get_model(d_ctx_mcsat, true) ;
13611361

@@ -1810,10 +1810,10 @@ void yices2_internal::efsmt_to_stream(std::ostream& out, const term_vector_t* G_
18101810

18111811
void yices2_internal::interpolate(std::vector<expr::term_ref>& out) {
18121812
smt_status status = yices_check_context_with_interpolation(&d_interpolation_ctx, NULL, 0);
1813-
if (status == STATUS_ERROR) {
1813+
if (status == YICES_STATUS_ERROR) {
18141814
check_error(-1, "Yices error (interpolation)");
18151815
}
1816-
assert(status == STATUS_UNSAT);
1816+
assert(status == YICES_STATUS_UNSAT);
18171817
assert(d_interpolation_ctx.interpolant != NULL_TERM);
18181818
expr::term_ref interpolant = to_term(d_interpolation_ctx.interpolant);
18191819
TRACE("yices2::interpolation") << "I = " << interpolant << std::endl;
@@ -1822,13 +1822,13 @@ void yices2_internal::interpolate(std::vector<expr::term_ref>& out) {
18221822
yices_push(d_interpolation_ctx.ctx_A);
18231823
yices_assert_formula(d_interpolation_ctx.ctx_A, yices_not(d_interpolation_ctx.interpolant));
18241824
status = yices_check_context(d_interpolation_ctx.ctx_A, NULL);
1825-
assert(status == STATUS_UNSAT);
1825+
assert(status == YICES_STATUS_UNSAT);
18261826
yices_pop(d_interpolation_ctx.ctx_A);
18271827
// Check I && B is unsat
18281828
yices_push(d_interpolation_ctx.ctx_B);
18291829
yices_assert_formula(d_interpolation_ctx.ctx_B, d_interpolation_ctx.interpolant);
18301830
status = yices_check_context(d_interpolation_ctx.ctx_B, NULL);
1831-
assert(status == STATUS_UNSAT);
1831+
assert(status == YICES_STATUS_UNSAT);
18321832
yices_pop(d_interpolation_ctx.ctx_B);
18331833
}
18341834
out.push_back(interpolant);

0 commit comments

Comments
 (0)