author | m2lahtel <> |
Thu, 24 Jun 2010 10:35:05 +0300 | |
changeset 596 | 9f25be3da657 |
parent 584 | 56dd7656a965 |
permissions | -rw-r--r-- |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
2 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
3 |
# All rights reserved. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
4 |
# This component and the accompanying materials are made available |
584 | 5 |
# under the terms of the License "Eclipse Public License v1.0" |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
6 |
# which accompanies this distribution, and is available |
584 | 7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
8 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
9 |
# Initial Contributors: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
10 |
# Nokia Corporation - initial contribution. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
11 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
12 |
# Contributors: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
13 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
14 |
# Description: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
15 |
# Common buildrom plugin methods, for parsing Symbian IBY entries etc. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
16 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
17 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
18 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
19 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
20 |
package plugincommon; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
21 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
22 |
use strict; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
23 |
use warnings; |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
24 |
use Cwd; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
25 |
use File::Basename; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
26 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
27 |
use constant FILESPECSTATEMENT => qr/^\s*(\S+?)\s*[=\s]\s*(?:"(.+?)"|(\S+))\s+(?:"(.+?)"|(\S+))(\s+.+?)?\s*$/; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
28 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
29 |
use constant FILESPECKEYWORD => |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
30 |
qr/^(?:data|file|primary|secondary|variant|device|extension|dll|filecompress|fileuncompress)/i; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
31 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
32 |
use constant FILEBITMAPSPECKEYWORD => |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
33 |
qr/^(?:data|file|primary|secondary|variant|device|extension|dll|filecompress|fileuncompress|BITMAP|AUTO-BITMAP|COMPRESSED-BITMAP)/i; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
34 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
35 |
use constant ROFSFILESPECKEYWORD => qr/^(?:data|file|filecompress|fileuncompress)/i; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
36 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
37 |
use constant ROFSBITMAPFILESPECKEYWORD => qr/^(?:data|file|filecompress|fileuncompress|BITMAP|AUTO-BITMAP|COMPRESSED-BITMAP)/i; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
38 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
39 |
use constant HIDESTATEMENT => qr/^\s*(hide\S*?)\s*[=\s]\s*(?:"(.+?)"|(\S+))()\s*$/; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
40 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
41 |
use constant DIRECTORYKEYWORD => qr/^(?:alias|hide|rename)/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
42 |
|
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
43 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
44 |
BEGIN |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
45 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
46 |
use Exporter(); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
47 |
our ($VERSION, @ISA, @EXPORT); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
48 |
$VERSION = 1.00; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
49 |
@ISA = qw(Exporter); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
50 |
@EXPORT = qw( |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
51 |
FILESPECSTATEMENT FILESPECKEYWORD FILEBITMAPSPECKEYWORD ROFSFILESPECKEYWORD ROFSBITMAPFILESPECKEYWORD |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
52 |
HIDESTATEMENT DIRECTORYKEYWORD |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
53 |
&abspath &dprint &plugin_reset &plugin_init &plugin_start &plugin_end &parse_keyline &parse_obyline |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
54 |
&is_entry &get_type_from_entry &get_source_from_entry &get_target_from_entry |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
55 |
$gPluginname $gImgid $gLogfile $gWorkdir $gDebug $gFeatvar $gHandlestr |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
56 |
$gLine $gLnum $gRomid $gRomidCmp $gKeyword $gSource $gTarget $gAttrib $gSrcCmp $gTgtCmp); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
57 |
$| = 1; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
58 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
59 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
60 |
our ($gPluginname, $gImgid, $gLogfile, $gWorkdir, $gDebug, $gFeatvar, $gHandlestr); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
61 |
our ($gLine, $gLnum, $gRomid, $gRomidCmp, $gKeyword, $gSource, $gTarget, $gAttrib, $gSrcCmp, $gTgtCmp); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
62 |
my $duration = 0; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
63 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
64 |
sub abspath($) |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
65 |
{ |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
66 |
my $path = shift(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
67 |
eval { local $SIG{__DIE__}; $path = Cwd::abs_path($path) }; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
68 |
return($path); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
69 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
70 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
71 |
sub dprint($$;$) |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
72 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
73 |
my ($log, $str, $nonl) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
74 |
($str = ($log < 0 ? "Warning: " : "") . $str) =~ s/\n//g; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
75 |
$str .= "\n" if !$nonl; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
76 |
$log = abs($log); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
77 |
print($str) if (($log == 1) && !$gDebug) || (($log == 2) && $gDebug) || ($log > 2); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
78 |
print(LOG $str) if $gLogfile && ($log > 1); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
79 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
80 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
81 |
sub plugin_reset() |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
82 |
{ |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
83 |
($gLine, $gLnum, $gRomid, $gRomidCmp, $gKeyword, $gSource, $gTarget, $gAttrib, $gSrcCmp, $gTgtCmp) = |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
84 |
("", 0, 0, 0, "", "", "", "", "", ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
85 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
86 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
87 |
sub plugin_init($$$) |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
88 |
{ |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
89 |
my ($pluginfo, $opt, $start) = @_; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
90 |
$gPluginname = "$pluginfo->{name}.pm"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
91 |
plugin_reset(); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
92 |
($gImgid, $gLogfile, $gWorkdir, $gDebug, $gFeatvar, my $warn) = (0, "", undef, 0, "", ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
93 |
foreach (split(/;+/, $opt)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
94 |
if (s/^\s*-i//i) { $gImgid = (/^CORE$/ ? 0 : (/^ROFS(\d)$/ ? $1 : -1)) } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
95 |
elsif (s/^\s*-l//i) { $gLogfile = abspath(File::Basename::dirname($_)) . "/" . File::Basename::basename($_) } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
96 |
elsif (s/^\s*-w//i) { $gWorkdir = abspath($_) } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
97 |
elsif (s/^\s*-d//i) { $gDebug = ($_ ? 1 : 0) } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
98 |
elsif (s/^\s*-f//i) { $gFeatvar = $_ } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
99 |
else { $warn .= ", `$_'" } |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
100 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
101 |
$warn = "Unknown parameter(s):$warn." if ($warn =~ s/^,//); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
102 |
(open(LOG, ">>$gLogfile") or |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
103 |
(($warn .= ($warn ? " " : "") . "Can't write to `$gLogfile'."), $gLogfile = "")) if $gLogfile; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
104 |
dprint(3, "$gPluginname: " . ($start ? "-" x (77 - length($gPluginname)) : |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
105 |
"Initializing; $pluginfo->{invocation}, image id = " . ($gImgid < 0 ? "d" : $gImgid) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
106 |
", logfile = `$gLogfile'" . (defined($gWorkdir) ? ", workdir = `$gWorkdir'" : "") . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
107 |
", debug = $gDebug" . ($gFeatvar ne "" ? ", feature variant = `$gFeatvar'" : ""))); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
108 |
dprint(-3, $warn) if $warn; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
109 |
close(LOG) if !$start; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
110 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
111 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
112 |
sub plugin_start($$) |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
113 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
114 |
$duration = time(); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
115 |
plugin_init(shift(), shift(), 1); |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
116 |
$gHandlestr = "REM handled $gPluginname:"; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
117 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
118 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
119 |
sub plugin_end() |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
120 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
121 |
my $msg = "$gPluginname: Duration: " . (time() - $duration) . " seconds "; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
122 |
dprint(3, $msg . "-" x (79 - length($msg))); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
123 |
close(LOG); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
124 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
125 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
126 |
sub parse_keyline(;$) |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
127 |
{ |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
128 |
($gLine = shift()) =~ s/^\s+|\s+$//g if defined($_[0]); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
129 |
return(-1) if ($gLine !~ FILESPECSTATEMENT) && ($gLine !~ HIDESTATEMENT); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
130 |
($gKeyword, $gSource, $gTarget, $gAttrib) = |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
131 |
($1, defined($2) ? $2 : $3, defined($4) ? $4 : $5, defined($6) ? $6 : ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
132 |
($gSrcCmp, $gTgtCmp) = (lc($gSource), lc($gTarget)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
133 |
($gTgtCmp = ($gKeyword =~ DIRECTORYKEYWORD ? $gSrcCmp : $gTgtCmp)) =~ tr/\\/\//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
134 |
$gTgtCmp =~ s/^\/+//; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
135 |
return(2); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
136 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
137 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
138 |
sub parse_obyline($) |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
139 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
140 |
($gLine = shift()) =~ s/^\s+|\s+$//g; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
141 |
$gLnum++; |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
142 |
if ($gLine =~ /^REM\s+(ROM|DATA)_IMAGE\[(\d+)\]/i) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
143 |
$gRomid = $2; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
144 |
$gRomidCmp = ($gImgid >= 0 ? ($1 eq "ROM" ? ($2 != 1 ? $2 : 0) : 99) : ($1 eq "DATA" ? -$2 - 1 : 99)); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
145 |
return(1); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
146 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
147 |
return(0) if ($gLine =~ /^(?:#|REM\s)/i) || ($gLine eq ""); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
148 |
return(parse_keyline()); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
149 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
150 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
151 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
152 |
############################################################################### |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
153 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
154 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
155 |
sub is_entry |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
156 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
157 |
my $entry = shift; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
158 |
if ($entry =~ /\s*(\S+)\s*=\s*(?:"(.+?)"|(\S+))\s+(?:"(.+?)"|(\S+))/i) |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
159 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
160 |
return 1; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
161 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
162 |
return 0; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
163 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
164 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
165 |
# get the type from an iby entry |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
166 |
sub get_type_from_entry($) |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
167 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
168 |
my $entry = shift; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
169 |
if ($entry =~ /\s*(\S+)\s*=\s*(?:"(.+?)"|(\S+))\s+(?:"(.+?)"|(\S+))/i) |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
170 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
171 |
return $1; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
172 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
173 |
return ""; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
174 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
175 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
176 |
# get the source file from an iby entry |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
177 |
sub get_source_from_entry($) |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
178 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
179 |
my $entry = shift; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
180 |
if ($entry =~ /\s*(\S+)\s*=\s*(?:"(.+?)"|(\S+))\s+(?:"(.+?)"|(\S+))/i) |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
181 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
182 |
return defined($2) ? "\"$2\"" : $3; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
183 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
184 |
return ""; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
185 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
186 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
187 |
# get the target file from an iby entry |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
188 |
sub get_target_from_entry($) |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
189 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
190 |
my $entry = shift; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
191 |
if ($entry =~ /\s*(\S+)\s*=\s*(?:"(.+?)"|(\S+))\s+(?:"(.+?)"|(\S+))/i) |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
192 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
193 |
return defined($4) ? "\"$4\"" : $5; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
194 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
195 |
return ""; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
196 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
197 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
198 |
1; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
199 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
200 |
__END__ # OF PLUGINCOMMON.PM |