sysmodelgen/SysModGen.pl
author Bob Rosenberg <bob.rosenberg@nokia.com>
Tue, 06 Apr 2010 10:28:27 +0100
branchHighFidelityModel
changeset 152 5acf50bbb618
permissions -rw-r--r--
Preview version of system model generator which supports 3.0 syntax
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     1
#!perl
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     2
# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     3
# All rights reserved.
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     5
# under the terms of the License "Symbian Foundation License v1.0"
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     7
# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     8
#
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     9
# Initial Contributors:
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    11
#
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    12
# Contributors:
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    13
#
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    14
# Description:
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    15
#
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    16
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    17
use strict;
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    18
use warnings;
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    19
use FindBin;
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    20
use lib $FindBin::Bin;
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    21
use lib $FindBin::Bin."/old";
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    22
use lib $FindBin::Bin."/src";
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    23
use SysModelGen;
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    24
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    25
#legacy stuff
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    26
use lib $FindBin::Bin."/src/old/svg";
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    27
use DrawSvg;
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    28
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    29
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    30
my %versions = &DrawSvg::SchemaVersionsFromArgs(@ARGV);
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    31
#my $drawer = new DrawSvg();
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    32
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    33
my $nOld = 0; 
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    34
my $nCurrent = 0;
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    35
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    36
# test versions here. If any are less than 3.0.0, build using old model code
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    37
foreach my $v (keys(%versions))
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    38
	{ # need to downgrade anything in 3.x syntax
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    39
	if($v=~/^[12]\./) {$nOld++} else {$nCurrent++}
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    40
	}
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    41
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    42
if($nOld && $nCurrent)
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    43
	{
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    44
	die "Cannot mix pre-3.0 syntax system definitions with 3.0 and later syntaxes";
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    45
	}
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    46
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    47
my $drawer = ($nOld)  ? new DrawSvg() :  new SysModelGen();
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    48
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    49
$drawer->Draw();
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    50
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    51
exit;