From 303f057de13c20cf8a832f5e4ebac9be9150a89a Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Wed, 13 Apr 2011 19:55:18 -0700 Subject: [PATCH] Support collecting ALL component declarations from a used scope. --- vhdlpp/library.cc | 2 +- vhdlpp/parse.y | 2 ++ vhdlpp/scope.cc | 10 ++++++++++ vhdlpp/scope.h | 3 +++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/vhdlpp/library.cc b/vhdlpp/library.cc index 6b4f13a85..cbed2db2d 100644 --- a/vhdlpp/library.cc +++ b/vhdlpp/library.cc @@ -91,7 +91,7 @@ void library_use(const YYLTYPE&loc, struct library_results&res, // results into the "res" members. if (use_name == "all") { - sorrymsg(loc, "Don't support all from package\n"); + pack->collect_components(res.components); return; } diff --git a/vhdlpp/parse.y b/vhdlpp/parse.y index eb2dbb405..dfb814413 100644 --- a/vhdlpp/parse.y +++ b/vhdlpp/parse.y @@ -982,11 +982,13 @@ selected_name_use : IDENTIFIER '.' K_all { struct library_results res; library_use(@1, res, 0, $1, 0); + collect_library_results(res); delete[]$1; } | IDENTIFIER '.' IDENTIFIER '.' K_all { struct library_results res; library_use(@1, res, $1, $3, 0); + collect_library_results(res); delete[]$1; delete[]$3; } diff --git a/vhdlpp/scope.cc b/vhdlpp/scope.cc index e25b429af..edf0b49d7 100644 --- a/vhdlpp/scope.cc +++ b/vhdlpp/scope.cc @@ -38,3 +38,13 @@ ComponentBase* Scope::find_component(perm_string by_name) else return cur->second; } + +void Scope::collect_components(list&res) +{ + for (map::const_iterator cur = components_.begin() + ; cur != components_.end() ; ++cur) { + if (cur->second == 0) + continue; + res.push_back(cur->second); + } +} diff --git a/vhdlpp/scope.h b/vhdlpp/scope.h index 93be0c192..fce58536b 100644 --- a/vhdlpp/scope.h +++ b/vhdlpp/scope.h @@ -19,6 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ +# include # include # include "StringHeap.h" @@ -33,6 +34,8 @@ class Scope { ComponentBase* find_component(perm_string by_name); + void collect_components(std::list&res); + void dump_scope(ostream&out) const; private: