From: <bl...@us...> - 2003-04-30 22:10:52
|
Update of /cvsroot/cpptool/rfta/src/astdumper In directory sc8-pr-cvs1:/tmp/cvs-serv5788/src/astdumper Modified Files: ASTDumper.cpp ASTDumper.h Log Message: * astdump now takes the input and output file path as argument, and parse the whole file. * added python script to recursively generate ast dump for all files contained in testdata/ Index: ASTDumper.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/astdumper/ASTDumper.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ASTDumper.cpp 28 Apr 2003 20:53:20 -0000 1.6 --- ASTDumper.cpp 30 Apr 2003 22:10:48 -0000 1.7 *************** *** 135,143 **** void ASTDumper::dump( const std::string &source, ! const boost::filesystem::path &logDir, const std::string &title ) { - boost::filesystem::path filePath = makeUniquePath( logDir ); boost::filesystem::ofstream stream( filePath ); HTMLWriter writer( stream ); writer.writeHeader( title ); --- 135,145 ---- void ASTDumper::dump( const std::string &source, ! const boost::filesystem::path &filePath, const std::string &title ) { boost::filesystem::ofstream stream( filePath ); + if ( !stream.good() ) + throw std::runtime_error( "failed to create file: " + filePath.string() ); + HTMLWriter writer( stream ); writer.writeHeader( title ); *************** *** 150,169 **** writer.writeFooter(); stream.close(); - } - - - const boost::filesystem::path - ASTDumper::makeUniquePath( const boost::filesystem::path &logDir ) - { - int serialNo = 1; - while ( true ) - { - std::string fileName = (boost::format( "dump-%05d.html" ) % serialNo).str(); - boost::filesystem::path filePath = logDir / fileName; - if ( !boost::filesystem::exists( filePath ) ) - return filePath; - - ++serialNo; - } } --- 152,155 ---- Index: ASTDumper.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/astdumper/ASTDumper.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ASTDumper.h 23 Oct 2002 20:25:17 -0000 1.1.1.1 --- ASTDumper.h 30 Apr 2003 22:10:49 -0000 1.2 *************** *** 32,37 **** private: - const boost::filesystem::path makeUniquePath( const boost::filesystem::path &logDir ); - void writeAST( const std::string &source, HTMLWriter &writer ); --- 32,35 ---- |