From adb78bb339124dade1fa0511abd5bef4c9af375c Mon Sep 17 00:00:00 2001 From: goodale Date: Mon, 30 Nov 1998 09:28:57 +0000 Subject: Synchronsiing laptop with repository. git-svn-id: http://svn.cactuscode.org/flesh/trunk@30 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/sbin/interface_parser.pl | 62 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) (limited to 'lib') diff --git a/lib/sbin/interface_parser.pl b/lib/sbin/interface_parser.pl index 9611563c..5fdf7904 100644 --- a/lib/sbin/interface_parser.pl +++ b/lib/sbin/interface_parser.pl @@ -83,11 +83,73 @@ sub cross_index_interface_data $interface_data{"IMPLEMENTATIONS"} .= $implementations{"\U$implementation\E"} . " "; &check_interface_consistency($implementation, %interface_data); + + $interface_data{"IMPLEMENTATION \U$implementation\E ANCESTORS"} = &get_implementation_ancestors($implementation, %interface_data); + + $interface_data{"IMPLEMENTATION \U$implementation\E FRIENDS"} = &get_implementation_friends($implementation, %interface_data); + } + return %interface_data; +} + +sub get_implementation_friends +{ + local($implementation, %interface_data); + local($thorn); + local($friend, $friends); + local(%ancestors); + + $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)) + { + $ancestors{"\U$ancestor\E"} = 1; + } + + $ancestors = join(" ", %ancestors); + + return $ancestors; } +sub get_implementation_ancestors +{ + local($implementation, %interface_data); + local($thorn); + local($ancestor, $ancestors); + local(%ancestors); + + $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)) + { + $ancestors{"\U$ancestor\E"} = 1; + } + + $ancestors = join(" ", %ancestors); + + return $ancestors; +} sub check_interface_consistency { -- cgit v1.2.3