diff --git a/src/doc/doc/about/about_libraries.xml b/src/doc/doc/about/about_libraries.xml index a3b9fb8c6..c41e52844 100644 --- a/src/doc/doc/about/about_libraries.xml +++ b/src/doc/doc/about/about_libraries.xml @@ -253,6 +253,15 @@ define("B", "b.gds"); +
  • + +

    description: Specifies a description for that library. +

    + +
    define("A", "a.gds", description="Library A");
    + +
  • + diff --git a/src/lay/lay/layLibraryController.cc b/src/lay/lay/layLibraryController.cc index 4b668fbdc..a95b5da3e 100644 --- a/src/lay/lay/layLibraryController.cc +++ b/src/lay/lay/layLibraryController.cc @@ -320,6 +320,7 @@ public: for (auto k = kwargs->begin (); k != kwargs->end (); ++k) { static const std::string replicate_key ("replicate"); + static const std::string description_key ("description"); static const std::string technology_key ("technology"); static const std::string technologies_key ("technologies"); @@ -327,6 +328,10 @@ public: fi.replicate = k->second.to_bool (); + } else if (k->first == description_key) { + + fi.description = k->second.to_string (); + } else if (k->first == technology_key) { fi.tech.clear (); @@ -465,6 +470,7 @@ LibraryController::read_libs (const std::vector std::unique_ptr lib (new db::FileBasedLibrary (lib_path, im->name)); lib->set_technologies (im->tech); + lib->set_description (im->description); lib->set_replicate (im->replicate); tl::log << "Reading library '" << lib_path << "'"; @@ -493,6 +499,7 @@ LibraryController::read_libs (const std::vector LibInfo li; li.name = libname; li.time = fi.lastModified (); + li.description = im->description; li.tech = im->tech; li.replicate = im->replicate; new_lib_files.insert (std::make_pair (lib_path, li)); diff --git a/src/lay/lay/layLibraryController.h b/src/lay/lay/layLibraryController.h index 54c345a02..0fd26634e 100644 --- a/src/lay/lay/layLibraryController.h +++ b/src/lay/lay/layLibraryController.h @@ -61,6 +61,7 @@ public: { LibFileInfo () : name (), path (), replicate (true) { } std::string name; + std::string description; std::string path; std::set tech; bool replicate; @@ -135,8 +136,9 @@ private slots: private: struct LibInfo { - LibInfo () : name (), time (), tech (), replicate (true) { } + LibInfo () : name (), description (), time (), tech (), replicate (true) { } std::string name; + std::string description; QDateTime time; std::set tech; bool replicate; diff --git a/src/lay/unit_tests/layLibraryControllerTests.cc b/src/lay/unit_tests/layLibraryControllerTests.cc index b5785dcfa..782f19ef7 100644 --- a/src/lay/unit_tests/layLibraryControllerTests.cc +++ b/src/lay/unit_tests/layLibraryControllerTests.cc @@ -37,11 +37,13 @@ TEST (1) EXPECT_EQ (file_info[0].name, ""); EXPECT_EQ (file_info[0].path, tl::combine_path (tl::absolute_path (lib_file), "noname.gds")); EXPECT_EQ (file_info[0].replicate, true); + EXPECT_EQ (file_info[0].description, ""); EXPECT_EQ (tl::join (file_info[0].tech.begin (), file_info[0].tech.end (), ","), "T1"); EXPECT_EQ (file_info[1].name, "L2"); EXPECT_EQ (file_info[1].path, tl::absolute_file_path (lib_file) + ".zzz"); EXPECT_EQ (file_info[1].replicate, true); + EXPECT_EQ (file_info[1].description, "Library L2"); EXPECT_EQ (file_info[1].tech.size (), size_t (0)); EXPECT_EQ (file_info[2].name, "L3"); diff --git a/testdata/lay/a.libdef b/testdata/lay/a.libdef index ff4bc56af..98d5b756e 100644 --- a/testdata/lay/a.libdef +++ b/testdata/lay/a.libdef @@ -1,6 +1,6 @@ # A comment define("noname.gds"); -define("L2", file + ".zzz", technology = ""); +define("L2", file + ".zzz", technology = "", description = "Library L2"); define("L3", "subdir/l3.gds", technologies = [ "T2", "T3" ], replicate = false);