summaryrefslogtreecommitdiff
path: root/src/printer/cvc/cvc_printer.cpp
diff options
context:
space:
mode:
authorYing Sheng <sqy1415@gmail.com>2020-03-07 21:01:16 -0800
committerGitHub <noreply@github.com>2020-03-07 21:01:16 -0800
commita0b35a8ba9c47ed521082c5ac5a8f50909d9f7c4 (patch)
tree78ac2d6fcc4f93145bfd199844e5aadf3c610847 /src/printer/cvc/cvc_printer.cpp
parent76c1710e99f2e9ca2109762394eaefcbc4a5557c (diff)
Explicit end marker for models printed in the CVC language (#3934)
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; ```
Diffstat (limited to 'src/printer/cvc/cvc_printer.cpp')
-rw-r--r--src/printer/cvc/cvc_printer.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/printer/cvc/cvc_printer.cpp b/src/printer/cvc/cvc_printer.cpp
index 86dd31da2..79a8904cd 100644
--- a/src/printer/cvc/cvc_printer.cpp
+++ b/src/printer/cvc/cvc_printer.cpp
@@ -1174,6 +1174,23 @@ void DeclareFunctionCommandToStream(std::ostream& out,
} // 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
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback