Add some implicit support for std and textio libraries

Patch submitted by Fabrizio Ferrandi.
This commit is contained in:
Stephen Williams 2014-12-18 08:20:19 -08:00
parent c8255952a3
commit 6fd10dedb6
1 changed files with 23 additions and 0 deletions

View File

@ -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<perm_string>*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);