X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/e45bacc6bd342a1b19e42b62133ddabc99aa9edd..14cd6d834ab531525a51c6a6992583b3e9143e02:/Parameters.cpp?ds=sidebyside

diff --git a/Parameters.cpp b/Parameters.cpp
index c903f5d..2ee6255 100644
--- a/Parameters.cpp
+++ b/Parameters.cpp
@@ -836,7 +836,7 @@ void Parameters::loadImplementationsFromXml() throw(Exception) {
       if (compList != "none") {
         QStringList compos = compList.split(",");
         foreach(QString s, compos) {
-          impl->addSource(s);
+          impl->addResource(s);
         }
       }
 
@@ -949,54 +949,64 @@ void Parameters::loadSources() throw(Exception) {
     cout << "analyzing " << qPrintable(sourcePathes.at(i)) << endl;
     QDir dir(sourcePathes.at(i));
     QStringList filter;
-    filter << "*.vhd";
+    filter << "*.vhd" << "*.ngc";
     dir.setNameFilters(filter);
     QStringList list = dir.entryList();
     for(int j=0;j<list.size();j++) {
       QString fileName = dir.absolutePath();
       fileName.append("/"+list.at(j));
 
-      cout << "parsing " << qPrintable(fileName) << " ... ";
-      QFile srcXML(fileName);
-      if (!srcXML.open(QIODevice::ReadOnly)) {
-        throw(Exception(IMPLFILE_NOACCESS));
+      if (list.at(j).endsWith(".ngc")) {
+        QString netName = list.at(j);
+        netName.truncate(list.at(j).size() -4);
+        cout << "found netlist " << qPrintable(netName) << endl;
+        availableResources.append(new ExternalResource(netName,fileName,ExternalResource::Netlist));
       }
-      QTextStream in(&srcXML);
-
-      QString line = in.readLine();
-      while (!line.isNull()) {
-        if (line.contains("package", Qt::CaseInsensitive)) {
-          QRegularExpression rxPack("^package (.+) is$",QRegularExpression::CaseInsensitiveOption);
-          QRegularExpressionMatch matchPack = rxPack.match(line);
-          if (matchPack.hasMatch()) {
-            QString packName = matchPack.captured(1);
-            cout << "found package " << qPrintable(packName) << endl;
-            availableSources.append(new ExternalSource(packName,fileName,ExternalSource::Package));
-          }
+      else {
+        cout << "parsing " << qPrintable(fileName) << " ... ";
+        QFile srcXML(fileName);
+        if (!srcXML.open(QIODevice::ReadOnly)) {
+          throw(Exception(IMPLFILE_NOACCESS));
         }
-        else if (line.contains("entity", Qt::CaseInsensitive)) {
-          QRegularExpression rxEnt("^entity (.+) is$",QRegularExpression::CaseInsensitiveOption);
-          QRegularExpressionMatch matchEnt = rxEnt.match(line);
-          if (matchEnt.hasMatch()) {
-            QString entityName = matchEnt.captured(1);
-            cout << "found entity " << qPrintable(entityName) << endl;
-            availableSources.append(new ExternalSource(entityName,fileName,ExternalSource::Code));
+        QTextStream in(&srcXML);
+
+        QString line = in.readLine();
+        while (!line.isNull()) {
+          if (line.contains("package", Qt::CaseInsensitive)) {
+            QRegularExpression rxPack("^package (.+) is$",QRegularExpression::CaseInsensitiveOption);
+            QRegularExpressionMatch matchPack = rxPack.match(line);
+            if (matchPack.hasMatch()) {
+              QString packName = matchPack.captured(1);
+              cout << "found package " << qPrintable(packName) << endl;
+              availableResources.append(new ExternalResource(packName,fileName,ExternalResource::Package));
+            }
+          }
+          else if (line.contains("entity", Qt::CaseInsensitive)) {
+            QRegularExpression rxEnt("^entity (.+) is$",QRegularExpression::CaseInsensitiveOption);
+            QRegularExpressionMatch matchEnt = rxEnt.match(line);
+            if (matchEnt.hasMatch()) {
+              QString entityName = matchEnt.captured(1);
+              cout << "found entity " << qPrintable(entityName) << endl;
+              availableResources.append(new ExternalResource(entityName,fileName,ExternalResource::Code));
+            }
           }
+          line = in.readLine();
         }
-        line = in.readLine();
+        srcXML.close();
+        cout << "OK" << endl;
       }
-      srcXML.close();
-      cout << "OK" << endl;
-
     }
   }
 }
 
-ExternalSource* Parameters::searchSourceByName(const QString& name) {
-  foreach(ExternalSource* s, availableSources) {
-    if (s->getName() == name) return s;
+QList<ExternalResource *> Parameters::searchResourceByName(const QString& name) {
+  QList<ExternalResource*> listRes;
+  foreach(ExternalResource* s, availableResources) {
+    if (s->getName() == name) {
+      listRes.append(s);
+    }
   }
-  return NULL;
+  return listRes;
 }
 
 void Parameters::addAvailableBlock(ReferenceBlock *block) {