srctools/distillsrc/readmrp.pm
author Bob Rosenberg <bob.rosenberg@nokia.com>
Fri, 27 Aug 2010 14:50:55 +0100
changeset 638 024a31e39848
parent 602 3145852acc89
permissions -rw-r--r--
Change bld.inf install location to epoc32\tools\sysdeftools
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
#! /bin/perl
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     2
# Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     3
# All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     4
# This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     6
# which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     8
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     9
# Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    11
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    12
# Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    13
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    14
# Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    15
# readmrp - API to parse mrp files (but do no further processing)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    16
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    17
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
package ReadMrp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
sub New($)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
	{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
	my $proto = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
	my $class = ref($proto) || $proto;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
	my $self = {};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
	bless $self, $class;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
	my ($fileName) = @_;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
	$self->{filename} = $fileName;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
	$self->Read();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
	return $self;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
	}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
sub Read()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
	{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
	my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
	my $fileName = $self->{filename};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
	die "ERROR: MRP file '$fileName' does not exist\n" unless (-e $fileName);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
	my $srcitems = [];
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
	my $binexpitems = [];
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
	my $component;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
	my $notes;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
	open MRP, "$fileName" or die "ERROR: Couldn't open '$fileName' for reading: $!\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
	
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
	while (my $line = <MRP>)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
		{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
		chomp $line;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
		$line =~ s/(?<!\\)#.*$//;  # remove comments
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
		$line =~ s/^\s+//;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
		next if (!$line); # blank lines
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
		my @operands;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
		my $string = $line;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
		while ($string)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
		{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
			if ($string =~ s/^\"(.*?)\"// # Match and remove next quoted string
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
			or $string =~ s/^(.*?)\s+//   # or, match and remove next (but not last) unquoted string
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
		 	or $string =~ s/^(.*)\s*$//)  # or, match and remove last unquoted string.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
				push (@operands, $1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
				$string =~ s/^\s+//; # Remove delimiter if present.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
		}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
		my $keyword = shift @operands;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
		my $minus = ($keyword =~ s/^-//);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
		if ($keyword eq "component")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
			die "-component is not a valid command in file '$fileName'\n" if $minus;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
			$component = shift @operands;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
		elsif ($keyword eq "notes_source")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
			die "-notes_source is not a valid command in file '$fileName'\n" if $minus;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
			$notes = shift @operands
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
			# N.B. This may require source mapping, so we don't check for existence here
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
		elsif ($keyword eq "source")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
			die "-source is not supported by this parser yet in file '$fileName'\n" if $minus;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
			my $srcItem = join ' ', @operands;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
			push @$srcitems, $srcItem;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
		elsif ($keyword eq "binary")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
			if (scalar @operands == 1)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
				{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
				push @$binexpitems, shift @operands;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
				}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
			else
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
				{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
				# This release doesn't handle bld.inf binary lines; no parsing here
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
				}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
		elsif ($keyword eq "testbinary")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
			if (scalar @operands == 1)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
				{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
				push @$binexpitems, shift @operands;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
				}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
			else
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
				{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
				# This release doesn't handle bld.inf binary lines; no parsing here
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
				}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
		elsif ($keyword eq "exports")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
			# This release doesn't handle bld.inf exports lines; no parsing here
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
		elsif ($keyword eq "testexports")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
			# This release doesn't handle bld.inf exports lines; no parsing here
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
		elsif ($keyword eq "export_file")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
			push @$binexpitems, $operands[1];
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
		elsif ($keyword eq "ipr")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
			# This release doesn't handle ipr lines; no parsing here
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
		else
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
			die "ERROR: In file '$fileName', command not understood in line: $line\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
		}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
	die "ERROR: Component not specified in file '$fileName'\n" unless defined($component);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
	die "ERROR: Notes_source not specified in file '$fileName'\n" unless defined($notes);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
	$self->{srcitems} = $srcitems;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
	$self->{component} = $component;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
	$self->{binexpitems} = $binexpitems;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
	$self->{notes} = $notes;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
	}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
sub GetComponent()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
	{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
	my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
	return $self->{component};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
	}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
sub GetSrcItems()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
	{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
	my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
	return $self->{srcitems};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
	}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
sub GetBinExpItems()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
	{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
	my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
	return $self->{binexpitems};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
	}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
sub GetNotes()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
	{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
	my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
	return $self->{notes};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
	}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
sub _SplitOnSpaces($)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
	{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
	my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
	my ($operands) = (@_);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
	
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
	# Break down operands
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
	my @operands = ();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
	my $operand = "";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
	my $first;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
	while ($operands =~ /\S/)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
		{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
		$operands =~ /^(\s*\S+)(\s+.*)?$/ or die "Semantic error (broken regexp)";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
		($first, $operands) = ($1, $2);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
		$operand .= $first;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
		$operand =~ s/^\s*//; # Remove preceding whitespace
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
		if (substr($operand,0,1) ne '"')
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
			# Not quoted
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
			push @operands, $operand;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
			$operand = "";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
		else
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
			{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
			# Quoted
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
			if (substr($operand,scalar($operand-1),1) eq '"')
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
				{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
				# Complete quoted operand
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
				$operand = substr ($operand, 1, scalar($operand-1));
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
				push @operands, $operand;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
				$operand = "";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
				}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
			# Else leave the operand to have the next word added
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
			}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
		}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
	if ($operand ne "")
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
		{
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
		die "ERROR: Missing end quote from '$operand'\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
		}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
	
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
	return @operands;	
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
	}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
=pod
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
readmrp - Simple parser for MRP fils
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
 use readmrp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
 my $mrpFile = '\someFolder\anMrpFile.mrp';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
 # Create an instance of a readmrp object
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
 my $mrp = new readmrp($mrpFile);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
 # Get data out
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
 my $name = $mrp->GetComponent();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
 my @srcitems = @{$mrp->GetSrcItems()};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
 my @binexpitems = @{$mrp->GetBinExpItems()};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
 my $notessrc = $mrp->GetNotes();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
This module is used to parse MRP files and to store the basic data.  It does not do any further processing of the data, and so it deliberately does not depend on the referenced files being present.  It records source statements, as well as simple binary statements and the target of export_file statements.  It ignores exports and complex binary statements, which refer to a group directory and would require further processing to determine their targets.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
=head1 METHODS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
=head2 New (mrpFile)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
Constructor.  Takes an MRP filename, and immediately parses it.  Dies if there is a syntax error in the MRP file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
=head2 GetComponent ()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   249
Returns the parsed component name.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
=head2 GetSrcItems ()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
Returns an array ref of the source paths of the 'source' statements in the MRP file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
=head2 GetBinExpItems ()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
Returns an array ref of the target paths of the simple 'binary' and 'export_file' statements in the MRP file.  It does not distringuish between binary files and exports.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
=head2 GetNotes ()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
Returns the path of the 'notes_source' file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
Copyright (c) 2004-2007 Symbian Software Ltd. All Rights Reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
=cut