summaryrefslogtreecommitdiff
path: root/src/expr/expr_template.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/expr/expr_template.h')
-rw-r--r--src/expr/expr_template.h16
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 {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback