imgtools/imaker/buildrom_plugins/s60ibymacros.pm
changeset 629 541af5ee3ed9
parent 595 997c19261166
equal deleted inserted replaced
628:7c4a911dc066 629:541af5ee3ed9
       
     1 # ============================================================================
       
     2 #  Name        : s60ibymacros.pm
       
     3 #  Part of     : build_RnD
       
     4 #  Description : S60 specific IBY file macro handling
       
     5 #  Version     : %version: 1 %
       
     6 #
       
     7 #  Copyright © 2006 Nokia.  All rights reserved.
       
     8 #  This material, including documentation and any related computer
       
     9 #  programs, is protected by copyright controlled by Nokia.  All
       
    10 #  rights are reserved.  Copying, including reproducing, storing,
       
    11 #  adapting or translating, any or all of this material requires the
       
    12 #  prior written consent of Nokia.  This material also contains
       
    13 #  confidential information which may not be disclosed to others
       
    14 #  without the prior written consent of Nokia.
       
    15 # ============================================================================
       
    16 #
       
    17 # 07.08.2006 Juha Ristimäki
       
    18 # Initial version.
       
    19 #
       
    20 
       
    21 package s60ibymacros;
       
    22 
       
    23 BEGIN
       
    24   {
       
    25   use Exporter ();
       
    26   our ( $VERSION, @ISA, @EXPORT );
       
    27   # set the version for version checking
       
    28   $VERSION     = 1.00;
       
    29 
       
    30   @ISA         = qw( Exporter );
       
    31   @EXPORT      = qw( &s60ibymacros_info &DoS60IbyModifications );
       
    32   }
       
    33 
       
    34 my %s60ibymacros_infostruct =
       
    35   (
       
    36   name => "s60ibymacros",
       
    37   invocation => "InvocationPoint1",
       
    38   single => "s60ibymacros::DoS60IbyModifications"
       
    39   );
       
    40 
       
    41 my @newobydata;
       
    42 
       
    43 sub s60ibymacros_info
       
    44   {
       
    45   return \%s60ibymacros_infostruct;
       
    46   }
       
    47 
       
    48 sub DoS60IbyModifications
       
    49   {
       
    50   my $obydata = shift;
       
    51 
       
    52   undef @newobydata;
       
    53   foreach $line (@{$obydata})
       
    54     {
       
    55     if ($line =~ /^\s*REM/i)
       
    56       {
       
    57       # Ignore REM statements, to avoid processing "REM __SCALABLE_IMAGE( ... )"
       
    58       push @newobydata, $line;
       
    59       }
       
    60     elsif( ! ( HandleIconMacros($line) || HandleCenrepMacros($line) ) )
       
    61       {
       
    62       push @newobydata, $line;
       
    63       }
       
    64     }
       
    65   @{$obydata} = @newobydata;
       
    66   }
       
    67 
       
    68 sub HandleCenrepMacros
       
    69   {
       
    70   my $line = shift;
       
    71   if ( $line =~ m/^.*__CENREP_TXT_FILES\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/i )
       
    72   # __CENREP_TXT_FILES(dataz_, source dir, target dir)
       
    73     {
       
    74     my $sourcepath="$1\\$2";
       
    75     my $targetpath=$3;
       
    76     my $s60extras_export_list_filename = "$sourcepath"."\\s60extras_export_list.txt";
       
    77 
       
    78     open(DH, $s60extras_export_list_filename);
       
    79     my @dlist = <DH>;
       
    80     chop @dlist;
       
    81     close(DH);
       
    82 
       
    83     my $cenreptxtfile;
       
    84     foreach $cenreptxtfile (@dlist)
       
    85       {
       
    86       if ($cenreptxtfile =~ /^\S+\.txt/)
       
    87         {
       
    88         push @newobydata, "data=$sourcepath\\$cenreptxtfile $targetpath\\$cenreptxtfile\n";
       
    89         }
       
    90       }
       
    91     return 1;
       
    92     }
       
    93   }
       
    94 
       
    95 sub HandleIconMacros
       
    96   {
       
    97   my $line = shift;
       
    98   if ( $line =~ m/^.*__SCALABLE_IMAGE\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/i )
       
    99   # __SCALABLE_IMAGE(emulator directory, file rom dir, dataz_, resource rom dir,
       
   100   #                  filename, resource filename)
       
   101     {
       
   102       
       
   103     my $sourcepath="$1\\$2";
       
   104     my $targetpath=$3;
       
   105     my $filename=$4;
       
   106 
       
   107     if( -e "$sourcepath\\$filename.mbm" )
       
   108       {
       
   109       push @newobydata, "AUTO-BITMAP=$sourcepath\\$filename.mbm $targetpath\\$filename.mbm\n";
       
   110       }
       
   111     if( -e "$sourcepath\\$filename.mif" )
       
   112       {
       
   113       push @newobydata, "data=$sourcepath\\$filename.mif $targetpath\\$filename.mif\n";
       
   114       }
       
   115     elsif( ! -e "$sourcepath\\$filename.mbm ")
       
   116       {
       
   117       print STDERR "* Invalid image file name: $sourcepath\\$filename.mbm or .mif\n";
       
   118       }
       
   119     return 1;
       
   120     }
       
   121   }
       
   122 
       
   123 1;  # Return a true value from the file