diff -r 4d23dd2e8d04 -r d3c5dd0ae0b0 common/tools/analysis/dump_recipe_at_line.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/analysis/dump_recipe_at_line.pl Wed Jun 03 18:30:15 2009 +0100 @@ -0,0 +1,69 @@ +#!/usr/bin/perl +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# Matt Davies +# +# Description: +# dumprecipe.pl : Gives you the recipe starting with the given line number +# perl dumprecipe.pl +# +# Tool is generally for use with yarp, to look at individual errors, and was written as the logs are too verbose for many editors to handle. +# As usual, this tool is rough and ready. + + +use strict; + +my $file = shift @ARGV; +my $number = shift @ARGV; +my %numbers; +if(!-e $number && $number =~ m/^\d+$/) +{ + $numbers{$number} = $number; +} +else +{ + open(NUMBERS, "<$number") or die "Couldn't open $number"; + while(my $line = ) + { + if($line =~ m/(\d+)\s+(\S+)/) + { + $numbers{$1} = "$2($1)"; + } + elsif($line =~ m/(\d+)/) + { + $numbers{$1} = $1; + } + } + close NUMBERS; +} + + +open(FILE,"<$file") or die "Coudln't open file $file\n"; +my $linecount = 0; +my $recipe = 0; +while(my $line = ) +{ + ++$linecount; + + if(!$recipe && defined $numbers{$linecount}) + { + $recipe = $numbers{$linecount}; + } + if($recipe) + { + print $recipe."\t".$line; + } + if($line =~ m/<\/recipe>/) + { + $recipe = 0; + } +} +#print $linecount; \ No newline at end of file