summaryrefslogtreecommitdiff
path: root/lib/sbin/interface_parser.pl
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1998-11-30 16:02:30 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1998-11-30 16:02:30 +0000
commit3f3b7033ef7c05acd60efb561060efd12f393e31 (patch)
treea1e96213b20c749033d3c0e73d405d60abf7f245 /lib/sbin/interface_parser.pl
parentadb78bb339124dade1fa0511abd5bef4c9af375c (diff)
Finished get_implementation_ancestors
git-svn-id: http://svn.cactuscode.org/flesh/trunk@31 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/interface_parser.pl')
-rw-r--r--lib/sbin/interface_parser.pl40
1 files changed, 25 insertions, 15 deletions
diff --git a/lib/sbin/interface_parser.pl b/lib/sbin/interface_parser.pl
index 5fdf7904..fb5fd3ce 100644
--- a/lib/sbin/interface_parser.pl
+++ b/lib/sbin/interface_parser.pl
@@ -59,6 +59,7 @@ sub cross_index_interface_data
local(%interface_data);
local(%implementations);
local($implementation);
+ local(%ancestors);
@thorns = @indata[0..$n_thorns-1];
%interface_data = @indata[$n_thorns..$#indata];
@@ -84,9 +85,11 @@ sub cross_index_interface_data
&check_interface_consistency($implementation, %interface_data);
- $interface_data{"IMPLEMENTATION \U$implementation\E ANCESTORS"} = &get_implementation_ancestors($implementation, %interface_data);
+ %ancestors = &get_implementation_ancestors($implementation, 0, %interface_data);
+
+ $interface_data{"IMPLEMENTATION \U$implementation\E ANCESTORS"} = join(" ",( keys %ancestors));
- $interface_data{"IMPLEMENTATION \U$implementation\E FRIENDS"} = &get_implementation_friends($implementation, %interface_data);
+# $interface_data{"IMPLEMENTATION \U$implementation\E FRIENDS"} = &get_implementation_friends($implementation, %interface_data);
}
@@ -124,10 +127,22 @@ sub get_implementation_friends
sub get_implementation_ancestors
{
- local($implementation, %interface_data);
+ local($implementation, $n_ancestors, @indata) = @_;
+ local(%ancestors);
+ local(%interface_data);
local($thorn);
local($ancestor, $ancestors);
- local(%ancestors);
+
+ if($n_ancestors > 0)
+ {
+ %ancestors = @indata[0..2*$n_ancestors-1];
+ %interface_data = @indata[2*$n_ancestors..$#indata];
+ }
+ else
+ {
+ %ancestors = ();
+ %interface_data = @indata;
+ }
$interface_data{"IMPLEMENTATION \U$implementation\E THORNS"} =~ m:(\w+):;
@@ -136,19 +151,14 @@ sub get_implementation_ancestors
# Recurse. This needs to be made robust against loops.
foreach $ancestor (split(" ", $interface_data{"\U$thorn\E INHERITS"}))
{
- $ancestors .= &get_implementation_ancestors($ancestor, %interface_data);
- $ancestors .= "$ancestor ";
+ if(! $ancestors{"\U$ancestor\E"})
+ {
+ $ancestors{"\U$ancestor\E"} = 1;
+ %ancestors = &get_implementation_ancestors($ancestor, scalar(keys %ancestors), %ancestors,%interface_data);
+ }
}
- # Uniquify the list.
- foreach $ancestor (split(" ", $ancestors))
- {
- $ancestors{"\U$ancestor\E"} = 1;
- }
-
- $ancestors = join(" ", %ancestors);
-
- return $ancestors;
+ return %ancestors;
}
sub check_interface_consistency