+\r
+\r
+void Parameters::loadSources() throw(Exception) {\r
+\r
+ for(int i=0;i<sourcePathes.size();i++) {\r
+ cout << "analyzing " << qPrintable(sourcePathes.at(i)) << endl;\r
+ QDir dir(sourcePathes.at(i));\r
+ QStringList filter;\r
+ filter << "*.vhd" << "*.ngc";\r
+ dir.setNameFilters(filter);\r
+ QStringList list = dir.entryList();\r
+ for(int j=0;j<list.size();j++) {\r
+ QString fileName = dir.absolutePath();\r
+ fileName.append("/"+list.at(j));\r
+\r
+ if (list.at(j).endsWith(".ngc")) {\r
+ QString netName = list.at(j);\r
+ netName.truncate(list.at(j).size() -4);\r
+ cout << "found netlist " << qPrintable(netName) << endl;\r
+ availableResources.append(new ExternalResource(netName,fileName,ExternalResource::Netlist));\r
+ }\r
+ else {\r
+ cout << "parsing " << qPrintable(fileName) << " ... ";\r
+ QFile srcXML(fileName);\r
+ if (!srcXML.open(QIODevice::ReadOnly)) {\r
+ throw(Exception(IMPLFILE_NOACCESS));\r
+ }\r
+ QTextStream in(&srcXML);\r
+\r
+ QString line = in.readLine();\r
+ while (!line.isNull()) {\r
+ if (line.contains("package", Qt::CaseInsensitive)) {\r
+ QRegularExpression rxPack("^package (.+) is$",QRegularExpression::CaseInsensitiveOption);\r
+ QRegularExpressionMatch matchPack = rxPack.match(line);\r
+ if (matchPack.hasMatch()) {\r
+ QString packName = matchPack.captured(1);\r
+ cout << "found package " << qPrintable(packName) << endl;\r
+ availableResources.append(new ExternalResource(packName,fileName,ExternalResource::Package));\r
+ }\r
+ }\r
+ else if (line.contains("entity", Qt::CaseInsensitive)) {\r
+ QRegularExpression rxEnt("^entity (.+) is$",QRegularExpression::CaseInsensitiveOption);\r
+ QRegularExpressionMatch matchEnt = rxEnt.match(line);\r
+ if (matchEnt.hasMatch()) {\r
+ QString entityName = matchEnt.captured(1);\r
+ cout << "found entity " << qPrintable(entityName) << endl;\r
+ availableResources.append(new ExternalResource(entityName,fileName,ExternalResource::Code));\r
+ }\r
+ }\r
+ line = in.readLine();\r
+ }\r
+ srcXML.close();\r
+ cout << "OK" << endl;\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+QList<ExternalResource *> Parameters::searchResourceByName(const QString& name) {\r
+ QList<ExternalResource*> listRes;\r
+ foreach(ExternalResource* s, availableResources) {\r
+ if (s->getName() == name) {\r
+ listRes.append(s);\r
+ }\r
+ }\r
+ return listRes;\r
+}\r
+\r