1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-21 02:37:16 +01:00

see #2556 "PF import:

impor of rules referring to undefined macros". Importer displays
warnings for all undefined macros found in the file, even if there
are several.
This commit is contained in:
Vadim Kurland 2011-07-08 11:45:42 -07:00
parent a440400b9e
commit ea03c38e99
2 changed files with 17 additions and 8 deletions

View File

@ -1,5 +1,10 @@
2011-07-08 vadim <vadim@netcitadel.com>
* PFImporterRun.cpp (substituteMacros): see #2556 "PF import:
impor of rules referring to undefined macros". Importer displays
warnings for all undefined macros found in the file, even if there
are several.
* objectSignature.cpp: fixes #2559 "Crash on import when at least
one DynamicGroup object already exists in the object tree."

View File

@ -260,7 +260,7 @@ void PFImporter::substituteMacros(const QMap<QString,QString> &macros,
{
// make several passes: sometimes macros can use other macros
QRegExp any_macro_instance("\\$(\\w+)\\W");
QSet<QString> undefined_macros;
for (;;)
{
QMapIterator<QString, QString> it(macros);
@ -275,18 +275,22 @@ void PFImporter::substituteMacros(const QMap<QString,QString> &macros,
}
bool has_known_macros = false;
if (any_macro_instance.indexIn(buffer) != -1)
int idx = 0;
while ((idx = buffer.indexOf(any_macro_instance, idx)) != -1)
{
QString macro_name = any_macro_instance.cap(1);
if (macros.contains(macro_name)) has_known_macros = true;
else
{
QString err;
err = QObject::tr("Warning: Macro %1 is undefined").arg(macro_name);
*logger << err.toUtf8().constData();
}
else undefined_macros.insert(macro_name);
idx++;
}
if (!has_known_macros) break;
}
foreach(QString macro_name, undefined_macros)
{
QString err;
err = QObject::tr("Warning: Macro %1 is undefined").arg(macro_name);
*logger << err.toUtf8().constData();
}
}