1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 #!perl |
|
17 # This script converts new-style System Definition XML files to the older |
|
18 # .TXT file format (i.e. files of the type GT.TXT, Techview.TXT etc.) |
|
19 |
|
20 # |
|
21 # Modified by S60 to get two xml input file |
|
22 # Can use cases when system model and system build located in different files |
|
23 # |
|
24 |
|
25 use strict; |
|
26 use FindBin; # for FindBin::Bin |
|
27 use lib $FindBin::Bin; |
|
28 use Getopt::Long; |
|
29 use SysDefToText; |
|
30 |
|
31 my $debug; |
|
32 |
|
33 my ($config, $XMLfile, $outfile, $logfile) = ProcessCommandLine(); |
|
34 |
|
35 print STDERR "Configuration: $config\n"; |
|
36 print STDERR "Input .XML file: @$XMLfile\n"; |
|
37 print STDERR "Output .TXT file: $outfile\n"; |
|
38 if (defined $logfile) |
|
39 { |
|
40 print STDERR "Logfile: $logfile\n"; |
|
41 } |
|
42 |
|
43 SysDefToText::ConvertFile($config, $XMLfile, $outfile, $logfile); |
|
44 |
|
45 exit(0); |
|
46 |
|
47 # ProcessCommandLine |
|
48 # |
|
49 # Inputs |
|
50 # @ARGV |
|
51 # |
|
52 # Outputs |
|
53 # Returns Configuration Nmae and filenames. |
|
54 # |
|
55 # Description |
|
56 # This function processes the command line |
|
57 # On error, exits via Usage(); |
|
58 |
|
59 sub ProcessCommandLine |
|
60 { |
|
61 my ($help, $config, @XMLfile, $XMLfile1, $outfile, $logfile); |
|
62 my $args = @ARGV; |
|
63 |
|
64 my $ret = GetOptions('h' => \$help, 'n=s' => \$config, 'x=s' => \@XMLfile, 'o=s' => \$outfile, 'l=s' => \$logfile); |
|
65 |
|
66 if (($help) || (!$args) || (!$ret) || (!@XMLfile) || (!defined $config) || (!defined $outfile)) |
|
67 { |
|
68 Usage(); |
|
69 } |
|
70 if (@ARGV) |
|
71 { |
|
72 Usage ("Redundant information on command line: @ARGV"); |
|
73 } |
|
74 return($config, \@XMLfile, $outfile, $logfile); |
|
75 } |
|
76 |
|
77 # Usage |
|
78 # |
|
79 # Input: Error message, if any |
|
80 # |
|
81 # Output: Usage information. |
|
82 # |
|
83 |
|
84 sub Usage |
|
85 { |
|
86 if (@_) |
|
87 { |
|
88 print "\n****@_\n"; |
|
89 } |
|
90 |
|
91 print <<USAGE_EOF; |
|
92 |
|
93 Usage: SysDefToText.pl parameters [options] |
|
94 |
|
95 Parameters: |
|
96 |
|
97 -x XML System Model File [Multiple -x options allowed] |
|
98 -n Named Configuration |
|
99 -o Output Text (.TXT) file |
|
100 |
|
101 Options: |
|
102 |
|
103 -h Display this Help and exit. |
|
104 -l Logfile (.LOG) |
|
105 |
|
106 USAGE_EOF |
|
107 |
|
108 exit 1; |
|
109 } |
|
110 |
|
111 sub dbgprint |
|
112 { |
|
113 if($debug) { print ">>@_"; } |
|
114 } |
|
115 |
|
116 __END__ |
|