From: <bl...@us...> - 2003-05-01 09:56:26
|
Update of /cvsroot/cpptool/rfta/bin In directory sc8-pr-cvs1:/tmp/cvs-serv21655/bin Modified Files: lister.py Log Message: * fixed astdump, parser failure was not indicated by error code * correctly define output html filename (was stripping .cpp/.h extension) Index: lister.py =================================================================== RCS file: /cvsroot/cpptool/rfta/bin/lister.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lister.py 1 May 2003 08:12:30 -0000 1.2 --- lister.py 1 May 2003 09:08:08 -0000 1.3 *************** *** 139,142 **** --- 139,151 ---- self.output_path = output_path + def __cmp__( self, other ): + x = self.source_path + y = other.source_path + if x < y: + return -1 + elif x > y: + return 1 + return 0 + class ASTGenerator: def __init__( self, source_dir, output_dir ): *************** *** 147,158 **** def generate( self, source_path ): relative_source_path = Path(source_path).make_relative_to( self.source_dir ) ! output_filename = Path( relative_source_path ).change_extension( "html" ) output_path = os.path.join( self.output_dir, output_filename ) ! print "Generating AST for ", source_path, " in ", output_path Path(output_path).ensure_dir_exists() exit_code = os.spawnl( os.P_WAIT, "astdump", "astdump", source_path, output_path ) ! self.parse_result[ source_path ] = ParseResult( self.convertParseExitCode(exit_code), ! source_path, ! output_path ) def convertParseExitCode( self, code ): --- 156,167 ---- def generate( self, source_path ): relative_source_path = Path(source_path).make_relative_to( self.source_dir ) ! output_filename = relative_source_path + ".html" output_path = os.path.join( self.output_dir, output_filename ) ! print "Generating AST for ", source_path, " in ", output_path, Path(output_path).ensure_dir_exists() exit_code = os.spawnl( os.P_WAIT, "astdump", "astdump", source_path, output_path ) ! status = self.convertParseExitCode(exit_code) ! self.parse_result[ source_path ] = ParseResult( status, source_path, output_path ) ! print ': ', status def convertParseExitCode( self, code ): *************** *** 205,209 **** table_tag = Tag( 'TABLE' ).setAttributes( { 'WIDTH' : '100%', 'BORDER' : '0', 'COLS' : '2' } ) tags.append( table_tag ) ! for test in self.parse_result.itervalues(): row_tag = Tag( 'TR' ).setAttribute( 'ALIGN', 'left' ) relative_url = Path( test.output_path ).make_relative_to( self.output_dir ) --- 214,220 ---- table_tag = Tag( 'TABLE' ).setAttributes( { 'WIDTH' : '100%', 'BORDER' : '0', 'COLS' : '2' } ) tags.append( table_tag ) ! sorted_tests = self.parse_result.values() ! sorted_tests.sort() ! for test in sorted_tests: row_tag = Tag( 'TR' ).setAttribute( 'ALIGN', 'left' ) relative_url = Path( test.output_path ).make_relative_to( self.output_dir ) |