diff options
author | Tim King <taking@google.com> | 2015-12-30 11:45:37 -0800 |
---|---|---|
committer | Tim King <taking@google.com> | 2015-12-30 11:45:37 -0800 |
commit | fa7f30a4ba08afe066604daee87006b4fb5f21f7 (patch) | |
tree | 6eecac7cce64fa00f4ac5c18f023f1bc234435a3 /src/printer/printer.cpp | |
parent | 1ce397129214a427a10ff3e33069e315fe13eec1 (diff) |
Shuffling around public vs. private headers
- Adding a script contrib/test_install_headers.h that tests whether one can include all cvc4_public headers. CVC4 can pass this test after this commit.
- Making lib/{clock_gettime.h,ffs.h,strtok_r.h} cvc4_private.
- Making prop/sat_solver_factory.h cvc4_private.
- Moving the expr iostream manipulators into their own files: expr_iomanip.{h,cpp}.
- Setting the generated *_options.h files back to being cvc4_private.
-- Removing the usage of options/expr_options.h from expr.h.
-- Removing the include of base_options.h from options.h.
- Cleaning up CPP macros in cvc4_public headers.
-- Changing the ROLL macro in floatingpoint.h into an inline function.
-- Removing the now unused flag -D__BUILDING_STATISTICS_FOR_EXPORT.
Diffstat (limited to 'src/printer/printer.cpp')
-rw-r--r-- | src/printer/printer.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/printer/printer.cpp b/src/printer/printer.cpp index 75d625edc..d4b99536e 100644 --- a/src/printer/printer.cpp +++ b/src/printer/printer.cpp @@ -17,6 +17,7 @@ #include <string> +#include "options/base_options.h" #include "options/language.h" #include "printer/ast/ast_printer.h" #include "printer/cvc/cvc_printer.h" @@ -87,4 +88,29 @@ void Printer::toStream(std::ostream& out, const UnsatCore& core, const std::map< } }/* Printer::toStream(UnsatCore, std::map<Expr, std::string>) */ +Printer* Printer::getPrinter(OutputLanguage lang) throw() { + if(lang == language::output::LANG_AUTO) { + // Infer the language to use for output. + // + // Options can be null in certain circumstances (e.g., when printing + // the singleton "null" expr. So we guard against segfault + if(not Options::isCurrentNull()) { + if(options::outputLanguage.wasSetByUser()) { + lang = options::outputLanguage(); + } + if(lang == language::output::LANG_AUTO && options::inputLanguage.wasSetByUser()) { + lang = language::toOutputLanguage(options::inputLanguage()); + } + } + if(lang == language::output::LANG_AUTO) { + lang = language::output::LANG_CVC4; // default + } + } + if(d_printers[lang] == NULL) { + d_printers[lang] = makePrinter(lang); + } + return d_printers[lang]; +} + + }/* CVC4 namespace */ |