Fixes https://github.com/CVC4/cvc4-wishues/issues/9.
When communicating with CVC4 using pipes and the CVC language, it was not possible to determine when all the lines of a model have been printed.
This change adds begin and end markers as the example below:
```
MODEL BEGIN
x : INT = -3;
y : INT = 0;
z : INT = 0;
MODEL END;
```
} // namespace
+void CvcPrinter::toStream(std::ostream& out, const Model& m) const
+{
+ // print the model comments
+ std::stringstream c;
+ m.getComments(c);
+ std::string ln;
+ while (std::getline(c, ln))
+ {
+ out << "; " << ln << std::endl;
+ }
+
+ // print the model
+ out << "MODEL BEGIN" << std::endl;
+ this->Printer::toStream(out, m);
+ out << "MODEL END;" << std::endl;
+}
+
void CvcPrinter::toStream(std::ostream& out,
const Model& model,
const Command* command) const
bool types,
size_t dag) const override;
void toStream(std::ostream& out, const CommandStatus* s) const override;
+ void toStream(std::ostream& out, const Model& m) const override;
private:
void toStream(
regress0/preprocess/preprocess_14.cvc
regress0/preprocess/preprocess_15.cvc
regress0/print_lambda.cvc
+ regress0/print_model.cvc
regress0/printer/bv_consts_bin.smt2
regress0/printer/bv_consts_dec.smt2
regress0/printer/empty_sort.smt2
% SCRUBBER: sed -e 's/f : (INT) -> INT = (LAMBDA(.*:INT): 0);$/f : (INT) -> INT = (LAMBDA(VAR:INT): 0);/'
% COMMAND-LINE: --produce-models
% EXPECT: sat
+% EXPECT: MODEL BEGIN
% EXPECT: f : (INT) -> INT = (LAMBDA(VAR:INT): 0);
+% EXPECT: MODEL END;
f : INT -> INT;
ASSERT f(1) = 0;
--- /dev/null
+% COMMAND-LINE: --produce-models
+% EXPECT: sat
+% EXPECT: MODEL BEGIN
+% EXPECT: s1 : INT = 2;
+% EXPECT: s2 : INT = 1;
+% EXPECT: MODEL END;
+
+OPTION "produce-models";
+s1, s2 : INT;
+ASSERT s1 = 2;
+CHECKSAT s2 > 0 AND s2 < s1;
+COUNTERMODEL;