|
1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of the License "Symbian Foundation License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # Buildrom plugin for hiding entire iby files. |
|
16 # Adds a HIDEALL keyword to hide content. |
|
17 # |
|
18 |
|
19 |
|
20 |
|
21 ############################################################################## |
|
22 # |
|
23 # Syntax: HIDEALLBEGIN |
|
24 # .. |
|
25 # HIDEALLEND |
|
26 # |
|
27 # Example: |
|
28 # HIDEALLBEGIN |
|
29 # #include <browserui.iby> |
|
30 # #include <BrowserResources.iby> |
|
31 # HIDEALLEND |
|
32 # hides all target files in browserui.iby |
|
33 # |
|
34 ############################################################################## |
|
35 |
|
36 |
|
37 package hide; |
|
38 use strict; |
|
39 use plugincommon; |
|
40 |
|
41 BEGIN |
|
42 { |
|
43 use Exporter (); |
|
44 our ( $VERSION, @ISA, @EXPORT ); |
|
45 # set the version for version checking |
|
46 $VERSION = 1.00; |
|
47 |
|
48 @ISA = qw( Exporter ); |
|
49 @EXPORT = qw(&hide_info |
|
50 &do_hide_extension |
|
51 &is_hideallbegin |
|
52 &is_hideallend ); |
|
53 } |
|
54 |
|
55 my %hide_infostruct = |
|
56 ( |
|
57 name => "hide", |
|
58 invocation => "InvocationPoint2.5", |
|
59 single => "hide::do_hide_extension" |
|
60 ); |
|
61 |
|
62 my $line; |
|
63 my @newobydata; |
|
64 my %languages; |
|
65 my $defaultLang; |
|
66 my $verbose=0; |
|
67 my $errors=0; |
|
68 |
|
69 sub hide_info |
|
70 { |
|
71 return \%hide_infostruct; |
|
72 } |
|
73 |
|
74 sub do_hide_extension |
|
75 { |
|
76 print "Running plugin hide.pm\n"; |
|
77 my $obydata = shift; |
|
78 my $depth = 0; |
|
79 my $inhide = 0; |
|
80 undef @newobydata; |
|
81 foreach $line (@{$obydata}) |
|
82 { |
|
83 if ($line =~ /^\s*REM/i) |
|
84 { |
|
85 # Ignore REM statements, to avoid processing "REM __SCALABLE_IMAGE( ... )" |
|
86 push @newobydata, $line; |
|
87 next; |
|
88 } |
|
89 if (is_hideallbegin($line)) |
|
90 { |
|
91 push @newobydata, "REM handled $line"; |
|
92 $inhide = 1; |
|
93 print "DoHide inhide\n" if $verbose; |
|
94 next; |
|
95 } |
|
96 if (is_hideallend($line)) |
|
97 { |
|
98 print "DoHide inhide end!\n" if $verbose; |
|
99 $inhide = 0; |
|
100 push @newobydata, "REM handled $line"; |
|
101 next; |
|
102 } |
|
103 # inhide, hide all target files and data entries |
|
104 if ($inhide) |
|
105 { |
|
106 if (is_entry($line)) |
|
107 { |
|
108 my $target = get_target_from_entry($line); |
|
109 print "DoHide target $target!\n" if $verbose; |
|
110 push @newobydata, "hide=$target\n"; |
|
111 next; |
|
112 } |
|
113 } |
|
114 # Default case |
|
115 push @newobydata, $line; |
|
116 } |
|
117 @{$obydata} = @newobydata; |
|
118 print "========================== End DoHideExtension =======================\n" if $verbose; |
|
119 #Stop image creation in error case |
|
120 #exit(1) if ($errors); |
|
121 |
|
122 } |
|
123 |
|
124 sub is_hideallbegin |
|
125 { |
|
126 my $entry = shift; |
|
127 if ($entry=~/^\s*HIDEALLBEGIN\s*$/i) |
|
128 { |
|
129 return 1; |
|
130 } |
|
131 return 0; |
|
132 } |
|
133 |
|
134 sub is_hideallend |
|
135 { |
|
136 my $entry = shift; |
|
137 if ($entry=~/^\s*HIDEALLEND\s*$/i) |
|
138 { |
|
139 return 1; |
|
140 } |
|
141 return 0; |
|
142 } |
|
143 |
|
144 1; # Return a true value from the file |