1 |
#!/usr/local/bin/perl5
|
2 |
#
|
3 |
#
|
4 |
|
5 |
package Interface;
|
6 |
require Exporter;
|
7 |
require BuildFile;
|
8 |
@ISA = qw(Exporter);
|
9 |
@EXPORT = qw( GetClass $ClassDir $Class);
|
10 |
|
11 |
sub GetClass($dirname) {
|
12 |
my $dirname = shift;
|
13 |
$Class="DEFAULT";
|
14 |
$ClassDir="";
|
15 |
|
16 |
#return if $dirname eq "";
|
17 |
@DIRA=split /\//, $dirname;
|
18 |
|
19 |
$thispath=".";
|
20 |
# bootstrap from project buildfile if it exists
|
21 |
BuildFile::CheckBuildFile($ENV{projconfigdir});
|
22 |
|
23 |
my @ClassPaths=split /:/, $BuildFile::BlockClassPath;
|
24 |
foreach $BClassPath ( @ClassPaths ) {
|
25 |
next if ( $BClassPath eq "");
|
26 |
push @LoBCA, [ split /\//, $BClassPath ];
|
27 |
}
|
28 |
for ( $i=0; $i<=$#DIRA; $i++ ) {
|
29 |
$thispath=$thispath."/".$DIRA[$i];
|
30 |
if ( ($ClassName=BuildFile::CheckBuildFile($thispath)) ne "" ) {
|
31 |
$Class=$ClassName;
|
32 |
$ClassDir=$thispath;
|
33 |
}
|
34 |
# TODO --- Must test against position of last new BlockCaseA
|
35 |
# Need to reset array LoBCA to the New BlockPath
|
36 |
# - merge and replace options
|
37 |
#
|
38 |
else {
|
39 |
foreach $BlockClassA ( @LoBCA ) {
|
40 |
if ( $$BlockClassA[0]=~/^$DIRA[$i]\+/ ) {
|
41 |
$$BlockClassA[0]=~s/^$DIRA[$i]//;
|
42 |
}
|
43 |
if ( $$BlockClassA[0]=~/^\+/ ) {
|
44 |
($Class=$$BlockClassA[0])=~s/^\+//;
|
45 |
$ClassDir=$thispath;
|
46 |
shift @$BlockClassA;
|
47 |
}
|
48 |
else {
|
49 |
@$BlockClassA=();
|
50 |
}
|
51 |
}
|
52 |
}
|
53 |
}
|
54 |
$ClassDir=~s/^\.\///;
|
55 |
}
|