diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1998-11-30 18:46:48 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1998-11-30 18:46:48 +0000 |
commit | 2ef23ec2077d7ca1ba53a3605d6fbf5e8d0982d6 (patch) | |
tree | b9aabea1fdeff4bb0f2c20c0df07c07422453bbb /lib/sbin/interface_parser.pl | |
parent | 3f3b7033ef7c05acd60efb561060efd12f393e31 (diff) |
Some more stuff on friends.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@32 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/interface_parser.pl')
-rw-r--r-- | lib/sbin/interface_parser.pl | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/lib/sbin/interface_parser.pl b/lib/sbin/interface_parser.pl index fb5fd3ce..b10d6967 100644 --- a/lib/sbin/interface_parser.pl +++ b/lib/sbin/interface_parser.pl @@ -60,6 +60,7 @@ sub cross_index_interface_data local(%implementations); local($implementation); local(%ancestors); + local(%friends); @thorns = @indata[0..$n_thorns-1]; %interface_data = @indata[$n_thorns..$#indata]; @@ -72,7 +73,7 @@ sub cross_index_interface_data die "Thorn $thorn doesn't specify an implementation.\n"; } - $interface_data{"IMPLEMENTATION \U$implementation\E THORNS"} .= " $thorn"; + $interface_data{"IMPLEMENTATION \U$implementation\E THORNS"} .= "$thorn "; $implementations{"\U$implementation\E"} = "$implementation"; } @@ -89,8 +90,6 @@ sub cross_index_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); - } return %interface_data; @@ -98,31 +97,42 @@ sub cross_index_interface_data sub get_implementation_friends { - local($implementation, %interface_data); + local($implementation, $n_friends, @indata) = @_; + local(%friends); + local(%interface_data); local($thorn); local($friend, $friends); - local(%ancestors); + local($friends_of_me); + local($other_implementation); + + if($n_friends > 0) + { + %friends = @indata[0..2*$n_friends-1]; + %interface_data = @indata[2*$n_friends..$#indata]; + } + else + { + %friends = (); + %interface_data = @indata; + } $interface_data{"IMPLEMENTATION \U$implementation\E THORNS"} =~ m:(\w+):; $thorn = $1; - # 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 "; - } - # Uniquify the list. - foreach $ancestor (split(" ", $ancestors)) + # Recurse + foreach $friend (split(" ", $interface_data{"\U$thorn\E FRIEND"})) { - $ancestors{"\U$ancestor\E"} = 1; + if(! $friends{"\U$friend\E"}) + { + $friends{"\U$friend\E"} = 1; + %friends = &get_implementation_friends($friend, scalar(keys %friends), %friends,%interface_data); + } } + + return %friends; - $ancestors = join(" ", %ancestors); - - return $ancestors; } sub get_implementation_ancestors @@ -148,7 +158,7 @@ sub get_implementation_ancestors $thorn = $1; - # Recurse. This needs to be made robust against loops. + # Recurse. foreach $ancestor (split(" ", $interface_data{"\U$thorn\E INHERITS"})) { if(! $ancestors{"\U$ancestor\E"}) |