sbsv1/abld/genutil/modload.pm
author Zheng Shen <zheng.shen@nokia.com>
Tue, 20 Jul 2010 15:02:28 +0800
changeset 617 3a747a240983
parent 599 fa7a3cc6effd
permissions -rw-r--r--
ROM Tools 12.2.0.4 Postlinker 2.2.5 Revert package_definition.xml to changeset 360bd6b35136
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
# Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
# Runtime module-loading routine for loading e32tools modules into 'main' module
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
# 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
package Modload;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
require Exporter;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
@ISA=qw(Exporter);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
@EXPORT=qw(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
	Load_SetVerbose
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
	Load_SetModulePath
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
	Load_ModuleL
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
use Pathutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
my %Mode=(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
	Verbose=>0
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
my $ModulePath;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
sub Load_SetVerbose () {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
	$Mode{Verbose}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
sub Load_SetModulePath ($) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
	$ModulePath=$_[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
sub Load_ModuleL (@) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
# Loads a module into the 'main' package, including all the functions the module defines for export
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
	my @ModBaseList=@_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
	my $ModBase;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
	foreach $ModBase (@ModBaseList) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
		$ModBase=uc $ModBase;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
		die "ERROR: Can't load \"$ModulePath$ModBase.PM\"\n" unless -e "$ModulePath$ModBase.PM";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
		if ($Mode{Verbose}) {
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
			print "Loading Module: \"",$ModBase,".PM\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
		package main;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
		require $ModBase.".PM" or die "ERROR: Can't load function from \"$ModulePath$ModBase.PM\"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
		my $Package=ucfirst lc $ModBase;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
		$Package->import;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
1;