+QString VHDLConverter::skipBlankAndComments(QTextStream &in) {\r
+ \r
+ QString line = "";\r
+ \r
+ // skipping blank/comment lines \r
+ while ( (line.isEmpty()) || ((line.at(0) == '-') && (line.at(1) == '-')) ) {\r
+ if (in.atEnd()) {\r
+ return "";\r
+ }\r
+ line = in.readLine();\r
+ if (!line.isEmpty()) line = line.trimmed();\r
+ } \r
+ return line;\r
+}\r
+\r
+void VHDLConverter::readLibraries(QTextStream &in) throw(Exception) {\r
+ \r
+ QRegularExpression rxLib("^library[\\s\\t]*(.+);$",QRegularExpression::CaseInsensitiveOption);\r
+ QRegularExpression rxPack("^use[\\s\\t]*([^.]+)[.](.+);$",QRegularExpression::CaseInsensitiveOption);\r
+ QString line = "";\r
+ \r
+ line = skipBlankAndComments(in);\r
+ if (line == "") {\r
+ throw(Exception(VHDLFILE_CORRUPTED));\r
+ } \r
+ \r
+ while (! line.contains("entity",Qt::CaseInsensitive)) {\r
+ \r
+ QRegularExpressionMatch matchLib = rxLib.match(line);\r
+ QRegularExpressionMatch matchPack = rxPack.match(line);\r
+ \r
+ if (matchLib.hasMatch()) {\r
+ \r
+ QString libName = matchLib.captured(1);\r
+ libName = libName.toLower();\r
+ \r
+ cout << "matching library: " << qPrintable(libName) << endl; \r
+ \r
+ if (!packages.contains(libName)) { \r
+ packages.insert(libName,new QList<QString>()); \r
+ } \r
+ }\r
+ else if (matchPack.hasMatch()) {\r
+ cout << "matching packages" << endl;\r
+ \r
+ QString libName = matchPack.captured(1);\r
+ QString packName = matchPack.captured(2); \r
+ \r
+ libName = libName.toLower();\r
+ packName = packName.toLower(); \r
+ \r
+ if (libName == "work") {\r
+ if (!packages.contains("work")) {\r
+ packages.insert("work",new QList<QString>());\r
+ }\r
+ }\r
+ else if (libName == "std") {\r
+ if (!packages.contains("std")) {\r
+ packages.insert("std",new QList<QString>());\r
+ }\r
+ }\r
+ else if (!packages.contains(libName)) throw(Exception(VHDLFILE_CORRUPTED));\r
+ \r
+ QList<QString>* lstPack = packages.value(libName);\r
+ QString s = libName + "." + packName; \r
+ lstPack->append(s);\r
+ cout << qPrintable(s) << endl;\r
+ \r
+ }\r
+ \r
+ line = skipBlankAndComments(in);\r
+ if (line == "") {\r
+ throw(Exception(VHDLFILE_CORRUPTED));\r
+ }\r
+ cout << "read line = " << qPrintable(line) << endl;\r
+ }\r
+}\r
+\r
+void VHDLConverter::readEntity(QTextStream &in) throw(Exception) {\r
+ \r
+}\r
+\r
+void VHDLConverter::readGenerics(QTextStream &in) throw(Exception) {\r
+ \r
+}\r
+\r
+void VHDLConverter::readPorts(QTextStream &in) throw(Exception) {\r
+ \r
+}\r
+\r
+void VHDLConverter::readArchitecture(QTextStream &in) throw(Exception) {\r
+ \r
+}\r
+\r