From 6fd10dedb6c96486101e07e53fb76310fab23a7c Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Thu, 18 Dec 2014 08:20:19 -0800 Subject: [PATCH] Add some implicit support for std and textio libraries Patch submitted by Fabrizio Ferrandi. --- vhdlpp/library.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/vhdlpp/library.cc b/vhdlpp/library.cc index 52943156e..3ed27b0e2 100644 --- a/vhdlpp/library.cc +++ b/vhdlpp/library.cc @@ -108,6 +108,7 @@ static string make_library_package_path(perm_string lib_name, perm_string name) static void import_ieee(void); static void import_ieee_use(ActiveScope*res, perm_string package, perm_string name); +static void import_std_use(const YYLTYPE&loc, ActiveScope*res, perm_string package, perm_string name); static void dump_library_package(ostream&file, perm_string lname, perm_string pname, Package*pack) { @@ -211,6 +212,9 @@ void library_import(const YYLTYPE&loc, const std::list*names) // The ieee library is special and handled by an // internal function. import_ieee(); + } else if (*cur == "std") { + // The std library is always implicitly imported. + } else if (*cur == "work") { // The work library is always implicitly imported. @@ -238,6 +242,11 @@ void library_use(const YYLTYPE&loc, ActiveScope*res, import_ieee_use(res, use_package, use_name); return; } + // Special case handling for the STD library. + if (use_library == "std") { + import_std_use(loc, res, use_package, use_name); + return; + } struct library_contents&lib = libraries[use_library]; Package*pack = lib.packages[use_package]; @@ -361,6 +370,20 @@ static void import_ieee_use(ActiveScope*res, perm_string package, perm_string na } } +static void import_std_use(const YYLTYPE&loc, ActiveScope*/*res*/, perm_string package, perm_string name) +{ + if (package == "standard") { + // do nothing + return; + } else if (package == "textio") { + cerr << "warning: textio package not really supported" << endl; + return; + } else { + sorrymsg(loc, "package %s of library %s not yet supported", package.str(), name.str()); + return; + } +} + const VTypePrimitive primitive_BOOLEAN(VTypePrimitive::BOOLEAN, true); const VTypePrimitive primitive_BIT(VTypePrimitive::BIT, true); const VTypePrimitive primitive_INTEGER(VTypePrimitive::INTEGER);