sysmodellibs/sysmodelgen/src/old/svg/DrawSvg.pm
author Bob Rosenberg <bob.rosenberg@nokia.com>
Wed, 13 Oct 2010 14:00:36 +0100
changeset 6 5b32dc297d05
parent 1 sysmodellibs/sysmodelgen/src/svg/DrawSvg.pm@b538b70cbe51
permissions -rw-r--r--
Prepare old system model generator for 2.0 update
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     1
# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     2
# All rights reserved.
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     3
# This component and the accompanying materials are made available
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     4
# under the terms of "Eclipse Public License v1.0"
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     5
# which accompanies this distribution, and is available
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     7
#
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     8
# Initial Contributors:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    10
#
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    11
# Contributors:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    12
#
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    13
# Description:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    14
# Package:      DrawSvg
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    15
# Build the SVG diagram
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    16
# 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    17
#
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    18
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    19
package DrawSvg;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    20
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    21
use Cwd;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    22
use Cwd 'abs_path';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    23
use File::Copy;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    24
use File::Path;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    25
use FindBin;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    26
use lib $FindBin::Bin."/../common";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    27
use Getopt::Long qw(:config no_ignore_case);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    28
use File::Basename;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    29
use File::Spec;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    30
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    31
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    32
use constant KNoCoreOs					=> 0;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    33
use constant KCoreOsWithHal			=> 1;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    34
use constant KCoreOsWithHardware	=> 2;
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    35
use constant KOldSystemModelGenerator							=> 202;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    36
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    37
my @Filters;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    38
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    39
#-------------------------------------------------------------------------------------------------
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    40
# Subroutine:   new
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    41
# Purpose:      
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    42
# Input:        None (extracted from command line args)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    43
# Output:       A reference to itself
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    44
#-------------------------------------------------------------------------------------------------
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    45
sub new
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    46
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    47
    my $package = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    48
    my $self = {};              # Create reference to object
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    49
    bless $self,  $package;    # Associate a reference with class name
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    50
    
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    51
    $self->{iScriptCode} = 999;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    52
    
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    53
    # basic test of command line:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    54
    if (scalar(@ARGV) == 0)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    55
    	{
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    56
		$self->Help();
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    57
        exit Logger::KErrorNone;	# nothing to do. Leave
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    58
    	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    59
    
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    60
    # process the input:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    61
    $self->ParseCommandLineOptions();
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    62
    
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    63
    $self->{iReturnCode} = Logger::KErrorNone;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    64
    return $self;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    65
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    66
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    67
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    68
# gets the schema versions without comsuming any of the command line arguments
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    69
sub SchemaVersionsFromArgs
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    70
	{ 
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    71
	my @sysdefs;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    72
	my @ini;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    73
	my $model;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    74
	for(my $i=0;$i<=$#_;$i++)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    75
		{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    76
		if($_[$i] eq '-model')
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    77
			{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    78
			$model=$_[++$i];
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    79
			}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    80
		if($_[$i] eq '-sysdef')
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    81
			{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    82
			$i++;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    83
			push(@sysdefs,split(/,/,$_[$i]));
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    84
			}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    85
		elsif($_[$i] eq '-i')
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    86
			{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    87
			push(@ini,$_[++$i]);
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    88
			}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    89
		}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    90
	if(!scalar(@sysdefs) )
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    91
		{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    92
		foreach my $in (@ini)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    93
			{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    94
			open(INI,$in);
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    95
			my $iniDir = $in;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    96
			$iniDir =~ s,[^\\//]+$,,;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    97
			while(my $line = <INI>)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    98
				{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
    99
				$line =~ s/^\s*//; 		# remove spaces
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   100
				$line =~ s/\s*$//;		# a/a
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   101
				$line =~ s/\n$//; 		# remove new line
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   102
				if($line =~/"/) {
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   103
					$line =~ s/^(([^"#]*"[^"]*")+)#.*$/$1/; 		# remove comments indicated by # (to the end of the line)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   104
				}  else {
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   105
					$line =~ s/#.*$//; 		# remove comments indicated by # (to the end of the line)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   106
				}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   107
				next if $line eq ""; 	# ignore blank lines
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   108
				if ($line =~ m/sysdef\s*=\s*(.*)/i)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   109
					{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   110
					foreach my $file (split(/,/,$1))
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   111
						{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   112
						push(@sysdefs,&FullPath($iniDir,$file));
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   113
						}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   114
					}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   115
				}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   116
			close INI;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   117
			}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   118
		}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   119
	my $dir = $model;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   120
	$dir=~s,[^/\\]+$,,;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   121
	open M,$model;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   122
	$/=">";
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   123
	while(my $line=<M>)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   124
		{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   125
		if($line=~s/<sysdef.*href=("[^"]+"|'[^']+')//)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   126
			{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   127
			my $f=$1;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   128
			$f=~s/^.(.*).$/$1/;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   129
			if(! ($f=~/^(\/|[a-z]+:)/)) {$f="$dir$f"}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   130
			push(@sysdefs,$f);
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   131
			}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   132
		}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   133
	close M;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   134
	my %res;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   135
	foreach my $file (@sysdefs)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   136
		{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   137
		open S,$file;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   138
		while(my $line = <S>)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   139
			{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   140
			if($line =~ /<SystemDefinition.*\sschema="(.*?)"/s)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   141
				{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   142
				push(@{$res{$1}},$file);
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   143
				last;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   144
				}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   145
			}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   146
		close S;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   147
		}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   148
	$/="\n";
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   149
	return %res;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   150
	}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   151
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   152
sub GuessReleaseNumber()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   153
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   154
	my $self = shift;	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   155
	# always use release value if defined
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   156
	$self->{iRelease} && return $self->{iRelease} ;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   157
	# if not there, it's in the s12,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   158
	my $ver;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   159
	my $t = $/;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   160
	foreach my $s12 (@{$self->{'iS12'}})		# use version from first s12 file listed
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   161
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   162
		if(-d $s12) {next}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   163
		open(FILE,$s12) || return;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   164
		$/='>';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   165
		while(<FILE>)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   166
			{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   167
			if(/<Schedule12\s.*\bOS_version=('(.*?)'|"(.*?)")/s)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   168
				{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   169
				$ver = $2 || $3;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   170
				last;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   171
				}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   172
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   173
		close FILE;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   174
		$/=$t;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   175
		return  $ver;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   176
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   177
	# not there either, 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   178
	if($self->{'iDepsFile'}) 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   179
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   180
		open(FILE,$self->{'iDepsFile'}) || return;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   181
		$/='>';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   182
		while(<FILE>)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   183
			{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   184
			if(/<SystemModelDeps\s.*\bversion=('(.*?)'|"(.*?)")/s)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   185
				{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   186
				$ver = $2 || $3;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   187
				last;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   188
				}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   189
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   190
		close FILE;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   191
		$/=$t;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   192
		return  $ver;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   193
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   194
	return "";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   195
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   196
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   197
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   198
# an empty value indicates its a single file. Any other value means it's a list separated by that value as a regexp
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   199
%KFileParams = 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   200
	( 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   201
	'iSysDefFile'	=> ',',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   202
	'iS12'		=> ',',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   203
	'iExtra'		=> ',',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   204
	'iDepsFile'	=> '',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   205
	'iLocalize'		=> ',',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   206
	'iLevels'		=> ',',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   207
	'iStyle'		=> ',',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   208
	'iOverlay'		=> ',',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   209
	'iBorder'		=> ',',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   210
	'iColor'		=> ',',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   211
	'iShapes'		=> '',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   212
	'iLogoSrc'		=> '',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   213
	'iModel'		=> '',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   214
	'iLogFile'		=> '',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   215
	);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   216
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   217
sub ParseCommandLineOptions()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   218
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   219
	my $self = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   220
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   221
	# Possible arguments (with default values where possible):
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   222
	my $help;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   223
	$self->{iSysDefFile};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   224
	$self->{iDepsFile};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   225
	$self->{iOutputCsv};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   226
	$self->{iCsvColumns};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   227
	$self->{iCsvLabels};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   228
	$self->{iTemporaryDirectory};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   229
	$self->{iLogFile};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   230
	$self->{iWarningLevel};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   231
	$self->{iClean}; # if specified, it will delete the temp directory.
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   232
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   233
	# custom properties:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   234
	$self->{iDiagram}; # the output svg
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   235
	$self->{iCopyright};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   236
	$self->{iRelease};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   237
	$self->{iName};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   238
	$self->{iLabel};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   239
	$self->{iModel};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   240
	$self->{iCoreOs};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   241
	$self->{iLevels};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   242
	$self->{iExtra};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   243
	$self->{iIniFile};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   244
	$self->{iS12};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   245
	$self->{iLink};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   246
	# Read in the user arguments:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   247
	GetOptions( "h"						=> \$help,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   248
				"i=s"					=> \$self->{iIniFile},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   249
				"output=s"				=> \$self->{iDiagram} ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   250
				"csv_output=s"				=> \$self->{iOutputCsv} ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   251
				"csv_columns=s"				=> \$self->{iCsvColumns} ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   252
				"csv_labels=s"				=> \$self->{iCsvLabels} ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   253
				'xml_output=s'				=> \$self->{iOutputXml} ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   254
				"model=s"				=> \$self->{iModel} ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   255
				"sysdef=s"				=> \@{$self->{iSysDefFile}} ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   256
				"srcvar=s"				=> \@{$self->{iSourceRoot}} ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   257
				"shapes=s"				=> \$self->{iShapes},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   258
				"link=s"				=> \$self->{iLink},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   259
				"system_name=s"			=> \$self->{iName} ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   260
				"system_version=s"		=> \$self->{iRelease} ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   261
				"model_name=s"			=> \$self->{iLabel} ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   262
				"model_version=s"		=> \$self->{iRevision},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   263
				"model_version_type=s"	=> \$self->{iRevisionType},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   264
				"copyright=s"			=> \$self->{iCopyright},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   265
				"distribution=s"		=> \$self->{iDistribution},
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   266
				"legend_title=s"		=> \$self->{iLgdTitle},
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   267
				"coreos=s"				=> \$self->{iCoreOs},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   268
				
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   269
				"sysinfo=s"				=> \@{$self->{iExtra}},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   270
				"localize=s"			=> \@{$self->{iLocalize}},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   271
				"levels=s"				=> \@{$self->{iLevels}},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   272
				
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   273
				"color=s"				=> \@{$self->{iColor}},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   274
				"border-shape=s"		=> \@{$self->{iBorder}},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   275
				"pattern=s"				=> \@{$self->{iOverlay}},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   276
				"border-style=s"		=> \@{$self->{iStyle}},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   277
				
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   278
				"filter=s"				=> \@{$self->{iFilter}},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   279
				"filter-has=s"				=> \&OrderedOption,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   280
				"show-attr=s"			=> \&OrderedOption,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   281
				"hide-attr=s"			=> \&OrderedOption,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   282
				"ignore=s"				=> \@{$self->{iIgnore}},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   283
				
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   284
				"s12=s"				=>  \@{$self->{iS12}},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   285
				
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   286
				"detail=s"				=> \$self->{iDetail},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   287
				"detail-type=s"				=> \$self->{iDetailType},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   288
				"page-width=s"			=> \$self->{iPageWidth},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   289
				"static"				=> \$self->{iStatic},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   290
				"deps=s"				=> \$self->{iDepsFile},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   291
				"w=s"					=> \$self->{iWarningLevel},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   292
				"clean"				=> \$self->{iClean},				
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   293
				"compress"				=> \$self->{iCompress},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   294
				"tempdir=s"				=> \$self->{iTemporaryDirectory},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   295
				"dpi=s"				=> \$self->{iPrintResolution},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   296
				"model_font=s"				=> \$self->{iModelFont},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   297
				"version-list=s"			=>  \$self->{iVersions},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   298
				"log=s"				=> \$self->{iLogFile},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   299
				"logo=s"				=> \$self->{iLogoSrc},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   300
				"logo-height=s"				=> \$self->{iLogoHeight},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   301
				"logo-width=s"				=> \$self->{iLogoWidth},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   302
				"legend-width=s"			=> \$self->{iLegendWidth},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   303
				"legend-max-scale=s"			=> \$self->{iLegendMaxScale},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   304
				"title-scale=s"			=> \$self->{iTitleScale},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   305
				"xslt-param=s"			=> \%{$self->{iXsltParam}},
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   306
				"note=s"			=> \@{$self->{iLegendNote}}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   307
				);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   308
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   309
	if ($help)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   310
	    {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   311
	   	warn $self->Help();
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   312
	   	exit Logger::KErrorNone;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   313
	   	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   314
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   315
	@{$self->{'iFiltering'}} = @Filters;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   316
	@Filters=();
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   317
	my $i=0;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   318
	for($i=0;$i<=$#ARGV;$i++)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   319
		{ # check remaining args to ensure they are valid
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   320
			if($ARGV[$i]=~/^(http|file):\/\//) { # assume URLs are correct
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   321
				next;			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   322
				}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   323
			if($ARGV[$i] eq "-" || $ARGV[$i] eq "") 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   324
				{ #special values to use nothing or use the tmp file, but only valid for odd numbered args
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   325
				if($i%2==1) {next}
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   326
				$self->Help();
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   327
				&Logger::LogFatal("Invalid syntax", KOldSystemModelGenerator, 0,Logger::KIncorrectSyntax);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   328
				}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   329
			if(!(-e $ARGV[$i])) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   330
				warn "file $ARGV[$i] does not exist";
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   331
	   			exit Logger::KFileDoesNotExist;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   332
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   333
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   334
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   335
	# Now read the ini file and override command line if necessary:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   336
	my @yr = gmtime();
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   337
	my $dataroot =&SystemModelXmlDataDir();
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   338
	my %defaults = (
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   339
		'iCopyright' 			=> (1900+$yr[5])." Nokia Corporation",
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   340
		'iDiagram' 			=> "sysmodel.svg",
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   341
		'iTemporaryDirectory' 	=> "drawsvg_temp",
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   342
		'iName' 				=> "Symbian OS"	,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   343
		'iLabel' 				=> "System Model",
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   344
		'iLgdTitle' 				=> "Key",
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   345
		'iShapes' 				=> "$dataroot/Shapes.xml" 	,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   346
		'iLogFile' 				=> ""  # do not set this to any default: stdout is used if log file isn't set
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   347
	);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   348
	my %defaultsForMulti = (
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   349
		'iLocalize' 			=> "$dataroot/display-names.xml" ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   350
		'iExtra' 				=> "$dataroot/SystemInfo.xml"   
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   351
	);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   352
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   353
	$self->ReadIniFile();
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   354
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   355
	foreach my $type ('iSysDefFile', 'iFilter','iSourceRoot')
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   356
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   357
		if(scalar(@{$self->{$type}})==1 && $self->{$type}->[0]=~/,/)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   358
			{ # treat as comma-separated for backwards compatibility (leave alone if no commas)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   359
			@{$self->{$type}} = split(/,/,$self->{$type}->[0]);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   360
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   361
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   362
	if (scalar(@{$self->{iIgnore}})) 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   363
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   364
		foreach my $type ('iIgnore')
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   365
			{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   366
			if(scalar(@{$self->{$type}})==1)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   367
				{ # treat as semicolon-separated for backwards compatibility
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   368
				@{$self->{$type}} = split(/;/,$self->{$type}->[0]);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   369
				}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   370
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   371
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   372
	else
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   373
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   374
		push(@{$self->{iIgnore}}, "layer:Tools and Utils and SDKENG","layer:MISC","block:Techview") 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   375
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   376
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   377
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   378
	my $ver = $self->GuessReleaseNumber(); # determine release from attached files.
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   379
		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   380
	# Use a special levels.xml file for 9.1 (unless it's specified by the user):
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   381
	push(@{$self->{iLevels}}, "$dataroot/Levels91.xml") if !scalar(@{$self->{iLevels}}) and $ver eq "9.1";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   382
	push(@{$self->{iLevels}}, "$dataroot/Levels.xml") if !scalar(@{$self->{iLevels}}) and ($ver eq "9.2" or $ver eq "9.2" );
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   383
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   384
	if(!scalar(@{$self->{'iFiltering'}}) && !scalar(@{$self->{'iFilter'}}))
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   385
		{ # filter only has a default if fitler-has is not set
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   386
		@{$self->{'iFilter'}}= ("java","gt");
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   387
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   388
	while (($key, $value) = each %defaults) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   389
		$self->{$key} = $value if ! defined $self->{$key};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   390
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   391
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   392
	while (($key, $value) = each %defaultsForMulti) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   393
		push(@{$self->{$key}}, $value) if ! scalar(@{$self->{$key}});
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   394
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   395
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   396
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   397
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   398
	# if saving to .svgz, try to compress
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   399
	$self->{iCompress} = $self->{iCompress} || ( $self->{iDiagram} =~ /\.svgz$/i );
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   400
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   401
	# if there's a deps file XSLT will get revision number and type from that.
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   402
	# if there is no deps file and neither revision nor revision type are specified, default to "DRAFT 1"
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   403
	if(!$self->{'iDepsFile'} &&  !$self->{'iRevision'} && !$self->{'iRevisionType'})
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   404
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   405
		$self->{'iRevisionType'} = "draft";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   406
		$self->{'iRevision'} = "1";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   407
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   408
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   409
	if ($self->{iShapes} eq "$dataroot/Shapes.xml"  && !scalar(@{$self->{'iColor'}}))
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   410
		{ # if it's got the default shapes use default colours
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   411
		@{$self->{iColor}} = (&SystemModelColorsXmlFile());
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   412
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   413
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   414
	if(defined $self->{iCoreOs})
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   415
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   416
		if($self->{iCoreOs}=~/(on|yes|true)$/i )
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   417
			{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   418
			$self->{iCoreOs} = KCoreOsWithHal;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   419
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   420
		elsif($self->{iCoreOs}=~/(off|no|false)$/i )
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   421
			{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   422
			$self->{iCoreOs} = KNoCoreOs;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   423
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   424
		elsif(! ($self->{iCoreOs}=~/^[0-9]+$/ ))	# any other non-number
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   425
			{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   426
			$self->{iCoreOs} = KCoreOsWithHardware;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   427
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   428
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   429
	else		# use version numebr to decide
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   430
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   431
		$self->{iCoreOs} = ($self->{iRelease} eq 'Future' || $ver > 9.4) ? KCoreOsWithHardware :
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   432
			(($ver=~/^9\.4/) ? KCoreOsWithHal : KNoCoreOs);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   433
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   434
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   435
	$self->{'iGuessVer'} = $ver;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   436
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   437
	mkpath $self->{iTemporaryDirectory} if ! -d $self->{iTemporaryDirectory};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   438
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   439
	# set the log file if needed:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   440
	$Logger::LOGFILE = $self->{iLogFile} if $self->{iLogFile};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   441
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   442
	# set the correct warning level:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   443
	#  -w=1: errors only (default)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   444
	#  -w=2: warnings as well as errors
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   445
	#  -w=3: info messages, warnings and errors.
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   446
	if (defined $self->{iWarningLevel} and $self->{iWarningLevel} > 1)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   447
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   448
		if ($self->{iWarningLevel} == 2)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   449
			{
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   450
			$self->{iWarningLevel} = LogItem::WARNING;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   451
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   452
		elsif ($self->{iWarningLevel} == 3)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   453
			{
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   454
			$self->{iWarningLevel} = LogItem::INFO;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   455
			}
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   456
		else # for anything higher than set it to LogItem::VERBOSE
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   457
			{
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   458
			$self->{iWarningLevel} = LogItem::VERBOSE;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   459
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   460
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   461
	else
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   462
		{
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   463
		$self->{iWarningLevel} = LogItem::ERROR;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   464
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   465
	# set the logger up:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   466
	$Logger::SEVERITY = $self->{iWarningLevel};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   467
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   468
	# set all URIs
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   469
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   470
	(my $dir  = cwd ) =~ s#\/#\\#g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   471
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   472
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   473
	foreach ( keys(%KFileParams)) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   474
		if($self->{$_} eq '') {next} # no value, so do nothing
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   475
		if($KFileParams{$_} eq '') {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   476
			$self->{$_}  = &FullPath("$dir\\",	$self->{$_} );
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   477
		} elsif($KFileParams{$_} eq ',') {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   478
			foreach my $item  (@{$self->{$_}})	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   479
				if ($item eq '') {next}	# skip if explicitly set to empty
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   480
				$item = &FileAsUrl(&FullPath("$dir\\",$item));
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   481
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   482
			next;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   483
		} 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   484
		$self->{$_} = &FileAsUrl($self->{$_});
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   485
	}	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   486
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   487
}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   488
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   489
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   490
sub OrderedOption() {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   491
	my $var = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   492
	my $val = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   493
	if($var=~/^(show|hide)-attr$/) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   494
		my $f = "<filter display='$1' ";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   495
		if($val=~s/^([^=]+)=//) {$f.="select='$1' value='$val'/>"}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   496
		else {$f.="select='$val'/>"}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   497
		push(@Filters,$f);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   498
	} elsif($var eq 'filter-has' && $val eq '*') {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   499
		push(@Filters,"<filter display='show' select='*'/>");
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   500
	}elsif($var eq 'filter-has') {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   501
		if(!scalar(@Filters)) { # if the 1st is showing a filter than that implies everythig without a filter is turned off 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   502
			push(@Filters,'<filter select="*" display="hide"/>');
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   503
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   504
		foreach my $v (split(/,/,$val)) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   505
			push(@Filters,"<filter display='show' select='filter' value='$v'/>");
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   506
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   507
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   508
}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   509
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   510
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   511
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   512
sub FullPath {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   513
	my $root = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   514
	my $file = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   515
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   516
	# If the file is not specified then return null
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   517
	if (!$file) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   518
		return;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   519
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   520
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   521
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   522
	# If the file is a URL or Windows path then return it as is
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   523
	if ($file =~ /:/) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   524
		return $file;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   525
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   526
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   527
	if ($root && !-e $root) {
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   528
		&Logger::LogFatal("root $root does not exist");
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   529
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   530
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   531
	if (-f $root) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   532
		$root = File::Basename::dirname($root)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   533
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   534
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   535
	# if root is empty or the same dir, then file is relative
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   536
	if($root eq '' or $root eq '.') {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   537
		return $file;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   538
	}	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   539
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   540
	# If the file is relative from the root then we want to add the drive letter to the file (if one exists)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   541
	if ($file =~ s/^[\\\/]// ) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   542
		if ($root =~ /^([a-z]:)/i) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   543
			return File::Spec->catdir($1, $file);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   544
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   545
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   546
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   547
	# Return the concatenated root and filename
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   548
	return File::Spec->catdir($root, $file);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   549
}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   550
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   551
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   552
sub ReadIniFile()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   553
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   554
	my $self = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   555
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   556
	return if ! defined $self->{iIniFile};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   557
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   558
	# Log a fatal error if the ini file is defined but doesn't exist:
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   559
	&Logger::LogFatal("ini file does not exist\"$self->{iIniFile}\": $!", KOldSystemModelGenerator) if ! -e $self->{iIniFile};
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   560
	
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   561
	open(INI, $self->{iIniFile}) or 	
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   562
		&Logger::LogFatal("Could not open the ini file \"$self->{iIniFile}\": $!", KOldSystemModelGenerator);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   563
	
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   564
	&Logger::LogInfo("Reading ini file \"$self->{iIniFile}...", KOldSystemModelGenerator);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   565
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   566
	%AllowMulitples = (
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   567
		"iLocalize"		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   568
		"iExtra"		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   569
		'iLevels'		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   570
		'iSysDefFile'		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   571
		'iSourceRoot'		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   572
		'iS12'		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   573
		"iIgnore"		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   574
		"iFilter"		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   575
		"iStyle"		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   576
		"iOverlay"		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   577
		"iBorder"		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   578
		"iColor"		=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   579
		"iLegendNote" => 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   580
		"iXsltParam" => 2
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   581
	); # value of 2 means it's a hash, value of 1 is an array
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   582
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   583
	foreach my $m (keys %AllowMulitples) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   584
		# if it's already set, note that we're to ignore anything in the ini file
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   585
		if($AllowMulitples{$m}==2 ? (scalar(%{$self->{$m}})>0) : (scalar(@{$self->{$m}})>0)) {$AllowMulitples{$m}=0}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   586
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   587
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   588
	%Ordered = (
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   589
		"filter-has"				=> 1,	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   590
		"show-attr"			=> 1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   591
		"hide-attr"			=> 1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   592
	);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   593
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   594
	%IniMap = (
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   595
		"model"					=> 'iModel' ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   596
		"sysdef"				=> 'iSysDefFile' ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   597
		'srcvar'					=> 'iSourceRoot',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   598
		"shapes"				=> 'iShapes',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   599
		"system_name"			=> 'iName' ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   600
		"model_name"			=> 'iLabel' ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   601
		"system_version"		=> 'iRelease' ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   602
		"copyright"				=> 'iCopyright',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   603
		"model_version"			=> 'iRevision',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   604
		"model_version_type"	=> 'iRevisionType',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   605
		"distribution"			=> 'iDistribution',
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   606
		"legend_title"			=> 'iLgdTitle',
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   607
		"coreos"				=> 'iCoreOs',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   608
		"sysinfo"				=> 'iExtra',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   609
		"localize"				=> 'iLocalize',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   610
		"levels"				=> 'iLevels',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   611
		"filter"				=> 'iFilter',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   612
		"ignore"				=> 'iIgnore',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   613
		"output"				=> 'iDiagram',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   614
		"csv_output"				=> 'iOutputCsv',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   615
		"csv_columns"				=> 'iCsvColumns' ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   616
		"csv_labels"				=> 'iCsvLabels' ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   617
		'xml_output'				=> 'iOutputXml' ,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   618
		"detail"				=> 'iDetail',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   619
		"detail-type"				=> 'iDetailType',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   620
		"page-width"			=> 'iPageWidth',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   621
		"static"				=> 'iStatic',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   622
		"color"					=> 'iColor',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   623
		"border-shape"			=> 'iBorder',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   624
		"pattern"				=> 'iOverlay',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   625
		"deps"					=> 'iDepsFile',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   626
		"border-style"			=> 'iStyle',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   627
		"w"						=> 'iWarningLevel',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   628
		"tempdir"				=> 'iTemporaryDirectory',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   629
		'dpi'					=>'iPrintResolution',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   630
		'model_font'					=>'iModelFont',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   631
		"s12"				=> 'iS12',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   632
		"log"					=> 'iLogFile',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   633
		"logo"				=> 'iLogoSrc',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   634
		"logo-height"			=> 'iLogoHeight',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   635
		"logo-width"			=> 'iLogoWidth',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   636
		'version-list'			 => 'iVersions',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   637
		"link"					=> 'iLink',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   638
		"clean"				=> 'iClean',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   639
		"compress"			=> 'iCompress',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   640
		"legend-width"			=>'iLegendWidth',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   641
		"legend-max-scale"		=> 'iLegendMaxScale',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   642
		"title-scale"			=> 'iTitleScale',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   643
		"xslt-param"			=> 'iXsltParam',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   644
		"note"			=> 'iLegendNote'
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   645
	);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   646
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   647
	foreach my $line (<INI>)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   648
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   649
		$line =~ s/^\s*//; 		# remove spaces
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   650
		$line =~ s/\s*$//;		# a/a
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   651
		$line =~ s/\n$//; 		# remove new line
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   652
		if($line =~/"/) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   653
			$line =~ s/^(([^"#]*"[^"]*")+)#.*$/$1/; 		# remove comments indicated by # (to the end of the line)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   654
		}  else {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   655
			$line =~ s/#.*$//; 		# remove comments indicated by # (to the end of the line)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   656
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   657
		next if $line eq ""; 	# ignore blank lines
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   658
		if ($line =~ m/([^=]+)\s*=\s*(.*)/)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   659
			{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   660
			my $argType = lc $1; 	# case-insensitive
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   661
			my $argValue = $2; 		# case-sensitive as it can have strings intended for html output
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   662
			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   663
			$argType =~ s/^\s*//; # remove spaces on either end (Cannot use s/\s+// as this will not be suitable for html text)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   664
			$argType =~ s/\s*$//;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   665
			$argValue =~ s/^\s*//;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   666
			$argValue =~ s/\s*$//;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   667
			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   668
			$argValue =~ s/^'//; # no need for quotes around the values
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   669
			$argValue =~ s/'$//;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   670
			$argValue =~ s/^"//;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   671
			$argValue =~ s/"$//;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   672
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   673
			my $iniDir = $self->{iIniFile};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   674
			$iniDir =~ s,[^\\//]+$,,;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   675
			#$iniDir .= '\\';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   676
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   677
			if(defined $Ordered{$argType}) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   678
				&OrderedOption($argType, $argValue);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   679
			} elsif(defined $IniMap{$argType}) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   680
				my $param = $IniMap{$argType};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   681
				# make sure all files mentioned are taken relative to the ini file
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   682
				if($KFileParams{$param} ne '' )
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   683
					{# comma-separated filenames
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   684
					my @list;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   685
					foreach my $item  (split(/,/,$argValue))
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   686
						{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   687
						push(@list,&FullPath($iniDir,$item));
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   688
						}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   689
					$argValue = join(',',@list);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   690
					}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   691
				elsif(defined $KFileParams{$param} && $argValue ne '')
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   692
					{# single file names			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   693
					$argValue = &FullPath($iniDir,$argValue);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   694
					}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   695
				# do not override! Only set values that have not been set on command line already
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   696
				if ($AllowMulitples{$param}==1)  # check so we don't add if it's set by the cmd line
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   697
					{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   698
				 	push(@{$self->{$param}}, $argValue); 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   699
					} 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   700
				elsif ($AllowMulitples{$param}==2)  # check so we don't add if it's set by the cmd line
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   701
					{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   702
					$argValue=~s/^([^=]+)=//;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   703
				 	$self->{$param}->{$1}=$argValue; 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   704
					} 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   705
				elsif (! defined $AllowMulitples{$param})
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   706
					{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   707
				 	$self->{$param} = $argValue if ! $self->{$param}; 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   708
					}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   709
				}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   710
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   711
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   712
; 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   713
	@{$self->{'iFiltering'}} = @Filters if ! @{$self->{'iFiltering'}}; 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   714
	@Filters=();
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   715
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   716
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   717
sub MakeInfo() {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   718
	my $self = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   719
	my %files = @_;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   720
	my $res="";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   721
	while (my ($key,$value) = each %files) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   722
		 if ($self->{$key} ne '') {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   723
		 	$res .= "\t\t<info href='".$self->{$key}."' type='$value'/>\n"
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   724
		 }
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   725
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   726
	return $res;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   727
}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   728
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   729
sub MakeMultiInfo() {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   730
	my $self = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   731
	my %files = @_;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   732
	my $res="";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   733
	while (my ($key,$value) = each %files) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   734
		 foreach my $m (@{$self->{$key}}) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   735
		 	if($m ne '') { # skip if empty
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   736
		 		$res .= "\t\t<info href='$m' type='$value'/>\n"
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   737
		 	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   738
		 }
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   739
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   740
	return $res;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   741
}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   742
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   743
sub MakeAttirbutes() {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   744
	my $self = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   745
	my %atts = @_;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   746
	my $res="";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   747
	while (my ($key,$value) = each %atts) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   748
		 if (defined $self->{$key}) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   749
		 	my $cur = $self->{$key};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   750
		 	if($key=~/File$/) {$cur=&FileAsUrl($cur)}	# anything that ends in File is treated as a URL
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   751
		 	$res .= " $value=\"$cur\"";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   752
		 }
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   753
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   754
	return $res;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   755
}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   756
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   757
sub getSchedule12Xml ()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   758
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   759
	my $self = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   760
	my $ver = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   761
	my @files = @{$self->{'iS12'}};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   762
	my @ret;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   763
	foreach my $s12 (@files)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   764
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   765
		if($s12 eq '') {next}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   766
		if($s12=~/^file:\/\/\/(.*)$/)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   767
			{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   768
			if(-d $1) 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   769
				{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   770
				# it's a directory, so append Symbian_OS_v[version]_Schedule12.xml
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   771
				$s12=~s,[\\/]*$,/Symbian_OS_v${ver}_Schedule12.xml,;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   772
				}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   773
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   774
		push(@ret,$s12);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   775
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   776
	return @ret
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   777
	}	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   778
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   779
sub getModel()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   780
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   781
	my $self = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   782
	if($self->{iModel})  {return $self->{iModel}}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   783
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   784
	my $xsltDir = $self->GetXsltDir();
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   785
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   786
	my $tempDirectoryPathname = abs_path($self->{iTemporaryDirectory});
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   787
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   788
	(my $modelXml = "$tempDirectoryPathname/Model.xml") =~ s#\/#\\#g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   789
	(my $modelTemplateXml = $xsltDir."/") =~ s#\/#\\#g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   790
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   791
	if($self->{iCoreOs} == KCoreOsWithHardware)	{ #  show 9.5+ CoreOS 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   792
		$modelTemplateXml .= "ModelTemplate.xml";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   793
	} elsif($self->{iCoreOs} == KCoreOsWithHal )  	{ 		# show 9.4 CoreOS
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   794
		$modelTemplateXml .= "ModelTemplate.mid.xml";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   795
	} else {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   796
		$modelTemplateXml .= "ModelTemplate.older.xml";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   797
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   798
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   799
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   800
	# the follownig params cannot be emtpy, delete if they are
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   801
	foreach my $item ('iCopyright' ,	'iDistribution' ,'iDepsFile',	'iLink', 'iDetailType',  'iDetail', 'iVersions')
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   802
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   803
		if($self->{$item} eq '') {delete $self->{$item}}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   804
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   805
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   806
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   807
	# Step 1:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   808
	# Create a Model.xml based on the ModelTemplate.xml
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   809
	open (INPUT, $modelTemplateXml) or &Logger::LogError("Xalan error ($?) occured in Step 1 of SVG building (<$modelTemplateXml)...", KOldSystemModelGenerator, 1);
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   810
	open (OUTPUT, ">$modelXml") or &Logger::LogError("Xalan error ($?) occured in Step 1 of SVG building (>$modelXml)...", KOldSystemModelGenerator, 1);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   811
	my $release = $self->{iRelease};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   812
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   813
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   814
	# Since $self->{iSysDefFile} may be a comma-separated list of sysdefs, create a <sysdef> tag for each one of the files:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   815
	my $sysdefTagsForModelTemplate = "";	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   816
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   817
	@{$self->{'iS12'}} = $self->getSchedule12Xml($self->{'iGuessVer'});
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   818
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   819
	if(scalar(@{$self->{iSourceRoot}}) == 1)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   820
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   821
		@{$self->{iSourceRoot}} = ($self->{iSourceRoot}->[0]) x scalar($self->{iSourceRoot}->[0]);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   822
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   823
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   824
	for (my $index = 0; $index < scalar(@{$self->{iSysDefFile}}); ++$index)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   825
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   826
		$sysdefTagsForModelTemplate .= $self->CreateSysDefTagsForModelXML($self->{iSysDefFile}->[$index], $self->{iSourceRoot}->[$index]);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   827
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   828
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   829
	my $display;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   830
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   831
	if($self->{iLink}=~/\\/)    # it's a windows dir, change to file URI
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   832
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   833
		$self->{iLink} = &FileAsUrl($self->{iLink});
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   834
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   835
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   836
	$display .= $self->MakeMultiInfo ('iLocalize' 	=> 'abbrev');
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   837
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   838
	my %infoMap = (
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   839
		'iStyle'  		=> 'style',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   840
		'iOverlay'		=> 'overlay',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   841
		 'iBorder'		=> 'border',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   842
		 'iColor'		=> 'color'		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   843
	);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   844
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   845
	$display .=$self->MakeMultiInfo( %infoMap);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   846
	if($self->{'iLogoSrc'})
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   847
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   848
		$display.="\n<logo". $self->MakeAttirbutes(
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   849
			'iLogoSrc' 	=> 'src',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   850
			'iLogoWidth'  		=> 'width',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   851
			'iLogoHeight'  		=> 'height'
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   852
			) ;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   853
		if($self->{'iLogoSrc'} =~ /\.svg$/i)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   854
			{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   855
			$display.= " embed=\"yes\"";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   856
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   857
		$display.= "/>";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   858
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   859
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   860
	my $filters='';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   861
	if(scalar @{$self->{'iFiltering'}})	# complex filtering 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   862
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   863
		$filters = join("\n\t",@{$self->{'iFiltering'}});
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   864
		}		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   865
	elsif (@{$self->{iFilter}}) { # can't have both -filter and complex filtering
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   866
		foreach ( @{$self->{iFilter}}) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   867
			if($_ ne '') {$filters.="<filter accept='$_'/>\n\t";}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   868
		} 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   869
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   870
		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   871
	my $ignore='';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   872
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   873
	foreach ( @{$self->{iIgnore}}){
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   874
		if(/^(.*):(.*)$/) {$ignore.="<ignore type='$1' name='$2'/>\n\t"}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   875
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   876
		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   877
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   878
	my $optional = $self->MakeAttirbutes(
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   879
		'iCopyright' 	=> 'copyright',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   880
		'iDistribution'  		=> 'distribution',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   881
		'iRevision'  		=> 'revision',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   882
		'iDepsFile'  		=> 'deps',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   883
		'iLink'  		=> 'link',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   884
		'iRevisionType'  => 'revision-type',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   885
		'iVersions' 	=>	'version-list'
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   886
		);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   887
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   888
	if($self->{iRelease} ne '') {$optional .= " ver='$self->{iRelease}'"}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   889
	elsif($self->{iGuessVer} eq 'Future' ) {$optional .= " ver='$self->{iGuessVer}'"}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   890
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   891
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   892
	my $layout = $self->MakeAttirbutes(
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   893
		'iDetail'  		=> 'detail',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   894
		'iDetailType'  		=> 'detail-type',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   895
		'iPageWidth' 	=> 'page-width',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   896
		'iPrintResolution' 	=> 'resolution',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   897
		'iModelFont' 	=> 'font'
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   898
		);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   899
	if($self->{iStatic}) {$layout .= " static='true'"}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   900
	my $legend = '';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   901
	my @legendmap = (
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   902
		'iColor',	'colors',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   903
		'iStyle',	'styles',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   904
		'iOverlay',	'patterns',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   905
		'iBorder',	'borders'
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   906
		); # order is important
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   907
	for(my $i=0; $i<$#legendmap;$i+=2){
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   908
		my $cur='#'.$infoMap{$legendmap[$i]};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   909
		my $count = scalar(@{$self->{$legendmap[$i]}});
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   910
		 if ($count==0 || ($count==1 && $self->{$legendmap[$i]}->[0] eq '' )) {$cur='@shapes'."#$legendmap[$i+1]"}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   911
		$legend .= "\t\t\t<legend use=\"$cur\"/>\n";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   912
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   913
	foreach my $note (@{$self->{iLegendNote}})
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   914
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   915
		if(!($note=~/&#?[0-9a-z]+;/i))
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   916
			{	# if not entity-encoded, entity encode the stuff
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   917
			$note=~ s/([&<>\x7f-\xff])/"&#".ord($1).";"/eg;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   918
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   919
		$legend .= "\t\t\t<note width='auto'>$note</note>";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   920
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   921
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   922
	my $legendOptions;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   923
	if($self->{iLegendWidth}) {$legendOptions .= ' width="' .$self->{iLegendWidth} .'"'}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   924
	if($self->{iLegendMaxScale}) {$legendOptions .= ' maxscale="' .$self->{iLegendMaxScale} .'"'}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   925
	if($self->{iTitleScale}) {$legendOptions .= ' title-scale="' .$self->{iTitleScale} .'"'}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   926
	foreach my $line (<INPUT>)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   927
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   928
		my $cur='';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   929
		$line =~ s/___SYMBIAN_OS_RELEASE___/$self->{iRelease}/g;	# not used
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   930
		$line =~ s/___NAME___/$self->{iName}/g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   931
		$line =~ s/___LABEL___/$self->{iLabel}/g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   932
		$line =~ s/___REVISION_TYPE___/$self->{iRevisionType}/g;	# not used
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   933
		$line =~ s/___LINK___/$self->{iLink}/g;	# not used
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   934
		$line =~ s/___OPTIONAL___/$optional/g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   935
		$line =~ s/___LAYOUT_OPTIONS___/$layout/g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   936
		$line =~ s/___FILTERS___/$filters/g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   937
		$line =~ s/___IGNORE___/$ignore/g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   938
		$line =~ s/___LEGEND___/$legend/g;
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   939
		$line =~ s/___LEGEND_TITLE___/$self->{iLgdTitle}/g;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   940
		$line =~ s/___LEGEND_OPTIONS___/$legendOptions/g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   941
		$line =~ s/___SHAPES_XML___/$self->{iShapes}/g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   942
		$line =~ s/___SYSTEM_DEFINITIONS___/$sysdefTagsForModelTemplate/; # should be only one incident of it
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   943
		$line =~ s/___DISPLAY___/$display/g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   944
		$line =~ s/\sshapes=""//g; # remove empty attribute
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   945
		print OUTPUT $line;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   946
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   947
	close INPUT;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   948
	close OUPUT;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   949
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   950
	# Open and close the file so that it can flush itself:
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   951
	open (OUTPUT, "$modelXml") or &Logger::LogError("Xalan error ($error) occured in Step 1 of SVG building...", KOldSystemModelGenerator, 1);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   952
	close OUTPUT;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   953
	return $modelXml;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   954
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   955
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   956
sub GetXsltDir()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   957
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   958
	my $self = shift;
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   959
	my $xsltDir = $FindBin::Bin."/svg";  # calcluated w.r.t old directory
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   960
	$xsltDir = $FindBin::Bin."/src/old/svg" if ! -d $xsltDir; # calculated w.r.t the root directory
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
   961
	$xsltDir = $FindBin::Bin  if ! -d $xsltDir; # calculated w.r.t the /svg directory
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   962
	return $xsltDir;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   963
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   964
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   965
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   966
sub FileAsUrl() 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   967
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   968
	my $file = $_[0];
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   969
	if($file=~/^..+:/){ return $file}	# already a URL
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   970
	if(-f $file)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   971
		{ # abs_path only works on dirs, so strip off file name and put it back when done
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   972
		if(! ($file=~/^[a-z]:[\\\/][^\\\/]+$/i))
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   973
			{ # if it's in the root dir, do nothing
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   974
			my $tail = "/$file";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   975
			# if it's just a file name, need to find cwd;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   976
			if($file =~ s,([\\/][^\\/]+)$,,)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   977
				{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   978
				$tail = $1;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   979
				}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   980
			else {$file = "."}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   981
			$file = abs_path($file)."$tail";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   982
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   983
		} 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   984
	elsif (-d $file)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   985
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   986
		$file = abs_path($file);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   987
		}  # else does not exist, so just convert to unix-style path
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   988
	$file=~tr/\\/\//;	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   989
	return "file:///$file";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   990
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   991
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   992
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   993
sub RunCmd() {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   994
	my $command = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   995
	open(EXE,"$command 2>&1|");
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   996
	while(<EXE>){
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   997
		chomp;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   998
		s/^XSLT Message: //;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   999
		s/\.Source tree node:.*$//;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1000
		if($_ ne '') {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1001
			if(s/^note: //i) {
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1002
				&Logger::LogInfo($_, KOldSystemModelGenerator,2, 100);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1003
			} elsif(s/^Warning: //) {
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1004
				&Logger::LogWarning($_,  KOldSystemModelGenerator,2, 600);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1005
			} elsif(s/^Error: //i) {
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1006
				&Logger::LogError($_,  KOldSystemModelGenerator,2, 400);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1007
			} else {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1008
				print STDERR "$_\n";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1009
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1010
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1011
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1012
	close(EXE);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1013
	return $?;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1014
}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1015
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1016
sub ShouldCreateDepmodel()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1017
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1018
	my $self = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1019
	if ($self->{iDepsFile})
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1020
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1021
		return 1;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1022
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1023
	my $model = $self->getModel();
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1024
	my $t = $/;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1025
	$/='>';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1026
	open(M,$model);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1027
	while(<M>)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1028
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1029
		if(/<model\s/){last}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1030
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1031
	close M;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1032
	$/ = $t;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1033
	return /\sdeps=/;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1034
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1035
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1036
sub XsltTransform()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1037
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1038
	my $xslt = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1039
	my $from = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1040
	my $to = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1041
	my $indent = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1042
	my %params = %{$_[0]};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1043
	my $xsltParams;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1044
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1045
	# windows-specific stuff follows
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1046
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1047
	if(! ($xslt=~/^..+:/)) {$xslt	=~ s#\/#\\#g}			#it's not a URL
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1048
	if(! ($from=~/^..+:/)) {$from	=~ s#\/#\\#g}			#it's not a URL
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1049
	if(! ($to=~/^..+:/)) {$to	=~ s#\/#\\#g}			#it's not a URL
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1050
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1051
	while (my($p,$v) = each(%{$_[0]}))
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1052
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1053
		$v =~ s/"/&quot;/g;	#"		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1054
		$xsltParams.= " -p $p \"$v\"";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1055
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1056
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1057
	my $command = &SysModelGen::Xalan();
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1058
	$command =~ s#\/#\\#g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1059
	$command .= $xsltParams;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1060
	if($indent >=0) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1061
		$command .= " -i $indent";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1062
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1063
	if($to ne '') {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1064
		$command .= " -o \"$to\"";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1065
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1066
	$command.=" \"$from\" \"$xslt\"";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1067
	&Logger::LogInfo("System Call: $command", 800);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1068
	if($to eq '') {return `$command`}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1069
	return &RunCmd($command);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1070
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1071
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1072
sub Draw()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1073
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1074
	my $self = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1075
	my $genSvg = $self->{'iDiagram'} ne '';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1076
	my $genCsv = $self->{'iOutputCsv'} ne '';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1077
	my $genXml = $self->{'iOutputXml'} ne '';
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1078
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1079
	if(!$genSvg && !$genCsv && !$genXml)  
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1080
		{
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1081
        &Logger::LogFatal("Must specify at least one type of output file. Cannot continue...", KOldSystemModelGenerator, 0,Logger::KNothingToDo);		
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1082
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1083
	
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1084
	&Logger::LogInfo("Creating sysmodel.svg...", KOldSystemModelGenerator,0);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1085
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1086
	# Step 0:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1087
	# Prepare some file names and create output directory:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1088
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1089
	# construct full path name:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1090
	($self->{iRootDirectory} = cwd ) =~ s#\/#\\#g;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1091
	chdir($self->{iTemporaryDirectory});
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1092
	my $tempDirectoryPathname = cwd; # now gives the full path name $self->{iTemporaryDirectory}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1093
	chdir($self->{iRootDirectory}); # change back!
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1094
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1095
	my $xsltDir = $self->GetXsltDir();	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1096
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1097
	my $tempStuctureFile = "$tempDirectoryPathname/system_model_svg_tmp.xml";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1098
	my $tempXslFile = "$tempDirectoryPathname/system_model_svg_tmp.xsl";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1099
	my $tempModelFile = "$tempDirectoryPathname/model_tmp.svg";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1100
	my $tempModelFile2 = "$tempDirectoryPathname/model_tmp2.svg";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1101
	my $modelXsl = $xsltDir."/Model.xsl";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1102
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1103
	my $modelXml = $self->getModel();
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1104
	 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1105
	# Step 2
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1106
	# xalan -i 2 model.xml model.xsl > tmp.xml
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1107
	$error = &XsltTransform($modelXsl,$modelXml,$tempStuctureFile,1,	$self->{'iXsltParam'});
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1108
				
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1109
	&Logger::LogError("Xalan error ($error) occured in combining sysdefs", KOldSystemModelGenerator, 1) if $error;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1110
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1111
	# Step 3 - validation
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1112
	# xalan tmp.xml validate.xsl
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1113
	if($self->{iWarningLevel} == LogItem::VERBOSE )
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1114
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1115
		my $errors = &XsltTransform($xsltDir."/validate.xsl",$tempStuctureFile,'',-1);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1116
		&Logger::LogList(split(/\n/,$errors));
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1117
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1118
	if($genSvg)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1119
		{ # only needed for model building 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1120
		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1121
		# Step 4
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1122
		&Logger::LogInfo("Creating styling XSLT...", KOldSystemModelGenerator, 1);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1123
		$error = &XsltTransform("$xsltDir/Shapes.xsl",$modelXml,$tempXslFile,1,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1124
				{%{$self->{'iXsltParam'}},'Model-Transform' => "'".&FileAsUrl($modelXsl)."'" });
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1125
		&Logger::LogError("Xalan error ($error) occured generating Styling transform", KOldSystemModelGenerator, 2) if $error;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1126
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1127
		# Step 5
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1128
		&Logger::LogInfo("Generating SVG model...", KOldSystemModelGenerator, 1);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1129
		$error = &XsltTransform($tempXslFile,$tempStuctureFile,$tempModelFile,1,$self->{'iXsltParam'});
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1130
		&Logger::LogError("Xalan error ($error) occured in building SVG", KOldSystemModelGenerator, 2) if $error;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1131
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1132
		if ($self->ShouldCreateDepmodel()) {	# insert as 1st transform
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1133
			@ARGV=( $xsltDir."/Postprocess.xsl",'-',@ARGV)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1134
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1135
		my $tmpsvg = $tempModelFile;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1136
		while(scalar(@ARGV)) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1137
			my $transform = shift(@ARGV);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1138
			my $datafile = shift(@ARGV);
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1139
			if($datafile eq '""' || $datafile eq "''") {$datafile=''}	# not sure if this will work, but it should fix cygwin troubles
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1140
			if($datafile eq '-') {$datafile = &FileAsUrl($tempStuctureFile)}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1141
			elsif($datafile ne '') {$datafile = &FileAsUrl($datafile)}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1142
			# save to the output if this is the last transform
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1143
			# otherwise save to tempModelFile2 if reading from tempModelFile, and vis versa
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1144
			my $saveto = $self->{'iDiagram'};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1145
			if(scalar(ARGV))	 {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1146
				$saveto = ($tmpsvg eq $tempModelFile) ? $tempModelFile2 : $tempModelFile;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1147
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1148
			# Step 6
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1149
			# xalan  -i 2 -p Data tmp.xml 'tmp.svg' postprocess.xsl> final.svg
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1150
			my %p; 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1151
			if($datafile ne '') {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1152
				$p{'Data'}="'$datafile'";	# optional -- only if needed for transform
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1153
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1154
			$error = &XsltTransform($transform,$tmpsvg,$saveto,1,\%p);
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1155
			&Logger::LogError("Xalan error ($error) occured in post-processing SVG file", KOldSystemModelGenerator, 2) if $error;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1156
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1157
			$tmpsvg = $saveto; # read from this next time.
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1158
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1159
		if ($tmpsvg ne $self->{'iDiagram'}) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1160
			open(OUT,">".$self->{iDiagram});
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1161
			open(IN,$tmpsvg);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1162
			print OUT <IN>;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1163
			close OUT;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1164
			close IN;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1165
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1166
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1167
		my $zipname = $self->{iDiagram};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1168
		my $unzipname = $zipname;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1169
		$zipname =~ s/\.svg$/.svgz/i;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1170
		$unzipname =~ s/\.svgz$/.svg/i;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1171
		my $compressed = 0;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1172
		if($self->{iCompress})
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1173
			{
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1174
			my $gzip = &SysModelGen::GzipCommand();
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1175
			if($gzip)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1176
				{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1177
				my $command = "$gzip ".$self->{iDiagram};
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1178
				&Logger::LogInfo("System Call: $command", KOldSystemModelGenerator);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1179
				$error = &RunCmd($command);# this should generate the sysmodel.svg in the output directory
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1180
				&Logger::LogError("Gzip error ($error) occured when comrpessing SVG", KOldSystemModelGenerator, 1) if $error;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1181
				&Logger::LogInfo("Renaming output to : $zipname", KOldSystemModelGenerator);		
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1182
				rename $self->{iDiagram}.".gz", $zipname;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1183
				$compressed = 1;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1184
				}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1185
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1186
		if(!$compressed && $unzipname ne $self->{iDiagram}) 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1187
			{
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1188
			&Logger::LogInfo("Renaming output to : $unzipname", KOldSystemModelGenerator);		
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1189
			rename $self->{iDiagram}, $unzipname;	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1190
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1191
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1192
	# create CSV if desired
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1193
	if($genCsv)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1194
		{
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1195
		&Logger::LogInfo("Generating CSV output", KOldSystemModelGenerator, 0);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1196
		my %p;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1197
		if($self->{iCsvColumns})
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1198
			{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1199
			$p{'atts'}="'".$self->{iCsvColumns}."'";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1200
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1201
		if($self->{iCsvLabels})
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1202
			{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1203
			$p{'labels'}="'".$self->{iCsvLabels}."'";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1204
			}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1205
		$error = &XsltTransform($xsltDir."/output-csv.xsl",$tempStuctureFile,$self->{iOutputCsv},-1,\%p);
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1206
		&Logger::LogError("Xalan error ($error) occured in CSV output...", KOldSystemModelGenerator, 1) if $error;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1207
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1208
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1209
		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1210
	# create sysdef XML if desired
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1211
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1212
	if($genXml)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1213
		{
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1214
		&Logger::LogInfo("Generating XML output", KOldSystemModelGenerator, 0);
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1215
		$error = &XsltTransform($xsltDir."/output-sysdef.xsl",$tempStuctureFile,$self->{iOutputXml},1);
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1216
		&Logger::LogError("Xalan error ($error) occured in Sysdef output...", KOldSystemModelGenerator, 1) if $error;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1217
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1218
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1219
	# delete the contents of the temp directory if -clean is specified by the user:
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1220
	if ($self->{iClean})
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1221
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1222
		&Logger::LogInfo("Deleting contents of the temp directory $self->{iTemporaryDirectory}...", 100);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1223
		$self->DeleteTempDirectory();
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1224
		}	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1225
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1226
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1227
sub Downgrade()
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1228
	{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1229
	my $self = shift;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1230
	my $sysdef = shift;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1231
	my $saveto = $self->{iTemporaryDirectory}."/".shift;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1232
	my $sysdefurl=&FileAsUrl($sysdef);
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1233
	my $xsltDir = $self->GetXsltDir();	
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1234
	foreach(@{$self->{iSysDefFile}}) 
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1235
		{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1236
		if($_ eq $sysdefurl)
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1237
			{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1238
			$error = &XsltTransform("$xsltDir/sysdefdowngrade.xsl",$sysdef,$saveto,1);
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1239
			&Logger::LogError("Xalan error ($error) occured in downgrading $sysdef...", KOldSystemModelGenerator, 1) if $error;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1240
			$_=&FileAsUrl($saveto);
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1241
			}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1242
		}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1243
	}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1244
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1245
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1246
sub SystemModelXmlDataDir()
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1247
	{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1248
	my $file = $FindBin::Bin."/src/old/resources/auxiliary";
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1249
	$file = $FindBin::Bin."/../resources/auxiliary" if ! -d $file; # calculated w.r.t the /svg directory
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1250
	return $file;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1251
	}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1252
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1253
sub SystemModelColorsXmlFile()
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1254
	{
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1255
	my $colorsFile =  &SystemModelXmlDataDir()."/system_model_colors.xml";
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1256
	return $colorsFile;
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1257
	}
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1258
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1259
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1260
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1261
sub CreateSysDefTagsForModelXML()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1262
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1263
	my $self = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1264
	my $sysdefXml = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1265
	my $srcvar = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1266
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1267
	if($sysdefXml eq '')
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1268
		{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1269
		&Logger::LogInfo("Cannot find System Definition file", 100);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1270
		return;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1271
		}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1272
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1273
	my $ret = "<sysdef href=\"".&FileAsUrl($sysdefXml)."\"";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1274
	if($srcvar ne '') {$ret.=" root=\"$srcvar\""}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1275
	$ret .=">\n" . 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1276
		$self->MakeMultiInfo('iExtra' 	=> 'extra', 'iLevels'  	=> 'levels'	, 'iS12' => 's12');
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1277
	return "$ret\t</sysdef>\n";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1278
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1279
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1280
sub DeleteTempDirectory()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1281
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1282
	my $self = shift;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1283
	# This will delete all files in the $self->{iTemporaryDirectory}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1284
	rmtree $self->{iTemporaryDirectory};
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1285
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1286
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1287
sub Help()
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1288
	{
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1289
	my $self = shift;
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1290
format OK =
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1291
 @<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1292
$param,                               $text,
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1293
                       ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1294
                       $text
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1295
.
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1296
my @list =(
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1297
 'Switch',               'Explanation',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1298
 '------',               '-----------',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1299
'-h' ,           'Help on usage',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1300
	'-i'      ,      'An INI file listing one argument per line, with the syntax: <argument> = <value>',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1301
	'==== Build Control  ====',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1302
  '-w'          ,  'Warning level. 1: errors only (default), 2: warnings as well as errors, 3: info messages, warnings and errors, 4: all plus deep syntax validation and reporting -- note that this can take a long time to compute so do not use this warning level by default',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1303
  '-tempdir',	    'Temporary directory for build files. Defaults to drawsvg_temp',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1304
  '-output', 		'The name of the file to save the built System Model SVG. If in the format filename.svgz, it will attempt to compress the file. If compression is not supported, it will rename the output to filename.svg. Defaults to sysmodel.svg or sysmodel.svgz if -compress is set.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1305
  '-csv_output', 		'The name of the file to save a CSV description of the built System Model. Only items shown on the system model will be included.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1306
  '-csv_columns', 	'Comma-separated list of columns to include in the output CSV.  This does nothing if -csv_output is not present. By default (if -csv_columns is not present), the columns will be a sorted list of all attributes on all items. ',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1307
  '-csv_labels', 	'Comma-separated list of columns labels include in the output CSV.  Do not use quotes or commas in label names. This does nothing if -csv_output is not present. If this list is shorter than -csv_columns, the remaining columns will use the attribute name as the label. ',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1308
  '-xml_output', 		'The name of the file to save a combined system definition XML. Only items shown in the built system model will be included.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1309
  '-log'	,    'File in which to store output. Defaults to stdout',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1310
  '-compress', 	'If set, it will attempt to compress the output as an SVGZ file. In order to success gzip must be installed and in the PATH. This will also rename the output file from filename.svg to filename.svgz.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1311
  '-clean'   ,        'Caution: if set, it will delete the contents of the temporary directory.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1312
  "==== Files or URIs ====\nAll of these take a file name (relative or absolute path) or URI of a data source",
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1313
'-model', 'The location of the Model XML file to use to build the file.  If this is provided all other non-build control command line  and ini options are ignored.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1314
'-shapes', 'The location of the Shapes XML file used to provide rules to control  the display of the components on the model. If not present, default behaviour  (in Shapes.xml) is used. This and the default bahaviours are overrriden by  using the -color, -border, -pattern, and -style options. ',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1315
'-localize', 'The location of the Localization file used to provide displayable names for the model entities. By default,  the provided  "display-names.xml" is used.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1316
'-s12', 'The location of the Schedule 12 XML file used to provide the border shapres of the components. If this a directory, the S12 XML file is found by appending "Symbian_OS_v[system_version]_Schedule12.xml" to the directory.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1317
'-levels', 'The location of the Levels XML file used to override the  stacking of collections. ',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1318
'-sysinfo', 'The location of extra component information used to provided additional  properies for components.  By default,  the provided "SystemInfo.xml" is used.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1319
'-deps', 'The location of the Dependencies XML file used to draw the depmodel.  If not present, dependencies will not be drawn',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1320
'-color', 'The location of a Values XML file used to specify per-component colours. If not present, the default colours are used.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1321
'-border-shape', 'The location of a Values XML file used to specify the shape (border)  of each component. If not present, the default borders are used.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1322
'-pattern', 'The location of a Values XML file used to specify per-component overlay patterns. If not present, the default patterns (for new  and reference components) are used.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1323
'-border-style', 'The location of a Values XML file used to specify per-component border  styles. If not present, the default border styles are used. ',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1324
'-link','The base URL to use for all hyperlinks in the model. A base URL will be appended by the type and name (e.g. Blocks/Comms%20Services.html) of the items to create the full URL of the linked file. Window directories will be converted into file URIs.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1325
"==== Labels ====\nAll of these take a plain text value which is displayed on the model",
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1326
'-system_name', 'The name of the product described in the model. It appears at  the bottom right. Defaults to "Symbian OS"',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1327
'-system_version', 'The version of the product described in the model. It appears  at the bottom right after the name.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1328
'-model_name', 'The label for the model. It appears at the bottom right,  under the name. Defaults to "System Model".',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1329
'-model_version', 'A number which appears before th model-revision-type.   If specified this overrides the build number used by depmodel.  If not building depmodel, this defaults to "1"',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1330
'-model_version_type', 'One of "draft", "issued", "build" or free-text value. Appears below the model label. If specified this overrides the build number used by DepToolkit.If not building depmodel, this defaults to "draft"',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1331
'-copyright', 'The copyright to appear in the lower left. Set to empty string to leave out. Defaults to "[this year] Nokia Corporation"',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1332
'-distribution', 'Text to appear on the bottom centre to indicate to whom the  model can be show. Informational only. Suggested values are "internal", "secret" or "unrestrictred". Not shown if not set.',
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1333
'-legend_title', 'The title to appear in the leftmost part of the legend. Defautls to "Key"',
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1334
'-note', 'Free text to appear inside the legend box, on the rightmost side. If multiple ones are provided, they will appear as separate boxes from left to right. Newlines and other special characters can be entity-encoded (e.g. &#xa;)',  
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1335
"==== Model Control  ====",
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1336
'-sysdef [uri-list]',   'Comma-separated list of locations for the System Definition XML file(s) used to build the model. Layers in the files will be  stacked on top of each other in order, from bottom to top.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1337
'-coreos [on/off/new]', 'Turn on or off Core OS colouring, or use the new colouring for 9.5 and later models. Defaults to "off" for model versions before 9.4 or those with no specified version, "on" for 9.4 and "new" for 9.5 and later',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1338
'-filter [filter-name]', 'The name of a filter to turn on when building the model.  All filters on an item must be present in this list in order for that item to appear. Can have any number of these Defaults to "java" and "gt"',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1339
'-filter-has [filter-name]', 'Like -filter, except any filter on an item must be present in this list in order for that item to appear. Include "*" in the list in order to show items with no filters. Equivalent to "-show-attr filter xxx"',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1340
'-ignore [item]', 'A model entity to not draw, in the  form "[item-type]:[item-name]". Any number of these can be used. Defaults to "layer:Tools and Utils and SDKENG" ,"layer:MISC", "block:Techview"',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1341
'-show-attr [attr[=val]]', 'A mechanism of filtering which allows filtering based on component attribute values. If a value is set for that attribute, the component will be shown. Use in conjunction with -hide-attr for fine contol of what is shown. "class" and "filter" attribtues are handled specially -- see the documentation for details',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1342
'-hide-attr [attr[=val]]', 'A mechanism of filtering which allows filtering based on component attribute values. If a value is set for that attribute, the component will not be shown on the model. Use in conjunction with -show-attr for fine contol of what is shown. "class" and "filter" attribtues are handled specially -- see the documentation for details',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1343
'-detail [item-type]' , 'The type of the smallest System Model entity to draw. One of "layer", "block", "subblock", "collection" or "component".  Defaults to "component"',		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1344
'-detail-type [type]' , 'If set to "fixed", the smallest System Model entity drawn will have a fixed width (rather then sized by their invisible components). This can be used to reduce the size and complexity of the overall model.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1345
'-page-width [length]', 'The width of the drawn image (with units). If not specified it will fit the viewer window. Valid units: "in", "mm", "cm", "px", "pt"',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1346
'-static', 'If present, the model will not have any mouseover effects (this is  overriden by builing the depmodel).',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1347
'-logo [file]', 'If present, the logo will be drawn in the lower-left corner of the model. If the logo is an SVG file, -logo-width and -logo-height are optional, otherwise the must both be specified',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1348
'-logo-height [length]', 'Specifies the height of the logo (if any) in mm. Width is scaled along with height unless otherwise specified. Both width and height MUST be specified if a bitmap image is used',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1349
'-logo-width [length]', 'Specifies the width of the logo (if any) in mm. Height is scaled along with width unless otherwise specified. Both width and height MUST be specified if a bitmap image is used',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1350
'-legend-width [%]', 'The percent width of the model the legend takes up. This will scale the size of the legend and model title, but not the logo, to fill the specified space. If a logo is included, but no width specified, the legend cannot be scaled since it will not be able to determine the available space. Note that that -max-legend-scale will further limit the potential width.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1351
'-legend-max-scale [scale]', 'Specifies the maximum scale factor for resizing the legend. If this is present and -legend-width is not, the legend and title will scale to 100% of the available width. If both are present the scale factor will take precedent. If neither is present, the legend will not resize. Note that when this is used, the legend can shrink if it would normally be wider than the model.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1352
'-title-scale [scale]', 'Specifies the scale factor for the size of the title font (the text in the lower right). Use this instead of CSS to control the size, since the model generator needs to explicitly know how much space to allocate for the title.',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1353
'-model_font [font]', 'The name of the base font to use to draw the model. This will be overriden by any custom CSS in the Shapes XML',
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1354
'-dpi [number]', 'The DPI to use when printing from the Adobe SVG Viewer. If not present, it will print well at A4 size. A value of 300 will look good on A3 size paper'
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1355
  );
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1356
print STDERR "Usage: DrawSvg.pl [Arguments] [Transform Data-file] ...\n\nArguments:\n";
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1357
  my $head=2;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1358
while(@list) {
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1359
	$param = shift(@list);
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1360
	if($head<=0 and !($param=~/^-/)){print "\n$param\n";next;}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1361
	$text = shift(@list);
6
5b32dc297d05 Prepare old system model generator for 2.0 update
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 1
diff changeset
  1362
	write OK ;
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1363
	$head--;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1364
}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1365
	return;
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1366
	}
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1367
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1368
1;