diff options
author | Morgan Deters <mdeters@gmail.com> | 2010-11-15 22:57:14 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2010-11-15 22:57:14 +0000 |
commit | 5e5956d492ab18b5b4d4bb51117ac760867a525d (patch) | |
tree | 0c151baa58810722288ad986dfa13123de273739 /src/expr/expr_template.h | |
parent | ec4e1bdba56565d6372cb19ded12c9cadc506870 (diff) |
Pretty-printer infrastructure created (in src/printer) and SMT-LIBv2 printer
implemented. This new infrastructure removes support for pretty-printing
(even in the AST language) an Expr with reference count 0. Previously,
this was supported in a few places internally to the expr package, for
example in NodeBuilder. (Now, a NodeBuilder cannot be prettyprinted, you
must extract the Node before printing it.)
Diffstat (limited to 'src/expr/expr_template.h')
-rw-r--r-- | src/expr/expr_template.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/expr/expr_template.h b/src/expr/expr_template.h index be089bca8..2e27b4f66 100644 --- a/src/expr/expr_template.h +++ b/src/expr/expr_template.h @@ -648,15 +648,23 @@ public: ExprSetLanguage(OutputLanguage l) : d_language(l) {} inline void applyLanguage(std::ostream& out) { - out.iword(s_iosIndex) = int(d_language); + // (offset by one to detect whether default has been set yet) + out.iword(s_iosIndex) = int(d_language) + 1; } static inline OutputLanguage getLanguage(std::ostream& out) { - return OutputLanguage(out.iword(s_iosIndex)); + long& l = out.iword(s_iosIndex); + if(l == 0) { + // set the default language on this ostream + // (offset by one to detect whether default has been set yet) + l = s_defaultLanguage + 1; + } + return OutputLanguage(l - 1); } static inline void setLanguage(std::ostream& out, OutputLanguage l) { - out.iword(s_iosIndex) = int(l); + // (offset by one to detect whether default has been set yet) + out.iword(s_iosIndex) = int(l) + 1; } };/* class ExprSetLanguage */ @@ -664,7 +672,7 @@ public: ${getConst_instantiations} -#line 659 "${template}" +#line 676 "${template}" namespace expr { |