summaryrefslogtreecommitdiffabout
path: root/lib/sitecing_enflesher.ll
Unidiff
Diffstat (limited to 'lib/sitecing_enflesher.ll') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/sitecing_enflesher.ll8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sitecing_enflesher.ll b/lib/sitecing_enflesher.ll
index 46489c7..bb667be 100644
--- a/lib/sitecing_enflesher.ll
+++ b/lib/sitecing_enflesher.ll
@@ -178,8 +178,9 @@ void sitecing_enflesher::enflesh() {
178 if(!ifs.good()) 178 if(!ifs.good())
179 throw preprocessor_error(CODEPOINT,"failed to open skeleton file"); 179 throw preprocessor_error(CODEPOINT,"failed to open skeleton file");
180 switch_streams(&ifs,NULL); 180 switch_streams(&ifs,NULL);
181 yylex(); 181 yylex();
182 outs_close();
182} 183}
183 184
184void sitecing_enflesher::anchor() { 185void sitecing_enflesher::anchor() {
185 if(!anchoraged) 186 if(!anchoraged)
@@ -187,9 +188,9 @@ void sitecing_enflesher::anchor() {
187 outs << "\n#line " << lineno() << " \"" << parser.skeleton << "\"\n"; 188 outs << "\n#line " << lineno() << " \"" << parser.skeleton << "\"\n";
188 anchor_time = false; 189 anchor_time = false;
189} 190}
190 191
191void sitecing_enflesher::outs_open(const string& nfile) { 192void sitecing_enflesher::outs_close() {
192 if(!outs_filename.empty()) { 193 if(!outs_filename.empty()) {
193 outs.flush(); 194 outs.flush();
194 outs.close(); 195 outs.close();
195 outs.clear(); 196 outs.clear();
@@ -243,8 +244,13 @@ void sitecing_enflesher::outs_open(const string& nfile) {
243 if(rename(fn_s.c_str(),fn_d.c_str())) 244 if(rename(fn_s.c_str(),fn_d.c_str()))
244 throw preprocessor_error(CODEPOINT,"failed to rename() generated output"); 245 throw preprocessor_error(CODEPOINT,"failed to rename() generated output");
245 } 246 }
246 } 247 }
248 outs_filename.erase();
249}
250
251void sitecing_enflesher::outs_open(const string& nfile) {
252 outs_close();
247 outs_filename = nfile; 253 outs_filename = nfile;
248 outs.open((nfile+".new").c_str(),ios::trunc); 254 outs.open((nfile+".new").c_str(),ios::trunc);
249 if(!outs.good()) 255 if(!outs.good())
250 throw preprocessor_error(CODEPOINT,"failed to write preprocessor output"); 256 throw preprocessor_error(CODEPOINT,"failed to write preprocessor output");