forked from qt-creator/qt-creator
make the qmake option object a proper member
to be able to share the option object among evaluators, it is passed by pointer. only field_sep stays static and becomes a string - that's effectively just a cache to avoid repeated construction.
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
using namespace Qt4ProjectManager;
|
using namespace Qt4ProjectManager;
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
|
|
||||||
ProFileReader::ProFileReader()
|
ProFileReader::ProFileReader() : ProFileEvaluator(&m_option)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
QMap<QString, ProFile *> m_includeFiles;
|
QMap<QString, ProFile *> m_includeFiles;
|
||||||
QList<ProFile *> m_proFiles;
|
QList<ProFile *> m_proFiles;
|
||||||
|
ProFileEvaluator::Option m_option;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -82,20 +82,31 @@ namespace {
|
|||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if defined(Q_OS_WIN32)
|
ProFileEvaluator::Option::Option()
|
||||||
ProFileEvaluator::Option::TARG_MODE ProFileEvaluator::Option::target_mode = ProFileEvaluator::Option::TARG_WIN_MODE;
|
{
|
||||||
#elif defined(Q_OS_MAC)
|
#ifdef Q_OS_WIN
|
||||||
ProFileEvaluator::Option::TARG_MODE ProFileEvaluator::Option::target_mode = ProFileEvaluator::Option::TARG_MACX_MODE;
|
dirlist_sep = QLatin1Char(';');
|
||||||
#elif defined(Q_OS_QNX6)
|
dir_sep = QLatin1Char('\\');
|
||||||
ProFileEvaluator::Option::TARG_MODE ProFileEvaluator::Option::target_mode = ProFileEvaluator::Option::TARG_QNX6_MODE;
|
|
||||||
#else
|
#else
|
||||||
ProFileEvaluator::Option::TARG_MODE ProFileEvaluator::Option::target_mode = ProFileEvaluator::Option::TARG_UNIX_MODE;
|
dirlist_sep = QLatin1Char(':');
|
||||||
|
dir_sep = QLatin1Char('/');
|
||||||
|
#endif
|
||||||
|
qmakespec = QString::fromLatin1(qgetenv("QMAKESPEC").data());
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN32)
|
||||||
|
target_mode = TARG_WIN_MODE;
|
||||||
|
#elif defined(Q_OS_MAC)
|
||||||
|
target_mode = TARG_MACX_MODE;
|
||||||
|
#elif defined(Q_OS_QNX6)
|
||||||
|
target_mode = TARG_QNX6_MODE;
|
||||||
|
#else
|
||||||
|
target_mode = TARG_UNIX_MODE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString ProFileEvaluator::Option::qmakespec;
|
field_sep = QLatin1String(" ");
|
||||||
QString ProFileEvaluator::Option::dirlist_sep;
|
}
|
||||||
QString ProFileEvaluator::Option::dir_sep;
|
|
||||||
QChar ProFileEvaluator::Option::field_sep;
|
QString ProFileEvaluator::Option::field_sep;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -106,7 +117,7 @@ QChar ProFileEvaluator::Option::field_sep;
|
|||||||
class ProFileEvaluator::Private : public AbstractProItemVisitor
|
class ProFileEvaluator::Private : public AbstractProItemVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private(ProFileEvaluator *q_);
|
Private(ProFileEvaluator *q_, ProFileEvaluator::Option *option);
|
||||||
|
|
||||||
ProFileEvaluator *q;
|
ProFileEvaluator *q;
|
||||||
int m_lineNo; // Error reporting
|
int m_lineNo; // Error reporting
|
||||||
@@ -160,6 +171,8 @@ public:
|
|||||||
const ProFile *pro) const;
|
const ProFile *pro) const;
|
||||||
QString propertyValue(const QString &val) const;
|
QString propertyValue(const QString &val) const;
|
||||||
|
|
||||||
|
QStringList split_value_list(const QString &vals, bool do_semicolon = false);
|
||||||
|
QStringList split_arg_list(const QString ¶ms);
|
||||||
bool isActiveConfig(const QString &config, bool regex = false);
|
bool isActiveConfig(const QString &config, bool regex = false);
|
||||||
QStringList expandVariableReferences(const QString &value);
|
QStringList expandVariableReferences(const QString &value);
|
||||||
void doVariableReplace(QString *str);
|
void doVariableReplace(QString *str);
|
||||||
@@ -179,7 +192,8 @@ public:
|
|||||||
|
|
||||||
QStringList evaluateFunction(ProBlock *funcPtr, const QStringList &argumentsList, bool *ok);
|
QStringList evaluateFunction(ProBlock *funcPtr, const QStringList &argumentsList, bool *ok);
|
||||||
|
|
||||||
QStringList qmakeFeaturePaths();
|
QStringList qmakeMkspecPaths() const;
|
||||||
|
QStringList qmakeFeaturePaths() const;
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
bool condition;
|
bool condition;
|
||||||
@@ -216,6 +230,8 @@ public:
|
|||||||
QStringList m_addUserConfigCmdArgs;
|
QStringList m_addUserConfigCmdArgs;
|
||||||
QStringList m_removeUserConfigCmdArgs;
|
QStringList m_removeUserConfigCmdArgs;
|
||||||
bool m_parsePreAndPostFiles;
|
bool m_parsePreAndPostFiles;
|
||||||
|
|
||||||
|
Option *m_option;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
|
#if !defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
|
||||||
@@ -223,8 +239,8 @@ Q_DECLARE_TYPEINFO(ProFileEvaluator::Private::State, Q_PRIMITIVE_TYPE);
|
|||||||
Q_DECLARE_TYPEINFO(ProFileEvaluator::Private::ProLoop, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(ProFileEvaluator::Private::ProLoop, Q_MOVABLE_TYPE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ProFileEvaluator::Private::Private(ProFileEvaluator *q_)
|
ProFileEvaluator::Private::Private(ProFileEvaluator *q_, ProFileEvaluator::Option *option)
|
||||||
: q(q_)
|
: q(q_), m_option(option)
|
||||||
{
|
{
|
||||||
// Configuration, more or less
|
// Configuration, more or less
|
||||||
m_verbose = true;
|
m_verbose = true;
|
||||||
@@ -586,7 +602,7 @@ void ProFileEvaluator::Private::updateItem()
|
|||||||
|
|
||||||
//////// Evaluator tools /////////
|
//////// Evaluator tools /////////
|
||||||
|
|
||||||
static QStringList split_arg_list(QString params)
|
QStringList ProFileEvaluator::Private::split_arg_list(const QString ¶ms)
|
||||||
{
|
{
|
||||||
int quote = 0;
|
int quote = 0;
|
||||||
QStringList args;
|
QStringList args;
|
||||||
@@ -641,12 +657,13 @@ static QStringList split_arg_list(QString params)
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QStringList split_value_list(const QString &vals, bool do_semicolon=false)
|
QStringList ProFileEvaluator::Private::split_value_list(const QString &vals, bool do_semicolon)
|
||||||
{
|
{
|
||||||
QString build;
|
QString build;
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
QStack<char> quote;
|
QStack<char> quote;
|
||||||
|
|
||||||
|
const ushort SPACE = ' ';
|
||||||
const ushort LPAREN = '(';
|
const ushort LPAREN = '(';
|
||||||
const ushort RPAREN = ')';
|
const ushort RPAREN = ')';
|
||||||
const ushort SINGLEQUOTE = '\'';
|
const ushort SINGLEQUOTE = '\'';
|
||||||
@@ -673,7 +690,7 @@ static QStringList split_value_list(const QString &vals, bool do_semicolon=false
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!parens && quote.isEmpty() && ((do_semicolon && unicode == SEMICOLON) ||
|
if (!parens && quote.isEmpty() && ((do_semicolon && unicode == SEMICOLON) ||
|
||||||
vals_data[x] == ProFileEvaluator::Option::field_sep)) {
|
vals_data[x] == SPACE)) {
|
||||||
ret << build;
|
ret << build;
|
||||||
build.clear();
|
build.clear();
|
||||||
} else {
|
} else {
|
||||||
@@ -1046,14 +1063,14 @@ ProItem::ProItemReturn ProFileEvaluator::Private::visitProFunction(ProFunction *
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static QStringList qmake_mkspec_paths()
|
QStringList ProFileEvaluator::Private::qmakeMkspecPaths() const
|
||||||
{
|
{
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
const QString concat = QDir::separator() + QString(QLatin1String("mkspecs"));
|
const QString concat = QDir::separator() + QString(QLatin1String("mkspecs"));
|
||||||
QByteArray qmakepath = qgetenv("QMAKEPATH");
|
QByteArray qmakepath = qgetenv("QMAKEPATH");
|
||||||
if (!qmakepath.isEmpty()) {
|
if (!qmakepath.isEmpty()) {
|
||||||
const QStringList lst = QString::fromLocal8Bit(qmakepath)
|
const QStringList lst = QString::fromLocal8Bit(qmakepath)
|
||||||
.split(ProFileEvaluator::Option::dirlist_sep);
|
.split(m_option->dirlist_sep);
|
||||||
for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
|
for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
|
||||||
ret << ((*it) + concat);
|
ret << ((*it) + concat);
|
||||||
}
|
}
|
||||||
@@ -1062,7 +1079,7 @@ static QStringList qmake_mkspec_paths()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ProFileEvaluator::Private::qmakeFeaturePaths()
|
QStringList ProFileEvaluator::Private::qmakeFeaturePaths() const
|
||||||
{
|
{
|
||||||
QStringList concat;
|
QStringList concat;
|
||||||
{
|
{
|
||||||
@@ -1079,15 +1096,15 @@ QStringList ProFileEvaluator::Private::qmakeFeaturePaths()
|
|||||||
QStringList feature_roots;
|
QStringList feature_roots;
|
||||||
QByteArray mkspec_path = qgetenv("QMAKEFEATURES");
|
QByteArray mkspec_path = qgetenv("QMAKEFEATURES");
|
||||||
if (!mkspec_path.isNull())
|
if (!mkspec_path.isNull())
|
||||||
feature_roots += QString::fromLocal8Bit(mkspec_path).split(Option::dirlist_sep);
|
feature_roots += QString::fromLocal8Bit(mkspec_path).split(m_option->dirlist_sep);
|
||||||
/*
|
/*
|
||||||
if (prop)
|
if (prop)
|
||||||
feature_roots += prop->value("QMAKEFEATURES").split(Option::dirlist_sep);
|
feature_roots += prop->value("QMAKEFEATURES").split(m_option->dirlist_sep);
|
||||||
if (!Option::mkfile::cachefile.isEmpty()) {
|
if (!m_option->mkfile::cachefile.isEmpty()) {
|
||||||
QString path;
|
QString path;
|
||||||
int last_slash = Option::mkfile::cachefile.lastIndexOf(Option::dir_sep);
|
int last_slash = m_option->mkfile::cachefile.lastIndexOf(m_option->dir_sep);
|
||||||
if (last_slash != -1)
|
if (last_slash != -1)
|
||||||
path = fixPathToLocalOS(Option::mkfile::cachefile.left(last_slash));
|
path = fixPathToLocalOS(m_option->mkfile::cachefile.left(last_slash));
|
||||||
foreach (const QString &concat_it, concat)
|
foreach (const QString &concat_it, concat)
|
||||||
feature_roots << (path + concat_it);
|
feature_roots << (path + concat_it);
|
||||||
}
|
}
|
||||||
@@ -1095,16 +1112,16 @@ QStringList ProFileEvaluator::Private::qmakeFeaturePaths()
|
|||||||
|
|
||||||
QByteArray qmakepath = qgetenv("QMAKEPATH");
|
QByteArray qmakepath = qgetenv("QMAKEPATH");
|
||||||
if (!qmakepath.isNull()) {
|
if (!qmakepath.isNull()) {
|
||||||
const QStringList lst = QString::fromLocal8Bit(qmakepath).split(Option::dirlist_sep);
|
const QStringList lst = QString::fromLocal8Bit(qmakepath).split(m_option->dirlist_sep);
|
||||||
foreach (const QString &item, lst) {
|
foreach (const QString &item, lst) {
|
||||||
foreach (const QString &concat_it, concat)
|
foreach (const QString &concat_it, concat)
|
||||||
feature_roots << (item + mkspecs_concat + concat_it);
|
feature_roots << (item + mkspecs_concat + concat_it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (!Option::mkfile::qmakespec.isEmpty())
|
//if (!m_option->mkfile::qmakespec.isEmpty())
|
||||||
// feature_roots << Option::mkfile::qmakespec + QDir::separator() + "features";
|
// feature_roots << m_option->mkfile::qmakespec + QDir::separator() + "features";
|
||||||
//if (!Option::mkfile::qmakespec.isEmpty()) {
|
//if (!m_option->mkfile::qmakespec.isEmpty()) {
|
||||||
// QFileInfo specfi(Option::mkfile::qmakespec);
|
// QFileInfo specfi(m_option->mkfile::qmakespec);
|
||||||
// QDir specdir(specfi.absoluteFilePath());
|
// QDir specdir(specfi.absoluteFilePath());
|
||||||
// while (!specdir.isRoot()) {
|
// while (!specdir.isRoot()) {
|
||||||
// if (!specdir.cdUp() || specdir.isRoot())
|
// if (!specdir.cdUp() || specdir.isRoot())
|
||||||
@@ -1152,7 +1169,7 @@ QString ProFileEvaluator::Private::propertyValue(const QString &name) const
|
|||||||
if (name == QLatin1String("QT_INSTALL_DEMOS"))
|
if (name == QLatin1String("QT_INSTALL_DEMOS"))
|
||||||
return QLibraryInfo::location(QLibraryInfo::DemosPath);
|
return QLibraryInfo::location(QLibraryInfo::DemosPath);
|
||||||
if (name == QLatin1String("QMAKE_MKSPECS"))
|
if (name == QLatin1String("QMAKE_MKSPECS"))
|
||||||
return qmake_mkspec_paths().join(Option::dirlist_sep);
|
return qmakeMkspecPaths().join(m_option->dirlist_sep);
|
||||||
if (name == QLatin1String("QMAKE_VERSION"))
|
if (name == QLatin1String("QMAKE_VERSION"))
|
||||||
return QLatin1String("1.0"); //### FIXME
|
return QLatin1String("1.0"); //### FIXME
|
||||||
//return qmake_version();
|
//return qmake_version();
|
||||||
@@ -1186,7 +1203,7 @@ QString ProFileEvaluator::Private::currentDirectory() const
|
|||||||
|
|
||||||
void ProFileEvaluator::Private::doVariableReplace(QString *str)
|
void ProFileEvaluator::Private::doVariableReplace(QString *str)
|
||||||
{
|
{
|
||||||
*str = expandVariableReferences(*str).join(QString(Option::field_sep));
|
*str = expandVariableReferences(*str).join(Option::field_sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &str)
|
QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &str)
|
||||||
@@ -1311,7 +1328,7 @@ QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &s
|
|||||||
current = str.left(start_var);
|
current = str.left(start_var);
|
||||||
if (!replacement.isEmpty()) {
|
if (!replacement.isEmpty()) {
|
||||||
if (quote) {
|
if (quote) {
|
||||||
current += replacement.join(QString(Option::field_sep));
|
current += replacement.join(Option::field_sep);
|
||||||
} else {
|
} else {
|
||||||
current += replacement.takeFirst();
|
current += replacement.takeFirst();
|
||||||
if (!replacement.isEmpty()) {
|
if (!replacement.isEmpty()) {
|
||||||
@@ -1377,28 +1394,28 @@ bool ProFileEvaluator::Private::isActiveConfig(const QString &config, bool regex
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// mkspecs
|
// mkspecs
|
||||||
if ((Option::target_mode == Option::TARG_MACX_MODE
|
if ((m_option->target_mode == m_option->TARG_MACX_MODE
|
||||||
|| Option::target_mode == Option::TARG_QNX6_MODE
|
|| m_option->target_mode == m_option->TARG_QNX6_MODE
|
||||||
|| Option::target_mode == Option::TARG_UNIX_MODE)
|
|| m_option->target_mode == m_option->TARG_UNIX_MODE)
|
||||||
&& config == QLatin1String("unix"))
|
&& config == QLatin1String("unix"))
|
||||||
return true;
|
return true;
|
||||||
if (Option::target_mode == Option::TARG_MACX_MODE && config == QLatin1String("macx"))
|
if (m_option->target_mode == m_option->TARG_MACX_MODE && config == QLatin1String("macx"))
|
||||||
return true;
|
return true;
|
||||||
if (Option::target_mode == Option::TARG_QNX6_MODE && config == QLatin1String("qnx6"))
|
if (m_option->target_mode == m_option->TARG_QNX6_MODE && config == QLatin1String("qnx6"))
|
||||||
return true;
|
return true;
|
||||||
if (Option::target_mode == Option::TARG_MAC9_MODE && config == QLatin1String("mac9"))
|
if (m_option->target_mode == m_option->TARG_MAC9_MODE && config == QLatin1String("mac9"))
|
||||||
return true;
|
return true;
|
||||||
if ((Option::target_mode == Option::TARG_MAC9_MODE
|
if ((m_option->target_mode == m_option->TARG_MAC9_MODE
|
||||||
|| Option::target_mode == Option::TARG_MACX_MODE)
|
|| m_option->target_mode == m_option->TARG_MACX_MODE)
|
||||||
&& config == QLatin1String("mac"))
|
&& config == QLatin1String("mac"))
|
||||||
return true;
|
return true;
|
||||||
if (Option::target_mode == Option::TARG_WIN_MODE && config == QLatin1String("win32"))
|
if (m_option->target_mode == m_option->TARG_WIN_MODE && config == QLatin1String("win32"))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (regex) {
|
if (regex) {
|
||||||
QRegExp re(config, Qt::CaseSensitive, QRegExp::Wildcard);
|
QRegExp re(config, Qt::CaseSensitive, QRegExp::Wildcard);
|
||||||
|
|
||||||
if (re.exactMatch(Option::qmakespec))
|
if (re.exactMatch(m_option->qmakespec))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// CONFIG variable
|
// CONFIG variable
|
||||||
@@ -1408,7 +1425,7 @@ bool ProFileEvaluator::Private::isActiveConfig(const QString &config, bool regex
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// mkspecs
|
// mkspecs
|
||||||
if (Option::qmakespec == config)
|
if (m_option->qmakespec == config)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// CONFIG variable
|
// CONFIG variable
|
||||||
@@ -1578,7 +1595,7 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun
|
|||||||
if (args.count() != 2) {
|
if (args.count() != 2) {
|
||||||
q->logMessage(format("split(var, sep) requires one or two arguments"));
|
q->logMessage(format("split(var, sep) requires one or two arguments"));
|
||||||
} else {
|
} else {
|
||||||
const QString &sep = (args.count() == 2) ? args[1] : QString(Option::field_sep);
|
const QString &sep = (args.count() == 2) ? args[1] : Option::field_sep;
|
||||||
foreach (const QString &var, values(args.first()))
|
foreach (const QString &var, values(args.first()))
|
||||||
foreach (const QString &splt, var.split(sep))
|
foreach (const QString &splt, var.split(sep))
|
||||||
ret.append(splt);
|
ret.append(splt);
|
||||||
@@ -1827,7 +1844,7 @@ QStringList ProFileEvaluator::Private::evaluateExpandFunction(const QString &fun
|
|||||||
const QRegExp regex(r, Qt::CaseSensitive, QRegExp::Wildcard);
|
const QRegExp regex(r, Qt::CaseSensitive, QRegExp::Wildcard);
|
||||||
for (int d = 0; d < dirs.count(); d++) {
|
for (int d = 0; d < dirs.count(); d++) {
|
||||||
QString dir = dirs[d];
|
QString dir = dirs[d];
|
||||||
if (!dir.isEmpty() && !dir.endsWith(Option::dir_sep))
|
if (!dir.isEmpty() && !dir.endsWith(m_option->dir_sep))
|
||||||
dir += QLatin1Char('/');
|
dir += QLatin1Char('/');
|
||||||
|
|
||||||
QDir qdir(dir);
|
QDir qdir(dir);
|
||||||
@@ -2239,7 +2256,7 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
|
|||||||
q->logMessage(format("%1(variable, value) requires two arguments.").arg(function));
|
q->logMessage(format("%1(variable, value) requires two arguments.").arg(function));
|
||||||
return ProItem::ReturnFalse;
|
return ProItem::ReturnFalse;
|
||||||
}
|
}
|
||||||
QString rhs(args[1]), lhs(values(args[0]).join(QString(Option::field_sep)));
|
QString rhs(args[1]), lhs(values(args[0]).join(Option::field_sep));
|
||||||
bool ok;
|
bool ok;
|
||||||
int rhs_int = rhs.toInt(&ok);
|
int rhs_int = rhs.toInt(&ok);
|
||||||
if (ok) { // do integer compare
|
if (ok) { // do integer compare
|
||||||
@@ -2259,7 +2276,7 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
|
|||||||
q->logMessage(format("%1(variable, value) requires two arguments.").arg(function));
|
q->logMessage(format("%1(variable, value) requires two arguments.").arg(function));
|
||||||
return ProItem::ReturnFalse;
|
return ProItem::ReturnFalse;
|
||||||
}
|
}
|
||||||
return returnBool(values(args[0]).join(QString(Option::field_sep)) == args[1]);
|
return returnBool(values(args[0]).join(Option::field_sep) == args[1]);
|
||||||
case T_CLEAR: {
|
case T_CLEAR: {
|
||||||
if (m_skipLevel && !m_cumulative)
|
if (m_skipLevel && !m_cumulative)
|
||||||
return ProItem::ReturnFalse;
|
return ProItem::ReturnFalse;
|
||||||
@@ -2370,7 +2387,7 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
|
|||||||
}
|
}
|
||||||
//regular expression I guess
|
//regular expression I guess
|
||||||
QString dirstr = currentDirectory();
|
QString dirstr = currentDirectory();
|
||||||
int slsh = file.lastIndexOf(Option::dir_sep);
|
int slsh = file.lastIndexOf(m_option->dir_sep);
|
||||||
if (slsh != -1) {
|
if (slsh != -1) {
|
||||||
dirstr = file.left(slsh+1);
|
dirstr = file.left(slsh+1);
|
||||||
file = file.right(file.length() - slsh - 1);
|
file = file.right(file.length() - slsh - 1);
|
||||||
@@ -2406,9 +2423,9 @@ QStringList ProFileEvaluator::Private::values(const QString &variableName,
|
|||||||
variableName == QLatin1String("IN_PWD"))
|
variableName == QLatin1String("IN_PWD"))
|
||||||
return QStringList(currentDirectory());
|
return QStringList(currentDirectory());
|
||||||
if (variableName == QLatin1String("DIR_SEPARATOR"))
|
if (variableName == QLatin1String("DIR_SEPARATOR"))
|
||||||
return QStringList(Option::dir_sep);
|
return QStringList(m_option->dir_sep);
|
||||||
if (variableName == QLatin1String("DIRLIST_SEPARATOR"))
|
if (variableName == QLatin1String("DIRLIST_SEPARATOR"))
|
||||||
return QStringList(Option::dirlist_sep);
|
return QStringList(m_option->dirlist_sep);
|
||||||
if (variableName == QLatin1String("_LINE_")) //parser line number
|
if (variableName == QLatin1String("_LINE_")) //parser line number
|
||||||
return QStringList(QString::number(m_lineNo));
|
return QStringList(QString::number(m_lineNo));
|
||||||
if (variableName == QLatin1String("_FILE_")) //parser file; qmake is a bit weird here
|
if (variableName == QLatin1String("_FILE_")) //parser file; qmake is a bit weird here
|
||||||
@@ -2499,7 +2516,7 @@ QStringList ProFileEvaluator::Private::values(const QString &variableName,
|
|||||||
if (variableName == QLatin1String("TEMPLATE")) {
|
if (variableName == QLatin1String("TEMPLATE")) {
|
||||||
result.append(QLatin1String("app"));
|
result.append(QLatin1String("app"));
|
||||||
} else if (variableName == QLatin1String("QMAKE_DIR_SEP")) {
|
} else if (variableName == QLatin1String("QMAKE_DIR_SEP")) {
|
||||||
result.append(Option::dirlist_sep);
|
result.append(m_option->dirlist_sep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -2583,10 +2600,9 @@ QString ProFileEvaluator::Private::format(const char *fmt) const
|
|||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ProFileEvaluator::ProFileEvaluator()
|
ProFileEvaluator::ProFileEvaluator(ProFileEvaluator::Option *option)
|
||||||
: d(new Private(this))
|
: d(new Private(this, option))
|
||||||
{
|
{
|
||||||
Option::init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProFileEvaluator::~ProFileEvaluator()
|
ProFileEvaluator::~ProFileEvaluator()
|
||||||
|
|||||||
@@ -47,45 +47,35 @@ public:
|
|||||||
// This struct is from qmake, but we are not using everything.
|
// This struct is from qmake, but we are not using everything.
|
||||||
struct Option
|
struct Option
|
||||||
{
|
{
|
||||||
|
Option();
|
||||||
|
|
||||||
//simply global convenience
|
//simply global convenience
|
||||||
//static QString libtool_ext;
|
//QString libtool_ext;
|
||||||
//static QString pkgcfg_ext;
|
//QString pkgcfg_ext;
|
||||||
//static QString prf_ext;
|
//QString prf_ext;
|
||||||
//static QString prl_ext;
|
//QString prl_ext;
|
||||||
//static QString ui_ext;
|
//QString ui_ext;
|
||||||
//static QStringList h_ext;
|
//QStringList h_ext;
|
||||||
//static QStringList cpp_ext;
|
//QStringList cpp_ext;
|
||||||
//static QString h_moc_ext;
|
//QString h_moc_ext;
|
||||||
//static QString cpp_moc_ext;
|
//QString cpp_moc_ext;
|
||||||
//static QString obj_ext;
|
//QString obj_ext;
|
||||||
//static QString lex_ext;
|
//QString lex_ext;
|
||||||
//static QString yacc_ext;
|
//QString yacc_ext;
|
||||||
//static QString h_moc_mod;
|
//QString h_moc_mod;
|
||||||
//static QString cpp_moc_mod;
|
//QString cpp_moc_mod;
|
||||||
//static QString lex_mod;
|
//QString lex_mod;
|
||||||
//static QString yacc_mod;
|
//QString yacc_mod;
|
||||||
static QString dir_sep;
|
QString dir_sep;
|
||||||
static QString dirlist_sep;
|
QString dirlist_sep;
|
||||||
static QString qmakespec;
|
QString qmakespec;
|
||||||
static QChar field_sep;
|
|
||||||
|
|
||||||
enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE, TARG_QNX6_MODE };
|
enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE, TARG_QNX6_MODE };
|
||||||
static TARG_MODE target_mode;
|
TARG_MODE target_mode;
|
||||||
//static QString pro_ext;
|
//QString pro_ext;
|
||||||
//static QString res_ext;
|
//QString res_ext;
|
||||||
|
|
||||||
static void init()
|
static QString field_sep; // Just a cache for quick construction
|
||||||
{
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
dirlist_sep = QLatin1Char(';');
|
|
||||||
dir_sep = QLatin1Char('\\');
|
|
||||||
#else
|
|
||||||
dirlist_sep = QLatin1Char(':');
|
|
||||||
dir_sep = QLatin1Char('/');
|
|
||||||
#endif
|
|
||||||
qmakespec = QString::fromLatin1(qgetenv("QMAKESPEC").data());
|
|
||||||
field_sep = QLatin1Char(' ');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TemplateType {
|
enum TemplateType {
|
||||||
@@ -96,7 +86,7 @@ public:
|
|||||||
TT_Subdirs
|
TT_Subdirs
|
||||||
};
|
};
|
||||||
|
|
||||||
ProFileEvaluator();
|
ProFileEvaluator(Option *option);
|
||||||
virtual ~ProFileEvaluator();
|
virtual ~ProFileEvaluator();
|
||||||
|
|
||||||
ProFileEvaluator::TemplateType templateType();
|
ProFileEvaluator::TemplateType templateType();
|
||||||
|
|||||||
Reference in New Issue
Block a user