imgtools/imaker/src/s60ibymacros.pm
author William Roberts <williamr@symbian.org>
Fri, 18 Jun 2010 12:51:41 +0100
changeset 586 bfc226f3f18c
permissions -rw-r--r--
Supply a version of s60ibymacros.pm, to fix Bug 2901
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
586
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
# All rights reserved.
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
# This component and the accompanying materials are made available
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
# under the terms of the License "Symbian Foundation License v1.0"
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
# which accompanies this distribution, and is available
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
# at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
#
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
# Initial Contributors:
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
#
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
# Contributors:
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
#
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
# Description:
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
# S60 specific IBY file macro handling
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
#
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    17
package s60ibymacros;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    18
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    19
BEGIN
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
  {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    21
  use Exporter ();
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
  our ( $VERSION, @ISA, @EXPORT );
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
  # set the version for version checking
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
  $VERSION     = 1.00;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    26
  @ISA         = qw( Exporter );
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
  @EXPORT      = qw( &s60ibymacros_info &DoS60IbyModifications );
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
  }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
my %s60ibymacros_infostruct =
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
  (
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
  name => "s60ibymacros",
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    33
  invocation => "InvocationPoint1",
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
  single => "s60ibymacros::DoS60IbyModifications"
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
  );
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
my @newobydata;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
sub s60ibymacros_info
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
  {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
  return \%s60ibymacros_infostruct;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
  }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
sub DoS60IbyModifications
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    45
  {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
  my $obydata = shift;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    47
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    48
  undef @newobydata;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
  foreach $line (@{$obydata})
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    50
    {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    51
    if ($line =~ /^\s*REM/i)
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
      {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
      # Ignore REM statements, to avoid processing "REM __SCALABLE_IMAGE( ... )"
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    54
      push @newobydata, $line;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
      }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
    elsif( ! ( HandleIconMacros($line) || HandleCenrepMacros($line) ) )
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
      {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58
      push @newobydata, $line;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    59
      }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    60
    }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    61
  @{$obydata} = @newobydata;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    62
  }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    63
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    64
sub HandleCenrepMacros
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    65
  {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    66
  my $line = shift;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    67
  if ( $line =~ m/^.*__CENREP_TXT_FILES\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/i )
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    68
  # __CENREP_TXT_FILES(dataz_, source dir, target dir)
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    69
    {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    70
    my $sourcepath="$1\\$2";
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    71
    my $targetpath=$3;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    72
    my $s60extras_export_list_filename = "$sourcepath"."\\s60extras_export_list.txt";
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    73
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    74
    open(DH, $s60extras_export_list_filename);
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    75
    my @dlist = <DH>;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    76
    chop @dlist;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    77
    close(DH);
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    78
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    79
    my $cenreptxtfile;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    80
    foreach $cenreptxtfile (@dlist)
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    81
      {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    82
      if ($cenreptxtfile =~ /^\S+\.txt/)
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    83
        {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    84
        push @newobydata, "data=$sourcepath\\$cenreptxtfile $targetpath\\$cenreptxtfile\n";
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    85
        }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    86
      }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    87
    return 1;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    88
    }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    89
  }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    90
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    91
sub HandleIconMacros
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    92
  {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    93
  my $line = shift;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    94
  if ( $line =~ m/^.*__SCALABLE_IMAGE\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/i )
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    95
  # __SCALABLE_IMAGE(emulator directory, file rom dir, dataz_, resource rom dir,
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    96
  #                  filename, resource filename)
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    97
    {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    98
      
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
    99
    my $sourcepath="$1\\$2";
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   100
    my $targetpath=$3;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   101
    my $filename=$4;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   102
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   103
    if( -e "$sourcepath\\$filename.mbm" )
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   104
      {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   105
      push @newobydata, "AUTO-BITMAP=$sourcepath\\$filename.mbm $targetpath\\$filename.mbm\n";
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   106
      }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   107
    if( -e "$sourcepath\\$filename.mif" )
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   108
      {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   109
      push @newobydata, "data=$sourcepath\\$filename.mif $targetpath\\$filename.mif\n";
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   110
      }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   111
    elsif( ! -e "$sourcepath\\$filename.mbm ")
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   112
      {
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   113
      print STDERR "* Invalid image file name: $sourcepath\\$filename.mbm or .mif\n";
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   114
      }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   115
    return 1;
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   116
    }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   117
  }
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   118
bfc226f3f18c Supply a version of s60ibymacros.pm, to fix Bug 2901
William Roberts <williamr@symbian.org>
parents:
diff changeset
   119
1;  # Return a true value from the file