author | Michael Krelin <hacker@klever.net> | 2005-04-02 17:13:21 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2005-04-02 17:13:21 (UTC) |
commit | 67b825ecb491066424b7e48f864c0b76b4156b28 (patch) (side-by-side diff) | |
tree | 32c9f346060d04adc5a1d527656306489a7b0274 | |
parent | 986589d804cf07f58b0b9b8786267bf9032d231c (diff) | |
download | sitecing-67b825ecb491066424b7e48f864c0b76b4156b28.zip sitecing-67b825ecb491066424b7e48f864c0b76b4156b28.tar.gz sitecing-67b825ecb491066424b7e48f864c0b76b4156b28.tar.bz2 |
removed debugging output
-rw-r--r-- | lib/sitecing_enflesher.ll | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/lib/sitecing_enflesher.ll b/lib/sitecing_enflesher.ll index bb667be..f833af2 100644 --- a/lib/sitecing_enflesher.ll +++ b/lib/sitecing_enflesher.ll @@ -147,114 +147,113 @@ ID [A-Za-z_][A-Za-z0-9_]* outs << ", virtual public " << parser.factory.get_classname(i->path); } } \<\%ancestors:typedefs\%\> { for(sitecing_parser::ancestor_classes_t::const_iterator i=parser.ancestor_classes.begin();i!=parser.ancestor_classes.end();++i) { outs << "typedef class " << parser.factory.get_classname(i->path) << " " << i->name << ";\n"; } anchor_time = true; } \<\%ancestors:import\%\> { for(sitecing_parser::ancestor_classes_t::const_iterator i=parser.ancestor_classes.begin();i!=parser.ancestor_classes.end();++i) { outs << i->name << "::__do_imports();\n"; } anchor_time = true; } \n { if(anchor_time) anchor(); ECHO; } . ECHO; %% void sitecing_enflesher::LexerOutput(const char *buf,int size) { outs.write(buf,size); } void sitecing_enflesher::enflesh() { ifstream ifs(parser.skeleton.c_str()); if(!ifs.good()) throw preprocessor_error(CODEPOINT,"failed to open skeleton file"); switch_streams(&ifs,NULL); yylex(); outs_close(); } void sitecing_enflesher::anchor() { if(!anchoraged) return; outs << "\n#line " << lineno() << " \"" << parser.skeleton << "\"\n"; anchor_time = false; } void sitecing_enflesher::outs_close() { if(!outs_filename.empty()) { outs.flush(); outs.close(); outs.clear(); /* * compare source and destination files. * * one can also keep a hash for the old one and compute one for the * output while writing, but I'm not sure if it's any better. Surely a * bit less accurate, unless we're going to compare it in case of * difference, anyway. */ bool overwrite = false; struct stat st_s, st_d; string fn_s = outs_filename+".new"; string fn_d = outs_filename; if(stat(fn_d.c_str(),&st_d)) { overwrite = true; }else{ if(stat(fn_s.c_str(),&st_s)) throw preprocessor_error(CODEPOINT,"failed to stat() supposedly created file"); if(st_s.st_size!=st_d.st_size) { overwrite = true; }else{ ifstream i_s(fn_s.c_str(),ios::in); if(!i_s) throw preprocessor_error(CODEPOINT,"failed to open supposedly created file"); ifstream i_d(fn_d.c_str(),ios::in); if(!i_d) throw preprocessor_error(CODEPOINT,"failed to open the old preprocessed source"); off_t remaining = st_s.st_size; char t1[2048]; char t2[sizeof(t1)]; while(remaining) { int rb = remaining; if(rb>sizeof(t1)) rb = sizeof(t1); if(i_s.read(t1,rb).gcount()!=rb) throw preprocessor_error(CODEPOINT,"error reading just created file"); if(i_d.read(t2,rb).gcount()!=rb) throw preprocessor_error(CODEPOINT,"error reading the old preprocessed source"); if(memcmp(t1,t2,rb)) { overwrite = true; break; } remaining -= rb; } } } if(overwrite) { - cerr << "renaming '" << fn_s << "'" << endl; if(rename(fn_s.c_str(),fn_d.c_str())) throw preprocessor_error(CODEPOINT,"failed to rename() generated output"); } } outs_filename.erase(); } void sitecing_enflesher::outs_open(const string& nfile) { outs_close(); outs_filename = nfile; outs.open((nfile+".new").c_str(),ios::trunc); if(!outs.good()) throw preprocessor_error(CODEPOINT,"failed to write preprocessor output"); } /* * vim:set ft=lex: */ |