24
24
import static org .sosy_lab .java_smt .solvers .mathsat5 .Mathsat5NativeApi .msat_pop_backtrack_point ;
25
25
import static org .sosy_lab .java_smt .solvers .mathsat5 .Mathsat5NativeApi .msat_push_backtrack_point ;
26
26
import static org .sosy_lab .java_smt .solvers .mathsat5 .Mathsat5NativeApi .msat_set_option_checked ;
27
+ import static org .sosy_lab .java_smt .solvers .mathsat5 .Mathsat5NativeApi .msat_set_termination_callback ;
27
28
import static org .sosy_lab .java_smt .solvers .mathsat5 .Mathsat5NativeApi .msat_term_get_arg ;
28
29
import static org .sosy_lab .java_smt .solvers .mathsat5 .Mathsat5NativeApi .msat_term_is_boolean_constant ;
29
30
import static org .sosy_lab .java_smt .solvers .mathsat5 .Mathsat5NativeApi .msat_term_is_not ;
@@ -99,14 +100,12 @@ private long buildConfig(Set<ProverOptions> opts) {
99
100
public boolean isUnsat () throws InterruptedException , SolverException {
100
101
Preconditions .checkState (!closed );
101
102
102
- long hook = context .addTerminationTest (curEnv );
103
- boolean result ;
103
+ final long hook = msat_set_termination_callback (curEnv , context .getTerminationTest ());
104
104
try {
105
- result = !msat_check_sat (curEnv );
105
+ return !msat_check_sat (curEnv );
106
106
} finally {
107
107
msat_free_termination_callback (hook );
108
108
}
109
- return result ;
110
109
}
111
110
112
111
@ Override
@@ -115,14 +114,12 @@ public boolean isUnsatWithAssumptions(Collection<BooleanFormula> pAssumptions)
115
114
Preconditions .checkState (!closed );
116
115
checkForLiterals (pAssumptions );
117
116
118
- long hook = context .addTerminationTest (curEnv );
119
- boolean result ;
117
+ final long hook = msat_set_termination_callback (curEnv , context .getTerminationTest ());
120
118
try {
121
- result = !msat_check_sat_with_assumptions (curEnv , getMsatTerm (pAssumptions ));
119
+ return !msat_check_sat_with_assumptions (curEnv , getMsatTerm (pAssumptions ));
122
120
} finally {
123
121
msat_free_termination_callback (hook );
124
122
}
125
- return result ;
126
123
}
127
124
128
125
private void checkForLiterals (Collection <BooleanFormula > formulas ) {
0 commit comments