diff -r c8ecf89eb77f -r ea3e26ea6629 Symbian/SysDefToText/SysDefToText.pm --- a/Symbian/SysDefToText/SysDefToText.pm Sat Feb 20 00:39:01 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +0,0 @@ -# -# Copyright (c) 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: -# -# This module converts new-style System Definition XML files to the older -# .TXT file format (i.e. files of the type GT.TXT, Techview.TXT etc.) - -package SysDefToText; -use strict; -use SysDefCollector; -use SysDefParser; - -# ConvertFile -# -# Inputs -# Name of XML file to read -# Configuration name -# -# Outputs -# Writes data to Text File -# Writes to log file, if filename defined. -# -# Description -# This is the "top level" subroutine for the conversion of a "SysDef" .XML file to an old format "Text" file. -# -sub ConvertFile -{ - my ($configname, $XMLfile, $outfile, $logfile) = @_; - -# my $XMLhandle = \*XMLFILE; - my $outhandle = \*OUTFILE; - my $loghandle = \*LOGFILE; - -# open $XMLhandle, "<$XMLfile" or die "Cannot open input file: $XMLfile"; - open $outhandle, ">$outfile" or die "Cannot open output file: $outfile"; - if (defined $logfile) - { - open $loghandle, ">$logfile" or die "Cannot open logfile: $logfile"; - print $loghandle "Processing: $XMLfile Output to: $outfile\n"; - print $loghandle "==================================================\n"; - } - else - { - $loghandle = \*STDERR; - } - - my $sysdef = SysDefCollector->new($configname,$loghandle); - my $parser = SysDefParser->new(-client => $sysdef->parserClient()); - - foreach my $file (@$XMLfile) { - my $XMLhandle = \*file; - open $XMLhandle, "<$file" or die "Cannot open input file: $file"; - $parser->parse($XMLhandle); - close $XMLhandle; - } - - ## Suppress this debugging! - ##{ # FTB just call dump() and test() routines. - #$sysdef->dump($loghandle); - #$sysdef->test($loghandle); - ##} - - WriteHeader($outhandle,$configname,$XMLfile); - - my @list0 = $sysdef->options(); # ABLD options - my @list1 = $sysdef->targets(); - WriteOptionList($outhandle,\@list0,\@list1); - - my @list2 = $sysdef->components(); - my $bootflag = $sysdef->specialInstructionsFlag(); - WriteComponentList($outhandle,\@list2,$bootflag); - -# close XMLFILE; - close OUTFILE; - if (defined $logfile) { close LOGFILE; } -} - -# WriteHeader -# -# Inputs -# Handle of Text file to which to write -# Configuration name -# -# Outputs -# Writes data to Text File -# -# Description -# This subroutine initiates the old format "Text" file. -# -sub WriteHeader -{ - my $fh = shift; - my $config = shift; - my $XMLfile = shift; - print $fh < $column2pos) { $column2pos += 8; } - printf $fh "%-*s\t# use abld %s\n", $column2pos, $name, $option; - } - - foreach my $target (@$targets) - { - # abld targets are only one word - next if ($target =~ /\w+\s+\w+/); - my $name; - if ($target =~ /(misa|mint|mcot|mtemplate|meig)/i) - { - $name = "