diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index d536a03ef0f..45fb093df23 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -1735,7 +1735,7 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun expands.insert(QLatin1String("first"), E_FIRST); expands.insert(QLatin1String("last"), E_LAST); expands.insert(QLatin1String("cat"), E_CAT); - expands.insert(QLatin1String("fromfile"), E_FROMFILE); // implementation disabled (see comment below) + expands.insert(QLatin1String("fromfile"), E_FROMFILE); expands.insert(QLatin1String("eval"), E_EVAL); expands.insert(QLatin1String("list"), E_LIST); expands.insert(QLatin1String("sprintf"), E_SPRINTF); @@ -1923,33 +1923,18 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun } } break; -#if 0 // Used only by Qt's configure for caching case E_FROMFILE: if (args.count() != 2) { logMessage(format("fromfile(file, variable) requires two arguments.")); } else { - QString file = args[0], seek_variableName = args[1]; - - ProFile pro(fixPathToLocalOS(file)); - - ProFileEvaluator visitor; - visitor.setVerbose(m_verbose); - visitor.setCumulative(m_cumulative); - - if (!visitor.queryProFile(&pro)) - break; - - if (!visitor.accept(&pro)) - break; - - ret = visitor.values(seek_variableName); + QHash vars; + if (evaluateFileInto(args.at(0), &vars, 0)) + ret = vars.value(args.at(1)); } break; -#endif case E_EVAL: if (args.count() != 1) { logMessage(format("eval(variable) requires one argument")); - } else { ret += values(args.at(0)); } @@ -2251,8 +2236,22 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction( m_filevaluemap.value(currentProFile()).value(args[0]); } return ProItem::ReturnTrue; -#if 0 case T_INFILE: + if (args.count() < 2 || args.count() > 3) { + logMessage(format("infile(file, var, [values]) requires two or three arguments.")); + } else { + QHash vars; + if (!evaluateFileInto(args.at(0), &vars, 0)) + return ProItem::ReturnFalse; + if (args.count() == 2) + return returnBool(vars.contains(args.at(1))); + QRegExp regx(args.at(2)); + foreach (const QString &s, vars.value(args.at(1))) + if (s == regx.pattern() || regx.exactMatch(s)) + return ProItem::ReturnTrue; + } + return ProItem::ReturnFalse; +#if 0 case T_REQUIRES: case T_EVAL: #endif