diff -r 000000000000 -r 83f4b4db085c bldsystemtools/commonbldutils/renumber.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bldsystemtools/commonbldutils/renumber.pl Tue Feb 02 01:39:43 2010 +0200 @@ -0,0 +1,110 @@ +# Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "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: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Script to renumber the XML command file +# +# + +use strict; +use Getopt::Long; +use File::Copy; + +# Process the commandline +my ($iDataSource) = ProcessCommandLine(); + +&Renumber($iDataSource); + + +# ProcessCommandLine +# +# Inputs +# +# Outputs +# $iDataSource (XML file to process) +# +# Description +# This function processes the commandline + +sub ProcessCommandLine { + my ($iHelp, $iPort, $iDataSource, $iLogFile); + GetOptions('h' => \$iHelp, 'd=s' =>\$iDataSource ); + + if (($iHelp) || (!defined $iDataSource)) + { + Usage(); + } elsif (! -e $iDataSource) { + die "Cannot open $iDataSource"; + } else { + return($iDataSource); + } +} + +# Usage +# +# Description +# Output Usage Information. +# + +sub Usage { + print <$iDataSource" or die "Can't read $iDataSource"; + + while ($iLine=) + { + if ($iLine =~ /ID=\"\d+\"/) + { + $iLine =~ s/ID="\d+"\s+Stage="\d+"/ID="$iNum" Stage="$iNum"/; + $iNum++; + } + elsif ($iLine =~ /Order="\d+"/) + { + $iLine =~ s/Order="\d+"/Order="$iOrder"/; + $iOrder++; + } + print XMLOUT $iLine; + + } + + close XML; +}